input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<gh_stars>1-10
# Authors: <NAME>, <NAME>, <NAME>
# Scientific Ancestry: <NAME>, <NAME>, <NAME>
import math
import numbers
import numpy as np
import torch
from .backend import (fft1d_c2c, ifft1d_c2c, modulus_complex, pad, real,
subsample_fourier, unpad)
from .filter_bank import (calibrate_scattering_filters,
scatter... | |
}],
"fields": [
"Catalog No.", "Context"
]
}
db0_2_extracted = {
"artifacts": [{
"Catalog No.": "2351a6824/1 Type IIa",
"Context": "Feature 28"
}, {
"Catalog No.": "2351a6824/1 Type IIa",
"Context": "Feature 28"
}, {
"Catalog No.": "2351a6824/1 Type IVa",
"Context": "Feature 28"
}],
"fields": [
"Catalog... | |
inp = '''100'''
fmt = '''(B7.0)'''
result = [4]
eds, rev_eds = _parser(_lexer(fmt))
self.assertEqual(result, _input(eds, rev_eds, inp))
@attr(platform='9-1_linux_intel')
@attr('input')
@attr(ed='B')
def test_b_ed_input_281(self):
inp = '''-100'''
fmt = '''(B7.0)'''
result = ['''ERR''']
eds, rev_eds = _pars... | |
""" PointNet++ Layers
Original Author: <NAME>
Modified by <NAME>
Date: April 2019
"""
import os
import sys
import pointnet
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'utils'))
sys.path.append(os.path.join(ROOT_DIR, 'tf_ops/samplin... | |
<gh_stars>0
# For controlling experiments for the ion trap lab led by Prof. <NAME>
# The code is written by <NAME>, School of Physical Sciences, USTC
# Last updated: April 29th, 2019
from PyQt5 import QtWidgets, QtCore, QtGui
# import pylint
from Ui_SubExperiment import Ui_SubExperiment_Dialog
import sys
impor... | |
# -*- coding: utf-8 -*-
import functools
import os
from anima.env.mayaEnv.animation import Animation
from anima.env.mayaEnv.general import General
from anima.env.mayaEnv.modeling import Modeling
from anima.env.mayaEnv.previs import Previs
from anima.env.mayaEnv.reference import Reference
from anima.env.mayaEnv.render... | |
<filename>modules/database.py
from re import M
import sqlite3
import os
from PyQt5.QtWidgets import QFileDialog
from datetime import datetime, timedelta
import psutil
import time
from PyQt5.QtCore import QThread, QUrl
from PyQt5 import QtWidgets
from modules.show_logs import ShowLogs
from modules.settings import Setti... | |
"""
本文件包含所有字符串算法
"""
# 给定两个字符串形式的非负整数num1 和num2,计算它们的和。
#
#
#
# 提示:
#
# num1 和num2的长度都小于 5100
# num1 和num2 都只包含数字 0-9
# num1 和num2 都不包含任何前导零
# 你不能使用任何內建 BigInteger 库,也不能直接将输入的字符串转换为整数形式
import networkx as nx
def Reverse(s:str) -> str:
"""
字符串逆
:param s:
:return:
"""
num = len(s)
ans = ""
for i in range(num-1,... | |
self.Final_Features= ['SLCDPU_Surface_Supplies', 'Dell_Streamflow', 'Lambs_Streamflow',
'SLCDPU_GW_Initial', 'Mtn_Dell_Percent_Full_Initial']
self.Final_FeaturesDF = self.Col_Check_feat[self.Final_Features]
if self.targ=='SLCDPU_GW':
self.Final_FeaturesDF = self.Col_Check_feat[self.Final_Features]
if self.targ =... | |
1],
[1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0],
[1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1... | |
'''
mode: <NAME>
<EMAIL>
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from model.faster_rcnn.faster_rcnn import _fasterRCNN
import pdb
input_size=[480, 640]
width_mult = 1.
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# class FrozenBatchNorm2d(nn.Mod... | |
<reponame>olliemath/pypy
# -*- coding: utf-8 -*-
"""
RPython implementation of MD5 checksums.
See also the pure Python implementation in lib_pypy/md5.py, which might
or might not be faster than this one on top of CPython.
This is an implementation of the MD5 hash function,
as specified by RFC 1321. It was implemented... | |
#!/usr/bin/env python
# Copyright 2012-2013 inBloom, Inc. and its affiliates.
#
# 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... | |
a temporary local table will be created. The parameter 'schema'
must be empty, otherwise this parameter is ignored.
gen_tmp_table_name: bool, optional
Sets the name of the temporary table. This parameter is only used when the
parameter 'temporary_local_table' is set to True and if the parameters
"table_name" and ... | |
of actions: RuleEmailAction and RuleWebhookAction.
Expected value is 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction'.
"""
return pulumi.get(self, "odata_type")
@property
@pulumi.getter(name="customEmails")
def custom_emails(self) -> Optional[Sequence[str]]:
"""
the list of administrator's custom e... | |
self.license_type is not None and vm_dict['properties'].get('licenseType') != self.license_type:
differences.append('License Type')
changed = True
# Defaults for boot diagnostics
if 'diagnosticsProfile' not in vm_dict['properties']:
vm_dict['properties']['diagnosticsProfile'] = {}
if 'bootDiagnostics' not in vm_... | |
from python_helper import SettingHelper, StringHelper, Constant, log, EnvironmentHelper, ObjectHelper, Test
LOG_HELPER_SETTINGS = {
log.LOG : False,
log.SUCCESS : True,
log.SETTING : True,
log.DEBUG : True,
log.WARNING : True,
log.WRAPPER : True,
log.FAILURE : True,
log.ERROR : True,
log.TEST : False
}
@Test... | |
<reponame>VedaAnnayappa/pypowervm<filename>pypowervm/wrappers/managed_system.py
# Copyright 2014, 2018 IBM Corp.
#
# 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
#
# h... | |
<filename>NetPacket/Tool/GenerateRequest.py
# -*- coding: UTF-8 -*-
import os
import sys
import yaml
from netpacket import common
def write_net_header():
write_content = "\n"
write_content += "enum ENetHeader\n"
write_content += "{\n"
write_content += " ENetHeader_None = 0,\n"
for net_header in net_header_list... | |
get the first 12 characters
return unique_id
def create_targets_file(targets, file_name):
"""
Creates a targets file, containing the targets separated by new line characters
"""
with open(file_name, 'w') as fw:
for target in targets:
fw.write('{}\n'.format(target))
return
def create_number_of_targets_file(dru... | |
#!/usr/bin/env python
"""
Until the 18 Apr 2017 there is no version of abcpmc that allows for np.random seeds within multiprocessing processes!
The alternative astroABC that can handle this. One simple workaround is to set the np.seed(...) within the function that has to be called.
"""
from __future__ import divisio... | |
def getZSize(self):
"""getZSize(self) -> vpl::tSize"""
return _Volume.swig_base_FVolume_getZSize(self)
def width(self):
"""width(self) -> vpl::tSize"""
return _Volume.swig_base_FVolume_width(self)
def height(self):
"""height(self) -> vpl::tSize"""
return _Volume.swig_base_FVolume_height(self)
def depth(s... | |
<gh_stars>0
"""
GPT model:
- the initial stem consists of a combination of token encoding and a positional encoding
- the meat of it is a uniform sequence of Transformer blocks
- each Transformer is a sequential combination of a 1-hidden-layer MLP block and a self-attention block
- all blocks feed into a central resi... | |
"""
Augmenters that are based on applying convolution kernels to images.
Do not import directly from this file, as the categorization is not final.
Use instead ::
from imgaug import augmenters as iaa
and then e.g. ::
seq = iaa.Sequential([
iaa.Sharpen((0.0, 1.0)),
iaa.Emboss((0.0, 1.0))
])
List of augmenters:... | |
2, 0, 0, 0, 1))].cells[cgraph.family_id]
atomic_cross_edge_dict = cgraph.get_atomic_cross_edge_dict(to_label(cgraph, 2, 0, 0, 0, 1))
column = column_keys.Hierarchy.Child
children = column.deserialize(row[column.key][0].value)
for aces in atomic_cross_edge_dict.values():
assert len(aces) == 0
assert len(childre... | |
beta):
# post-jump parameters
q = parameters.copy()
# transition probability
qxy = 0
npsr = len(psr)
pct = 0
if not args.fixRed:
if args.redSpecModel == 'powerlaw':
pct = 2*npsr
elif args.redSpecModel == 'spectrum':
pct = npsr*nmodes_red
if args.incDM and not args.fixDM:
if args.dmSpecModel == 'powerla... | |
<reponame>wwongkamjan/dipnet_press
# ==============================================================================
# Copyright 2019 - <NAME>
#
# NOTICE: 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 ... | |
)
)
self.is_serving = True
self.server.serve_forever()
self.logger.info("stopped serving")
def __del__(self):
self.shutdown()
def shutdown(self):
if self.is_serving:
self.logger.info("Shutting down bridge")
self.is_serving = False
self.server.shutdown()
self.server.server_close()
class BridgeClient(obje... | |
# -*- coding: UTF-8 -*-
# Copyright (c) 2007 - 2014, <NAME>
# See COPYING for distribution information.
"""
vmm.cli.subcommands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vmm's cli subcommands.
"""
from gettext import gettext as _
import locale
import platform
from argparse import (
Action,
ArgumentParser,
ArgumentTyp... | |
by individual i. -1 if they never became infectious
time_documented (n vector): time step when each individual became a documented case, 0 if never documented
time_to_activation (n vector): incubation time drawn for this individual, 0 if no time drawn
time_to_death (n vector): time-to-event for critical -> death for... | |
""""
Title : Input fpwb
Written by: <NAME>
Date : 18/11/19
Language : Python
Aeronautical Institute of Technology
Inputs:
MTOW
Outputs:
Cap_Sal
FO_Sal
"""
########################################################################################
"""Importing Modules"""
##############################################... | |
#
# -------------------------------------------------------------------------
# Copyright (c) 2015-2017 AT&T Intellectual Property
# Copyright (C) 2020 Wipro Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a... | |
# Copyright (c) 2018-2019 <NAME>
# Copyright (c) 2021 RACOM s.r.o.
# SPDX-License-Identifier: MIT
from contextlib import suppress
from typing import IO, Any, Dict, Iterator, Optional, Tuple, Union
from _libyang import ffi, lib
from .util import IOType, c2str, init_output, ly_array_iter, str2c
# --------------------... | |
#!/usr/bin/env python
# coding: utf-8
import geopandas as gpd
import pandas as pd
import numpy as np
from datetime import datetime, timedelta, date
import requests
import json
from rasterstats import point_query
from shapely import geometry as sgeom
import ulmo
from collections import OrderedDict
import math
from rand... | |
"GLU(OE)", r, avg )
if r.isProt and r.type == "GLU" and r.id.position==17 :
avg = (r.atomsMap["OE1"][0].Q + r.atomsMap["OE2"][0].Q)/2.0
addType ( "GLU_17(OE)", r, avg )
if r.isProt and r.type == "GLU" and r.id.position==27 :
avg = (r.atomsMap["OE1"][0].Q + r.atomsMap["OE2"][0].Q)/2.0
addType ( "GLU_27(OE)", r, av... | |
'''
Created on Jan 25, 2011
@author: Mark V Systems Limited
(c) Copyright 2011 Mark V Systems Limited, All rights reserved.
'''
from tkinter import *
try:
from tkinter.ttk import *
_Combobox = ttk.Combobox
except ImportError:
from ttk import *
_Combobox = Combobox
TOPBORDER = 1
LEFTBORDER = 2
RIGHTBORDER = 3
BOTT... | |
<reponame>stanionascu/python-embyapi
# coding: utf-8
"""
Emby Server API
Explore the Emby Server API # noqa: E501
OpenAPI spec version: 4.1.1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class SyncModelSyncJobItem(object):
"""NOTE: T... | |
<filename>hata/backend/subprocess.py<gh_stars>0
# -*- coding: utf-8 -*-
import os, sys, errno
from stat import S_ISCHR, S_ISFIFO, S_ISSOCK
from subprocess import TimeoutExpired, PIPE, Popen
from socket import socketpair as create_socket_pair
from .futures import Task, Future, WaitTillAll, future_or_timeout
from .prot... | |
(tmp2911 if depth6 else tmp2913)
tmp2910 = (tmp2911 if depth5 else tmp2914)
tmp2915 = (tmp2910 if depth4 else tmp2914)
tmp2909 = (tmp2910 if depth3 else tmp2915)
tmp2922 = (tmp2875 if k2 else tmp2884)
tmp2921 = (tmp2922 if k1 else tmp2883)
tmp2920 = (tmp2921 if depth7 else tmp2913)
tmp2919 = (tmp2911 if depth6 e... | |
from __future__ import annotations
from typing import *
import numpy as np
import torch
import torch.optim as optim
from tqdm import tqdm
AnyDeepModel = TypeVar("AnyDeepModel")
AnyOptimizer = TypeVar("AnyOptimizer")
AnyScheduler = TypeVar("AnyScheduler")
AnyDataLoader = TypeVar("AnyDataLoader")
class Metric:
"""Thi... | |
<filename>backup/torchray/extremal_perturbation/multimodal_extremal_perturbation.py<gh_stars>0
from __future__ import division
from __future__ import print_function
import sklearn
from sklearn.utils import check_random_state
import numpy as np
import scipy as sp
import copy
"""
__all__ = [
"extremal_perturbation",
... | |
<= 1940", count*0.81])
tipo_out.append(["M6M",">1920 <= 1940", count*0])
tipo_out.append(["RC3.1M",">1920 <= 1940", count*0])
tipo_out.append(["RC3.2preM", ">1920 <= 1940", count*0])
tipo_out.append(["RC3.1-preM", ">1920 <= 1940", count*0])
tipo_out.append(["RC1.1M", ">1920 <= 1940", count*0])
tipo_out.appe... | |
isinstance(group, ds.Dataset):
raise ValueError("'group' must be an ExeTera DataFrame rather than a"
" top-level Dataset")
else:
raise ValueError("'group' must be an Exetera DataFrame but a "
"{} was passed to it".format(type(group)))
if isinstance(group, h5py.Group):
fld.timestamp_field_constructor(self, group... | |
# See info about the sl2 file format at:
# * https://wiki.openstreetmap.org/wiki/SL2
# * https://github.com/kmpm/node-sl2format/blob/master/doc/sl2fileformat.md
# * https://www.geotech1.com/forums/showthread.php?11159-Lowrance-MCC-saved-data-structure
# * https://github.com/Chris78/sl2decode/blob/master/sl2decode.rb
# ... | |
# Code written by: <NAME> (<EMAIL>)
# <NAME> (<EMAIL>)
"""
This class is a collection of functions for showing data with pymol.
Note that the limit of pymol is 100k monomers, therefore interpolateData is
useful to collapse the 200k-long simulation into a 100k-long conformation.
"""
import os
import tempfile
import sub... | |
<filename>rmgweb/database/views.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# #
# RMG Website - A Django-powered website for Reaction Mechanism Generator #
# #
# Copyright (c) 2011-2018 Prof. <NAME> (<EMAIL>), #
# Prof. <NAME> (<EMAIL... | |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
# External
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow.keras.backend as K
import numpy as np
from dataclasses import dataclass
# Internal
from DeepAttCorr_lib.GAN_3D_lib import layers
# Defaults
CONV_CHANNELS_GEN = 32
CONV_CHANNELS_DISC... | |
#
# QE.py
#
# Interface to Quantum ESPRESSO (http://www.quantum-espresso.org)
#
# Copyright (c) 2014-2020 <NAME>
#
# This file is distributed under the terms of the MIT license.
# Please see the file 'LICENCE.txt' in the root directory
# or http://opensource.org/licenses/mit-license.php for information.
#
from __future... | |
<gh_stars>10-100
# Author: Legendnic @ ael
# Title: Combination of GA and CNN
# This code is for template. It is much more better if you
# grasp the idea and change it for your own purpose.
# This is because, I am using fully extensive libraries, which I am
# afraid that it won't work on your computer.
# Thus, I ... | |
"""Debug Plugin for EasyEngine"""
from cement.core.controller import CementBaseController, expose
from cement.core import handler, hook
from ee.core.aptget import EEAptGet
from ee.core.shellexec import *
from ee.core.mysql import EEMysql
from ee.core.services import EEService
from ee.core.logging import Log
from ee.cl... | |
= tf.argmax(output_logits, axis=1)
next_input = tf.nn.embedding_lookup(self._word_embeddings, prediction)
return next_input
elements_finished = (time >= decoder_lengths)
finished = tf.reduce_all(elements_finished) # -> boolean scalar
input = tf.cond(finished, lambda: pad_step_embedded, get_next_input)
state = ... | |
check_if_boundary_type_and_first_timepoint(
mod=mod, tmp=tmp, balancing_type=mod.balancing_type_project[g],
boundary_type="linked"
):
prev_tmp_hrs_in_tmp = mod.hrs_in_linked_tmp[0]
prev_tmp_power = \
mod.gen_commit_cap_linked_power[g, 0]
prev_tmp_upwards_reserves = \
mod.gen_commit_cap_linked_upwards_reserves[g... | |
+ 20.4095513732146*m.x1248 + 17.1635762813129*m.x1249 + 11.3024707056812*m.x1250
+ 43.2216142122513*m.x1251 + 32.1958816363713*m.x1252 + 32.3360185264323*m.x1253
+ 40.0948337980926*m.x1254 + 31.2419451873797*m.x1255 + 31.7822097117694*m.x1256
+ 17.8010470053686*m.x1257 + 42.0764073872544*m.x1258 + 27.0022803136903*m... | |
in tokens])
#@+node:ekr.20191231072039.1: *3* functions: utils...
# General utility functions on tokens and nodes.
#@+node:ekr.20191119085222.1: *4* function: obj_id
def obj_id(obj):
"""Return the last four digits of id(obj), for dumps & traces."""
return str(id(obj))[-4:]
#@+node:ekr.20191231060700.1: *4* funct... | |
+ m.b19 - m.b190 <= 0)
m.c2467 = Constraint(expr= - m.b9 + m.b20 - m.b191 <= 0)
m.c2468 = Constraint(expr= - m.b9 + m.b21 - m.b192 <= 0)
m.c2469 = Constraint(expr= - m.b9 + m.b22 - m.b193 <= 0)
m.c2470 = Constraint(expr= - m.b9 + m.b23 - m.b194 <= 0)
m.c2471 = Constraint(expr= - m.b9 + m.b24 - m.b195 <= 0)
m.c247... | |
import pytz
from django.apps import apps
from django.db.models import F
from guardian.shortcuts import get_objects_for_user
from rest_framework.throttling import UserRateThrottle
from api.addons.views import AddonSettingsMixin
from api.base import permissions as base_permissions
from api.base.waffle_decorators import... | |
'%s'" % row['Input_type'],
badtext=row['Input_type'])
if row['Result_type'] not in VALID_RESULT_TYPES:
error(statefile, "Unknown result type '%s'" % row['Result_type'],
badtext=row['Result_type'])
if no_contd_allowed and row['Input_type'] == 'CONTD':
error(statefile, "CONTD not allowed after state tra... | |
import random as rd
import os
import sys
import numpy as np
import pandas as pd
from prettytable.prettytable import NONE
import spacy as sp
import prettytable as pt
import matplotlib.pyplot as plt
import streamlit as st
# from utilities import R, G, Y, B, N, DARK_GREY, LIGHT_CYAN, HEADER
R = "\033[1;31m" # RED
G = '\03... | |
<filename>src/sharkradar/Util/sharkradarDbutils.py
"""
DB Utils functions for the project
"""
import sys
from os.path import dirname as opd, realpath as opr
import os
import time
import sqlite3
basedir = opd(opd(opd(opr(__file__))))
sys.path.append(basedir)
from sharkradar.Config.Config import Config
def createTable... | |
analysis of accuracy training on "
"most of the data and validating on an unseen subset",
)
add_global_options(train_g2p_parser)
help_message = "Inspect, download, and save pretrained MFA models"
model_parser = subparsers.add_parser(
"model", aliases=["models"], description=help_message, help=help_message
)
mo... | |
# -*- coding: utf-8; py-indent-offset:4 -*-
import datetime as dt
import pandas as pd
from ..utils import datetime_today
from .data_cache import get_all_symbol_name, get_cn_stock_fund_flow_rank, \
get_daily, get_stock_fund_flow_daily, \
get_stock_spot, \
get_index_daily
class Market:
all_symbol_name = {}
watchi... | |
[
expression_1.pk,
wrong_source.pk,
],
}
clustering = self.run_process(
"clustering-hierarchical-genes", inputs, Data.STATUS_ERROR
)
warning_msg = [
"All expression data must be annotated by the same genome database."
]
error_msg = [
(
"Sample 'expression' has 'ENSEMBL' gene IDs, "
"while sample 'wrong so... | |
#!/usr/bin/env python
#
# File: $id$
# @Package: orio
# @version: $keRevision$
# @lastrevision: $Date$
# @modifiedby: $LastChangedBy$
# @lastmodified: $LastChangedDate$
#
# Description: Fortran 2003 parser (supports Fortran 77 and later)
#
# Copyright (c) 2009 UChicago, LLC
# Produced at Argonne National Laboratory
# ... | |
<reponame>jialiuGit/Bayes_GGP<filename>main.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 27 15:22:39 2021
@author: jialiu
Bayesian inference---Gibbs-Metropolise sampling
paras
mu---field mean
Sig -- field covariance
augmented variable of length --r
"""
import numpy as np
from PN_Ba... | |
<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A Basic Card Game Using Flask"""
############
# METADATA #
############
__author__ = "<NAME> <<EMAIL>>"
###########
# IMPORTS #
###########
import base64
import datetime
import functools
import hashlib
import os
import pathlib
import random
import uuid
i... | |
"""
Author: <NAME> <<EMAIL>>
Copyright (c) 2016-2017 University of Oxford, <NAME>
"""
from __future__ import division, unicode_literals, absolute_import, print_function
import sys
import os
import time
import traceback
import re
import tempfile
from PySide2 import QtGui, QtCore, QtWidgets
from quantiphyse.gui.optio... | |
<gh_stars>1-10
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, 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.a... | |
<reponame>intel/neural-compressor
# -*- coding: utf-8 -*-
# Copyright (c) 2022 Intel 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 License at
#
# http://www.apache.org/licenses/LICE... | |
<reponame>geokabi/raspberrypi-dht22<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
#
r"""
Weather Metrics script.
Read Sensor metrics, output to stdout (CSV format) and optionally post them to ThingSpeak.
Logs to syslog but if there is an error it will a... | |
import abc
import warnings
import xml.etree.ElementTree as etree
import pprint
import itertools
from functools import reduce
from typing import Any
from typing import Optional
# from lxml import etree # type: ignore
import networkx as nx
import pydot
# from networkx.drawing.nx_pydot import write_dot # type: ignore
f... | |
name_='uris', pretty_print=pretty_print)
if self.attributes is not None:
self.attributes.export(outfile, level, namespaceprefix_, name_='attributes', pretty_print=pretty_print)
if self.defaultProfile is not None:
self.defaultProfile.export(outfile, level, namespaceprefix_, name_='defaultProfile', pretty_print=prett... | |
size
# if the whole type, and so SIZEOF(Option<Opcode>>) == SIZEOF(Opcode)
is_first_opcode = True
with fmt.indented('pub enum Opcode {', '}'):
for g in groups:
for i in g.instructions:
instrs.append(i)
i.number = len(instrs)
fmt.doc_comment('`{}`. ({})'.format(i, i.format.name))
# Document polymorphism.
if i.... | |
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2019-2022 Xilinx, Inc. All rights reserved.
#
# =============================================================================
# Checks and validates the windows installation environment
# =============================================================================
... | |
the same shape as x.
edges centers first last
e - + - + - e + - + - + - + + - + - + - + + - + - + - +
| . | . | . | | c | . | c | | f | . | . | | . | . | . |
+ _ + _ + _ + + _ + _ + _ + + _ + _ + _ + + _ + _ + _ +
| . | . | . | | . | . | . | | . | . | . | | . | . | . |
+ _ + _ + _ + + _ + _ + _ + + _ + _ + _ + +... | |
<gh_stars>0
# Copyright (c) 2014-2019, <NAME> & <NAME>
# Copyright (c) 2014-2019, <NAME>
# Copyright (c) 2017-2019, <NAME>
# Copyright (c) 2018-2019, <NAME>
# Copyright (c) 2018-2019, <NAME>
# Copyright (c) 2020, <NAME>
# All rights reserved.
import os
import platform
class Toolchain:
def __init__(
self,
name,
ge... | |
ant's head to not touch the ground, it's roll
and pitch cannot be too large"""
#return +1 if z > 0.26 else -1 # 0.25 is central sphere rad, die if it scrapes the ground
alive = roll < np.pi/2 and roll > -np.pi/2 and pitch > -np.pi/2 and pitch < np.pi/2
debugmode = 0
if debugmode:
print("roll, pitch")
print(roll,... | |
self.base_filename
base, ext = os.path.splitext(self.base_filename)
return base + "-v" + self.version + ext
@property
def has_version(self):
"""Determines whether the model has a version."""
return self.version is not None
@property
def comp_version(self):
"""The version of this model expressed as a
`distu... | |
"""
Unit tests for data fields
"""
import unittest
from cellardoor.model import *
from datetime import datetime
import time
class TestAbstractField(unittest.TestCase):
def test_field_abstract(self):
"""
Shouldn't be able to use base Field as a field
"""
field = Field()
self.assertRaises(NotImplementedError, f... | |
# Copyright (C) 2003-2007 <NAME> <<EMAIL>>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any la... | |
<filename>etl/parsers/etw/Microsoft_Windows_Direct3D12.py
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-Direct3D12
GUID : 5d8087dd-3a9b-4f56-90df-49196cdc4f11
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CS... | |
<reponame>suntorvic/tobman
#!/usr/bin/python3
# coding: utf-8
from __future__ import annotations
import discord
from discord.ext import commands
from enum import Enum
import yaml
import re
import sys
import json
import os.path
import urllib, urllib.parse
import datetime
import ics
import io
import asyncio
class Transl... | |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
jinja2.testsuite.filters
~~~~~~~~~~~~~~~~~~~~~~~~
Tests for the jinja filters.
:copyright: (c) 2017 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import random
import pytest
from jinja2 import Markup, Environment
from jinja2._compat import text_type, ... | |
import numpy as np
from .. import processors as pr
from ..abstract import SequentialProcessor, Processor
from ..models import SSD512, SSD300, HaarCascadeDetector
from ..datasets import get_class_names
from .image import AugmentImage, PreprocessImage
from .classification import MiniXceptionFER
from .keypoints import F... | |
<reponame>CAMeL-Lab/gender-reinflection
#!/usr/bin/python
# This file is part of the NUS M2 scorer.
# The NUS M2 scorer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (a... | |
schedule with specifing interval only\n")
return False
return True
def assert_options_valid(args):
if args.logout is not None and (args.server is not None or args.site is not None):
print("Do not use --logout and --server at the same time.")
return False
if args.logout is not None or args.server is not None or... | |
of SVGs to process (total)/Length of cell positional history. Number of samples * sample size step interval provides the index of the final SVG to process
output_plot :
Save plot flag (required to produce a movie from resulting images)
show_plot :
Show plot flag (for processing many images in a loop, this should li... | |
does not exist in quotes DataFrame.")
raise KeyError(f"column {col} does not exist in quotes DataFrame.")
df["__adjusted_quote"] = None
for index, row in df.iterrows():
if np.isnan(row[price_col]) and row[type_col] == type_code:
logging.warning(
f"Could not adjust price at row {index} because it contains no pri... | |
<reponame>mtag-dev/squall
from dataclasses import dataclass
from squall import Body, Cookie, Header, Path, Query, Squall
from squall.testclient import TestClient
app = Squall()
@dataclass
class Item:
data: str
@app.post("/schema_extra")
def schema_extra(item: Item):
return item
@app.post("/example")
def examp... | |
import logging
import json
import pytz
import time
import omise
import requests
from datetime import datetime
from flask import request, jsonify, Blueprint, url_for, redirect
from flask_jwt_extended import current_user
from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
from marshmallow_j... | |
<filename>python/vespa/vespa/package.py
import sys
import http.client
import json
import os
import re
import zipfile
from base64 import standard_b64encode
from datetime import datetime, timedelta
from io import BytesIO
from pathlib import Path
from time import sleep, strftime, gmtime
from typing import List, Mapping, O... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tensorflow as tf
from .inits import glorot, zeros
from .layers import Layer
class AttentionHead(Layer):
"""
One attention head over 1st-order neighbors
Adapted from https://github.com/PetarV-/GAT
"""
def __init__(self, input_dim, attend_head_units, neigh_in... | |
'''
封装部分协助进行LP计算的函数
'''
from shapely.geometry import Polygon,Point,mapping,LineString
from tools.geofunc import GeoFunc
from math import sqrt,acos
import math
bias=0.0000001
class GeometryAssistant(object):
'''
几何相关的算法重新统一
'''
@staticmethod
def getAdjustPts(original_points, first_pt, to_real):
'''部分情况需要根据相对位置调... | |
self ):
selected = self._gallery_importers_listctrl.GetData( only_selected = True )
if len( selected ) != 1:
return False
gallery_import = selected[0]
return gallery_import != self._highlighted_gallery_import
def _CanRetryFailed( self ):
for gallery_import in self._gallery_importers_listctrl.Ge... | |
#!/usr/bin/env python
# Copyright (c) 2016-2018, F5 Networks, 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 appli... | |
<reponame>cheginit/spotpy<filename>spotpy/parameter.py
# -*- coding: utf-8 -*-
'''
Copyright (c) 2015 by <NAME>
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: <NAME> and <NAME>
Contains classes to generate random parameter sets
'''
from __future__ import division, print_function, absolute... | |
BENT',
120861: 'SIGNWRITING HAND-FIST INDEX BENT OVER MIDDLE',
120842: 'SIGNWRITING HAND-FIST INDEX CUPPED',
120843: 'SIGNWRITING HAND-FIST INDEX HINGED',
120844: 'SIGNWRITING HAND-FIST INDEX HINGED LOW',
120852: 'SIGNWRITING HAND-FIST INDEX HINGED MIDDLE UP',
120870: 'SIGNWRITING HAND-FIST INDEX HINGED MIDDLE UP THUMB... | |
<gh_stars>0
# # -*- coding: utf-8 -*-
# import lxml
# from lxml import etree
# class Parser( object ):
# """ Contains functions for preparing solr-data.
# TODO: replace pq extracts with straight lxml or beautifulsoup extracts. """
# def __init__( self, inscription_xml_path, bib_xml_path, log ):
# '''
# - makes lxml... | |
abs value for each row.
Default None to keep everything.
batch (int or None, optional): the batch size for construction.
Default None to use min(dense.shape[0], 10 ** 5).
Returns:
csr_matrix that has topk nnz each row with the same shape as dense.
"""
BATCH_LIMIT = 10 ** 5
if topk is None:
keep_topk = dense... | |
<filename>backstaff/plotting.py
import copy
import numpy as np
import matplotlib as mpl
#mpl.use('agg')
import matplotlib.pyplot as plt
import matplotlib.colors as mpl_colors
import matplotlib.cm as mpl_cm
import matplotlib.animation as animation
import matplotlib.patheffects as path_effects
from mpl_toolkits.mplot3d i... | |
update on channel change
# Assumption - a user won't be in a monitored channel with no voice_state_update for more than a day + the grace period (see update_streak)
await self.update_streak(user_id)
await self.update_roles(member)
@commands.Cog.listener()
async def on_member_join(self, member):
if self.sqlalche... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.