input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
self.setglobal(__file__)
self.runpy()
class E36abmag(basecase.effstimCase):
def setUp(self):
self.spectrum="bb(3000) "
self.obsmode="acs,wfc1,f775w"
self.form="abmag"
self.setglobal(__file__)
self.runpy()
class E36stmag(basecase.effstimCase):
def setUp(self):
self.spectrum="bb(3000) "
self.obsmode="acs,wf... | |
import torch
from torch.autograd import Variable
import numpy as np
import util
import classifier
from util import cal_macc
from lib import generate_syn_feature
from binary_classifier import BINARY_CLASSIFIER
from knn_classifier import KNNClassifier
import os
from datetime import datetime
import pickle
import numpy as ... | |
#!/usr/bin/env python3
"""
lang.py
Type: module
Description: a parser for a file type that makes it easier to implement
various languages in a game
Classes:
- LangNode
- LangEval
Functions:
- load(path, encoding, as_dict)
- loads(s, encoding, as_dict, file)
Lang syntax
===========
The file can contain attr... | |
)
#
#
#
def sigmoid(self, x):
return 1 / (1+numpy.exp(-x))
#
#
def compute_hidden_states(self):
# every time it is called,
# it computes the new hidden states of the LSTM
# it gets the last event in the sequence
# which is generated at t_(rec(t))
# and compute its hidden states
# Note : for this event, we... | |
----------
resource_path : str
Path to the method endpoint, relative to the base URL.
method : str
HTTP method verb to call.
path_params : Union[Dict[str, Union[str, int]], List[Tuple]]
Path parameters to pass in the URL.
query_params : Union[Dict[str, Union[str, int]], List[Tuple]]
Query parameters to pass in ... | |
self.testers = testers
self.temp_dir = args.tempdir or tempfile.mkdtemp()
self.debug = args.debug
self.stop_on_error = args.stop_on_error
self.gold_dirs = args.gold_dirs
def run(self):
failures = []
for producer, consumer in itertools.product(
filter(lambda t: t.PRODUCER, self.testers),
filter(lambda t: t.CO... | |
#**************************************************************
#
# 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... | |
is a command.
cmd = msg.startswith(glob.config.command_prefix) \
and await commands.process_commands(p, t, msg)
if cmd and 'resp' in cmd:
# Command triggered and there is a response to send.
p.enqueue(await packets.sendMessage(t.name, cmd['resp'], client, t.id))
else: # No command triggered.
if match := regexes... | |
# -*- coding:UTF8 -*-
#!/usr/bin/python
#Shieber on 2018/8/7
#树,二叉堆的结构
########################################################
#树的实现方法一:列表
def BinaryTree1(tree):
'''二叉树的实现'''
return [tree,[],[]]
def getRootVal(root):
return root[0]
def setRootVal(root,newVal):
root[0] = newVal
def getLeftChild(root):
return ... | |
"""
mcpython - a minecraft clone written in python licenced under the MIT-licence
(https://github.com/mcpython4-coding/core)
Contributors: uuk, xkcdjerry (inactive)
Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence
Original game "minecraft" by Mojang Studios (www.m... | |
batch_size, self.n_hidden)
return hidden
def forward(self, x):
batch_size = x.size(0)
x = x.permute(1,0,2)
# Initializing hidden state for first input using method defined below
hidden = self.init_hidden(batch_size)
pdb.set_trace()
# Passing in the input and hidden state into the model and obtaining output... | |
###################
# 0. General Setup:
###################
import sqlite3
import numpy as np
MAX_IMAGE_ID = 2**31 - 1
# Strings of SQL Commands:
##########################
CREATE_CAMERAS_TABLE = """CREATE TABLE IF NOT EXISTS cameras (
camera_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
model INTEGER NOT NULL,
... | |
v in self.params.items() if v is not None)
)
# Verify that the name is unquoted correctly in the
# secrets.on_get function prior to searching the repo.
self.secret_repo.get_by_create_date \
.assert_called_once_with(self.keystone_id,
offset_arg=u'{0}'.format(self.offset),
limit_arg=u'{0}'.format(self.limit),
sup... | |
from __future__ import print_function, absolute_import, division
from contextlib import contextmanager
import numpy as np
import scipy.sparse as ss
from numba import cuda
from .binding import (cuSparse, CUSPARSE_INDEX_BASE_ZERO,
CUSPARSE_INDEX_BASE_ONE)
dtype_to_char = {
np.dtype(np.float32): 'S',
np.dtype(np.float... | |
id for each row in the dense tensor
represented by sp_ids (i.e. there are no rows with empty features), and that
all the indices of sp_ids are in canonical row-major order.
It also assumes that all id values lie in the range [0, p0), where p0
is the sum of the size of params along dimension 0.
!!! note
in tensor... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script saves bid and ask data for specified ETFs to files for each day
during market open hours.
It assumes the computer is at US East Coast Time.
@author: mark
"""
import os
import pandas as pd
import numpy as np
from itertools import product
import streaml... | |
in conjunction with `access_control_translation` override configuration.
"""
return pulumi.get(self, "account")
@property
@pulumi.getter(name="encryptionConfiguration")
def encryption_configuration(self) -> Optional['outputs.BucketReplicationConfigRuleDestinationEncryptionConfiguration']:
"""
A configuration bl... | |
type of activation function to use in MLP. \
If ``None``, then default set activation to ``nn.ReLU()``. Default ``None``.
- norm_type (:obj:`str`): The type of normalization to use. See ``ding.torch_utils.network.fc_block`` \
for more details. Default ``None``.
- noise (:obj:`bool`): Whether use ``NoiseLinearLayer`... | |
res3 = res3[1:]
aNew.append(a)
res_final.append(aNew)
return render_template('hn_viewwn.html', username=username, result=res_final, messages=msg,
userRole=userRole)
else:
print("NULL")
msg = "none"
return render_template('hn_viewwn.html', username=username, messages=msg, userRole=userRole)
@app.route('/hn_vie... | |
if index is out of range.
If errors=='ignore', return None if index is out of range.
default is 'ignore'.
Usage:
>>> from ds.cdll import CDLList
>>> cdll = CDLList([1, 2, 3])
>>> cdll
CDLList(head=Node(value=1, left=<class 'ds.cdll.Node'>, right=<class 'ds.cdll.Node'>), size=3)
>>> cdll.peek(0)
1
>>> cdll.pe... | |
parsed_ca.pop('creator_id', None)
if creator_id is not None:
self.creator_id = creator_id
project_id = parsed_ca.pop('project_id', None)
if project_id is not None:
self.project_id = project_id
for key in parsed_ca:
meta = CertificateAuthorityMetadatum(key, parsed_ca[key])
self.ca_meta[key] = meta
self.statu... | |
id
:param imageid: AWS OS AMI image id or
Azure image references offer and sku: e.g. 'UbuntuServer#16.04.0-LTS'.
:param instancetype: AWS instance resource type e.g 'd2.4xlarge' or
Azure hardware profile vm size e.g. 'Standard_DS14_v2'.
:param user: remote ssh user for the instance
:param localpath: localpath whe... | |
from start to end
# http://gavwood.com/paper.pdf
data = self.try_simplify_to_constant(self.read_buffer(start, size))
if issymbolic(data):
known_sha3 = {}
# Broadcast the signal
self._publish(
"on_symbolic_sha3", data, known_sha3
) # This updates the local copy of sha3 with the pairs we need to explore
value =... | |
= Constraint(expr= m.b55 + m.b79 <= 1)
m.c295 = Constraint(expr= m.b56 + m.b80 <= 1)
m.c296 = Constraint(expr= m.b57 + m.b81 <= 1)
m.c297 = Constraint(expr= m.b58 + m.b82 <= 1)
m.c298 = Constraint(expr= m.b59 + m.b83 <= 1)
m.c299 = Constraint(expr= m.b60 + m.b84 <= 1)
m.c300 = Constraint(expr= m.x127 == 0)
m.c30... | |
<gh_stars>0
################################################################################
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or... | |
import numpy as np
import scipy.special as special
import scipy.spatial.distance as distfuncs
def cart2sph(x, y, z):
"""Conversion from Cartesian to spherical coordinates
Parameters
------
x, y, z : Position in Cartesian coordinates
Returns
------
phi, theta, r: Azimuth angle, zenith angle, distance
"""
r_... | |
<reponame>BenniSchmiedel/ECO
import numpy as np
import xarray as xr
import xgcm
class Grid_ops:
"""
An object that includes operations for variables defined on a xgcm compatible grid.
Those operations are defined to simplify dealing with mathematical operations that shift grid point positions
when applied.
Note... | |
def __init__(self, *args, **options):
"""
Initialize a :class:`RemoteCommand` object.
:param args: Refer to the initializers of the :class:`RemoteAccount`
and :class:`.ExternalCommand` classes.
:param options: Keyword arguments can be used to conveniently override
the values of :attr:`batch_mode`,
:attr:`connec... | |
import numpy as np
import matplotlib
matplotlib.use("Agg") # Must be before importing matplotlib.pyplot or pylab!
from matplotlib import pyplot as plt
from matplotlib.colors import to_rgb
from matplotlib import cm
from mpl_toolkits.mplot3d import proj3d, Axes3D
from tqdm import tqdm
from typing import Dict, Sequence
... | |
<reponame>DeliciousLlama/MCturtle<gh_stars>0
from mcpi.minecraft import Minecraft
from math import *
import time
import enum
# ----enums----
class direction(enum.Enum):
LEFT = 0
RIGHT = 1
UP = 2
DOWN = 3
KEEP_SAME = 4
class heading(enum.Enum):
DOWN = 0
UP = 1
NORTH = 2
SOUTH = 3
WEST =... | |
<filename>openerp/addons/web/http.py
# -*- coding: utf-8 -*-
#----------------------------------------------------------
# OpenERP Web HTTP layer
#----------------------------------------------------------
import ast
import cgi
import contextlib
import functools
import getpass
import logging
import mimetypes
import os
... | |
"gifs": 0,
"fetch_date": datetime.strptime("2000-01-01 23:59:59", DATE_TIME_FORMAT)
})
]
user_features = UserFeatures(user, tweets)
self.assertAlmostEqual(user_features[USER_FEATURES_INDEX["emoji_only_tweets_mean"]], np.mean([0, 1, 1]))
def test_number_of_tweet_languages_nan(self):
user_dic = {
"id": 1,
"na... | |
# MIT License
#
# Copyright (c) 2020 Sixshaman
#
# 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, pu... | |
Rune if you have not detonated Runes in the past 1.5 seconds",
"Frostblink has 75% increased maximum travel distance",
"15% increased Rallying Cry Buff Effect",
"Tectonic Slam deals 25% increased Damage",
"25% increased Creeping Frost Damage",
"Earthshatter deals 25% increased Damage",
"Wintertide Brand deals 25%... | |
documented below.
:param pulumi.Input[str] fingerprint: Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking.
:param pulumi.Input[str] health_checks: The set of URLs to HealthCheck resources for health checking
this RegionBackendService. Currently at mo... | |
string by x number of characters."""
indented_string = ''
for line in string.splitlines():
indented_string += '%s%s\n' % ((' ' * chars), line)
# Strip the ending '\n' and return result.
return indented_string[0:-1]
def is_binary_file(file_path, bytes_to_read=1024):
"""Return true if the file looks like a bina... | |
check that formats are added only when CWL can resolve references
# FIXME: no format is back-propagated from WPS format to CWL at the moment
# (https://github.com/crim-ca/weaver/issues/50)
"wps_only_format_exists": "File",
"wps_only_format_not_exists": "File",
"wps_only_format_both": "File",
"cwl_only_format_exis... | |
<filename>src/LineageTree/lineageTree.py
#!python
# This file is subject to the terms and conditions defined in
# file 'LICENCE', which is part of this source code package.
# Author: <NAME> (<EMAIL>)
from scipy.spatial import cKDTree as KDTree
import os
import xml.etree.ElementTree as ET
from copy import copy
from sci... | |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 11 14:01:00 2020
@author: hvf811
"""
seed_val = 1234
import os
import tensorflow as tf
from tensorflow.keras.layers import Dense, Input, Dropout,Multiply, LSTM, Add, Concatenate, TimeDistributed
from tensorflow.keras.layers import Conv1D, Flatten, Lambda, ... | |
import re
from typing import Optional, Dict, List, Union
import functools
def select_most_frequent_shingles(matches: List[str],
db: Dict[str, int],
min_count_split: int,
threshold: float):
"""Select the most frequent shingles that matches the wildcard shingle
Parameters:
-----------
matches : List[str]
A lis... | |
import os
import sys
import importlib
import pkg_resources
import json
import argparse
import yaml
import re
import copy
from datetime import datetime
from .config_loader import ConfigLoader
from .dependency_grapher import DependencyGrapher
from .git import Git
from .run import run
from .token_interpolator import Toke... | |
#!/usr/bin/python3.5
class Playing:
clicks = 9
def __init__(self, random, app, who_winner):
self.app = app
self.random = random
self.who_winner = who_winner
self.first_player = random.randint(1,2)# فعلا از این قابلیت استفاده نشود
self.check_button_list = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9']
de... | |
<filename>dorado/lagrangian_walker.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Core functions to handle the Lagrangian random walk movement of the particles.
Project Homepage: https://github.com/passaH2O/dorado
"""
from __future__ import division, print_function, absolute_import
from builtins import range, map
from math... | |
MA', 'pt': 'Lajeado Novo - MA'},
'55993586':{'en': 'Ribamar Fiquene - MA', 'pt': 'Ribamar Fiquene - MA'},
'55993587':{'en': u('S\u00e3o Francisco do Brej\u00e3o - MA'), 'pt': u('S\u00e3o Francisco do Brej\u00e3o - MA')},
'55993592':{'en': u('A\u00e7ail\u00e2ndia - MA'), 'pt': u('A\u00e7ail\u00e2ndia - MA')},
'55993... | |
with '
'repositories that support server-side '
'changesets.',
},
'submit_as': {
'type': str,
'description': 'The optional user to submit the review '
'request as. This requires that the actual '
'logged in user is either a superuser or has '
'the "reviews.can_submit_as_another_user" '
'permission.',
},
})
... | |
<reponame>kperrynrel/rdtools
'''Functions for normalizing, rescaling, and regularizing PV system data.'''
import pandas as pd
import pvlib
import numpy as np
from scipy.optimize import minimize
import warnings
from rdtools._deprecation import deprecated
class ConvergenceError(Exception):
'''Rescale optimization did... | |
#!/usr/bin/env python
"""Test suite for :py:mod:`plastid.readers.bigbed`
Notes
-----
Several of these tests are tested against |GenomeHash|, and so will fail if
|GenomeHash| is malfunctioning
"""
import unittest
import copy
import warnings
from random import shuffle
from pkg_resources import resource_filename, clean... | |
import numpy as np
class PlanarPauli:
"""
Defines a Pauli operator on a planar lattice.
Notes:
* This is a utility class used by planar implementations of the core models.
* It is typically instantiated using :meth:`qecsim.models.planar.PlanarCode.new_pauli`
Use cases:
* Construct a planar Pauli operator b... | |
sets and follow sets **********************************************
EMPTY = "(empty)"
END = None
TerminalOrEmpty = str
TerminalOrEmptyOrErrorToken = typing.Union[str, ErrorTokenClass]
StartSets = typing.Dict[Nt, OrderedFrozenSet[TerminalOrEmptyOrErrorToken]]
def start_sets(grammar: Grammar) -> StartSets:
"""Comput... | |
song_properties = dict()
# Calculate the average 20D feature vector for the mfccs
for song_file in self.song_files:
filename, _ = os.path.splitext(os.path.basename(song_file))
l.debug("Currently loading %s.", filename)
if cache_dir and os.path.isfile(
os.path.join(cache_dir, filename + "_done")):
l.debug("Loadi... | |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser 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 the hope that it will b... | |
1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0],
[1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, ... | |
"""Contains eventful dict and list implementations."""
# void function used as a callback placeholder.
def _void(*p, **k): return None
class EventfulDict(dict):
"""Eventful dictionary.
This class inherits from the Python intrinsic dictionary class, dict. It
adds events to the get, set, and del actions and optiona... | |
import os, sys
import re
CONFIG_BAK_PATH = ".important.bak"
AOS_MAKEFILE = "aos.mk"
COMPONENT_KEYWORD = "KEYWORD: COMPONENT NAME IS "
def find_comp_mkfile(dirname):
""" Find component makefile (aos.mk) from dirname and its subdirectory,
exclude out, build, publish folder """
mklist = []
for root, dirs, files in ... | |
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2020 Apple Inc. All rights reserved.
#
'''Train CIFAR10 with PyTorch.'''
# import os
# os.environ['CUDA_LAUNCH_BLOCKING'] = "1"
# pip install pytorch-warmup
# Num epochs=600, lr scheduler after every 100 epochs
# CUDA_VISIBLE_DEVICES=0 python3 main1.py --... | |
<filename>pbd/system_enums.py<gh_stars>1-10
class EnumInfo(object):
def __init__(self, name, value, m_6):
self.name = name
self.value = value
self.m_6 = m_6
def __str__(self):
pass
enum_main = dict()
e_4000 = dict()
e_4000[0] = EnumInfo('defaultrole', 0, 0)
e_4000[1] = EnumInfo('titlebarrole', 1, 0)
e_4000[2... | |
<filename>tests/unittests/test_mock_network_plugin_public_nat.py
# Copyright (c) 2014-2020 Cloudify Platform Ltd. 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:... | |
<filename>mockupdb/__init__.py<gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | |
<gh_stars>0
from .models import *
from datetime import datetime
from django.core.exceptions import ObjectDoesNotExist
import json
from WebAppsMain.settings import TEST_WINDOWS_USERNAME, TEST_PMS, TEST_SUPERVISOR_PMS, TEST_COMMISSIONER_PMS
from WebAppsMain.testing_utils import HttpPostTestCase, HttpGetTestCase
from djan... | |
import discord
import asyncio
import uuid
import ast
from redbot.core import Config
from redbot.core import commands
from redbot.core import checks
from redbot.core.utils.predicates import ReactionPredicate
from redbot.core.utils.menus import start_adding_reactions, menu, DEFAULT_CONTROLS
k_factor = 40
defaults = {"... | |
<reponame>taodav/novelty-search-repr-space<filename>nsrl/experiment/exploration_helpers.py
import json
import os
import copy
import numpy as np
import torch
import json
from deer.experiment.base_controllers import Controller
from deer.helper.exploration import calculate_scores
from deer.helper.knn import ranked_avg_knn... | |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import argparse
import json
import random
from src.data.loader import check_data_params, load_data
from src.evaluation.evaluat... | |
<gh_stars>1-10
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'overview.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
Ma... | |
nn.Conv2d(in_channels=self.refine_channel//2, out_channels=self.refine_channel//2, kernel_size=self.refine_kernel, padding = (self.refine_kernel-1)//2)
self.convr3 = nn.Conv2d(in_channels=self.refine_channel//2, out_channels=1, kernel_size=self.refine_kernel, padding = (self.refine_kernel-1)//2)
self.act_fn = nn.Lea... | |
value in DevicePolicyTimestamp using the specified operator. The value in this input will be treated as an explicit constant value. Either this field or val_f_DevicePolicyTimestamp must be specified if op_DevicePolicyTimestamp is specified.
:type val_c_DevicePolicyTimestamp: String
| ``api version min:`` None
| ``a... | |
<reponame>nat143/lastfm-data-exporter<filename>main.py
'''
Copyright 2016 <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 app... | |
there's already")
with assertRaisesRegex(self, command.CommandException, "Bad request. Maybe there's already"):
command.create_user('', '<EMAIL>', team='qux')
def test_user_create_bogus_team(self):
self._mock_error('users/create', status=400, team='qux', message="Please enter a valid email address.")
with assertR... | |
988,
(None, None),
# (flag_str, value, pre_delay_ms)
(("start", 0, None),
(None, 9, None),
(None, 5, None),
("end", 13, None)),
self.get_expected_result(27, 13, trial, "end"),
protocol),
kwargs={'sequence_name' : "{}_{}".format(self._testMethodName, protocol)}))
for t in threads:
t.start()
for t in threads... | |
#!/usr/bin/env python3
# Copyright 2020 Canonical Ltd.
#
# 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 ... | |
self.helper('git', 'checkout', '79b3762')
self._apply_patches()
@stage
def configure(self):
# The code is stored one folder down
self.workdir = os.path.join(self.workdir, 'isis')
super(isis, self).configure(other=['-Dpybindings=Off','-DJP2KFLAG=OFF','-DbuildTests=OFF']) #-DNinja
class stereopipeline(GITPacka... | |
<filename>build/lib/WORC/classification/SearchCV.py
#!/usr/bin/env python
# Copyright 2016-2019 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file ... | |
dtype=np.int32)
gt_actions[ix, :] = np.zeros((self.num_actions), dtype=np.int32)
for aid in np.argwhere(tmp_action == 1): # loop 26 actions
# import ipdb
# ipdb.set_trace()
for j, rid in enumerate(self.roles[aid[0]]):
if rid == 'agent':
continue
else:
# tmp_role_id[aid[0]]
if np.all(tmp_role_id[aid[0]] == -1... | |
# "time": 1640819389454,
# "orderId": "a17e0874ecbdU0711043490bbtcpDU5X",
# "seqNum": -1,
# "orderType": "Limit",
# "execInst": "NULL_VAL",
# "side": "Buy",
# "symbol": "BTC-PERP",
# "price": "30000",
# "orderQty": "0.002",
# "stopPrice": "0",
# "stopBy": "ref-px",
# "status": "Ack",
# "lastExecTime": 16408... | |
#!/usr/bin/env python3
""" FOP
Filter Orderer and Preener
Copyright (C) 2011 Michael
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 lat... | |
<gh_stars>100-1000
"""
By <NAME> <<EMAIL>>
ecdsa implementation in python
demonstrating several 'unconventional' calculations,
like finding a public key from a signature,
and finding a private key from 2 signatures with identical 'r'
"""
def GCD(a, b):
"""
(gcd,c,d)= GCD(a, b) ===> a*c+b*d!=gcd:
"""
if a == 0:
r... | |
<filename>src/jobTreeSlave.py
#!/usr/bin/env python
#Copyright (C) 2011 by <NAME> (<EMAIL>)
#
#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 t... | |
# This class defines key analytical routines for performing a 'gap-analysis'
# on EYA-estimated annual energy production (AEP) and that from operational data.
# Categories considered are availability, electrical losses, and long-term
# gross energy. The main output is a 'waterfall' plot linking the EYA-
# estimated and... | |
219: '마그카르고',
220: '꾸꾸리',
221: '메꾸리',
222: '코산호',
223: '총어',
224: '대포무노',
225: '딜리버드',
226: '만타인',
227: '무장조',
228: '델빌',
229: '헬가',
230: '킹드라',
231: '코코리',
232: '코리갑',
233: '폴리곤2',
234: '노라키',
235: '루브도',
236: '배루키',
237: '카포에라',
238: '뽀뽀라',
239: '에레키드',
240: '마그비',
241: '밀탱크',
242: '해피너스',
243... | |
<reponame>AutoCoinDCF/NEW_API<filename>api/graph/utility/graph_inquiry.py
"""
SQLGraphAPI utility level:
1.create a sql query
2.call executor to execute sql query and get raw response data
3.simply pre-process raw data (generate frontend-defined response code, extract useful data from raw data)
"""
import time
# from... | |
'resource_id': 'resourceId',
},
'location_map': {
'project_id': 'path',
'location_id': 'path',
'agent_id': 'path',
'resource_id': 'path',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [],
},
api_client=api_client,
callable=__provider_project_agent_r... | |
import logging
import json
import base64
from django.core.paginator import Paginator
# Create your views here.
from rest_framework import viewsets, status
from rest_framework.decorators import action, detail_route
from rest_framework.generics import get_object_or_404
from rest_framework.response import Response
from d... | |
import random
import feedparser
import time
from DiscordCharacters import WoDCharacter
import os.path
from discord import message
def splitstr(text,length):
return [text[i:i+length] for i in range(0, len(text), length)]
# list of feeds to pull down
rss_feed_list = [ "https://www.reddit.com/r/WhiteWolfRPG/new.rss"
,... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import sys
import numpy as np
import scipy.optimize
import matplotlib.pyplot as plt
import cv2
import ellipse
DEBUG_IMAGES = []
def debug_show(name, src):
global DEBUG_IMAGES
filename = 'debug{:02d}_{}.png'.for... | |
42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 4... | |
/ (M-2.0) * sqrt((M-1.0) / (m*n*N*(M-N)))
g2 = M*(M+1) - 6.*N*(M-N) - 6.*n*m
g2 *= (M-1)*M*M
g2 += 6.*n*N*(M-N)*m*(5.*M-6)
g2 /= n * N * (M-N) * m * (M-2.) * (M-3.)
return mu, var, g1, g2
def _entropy(self, M, n, N):
k = np.r_[N - (M - n):min(n, N) + 1]
vals = self.pmf(k, M, n, N)
return np.sum(entr(vals), a... | |
of 1.2 to 1.5. However
# under these conditions there will be cases where two adjacent pixels will
# both be marked as maxima. Accordingly there is a final morphological
# thinning step to correct this.
# This function is slow. It uses bilinear interpolation to estimate
# intensity values at ideal, real-valued pi... | |
<filename>PROGRAMS/IGCSEPhysicsSorting.py
#IMPORTING NECESSARY LIBRARIES
import tkinter as tk
from tkinter import *
from tkinter import filedialog
from tkinter import Tk
from array import *
import os
import time
import PyPDF2
from tkinter import ttk
from ttkthemes import themed_tk as theme
#DEFINING IMPORT... | |
<filename>reVX/least_cost_xmission/least_cost_xmission.py
# -*- coding: utf-8 -*-
"""
Module to compute least cost xmission paths, distances, and costs one or
more SC points
"""
from concurrent.futures import as_completed
import geopandas as gpd
import json
import logging
import numpy as np
import os
import pandas as p... | |
import logging
import re
from django.apps import apps
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.contrib.admin import AdminSite
from django.contrib.admin.models import LogEntry
from django.contrib.admin.views.main import Chan... | |
# -*- coding: utf-8 -*-
"""Test suite for assets."""
import copy
import pytest
from axonius_api_client.constants import AGG_ADAPTER_ALTS, AGG_ADAPTER_NAME
from axonius_api_client.exceptions import ApiError, NotFoundError
from ...meta import FIELD_FORMATS, SCHEMA_FIELD_FORMATS, SCHEMA_TYPES
from ...utils import get_s... | |
<reponame>FZJ-IEK3-VSA/HiSim
# Generic/Built-in
import datetime
import math
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import pvlib
from dataclasses_json import dataclass_json
from typing import Optional
from dataclasses import dataclass
from functools import lru_cache
from hisim.... | |
an ancestor - used to find
the ancestor country location.
"""
country = current.gis.get_parent_country(id)
s3db = current.s3db
table = s3db.gis_hierarchy
fieldname = "edit_%s" % level
# Read the system default
query = (table.uuid == "SITE_DEFAULT")
if country:
# Try the Location's Country, but ensure we ha... | |
<gh_stars>0
import argparse
import numpy as np
import pandas as pd
import scipy.stats as stats
from sklearn.ensemble import RandomForestClassifier
#from sklearn.mixture import GaussianMixture
from sklearn.mixture import GMM
from statsmodels.sandbox.stats.multicomp import fdrcorrection0
from pyemd import emd
import... | |
<filename>tests/test_georaster.py
import pytest
import os
from tempfile import TemporaryDirectory, NamedTemporaryFile
from copy import deepcopy
import numpy as np
from affine import Affine
from rasterio.enums import Resampling, MaskFlags
from unittest.mock import Mock
from PIL import Image
from shapely.geometry import... | |
import pendulum as pdl
import sys
sys.path.append(".")
# the memoization-related library
import loguru
import itertools
import portion
import klepto.keymaps
import CacheIntervals as ci
from CacheIntervals.utils import flatten
from CacheIntervals.utils import pdl2pd, pd2pdl
from CacheIntervals.utils import Timer
... | |
y)
assert len(mock_estimator_fit.call_args[0][0]) == len(
mock_estimator_fit.call_args[0][1]
)
assert len(mock_estimator_fit.call_args[0][0]) == int(1.25 * 90)
def test_component_graph_equality(example_graph):
different_graph = {
"Target Imputer": [TargetImputer, "X", "y"],
"OneHot": [OneHotEncoder, "Target Im... | |
t.start()
else:
# value 2+: the 2nd thread in queue will include changes for this sync_storage_databases request
logger.info("%s::%s: PASS THREAD, sync_queue full: nb=%s" %
(__class__.__name__, __name__, len(sync_queue)))
@staticmethod
def thread_sync_storage_databases():
"""
One sync at a time is possible.
O... | |
"""
Unit tests for the QVM simulator device.
"""
import logging
import re
import networkx as nx
import pytest
import re
import pennylane as qml
from pennylane import numpy as np
from pennylane.operation import Tensor
from pennylane.circuit_graph import CircuitGraph
from pennylane.wires import Wires
from pyquil.quil ... | |
<filename>hw3/asp_planner_core.py
"""
An algorithm to solve sequential planning problems (specified in a format unique to this assignment) with Clingo
Author: <NAME>
Student ID: 12547190
References:
- plasp 3: Towards Effective ASP Planning (Dimopoulos et al. 2018)
https://arxiv.org/pdf/1812.04491.pdf
- Potass... | |
2D+F E+2F 3F+G 5G
C | C D+E C+E+F D+3F 2E+2F+G 4F+3G 10G
D | D 2D+F D+3F 2D+4F+G 6F+2G 6F+7G 20G
E | E E+2F 2E+2F+G 6F+2G 2E+4F+5G 6F+12G 30G
F | F 3F+G 4F+3G 6F+7G 6F+12G 6F+27G 60G
G | G 5G 10G 20G 30G 60G 120G
""" # parabolics of S_5
tables["D_4"] = open("D_4.table").read()
tables["PD_4"] = """
| A B C D E... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.