input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
from datetime import datetime
#from sklearn import metrics
from theano import tensor as T
import cPickle
import numpy
import os
import sys
import theano
import time
from collections import defaultdict
import subprocess
import pandas as pd
from tqdm import tqdm
import nn_layers
import sgd_trainer
import warnings
warni... | |
<filename>sumatra/launch.py
"""
The launch module handles launching of simulations/analyses as sub-processes, and
obtaining information about the platform(s) on which the simulations are run.
:copyright: Copyright 2006-2015 by the Sumatra team, see doc/authors.txt
:license: BSD 2-clause, see LICENSE for details.
"""
... | |
slug="not existing"
)
}
}
}
),
(
[
collections.OrderedDict([
("object_type", "Assessment"),
("Code*", ""),
("Assignees", "<EMAIL>"),
("Creators", "<EMAIL>"),
("Title", "Some title"),
("State", "Open")
])
],
{
"Assessment": {
"row_warnings": {
errors.WRONG_VALUE_DEFAULT.format(
line=3,
column_name=... | |
<filename>ate_asc_run.py
from __future__ import absolute_import, division, print_function
import argparse
import logging
import os
import random
import time
import numpy as np
import torch
import torch.nn.functional as F
from file_utils import PYTORCH_PRETRAINED_BERT_CACHE
from ate_asc_modeling import BertForSequence... | |
if 'quiet' not in self.params.keys():
RuntimeUtils.info("Tunnel is %s." % (self.is_tunnel_enabled and 'enabled' or 'disabled'), format=self.params.get('output-format', 'text'))
# Register, if requested
if 'activation-keys' in self.params.keys():
self._do_register_at_sm(force=('override' in self.params.keys()))
... | |
token_pedido_ssr = ""
def ssr_estoque():
return{
"cep_destino": "07929050",
"url": "https://ssr.e-peca.com.br/checkout/pagamento",
"produtos": [
{
"id": "78",
"id_produto_variacao": "78",
"preco_final": 78.99,
"quantidade": 2,
"codigosoriginais": [
"43957-86E",
"43957-86C",
"43957-86B",
"43957-86D",
"4... | |
ConfigurationException(
'Expected training_main_memory_chunksize > training_chunk')
if self.guessing_secondary_training:
if ((not self.secondary_training) or
(not self.secondary_training_save_freqs)):
raise ConfigurationException(
'Expected secondary_training and secondary_training_save_freqs')
if self.sequence... | |
fr.write('\t name = "' + name + '"\n')
fr.write('\t virtual_network_name = "' + vnetname + '"\n')
fr.write('\t resource_group_name = "' + rgs + '"\n')
sprefix=subs[j]["properties"]["addressPrefix"]
fr.write('\t address_prefix = "' + sprefix + '"\n')
rtbid="null"
try:
seps=subs[j]["properties"]["serviceEndpoint... | |
return _gui.GuiPushButton_set_style(self, style)
def get_content_size(self, w, h):
return _gui.GuiPushButton_get_content_size(self, w, h)
def set_roundness(self, roundness):
return _gui.GuiPushButton_set_roundness(self, roundness)
def get_roundness(self):
return _gui.GuiPushButton_get_roundness(self)
def set... | |
<reponame>Stienvdh/statrick
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Dell EMC OpenManage Ansible Modules
# Version 3.0.0
# Copyright (C) 2019-2021 Dell Inc. or its subsidiaries. All Rights Reserved.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
from __future__ i... | |
<filename>src/sage/schemes/elliptic_curves/ell_number_field.py
# -*- coding: utf-8 -*-
r"""
Elliptic curves over number fields
An elliptic curve `E` over a number field `K` can be given
by a Weierstrass equation whose coefficients lie in `K` or by
using ``base_extend`` on an elliptic curve defined over a subfield.
On... | |
new %s[pInStruct->%s];\n' % (m_name, m_type, self.struct_dict[s][m]['array_size'])
#construct_txt += ' std::copy (pInStruct->%s, pInStruct->%s+pInStruct->%s, %s);\n' % (m_name, m_name, self.struct_dict[s][m]['array_size'], m_name)
construct_txt += ' memcpy ((void *)%s, (void *)pInStruct->%s, sizeof(%s)*pInStruct->%s)... | |
ignore_missing:
warnings.warn(
"[GDSPY] Cell {0} not found; operations on this CellArray may not work.".format(
self.ref_cell
),
stacklevel=2,
)
def __str__(self):
if isinstance(self.ref_cell, Cell):
name = self.ref_cell.name
else:
name = self.ref_cell
return 'CellArray ("{0}", {1} x {2}, at ({3[0]}, {3[1]... | |
the hw config 'rngi' and 'rngw' in " + str(self) + " class can't adopt temporal coding simultaneously."
assert self.hwcfg["quantilei"] > 0 and self.hwcfg["quantilei"] <= 1, \
"Error: the hw config 'quantilei' of " + str(self) + " class needs to be within (0, 1]."
assert self.hwcfg["quantilew"] > 0 and self.hwcfg[... | |
<reponame>YileC928/finm-portfolio-2021
"""
Mean models to use with ARCH processes. All mean models must inherit from
:class:`ARCHModel` and provide the same methods with the same inputs.
"""
from __future__ import annotations
import copy
import sys
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
M... | |
# Copyright 2021 Internet Corporation for Assigned Names and Numbers.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# Developed by Sinodun IT (sinodun.com)
#
# Ag... | |
proofctx):
# Note that if var is a proof dummy variable, then
# proofctx.fvvarmap.get(var, None) is just None and
# check_free_in() will return False unless var occurs _explicitly_
# free in term.
return self.check_free_in(var, term, proofctx.fvvarmap.get(var, None))
# match templ, which is an expression in the ... | |
<filename>repcap.py
#repcap.py
#version 1.0
#Python 3
#Requires scapy - tested/developed with 2.4.3
#Project to allow users to modify packet captures and replay them
#Author: <NAME> - <EMAIL>
# Command Line Tool that takes in arguments
# Current version supports 5 modes: passed to tool via -m command
# 0 - the ability ... | |
<filename>src/python/live_plotting.py<gh_stars>0
#!/usr/bin/env python
DEF_RES_PATH = "/home/dimitar/projects/STT_theories/results/APR4"
PREVIUS_FILE_BETA = 0
PREVIUS_FILE_M = 0
PREVIUS_FILE_LAMBDA = 0
#~ DEF_RES_PATH_PREV = "/home/dimitar/projects/STT_theories/results/" \
#~ + "Results_Statia_1/" \
#~ + "beta{:.0... | |
<filename>ShapeStatistics.py
#Purpose: To implement a suite of 3D shape statistics and to use them for point
#cloud classification
#TODO: Fill in all of this code for group assignment 2
import sys
sys.path.append("S3DGLPy")
from Primitives3D import *
from PolyMesh import *
import numpy as np
import matplotlib.pyplot a... | |
<filename>script/geometry.py<gh_stars>0
import collections, os, sys
import numpy as np
import scipy.integrate
from scipy.special import erf, erfc
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from matplotlib.colors import LinearSegmentedColormap
import noise
matplo... | |
from io import BytesIO
from sys import version_info
from unittest import TestCase
from xml.etree import ElementTree
import datetime
import pytest
from pyclarity_lims.constants import nsmap
from pyclarity_lims.descriptors import StringDescriptor, StringAttributeDescriptor, StringListDescriptor, \
StringDictionaryDesc... | |
in group.items() if v is not None})
physical_interface_list.append(physical_interface_dict)
continue
m = p2.match(line)
if m:
group = m.groupdict()
physical_interface_dict.update({k.replace('_','-'):
v for k, v in group.items() if v is not None})
continue
m = p3.match(line)
if m:
group = m.groupdict()
ph... | |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from . import http
import time
from . import util
from . import exceptions
from . import compat
from . import verlib
import re
import json
from xml.etree import ElementTree
from . import signalsmixin
from . import plexobjects
from . import plexresource
fro... | |
this entity from a cached registry
Returns:
Returns either the specified entity, or raises an exception if
none is found
"""
registry_proto = self._get_registry_proto(allow_cache=allow_cache)
for entity_proto in registry_proto.entities:
if entity_proto.spec.name == name and entity_proto.spec.project == project:... | |
# Licensed under an MIT style license -- see LICENSE.md
import numpy as np
from matplotlib import gridspec
from scipy.stats import gaussian_kde
import copy
from pesummary.core.plots.figure import figure
from .corner import hist2d
from pesummary import conf
__author__ = ["<NAME> <<EMAIL>>"]
DEFAULT_LEGEND_KWARGS = {"... | |
'''
this Adapter is designed to wrap the sending and receiving activities of the Battery Management extension if
it is applied.
'''
from tools.singleton import Singleton
import api.ecu_sim_api as api
import copy
from api.core.component_specs import SimpleECUSpec, SimpleBusSpec
from enums.sec_cfg_enum import CAEnum
fr... | |
import os
import datetime
import tempfile
import numpy as np
from simtk import openmm as mm
from simtk import unit
from simtk.openmm.app.pdbfile import PDBFile
from simtk.openmm.app.topology import Topology
import simtk.openmm.app.element as elem
from cg_openmm.simulation.tools import build_mm_simulation
from cg_openmm... | |
"""
return pulumi.get(self, "prefix")
@prefix.setter
def prefix(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "prefix", value)
@property
@pulumi.getter(name="processingConfiguration")
def processing_configuration(self) -> Optional[pulumi.Input['FirehoseDeliveryStreamExtendedS3ConfigurationProcess... | |
user namespace.
Return value: a flag indicating whether the code to be run completed
successfully:
- 0: successful execution.
- 1: an error occurred.
"""
outflag = 1 # start by assuming error, success will reset it
try:
exec code in self.user_ns
outflag = 0
except SystemExit:
self.resetbuffer()
self.tra... | |
# Copyright (c) MONAI Consortium
# 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, softwa... | |
# -*- coding: utf-8 -*-
"""This python module aims to manage
`DokuWiki <https://www.dokuwiki.org/dokuwiki>`_ wikis by using the
provided `XML-RPC API <https://www.dokuwiki.org/devel:xmlrpc>`_. It is
compatible with python2.7 and python3+.
Installation
------------
It is on `PyPi <https://pypi.python.org/pypi/dokuwiki... | |
database change flag and the version number.
self.changed = 1
self.version += 1
# Return the results.
return val
def __remove(self,which,var):
# Special helper function - it assumes the table is already locked. This is
# used in the loading function when a variable needs to be removed.
#
# Do w... | |
<reponame>mlraglin/fury
"""UI container module."""
__all__ = ["Panel2D", "TabPanel2D", "TabUI", "ImageContainer2D",
"GridUI"]
import numpy as np
import vtk
from fury.io import load_image
from fury.ui.core import UI, Rectangle2D, TextBlock2D
from fury.utils import set_input, rotate
from fury.actor import grid
clas... | |
<filename>cmiputil/dds.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Module to parse DDS (Dataset Descriptor Structure) used in OPeNDAP.
DDS
---
For the definition of DDS, see `OpenDAP UserGuide`_.
In this module, we change the notation in the DDS syntax as follows:
| *declarations* := list(*declaration*)
... | |
])
self.ContentionCount = v_uint32()
self.NumberOfSharedWaiters = v_uint16()
self.NumberOfExclusiveWaiters = v_uint16()
self.Address = v_ptr32()
self.SpinLock = v_uint32()
class FILE_NETWORK_OPEN_INFORMATION(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.CreationTime = LA... | |
<reponame>leddartech/pioneer.common<gh_stars>1-10
from pioneer.common import plane, linalg
from pioneer.common.logging_manager import LoggingManager
from numpy.matlib import repmat
import math
import numpy as np
import os
import transforms3d
def grid(v, h, v_from, v_to, h_from, h_to, dtype = np.float32):
'''
Comp... | |
<reponame>usnistgov/OOF3D
# -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# fa... | |
<gh_stars>1-10
#!/usr/bin/env python
import argparse
import itertools
import math
import numpy as np
import random
import torch
import torch.nn as nn
import torch.optim as optim
import pickle as pk
from discriminator import Discriminator
from gan import batch_dataset, train, gen_noise
from generator imp... | |
<reponame>eric11eca/inference-information-probing<filename>jiant/ext/allennlp.py
from typing import Optional
import torch
import torch.nn as nn
# noinspection PyTypeChecker
# noinspection PyUnusedLocal
class SelfAttentiveSpanExtractor(nn.Module):
"""
Computes span representations by generating an unnormalized atte... | |
single word without wrapping it in quotes as an argument
# ex: p.inflect("I plural(see)") instead of p.inflect("I plural('see')")
raise NameError(f"name '{obj.id}' is not defined")
def _string_to_substitute(
self, mo: Match, methods_dict: Dict[str, Callable]
) -> str:
"""
Return the string to be substituted for... | |
<filename>codes/dataloader.py<gh_stars>1-10
#!/usr/bin/python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import torch
from torch.utils.data import Dataset
from utils import *
TIME_TYPE = {'no-time':0, 'point-in-time':1, 'only-begin... | |
<filename>openmdao/jacobians/tests/test_jacobian.py
""" Test the Jacobian objects."""
import itertools
import sys
import unittest
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix
from openmdao.api import IndepVarComp, Group, Problem, \
ExplicitComponent, ImplicitComponent, ExecComp, \
NewtonSolve... | |
import discord
from discord.ext import commands
from cogs.utils import hypixel
from datetime import datetime
import json
import aiohttp
from concurrent.futures import ThreadPoolExecutor
import asyncio
import requests
class staff(commands.Cog, name="Staff"):
def __init__(self, bot):
self.bot = bot
@commands.comman... | |
<reponame>colebrooke/adventure
#!/usr/bin/env python3
#
# "Adventure Game"
#
# This is a text based science fiction themed adventure game, written in Python 3.
# The database back end is created in SQLite3.
#
# Main authors <NAME> and <NAME>.
# Contributions welcome.
#
# Github page: https://github.com/colebrooke/adven... | |
# pylint: disable=missing-function-docstring
"""Tests for '_continuous.py' file"""
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
import scipy.stats.distributions as distrs
from scipy.stats.kde import gaussian_kde
from scipy.integrate import quad
import pytest
from randomvar... | |
__init__(SimTK::Mat<(3,3)> self, double const & e0, double const & e1, double const & e2, double const & e3, double const & e4, double const & e5, double const & e6, double const & e7, double const & e8, double const & e9, double const & e10, double const & e11, double const & e12, double const & e13, double const & e1... | |
= s1.replace('"', '\\"')
if s1.find('\n') == -1:
return '"%s"' % s1
else:
return '"""%s"""' % s1
def get_all_text_(node):
if node.text is not None:
text = node.text
else:
text = ''
for child in node:
if child.tail is not None:
text += child.tail
return text
def find_attr_value_(attr_name, node):
attrs ... | |
= self._estimate_error_norm(self.E1, h, scale)
# reject step if needed
if error_norm > 1:
step_rejected = True
h_abs *= max(MIN_FACTOR, SAFETY*error_norm**self.error_exponent)
continue
# calculate solution
self._rk_stage(h, 6) # stage 6
y_new = y + self.K[:-1].T @ self.B * h
# calculate second error esti... | |
"3": # speed
stat_name = "Speed"
test_bounds = (20, 256)
stat_values = loaddata.non_legendary_ghost_types['speed']
stat_stats = loaddata.non_legendary_ghost_types['speed'].describe()
unit = ''
elif stat_set == "4": # attack
stat_name = "Attack"
test_bounds = (20, 256)
stat_values = loaddata.non_legendary_ghost... | |
cons.idtabla = nodo.idnuevo
consola += "La tabla " + nodo.idactual + \
" se cambio a " + nodo.idnuevo + " exitosamente \n"
elif lib == 1:
listaSemanticos.append(Error.ErrorS(
"Error Semantico", "Error en la operacion."))
elif lib == 2:
listaSemanticos.append(Error.ErrorS(
"Error Semantico", "La base de datos " ... | |
from enum import Enum
import numpy as np
from cvxopt import matrix, solvers
from processing import vector_of_quants
import math
class KnowledgePatternManager:
@staticmethod
def checkConsistency(knowledgePattern):
return KnowledgePatternManager.__getConsistencyChecker(knowledgePattern.type) \
.isConsistent(knowl... | |
<gh_stars>0
# coding=utf-8
import os
import torch
import mpu
import torch.nn.functional as F
from collections import defaultdict
from tokenization_eva import EVATokenizer
class BeamHypotheses(object):
def __init__(self, num_beams, max_length, length_penalty, early_stopping, tokenizer=None):
"""
Initialize n-bes... | |
class TestSequence(Enum):
_init_ = 'sequence'
_order_ = lambda member: member.sequence
item_id = 'An$(1,6)', 0 # Item Code
warehouse_no = 'An$(9,4)', 2 # Warehouse Number
company = 'Hn$(13,6)', 3 # 4 SPACES + COMPANY
company_id = 'An$(7,2)', 1 # Company Code
inv_units = 'Qn$(7,2)', 10 # Inv Units
available = 'Z... | |
121.4*m.x682 == 0)
m.c1643 = Constraint(expr= m.x143 - m.x148 + 728.4*m.x673 + 364.2*m.x678 + 121.4*m.x683 == 0)
m.c1644 = Constraint(expr= m.x144 - m.x149 + 728.4*m.x674 + 364.2*m.x679 + 121.4*m.x684 == 0)
m.c1645 = Constraint(expr= m.x145 - m.x150 + 728.4*m.x675 + 364.2*m.x680 + 121.4*m.x685 == 0)
m.c1646 = Const... | |
'black'
`markerfacecolor` = 'white'
`marker` = 'o',
`markersize` = 4.0.
Returns
-------
:c:`matplotlib.axes.Axes`
The axes that the :a:`nodes` were plotted on.
Examples
--------
>>> # initialize a mesh and plot the nodes
>>> import matplotlib.pyplot as plt
>>> import vcfempy.meshgen
>>> msh = vcfempy.mes... | |
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
"""
* Copyright (C) 2021 <NAME>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above ... | |
<reponame>dkamotsky/addons
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | |
go.layout.Annotation(
text = f'regressor: {self.label}',
x = 0,
y = 2.1,
font = go.layout.annotation.Font(
color = '#5E5E5E',
size = 15,
),
showarrow = False,
xref = 'paper',
yref = 'paper'
)
annotations.append(annotation)"""
# draw vertical line at output value
shape = go.layout.Shape(type='line',
x0=... | |
<filename>Yolo/yolo2_model_base.py
# coding = utf-8
import tensorflow as tf
import tensorflow.contrib.layers as layers
from colorama import Fore
import numpy as np
import random
import Putil.np.util as npu
import Putil.tf.util as tfu
import base.logger as plog
root_logger = plog.PutilLogConfig('yolo2ModelBase').logger... | |
<reponame>maxbeegee/yt
"""
openPMD data structures
"""
# -----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
# Copyright (c) 2015, <NAME> (HZDR)
# Copyright (c) 2016, <NAME> (HZDR)
#
# Distributed under the terms of the Modified BSD License.
#
# Th... | |
<reponame>YoheiN/donkeycar
'''
utils.py
Functions that don't fit anywhere else.
'''
from io import BytesIO
import os
import glob
import socket
import zipfile
import sys
import itertools
import subprocess
import math
import random
import time
from PIL import Image
import numpy as np
'''
IMAGES
'''
def scale(im, siz... | |
m.b148*m.b435 + m.b148*m.b443 + m.b148*m.b445 + m.b148*m.b446 + m.b148*m.b464 + m.b148*m.b479 +
m.b148*m.b489 + m.b148*m.b494 + m.b148*m.b551 + m.b148*m.b564 + m.b148*m.b568 + m.b148*m.b573 +
m.b148*m.b593 + m.b148*m.b598 + m.b148*m.b601 + m.b148*m.b613 + m.b148*m.b620 + m.b148*m.b622 +
m.b148*m.b625 + m.b148*m.b... | |
#!/usr/bin/env python
########################################################################################
########################################################################################
# THIS FILE IS DEPRECATED, USE arm_moveit2.py INSTEAD
#################################################################... | |
:math:`\mathit{h}^2` constrained to ``i / 100``. The values for
``1 <= i <= 99`` are normalized to sum to 1, and ``a[0]`` and ``a[100]``
are set to ``nan``.
Returns
-------
:class:`ndarray` of :obj:`float64`
Normalized likelihood values for :math:`\mathit{h}^2`.
"""
log_lkhd = np.zeros(101, dtype=np.float64)
... | |
})
for item in items:
setResponseTimeLimit()
itemModel.remove(item, progress=progress, **kwargs)
if progress:
progress.update(increment=1, message='Deleted item %s' % item['name'])
# subsequent operations take a long time, so free the cursor's resources
items.close()
# Delete all child folders
folders = self.... | |
import mahjongpy
class MahjongPlayer:
"""
プレイヤーを表すクラス。各プレイヤーの情報などを保持する
Attributes
----------
hands : list
プレイヤーの手牌。MahjongTileのリスト
discards : list
プレイヤーの河。MahjongTileのリスト
melds : list
プレイヤーが鳴いた牌のリストのリスト。
ポン、カン、チーをしたときに3枚または4枚のMahjongTileのリストが追加される。
oya : bool
プレイヤーが親かどうか
points : int
プレイヤーの持ち点
wind :... | |
<reponame>mjc87/SHTOOLS
"""
Functions for reading and writing spherical harmonic coefficients from text
files that are formatted as [degree, order, value].
"""
import os as _os
import io as _io
import gzip as _gzip
import zipfile as _zipfile
import numpy as _np
import requests as _requests
import shutil as _shutil
de... | |
inventory_currentmachinesnapshot as cms on (msaa.machinesnapshot_id = cms.machine_snapshot_id)"
" join inventory_source as s on (cms.source_id = s.id)"
f" {wheres_str}"
" group by aa.id, aa.display_name, aa.version_name, aa.version_code, s.name, s.id"
") select display_name, name_ms_count ms_count,"
"jsonb_agg("
... | |
:param aging: enable aging or not
:type re_c: boolean
:param re_c: recount centers of the circles or not
"""
maps = []
for i in clust:
mapy, _, _, _ = cluster(data,i,level,levels=levels, border = border, aging=False, re_c=False)
maps.append(mapy)
return maps
def update_mg(pay, time, last_t, m, v, p, valu... | |
only, to, training after the moment.
:param model:
:param optimizer:
:param train_queue:
:param valid_queue:
:param args:
:param search_space:
:return: res_dict, best_valids, best_tests from evlutionary search
"""
# merge the evaluation phase inside.
# optimizer = self.optimizer
# scheduler = self.scheduler... | |
<reponame>mkelcb/knet<filename>knet/com/application/logic/knet/knet_manager.py
# -*- coding: utf-8 -*-
#MIT License
#Copyright (c) 2017 <NAME>
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software ... | |
<gh_stars>0
# Copyright (c) 2010-2011 Lazy 8 Studios, LLC.
# All rights reserved.
import hashlib, pkg_resources
from mako import lookup
from front import models
from front.lib import db, xjson, urls, gametime
from front.backend import deferred
from front.data import load_json, schemas, assets
from front.models import ... | |
<gh_stars>10-100
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright 2012-2013, The SAGA Project"
__license__ = "MIT"
""" Attribute interface """
import radical.utils as ru
import radical.utils.signatures as rus
from . import exceptions as se
# ----------------------------------------------------------------... | |
= int(round_up_to_even(number_finger / (fan_factor ** i)) / 2)
dp_num_tot = dp_num_tot + dp_num_half_fan[2 * i] + dp_num_half_fan[2 * i + 1]
dp_num_half_fan.sort()
for i in range(number_fan * 2):
if (i == 0):
dp_index_first_half_fan[i] = 0
dp_index_end_half_fan[i] = dp_num_half_fan[i] - 1
else:
dp_index_first_h... | |
<gh_stars>1-10
import copy
import numpy as np
class MET(object):
"""
MET returns the ID of the resource that executes the current task with the minimum time
"""
def __init__(self, env):
self.env = env
def schedule(self, state):
"""
:param env_storage: data stored in environment
:return scheduled_tasks: Sc... | |
company_id,
customer_payment_journal_id,
if_match=None):
return client.delete_customer_payment_journals(company_id=company_id,
customer_payment_journal_id=customer_payment_journal_id,
if_match=if_match)
def financials_financial_company_delete_dimension(client,
company_id,
dimension_id,
if_match=Non... | |
# constant grid for ROC
fpr_grid = np.linspace(0, 1, num=20)
# get class scores
class_score = PyPLS.predict(self, x=x)
# binery classification
if n_classes == 2:
y_pred = self.predict(x)
accuracy = metrics.accuracy_score(y, y_pred)
precision = metrics.precision_score(y, y_pred)
recall = metrics.recall_score(y... | |
import random
import re
import math
import numpy as np
from src import constants
from src.multi_agent.elements.camera import Camera, CameraRepresentation
from src.my_utils import constant_class
from src.my_utils.my_math.bound import bound_angle_btw_minus_pi_plus_pi, bound
from src.my_utils.my_math.line import distance... | |
: An administrator password that you can use to sign in to the Puppet Enterprise console after the server is online.
- *(dict) --*
A name and value pair that is specific to the engine of the server.
- **Name** *(string) --*
The name of the engine attribute.
- **Value** *(string) --*
The value of the engine ... | |
# Copyright [2018-2022] 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
#
# Unless required by applicable... | |
#
# Copyright (c) 2019 ISP RAS (http://www.ispras.ru)
# Ivannikov Institute for System Programming of the Russian Academy of Sciences
#
# 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:... | |
*args, **kwargs):
return [{"Roles": [{"RoleName": "fake-role-1"}, {"RoleName": "fake-role-2"}]}]
iam_client.get_paginator.return_value = MockPaginator_Roles()
with CaptureStdout() as output:
kwargs = _get_aws_list_assets_kwargs()
iam.list_roles([], argparse.Namespace(**kwargs))
self.assertIn("fake-role-1", output... | |
<gh_stars>0
import networkx as nx
import tapnx as tapnx
import tapnx.utils_graph as utils_graph
#from networkx.algorithms.shortest_paths.weighted import _weight_function
#from networkx.algorithms.shortest_paths.weighted import _dijkstra_multisource
from networkx.algorithms.shortest_paths.generic import _build_paths_fro... | |
def knight_walk_distance(src, dest, board_size = 8):
"""
The first challenge was to:
Compute the number of chess' knight's jumps from src to dest.
The squares of a chess board are enumerated sequentially from
left to right and top to bottom, starting from 0.
src = value for the position of the initial position
... | |
import numpy as np
import numpy.ma as ma
from numpy import linalg as LA
import tsstats
#from numba import jit
from wormtracker import Logger
class WormTrajectoryPostProcessor:
## static properties!
# bad frame settings
filterByWidth = True
filterByLength = True
widthThreshold = (0.7, 1.3)
lengthThreshold = (0.9... | |
the extraction process so we don't end up with a corrupted cache.
tmp_extraction_dir = tempfile.mkdtemp(dir=os.path.split(extraction_path)[0])
try:
if is_zipfile(file_path):
with ZipFile(file_path, "r") as zip_file:
zip_file.extractall(tmp_extraction_dir)
zip_file.close()
else:
tar_file = tarfile.open(file_path... | |
str upload_id: 分片上传ID
:param headers: HTTP头部
:type headers: 可以是dict,建议是oss2.CaseInsensitiveDict
:return: :class:`RequestResult <oss2.models.RequestResult>`
"""
logger.debug("Start to abort multipart upload, bucket: {0}, key: {1}, upload_id: {2}".format(
self.bucket_name, to_string(key), upload_id))
headers =... | |
def Tx_Dia(self):
"""
Tx_Dia(Pointing_Errors_ff_sptr self) -> float
Return current pointing errors transmitter aperture diameter.
"""
return _FSO_Comm_swig.Pointing_Errors_ff_sptr_Tx_Dia(self)
def set_Tx_Theta(self, Tx_Theta):
"""
set_Tx_Theta(Pointing_Errors_ff_sptr self, float Tx_Theta)
Set poinintg erro... | |
munsell_value_Saunderson1944(Y: FloatingOrArrayLike) -> FloatingOrNDArray:
"""
Return the *Munsell* value :math:`V` of given *luminance* :math:`Y` using
*Saunderson and Milner (1944)* method.
Parameters
----------
Y
*luminance* :math:`Y`.
Returns
-------
:class:`np.floating` or :class:`numpy.ndarray`
*Muns... | |
content,
requires,
attachments,
name,
version_name,
document_type,
document_format,
target_type,
tags,
):
ssm_document = Document(
name=name,
version_name=version_name,
content=content,
document_type=document_type,
document_format=document_format,
requires=requires,
attachments=attachments,
target_typ... | |
<filename>acstools/acs_destripe_plus.py
#!/usr/bin/env python
"""
Fully calibrate post-SM4 ACS/WFC exposures using the standalone
:ref:`acsdestripe` tool to remove stripes between ACSCCD and ACSCTE
steps in CALACS.
This script runs CALACS (8.3.1 or higher only) and ``acs_destripe``
on ACS/WFC images. Input files must ... | |
given netcdf files
considering the units and the calendar type used. This is a wrapper to the
netCDF4.date2num function to account for calendar strangeness in ROMS
Parameters
----------
dates : array of datetime.datetime
Values to convert
nc : netCDF4.Dataset,
netcdf input file
tvar : string, optional
time v... | |
expected = [
mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'),
mock.call.getCPG(HP3PAR_CPG),
mock.call.getHost(self.FAKE_HOST),
mock.call.findHost(wwn='123456789012345'),
mock.call.findHost(wwn='123456789054321'),
mock.call.createHost(
self.FAKE_HOST,
FCWwns=['123456789012345', '123456789054321'],
optional={'... | |
import numpy as np
import math
import time
from scipy.spatial.transform import Rotation
from ..common import Vec, equal_angle
from .realtime.constants import *
class Joints(Vec):
'''
A vector of 6 elements representing joint properties. The order is: base, shoulder, elbow, wrist1, wrist2, wrist3.
'''
BASE = 0
SH... | |
= self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['Basic Authentication', 'Token Authentication'] # noqa: E501
response_type = 'Nic'
if 'response_type' in kwargs:
response_type = kwargs['response_type']
return self.api_client.call_api(
'/data... | |
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
#... | |
import logging
import json
import os
import re
import time
from subprocess import CalledProcessError
from .system import exec_shell
class CloudCliError(Exception):
pass
class AWSCli:
def __init__(self, bin_path=None):
# aws CLI supported versions interval
self.min_version = (0, 0, 0)
self.max_version = (1, 19... | |
<reponame>dhill2522/HERON
# Copyright 2020, Battelle Energy Alliance, LLC
# ALL RIGHTS RESERVED
"""
pyomo-based dispatch strategy
"""
import os
import sys
import time as time_mod
from functools import partial
import platform
import numpy as np
import pyomo.environ as pyo
from pyomo.opt import SolverStatus, Terminat... | |
<gh_stars>1-10
# coding=utf-8
"""
Module responsible for the definition of functions that convert Raw units (available in the
acquisition files returned by OpenSignals) and sample units to physical units like mV, A, ºC,
s,..., accordingly to the sensor under analysis.
Available Functions
-------------------
[Public]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.