input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
rnn_out = layers.transpose(rnn_out, [1, 0, 2])
return rnn_out, last_hidden
else:
rnn_out = fw_rnn_out
last_hidden = fw_last_hidden
if batch_first:
rnn_out = fluid.layser.transpose(rnn_out, [1, 0, 2])
return rnn_out, last_hidden
def basic_lstm(input,
init_hidden,
init_cell,
hidden_size,
num_layers=1,
se... | |
from __future__ import division, print_function, absolute_import
import argparse
import functools
import json
import logging
import math
import os
import random
import numpy as np
import pandas as pd
import sklearn.metrics as sm
import tensorflow as tf
import tqdm
try:
tf.compat.v1.logging.set_verbosity(tf.compat.v... | |
function for the device
:param args: is a sequence of arguments
:param start: a Time object specifying the start time for the period
for which this trigger is valid.
:param end: a Time object specifying the end time for which this trigger
is valid
:param days_of_week: days for which this trigger applies.
"""
se... | |
<gh_stars>10-100
# <<BEGIN-copyright>>
# Copyright 2021, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
import xData.XYs as XYsModule
import xData.regions as regionsModule
import xData.standards as standardsModul... | |
except:
return multi_pw_aff(arg0).add(arg1)
ctx = arg0.ctx
res = isl.isl_pw_multi_aff_add(isl.isl_pw_multi_aff_copy(arg0.ptr), isl.isl_pw_multi_aff_copy(arg1.ptr))
return pw_multi_aff(ctx=ctx, ptr=res)
def flat_range_product(arg0, arg1):
try:
if not arg0.__class__ is pw_multi_aff:
arg0 = pw_multi_aff(arg0)
exc... | |
entry in
the ISGCI database.
EXAMPLES:
Testing the inclusion of two classes::
sage: Chordal = graph_classes.Chordal
sage: Trees = graph_classes.Tree
sage: Trees <= Chordal
True
sage: Chordal <= Trees
Unknown
TESTS::
sage: Trees >= Chordal
Unknown
sage: Chordal >= Trees
True
"""
def __init__(self, n... | |
arbitrarily many types because this method is
called from format_return_expressions.
Return a *string* containing the reduction of all types in this list.
Returning a string means that all traversers always return strings,
never lists.
'''
r = [('None' if z in ('', None) else z) for z in self.aList]
assert None... | |
with discount rate included
"""
# Find total costs without discount(over timeseries)
# DEFAULT DATA
#logging.debug('[CBA, precalc_present_benefits]: start')
urb_imp = self.filt_risk[
[col for col in self.filt_risk.columns if ("urban_damage" in col) and (self.scen_abb.lower() in col)
and (model.lower() in col) a... | |
<gh_stars>0
import asyncio
import contextlib
import gc
import json
import re
from http.cookies import SimpleCookie
from io import BytesIO
from unittest import mock
import pytest
from multidict import CIMultiDict, MultiDict
from yarl import URL
import aiohttp
from aiohttp import client, hdrs, web
from aiohttp.client i... | |
"next", next_sweeps, 1.0,
orientation, image_size=im.size)
point_clouds.points = np.hstack((point_clouds.points, next_point_clouds.points))
times = np.hstack((times, next_times))
# First step: transform the point-cloud to the ego vehicle frame for the timestamp of the sweep.
cs_record = self.dataset.get('calibrat... | |
<gh_stars>10-100
import logging
from collections import defaultdict
from contextlib import suppress
from textwrap import dedent
from typing import Dict, List, Optional, Tuple
from bot.cogs.utils.context import Context
from bot.cogs.utils.db import Record
from bot.constants import Config
from discord import (CategoryCh... | |
available after transp occurs
transp = m['transp']
m['evap'] = evap = minimum(evap, (taw - pdr) - transp)
m['eta'] = et_actual = evap + transp
# Start Water Balance
water = m['rain'] + m['melt']
# if snow is melting, set ksat to 24 hour value
m['soil_ksat'] = soil_ksat = where(m['melt'] > 0.0, s['soil_ksat'],... | |
# scale of gap between ch plots
print("Electrode Quality (%dms)"%(duration))
def update_nch(self, nch):
self.batch = pyglet.graphics.Batch()
self.background = pyglet.graphics.OrderedGroup(0)
self.foreground = pyglet.graphics.OrderedGroup(1)
winw, winh = self.window.get_size()
r = (winh*.8)/(nch+1)
# TODO[X] us... | |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Export tools
"""
from __future__ import unicode_literals
import hashlib
import json
import os
import re
import sys
import builtins
from datetime import datetime, timedelta
from future.moves.urllib.parse import urlparse
from future.utils import iteritems
from django.conf impo... | |
= self.data.port_group_name_f
with mock.patch.object(self.rest, 'get_masking_view_list',
return_value=[]):
maskingview_list = self.rest.get_common_masking_views(
array, portgroup, initiatorgroup)
self.assertFalse(maskingview_list)
def test_create_masking_view(self):
maskingview_name = self.data.masking_view_nam... | |
signature, send
# out modify to the existing netixlan and re-create
# for the existing ixfmemberdata
assert IXFMemberData.objects.count() == 3
assert NetworkIXLan.objects.count() == 1
email_info = [
("CREATE", network.asn, "192.168.3.11", "fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b:2906:1"),
(
"MODIFY",
network... | |
<gh_stars>1-10
import typing # noqa: F401
import datetime as _datetime # noqa: F401
from kubernetes import client # noqa: F401
from kuber import kube_api as _kube_api # noqa: F401
from kuber import definitions as _kuber_definitions # noqa: F401
from kuber import _types # noqa: F401
from kuber.v1_20.meta_v1 import Lis... | |
= {(int(f.split('.')[0]), int(f.split('.')[1])): f for f in sorted(list(fnames))}
cum_file = '_'.join([codes[k] for k in codes if k in accum_codes])
inst_file = '_'.join([codes[k] for k in codes if k not in accum_codes])
task2files[task] = filter(None, [cum_file, inst_file])
for task, freqset in task2freqs.iteritem... | |
#!/usr/bin/env python3
import sys
import os
import subprocess
import logging
import logging.handlers
import time
from os.path import join
from typing import List, Optional, Tuple
from mmpm import colors
# String constants
MMPM_ENV_VAR: str = 'MMPM_MAGICMIRROR_ROOT'
MMPM_REPO_URL: str = "https://github.com/Bee-Mar/mmpm... | |
<filename>src/kdtree/tree.py<gh_stars>1-10
"""
Copyright 2018 (c) <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 applica... | |
'''Explore matrices that respect rank
identity_matrices = RankMatrices(identity_rule)
>>> identity_matrices.print_product_stats(10)
2 1 [(1, 2)]
3 1 [(0, 3), (1, 3)]
4 1 [(0, 10), (1, 5)]
4 2 [(0, 14), (1, 6)]
5 1 [(0, 32), (1, 8)]
5 2 [(0, 39), (1, 9)]
6 1 [(0, 91), (1, 13)]
6 2 [(0, 115), (1, 15)]
6 3 [(0, 101), (1... | |
<gh_stars>10-100
"""This module is part of the CFSAN SNP Pipeline. It contains the code to
align reads to a reference genome using an external mapper -- bowtie2 or smalt.
The sample alignment is sorted, duplicate reads are marked, and reads realigned around indels.
Read group tags are also assigned during this step.
""... | |
#!/usr/bin/env python
# Copyright (c) 2009-2019 <NAME> <<EMAIL>>
#
# This module is free software. You can redistribute it and/or modify it under
# the terms of the MIT License, see the file COPYING included with this
# distribution.
"""Build gene regulatory network"""
# Python imports
import os
import math
import r... | |
introduction_4.tStart = t # local t and not account for scr refresh
introduction_4.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(introduction_4, 'tStartRefresh') # time at next scr refresh
introduction_4.setAutoDraw(True)
# *key_resp_4* updates
waitOnFlip = False
if key_resp_4.status ==... | |
v[1]-v[0]]
f.write(symdex('g1t',args,exstruc)+' & '+schar1+parstring(temp)+schar2+' \\\ \n')
v=np.nanpercentile(g2, [16, 50, 84])
temp=[v[1], v[2]-v[1], v[1]-v[0]]
f.write(symdex('g2t',args,exstruc)+' & '+schar1+parstring(temp)+schar2+' \\\ \n')
if args.relpars: #relative parameters
if any('Mstar' in s for s... | |
#!/usr/bin/env python3
# PIA - STREAMLIT WEBUI - SCORE
# 2021 (c) <NAME>
# https://github.com/michabirklbauer/
# <EMAIL>
"""
#####################################################
## ##
## -- STREAMLIT PIA SCORING FUNCTIONS -- ##
## ##
#####################################################
"""
import os
import json
im... | |
diag_ele *= diagexp[ind]
for jnd in occ:
diag_ele *= arrayexp[ind, jnd]
beta_diag[b] = diag_ele
aarrays = numpy.empty((array.shape[1],), dtype=array.dtype)
for a in range(self.lena()):
aarrays[:] = 1.0
for ind in alpha_occ[a]:
aarrays[:] *= arrayexp[ind, :]
for b in range(self.lenb()):
diag_ele = 1.0
for in... | |
phase angle response.
This method plots the phase response given an output and an input
using bokeh.
Parameters
----------
percentile : list, optional
Sequence of percentiles to compute, which must be between
0 and 100 inclusive.
conf_interval : list, optional
Sequence of confidence intervals to compute, whi... | |
import falcon_kit.FastaReader as FastaReader
import os
import re
import sys
import argparse
import collections
import itertools
import logging
import contextlib
import json
LOG = logging.getLogger()
ZMWTuple = collections.namedtuple('ZMWTuple', ['movie_name', 'zmw_id', 'subread_start', 'subread_end', 'seq_len', 'sub... | |
= id
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
... | |
<reponame>hubmapconsortium/uuid-api
import logging
from flask import Response
import threading
import secrets
import time
from contextlib import closing
import json
from hmdb import DBConn
import copy
# HuBMAP commons
from hubmap_commons.string_helper import isBlank, listToCommaSeparated, padLeadingZeros
from hubmap_c... | |
# Copyright (c) 2013, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
#
#Parts of this file were influenced by the Matlab GPML framework written by
#<NAME> & <NAME>, however all bugs are our own.
#
#The GPML code is released under the FreeBSD License.
#Copyright (c) 2005-2013 ... | |
# -*- coding: utf-8 -*-
import sys
sys.dont_write_bytecode
import json
import os, operator
import numpy as np
from deap import algorithms, base, creator, tools, algorithms
## ROUTING ALGORITHMS
# MORA
from routing_algorithms.mora_v2 import *
# DIJKSTRA
from routing_algorithms.dijkstra import dijkstra_cost
from routing... | |
# type: Optional[List[str]]
**kwargs # type: Any
):
# type: (...) -> "models.MicrosoftGraphLicenseDetails"
"""Get licenseDetails from users.
Get licenseDetails from users.
:param user_id: key: id of user.
:type user_id: str
:param license_details_id: key: id of licenseDetails.
:type license_details_id: str
... | |
weights above min_weight.
Args:
-------
graph_main: networkx graph
Graph, e.g. made using create_network() function. Based on networkx.
m_sim: numpy array
2D array with all reference similarity values between all-vs-all nodes.
min_weight: float
Set minimum weight to be considered for making link. Default = 0.5... | |
<reponame>opengridcc/opengrid_dev
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
import datetime as dt
import forecastio
from forecastio.models import Forecast
from geopy import Location, Point, GoogleV3
import numpy as np
import pandas as pd
import pytz
from cached_property import cached_property
from tqdm import tqdm... | |
import csv
import os
import logging
import re
import shutil
import tarfile
import glob
from datetime import datetime
from stat import ST_CTIME
import requests
from dipper.sources.Source import Source
from dipper.models.assoc.D2PAssoc import D2PAssoc
from dipper.models.Reference import Reference
from dipper.models.Mode... | |
+ x; self.sigma_Km = self.std_Km + x; self.sigma_K2 = self.std_K2 + x
self.sigma_H1 = self.std_H1 + x; self.sigma_Hm = self.std_Hm + x; self.sigma_H2 = self.std_H2 + x
#--------------------------------------------------------------
if plot is 1: pt.plot_sindex_scatter(l, s_dif, s_std0, s_std, self.bands)
#---------... | |
#!/usr/bin/env python
import sys
import graphtodot
import argparse
import time
import ply.lex as lex
import networkx as nx
import ply.yacc as yacc
import math
import string
import libsystemflowgraph as lsfg
import re
import os.path
import os
from multiprocessing import Pool
# Define a list of couple (pattern, substit... | |
"""
Run a cpymad MAD-X simulation for the LHC optics (2018),
assign measured errors from a WISE realization and correct
the nonlinear errors in the IR.
At the end output for SixTrack input is written.
The ``main()`` function set's up the beams and is responsible to assign the
IRNL corrections to the right optics. Thes... | |
import collections
import inspect
import io
import types
import typing
import warnings
import torch
from . import (_dev_utils, activations, convolution, normalization, pooling,
preprocessing, regularization, upsample)
from ._version import __version__
from .module import InferDimension
__all__ = ["summary", "build"... | |
#!/usr/bin/python
from collections import defaultdict
from Qt import QtWidgets, QtCore, QtGui
from NodeGraphQt.constants import (NODE_PROP_QLABEL,
NODE_PROP_QLINEEDIT,
NODE_PROP_QTEXTEDIT,
NODE_PROP_QCOMBO,
NODE_PROP_QCHECKBOX,
NODE_PROP_QSPINBOX,
NODE_PROP_COLORPICKER,
NODE_PROP_SLIDER,
NODE_PROP_FILE,
NODE... | |
'/recordtype']
if any(p['path'] in state_rel_path for p in patch_obj):
raise wsme.exc.ClientSideError(
_("The following fields cannot be modified because this "
"host has been configured: hostname, recordtype "))
try:
# Update only the fields that have changed
for field in objects.profile.fields:
if iHost[fiel... | |
'zh': u('\u6e56\u5317\u7701\u6069\u65bd\u571f\u5bb6\u65cf\u82d7\u65cf\u81ea\u6cbb\u5dde')},
'861397189':{'en': 'Enshi, Hubei', 'zh': u('\u6e56\u5317\u7701\u6069\u65bd\u571f\u5bb6\u65cf\u82d7\u65cf\u81ea\u6cbb\u5dde')},
'861452258':{'en': 'Jinhua, Zhejiang', 'zh': u('\u6d59\u6c5f\u7701\u91d1\u534e\u5e02')},
'86145225... | |
to the actual address where the call occurs, just the start of the function that contains the call.
:return: List of start addresess for Functions that call this function
:rtype: list(int)
"""
functions = []
for ref in self.view.get_code_refs(self.start):
if ref.function is not None:
functions.append(... | |
#!/usr/bin/env python
# MIT License
#
# Copyright (c) 2019 <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... | |
<reponame>NatureGeorge/pyRMSD
from __future__ import print_function
import numpy
import pyRMSD.calculators
from pyRMSD.availableCalculators import availableCalculators
from pyRMSD.symmTools import symm_permutations, swap_atoms, min_rmsd_of_rmsds_list,\
symm_groups_validation
class RMSDCalculator(object):
"""
Using ... | |
logging.info('File desc= %s', upload_file_desc)
logging.info('Uploading to file - %s', ret_data_def_type[1])
if command[0] in retValueTable:
toaddr = retValueTable[command[0]]
else:
return
displayName = toaddr
if toaddr in DisplayNameTable:
displayName = DisplayNameTable[toaddr]
capi_run = command[1].strip(... | |
import json
from datetime import datetime
import click
import os
import numpy
""" CLI-TOOL """
os.system("")
print(""" """ + "\033[96m")
print("----------------------------------------------------------------------------------------------------------------")
print("""" WELCOME TO
_____ ______ ____ _____ ______
| _... | |
# -*- coding: utf-8 -*-
"""Tests of GLSAR and diagnostics against Gretl
Created on Thu Feb 02 21:15:47 2012
Author: <NAME>
License: BSD-3
"""
import os
import numpy as np
from numpy.testing import (assert_almost_equal, assert_equal,
assert_allclose, assert_array_less)
from statsmodels.regression.linear_model imp... | |
# ---------------------------------------------------------------------------
# Pelion Device Management SDK
# (C) COPYRIGHT 2017 Arm Limited
#
# 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
#... | |
= 1
newContents = ''
for line in inputFile:
line = line.rstrip('\n')
for w in line.split():
if w not in counterDict:
wordDict[counter] = w
counterDict[w] = counter
counter += 1
newContents += str(counterDict[w]) + ' '
newContents += '\n'
# print newContents
return (newContents.rstrip('\n'), wordDict)
# Re... | |
"processIsRedirectedCommandProcessor": "False",
"processIsWow64": "False",
"processName": "svchost.exe",
"processRoot": "True",
"processSessionId": "0",
"processStartTime": "2022-01-20T07:03:12.554Z",
"processSubSystem": "SYS_WIN32",
"processUniqueKey": "0E1224C52E1F3667",
"publisher": "MICROSOFT WINDOWS PUBLIS... | |
used in search (not match) mode, to
limit which test modules are searched for tests. The regular
expressions are checked against dotted module names. In an extension
of Python regexp notation, a leading "!" is stripped and causes the
sense of the remaining regexp to be negated (so "!bc" matches any
string that does not... | |
def get_message_list(self, page_index, page_size, count, must_update_cache=False):
result = FilfoxBase().get_message_list(page_size=page_size, page_index=page_index)
if not result or result.get("statusCode"):
return {"totalCount": 0, "messages_list": [], "methods": []}
messages_list = []
for message in result['me... | |
has_set else 1))
if '@type' in container:
# if mapping does not have an @type, set it to @id
if not mapping.get('@type'):
mapping['@type'] = '@id'
if mapping['@type'] != '@id' and mapping['@type'] != '@vocab':
raise JsonLdError(
'Invalid JSON-LD syntax; container: @type requires @type to be '
'@id or @vocab.'... | |
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.183498,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic':... | |
'keep_archives',
'no_user',
'no_default_includes']
# we can override many of default values via pillar
for k in overridable_variables:
if k in ignored_keys:
continue
cfg[k] = _s['mc_utils.get']('{0}:{1}'.format(name, k), cfg[k])
try:
cfg['keep_archives'] = int(cfg['keep_archives'])
except (TypeError, ValueEr... | |
#
# Autogenerated by Thrift Compiler (0.9.3)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
import logging
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport impo... | |
import os
from os.path import join
import re
import numpy as np
import time as time
from scipy.io import FortranFile
import ctypes as c
import struct
class ReadTreebrick_lowp:
#low precision Treebricks (mostly HAGN)
def __init__(self,file_path=None):
"""
Make a treebricks dictionary out of file
"""
self.fi... | |
of the report file, if None: no report file
:param nthreads:
(int) number of thread(s) to use for "GeosClassicSim" program (C),
(nthreads = -n <= 0: for maximal number of threads except n,
but at least 1)
:param verbose:
(int) indicates what is displayed during the GeosClassicSim run:
- 0: mininal display
- 1:... | |
System.Windows.UIElement that is associated
with this System.Windows.Automation.Peers.UIElementAutomationPeer. This method
is called by System.Windows.Automation.Peers.AutomationPeer.GetAcceleratorKey.
Returns: The System.Windows.Automation.AutomationProperties.AcceleratorKey that is
returned by
... | |
<reponame>bezthomas/astropysics
#!/usr/bin/env python
"""
<author> <date>
<project description>
<DELETE COMMENTS BELOW HERE AFTER READING>
This file is a template for a data analysis project (typically to go with a
paper or two). The main usage scenario is to plass functions and classes
before the "if __name__=='__... | |
import types
import inspect
import collections
import itertools
import pytest
import ramda as R
from ramda.shared import eq
from .common import list_xf, get_arity, _is_transformer
try:
from collections.abc import Callable, Iterable
except ImportError:
from collections import Callable, Iterable
@pytest.fixture
def T... | |
< vare1)
s.add(vare3 < vardf)
s.add(vare3 < vardd)
s.add(vare3 < vardc)
s.add(vare3 < vardb)
s.add(vare3 < varda)
s.add(vare3 < vard9)
s.add(vare3 < vard8)
s.add(vare2 > var120)
s.add(vare2 > var11f)
s.add(vare2 > var11e)
s.add(vare2 > var11d)
s.add(vare2 < var11c)
s.add(vare2 > var11a)
s.add(vare2 > var119)
s.add(vare... | |
import io
import re
import os.path
import tempfile
import binwalk.core.common
from binwalk.core.compat import *
from binwalk.core.filter import FilterType
class MagicSignature(object):
def __init__(self, **kwargs):
self.offset = 0
self.type = ''
self.condition = ''
self.description = ''
self.length = 0
for (... | |
vehicle.apply_physics_control(physics_control)
def tick(self, clock):
self.hud.tick(self, clock)
def render(self, display):
self.camera_manager.render(display)
self.hud.render(display)
def destroy_sensors(self):
self.camera_manager.sensor.destroy()
self.camera_manager.sensor = None
self.camera_manager.index... | |
<gh_stars>100-1000
import json
import shutil
import tempfile
from collections import OrderedDict
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
import gobbli.io
from gobbli.docker import maybe_mount, run_container
from gobbli.model.base impor... | |
not self.build_priority_cyclone
and not self.build_cc_home
and not self.super_greed
and self.supply_left > 1
and self.first_base_saturation < 0):
return
if self.ccANDoc.ready.amount < 2:
if self.marauder_push_limit != 0 and self.barracks.amount >= self.max_barracks:
max_pending_sd = 2
elif self.delay_expansion... | |
<reponame>ecuvelier/PPAT
# -*- coding: utf-8 -*-
"""
Created on 2013-2014
Author : <NAME>
Affiliation : Université catholique de Louvain - ICTEAM - UCL Crypto Group
Address : Place du Levant 3, 1348 Louvain-la-Neuve, BELGIUM
email : <EMAIL>
"""
import gmpy
import math
################## AHO Commitment ###############... | |
<gh_stars>1-10
# SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: MIT
from monitor_api.enums import Field
from monitor_api.core.entities import Context, Metric, Session
import collections
import pandas as pd
import typing
import yaml
class Contexts(collections.UserDict):
"""Dict like struc... | |
#!/usr/bin/env python2.7
import usb.core
import usb.util
import dfu_suffix
class runtime_target( object ):
def __init__( self, vid_, pid_, did_, ignore_iface_=False ):
self._vid = vid_
self._pid = pid_
self._did = did_
self._ignore_iface = ignore_iface_
def __call__( self, device ):
if ( device.idVendor==sel... | |
#! /usr/env/python
"""Fastscape stream power erosion."""
# This module attempts to "component-ify" GT's Fastscape stream
# power erosion.
# Created DEJH, March 2014.
from __future__ import print_function
import numpy as np
from six import string_types
from landlab import BAD_INDEX_VALUE as UNDEFINED_INDEX, Component... | |
#import libraries
from flask import Flask,render_template,flash,redirect,url_for,session,logging,request,Response
from flask_sqlalchemy import SQLAlchemy
from werkzeug.utils import secure_filename
from flask_wtf import FlaskForm
from flask_mail import Mail, Message
from itsdangerous import URLSafeTimedSerializer, Sig... | |
<gh_stars>1-10
import warnings
import dash
import dash_core_components as dcc
import dash_html_components as html
warnings.filterwarnings('ignore')
from dash.dependencies import Input, Output
from multiprocessing import Process, Queue
from utils import read_mongo, json_pandas
from main import get_keywords
from utils_... | |
<reponame>rs992214/keanu
## This is a generated file. DO NOT EDIT.
from typing import Collection, Optional
from py4j.java_gateway import java_import
from keanu.context import KeanuContext
from .base import Vertex, Double, Integer, Boolean, vertex_constructor_param_types
from keanu.vertex.label import _VertexLabel
from... | |
1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0],
[1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1],
[1, 0, 0... | |
{}
# Iterate over each field of the payload class and check for a matching keyword argument.
# If no matching kwarg was provided use a default value
for field in cls.fields():
key = field.name
try:
args[key] = kwargs[key]
except KeyError:
# Check if a default value was provided
default = field.metadata['defau... | |
s[{s.s_ho() if self.tunable.nxe != 0 else s.s_hi()}], s[{s.s_tmp(1)}]")
# calculate batch split and accumulate the base pointer for input/output
self._emit(f"s_mul_i32 s[{s.s_tmp(0)}], s[{s.s_n()}], s[{s.s_in_stride_n()}]")
self._emit(f"s_mul_i32 s[{s.s_tmp(1)}], s[{s.s_n()}], s[{s.s_out_stride_n()}]")
self._emit(... | |
self, [scope, id, props, enable_resource_property_constraint])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
'''
:param props: -
'''
return typing.cast(typing.Mapping[builtins.str, typing... | |
<filename>baobab/bnn_priors/models.py
import numpy as np
from scipy.special import gamma
import astropy.units as u
def velocity_dispersion_function_CPV2007(vel_disp_grid):
"""Evaluate the velocity dispersion function from the fit on SDSS DR6
by [1]_ on a provided grid.
Parameters
----------
vel_disp_grid : array... | |
<reponame>sethr07/surveys
#!/usr/bin/python
# Copyright (C) 2018 <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 the righ... | |
<reponame>OpenMOOC/moocng<filename>moocng/teacheradmin/views.py
# -*- coding: utf-8 -*-
# Copyright 2012-2013 UNED
#
# 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/li... | |
-1.221681223499369, 2.6618713903411937],
[-1.5387523541807724, 4.6220978399651482, -2.1795716817360713, -3.776821154104939], [1.4330066566763016,
3.7880327985429378, -0.65902727001966976, -4.29506128665055]], [[-4.0199255222547103, -3.644811287300751,
3.6508998060332054, -3.569704984460552], [-3.8429890733645489, -2... | |
<filename>examples/v12/output_helper.py
from campaignmanagement_example_helper import *
# Common
def output_status_message(message):
print(message)
def output_bing_ads_webfault_error(error):
if hasattr(error, 'ErrorCode'):
output_status_message("ErrorCode: {0}".format(error.ErrorCode))
if hasattr(error, 'Code'):... | |
<gh_stars>0
#!/usr/bin/env python2.7
'''
A tool to install Mach-O binaries into an ``.app`` bundle.
Other bundle types (particularly ``.framework`` and ``.plugin`` bundles) are
not supported yet.
'''
from __future__ import print_function
import json
import os
import os.path
import re
import shutil
import subprocess
... | |
<filename>src/my_data.py<gh_stars>1-10
import pandas as pd
from os import path, mkdir
import numpy as np
import torch
from torch.utils import data
from src import drug_drug, setting, network_propagation, logger
from sklearn.preprocessing import StandardScaler
from torch import save
class CustomDataLoader:
pass
clas... | |
= 0.0
self.totalVolume = 0.0
for T in self.tetrahedronList:
T.computeGeometricInfo()
self.hMax = max(T.diameter,self.hMax)
self.hMin = min(T.diameter,self.hMin)
self.sigmaMax = max(old_div(T.diameter,T.innerDiameter),self.sigmaMax)
self.totalVolume += T.volume
def buildLists(self):
self.buildListsNodes()
sel... | |
<filename>simorf/simulate_by_random_UTR3.py
"""
A script to test if a given ORF is shorter or longer than expected by intergenic region fetching method
Example script:
python simulate_by_random_UTR3.py -s human -oi "ENST00000370418.7:chr10:-|3|1863:63:90|uORF|ATG|253|1630|63|90" -esf data/exon_structure/human/ENST000... | |
indices
self.rho_idx = indices['rho']
self.cut_idx = indices['loss'] + indices['rho']
self.alpha_idx = indices['alpha']
self.L0_reg_ind = indices['L0_reg_ind']
self.C_0_nnz = indices['C_0_nnz']
self.compute_loss_cut = compute_loss_cut
self.get_alpha = get_alpha
self.get_L0_penalty_from_alpha = get_L0_penalty_fr... | |
<reponame>wdhif/go-nes
#!/usr/bin/env python
#
# Copyright (c) 2015 <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 ... | |
dampingSteps: Optional[int] = None
schemeDesc: Optional[FdmSchemeDesc] = None
leverageFct: Optional[LocalVolTermStructure] = None
class FdHestonDoubleBarrierEngine(BaseModel):
resource_name: Optional[
Literal["FdHestonDoubleBarrierEngine"]
] = "FdHestonDoubleBarrierEngine"
model: HestonModel
tGrid: Optional[in... | |
== 10 and parameterCategory == 0 and parameterNumber == 7:
return 'Direction of swell waves'
if discipline == 10 and parameterCategory == 0 and parameterNumber == 6:
return 'Mean period of wind waves'
if discipline == 10 and parameterCategory == 0 and parameterNumber == 5:
return 'Significant height of wind wave... | |
<gh_stars>0
#!/usr/bin/env python
# Copyright (c) 2015:
# Istituto Nazionale di Fisica Nucleare (INFN), Italy
# Consorzio COMETA (COMETA), Italy
#
# See http://www.infn.it and and http://www.consorzio-cometa.it for details on
# the copyright holders.
#
# Licensed under the Apache License, Version 2.0 (the "License");
#... | |
name is None:
name = ''
scale = (high - low) / 2
p = C.parameter(
shape,
init=C.initializer.uniform(
scale,
seed=seed),
dtype=dtype,
name=name)
return variable(value=p.value + low + scale)
def random_normal_variable(
shape,
mean,
scale,
dtype=None,
name=None,
seed=None):
if dtype is None:
dtype = f... | |
"""
Exceptions to raise from validators.
"""
import uuid
from http import HTTPStatus
from pathlib import Path
from mock_vws._constants import ResultCodes
from mock_vws._mock_common import json_dump
class DateHeaderNotGiven(Exception):
"""
Exception raised when a date header is not given.
"""
def __init__(self)... | |
for c1, c2, c3 in results:
c = c + 1
self.assertEqual(12, c, "ERROR: Data Difference")
self.cursor.execute("SELECT * FROM ((SELECT a_char20 from "
"all_datatypes) "
"UNION ALL (SELECT a_char10 FROM "
"all_latin_datatypes)) AS a "
"ORDER BY 1")
results = self.cursor.fetchall()
expected = [[None], ['9']... | |
ovly_data = overlay_data.fetch ()
if (not ovly_data.comrv_initialised ()):
raise RuntimeError ("ComRV not initialised, overlay "
+ "storage area address unknown")
group_desc = ovly_data.group (id)
tmp = group_desc.base_address ()
debug ("get_group_storage_area_address (%d) = 0x%x"
% (id, tmp))
return tmp
# ... | |
env_func, env_args)
'''reward shaping'''
args.reward_scale = 2 ** -1
args.gamma = 0.99
'''network update'''
args.target_step = args.max_step // 2
args.net_dim = 2 ** 8
args.num_layer = 3
args.batch_size = 2 ** 7
args.repeat_times = 2 ** 0
args.explore_noise = 0.1
'''evaluate'''
args.eval_gap = 2 ** 7
ar... | |
<reponame>DataJunction/datajunction<gh_stars>0
"""
Tests for ``datajunction.sql.build``.
"""
# pylint: disable=invalid-name, too-many-lines, line-too-long
import datetime
import pytest
from pytest_mock import MockerFixture
from sqlalchemy.engine import create_engine
from sqlmodel import Session
from datajunction.mod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.