input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
# Copyright 2016 NOKIA
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
#... | |
dbname}
if args['psql_host'] is not None: query_args['host'] = args['psql_host']
if args['psql_password'] is not None: query_args['password'] = args['psql_password']
con = psycopg2.connect(**query_args)
cur = con.cursor()
# Query on ventilation data
cur.execute('SET search_path to ' + schema_name)
query = """
... | |
__main__ module to make an exe file.
if not self.__writingModule('__main__'):
message = "Can't generate an executable without a __main__ module."
raise Exception(message)
if self.platform.startswith('win'):
modext = '.pyd'
else:
modext = '.so'
# First gather up the strings and code for all the module names, a... | |
self._split_groups(np.array(X))
preds = model.predict((X_markers, X_grouping))
return preds
def fit(
self,
params: Dict[str, Any],
X: "npt.ArrayLike",
y: "npt.ArrayLike",
individuals: Optional["npt.ArrayLike"] = None,
grouping: Optional["npt.ArrayLike"] = None,
sample_weights: Optional["npt.ArrayLike"] = Non... | |
summary.strip().split(".")[-1].replace(" ", "") + ";"
else:
summary = summary.strip().replace(".prototype", "")
if "Array." in summary and "(" in summary:
funcall = summary.strip().split("Array")[1].split("(")[0].replace(" ", "").strip()
funarg = summary.strip().split("(")[1]
callab... | |
os.path.join(os.path.dirname(path), newlabel)
# try:
# dobjs = TakeSnapshots([path,])
# os.rename(path, newpath)
# editOk = True
# if dobjs:
# self.RefreshView(dobjs)
# except OSError:
# editOk = False # TODO: notify user of error
return editOk
def DoShowMenu(self, item):
"""Show context menu"""
logge... | |
0.00000000051 * mu.cost(0.11390643300 + 17402.33328172660 * x)
L1 += 0.00000000065 * mu.cost(1.03099992649 + 4106.40549114620 * x)
L1 += 0.00000000060 * mu.cost(1.00159365247 + 151.89728108520 * x)
L1 += 0.00000000050 * mu.cost(3.84651247899 + 45494.58142974879 * x)
L1 += 0.00000000047 * mu.cost(3.03959709242 + 540... | |
{"Human": None}, {"Human": {"id": {"new_id"}}}
)
self.assertEqual(
expected_error_message,
str(e.exception),
)
def test_field_renaming_in_interfaces(self) -> None:
with self.assertRaises(NotImplementedError):
rename_schema(
parse(ISS.multiple_interfaces_schema), {}, {"Character": {"id": {"new_id"}}}
)
with ... | |
#region Information
#endregion
#region Module Imports
import bpy
import bmesh
import random
from mathutils import Vector, Matrix
from math import sqrt
from bpy.props import *
from bpy.types import (Panel,Menu,Operator,PropertyGroup)
from .. modules.spatial import measure
#endregion
#region Operators
class BYGEN_OT_Scat... | |
self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form = super(MarkDistributionCreate, self).get_form(**kwargs)
form.fields['class_name'].widget.attrs = {'class': 'basic-multiple'}
form.fields['subject_name'].wid... | |
#
# Copyright (c) 2015, <NAME> <<EMAIL>>
# Pypsi - https://github.com/ameily/pypsi
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS... | |
isinstance(validations, dict):
raise TypeError('validations is required to be a dict. type: {1} was passed.'.format(type(validations)))
if not isinstance(property_name, six.string_types):
raise TypeError("property_key must be a string. type: {0} was passed.".format(type(property_name)))
# reorder validates puttin... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 6 10:49:07 2019
@author: chrisbartel
"""
import os
from mlstabilitytest.stability.CompositionAnalysis import CompositionAnalysis
from mlstabilitytest.stability.HullAnalysis import AnalyzeHull
from mlstabilitytest.mp_data.data import Ef, mp_LiMnTMO,... | |
'zh': u('\u5b89\u5fbd\u7701\u516d\u5b89\u5e02')},
'86180563':{'en': 'Xuancheng, Anhui', 'zh': u('\u5b89\u5fbd\u7701\u5ba3\u57ce\u5e02')},
'86180560':{'en': 'Hefei, Anhui', 'zh': u('\u5b89\u5fbd\u7701\u5408\u80a5\u5e02')},
'86180561':{'en': '<NAME>', 'zh': u('\u5b89\u5fbd\u7701\u6dee\u5317\u5e02')},
'861811466':{'en... | |
expect_ec=ts4_expect_ec)
def M_getInfo(self, _answer_id=0, ts4_private_key=None, ts4_expect_ec=0, ts4_is_debot=False):
"""
Wrapper for D4Cert.getInfo method call
:param _answer_id: uint32
"""
_r_ = self.C_.call_method('getInfo', {'_answer_id': _answer_id}, private_key=ts4_private_key, expect_ec=ts4_expect_ec, is... | |
from __future__ import absolute_import
import re
import os
import time
import zlib
import math
import struct
import threading
import colorsys
from functools import partial
import sublime
import sublime_plugin
from .settings import Settings, SettingTogglerCommandMixin
from .colorizer import SchemaColorizer, all_names... | |
Listeners=[{"Protocol": "http", "LoadBalancerPort": 80, "InstancePort": 8080}],
AvailabilityZones=["us-east-1a", "us-east-1b"],
)
client.register_instances_with_load_balancer(
LoadBalancerName="my-lb",
Instances=[{"InstanceId": instance_id1}, {"InstanceId": instance_id2}],
)
balancer = client.describe_load_balan... | |
= int(self.widgets[self.iname + "_opd_i"].GetValue())
self.inst.pupilopd = (self.inst._datapath + os.sep + "OPD" + os.sep + self.opd_name, self.opd_i) # filename, slice
self.log("Selected OPD is " + str(self.opd_name))
if self.iname + "_coron" in self.widgets:
self.inst.image_mask = self.widgets[self.iname + "_co... | |
the obvious (and
default) choice is 0.5.
:param tuner: Which tuner to use for balancing?
:raises RuntimeError: Lock is not on line.
"""
status = await self.get_lock_status()
if not status == LockStatus.ON_LINE:
raise RuntimeError("Lock is {}. Refusing to balance.".format(status))
imbalance = await self._lockbo... | |
<filename>CV/Effective Transformer-based Solution for RSNA Intracranial Hemorrhage Detection/easymia/model/brain_intracranial_hemorrhage_clas/swin_transformers_update.py
# -*-coding utf-8 -*-
##########################################################################
#
# Copyright (c) 2022 Baidu.com, Inc. All Rights Res... | |
value
return
row = self.append(value)
for i, key in enumerate(self.key_on):
row[key] = item[i]
def normalize_row(self, row):
if row is None:
values = [None for i in range(len(self.row_columns))]
elif isinstance(row, (dict, SeabornRow)):
values = [row.get(k, None) for k in self.row_columns]
elif not isinstan... | |
ofname_id, doc_current,
researches, comments, for_rmis=None, rmis_data=None, vich_code=''):
#импорт для получения прайса и цены по услугам
from forms import forms_func
if rmis_data is None:
rmis_data = {}
researches_grouped_by_lab = [] # Лист с выбранными исследованиями по лабораториям
i = 0
result = {"r": Fa... | |
#!/usr/bin/env python
"""
###############################################
Filter Module Component Specific Work Book View
###############################################
"""
# -*- coding: utf-8 -*-
#
# rtk.hardware.gui.gtk.Filter.py is part of The RTK Project
#
# All rights reserved.
# Copyright 2007 - 2017 <NAME> and... | |
<reponame>figlerg/network_tracing
import hashlib
import os
import pickle
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import FormatStrFormatter
import matplotlib as mpl
from globals import *
from net import Net
from tqdm import tqdm
import cycler
import random
random.s... | |
x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
ExchangeID = property(_xmdapi.CTORATstpSecurityStatusField_ExchangeID_get, _xmdapi.CTORATstpSecurityStatusField_ExchangeID_set)
SecurityID = property(_xmdapi.CTORATstpSecurityStatusField_SecurityID_get, _xmdapi.CTORATstpSecuri... | |
<filename>PyMRFLSSVM/Batch_MRF_Helpers.py
# -*- coding: utf-8 -*-
__author__ = 'spacegoing'
from CyInf.WllepGraphCut import Inf_Algo
from MrfTypes import Example, Options
import numpy as np
import scipy as sp
def phi_helper(ex, label_inferred, latent_inferred, options):
'''
:param ex:
:type ex: Example
:param op... | |
<filename>imperative/python/test/unit/random/test_rng.py
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the Lice... | |
Set exit code integer (default: 23)
:param quiet: Quiet mode, if True no console output (default: False)
:return: IPv4 address string (example: '192.168.1.254') or None in case of error
"""
if interface_name in self._network_interfaces_settings.keys():
if self._network_interfaces_settings[interface_name]['ipv4-gat... | |
<reponame>tIoImIcIaItI/linux-server-configuration<gh_stars>0
import logging
import sys
import json
import random
import string
import httplib2
import requests
from flask import Flask, flash, jsonify, make_response, redirect, \
render_template, request, session as login_session, url_for
from oauth2client.client import ... | |
from typing import Union, List
import copy
import math
import numpy as np
"""
Principles:
- geometry objects are defined by the minimum required information
- Points are made of coordinates (floats), everything else is based on Points except for Vectors
"""
class Point:
def __init__(self, x: float, y: float, z: ... | |
"""
Routines for the analysis of proton radiographs. These routines can be broadly
classified as either creating synthetic radiographs from prescribed fields or
methods of 'inverting' experimentally created radiographs to reconstruct the
original fields (under some set of assumptions).
"""
__all__ = [
"SyntheticProto... | |
"""
Common tests shared by test_str, test_unicode, test_userstring and test_string.
"""
import unittest, string, sys, struct
from test import test_support
from UserList import UserList
class Sequence:
def __init__(self, seq='wxyz'): self.seq = seq
def __len__(self): return len(self.seq)
def __getitem__(self, i): r... | |
" + str(desc_count) + " where hm_uuid = '" + parent_id + "'")
dbConn.commit()
return r_val
#an organ
elif entity_type == 'SAMPLE' and anc_entity_type == 'DONOR':
if isBlank(organ_code):
return Response("An id can't be created for a SAMPLE because the immediate ancestor is a DONOR and the SAMPLE was not supplied w... | |
import sys
import os
cwd=os.getcwd()
work_dir = os.path.join(cwd,'benchmarks')
# os.chdir(work_dir)
sys.path.append(work_dir)
import tensorflow as tf
import benchmark_cnn
from config import Options
from utils import *
from model_builder import Model_Builder
import numpy as np
import random
import math
import copy
... | |
# -*- coding: utf-8 -*-
"""
Usage :
> python bsgs_dll_secp256k1.py -p <KEY> -b 2B_bPfile.bin -bl 2B_bloom.bin -n 500000000000000 -keyspace 800000000000000000000000000000:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -rand
> python bsgs_dll_secp256k1.py -p <KEY> -b 2B_bPfile.bin -bl 2B_bloom.bin -n 500000000000000 -rand1
@aut... | |
import numpy as np
import sys
import time
from sklearn.model_selection import RepeatedKFold
from sklearn.model_selection import GroupKFold
from sklearn.base import BaseEstimator
from scipy.linalg import cholesky, solve_triangular
from sklearn.metrics.pairwise import euclidean_distances
from sklearn.decomposition import... | |
+ ['port:eth101/1/32'], hostname=hn101)
aggregator.assert_metric(metric_name, value=0.0, tags=tags101 + ['port:eth101/1/33'], hostname=hn101)
aggregator.assert_metric(metric_name, value=0.0, tags=tags101 + ['port:eth101/1/34'], hostname=hn101)
aggregator.assert_metric(metric_name, value=0.0, tags=tags101 + ['port:et... | |
from .comment_bridge import CommentBridge
from PIL import Image, ImageDraw, ImageFont
from matplotlib.pyplot import imshow
import numpy as np
import cv2
from typing import List, Dict
import random
import os
import shutil
import random as r
from pydub import AudioSegment
import moviepy.editor as mpe
from enum import Int... | |
mock.Mock()
mock_api.endpoint_url = None
self.deployment_inst = api._Deployment(mock_api)
self.deployment_config = copy.deepcopy(FAKE_DEPLOYMENT_CONFIG)
self.deployment_uuid = "599bdf1d-fe77-461a-a810-d59b1490f4e3"
creds = copy.deepcopy(FAKE_DEPLOYMENT_CONFIG)["creds"]
admin_credential = creds["openstack"]
admin... | |
import termii_switch
import termii_token
import termii_insight
class Client:
"""
Creates a termi client using the api_key
...
Attributes:
api_key: str
The termii developer API Key to create a client from.
Methods:
fetch_sender_ids: A method to request new termii sender ID.
request_sender_id: A method to re... | |
see lines 3273-3281 in calendrica-3.0.cl
def aberration(tee):
"""Return the aberration at moment, tee."""
c = julian_centuries(tee)
return ((deg(mpf(0.0000974)) *
cosine_degrees(deg(mpf(177.63)) + deg(mpf(35999.01848)) * c)) -
deg(mpf(0.005575)))
# see lines 3283-3295 in calendrica-3.0.cl
def solar_longitude_afte... | |
import numpy as np
from PIL import Image
import torch
import torchvision
from torchvision import transforms
import torchvision.models as models
from torchvision.datasets import ImageFolder
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader... | |
self.SetUseTabs(False)
self.SetMargins(2, 2)
self.SetMarginWidth(1, 1)
def setCmdKeys(self):
self.CmdKeyAssign(ord("="), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
self.CmdKeyAssign(ord("-"), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)
def setStyle(self):
self.SetLexer(wx.stc.STC_LEX_CONTAINER)
self.SetStyleBits(5)... | |
M N P Q R S T V W X Y Z""",
)
mat = SubsMat.SeqMat(MatrixInfo.blosum80)
self.assertEqual(len(mat), 276)
self.checkMatrix(
mat,
"""\
A 5
B -2 4
C -1 -4 9
D -2 4 -4 6
E -1 1 -5 1 6
F -3 -4 -3 -4 -4 6
G 0 -1 -4 -2 -3 -4 6
H -2 -1 -4 -2 0 -2 -3 8
I -2 -4 -2 -4 -4 -1 -5 -4 5
K -1 -1 -4 -1 1 -4 -2 -1 -3 5
L -2 -4 -2 -5... | |
from sqlalchemy import Column, String, DECIMAL, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.dialects.mysql import LONGTEXT
all_tables = ['ASHAREBALANCESHEET', 'ASHARECAPITALIZATION', 'ASHARECASHFLOW', 'ASHAREDESCRIPTION', 'ASHAREDIVIDEND', 'ASHAREFINANCIALINDICATOR', 'ASHAREFREEF... | |
pass
# Exit a parse tree produced by SQLParser#cacheKeyList.
def exitCacheKeyList(self, ctx:SQLParser.CacheKeyListContext):
pass
# Enter a parse tree produced by SQLParser#keyUsageElement.
def enterKeyUsageElement(self, ctx:SQLParser.KeyUsageElementContext):
pass
# Exit a parse tree produced by SQLParser#key... | |
#!/usr/bin/env python
# coding: utf-8
"""
Classifiers implemented:
* Decision tree: See http://en.wikipedia.org/wiki/Decision_tree_learning
* Naive Bayes: See http://en.wikipedia.org/wiki/Naive_Bayes_classifier
* K-Nearest Neighbor: See http://en.wikipedia.org/wiki/K-nearest_neighbor
"""
import numpy
from collecti... | |
ofilename = None
if os.path.exists(wdir):
old_wdir=advance_kwargs.pop('wdir')
cluster = load_cluster(
ctype=cluster.ctype,units=cluster.units_init,origin=cluster.origin_init,orbit=orbit,filename=filename,load_function=load_function,wdir=wdir,ofilename=ofilename,**advance_kwargs
)
if cluster.ntot != 0.0:
# Ad... | |
<filename>nilearn/input_data/nifti_spheres_masker.py
"""
Transformer for computing seeds signals
----------------------------------------
Mask nifti images by spherical volumes for seed-region analyses
"""
import numpy as np
import warnings
from sklearn import neighbors
from joblib import Memory
from scipy import spar... | |
#!/usr/bin/env python
# Copyright 2018 <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-2.0
#
# Unless required by applicable law or agreed to... | |
# rambutan.py
# Contact: <NAME>
# <EMAIL>
import os, numpy, pandas
try:
from sklearn.metrics import roc_auc_score
except:
roc_auc_score = 'acc'
from joblib import Parallel, delayed
from .io import TrainingGenerator, ValidationGenerator
from .utils import bedgraph_to_dense, fasta_to_dense
from .utils import encode... | |
"cli:handler")
):
# No population for target language nodes.
pass
elif ctx.xml.is_node_with_attr(_xml_sub_node, "cli:menu", "@name") and ctx.xml.is_node(xml_node, "cli:cli"):
# Do not populate menus which are defined at the cli level.
pass
elif ctx.xml.is_node_with_attr(_xml_sub_node, "cli:tag", "@ref"):
... | |
<reponame>pabs3/oci-python-sdk<filename>src/oci/identity/models/domain.py
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache Lice... | |
@0x24> pop eax; ret
0x0020: 0x3 arg0
0x0024: 0x10000007 pop eax; ret
0x0028: 0x77 [arg0] eax = SYS_sigreturn
0x002c: 0x10000000 int 0x80
0x0030: 0x0 gs
0x0034: 0x0 fs
0x0038: 0x0 es
0x003c: 0x0 ds
0x0040: 0x0 edi
0x0044: 0x0 esi
0x0048: 0x0 ebp
0x004c: 0x0 esp
0x0050: 0x4 ebx
0x0054: 0x6 edx
0x0058: 0x5 ... | |
<filename>network.py
import os
import numpy as np
import tensorflow as tf
from utils.data_reader import H5DataLoader
from utils.img_utils import imsave
from utils import ops_param as ops
import scipy
import time
import pickle
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import confusion_matrix... | |
Appendix C (Paul Grove) or Borkowski, K.M.,
# "Accurate Algorithms to Transform Geocentric to Geodetic Coordinates", Bull. Geod. 63, pp.50 - 56, 1989.
k1 = np.sqrt(1 - ecc_o ** 2) * abs(r_eb_e[2, 0])
k2 = (ecc_o ** 2) * R_0
beta = np.sqrt(r_eb_e[0, 0] ** 2 + r_eb_e[1, 0] ** 2)
e_term = (k1 - k2) / beta
f_term = (... | |
<filename>apero/plotting/plot_functions.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# CODE NAME HERE
# CODE DESCRIPTION HERE
Created on 2019-10-03 at 10:51
@author: cook
"""
import numpy as np
from astropy import constants as cc
from astropy import units as uu
import copy
import os
import warnings
from ape... | |
<filename>utils/extract_utility.py
"""Contains classes for running and working with extracts.
Classes:
ExtractObject
ValidateObject
MergeObject
FeatureExtractTool
FeatureMergeObject
Also contains misc. related functions
"""
import sys
import os
import errno
import warnings
import time
from numpy import isnan
i... | |
if j == 0:
(art,) = axes.plot(fitx_, fity, "-b", label=label)
else:
(art,) = axes.plot(fitx_, fity, "-b")
if i == 0:
(art,) = axes.plot(
Knorm_bin_edges[j, i][:-1],
spe_cts_all[j, i],
"o",
label=str(time_steps[j]) + " ms",
)
else:
(art,) = axes.plot(
Knorm_bin_edges[j, i][:-1],
spe_cts_all[j, i],
"o",
... | |
import re
import math
import torch
import torchaudio
import numpy as np
import argparse
import librosa
import warnings
import itertools as it
from jiwer import wer
from tqdm import tqdm
import pandas as pd
import os
try:
from flashlight.lib.sequence.criterion import CpuViterbiPath, get_data_ptr_as_bytes
from flashli... | |
<gh_stars>1-10
#coding:utf-8
#
# id: bugs.core_0461
# title: JOIN including a complex view kills the server
# decription:
# NB: all versions of 2.1 and 2.5 fail on 2nd query (issue 2002-jul-12) with message about
# "too many contexts, max = 256" so this test checks only FB 3.0 and above.
#
# tracker_id: CORE-0461
# m... | |
pix_size(*args):
"""pix_size(self) -> int"""
return _cv.CvMatrix_pix_size(*args)
def data(*args):
"""
data(self) -> uchar
data(self) -> uchar
"""
return _cv.CvMatrix_data(*args)
def step(*args):
"""step(self) -> int"""
return _cv.CvMatrix_step(*args)
def set_data(*args):
"""
set_data(self, void data, i... | |
<filename>feature_generation/seq2seq/seq2seq.py
"""
This file implements a RNN encoder-decoder model (also known as sequence-to-sequence models).
We made the choice not to implement an attention mechanism (which means that the decoder is allowed to have a 'peak' at the input).
The reason why is because we are not tryi... | |
# ===============================================================================
# Copyright 2012 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | |
and
returns them in form of a :class:`pandas.DataFrame` or a
:class:`numpy.ndarray`.
The mechanistic model is solved for the provided parameters and times,
and samples around this solution are drawn from the error models for
each time point.
The number of samples for each time point can be specified with
``n_s... | |
from dataclasses import dataclass, field
from enum import Enum
from typing import List, Optional
from xsdata.models.datatype import XmlDateTime, XmlDuration
from siri.siri.siri_requests_v2_0 import (
AbstractCapabilitiesStructure,
AbstractFunctionalServiceRequestStructure,
AbstractIdentifiedItemStructure,
AbstractR... | |
import itertools
from collections import defaultdict, deque
from .common import fail, warn
from .dataflow import DFNode
from .errors import Errors, Warnings
from .graph import Graph
from .latency import get_latency
from .irvisitor import IRVisitor
from .ir import *
from .irhelper import has_exclusive_function
from .la... | |
# coding: utf8
########################################################################
# #
# Control law : tau = P(q*-q^) + D(v*-v^) + tau_ff #
# #
########################################################################
from matplotlib import pyplot as plt
import pinocchio as pin
import numpy as np
import numpy.ma... | |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '7i97.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, Q... | |
[1, 1, 1, 1, 1] the zScore must be 0.0
result[i] = 0.0
else:
result[i] = (arr[i] - _avg) / _sd
return result
def _min(arr1, arr2):
bc = len(arr1)
result = np.full(bc, nan)
for i in range(bc):
if isfinite(arr1[i]) and isfinite(arr2[i]):
if arr1[i] < arr2[i]:
result[i] = arr1[i]
else:
result[i] = arr2[i]... | |
<reponame>scrambler-crypto/pyecsca
"""
This module provides an `ECTester <https://github.com/crocs-muni/ECTester/>`_ target class.
"""
from abc import ABC
from binascii import hexlify
from enum import IntEnum, IntFlag
from functools import reduce
from math import ceil, log
from operator import or_
from typing import Op... | |
#!/usr/bin/env python3
# vim: sta:et:sw=4:ts=4:sts=4
"""
NAME
fermi_helper.py - Build and run Fermi HEP workflow using Docker/Singularity
SYNOPSIS
python3 fermi_helper.py build-docker-image [--tag TAG]
[--only-dependencies] [--pull-dependencies TAG] [--decaf-root ROOT]
[--decaf-repo REPO] [--decaf-repo-branch BRAN... | |
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.0952683,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 1.71596,
'... | |
is not None:
result['allowedMulti'] = self.allowed_multi
if self.approval_type is not None:
result['approvalType'] = self.approval_type
if self.approval_method is not None:
result['approvalMethod'] = self.approval_method
if self.actor_activate_type is not None:
result['actorActivateType'] = self.actor_activate_t... | |
fieldsets = (
('Details', {
'classes': ('collapse',),
'fields': ('resultid',
'xlocation',
'xlocationunitsid',
'ylocation',
'ylocationunitsid',
'spatialreferenceid',
'intendedzspacing',
'intendedzspacingunitsid',
'intendedtimespacing',
'intendedtimespacingunitsid',
'aggregationstatisticcv',
)
}),
)
ext... | |
9, 10, 11, 12],
dtype=dtypes.float32,
shape=[2, 2, 3])
float_graph_def.node.extend([a_constant])
b_constant = quantize_graph.create_constant_node(
b_constant_name,
value=[13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
dtype=dtypes.float32,
shape=[2, 2, 3])
float_graph_def.node.extend([b_constant])
concat_no... | |
oprot.writeBinary(iter13)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.e is not None:
oprot.writeFieldBegin('e', TType.STRUCT, 1)
self.e.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for ke... | |
1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0
1.0
1.0 1.0 1.0 1.0 1.0
1.0 1.0
1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0
Element: 189
Faces:
-1 -1 -1 -1 -1 -1
Nodes:
204 212 205 213 300 308 301 309
Scale factors:
1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0
1.0 1.0 1.0... | |
<filename>qPyMultiThread.py
# -*- coding=iso-8859-1 -*-
# Copyright 2019 Qualys Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | |
param.Parameter(default=None, doc="""
Ticks along x-axis specified as an integer, explicit list of
tick locations or bokeh Ticker object. If set to None default
bokeh ticking behavior is applied.""")
yticks = param.Parameter(default=None, doc="""
Ticks along y-axis specified as an integer, explicit list of
tick ... | |
import pytest
from adlib27.autodiff import AutoDiff as AD
import numpy as np
# Testing the getters and setters
def test_getters():
x = AD(val=[10])
value = x.val
derivative = x.der
assert value == pytest.approx([10], rel=1e-4)
for d in derivative:
assert d == pytest.approx([1])
def test_setters():
x = AD(val=... | |
'', 'title': '', 'genre': ''}
logging.debug("Getting metadata")
args = list(GLOBAL_SETTINGS['ffmpeg-flags'])
args.extend(['-i', path, '-f', 'ffmetadata', '-'])
process = subprocess.Popen(args, stdout=subprocess.PIPE)
output = process.communicate()
data = output[0].splitlines()
data.sort()
for l in data:
inf... | |
0.002215 seconds
timeseries = sorted(timeseries, key=lambda x: x[0])
if debug_logging:
current_logger.debug('debug :: %s :: time series of length - %s' % (
algorithm_name, str(len(timeseries))))
# Testing the data to ensure it meets minimum requirements, in the case
# of Skyline's use of the m66 algorithm this m... | |
#!/usr/bin/env python3
from dataknead import Knead
from facetool import config, media, util
from facetool.constants import *
from facetool.path import Path
from facetool.profiler import Profiler
from facetool.errors import ArgumentError
from facetool.util import message, force_mkdir, sample_remove, is_json_path
from r... | |
== 2
self.ilasm.store(link.target.inputargs[1])
else:
# the exception value is on the stack, store it in the proper place
if isinstance(link.last_exception, flowmodel.Variable):
self.ilasm.emit(jvmgen.DUP)
self.ilasm.store(link.last_exc_value)
fld = self.db.lltype_to_cts(rclass.OBJECT).lookup_field('meta')
self... | |
to use the admin shortcut view.
"""
model_ctype = ContentType.objects.get_for_model(ModelWithStringPrimaryKey)
obj = ModelWithStringPrimaryKey.objects.create(string_pk='foo')
shortcut_url = reverse('admin:view_on_site', args=(model_ctype.pk, obj.pk))
# Not logged in: we should see the login page.
response = self... | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import re
import sys
from collections import defaultdict
import torch
import torch.optim as optim
from torch.optim import optimizer, lbfgs, adagrad, adadelta, rmsprop
from trident.backend.common i... | |
Suess+19, but this
can be tuned depending on the use. Each annulus is 1 PSF FWHM wide.'''
# make sure the catalog photometry is good for this object
if self.flag != 1:
print('Could not calculate photometry for '+str(self.id)+', flag = '+str(self.flag))
return -99
# make cutouts of the of the data, weight ... | |
# -*- coding: utf-8 -*-
"""
Script to perform nuisance regression and timeseries extraction on CBS data
USAGE: python3 nuisRegr.py [--mask] folder
The script first lists all functional runs for which we have EPI data
and truncated confounds file. Then it applies
nilearn's NiftiMasker to each which calls signal.clean ... | |
ATL Disdik SMPN 3 Halong',
'proxy': True,
'verbose_name_plural': '07 Harga ATL Disdik SMPN 3 Halong',
},
bases=('atl.hargaatl',),
),
migrations.CreateModel(
name='HargaATLDisdikSMPN3Paringin',
fields=[
],
options={
'verbose_name': '07 Harga ATL Disdik SMPN 3 Paringin',
'proxy': True,
'verbose_name_plural':... | |
<gh_stars>0
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Base test case class for coverage.py testing."""
import contextlib
import datetime
import difflib
import glob
import os
import os.path
import random... | |
<filename>setupmeta/model.py
"""
Model of our view on how setup.py + files in a project can come together
"""
import inspect
import io
import os
import re
import sys
import setuptools
import setupmeta.versioning
from setupmeta import listify, MetaDefs, project_path, relative_path, short, temp_resource, trace
from se... | |
str(r['x1']) + " y: " + str(r['y1']) + " w: " + str(r['width']) + " h: " + str(r['height'])
if len(r['intersections']) == 0:
txt += " " + _("No intersections")
else:
txt += "\n" + _("Count of intersections: ") + str(len(r['intersections'])) + "\n"
txt += str(r['intersections']) + " " + _("Total: ") + str(sum(r['in... | |
import json
import logging
import os
import sys
from dataclasses import dataclass, field
from typing import Callable, Dict, List, Optional, Tuple
from collections import defaultdict
import numpy as np
import torch
from seq2seq_trainer import Seq2SeqTrainer
from transformers import (
AutoConfig,
AutoModelForSeq2SeqL... | |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 25 17:11:46 2020
@author: Mahdi
"""
from airsim_client import *
from DQN_model import DQNModel
import time
import numpy as np
import json
import os
import datetime
import sys
import copy
import pandas as pd
# A class that represents the agent that ... | |
amp_norm --- do a normalization for variable amplitude. usefull when tranfer function of the cryostat is not flat
'''
if ('bounds' in keywords):
bounds = keywords['bounds']
else:
#define default bounds
print("default bounds used")
bounds = ([np.min(x),100,.01,-np.pi,0,-np.inf,-np.inf,np.min(x)],[np.max(x),20000... | |
to identify the type
Returns:
List of Asset code already defined into the PI Server
Raises:
"""
payload = payload_builder.PayloadBuilder() \
.WHERE(['configuration_key', '=', configuration_key]) \
.AND_WHERE(['type_id', '=', type_id]) \
.payload()
omf_created_objects = self._sending_process_instance._storage.... | |
# -*- coding: utf-8 -*-
import copy
import os
from django.contrib import auth
from django.contrib.auth.models import User
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models import QuerySet
from django.test import TestCase, Client, mock
from django.urls import reverse
from ..forms imp... | |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
HidrowebDownloader
A QGIS plugin
Download hydrological data from ANA's API (Hidroweb)
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
-------------------
begin : 2021-03-27
git sh... | |
Constraint(expr=m.x1036*(8.00892516581441 + m.x2097) - m.x3474 == 0)
m.c1037 = Constraint(expr=m.x1037*(97.3173040663597 + m.x2098) - m.x3475 == 0)
m.c1038 = Constraint(expr=m.x1038*(58.8520674314227 + m.x2099) - m.x3476 == 0)
m.c1039 = Constraint(expr=m.x1039*(89.3791992560023 + m.x2100) - m.x3477 == 0)
m.c1040 = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.