input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
from mpl_toolkits.mplot3d import Axes3D
import sys
import matplotlib.pyplot as plt
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import numpy as np
from numpy import linspace
from sklearn.model_selection import train_test_split
from random import uniform
from abc import abstractmethod
# This is a hac... | |
symbol):
""" 获取当前持仓
Args:
symbol: Trade target
Returns:
position: Position if successfully, otherwise it's None.
error: Error information, otherwise it's None.
"""
raise NotImplementedError
async def get_symbol_info(self, symbol):
""" 获取指定符号相关信息
Args:
symbol: Trade target
Returns:
symbol_info: Symbol... | |
# -*- coding: utf-8 -*-
#Copyright (c) 2018 <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 without restriction, including without limitation the rights
#to use, copy, modify, merge, p... | |
givers, total and by class shareCareGivers
fig, ax = plt.subplots()
p1, = ax.plot(output['year'], output['shareCareGivers'], linewidth = 3, label = 'Population')
p2, = ax.plot(output['year'], output['shareCareGivers_1'], label = 'Class I')
p3, = ax.plot(output['year'], output['shareCareGivers_2'], label = 'Clas... | |
<reponame>sbow/mowbot_camera
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Dec 7 16:24:25 2019
@author: shaun
"""
import numpy as np
import cv2
import matplotlib.pyplot as plt
import copy
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.utils impor... | |
Sync 'Out' size: %sMB with %s files)\n" %(rpad(round((sync_outSize/(1000.0*1000.0)),1),12),sync_outCount))
output+=("- attachments size: %sMB (in %s attachments)\n" %(rpad(round((safe_attachmentsSize/(1000.0*1000.0)),1),12),countAttachments))
output+=("- archive size: %sMB (in %s files)\n" %(rpad(round((safe_archive... | |
not None:
return PublicKey.from_bytes(self._pubkey_bytes)
elif self._bip32_xpub is not None:
assert self._derivation_data is not None
assert self._derivation_data.derivation_path is not None
result = cast(BIP32PublicKey, bip32_key_from_string(self._bip32_xpub))
for n in self._derivation_data.derivation_path:
res... | |
line
else:
self.log.append(line)
def str(self):
return '\n'.join(filter(None,self.log))
def __getitem__(self, item):
return filter(None,self.log)[item]
def clear(self):
"""
Empty the log
"""
self.log = [None]*self.size
def raises(exception, f, *args, **kwargs):
"""
Determine whether the given call... | |
confidence interval
'ci_95_upp' : np.nan, # upper 95% confidence interval
'mean' : np.nan, # mean of posterior distribution
'std_dev' : np.nan, # standard deviation
'median' : np.nan, # median of posterior distribution
'med_abs_dev' : np.nan, # median absolute deviation
'flat_chain' : flat, # flattened samples us... | |
<reponame>martinjuckes/ceda_cc<gh_stars>0
import collections, glob, string, re, json, sys
from fcc_utils2 import mipTableScan, snlist, tupsort
from ceda_cc_config.config_c4 import CC_CONFIG_DIR
def uniquify( ll ):
ll.sort()
l0 = [ll[0],]
for l in ll[1:]:
if l != l0[-1]:
l0.append(l)
return l0
heightRequired = ... | |
self.last_off is None:
raise ValueError('No events in the stream')
return step - self.offset - self.last_off
def get_note_histogram(self):
"""Gets a histogram of the note occurrences in a melody.
Returns:
A list of 12 ints, one for each note value (C at index 0 through B at
index 11). Each int is the total num... | |
import sys
import numpy as np
import h5py
import cv2
from tqdm import tqdm
####
# list of utility functions
# 0. I/O util
# 1. binary pred -> instance seg
# 2. instance seg + pred heatmap -> instance score
# 3. instance seg -> bbox
# 4. instance seg + gt seg + instance score -> sorted match result
# 0. I/O
def seg2im... | |
import streamlit as st
# To make things easier later, we're also importing numpy and pandas for
# working with sample data.
import numpy as np
import pandas as pd
import pickle
import datetime as dt
import sklearn
import plotly.graph_objects as go
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033... | |
_mul_as_two_parts(g)
if not l:
return None
l = list(ordered(l, [
lambda p: max(len(_exponents(p[0], x)), len(_exponents(p[1], x))),
lambda p: max(len(_functions(p[0], x)), len(_functions(p[1], x))),
lambda p: max(len(_find_splitting_points(p[0], x)),
len(_find_splitting_points(p[1], x)))]))
for recursive in [F... | |
<gh_stars>1-10
import glob
import sys
import os
from pathlib import Path
from collections import namedtuple
import numpy as np
import time
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from numpy import min, max, median, std, isnan, delete, genfromtxt, savetxt, load, \
asarray, add, append,... | |
#
# Copyright 2015 <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 in writing, softwa... | |
u.data = self._l2normalize(u.data)
v.data = self._l2normalize(v.data)
w_bar = nn.Parameter(w.data)
# delete original weight matrix
del self.module._parameters[self.name]
# add u v and w_bar as parameters
self.module.register_parameter(self.name + '_u', u)
self.module.register_parameter(self.name + '_v', v)
self... | |
'''
Resampling methods
==================
'''
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import datasets
import sklearn.linear_model as lm
from sklearn.model_selection import train_test_split, KFold, PredefinedSplit
from sklearn.model_selection import cro... | |
<reponame>Totoro700/PyTerm
# __main__.py
# Import modules
# os for file commands and others, time for wait second, platform for os command, multiprocessing for CPU count
import os, time, platform, shutil, socket, getpass, multiprocessing, tkinter, sys, ctypes, pyglet
import webbrowser as web # Webbrowser for openLi... | |
if int, pads/clips to given length, if
True use right edge of the screen.
pad_chr (char, optional): pad character, default is space
clr (int, optional): curses color, Defaults to CLR_LOG1.
"""
if y < 0 or y > curses.LINES or x < 0 or x > curses.COLS:
return
if x + len(msg) > curses.COLS:
s = msg[:curses.COLS -... | |
import os
from labchain.datastructure.transaction import Transaction
from labchain.network.networking import TransactionDoesNotExistException, BlockDoesNotExistException, NoPeersException
from labchain.util.Menu import Menu
def clear_screen():
os.system('cls' if os.name == 'nt' else 'clear')
class Wallet:
def _... | |
whatever other state
they need to continue to run.
Since this introduces a new dependency of all batch processors on a powerup
for the IScheduler, install a Scheduler or a SubScheduler if one is not
already present.
"""
newProcessor = oldProcessor.upgradeVersion(
oldProcessor.typeName, 1, 2,
busyInterval=oldPr... | |
BufferedDC...)
@param x,y (int,int) are coord. of top left corner from which drawing
@param w,h (int,int) are width and height available for drawing.
"""
pass
# End DrawPane
# -----------------------------------------------------------------------
def DrawContent(self, dc, x,y, w,h):
"""
Draw the ruler on ... | |
# Copyright 2020 Makani Technologies 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 applicable law or agreed to in w... | |
import re
import numpy as np
import pandas as pd
try:
import holoviews as hv
except ImportError:
hv = None
from . import StarModel, get_ichrone
from .starmodel import SingleStarModel, BinaryStarModel, TripleStarModel
from .catalog import StarCatalog
from .priors import PowerLawPrior, FlatLogPrior, FehPrior, FlatPr... | |
<reponame>CrowdStrike/falconpy<filename>src/falconpy/prevention_policy.py<gh_stars>100-1000
"""CrowdStrike Falcon Prevention Policy API interface class
_______ __ _______ __ __ __
| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----.
|. 1___| _| _ | | | | _ | 1___| _| _| | <| -__|
|. |___|__| |_____|________|____... | |
" \
"{pillar_data} ".format(**command_args)
print(cmd)
ret = subprocess.call(cmd, shell=True)
if ret == 0:
print("Success")
else:
print('Error {} occurred while running Salt state "{}"'.format(
ret, salt_state if salt_state else "highstate"))
def salt_call_json(salt_command):
cmd = 'salt-call {} --local --o... | |
consider setting intercept=True (or normalise=False)",
SliseWarning,
)
self.intercept = True
self.alpha = np.concatenate(([0], alpha))
else:
alpha2 = alpha2[1:]
self.coefficients = alpha2
self.epsilon = self.epsilon_orig * y_scale
else:
self.coefficients = alpha
return self
def get_params(self, normalised:... | |
it is complete, the on_queue_declareok method will
be invoked by pika.
:param str|unicode exchange: The name of exchange to bind.
"""
cb = functools.partial(self.on_queue_declareok, exchange_name=exchange_name)
if self.exclusive_queues:
LOGGER.info("Declaring exclusive on exchange %s", exchange_name)
self._cha... | |
org=org)
cursor.executemany(
'INSERT INTO role_permission_mapping (role_id, permission_id) '
'VALUES (%s, %s)',
[(role['id'], perm['id']), (role['id'], readperm['id'])])
cursor.callproc('add_object_to_permission',
(user['auth0_id'], str(bin_to_uuid(objid)),
str(bin_to_uuid(perm['id']))))
res = cursor.execute("S... | |
from __future__ import print_function
import collections
import doctest
import sys
import time
import traceback
import mock
import zope.component
# HACK to make sure basicmost event subscriber is installed
import zope.component.event
from zope.testing import loggingsupport
from zope.testing.cleanup import CleanUp as ... | |
PROJ_PATH + '/midi-files'
usb_list = os.listdir('/media/pi')
usb_list.remove('SETTINGS')
if not usb_list:
logging.info('There are no USB drives inserted.')
QtGui.QMessageBox.warning(self, 'Error', 'No USB Drives Inserted', QtGui.QMessageBox.Close)
else:
for drive in usb_list:
source_dir = ('/media/pi/{}'.format... | |
items(self):
''' Return items from header data'''
return zip(self.keys(), self.values())
def check_fix(self,
logger=imageglobals.logger,
error_level=imageglobals.error_level):
''' Check header data with checks '''
battrun = BatteryRunner(self.__class__._get_checks())
self, reports = battrun.check_fix(self)
fo... | |
default 1e-6.
[Added 19/11/18]
Parameters
-----------
X : Upper Symmetric Matrix X
alpha : Ridge alpha regularization parameter. Default 1e-6
turbo : Boolean to use float32, rather than more accurate float64.
overwrite: Whether to overwrite X inplace with pinvh.
reflect: Output full matrix or 1/2 triangular
... | |
= " + "Button(description='" + ppchild.tag + "', disabled=True, layout=name_button_layout)\n"
# self.therapy_activation_time = FloatText(
# value=10080,
# step=1000,
# style=style, layout=widget_layout)
full_name = "self." + menv_var_name + "_" + ppchild.tag
# todo: add stepsize
delta_val = get_float_stepsize... | |
locations[1:]:
if self.distance(loc1, loc2) == 1:
# spawn locations too close
too_close = True
break
if too_close:
continue
# prevent starting food from being equidistant to ants
if not starting or len(locations) == self.num_players:
# set locations to visited
for loc in locations:
visited[loc[0]][loc[1]] =... | |
'n': n,
}
else:
# Return tuple (backwards compatible with other GIF classes)
return (time, V, eta_sum, V_T, spks)
def simulateDeterministic_forceSpikes(self, I, V0, spks):
"""
Simulate the spiking response of the GIF model to an input current I (nA) with time step dt.
V0 indicate the initial condition V(0)=V0.... | |
captured elsewhere, as provided by the well driller.",
"screen_intake_method_code":"Valid categories used to identify the type of intake mechanism for a well screen. It provides for a standard commonly understood code and description for screen intake codes. Some examples include: Open bottom, Screen, Uncased hole.",
... | |
1359534.8*m.b189 + 1969253.6*m.b190 + 3790517.2*m.b191 + 5939332*m.b192 + 11995082.8*m.b193
+ 13770962.8*m.b194 + 21853190*m.b195 + 1991830.1*m.b196 + 2885118.2*m.b197 + 5553418.9*m.b198
+ 8701609*m.b199 + 17573781.1*m.b200 + 20175591.1*m.b201 + 32016717.5*m.b202 + 2317313.7*m.b203
+ 3356573.4*m.b204 + 6460899.3*m.b... | |
<reponame>KeyiT/dlmslib<gh_stars>0
from keras import initializers, regularizers, constraints, activations
from keras.engine import Layer
import keras.backend as K
from keras.layers import merge
import tensorflow as tf
class AttentionWeight(Layer):
"""
This code is a modified version of cbaziotis implementation: Gith... | |
shape of
system.substrate.nb_subdomain_grid_pts
gap: ndarray
gap , in the shape of
system.substrate.nb_subdomain_grid_pts
pot: bool, optional
Whether to evaluate the energy, default True
forces: bool, optional
Whether to evaluate the forces, default False
logger: ContactMechanics.Tools.Logger
information of c... | |
<gh_stars>1-10
'''
Note: http://bugs.python.org/issue11077 seems to indicate that tk is
supposed to be thread-safe, but everyone else on the net insists that
it isn't. Be safe, don't call into the GUI from another thread.
'''
try:
import tkinter as tk
except ImportError:
print("pyfrc robot simulation requires p... | |
<filename>stubs.min/System/Windows/Forms/__init___parts/ToolTip.py
class ToolTip(Component,IComponent,IDisposable,IExtenderProvider):
"""
Represents a small rectangular pop-up window that displays a brief description of a control's purpose when the user rests the pointer on the control.
ToolTip(cont: IContai... | |
<reponame>m1griffin/arrayfunc<gh_stars>1-10
#!/usr/bin/env python3
##############################################################################
# Project: arrayfunc
# Purpose: Generate the unit tests for math operators.
# Language: Python 3.5
# Date: 03-Feb-2018
#
#####################################################... | |
<filename>flexCE/calc_yields/limongi_chieffi_yields.py
"""Generate finely spaced grid of SN II isotopic yields.
Use a combination of the Chieffi & Limongi (2004) & Limongi & Chieffi (2006).
Chieffi & Limongi (2004): M = 13--35 Msun; Z = 0--solar
Limongi & Chieffi (2006): M = 11--120; Z = solar
Mass cut = 0.1 Msun Ni... | |
+ EW1_star)
W1i = .2*W1i + .8*W1i2
# Update present value of unemployment
if update_eq:
_, ru, _, _ = self.getWorkerDecisions(EUi, EUi, employed=False)
Ui = self.pref.utility_gross(self.unemp_bf) + self.p.beta * (ru + EUi)
Ui = 0.2*Ui + 0.8*Ui2
# Updating J1 representation
error_j1p_chg, rsq_j1p = J1p.update_... | |
<reponame>JLHasson/coremltools<filename>coremltools/converters/nnssa/coreml/ssa_converter.py
import numpy as np
from warnings import warn
from six import string_types as _string_types
from coremltools.models import datatypes
from coremltools.proto import NeuralNetwork_pb2, Model_pb2
from coremltools.models.neural_ne... | |
self._branch_step = np.arange(0, self.num_timesteps + self.branch_every, self.branch_every)
self._chkpt_step = np.arange(self.chkpt_every, self.num_timesteps + self.chkpt_every, self.chkpt_every)
self._wfn_save_step = np.arange(self.equil_steps, self.num_timesteps + self.wfn_every, self.wfn_every)
self._desc_wt_save... | |
r"""
Library of commonly used, famous, or interesting polytopes
This module gathers several constructors of polytopes that can be reached
through ``polytopes.<tab>``. For example, here is the hypercube in dimension 5::
sage: polytopes.hypercube(5)
A 5-dimensional polyhedron in ZZ^5 defined as the convex hull of 32 ... | |
<gh_stars>0
from convertmask import baseDecorate
import copy
import datetime
import os
import random
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
import cv2
import numpy as np
import skimage
from convertmask.utils.auglib.optional.resize import resize_img
from convertmask.utils.img2xml.p... | |
0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
[ 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j,... | |
### BEGIN GPL LICENSE BLOCK #####
#
# This program 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 your option) any later version.
#
# This program is distributed in t... | |
1, SP)],
[("Resist Disease", 1, SP)],
[("Resist Fire", 1, SP)],
[("Resist Lightning", 1, SP)],
[("Resist Pain", 1, SP)],
[("Resist Poison", 1, SP)],
[("Resist Pressure", 1, SP)],
[("Restore Hearing", 1, SP)],
[("Restore Memory", 1, SP)],
[("Restore Sight", 1, SP)],
[("Restore Speech", 1, SP)],
[("Seeker", 1,... | |
sequence
def extract_dict(line):
"""
Return the key and value of the dictionary element contained in line
>>> extract_dict("something['toto'] = [0, 1, 2, -2, 'cosmo']")
'toto', [0, 1, 2, -2, 'cosmo']
"""
# recovering the array
sequence = extract_array(line)
# Recovering only the LHS
lhs = line.split('=')[0... | |
"""
**********
Edge Lists
**********
Read and write NetworkX graphs as edge lists.
The multi-line adjacency list format is useful for graphs with nodes
that can be meaningfully represented as strings. With the edgelist
format simple edge data can be stored but node or graph data is not.
There is no way of representing... | |
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: 163
Faces:
-1 -1 -1 -1 -1 -1
Nodes:
170 178 171 179 266 274 267 275
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 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.... | |
<filename>tests/util/test_short_client_token.py
from datetime import datetime, timedelta
import pytest
from library_registry.util.short_client_token import (
ShortClientTokenDecoder,
ShortClientTokenEncoder,
ShortClientTokenTool,
)
from library_registry.model import DelegatedPatronIdentifier
TEST_NODE_VALUE = 114... | |
<gh_stars>1-10
from models import *
import json
from base64 import b64encode
from schema import Schema, And, Use, Optional
import lxml.etree as xml
import re
import sys
vul_schema = Schema(
{
'cwe': And(Use(int)),
'name': basestring,
'tool': basestring,
'severity': And(Use(int), lambda n: 0 <= n <= 3),
'descript... | |
__all__ = [
"Class",
"EnumProperty",
"ModelProperty",
"NoneProperty",
"Property",
"Schemas",
"build_schemas",
"property_from_data",
]
from itertools import chain
from typing import Any, ClassVar, Dict, Generic, Iterable, Iterator, List, Optional, Set, Tuple, TypeVar, Union
import attr
from ... import Config
... | |
#!/usr/bin/env python3
"""
Script Name: ipaddresstools.py
Script Type: Python
Updated By: <NAME>
Date Written 1/11/2015
Description:
Collection of tools for IP Address's
"""
import logging
import re as __re
import ipaddress as __ipaddress
import random as __random
LOGGER = logging.getLogger(__name__)
__mask_... | |
#! /usr/bin/env python
import subprocess
import threading
import time
import docker
import sys,os,stat
import argparse
import json
import datetime
import re
import configparser
import tarfile
from io import BytesIO
# import tempfile
import json
import socket
sys.path.append(os.path.abspath('./TVDatabase'))
from TV... | |
<gh_stars>0
#!/usr/bin/env python
#
# MIT License
#
# (C) Copyright 2019-2022 Hewlett Packard Enterprise Development LP
#
# 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 without restriction, ... | |
0)
m.c3009 = Constraint(expr= m.b110 - m.b892 - m.b893 - m.b894 - m.b895 - m.b896 - m.b897 - m.b898 - m.b899 - m.b900
- m.b901 - m.b902 - m.b903 - m.b904 - m.b905 - m.b906 - m.b907 - m.b908 - m.b909 - m.b910
- m.b911 - m.b912 - m.b913 - m.b914 - m.b915 - m.b916 <= 0)
m.c3010 = Constraint(expr= m.b111 - m.b892 - m.b... | |
the
import.
:param int remaining_time: (optional) Estimate of remaining time in
seconds.
:param datetime start_time: (optional) The timestamp when the import
opearton started. In format YYYY-MM-DDTHH:mm:ssZ or
YYYY-MM-DDTHH:mm:ss.sssZ, matching the date-time format as specified by RFC
3339.
:param ImportCount t... | |
0)
m.c2115 = Constraint(expr=m.x337*m.x1190 - m.x743*m.x883 == 0)
m.c2116 = Constraint(expr=m.x338*m.x1205 - m.x744*m.x886 == 0)
m.c2117 = Constraint(expr=m.x338*m.x1206 - m.x745*m.x886 == 0)
m.c2118 = Constraint(expr=m.x338*m.x1207 - m.x746*m.x886 == 0)
m.c2119 = Constraint(expr=m.x338*m.x1208 - m.x747*m.x886 == ... | |
<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
import os
from django.db.models import query
from requests.api import head
import jwt
import uuid
import hashlib
import json
from urllib.parse import urlencode
import time
import requests
from dotenv import load_d... | |
def eventParameterList(self, ):
retval = self.eventParameterList_return()
retval.start = self.input.LT(1)
eventParameterList_StartIndex = self.input.index()
root_0 = None
char_literal136 = None
char_literal138 = None
char_literal140 = None
eventParameter137 = None
eventParameter139 = None
char_literal136... | |
one or multiple parameters.
The prior can be set for any of the atmosphere or calibration
parameters, e.g. ``prior={'teff': (1200., 100.)}``.
Additionally, a prior can be set for the mass, e.g.
``prior={'mass': (13., 3.)}`` for an expected mass of 13 Mjup
with an uncertainty of 3 Mjup. The parameter is not used if... | |
0)
m.c5162 = Constraint(expr= - 4.16666666666667*m.b728 + m.x2422 + m.x2902 + m.x3094 >= 0)
m.c5163 = Constraint(expr= - 4.16666666666667*m.b729 + m.x2423 + m.x2903 + m.x3095 >= 0)
m.c5164 = Constraint(expr= - 4.16666666666667*m.b730 + m.x2424 + m.x2904 + m.x3096 >= 0)
m.c5165 = Constraint(expr= - 4.16666666666667*... | |
import argparse
import copy
import math
import numpy as np
import pygame
from pygame.locals import *
from timeit import default_timer as timer
import traceback
import os
from minos.lib import common
from minos.config.sim_args import parse_sim_args
from minos.lib.Simulator import Simulator
from minos.lib.util.ActionTrac... | |
<reponame>gumpcraca/intersight-python<filename>intersight/models/workflow_task_meta.py
# coding: utf-8
"""
Intersight REST API
This is Intersight REST API
OpenAPI spec version: 1.0.9-255
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems... | |
lnext[0]
frac = 1.0 * (xnext - upper[ui][0]) / (unext[0] - upper[ui][0])
yupper = upper[ui][1] + frac * (unext[1] - upper[ui][1])
h2 = yupper - lnext[1]
li += 1
else:
xnext = unext[0]
frac = 1.0 * (xnext - lower[li][0]) / (lnext[0] - lower[li][0])
ylower = lower[li][1] + frac * (lnext[1] - lower[li][1])
h2 = u... | |
import time
import multiprocessing as mp
from multiprocessing import Pool as ProcessPool
import numpy as np
import pandas as pd
from floris.utils.tools import valid_ops as vops
from floris.utils.tools import farm_config as fconfig
from floris.utils.visualization import wflo_eval as vweval
from floris.utils.visualizat... | |
<reponame>DanielDimanov/tpu
# Copyright 2019 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
#
# Un... | |
def test_basic_pagination_mssql_uuids(self) -> None:
"""Ensure a basic pagination query is handled correctly."""
schema_graph = generate_schema_graph(self.orientdb_client) # type: ignore # from fixture
graphql_schema, type_equivalence_hints = get_graphql_schema_from_schema_graph(schema_graph)
pagination_keys = {
v... | |
system that defines the system the
vectors
origin : List[float, float, float]
the origin of the coordinate system
zaxis : List[float, float, float]
the z-axis of the coordinate system
xzplane : List[float, float, float]
a point on the xz plane
comment : str; default=''
a comment for the card
"""
coord = COR... | |
:param values: list of values to iterate and compute stat.
:param period: (optional) # of values included in computation.
* None - includes all values in computation.
:param population:
* True - entire population, n.
* False - sample set, n - 1 (default).
Examples:
>>> values = [32.47, 32.70, 32.77, 33.11, 33.2... | |
<gh_stars>0
import argparse
import copy
import json
import logging
import math
import os
import random
import traceback
import numpy as np
import torch
import wandb
from tqdm import tqdm
from transformers import (
MODEL_MAPPING,
AutoConfig,
AutoTokenizer,
AdamW,
get_linear_schedule_with_warmup,
)
from densephras... | |
_boldleader(self, awayteam, awayscore, hometeam, homescore):
"""Conveinence function to bold the leader."""
if (int(awayscore) > int(homescore)): # visitor winning.
return "{0} {1} {2} {3}".format(ircutils.bold(awayteam), ircutils.bold(awayscore), hometeam, homescore)
elif (int(awayscore) < int(homescore)): # home... | |
handling for this event.
e: The System.Windows.Input.KeyboardFocusChangedEventArgs that contains event data.
"""
pass
def OnLostMouseCapture(self,*args):
"""
OnLostMouseCapture(self: UIElement,e: MouseEventArgs)
Invoked when an unhandled System.Windows.Input.Mouse.LostMouseCapture�attached e... | |
"""Do recommendataion task.
Author: DHSong
Last Modified At: 2020.07.12
Anticipate target value. Find wheter the user would listen to the song again in a month.
"""
import os
import joblib
import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.sparse ... | |
into a pitch list.
Array of corresponding times does not change and is
assumed to be managed outside of the function.
Parameters
----------
multi_pitch : ndarray (F x T)
Discrete pitch activation map
F - number of discrete pitches
T - number of frames
profile : InstrumentProfile (instrument.py)
Instrument pr... | |
the directory you want to count the files and the subdirectories
required_by --> str, user who required the operation
grp --> list, groups to which the user belogns
Returns
-------
res --> dict, key: DIR_COUNT or FILE_COUNT, value: the number of directories and files
"""
#get fs (filesystem) MongoDB collection... | |
new_y < starty:
if (new_y + tile_dim) > starty:
break
new_y += tile_dim
#highlight tiles vertically, otherwise horizontally
if is_rotated:
for y in range(0,num_tiles):
next_y = new_y + (tile_dim * y)
if (min_val - 1) < next_y < ship_len_max and (min_val - 1) < startx < (max_val + 1):
pygame.draw.r... | |
import platform
from pathlib import Path
from textwrap import dedent
import pytest
import yaml
from plumbum import local
from plumbum.cmd import git
from copier import Worker, copy
from copier.cli import CopierApp
from copier.main import run_copy, run_update
from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, bui... | |
''',
'interface_count',
'Cisco-IOS-XR-infra-rcmd-oper', False),
_MetaInfoClassMember('last-archival-error', ATTRIBUTE, 'str' , None, None,
[], [],
''' Last Archival Error
''',
'last_archival_error',
'Cisco-IOS-XR-infra-rcmd-oper', False),
_MetaInfoClassMember('last-archival-error-time', ATTRIBUTE, 'str' , No... | |
<reponame>ZeitgeberH/FISH-VIEWER
import os
import numpy as np
import zipfile
import io
import sys
import shutil
from PIL import Image
from gr_sys_utils import get_subdirs, listdir
from gr_io import request, check_file_exists
import pdb
import glob
import pandas as pd
from biothings_client import get_client
... | |
#
#Set ncpus
if 'ncpus' in self.configuration:
ncpus = self.configuration['ncpus']
else:
ncpus = 1
#Set ppservers
if 'ppservers' in self.configuration:
ppservers = self.configuration['ppservers']
else:
ppservers = ("", )
#
# Check experiment
#
if len(self.experiments.keys()) == 0:
print('No experiment w... | |
<reponame>rickmark/dmglib
"""
dmglib is a basic ``hdiutil`` wrapper that simplifies working with dmg images from Python.
The module can be used to attach and detach disk images, to check a disk image's
validity and to query whether disk images are password protected or have a license
agreement included.
"""
import pl... | |
= 2, kernel: str = "linear"
) -> deepof.utils.Tuple[deepof.utils.Any, deepof.utils.Any]:
"""
Returns a training set generated from the 2D original data (time x features) and a PCA projection
to a n_components space. The sample parameter allows the user to randomly pick a subset of the data for
performance or visu... | |
"""Shelving Filter Cascade with Adjustable Transition Slope and Bandwidth
<NAME>, <NAME>, <NAME>
In: Proc. of 148th AES Convention, Virtual Vienna, May 2020, Paper 10339
http://www.aes.org/e-lib/browse.cfm?elib=20756
"""
import numpy as np
from scipy.signal import tf2sos, freqs
from matplotlib import rcParams
def ha... | |
<filename>geocamCore/models.py
# __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
import os
import shutil
import datetime
import pytz
from django.db import models
fr... | |
import pytest
import torch
import torch.nn.functional as F
import numpy as np
from cplxmodule import cplx
def cplx_allclose(input, other):
return torch.allclose(input.real, other.real) and \
torch.allclose(input.imag, other.imag)
def cplx_allclose_numpy(input, other):
other = np.asarray(other)
return (
torc... | |
if 3 - 3: Ii1I
lisp_send ( lisp_sockets , oO0o0 , LISP_CTRL_PORT , packet )
return
if 68 - 68: OOooOOo * ooOoO0o . I1IiiI - iII111i
if 81 - 81: I11i % Oo0Ooo / iII111i
if 44 - 44: Oo0Ooo
if 90 - 90: Oo0Ooo . ooOoO0o / IiII * I1Ii111 . ooOoO0o + II111iiii
if 43 - 43: iIii1I11I1II1 % OOooOOo + OoOoOO00 + I1ii11iIi... | |
<gh_stars>0
# coding=utf-8
""" Implement Mahjong Judger class
"""
import sys
from collections import defaultdict
from p2_mahjong.DEF import CardIdDef, ActionType, CARD3_SET_NUM
from p2_mahjong.utils import DIC_CHOW, card_decoding_dict
log_head = "judger.py "
class MahjongJudger(object):
""" Determine what cards a pl... | |
-8.544630002726358,
('B', 'v'): -1.82571749752844,
('B', 'vd'): -7.985014214790934,
('B', 'vn'): -3.4046735555274314,
('B', 'z'): -7.117513647086211,
('S', 'a'): -4.23103835946917,
('S', 'ag'): -8.111765920430077,
('S', 'b'): -6.5693922385765235,
('S', 'c'): -5.69923624011327,
('S', 'd'): -4.625962454579542,
... | |
import os
from xml.etree import ElementTree
from math import *
file_name = 'land_units.xml'
file_name2 = 'main_units.xml'
file_name3 = 'melee_weapons.xml'
file_name4 = 'unit_armour_types.xml'
file_name5 = 'projectiles.xml'
file_name6 = 'missile_weapons.xml'
file_name7 = 'projectiles_explosions.xml'
file_name8 = 'battl... | |
which last state change happened. Milliseconds part.
"""
try :
return self._statechangetimemsec
except Exception as e:
raise e
@property
def tickssincelaststatechange(self) :
"""Time in 10 millisecond ticks since the last state change.
"""
try :
return self._tickssincelaststatechange
except Ex... | |
#
# Copyright (c) 2020, Neptune Labs Sp. z o.o.
#
# 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 ... | |
<gh_stars>1-10
import psycopg2
import pickle
import numpy as np
from collections import defaultdict
import pandas as pd
import statsmodels.formula.api as smf
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings("ignore")
sns.set(context='poster')
pd.set_option('display.width',... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.