input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
"""Loss functions."""
import numpy as np
import tensorflow as tf
import dnnlib.tflib as tfli... | |
'generic':
edge_list.append((reactant1, product))
edge_list.append((reactant2, product))
node_set.add(reactant1)
node_set.add(reactant2)
node_set.add(product)
node_set.update(mod_species)
if edge_type == 'metabolic':
if reactant1 != reactant2 and reactant1 != product and reactant2 != product:
edge_list.append... | |
reporter=TextReporter(pylint_output), exit=False)
return pylint_output.read()
def _test_python_file(algo_type: str, lang: str, filepath: str, test_folder: str) -> Union[tuple, dict]:
"""Tests the python file
Arguments:
algo_type: the type of algorithm to test
lang: the language to test
filepath: the file to te... | |
<gh_stars>0
#!/usr/bin/env python
"""
Tests of our HDF5 reader, or perhaps more accurately test of our
understanding of how to use the h5py module.
"""
import h5py
import numpy
import storm_analysis
import storm_analysis.sa_library.sa_h5py as saH5Py
import storm_analysis.sa_library.writeinsight3 as i3w
class FakeR... | |
#
# Copyright (c) 2021 Citrix Systems, 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
#
# Unless required by applicable law or agreed to in... | |
<gh_stars>10-100
# Copyright (C) 2013 Sony Mobile Communications AB.
# All rights, including trade secret rights, reserved.
import os
import sys
import StringIO
import shutil
import ave.git
import vcsjob
import vcsjob.vcs
from ave.workspace import Workspace
# redirect stdout to a testable buffer. keep a backup to ... | |
not specified otherwise.
Parameters:
quantity:
The quantity of the currency the position holds
code:
The currency code of the currency this Cash position represents
Attributes:
code (str):
The currency code of the currency underlying this position
"""
def __init__(self, quantity: float, code: Optional[str... | |
import argparse
from collections import defaultdict
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
from allennlp.data.vocabulary import Vocabulary
from allennlp.data.samplers import BucketBatchSampler
from allennlp.data.dataset import Batch
# from allennlp.data.dataloader import DataLoad... | |
#!/usr/bin/env python -W ignore
from absl import flags
from absl import app
import pandas as pd
import numpy as np
import sys
from sodapy import Socrata
from os.path import abspath
from os.path import exists
from os import mkdir
FLAGS = flags.FLAGS
# delcare flags
flags.DEFINE_string("token", None, "SPARCS Socrates ... | |
<reponame>danielesgit/slingen
#!/usr/bin/python
'''
Created on Apr 11, 2012
@author: danieles
'''
import random
import os
import subprocess
import shlex
import time
import itertools
import traceback
from datetime import datetime, date
from copy import copy, deepcopy
from src.dsls.processing import trackTiling
from s... | |
<reponame>getlantern/lantern-archive<gh_stars>1-10
# -*- coding: utf-8 -*-
#
# PublicKey/RSA.py : RSA public key primitive
#
# Written in 2008 by <NAME> <<EMAIL>>
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that ... | |
# -*- coding: utf-8 -*-
"""Common PageObject actions."""
import hashlib
import io
import logging
import random
import string
import sys
import time
import traceback
import uuid
from collections import defaultdict, namedtuple
from contextlib import contextmanager
from io import BytesIO
from types import FunctionType, Mo... | |
()
, org_location = Link ("org_location")
, contract_type = Link ('contract_type')
, time_project = Link ("time_project")
, duration = Interval ()
, is_valid = Boolean ()
, durations_allowed = Boolean ()
, all_in = Boolean ()
)
auto_wp.setlabelprop ("name")
overtime_period = Class \
( db
, ''"overtime_peri... | |
LAYER_OUT_NUM,\n')
code.append(indent(1) + 'uint LAYER_IN_NUM_T,\n')
code.append(indent(1) + 'uint LAYER_OUT_NUM_T,\n')
code.append(indent(1) + 'uint LAYER_IN_IMG_H,\n')
code.append(indent(1) + 'uint LAYER_IN_IMG_W,\n')
code.append(indent(1) + 'uint LAYER_OUT_IMG_H,\n')
code.append(indent(1) + 'uint LAYER_OUT_IMG... | |
"""Permission storage model."""
import logging
from enum import IntEnum
from functools import reduce
from typing import List, Optional, Union
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, User
from django.db import models, transaction
log... | |
# -*- coding: utf-8 -*-
import logging
from abc import ABC, abstractmethod
import numpy as np
import cvxpy as cp
def cvx_desc_to_solver(solver_desc):
if solver_desc == "SCS":
return cp.SCS
elif solver_desc == "MOSEK":
return cp.MOSEK
elif solver_desc == "CVXOPT":
return cp.CVXOPT
elif solver_desc == "OSQP":
r... | |
# -*- coding: utf-8 -*-
"""PyVisio documents - Visio Document manipulation module"""
import logging
from .visCOM import visCOMobject as vCOM
#from visCOM import visCOMconstants as vC
from .visCOM import com_error
logging.info("documents loaded...")
logger = logging.getLogger(__name__)
logger.setLevel(loggin... | |
import os
import logging
import torch
import torch.nn as nn
from torchvision.models.detection import maskrcnn_resnet50_fpn
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from torchvision.models.detection.mask_rcnn import MaskRCNNPredictor
import warnings
import numpy as np
from torch.ba... | |
0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.172739,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic':... | |
r'%s:%s(?:\?%s)?(?:#%s)?' % (scheme, hier_part, query, fragment)
URI_reference = r'(?:%s|%s)' % (URI, relative_ref)
STRICT_URI_PYREGEX = r"\A%s\Z" % URI
STRICT_URIREF_PYREGEX = r"\A(?!\n)%s\Z" % URI_reference
global URI_PATTERN, URI_REF_PATTERN
URI_PATTERN = re.compile(STRICT_URI_PYREGEX) # strict checking for U... | |
to
be caught. Can be as generic as `AsanaError`, but testing for something
more specific is better to improve coverage.
log_index (int): The index to check in caplog for the desired exception
log message.
func (function): The reference to the function to call to test.
*args ([any]): The positional arguments to pa... | |
<filename>Bio/SeqIO/_index.py<gh_stars>1-10
# Copyright 2009-2010 by <NAME>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Dictionary like indexing of sequence files (PRIVATE)... | |
from a ratemap.
Parameters
----------
ratemap : array
Array of shape (n_units, ext_nx, ext_ny)
Returns
-------
"""
n_units, ext_nx, ext_ny = ratemap.shape
if occupancy is None:
# assume uniform occupancy
self._occupancy = np.ones((ext_nx, ext_ny))
if ext_xmin is None:
ext_xmin = 0
if ext_xmax is None... | |
= self.get("input.rerun%s.missin.Descent.ninde" % (i))
re_dedcd = self.get("input.rerun%s.missin.Descent.dedcd" % (i))
re_rdlim = self.get("input.rerun%s.missin.Descent.rdlim" % (i))
re_ns = self.get("input.rerun%s.missin.Descent.ns" % (i))
re_irs = self.get("input.rerun%s.missin.Reserve.irs" % (i))
re_resrfu = se... | |
import asyncio
import json
import os
import string
from statistics import mean
from typing import Any
import pytz
from django.conf import settings
from django.contrib.postgres.fields import ArrayField
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from loguru impor... | |
"""
Core classes for autodp:
Mechanism --- A `mechanism' describes a randomized algorithm and its privacy properties.
All `mechanism's (e.g., those in the `mechanism_zoo' module) inherit this class.
Transformer --- A transformer takes one or a list of mechanism and outputs another mechanism
All `transformer's (e.g.... | |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import discord
import discord.ext.commands as commands
import os
import re
from typing import Callable, Dict, List, Optional, Tuple, Union
import pss_assert
from cache import PssCache
import pss_core as core
import pss_entity as entity
import pss_lookups as lookups
import... | |
an inspector per row.
def children( self, target ) :
return []
##########################################################################
# DiffRow
##########################################################################
## A row which displays a diff from values generated by an Inspector.
class DiffRow( Row ) ... | |
#!/usr/bin/env python
# encoding: utf-8
"""
@author: zhanghe
@software: PyCharm
@file: production.py
@time: 2018-03-16 09:59
"""
from __future__ import unicode_literals
from datetime import datetime
from flask import (
request,
flash,
render_template,
url_for,
redirect,
abort,
jsonify,
Blueprint,
)
from fla... | |
import copy
import datetime
import uuid
from contextlib import contextmanager
from cdislogging import get_logger
from future.utils import iteritems
from sqlalchemy import (
BigInteger,
Column,
DateTime,
ForeignKey,
ForeignKeyConstraint,
Index,
Integer,
String,
and_,
func,
not_,
or_,
select,
)
from sqlalch... | |
# Copyright 2019 Huawei Technologies Co., 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 agreed to... | |
# Change some settings here since the autoconfig must only be changed
# through typing `:set` in the browser and for keybinding/aliases that
# is not recommended. (Saving in the browser is done by typing `sf`).
# Loading autoconfig.yml
config.load_autoconfig()
# Bindings
c.bindings.default = {
'normal': {
# General... | |
#
# Copyright 2019 BrainPad Inc. All Rights Reserved.
#
# 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, me... | |
for the crosshair.
:type color: A string (either a predefined color name in colors.py
or "#RRGGBB")) or a 4 columns unsigned byte array
(Default: black).
:param int linewidth: The width of the lines of the crosshair
(Default: 1).
:param str linestyle: Type of line::
- ' ' no line
- '-' solid line (the default)... | |
= MockStorage(core_management_host=None, core_management_port=None)
scheduler._storage_async = MockStorageAsync(core_management_host=None, core_management_port=None)
mocker.patch.object(scheduler, '_schedule_first_task')
log_exception = mocker.patch.object(scheduler._logger, "exception")
new_schedules = copy.deepc... | |
len(sl_center)
# Fitting Gaussians to skylines...
say_status = 0
self.wavelength_offset_per_fibre = []
wave_median_offset = []
print("\n> Performing a Gaussian fit to selected, bright skylines... (this will FAIL if RSS is not corrected for CCD defects...)")
if fibre != 0:
f_i = fibre
f_f = fibre + 1
print(" ... | |
# cashierAccount
from Tkinter import *
import tkMessageBox , ttk , pickle , datetime , re
class NegativeError(Exception) :
pass
class PositiveError(Exception) :
pass
class iteminfo(object):
def __init__(self):
self.icode = StringVar()
self.item = StringVar()
self.price = StringVar()
self.qty ... | |
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------------
# Copyright 2020 VMware, Inc. All rights reserved.
# AUTO GENERATED FILE -- DO NOT MODIFY!
#
# vAPI stub file for package com.vmware.vcenter.lcm.discovery.
#-------------------------------------------------------------... | |
feat1.name == feat2.name:
combinations = [(dipole1, dipole2), (dipole2, dipole1)]
for d1, d2 in combinations:
dipole_grp1, dipole_atm1, dipole_type1 = d1
dipole_grp2, dipole_atm2, dipole_type2 = d2
# Model: A-N ... E-Y
y_atm = dipole_grp2.atoms[1] if dipole_grp2.atoms[0] == dipole_atm2 else dipole_grp2.atoms[0]... | |
obj and 'value' in obj:
return {
'encoding': 'escape',
'value': {_json_key(k): to_reversible_json_structure(v) for k, v in obj.items()},
}
else:
return {_json_key(k): to_reversible_json_structure(v) for k, v in obj.items()}
# We do not use "is_sequence" because we do not want to convert all sequences,
# becaus... | |
import csv
import numpy as np
import copy # based on python documentation on how to
# copy lists
import sys
import pickle
from scipy.io import arff
class Node:
def __init__(self, children, splitFeature,
splitChildren, output, label = None, depth = 0):
self.children = children
self.splitFeature = splitFeature
se... | |
return "It's too dark to see anything."
return f"I don't see any {noun} here."
if scope == "knows":
return f"You don't know of any {noun}."
elif scope == "direction":
return f"{noun.capitalize()} is not a direction I recognize."
return f"You don't have any {noun}."
def getThing(self, noun_adj_arr, scope, far... | |
# 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 Apache License, Version 2.0 (the
# "License"); you may not use... | |
Pear": 0xEDEBDB,
"Barely Pink": 0xF8D7DD,
"Barely Ripe Apricot": 0xFFE3CB,
"Barely Rose": 0xEDE0E3,
"Barely White": 0xE1E3DD,
"Barf Green": 0x94AC02,
"Bargeboard Brown": 0x68534A,
"Barista": 0xBCAFA2,
"Barite": 0x9E7B5C,
"Baritone": 0x708E95,
"Barium": 0xF4E1C5,
"Barium Green": 0x8FFF9F,
"Bark": 0x5F5854,
... | |
<gh_stars>0
#!/usr/bin/env python3
""" Outputs the width file to stdout. """
import datetime
import hashlib
import os.path
import re
import sys
from collections.abc import Iterable
from typing import NamedTuple
from urllib.request import urlretrieve
VERSION = "14.0.0"
UNICODE_DATA_URL = "https://unicode.org/Public/... | |
<gh_stars>0
'''
pygetmap:
Download web map by cooridinates
'''
# Longitude 经度
# Latitude 纬度
# Mecator x = y = [-20037508.3427892,20037508.3427892]
# Mecator Latitue = [-85.05112877980659,85.05112877980659]
import math
from math import floor, pi, log, tan, atan, exp
from threading import Thread, Lock
import urllib.re... | |
"""
Load test picoCTF platform functionality.
Requires a connection to a MongoDB database populated with test user
credentials generated by the registration locustfile (registration.py)
"""
import random
import pymongo
from locust import HttpLocust, TaskSet, task
from config import (ADMIN_PASSWORD, ADMIN_USERNAME,
... | |
<gh_stars>1-10
import sys
import time
import os
import re
import json
from collections import OrderedDict
import random
import urllib.parse
import asyncio
import aiohttp
import aiohttp.web
import websockets
from .teamdat import Protocol, ProtoUI, Host, Channel, User
from .parsematch import ParseMatch
class SlackProto... | |
3.0,
4.0,
5.0,
6.0,
7.0,
9.969209968386869e36,
9.969209968386869e36,
],
[
0.5,
1.5,
2.5,
3.5,
4.5,
9.969209968386869e36,
9.969209968386869e36,
9.969209968386869e36,
9.969209968386869e36,
],
[-2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
],
units="days since 1970-01-01 00:00:00",
dtype="f8",
mas... | |
#!/usr/bin/env python3
#Local Func
from data import aquasettings, keystore
from data.aquachain import AquaTool
#Core Func
import binascii
from Crypto.PublicKey import RSA
import datetime
import math
import os
from os import chmod
import requests, json
import subprocess
from subprocess import Popen, PIPE, STDOUT
impo... | |
,band
,stokes
,f_datapoints
,avg_f_peak
,avg_f_peak_sq
,avg_f_peak_weight
,avg_weighted_f_peak
,avg_weighted_f_peak_sq
,avg_f_int
,avg_f_int_sq
,avg_f_int_weight
,avg_weighted_f_int
,avg_weighted_f_int_sq
)
SELECT r.id
,tmprc.band
,tmprc.stokes
,tmprc.f_datapoints
,avg_f_peak
,avg_f_peak_sq
,avg_f_p... | |
'''
Copyright (c) 2018 Modul 9/HiFiBerry
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, publish, distribu... | |
(count > 0):
if count > max_count:
write_count = max_count
else:
write_count = count
start = int(write_offset * 2)
end = int((write_offset + write_count) * 2)
self._write(slave_id, addr + write_offset, data[start:end],
trace_func=trace_func)
count -= write_count
write_offset += write_count
else:
raise Modbu... | |
<reponame>top-sim/topsim
# Copyright (C) 10/19 <NAME>
# 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 i... | |
mem_ds.CreateLayer( "my_layer")
sql_lyr = mem_ds.ExecuteSQL("SELECT *, fid from my_layer")
if sql_lyr.GetLayerDefn().GetFieldCount() != 1:
return 'fail'
if sql_lyr.GetLayerDefn().GetFieldDefn(0).GetName() != 'fid':
return 'fail'
mem_ds.ReleaseResultSet(sql_lyr)
mem_ds = None
return 'success'
################... | |
"""Widely useful utility methods.
"""
from collections import OrderedDict, Iterable, Sequence
from datetime import datetime
import errno
import functools
import logging
import math
from numbers import Number
import time
from atropos import AtroposError
# TODO: the nucleotide table should be implemented as an alphabet.... | |
<gh_stars>1-10
#!/usr/bin/python3
import json, dateutil, pytz, random, time, traceback, signal
import pandas as pd
from coin_wizard.historical_pair_data import get_historical_pair_data_pandas, plot_historical_pair_data
from coin_wizard.utils import translate_pair_to_splited, translate_pair_to_unsplited
import coin_wi... | |
<filename>outgrab_tools.py<gh_stars>0
#!/usr/bin/python3
"""outgrab: Programatically select important information from large
files and send it to other files for human or program consumption.
outgrab.py Can be invoked as a program interpreter or
outgrab_tools.py and outgrab_startup can be imported as a library of p... | |
100451
eumIMass = 100452
eumIMassPerTime = 100453
eumIMassPerAreaPerTime = 100454
eumIKd = 100455
eumIPorosity = 100456
eumIHalfLife = 100457
eumIDispersivity = 100458
eumIFrictionCoeffientcfw = 100459
eumIWaveamplitude = 100460
eumISedimentGrainDiameter = 100461
eumISedimentSpill = 100463
eumINumberOfParti... | |
list
"""
dummy_pos_and_or = [(pos, Direction.NORTH) for pos in player_positions]
return cls.from_players_pos_and_or(dummy_pos_and_or, bonus_orders, all_orders)
def deepcopy(self):
return OvercookedState(
players=[player.deepcopy() for player in self.players],
objects={pos:obj.deepcopy() for pos, obj in self.obj... | |
self.console_msg("Zoom: "+str(self.zoom_level))
self.display_image()
def zoom_out(self):
self.canvas.scale("all", 0, 0, 1-self.zoom_step, 1-self.zoom_step)
self.zoom_level = self.zoom_level * (1-self.zoom_step)
self.console_msg("Zoom: " + str(self.zoom_level))
self.display_image()
def zoom_100(self):
self.can... | |
1
outbound_layer = layer.outbound_nodes[0].outbound_layer
return isinstance(outbound_layer, (tf.keras.layers.ReLU, tf.keras.layers.PReLU))
return activation_type in ["relu", "prelu"]
class CrossLayerScaling:
"""
Code to apply the cross-layer-scaling technique to a model
"""
@staticmethod
def scale_cls_set_... | |
from __future__ import division
import numpy as np
from numpy.core.numeric import NaN
from scipy.signal import spectrogram
from . import timbral_util
import tensorflow as tf
import tensorflow.keras.backend as K
def timbral_depth(fname, fs=0, dev_output=False, phase_correction=False, clip_output=False, threshold_db=-6... | |
# pip install selenium
# pip install webdriver-manager
import urllib
import soup as soup
import time
from selenium import webdriver
import pandas
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.implicitly_wait(3) # 웹 자원 로드를 위해 3초 기다려줌
from se... | |
<filename>tests/test_heroku.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import mock
import pytest
import datetime
import signal
from dallinger.config import get_config
@pytest.fixture
def run_check(active_config):
from dallinger.heroku.clock import run_check
yield run_check
@pytest.fixture
def check_c... | |
#!/usr/bin/env python
#
# Copyright 2016-present <NAME>.
#
# Licensed under the MIT License.
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://opensource.org/licenses/mit-license.html
#
# Unless required by applicable law or agreed to in writing, sof... | |
import pprint
import re # noqa: F401
import six
class Task(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key i... | |
#
# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
#
# SPDX-License-Identifier: BSD-2-Clause
#
import solver
from solver import mk_smt_expr, to_smt_expr, smt_expr
import check
from check import restr_others, loops_to_split, ProofNode
from rep_graph import (mk_graph_slice, vc_num, vc_offs, vc_upto,
vc_double_range... | |
<filename>data/analysis/analyzers.py
""" Data analysis functions for output files
associated with : ``
plots to do:
- training data; vwr para cada sinal ao longo do tempo
objetivo: observar performance historica do sinal com os seus parametros otimos
se comparado com outros indicadores podemos inferir algumas coisas... | |
<filename>RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/traffic.py
# Copyright 1997 - 2018 by IXIA Keysight
#
# 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 r... | |
skin blood flow rate (BFsk) [L/h].
Parameters
----------
err_cr, err_sk : array
Difference between setpoint and body temperatures [oC].
height : float, optional
Body height [m]. The default is 1.72.
weight : float, optional
Body weight [kg]. The default is 74.43.
equation : str, optional
The equation name (s... | |
"""
Generates rules by optimising the thresholds of each feature individually, then
combining them.
"""
import pandas as pd
import numpy as np
import math
from itertools import combinations
from iguanas.correlation_reduction.agglomerative_clustering_reducer import AgglomerativeClusteringReducer
import iguanas.utils as ... | |
# coding=utf-8
import logging
import re
import traceback
import types
import os
import time
import datetime
from ignore import get_decision_list
from helpers import is_recent, get_plex_item_display_title, query_plex, PartUnknownException
from lib import Plex, get_intent
from config import config
from subliminal_pat... | |
paramfile is not None:
self.read_param_file(paramfile)
def aperture_info(self):
"""
Get basic information on the reuqested aperture from SIAF
"""
local_roll, attitude_matrix, self.framesize, subarray_bounds = get_siaf_information(self.siaf,
self.aperture,
self.crop_center_ra,
self.crop_center_dec,
self.blot_... | |
Returns a dictionary of the keys and values that would be
used to create the distribution for a Crow input file.
@ In, None
@ Out, retDict, dict, the dictionary of crow distributions
"""
retDict = Distribution.getCrowDistDict(self)
retDict['p'] = self.p
return retDict
def _handleInput(self, paramInput):
"""
... | |
0. 0. 120.]
[ 0. 0. 135.]]
"""
rot = R.from_rotvec(rotvec, degrees=degrees)
return self.rotate(rot, anchor=anchor, start=start)
def rotate_from_euler(self, angle, seq, anchor=None, start="auto", degrees=True):
"""Rotates object using Euler angle input.
Terminology for move/rotate methods:
- 'path' refers to `... | |
and %i-%i"%(node,quad_verts[0],
# node,quad_verts[2])
# first figure out the indices for everyone:
# the edges that get removed entirely:
# names are oriented with the first node of the pointy end up
dead_edge_top = self.find_edge( [node,quad_verts[0]] )
dead_edge_bot = self.find_edge( [node,quad_verts[2]] )
m... | |
<reponame>CQ2SPARQLOWL/Benchmark<gh_stars>1-10
import spacy
import sys
import re
# corpus_path = sys.argv[1]
corpus_path = "/Users/dawidwisniewski/Desktop/cqs.txt"
nlp = spacy.load('en_core_web_lg')
def mark_chunk(cq, spans, chunktype, offset, counter):
for (start, end) in spans: # for each span of EC/PC candidate
... | |
from .repo import get_local_repo, get_remote_repo, ProcessError, DEFAULT_BRANCH
from .utils import AsyncResult, with_lock, get_secure_random_string
from ConfigParser import RawConfigParser
from datetime import datetime
from subprocess import call
from threading import Semaphore
from urllib2 import urlopen
import json
i... | |
established (not before).'
choices:
- 'disable'
- 'enable'
revoked-server-cert:
type: str
description: 'Action based on server certificate is revoked.'
choices:
- 'allow'
- 'block'
- 'ignore'
sni-server-cert-check:
type: str
description: 'Check the SNI in the client hello message with the CN or SAN fields ... | |
= False
# Indicate whether the UI is working
self.sensitive = True
# Indicate whether the sanity check ran
self.sanity_checked = False
# save parsing warnings
self.parsing_warnings = []
# create visual elements
self.create_visual_elements()
# connect the signals to functions
self.connect("delete-event", ... | |
nsi_k) / nsi_k
@cached_const('nsi', 'max nbr degree', "n.s.i. maximum neighbour degree")
def nsi_max_neighbors_degree(self):
"""
For each node, return the maximal n.s.i. degree of its neighbors.
(not yet implemented for directed networks.)
**Example:**
>>> Network.SmallTestNetwork().nsi_max_neighbors_degree(... | |
<reponame>LarsHH/reproducible-hyperparameter-optimization-jcgs-2019<filename>sherpa-seq-testing/sherpa/schedulers.py
"""
SHERPA is a Python library for hyperparameter tuning of machine learning models.
Copyright (C) 2018 <NAME>, <NAME>, and <NAME>.
This file is part of SHERPA.
SHERPA is free software: you can redistr... | |
"""Módulo para metrificação de ativos e retornos."""
import numpy as np
import pandas as pd
from scipy import stats
def sharpe_ratio(returns, risk_free=0, time_scale=252):
"""
Essa função, a partir da definição do parâmetro de retorno, fornece o sharpe ratio do ativo, com base na média histórica e desvio padrão dos... | |
formatted
# properly, raise a ValueError
if(not isinstance(self.file_format, str)
or (self.file_format.find("{") < 0)
or (self.file_format.find("}") < 0)):
raise ValueError(''.join(['file format set to default, ',
'supplied string must be iterable ',
'[{:}]'.format(self.file_format)]))
# set up empty data and ... | |
service["StackServices"]["service_name"]
calculation = recommenderDict.get(serviceName, None)
if calculation is not None:
calculation(configurations, clusterSummary, services, hosts)
else:
serviceAdvisor = self.getServiceAdvisor(serviceName)
if serviceAdvisor is not None:
serviceAdvisors.append(serviceAdvisor)
... | |
<gh_stars>10-100
#!/usr/bin/env python
#
# Copyright 2007 Google 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
#
# Unless required by app... | |
#!/usr/bin/python3
import os
import sys
import json
import argparse
import subprocess
from PIL import Image, ImageOps
from glob import glob
animSize = 65536
srcdir = os.path.dirname(os.path.abspath(__file__))
ldsfile = os.path.join(srcdir,'animation.lds')
# The list of animations to build.
animations = ['marquee-ima... | |
<reponame>ProKil/OS2018spring-projects-g10
===== output.py ==================================================
uint64_t = int
def Or(a, b):
return a | b
def USub(a, b):
return a - b
def Concat32(a, b):
return (a << 32) | b
def If(cond, a, b):
if cond:
return a
return b
def Extract(hi, lo, val):
return v... | |
<gh_stars>1-10
import cv2
import numpy as np
import pylab
from keras.models import Sequential
from keras.layers import Dense
from keras.models import model_from_json
import skimage
from skimage import io
import matplotlib.pyplot as plt
from skimage import transform
from skimage.morphology import skeletonize_3d
import ... | |
<filename>util/configurejson2cmake.py
#!/usr/bin/env python3
#############################################################################
##
## Copyright (C) 2018 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the plugins of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
#... | |
<filename>profile_double11/ipython_nbconvert_config.py
# Configuration file for ipython-nbconvert.
c = get_config()
#------------------------------------------------------------------------------
# NbConvertApp configuration
#------------------------------------------------------------------------------
# This appli... | |
p1 = Parent(id=1, data=2, child=None)
p2 = Parent(id=2, data=3, child=None)
sess.add_all([p1, p2])
sess.flush()
sess.execute(self.tables.parent.delete())
sess.delete(p1)
sess.delete(p2)
assert_raises_message(
exc.SAWarning,
r"DELETE statement on table 'parent' expected to "
r"delete 2 row\(s\); 0 were match... | |
<reponame>mochell/stormy_forerunners
class plot_spectrogram(object):
def __init__(self,time,fs, data,clevs=None, sample_unit=None, data_unit=None,
ylim=None, time_unit=None, cmap=None):
import matplotlib.pyplot as plt
import numpy as np
self.fs=fs[1:]
self.time=time
self.data=data[:,1:]
self.clevs=clevs
self.... | |
<filename>xga/imagetools/smooth.py<gh_stars>10-100
# This code is a part of XMM: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
# Last modified by <NAME> (<EMAIL>) 30/08/2021, 09:32. Copyright (c) <NAME>
import os
from random import randint
from typing import Union
import numpy as np
... | |
return "".join([
"K" * pieces.count(6 ^ w),
"Q" * pieces.count(5 ^ w),
"R" * pieces.count(4 ^ w),
"B" * pieces.count(3 ^ w),
"N" * pieces.count(2 ^ w),
"P" * pieces.count(1 ^ w),
"v",
"K" * pieces.count(6 ^ b),
"Q" * pieces.count(5 ^ b),
"R" * pieces.count(4 ^ b),
"B" * pieces.count(3 ^ b),
"N" * pieces.cou... | |
vty = self.dispatch(val, env, misc)
defaults.append(cast(env, misc.cls, val, vty, ty, errmsg('DEFAULT_MISMATCH', misc.filename, lineno, k, ty), misc=misc))
args, argns = tuple(zip(*[self.visitarg(arg, env, misc) for arg in n.args])) if\
len(n.args) > 0 else ([], [])
args = list(args)
argns = list(argns)
assert ... | |
<reponame>thingalon/coldbrew<filename>src/Coldbrew.py
import _Coldbrew
import json
import os
import sys
import time
from _Coldbrew import *
############################################################
######################PATCH JSON DUMPS######################
########################################################... | |
<gh_stars>0
from django.test import TestCase
from django.test import Client
from django_blog_it.django_blog_it.models import Category, Post, Tags, PostHistory, UserRole, Page
from django.contrib.auth.models import User
from django_blog_it.django_blog_it.forms import BlogCategoryForm, BlogPostForm, AdminLoginForm
from d... | |
service (returns an integer)
Required:
name -- name of layer from which to grab ID
Optional:
grp_lyr -- default is false, does not return layer ID for group layers. Set
to true to search for group layers too.
"""
all_layers = self.layers
for layer in all_layers:
if fnmatch.fnmatch(layer[NAME], name):
if SUB... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.