input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<reponame>mikhailramalho/benchexec<filename>benchexec/util.py
# BenchExec is a framework for reliable benchmarking.
# This file is part of BenchExec.
#
# Copyright (C) 2007-2015 <NAME>
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... | |
"""Tests cac.data.transforms.DataProcessor"""
import unittest
import math
import numpy as np
import torch
import random
from torchaudio.transforms import TimeStretch
import librosa
from numpy.testing import assert_array_equal, assert_raises, \
assert_array_almost_equal
from cac.config import Config
from cac.data.utils... | |
for mp
multiprocessing = multiprocessing and self.multiprocessing
# model & kwargs preparation
if method=='fast':
if 'Nterms' in kwargs:
Nterms = kwargs['Nterms']
else:
kwargs['Nterms'] = 5
if model=='Fourier':
Nterms = kwargs['Nterms']
MODEL, P0_FUNC, KWARGS = self.check_model(model,p0_func,**kwargs)
#... | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cloudpickle as pickle
import hashlib
import inspect
import json
import numpy as np
import redis
import traceback
import ray.local_scheduler
import ray.signature as signature
import ray.worker
from ray.u... | |
from dataclasses import dataclass
from lzma import is_check_supported
from PIL import Image, ImageDraw, ImageFilter
from typing import List
from seedsigner.gui.renderer import Renderer
from seedsigner.models.threads import BaseThread
from .screen import ButtonListScreen, WarningScreen
from ..components import (BtcAmo... | |
self.redeploy_ui1_with_http_info(live, **kwargs) # noqa: E501
return data
def redeploy_ui1_with_http_info(self, live, **kwargs): # noqa: E501
"""Redeploy UI from current dev branch. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=T... | |
# (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
from __future__ import print_function, division, absolute_import
import os
import sys
import shutil
im... | |
`Tensor` of shape `[dim]`.
Corresponds to the mean reversion rate.
volatility: A real positive `Tensor` of the same `dtype` as
`mean_reversion` or a callable with the same specs as above.
Corresponds to the long run price variance.
notional: An optional `Tensor` of same dtype and compatible shape as
`strikes`spec... | |
# Lint as: python3
# Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | |
<filename>test/integration/component/test_vpc_routers.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apach... | |
!= type(item2):
return False
# Handle Mapping objects (dict)
if isinstance(item1, Mapping):
# Second item must be Mapping
if not isinstance(item2, Mapping):
return False
# Items must have the same number of elements
if not len(item1) == len(item2):
return False
# Keys must be the same
if not insensitive_com... | |
<gh_stars>1-10
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
from episodic_curiosity import keras_checkpoint
from episodic_curiosity.constants import Const
from third_party.baselines import logger
import gin
import... | |
}
})
@staticmethod
def load_sky_easy_task_1() -> 'Dataset':
df = pd.read_csv('data/sky_easy_task_1.csv')
df['cat'] = '1'
convert_dict = {
'Distance': 'float',
'CostPerNight': 'float',
'Label': 'category',
'cat':'category'
}
df = df.astype(convert_dict)
df['Label'] = df['Label'].apply(str)
return Da... | |
= find_str(s, ['\\quotes{', '\\doublequotes{', '\\enquote{'])
if k == -1:
if kwargs.get('pb'): # Update progressbar
kwargs.get('pb').update('Processing quotes')
return s
m = 0
for j in range(len(s)):
if s[k + j] == '{':
m = j
if s[k + j] == '}':
s = s[:k] + '"' + s[k + m + 1:k + j] + '"' + s[k + j + 1:]
brea... | |
from __future__ import division
import os
import base64
import zlib
import array
import gzip
import struct
import binascii
import io
import functools
from weakref import WeakValueDictionary
import sys
import warnings
import csv
import copy
import six
try:
# noinspection PyPackageRequirements
from lxml import etree... | |
<gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | |
# -*- coding: utf-8 -*-
"""
This module
"""
import attr
import typing
from ..core.model import (
Property, Resource, Tag, GetAtt, TypeHint, TypeCheck,
)
from ..core.constant import AttrMeta
#--- Property declaration ---
@attr.s
class PropGameServerGroupTargetTrackingConfiguration(Property):
"""
AWS Object Type ... | |
from typing import Tuple, List, Dict
from ursina import Ursina, camera, window, Light, color, scene, Entity, held_keys, time, Mesh, EditorCamera, invoke
import math
from ursina import Mesh
MAX_DEPTH = 5
LIMIT_VALUE = 2.0
# ONE PHASE CONSTANTS
ITER_COUNT = 10
# SEVERAL PHASES CONSTANTS
ITER_TETRAHEDRON_COUNT = 20
ITE... | |
Defaults to [].
"""
if client_comms:
warnings.warn("When wrapping a model function, client comms "
"must either be initialized outside the function, "
"pass a 'global_scope' parameter to the "
"comm initialization (e.g. Python, R, Matlab), "
"or use a 'WITH_GLOBAL_SCOPE' macro "
"(e.g. C, C++, Fortran) around ... | |
block should be deleted\n'
'[ Mac ] failures/expected/text.html [ Failure ]\n')
self.set_up_using_raw_expectations(raw_expectations)
self._system_config_remover.remove_os_versions(
'failures/expected/text.html',
{'Mac10.10', 'Mac10.11', 'Mac10.12'})
self._system_config_remover.update_expectations()
updated_exps ... | |
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to ... | |
to lock after 0.001 seconds
___step_2___
coffee 2 ready to start transaction after 0.000 seconds
___step_3___
Wait 0.1 seconds.
___step_4___
Start transaction SHOULD happen, but it won't
coffee 4 idn has been assigned after 0.001 seconds
___step_5___
Wait 0.1 seconds.
___step_6___
Successful insert on the co... | |
resultifier = ARAXResultify()
input_parameters = {'ignore_edge_direction': 'true'}
resultifier.apply(message, input_parameters)
assert resultifier.response.status == 'OK'
assert len(resultifier.message.results) == 2
def test07():
kg_node_info = ({'id': 'UniProtKB:12345',
'type': 'protein',
'qnode_ids': ['n01']... | |
<filename>lib/dataset_utils.py
#!/usr/bin/python3
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | |
176, 688, -688
51540, 192, 720, -800
51600, 144, 592, -864
51660, 272, 512, -816
51720, 384, 528, -752
51780, 224, 528, -784
51840, 256, 624, -752
51900, 224, 672, -688
51960, 192, 784, -720
52020, 240, 592, -720
52080, 272, 640, -736
52140, 320, 656, -544
52200, 240, 768, -528
52260, 496, 720, -576
52320, 304, 992, -4... | |
0x00, 0x00, 0x00,
0x2c, 0x19, 0x00, 0x33, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x08, 0x0c, 0x00, 0xb9, 0xd9, 0x43,
0x07, 0x00, 0x80, 0xb0, 0x5b, 0x00, 0x02, 0x02, 0x00, 0x21, 0xf9, 0x04, 0x05, 0x04, 0x00, 0x00,
0x00, 0x2c, 0x19, 0x00, 0x32, 0x00, 0x07, 0x00, 0x03, 0x00, 0x00, 0x08, 0x16, 0x00, 0xe9, 0xa9,
0x03, 0x40... | |
"""
A Convolutional Encoding and Decoding
Copyright (c) March 2017, <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 copyright not... | |
During this time, you can\'t invoke or modify the function. The State , StateReason , and StateReasonCode fields in the response from GetFunctionConfiguration indicate when the function is ready to invoke. For more information, see Function States .
A function has an unpublished version, and can have published version... | |
size=5)
if self.plot_vim_data:
self.vim_data_win = self.add_new_plot_window(title='VIM',
x_axis_title='MonteCarlo Step (MCS)',
y_axis_title='Variables', x_scale_type='linear',
y_scale_type='linear',
grid=False,
config_options={'legend': True})
self.vim_data_win.add_plot("R", style='Dots', color='orange', size... | |
Ending number of ionic step.
TODO(rambalachandran):
Requires a check to ensure if the new concatenating file has the
same lattice structure and atoms as the Xdatcar class.
"""
preamble = None
coords_str = []
structures = self.structures
preamble_done = False
if ionicstep_start < 1:
raise Exception("Start ioni... | |
# -*- coding: utf-8 -*-
"""
UUTrack.Controller.devices.PhotonicScience.scmoscam.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A wrapper class originally written by <NAME>,
<EMAIL> in Py2 and has been tested successfully with
scmoscontrol.dll SCMOS Pleora (GEV) control dll (x86 )v5.6.0.0 (date modifi... | |
117, 117),
("GRAY47", 120, 120, 120),
("GRAY48", 122, 122, 122),
("GRAY49", 125, 125, 125),
("GRAY5", 13, 13, 13),
("GRAY50", 127, 127, 127),
("GRAY51", 130, 130, 130),
("GRAY52", 133, 133, 133),
("GRAY53", 135, 135, 135),
("GRAY54", 138, 138, 138),
("GRAY55", 140, 140, 140),
("GRAY56", 143, 143, 143),
("GR... | |
NOT NULL PRIMARY KEY, `bk_cloud_name` varchar(45) NOT NULL, `isp` varchar(45) NULL, `ap_id` integer NULL, `creator` json NOT NULL, `is_visible` bool NOT NULL, `is_deleted` bool NOT NULL);",
"CREATE TABLE `node_man_cmdbeventrecord` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `bk_biz_id` integer NOT NULL, `subscr... | |
<reponame>C6SUMMER/allinclusive-kodi-pi
#############################################################################
#
# Copyright (C) 2013 Navi-X
#
# This file is part of Navi-X.
#
# Navi-X is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publish... | |
= (credentials['username'], credentials['password'])
continue
elif e.name in ('UsernameOrPasswordError', 'OTPMismatchError'):
if attempt < 3:
if e.name == 'UsernameOrPasswordError':
warn("Incorrect username and/or password")
else:
warn("Incorrect verification code")
attempt += 1
continue
else:
err_exit("Inco... | |
data from lists to arrays
self.species_pops = np.array(self.species_pops)
self.rxn_freqs = np.array(self.rxn_freqs)
self.propensities = np.array(self.propensities)
self.Props_integ = np.array(self.Props_integ)
self.traj_derivs = np.array(self.traj_derivs)
self.events_total = np.array(self.events_total)
self.CPU_... | |
== None ) :
lprint ( "Could not decode Map-Notify-Ack packet" )
return
if 48 - 48: i1IIi + IiII - iIii1I11I1II1 . i11iIiiIii % OOooOOo + I1ii11iIi11i
if 95 - 95: ooOoO0o + OoOoOO00 . II111iiii + Ii1I
oOoOOo . print_notify ( )
if 81 - 81: OoooooooOO / OOooOOo / Oo0Ooo
if 26 - 26: iII111i
if 93 - 93: Oo0Ooo + I1I... | |
<reponame>milnus/Corekaburra<gh_stars>1-10
import os
import csv
from math import ceil, floor
import gffutils
EXIT_GFF_REANNOTATION_ERROR = 3
try:
from Corekaburra.correct_gffs import annotate_refound_genes
except ModuleNotFoundError:
from correct_gffs import annotate_refound_genes
try:
from Corekaburra.exit_with_e... | |
"""
This module implements communications with Geopedia
"""
import os
import io
import copy
import json
import logging
import pkg_resources
from configparser import RawConfigParser
from itertools import islice
from sys import version_info
from collections import OrderedDict
import requests
import shapely.geometry
imp... | |
blank=True, null=True) # Field name made lowercase.
frenchcountryregionname = models.CharField(db_column='FrenchCountryRegionName', max_length=50, blank=True, null=True) # Field name made lowercase.
postalcode = models.CharField(db_column='PostalCode', max_length=15, blank=True, null=True) # Field name made lowercase... | |
import sys, os
sys.path = [os.getcwd()] + sys.path
from utils.tools import submit_jobs, random_params, lists_to_tuples
# Plain-S 64 width 8 resblock
# Plain-M 64 width 16 resblock
# Plain-L 100 width 16 resblock
pretrain_paths = {
'resnet20x4': "/data/pretrained/lightning_models/layerwise_resnet20x4_cifar100_b8242... | |
<filename>azure-iot-hub/azure/iot/hub/iothub_registry_manager.py
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------... | |
# import the necessary packages
from imutils.video import VideoStream
import argparse
import numpy as np, cv2
import imutils, time
# import the necessary packages
from scipy.spatial import distance as dist
from collections import OrderedDict
import numpy as np
class CentroidTracker():
def __init__(self, maxDisappea... | |
i in pv])
else:
pv = ','.join(['"%s"' % i if i.find(' ') > -1 else i \
for i in pv])
elif isinstance(pv, dict):
if flag == '-f':
filt_lst = []
for k, v_lst in pv.items():
for v in v_lst:
if v is None or v == '': continue
v = v.replace('"', '').replace("'", '')
filt_lst.append("%s.%s" % (k, v))
if len(filt... | |
<reponame>NISH1001/neurgoo
#!/usr/bin/env python3
from __future__ import annotations
import random
from abc import ABC, abstractmethod
from typing import Optional, Sequence, Tuple, Type
import numpy as np
from .misc.eval import Evaluator
from .structures import NULL_TENSOR, Shape, Tensor
class BaseMixin:
@proper... | |
import autosar
import math
import re
import sys
import copy
INVALID_TYPE_CODE = -1
UINT8_TYPE_CODE = 0
UINT16_TYPE_CODE = 1
UINT32_TYPE_CODE = 2
UINT64_TYPE_CODE = 3
SINT8_TYPE_CODE = 4
SINT16_TYPE_CODE = 5
SINT32_TYPE_CODE = 6
SINT64_TYPE_CODE = 7
STRING_TYPE_CODE = 8
RECORD_TYPE_CODE = 9
REFERENCE_T... | |
the context is not yet established. Any other errors would mean this isn't supported and we can't use
# the current version installed if we need session_key interrogation.
# https://github.com/gssapi/gss-ntlmssp/blob/9d7a275a4d6494606fb54713876e4f5cbf4d1362/src/gss_sec_ctx.c#L1277
if getattr(o_err, 'min_code', 0)... | |
<reponame>qbetterk/user-simulator
# -*- coding: utf-8 -*-
import copy
import json
import os
import re
import shutil
import urllib
from collections import OrderedDict
from io import BytesIO
from zipfile import ZipFile
from tqdm import tqdm
import numpy as np
from simulator.multiwoz_utils.utils import dbPointer
from si... | |
"""
.. module:: wagtailsnapshotpublisher.views
"""
import json
import logging
from datetime import datetime
from django.apps import apps
from django.conf import settings
from django.forms.models import modelform_factory
from django.http import JsonResponse, HttpResponseServerError, Http404
from django.shortcuts impor... | |
# Compatible IDs:
# USB\Class_02&SubClass_02&Prot_00
# USB\Class_02&SubClass_02
# USB\Class_02
#
# Grab what we hope is the instance ID
line = line.decode()
if line.startswith("USB"):
instance_id = line
else:
# If the next line is the Name we want then we're done
if instance_id and ("Name: " + device_descrip... | |
if c.parent else 1.0)
for c in self.iterComponents()
]
) # c x 1
totalVol = volumes.sum()
if totalVol == 0.0:
# there are no children so no volume or number density
return [0.0] * len(nucNames)
nucDensForEachComp = numpy.array(
[
[c.getNumberDensity(nuc) for nuc in nucNames]
for c in self.iterComponents()
... | |
<reponame>aerospike/aerospike-admin<filename>lib/live_cluster/health_check_controller.py<gh_stars>10-100
import copy
import time
from lib.health import util as health_util
from lib.get_controller import get_sindex_stats
from lib.utils import util
from lib.base_controller import CommandHelp
from .live_cluster_command_... | |
"""
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license
(https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
import torch
from torch.utils.data import Dataset
import numpy as np
import time
import os
import cv2
import sys
import utils
from datasets.scan... | |
pair is absolute,
# second is relative, and hence is the width.
for hint in hints:
if not hint:
continue
pos = hint[0]
if isinstance(pos, float) and (int(pos) == pos):
pos = int(pos)
width = hint[1]
if isinstance(width, float) and (int(width) == width):
width = int(width)
if isH:
op = kHStemName
else:
op ... | |
(features, labels)
tuple that corresponds to a batch of CSV rows. The features dictionary
maps feature column names to `Tensor`s containing the corresponding
feature data, and labels is a `Tensor` containing the batch's label data.
Args:
file_pattern: List of files or patterns of file paths containing CSV
record... | |
<gh_stars>10-100
# Copyright 2015, 2016 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | |
clenshaw_curtis_in_polynomial_order)
sparse_grid.set_function(function)
num_refinement_steps = 10
priority_dict = dict()
active_subspace_indices,I = get_active_subspace_indices(
sparse_grid.active_subspace_indices_dict,
sparse_grid.subspace_indices)
for ii in range(active_subspace_indices.shape[1]):
subspace_i... | |
<filename>lib/doekbase/data_api/wsfile.py
"""
Workspace implemented over files, using the mongomock package.
"""
__author__ = '<NAME> <<EMAIL>>'
__date__ = '9/3/15'
# Imports
# Stdlib
try:
import cStringIO as StringIO
except:
import StringIO
from datetime import datetime
import json
import logging
import msgpack
im... | |
<filename>inputs.py
"""Inputs - user input for humans.
Inputs aims to provide easy to use, cross-platform, user input device
support for Python. I.e. keyboards, mice, gamepads, etc.
Currently supported platforms are the Raspberry Pi, Linux, Windows and
Mac OS X.
"""
# Copyright (c) 2016, 2018: Zeth
# All rights res... | |
import pandas as pd
from matplotlib import pyplot as plt, dates, ticker
from matplotlib.pyplot import setp
from matplotlib.ticker import PercentFormatter
from switch_model.tools.graph.main import graph_scenarios, graph, Scenario
STORAGE_CAPACITY_LEGEND = "Storage Capacity (TWh)"
X_LABEL = "WECC-wide Storage Capacity... | |
<filename>OpenSeesAPI/Model/Element/Material/Section.py
__author__ = 'marafi'
"""
section secType? secTag? arg1? ...
The type of section created and the additional arguments required depends on the secType? provided in the command.
NOTE:
The valid queries to any section when creating an ElementRecorder are 'force', ... | |
<reponame>mikespub-org/remko-webapp2
# Copyright 2011 webapp2 AUTHORS.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | |
icon_url=member.avatar.url)
await ctx.send(embed=e)
async def buy_h_r(self, ctx, member):
ctx_data = await self.bot.db.fetchrow("SELECT * FROM econ WHERE user_id = $1", member.id)
fr = await self.bot.db.fetch("SELECT * FROM inve WHERE user_id = $1 AND item = $2", member.id, "h_rifle")
value = 50000
if not ctx_d... | |
# coding=utf-8
from app.customer.models.vip import UserVip, Vip
from app.customer.models.user import User
import datetime
import time
from mongoengine import *
from base.settings import CHATPAMONGO
from api.convert.convert_user import *
from app.customer.models.real_video_verify import RealVideoVerify
from app.util.me... | |
name must be specified as "name"')
if not conn:
conn = get_conn()
try:
data = conn.delete_storage_account(kwargs['name'])
return {'Success': 'The storage account was successfully deleted'}
except AzureMissingResourceHttpError as exc:
raise SaltCloudSystemExit('{0}: {1}'.format(kwargs['name'], exc.message))
d... | |
import argparse
import pyrealsense2 as rs
import numpy as np
import cv2
from models import * # set ONNX_EXPORT in models.py
from utils.datasets_v3 import *
from utils.utils import *
from utils.tugas_akhir_v3_5 import *
def detect(save_img=False):
img_size = (320, 192) if ONNX_EXPORT else opt.img_size # (320, 192) or... | |
the special
__iter__() method.
@tag6
(6) Negative subscripts for array-like indexing are supported.
Therefore,
bitvec[-i]
is legal assuming that the index range is not violated. A
negative index carries the usual Python interpretation: The
last element of a bit vector is indexed -1 and the first
element -(n... | |
# Copyright (c) 2021, NVIDIA CORPORATION. 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... | |
<reponame>mith1979/ansible_automation
# (c) 2012-2014, <NAME> <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible 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
# (at yo... | |
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
# This python file is a library of python functions which provides modular
# common set-up commands for solving a problem in OpenCMISS.
# Each function has a range of input options and calls the appropriate
# OpenCMISS linked command... | |
<filename>statsmodels/tsa/statespace/tests/test_kalman.py
"""
Tests for _statespace module
Author: <NAME>
License: Simplified-BSD
References
----------
Kim, Chang-Jin, and <NAME>. 1999.
"State-Space Models with Regime Switching:
Classical and Gibbs-Sampling Approaches with Applications".
MIT Press Books. The MIT Pre... | |
work nicely (+ deg -1)
box_off = int((int(c) + deg - 1) / deg)
box_base = (int((ord(r) - 64 + deg - 1) / deg) - 1) * deg
return 'b' + str(box_base + box_off)
@ classmethod
def getLocations(cls, id, deg):
""" Returns the row, column location of cell id as int indices into a 2D array
in a puzzle of degree deg.
T... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Loop through selected (hardcoded!) RunAnalysis.R output tables and plot
chosen parts of the data on Bokeh maps.
Created on Wed Apr 15 15:26:30 2020
@author: <NAME> (<EMAIL>)
"""
# Silence FutureWarnings of Pandas
import warnings
warnings.simplefilter(action='ignore'... | |
not smiley:
currentSmileys = smileys[:i]
break
for smiley in currentSmileys:
if name.upper() == smiley.upper():
raise commands.CommandError(message=f'Error: `{name}` is already on the smiley list.')
row = 0
for i, smiley in enumerate(smileys):
if name.upper() == smiley.upper():
row = i + headerRows + 1
break
... | |
be generated, you can view the status of these jobs below. ', 'info'))
if not display_link.preparing_display():
display_link.prepare_display()
preparable_steps = display_link.get_prepare_steps()
else:
raise Exception('Attempted a view action (%s) on a non-ready display application' % app_action)
return trans.fill... | |
# Copyright 2018 The TensorFlow Constrained Optimization 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... | |
- m.x4192*m.b3012 <= 0)
m.c4264 = Constraint(expr=m.x1163*m.x1163 - m.x4193*m.b3012 <= 0)
m.c4265 = Constraint(expr=m.x1164*m.x1164 - m.x4194*m.b3012 <= 0)
m.c4266 = Constraint(expr=m.x1165*m.x1165 - m.x4195*m.b3012 <= 0)
m.c4267 = Constraint(expr=m.x1166*m.x1166 - m.x4196*m.b3012 <= 0)
m.c4268 = Constraint(expr=m... | |
"""
These set of functions help the algorithms of MSAF to read and write files
of the Segmentation Dataset.
"""
from collections import Counter
import datetime
import glob
import json
import logging
import numpy as np
import os
from threading import Thread
# Local stuff
import msaf
from msaf import jams2
from msaf imp... | |
to simply be "\n", which when adjusted
# by tight_layout() will leave a spacing between the suptitle and the plots.
### create confusion matrix ###
# set "\n" as confusion matrix title, font size large (to mirror suptitle)
axs[0].set_title(" ", fontsize = "large")
# heatmap, with annotations, and using clabs ... | |
reverse the string
padded_bv = ('0' * (n - len(bv)) + bv)[::-1]
for i in range(n):
w = v
w ^= (1 << i) # push 1 to the left by i and xor with w
bw = int_to_binary_string(w)
padded_bw = ('0' * (n - len(bw)) + bw)[::-1]
butterfly[(padded_bv, i)] = [(padded_bv, i + 1), (padded_bw, i + 1)]
elif vertices == 'vectors... | |
'sumMax': sumMax, 'sumJerk': sumJerk, 'sumTargets': sumTargets}))
print(fstr({'vals': vals}, fmat='15.12g'))
print(fstr({'targets': targets}))
self.lossValue = loss
return loss
def jacobian(self):
# the 1st derivative of the loss function
vxj = self.vxj
vyj = self.vyj
omegaj = self.omegaj
pxj = self.pxj
pyj... | |
"""Errors for the binobj package."""
import typing
from typing import Any
from typing import Iterable
from typing import Optional
from typing import TypeVar
from typing import Union
import more_itertools as m_iter
from binobj.typedefs import FieldOrName
from binobj.typedefs import StructOrName
if typing.TYPE_CHECK... | |
import tensorflow as tf
from tensorflow.keras import layers
class SpectralNormalization(tf.keras.layers.Wrapper):
"""This wrapper reparameterizes a layer by decoupling the weight's
magnitude and direction.
This speeds up convergence by improving the
conditioning of the optimization problem.
Weight Normalization:... | |
= 155
slot_town_has_tournament = 156
slot_town_tournament_max_teams = 157
slot_town_tournament_max_team_size = 158
slot_center_faction_when_oath_renounced = 159
slot_center_walker_0_troop = 160
slot_center_walker_1_troop = 161
slot_center_walker_2_troop = 162
slot_center_walker_3_troop = 163
slot_center_walker_4_troo... | |
criteria.
:param int limit: Limits the size of the response to the specified number of objects on each page. To return the total number of resources, set `limit=0`. The total number of resources is returned as a `total_item_count` value. If the page size requested is larger than the system maximum limit, the server re... | |
node_id, likely a label string, search based on this
# label
for node in self:
if str(node) == key:
return node
log.warning('Unable to find node %s in %s ' % (key, self))
return None
def degree(self, node):
""""""
return node.degree()
def neighbors(self, node):
return iter(OverlayNode(self._anm, self._ov... | |
values of
parameters before writing the file. Default is True.
clobber: Option to overwrite the file if it already exists.
Default is False. If False and file exists, raises an IOError.
data_compression: HDF5 filter to apply when writing the data_array. Default is
None (no filter/compression).
flags_compression: ... | |
**callkwds):
"""
Parameters
----------
points : 2d (M,2) or 1d (N,)
M points in 2-dim space where to evalutae the interpolator
(only one in 1d case)
**callkwds : keywords passed to the interpolator's __call__ method
Returns
-------
Y : 1d array (M,)
interpolated values
"""
points = np.asarray(points)
if ... | |
str format:
:return: DeviceDataSourceInstanceData
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['device_id', 'hds_id', 'id', 'period', 'start', 'end', 'datapoints', 'format'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_para... | |
{3,S} {4,S}
2 Cd u0 {1,D}
3 Cb u0 {1,S}
4 O2s u0 {1,S}
""",
thermo = ThermoData(
Tdata = ([300,400,500,600,800,1000,1500],'K'),
Cpdata = ([4.4,5.37,5.93,6.18,6.5,6.62,6.72],'cal/(mol*K)','+|-',[0.1,0.1,0.1,0.1,0.1,0.1,0.1]),
H298 = (1.5,'kcal/mol','+|-',0.2),
S298 = (-14.4,'cal/(mol*K)','+|-',0.1),
),
shortDesc ... | |
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
N = 10001
Time = np.linspace(0,10,N)
dt = Time[1]-Time[0]
R = lambda t: 2*np.sin(2*np.pi*t)
dR = lambda t: (2*np.pi)*2*np.cos(2*np.pi*t)
d2R = lambda t: -( (2*np.pi)**2)*2*np.sin(2*np.pi*t)
def g1(x1,x2):
return(x1**2 + x2)
def g2(... | |
None,
operator: Union[Operator, str] = None,
active: bool = None,
pcallback: Union['Callback', int] = None,
registered_payload: Union[Payload, str] = None, # corresponding payload's UUID
payload_type: Union[PayloadType, str] = None, # corresponding payload's type
c2_profile: Union[C2Profile, str] = None, # corres... | |
of YYYY-MM-DD formatted dates in history (e.g. 2000-01-01,2005-02-24).
Vintage dates are used to download data as it existed on these specified dates in history.
Vintage dates can be specified instead of a real-time period using realtime_start and realtime_end.
Sometimes it may be useful to enter a vintage date that... | |
import collections
import dataclasses
import enum
import functools
import itertools
import operator
import random
import re
import typing
from typing import (
Any,
Mapping,
Union,
MutableMapping,
Optional,
TypeVar,
Callable,
NamedTuple,
Type,
Tuple,
Sequence,
)
import matplotlib.pyplot as plt
import numpy ... | |
= "%d"
j = scale_val(j)
num = locale.format(fmt, j, grouping=True)
if len(num) >= fieldlen:
num += " "
return num
def print_header(self):
pre = ""
for v, j in zip(self.vals, self.headers):
l = self.fieldlen(j)
l = max(len(self.format_field(v, j, l)), l)
print >>args.output, pre + j
pre += "|" + " "*(l - 1)... | |
<filename>tests/frontend/workspace.py
#
# Copyright (C) 2018 Codethink Limited
# Copyright (C) 2018 Bloomberg Finance LP
#
# 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.... | |
<reponame>The-Yak-Collective/gigayak
#simple gig manager using sqlite3
#database has one table: gigs and that table has the following fields:
# gigid INTEGER PRIMARY KEY - number of gig entry in table
# creatorid text - discord id of creator
# contents text - the contenst of teh gig - no internal formatting. consider s... | |
import os
import sys
import re
keywords = [
'Function:',
'Class:',
'Enum:',
'Values:',
'Description:',
'Parameters:',
'Returns:',
'Example:'
]
classFunctionSeparator = '.'
functionKeyword = keywords[0]
classKeyword = keywords[1]
enumKeyword = keywords[2]
enumValuesKeyword = keywords[3]
descriptionKeyword = k... | |
<filename>azure/mgmt/compute/v2017_03_30/operations/virtual_machines_operations.py<gh_stars>1-10
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root f... | |
import cv2 as cv
import numpy as np
import numpy as np
import math
import imutils
import os
beta = 0.75
class BodyPart():
def __init__(self, name='part'):
self.name = name
self.x = 0
self.y = 0
self.theta = 0
self.l = 0
self.w = 0
self.children = []
self.parent = None
self.left_upper_corner = None
s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.