input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<filename>phyllo/protocol/transport/reliablebuffers.py
"""Reliably-transmitted reliable buffers with automatic repeat requesting.
Implementation references:
- https://www.ibr.cs.tu-bs.de/courses/ws0910/pcn/Documents/Communication_Networks-
Fundamentals_Concepts_and_Key_Architectures.pdf
- https://blog.eqrion.net/reli... | |
<filename>htvlearn/delaunay.py
import torch
import numpy as np
import scipy.spatial
from htvlearn.lattice import Lattice
from htvlearn.grid import Grid
from htvlearn.hessian import (
get_finite_second_diff_Hessian,
get_exact_grad_Hessian
)
class Delaunay():
"""Wrapper around scipy.spatial.Delaunay"""
centers_ba... | |
if v.position is not None:
v.position += offset
if alias:
if len(funcs) == 1:
for a in alias.split():
self._functions_map[a] = _FunctionMapValue(funcs[0], position)
else:
raise TypeError(
"the `alias` argument is only allowed when adding a single "
"function to the chain"
)
for func in funcs:
func_name = fu... | |
# filename
#
# Using parsed data in a gc_event_dataframe, creates heatmaps to visually
# show latency during runtime.
#
import matplotlib
from matplotlib import pyplot as plt
import numpy as np
# TODO: Most of this code is borrowed. Read and update documentation
# to be consistent to my personal style.
# # # # # # #... | |
control
flow constructs. "try" specifies exception handlers and/or cleanup
code for a group of statements, while the "with" statement allows the
execution of initialization and finalization code around a block of
code. Function and class definitions are also syntactically compound
statements.
A compound statement cons... | |
if not self.is_config():
return False
if self.accesses is not None and self.accesses._has_data():
return True
if self.prefixes is not None and self.prefixes._has_data():
return True
if self.usages is not None and self.usages._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.m... | |
a ValueError
if required is ``True``, or ``None`` if required is ``False.
:type arg: ``Any``
:param arg: argument to convert
:type arg_name: ``str``
:param arg_name: argument name
:type required: ``bool``
:param required:
throws exception if ``True`` and argument provided is None
:return:
returns an ``int`` i... | |
if key == "imageUri":
suggest = "image_uri"
elif key == "containerArguments":
suggest = "container_arguments"
elif key == "containerEntrypoint":
suggest = "container_entrypoint"
elif key == "postAnalyticsProcessorSourceUri":
suggest = "post_analytics_processor_source_uri"
elif key == "recordPreprocessorSourceUr... | |
supported with Artifacts"
)
return json_dict
@classmethod
def seq_to_json(
cls,
seq,
run,
key,
step,
):
seq = list(seq)
jsons = [obj.to_json(run) for obj in seq]
for obj in jsons:
expected = util.to_forward_slash_path(cls.get_media_subdir())
if not obj["path"].startswith(expected):
raise ValueError(... | |
digest_entry.split('=', 1)
digests[key] = value
package_versions.append(PackageVersion(name, version, url, digests))
descriptor.packages = package_versions
def _parsed_shared_rand_commit(descriptor, entries):
# "shared-rand-commit" Version AlgName Identity Commit [Reveal]
commitments = []
for value, _, _ in... | |
<filename>fps.py
'''
Created on 21/03/2014
@author:
Created by <NAME> <<EMAIL>> @jeanmachuca
BeagleBone Black compatability changes by:
<NAME> <<EMAIL>>
<NAME>
<NAME>
'''
import os
import serial
from serial.tools import list_ports
import time
import binascii
def delay(seconds):
'''
wait a number of secons
''... | |
<reponame>cgiovanetti/DarkHistory
""" Physics functions as well as constants.
Throughout DarkHistory, we choose cm, s and eV as our system of units. Masses and temperatures are also given in eV. Particle Data Group central values [1]_ are used for constants, while cosmological parameters are set to the central values ... | |
import asyncio
import random
import arrow
import discord
from discord.ext import commands, tasks
from libraries import emoji_literals
from modules import emojis, log, queries, util
logger = log.get_logger(__name__)
command_logger = log.get_command_logger()
class Events(commands.Cog):
"""Event handlers for various... | |
total_lv_lines_length1, \
num_transformers1, generation_per_year1, peak_load1 = distribution_network(people, total_energy_per_cell)
hv_lines_total_length2, total_length_of_lines2, total_lv_lines_length2, \
num_transformers2, generation_per_year2, peak_load2 = \
distribution_network(people=(people - new_connections... | |
== []
assert e1.intersection(Point(2, 0)) == []
assert e1.intersection(e1) == e1
assert intersection(Ellipse(Point(0, 0), 2, 1), Ellipse(Point(3, 0), 1, 2)) == [Point(2, 0)]
assert intersection(Circle(Point(0, 0), 2), Circle(Point(3, 0), 1)) == [Point(2, 0)]
assert intersection(Circle(Point(0, 0), 2), Circle(Point... | |
"""Defines the Request class.
Copyright 2013 by Rackspace Hosting, 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 l... | |
panda_handle.apply_high_level_action("openEE", [], vel=0.5)
#
# # post_image
# _pos = [_loc[0], _loc[1], _loc[2] + 3, math.pi, 0, math.pi]
# panda_handle.apply_high_level_action("transit", _pos, vel=0.5)
#
# elif _action_type == "human-move":
# # get the urdf name and remove the existing body
# _obj_name = f"b{... | |
1
oshape = (n, oc_chunk, out_height, out_width, oc_bn)
pad_before = (0, 0, pad_top, pad_left, 0)
pad_after = (0, 0, pad_down, pad_right, 0)
# DOPAD
DOPAD = HPAD != 0 or WPAD != 0
if DOPAD:
data_pad = pad(data, pad_before, pad_after, name="data_pad")
else:
data_pad = data
ic = te.reduce_axis((0, in_channel),... | |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may ... | |
"""
@generated
cargo-raze generated Bazel file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") # buildifier: disable=load
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # buildifier: disable=load
load("@bazel_tools//tools... | |
# Copyright 2021 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompany... | |
exon.start:
# This handles an exon of just 5' UTR
continue
start = 0 if breakpoint < exon.start else breakpoint - exon.start
end = min(cds_start + 2, exon.end) - exon.start
sequence.append(exon.sequence[start:end + 1][::-1].translate(trans))
if exon.start <= breakpoint <= exon.end:
intron_junction = False
break... | |
from itertools import combinations, product
import pytest
from permuta import Perm
from permuta.misc.union_find import UnionFind
from tilings import GriddedPerm, Tiling
from tilings.algorithms import (
Factor,
FactorWithInterleaving,
FactorWithMonotoneInterleaving,
)
# --------------------------------------------... | |
xresult = SV.mk_simvalue(result)
pargs = str(a0) + ':' + a0str
simstate.set_register(iaddr, 'v0', xresult)
return self.add_logmsg(iaddr, simstate, pargs, returnval=str(xresult))
class MIPStub_inet_aton(MIPSimStub):
def __init__(self) -> None:
MIPSimStub.__init__(self, 'inet_aton')
def is_network_operation(sel... | |
exist. Ensure file with behavior details is present')
exit()
version = args.version
#Find the property details (IDs)
propertyResponse = papiObject.searchProperty(session,propertyName=args.property)
if propertyResponse.status_code == 200:
try:
propertyDetails = propertyResponse.json()['versions']['ite... | |
help='turn on/off relative path - default off')
@click.pass_obj
def dedup(ctx, srcdir, checkdir, relpath):
"""
Dedup command prints list of duplicate files in one or more checkdirs
"""
if relpath:
basepath = os.getcwd()
for i in dedup_yield(srcdir, checkdir):
click.echo(os.path.relpath(i, basepath))
else:
for ... | |
""" Module for loading PypeIt files
"""
import os
import warnings
import numpy as np
from astropy import units
from astropy.time import Time
from astropy.io import fits
from astropy.table import Table
from linetools.spectra.xspectrum1d import XSpectrum1D
from linetools.spectra.utils import collate
import linetools.u... | |
MSIE 7.0; AOL 9.7; AOLBuild 4343.19; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)',
'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3',
'Mozilla/5.0 (Windows; U; Windo... | |
random.choice([player1_ID, player2_ID])
if starting_player == player1_ID:
encoded_game.append("p1_")
elif starting_player == player2_ID:
encoded_game.append("p2_")
else:
starting_player = player1_ID
encoded_game.append("p1_")
game.reset(starting_player=starting_player,randomize=False)
while not game_over:
... | |
<reponame>mindspore-ai/mindscience
# Copyright 2021 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 requ... | |
"""Methods for handling atmospheric fronts.
A front may be represented as either a polyline or a set of grid points.
"""
import numpy
import pandas
import cv2
import shapely.geometry
from scipy.ndimage.morphology import binary_closing
from skimage.measure import label as label_image
from gewittergefahr.gg_utils impor... | |
<reponame>terminalkitten/pdf-stamp<filename>pyhanko/pdf_utils/crypt.py
"""
.. versionchanged:: 0.3.0
Added support for PDF 2.0 encryption standards and crypt filters.
Utilities for PDF encryption. This module covers all methods outlined in the
standard:
* Legacy RC4-based encryption (based on PyPDF2 code).
* AES-128... | |
<gh_stars>10-100
import collections
import csv
import json
import logging
import logging.handlers
import os
import random
import re
import splunk.rest as rest
import time
from splunk.clilib.bundle_paths import make_splunkhome_path
from splunk.util import mktimegm, normalizeBoolean
# set the maximum allowable CSV fiel... | |
from message.
if 'too few arguments' in message:
self._ReportErrorMetricsHelper(dotted_command_path,
parser_errors.TooFewArgumentsError)
return
re_result = re.search('argument (.+?) is required', message)
if re_result:
req_argument = re_result.group(1)
self._ReportErrorMetricsHelper(
dotted_command_path,
par... | |
"SWEDE",
"SWEED",
"SWEEL",
"SWEER",
"SWEES",
"SWEIR",
"SWELT",
"SWERF",
"SWEYS",
"SWIES",
"SWIGS",
"SWILE",
"SWIMS",
"SWINK",
"SWIPE",
"SWIRE",
"SWISS",
"SWITH",
"SWITS",
"SWIVE",
"SWIZZ",
"SWOBS",
"SWOLE",
"SWOLN",
"SWOPS",
"SWOPT",
"SWOTS",
"SWOUN",
"SYBBE",
"SYBIL",
"SYBOE",
"SYBOW",
... | |
data else returns False '''
return True
def _has_data(self):
if not self.is_config():
return False
if self.resync_threshold is not None:
return True
if self.sequencing is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_l2vpn_cfg ... | |
# Copyright 2019 Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
#... | |
00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 0E 19 15 08 0F 19 0F 05 00 00 12 13 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 07 1C... | |
# find closest matching trees for any pspans provided
for start, end in pspans:
sumdiff = lambda tree:abs(vstartchars[tree.start] - start) + abs(vendchars[tree.end] - end)
match = min(subtrees, key=sumdiff)
# Ensure that we're getting the highest node for this
# span relevant for sequences of single child
# deri... | |
'%s-normal-reference.png' % config.name),
LoadedModel.convert_image(reference_normal_image))
output_stats_screen = {}
def _eval_screen(ln, name, mode, override_network=None):
with torch.no_grad():
ln.render_network(
camera, width, height, mode, stepsize,
override_network=override_network, timer=None,
channel=p... | |
ca = Canvas(self.frame_pic, width = 200, height = 156, bg = 'white')
ca.create_image(0,0,anchor=NW,image = self.imag)
ca.grid(row = 0, column = 0, padx = 8, pady = 20)
self.label_s = Label(self.frame_options1, text = 'Offset from origin [A]')
self.entry_s = FloatEntry(self.frame_options1)
self.entry_s.insert(0, g... | |
#!/usr/bin/env python
#----------------------------------------------------------------------------
# Name: ListCtrl.py
# Purpose: Testing lots of stuff, controls, window types, etc.
#
# Author: <NAME> & <NAME>
#
# Created:
# Copyright: (c) 1998-2017 by Total Control Software
# Licence: wxWindows license
#------------... | |
[]
return lower
def func_592122217fda4547b201be134aec0e9b(infile):
W, L, U, G = map(int, infile.readline().split())
lower = []
upper = []
return W
def func_fe330482e2934cacb1429b4bbc7fd5a3(infile):
W, L, U, G = map(int, infile.readline().split())
lower = []
upper = []
return U
def func_b67ed09e9a24498296... | |
from z3.z3 import Distinct
from .esilclasses import *
import z3
import sys
import random
import time
import socket
import os
from struct import pack, unpack
import logging
logger = logging.getLogger("esilsolve")
def puts(state, addr):
addr = state.evaluate(addr).as_long()
length, last = state.mem_search(addr, [BZE... | |
import abc
import logging
import sqlite3
import unittest
from typing import Union
assert sqlite3.sqlite_version_info >= (
3,
24,
), "Your database engine (not the python package) is out of date."
log = logging.getLogger(__name__)
# Foreign key flags
Restrict = "restrict"
SetNull = "set null"
SetDefault = "set defa... | |
expect == actual
# You can apply the filter on any one of these four fields,
# using a Contributor or a ContributorData
for contributor_field in ('sort_name', 'display_name', 'viaf', 'lc'):
for cls in Contributor, ContributorData:
contributor = cls(**{contributor_field:"value"})
index_field = contributor_field
... | |
<gh_stars>1-10
#!/usr/bin/env python
"""
NetworKIN(tm), (C) 2005,2006,2007,2013.
Drs <NAME>, <NAME>, <NAME> & <NAME>
Usage: ./networkin.py Organism FastaFile SitesFile
If no sites file is given NetworKIN will predict on all T/S/Y residues
in the given sequences.
"""
### Coding strategy & TODO
# FIX: filtering when... | |
'is', 'are', 'was', 'were', 'been']:
continue
try:
pos = pos_tag_dict[tag]
except:
pos = None
antonyms = [
lemma.antonyms()[0].name()
for synset in wordnet.synsets(token, pos=pos)
for lemma in synset.lemmas()
if lemma.antonyms() != []]
in_vocab_antonyms = set(antonyms).intersection(set(vocab))
if len(in... | |
white',
'0,128,0': 'Ao (English)',
'141,182,0': 'Apple green',
'251,206,177': 'Apricot',
'0,255,255': 'Aqua',
'127,255,212': 'Aquamarine',
'208,255,20': 'Arctic lime',
'75,83,32': 'Army green',
'143,151,121': 'Artichoke',
'233,214,107': 'Arylide yellow',
'178,190,181': 'Ash gray',
'135,169,107': 'Asparagus',... | |
# The backbone of our LIGA model.
# including 2D feature extraction, stereo volume construction, stereo network, stereo space -> 3D space conversion
import math
import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
from mmdet.models.builder import build_backbone, build_neck
from ... | |
<reponame>jfrfonseca/kcmc_heuristic
"""
KCMC_Instance Object
"""
from filelock import FileLock
from typing import List, Set, Tuple, Dict
try:
import igraph
except Exception as exp:
igraph = None
class KCMC_Instance(object):
color_dict = {
"p": "green",
"i": "red", "offline": "white",
"s": "black", "vsink": "... | |
X XXXXXXXXX X
X XXXX XXXXXXXXX XXXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XX XXXXXX XX
X XXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXXX XX
X XXXX XXXXXXXXXXX XXXXXXXXXXX XXXXXXXX XXXXXXXXXXX XX
X XXXX XXXXXXX XXXXXXXXXX XXXXXXXX XXXXXXX XX
X XXXX XXXXXXXXXXX XXXXXXXXXX XXXXXXXX XXXXXXXXXXX XX
X XXXX XXXXXXXXXX XXXXXXXXXXX X... | |
<gh_stars>0
import copy
import time
from collections import Counter
"""Errors are still being found, validation processes are currently being built"""
"""If an error is found please notify"
class Puzzles:
Suduko_Input_Matrix_0 = [[0, 0, 0, 2, 6, 0, 7, 0, 1],
[6, 8, 0, 0, 7, 0, 0, 9, 0],
[1, 9, 0, 0, 0,... | |
_get_name(f)
ndim = int(fromfile(f, i4be, 1)[0])
shape = tuple(fromfile(f, i4be, ndim).astype(int)) if ndim else ()
attrs.append((name, _get_attrs(f)))
nctype = int(fromfile(f, i4be, 1)[0])
if nctype < 1 or nctype > 6:
raise IOError("bad nc_type (not in 1-6) in netCDF-3 header")
stype = _netcdf_stypes[nctype - 1... | |
#!/usr/bin/env python
# coding: utf-8
# # Breve introdução à utilização do Z3 em Python
# Um tutorial do Z3Py, a biblioteca Python de interface para o popular solver Z3 da Microsoft, pode ser encontrado em https://ericpony.github.io/z3py-tutorial/guide-examples.htm.
#
# Começamos por importar o módulo do Z3.
# In[ ]... | |
<filename>safe_control_gym/envs/gym_pybullet_drones/quadrotor.py
"""1D and 2D quadrotor environment using PyBullet physics.
Based on UTIAS Dynamic Systems Lab's gym-pybullet-drones:
* https://github.com/utiasDSL/gym-pybullet-drones
"""
import math
from copy import deepcopy
import casadi as cs
from gym import spaces
... | |
<gh_stars>0
import aerosandbox.numpy as np
from aerosandbox.optimization.opti import Opti
from typing import Union, Dict, Callable, List, Tuple
from aerosandbox.modeling.surrogate_model import SurrogateModel
import matplotlib.pyplot as plt
import copy
class FittedModel(SurrogateModel):
"""
A model that is fitted to... | |
<reponame>fnrizzi/pressio-demoapps<filename>meshing_scripts/_impl/natural_order_mesh_3d.py<gh_stars>1-10
import numpy as np
class NatOrdMesh3d:
def __init__(self, Nx, Ny, Nz, \
dx, dy, dz, \
xL, xR, yL, yR, zL, zR, \
stencilSize, \
enablePeriodicBc):
self.stSize_ = stencilSize
self.numNeighbors_ = int((stencil... | |
``'upper right'``, ``'ur'``, ``1``
upper left inset ``'upper left'``, ``'ul'``, ``2``
lower left inset ``'lower left'``, ``'ll'``, ``3``
lower right inset ``'lower right'``, ``'lr'``, ``4``
center left inset ``'center left'``, ``'cl'``, ``5``
center right inset ``'center right'``, ``'cr'``, ``6``
lower center ins... | |
# ChangeLog
import os, sys
import tempfile
import re
import subprocess
from datetime import datetime
from dateutil import parser as dtparser
from pytz import timezone
import time
import math
import shutil
import json
from libpredweb import myfunc
from libpredweb import webserver_common as webcom
TZ = webcom.TZ
os.env... | |
<reponame>xmarcosx/edfi-notebook<gh_stars>1-10
# coding: utf-8
"""
Ed-Fi Operational Data Store API
The Ed-Fi ODS / API enables applications to read and write education data stored in an Ed-Fi ODS through a secure REST interface. *** > *Note: Consumers of ODS / API information should sanitize all data for display a... | |
from collections import OrderedDict, abc
from enum import Enum
from functools import reduce, wraps
from typing import Callable, List, Optional, Sequence, TypeVar, Union, overload
import torch
from torch import Tensor, nn
from .delay import Delay
from .logging import getLogger
from .module import CallMode, CoModule, P... | |
<filename>import_yocto_bm/utils.py
import os
import json
import sys
import time
import requests
from import_yocto_bm import global_values
from import_yocto_bm import config
def get_projver(bd, pargs):
params = {
'q': "name:" + pargs.project,
'sort': 'name',
}
projects = bd.get_resource('projects', params=params... | |
trgt_label, source, target`` -
attributes following this algorithm:
1. Edge tuple produced: ``tuple(sorted([label, src_label, trgt_label, source, target]))``
2. MD5 hash derived from tuple: ``hashlib.md5(",".join(edge_tup).encode()).hexdigest()``
This method will replace existing and add new labels to the link.... | |
<reponame>ederst/pulumi-openstack
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequen... | |
name
icons = [images.sprcharacterget(c) for c in name]
self.nameicons = [ico for ico in icons if ico is not None][:16]
self.nameicons.reverse()
scoreboard()
def playerjoin(self):
n = self.pn
if not self.icons:
self.loadicons(flip='')
self.keepalive = None
if self.points or self.letters:
print('New player co... | |
import argparse, os, sys, gzip
from tqdm import tqdm
from pgs_harmonizer.harmonize import *
from datetime import datetime
# Inputs
parser = argparse.ArgumentParser(
description='Harmonize a PGS Catalog Scoring file (PGS######.txt.gz) to a specific genome build.')
subparsers = parser.add_subparsers(help='Harmonization... | |
model ID that is present in all related distribution files',
'id': '<int> unique node ID that is referenced by other files',
'name': '<str> unique human-interpretable name of this node (from the `title` attribute in `metadata.csv`)',
'db_refs': '<dict> database references of this node (`doi`, `pmcid`, `pubmed_id` at... | |
= _ScriptMethod(132) # FindNotoriety
_find_notoriety.restype = _uint
_find_notoriety.argtypes = [_ushort, # ObjType
_ubyte] # Notoriety
def FindNotoriety(ObjType, Notoriety):
return _find_notoriety(ObjType, Notoriety)
_find_at_point = _ScriptMethod(133) # FindAtCoord
_find_at_point.restype = _uint
_find_at_point.... | |
from enum import Enum
from typing import List, Optional, Dict, Set
from lite_forms.styles import ButtonStyle
class _Component:
"""
Base component for LITE forms - only for internal use
"""
def __init__(
self,
name: str,
title: str = "",
description: str = "",
short_title: str = None,
accessible_descriptio... | |
import csv
import os
import mxnet as mx
import numpy as np
import pylab as plt
from matplotlib import ticker
from mxnet import nd, gluon, autograd
# from mxnet.contrib import amp
from mxnet.gluon.nn import HybridBlock
from mxnet.gluon.utils import split_and_load as sal
from numpy.ma import masked_array
from skimage.mea... | |
# =============================================================================
# Created By : <NAME>
# Created Date: 2021-09-03
# =============================================================================
"""Module to fit an exponential model of clonal haematopoiesis for
all clonal trajectories present in an indivi... | |
#!/usr/bin/env python
from matplotlib import pyplot as plt
from matplotlib import gridspec
import sys
from time import time
import numpy as np
from biseqt.sequence import Alphabet
from biseqt.stochastics import rand_seq, MutationProcess
from biseqt.seeds import SeedIndex
from biseqt.blot import band_radius, band_radii,... | |
optional):
Total request timeout in seconds.
Returns:
ValidResponse: If the call was successful.
ErrorResponse: If the call was not successful.
Raises:
PureError: If calling the API fails.
ValueError: If a parameter is of an invalid type.
TypeError: If invalid or missing parameters are used.
"""
kwargs = di... | |
# coding: utf-8
"""
Ed-Fi Operational Data Store API
The Ed-Fi ODS / API enables applications to read and write education data stored in an Ed-Fi ODS through a secure REST interface. *** > *Note: Consumers of ODS / API information should sanitize all data for display and storage. The ODS / API provides reasonable s... | |
<reponame>phargogh/invest-natcap.invest-3
"""The invest_natcap.testing package defines core testing routines and
functionality.
Rationale
---------
While the python standard library's ``unittest`` package provides valuable
resources for testing, GIS applications such as the various InVEST models
output GIS data that ... | |
* x)
B2 -= 0.00004986799
B2 += 0.00000302141 * mu.cost(5.55871276021 + 6681.22485339960 * x)
B2 += 0.00000025767 * mu.cost(1.89662673499 + 13362.44970679920 * x)
B2 += 0.00000021452 * mu.cost(0.91749968618 + 10021.83728009940 * x)
B2 += 0.00000011820 * mu.cost(2.24240738700 + 3337.08930835080 * x)
B2 += 0.0000000... | |
<gh_stars>10-100
bl_info = {
"name": "Drawchitecture",
"description": "creates temporary workplanes by strokes or points for drawing in 3D with the grease pencil",
"author": "<NAME>",
"version": (1, 1),
"blender": (2, 80, 0),
"location": "View3D",
# "warning": "", # used for warning icon and text in addon... | |
print('Initializing schema for %s'%dbpath)
with open('tilelive.schema','r') as fp:
script = fp.read()
mbTiles.execute_script(script)
print('Copying zoom %s from %s to %s'%(bbox_zoom_start-1,args.mbtiles,dbpath))
mbTiles.copy_zoom(str(bbox_zoom_start-1),args.mbtiles)
else:
mbTiles = MBTiles(dbpath)
mbTiles.Check... | |
in all_indices:
path_controls = []
for indices in path_indices:
assert len( indices ) == 4
As = dot( asarray(transforms).T, all_weights[ indices ].T ).T
Bs = append( all_vertices[ indices ], ones( ( len( indices ), 1 ) ), axis = 1 )
tps = asarray([ dot( A, B ) for A, B in zip( As, Bs ) ])
... | |
'''
------------------------------------------------------------------------
This program runs the steady state solver as well as the time path
solver for the OG model with S-period lived agents, exogenous labor,
M industries, and I goods.
This Python script calls the following other file(s) with the associated... | |
wavelength
array.
f_conv : Numpy Array
The flux array on the old wavelength grid.
w_temp : Numpy Array
The old wavelength grid.
"""
if stacked is True:
band_correction = [0.8, 0.775, 0.75, 0.83]
j = int(wave_t[0] / 1000 - 4)
res_power = 28000 * band_correction[j]
if harps is True:
harps_res = 75000
res_p... | |
=-129
PI_BAD_FILE_FLAG =-130
PI_BAD_FILE_READ =-131
PI_BAD_FILE_WRITE =-132
PI_FILE_NOT_ROPEN =-133
PI_FILE_NOT_WOPEN =-134
PI_BAD_FILE_SEEK =-135
PI_NO_FILE_MATCH =-136
PI_NO_FILE_ACCESS =-137
PI_FILE_IS_A_DIR =-138
PI_BAD_SHELL_STATUS =-139
PI_BAD_SCRIPT_NAME =-140
PI_BAD_SPI_BAUD =-141
PI_NOT_SPI_GPIO =-142
PI_BAD_E... | |
<reponame>naaniz/Malicious-Urlv5
#!/usr/bin/python
# -*- coding: utf-8 -*-
def warn(*args, **kwargs):
pass
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django.db.models import Q
from .models import *
# Create your views here.
def getServerStatus(request):
return HttpR... | |
['c3d', 'amc', 'avi'],
'fps': 120},
5: {'desc': 'Gedanbarai',
'files': ['c3d', 'amc', 'avi'],
'fps': 120},
6: {'desc': 'Heiansyodan',
'files': ['c3d', 'amc', 'avi'],
'fps': 120},
7: {'desc': 'Mawashigeri',
'files': ['c3d', 'amc', 'avi'],
'fps': 120},
8: {'desc': 'Motorcycle',
'files': ['c3d', 'amc', 'avi'],... | |
self.d[3] = 3.1844126808691092e-01
self.d[4] = 5.0000000000000000e-01
self.d[5] = 6.8155873191308913e-01
self.d[6] = 8.3859313975536887e-01
self.d[7] = 9.4987899770573003e-01
self.d[8] = 1.0000000000000000e+00
elif m == 9:
self.A[0, 0] = 0.0000000000000000e+00
self.A[0, 1] = 0.0000000000000000e+00
self.A[0, 2]... | |
from __future__ import annotations
import inspect
import logging
import os
import tempfile
import time
import typing
from base64 import urlsafe_b64encode
from collections.abc import (
Mapping as AbstractMapping,
Sequence,
ItemsView as _ItemsView,
MappingView,
Set as AbstractSet,
KeysView,
)
from collections imp... | |
from app import app
from flask import render_template, redirect, session, request, send_from_directory
from app import models, db, reqs
from flask_socketio import SocketIO, emit
import json
from xhtml2pdf import pisa
import os
from datetime import datetime
socketio = SocketIO(app)
if __name__ == '__main__':
socketio... | |
-1.7,
"attractiveness": 1.8,
"neatly": 1.4,
"hurrahed": 1.9,
"importantly": 1.3,
"successive": 1.1,
"envying": -0.8,
"can't stand": -2.0,
"flawlessly": 0.8,
"gratifies": 1.5,
"gratified": 1.6,
"boresome": -1.3,
"agreements": 1.1,
"blessedly": 1.7,
"embittered": -0.4,
"encouragers": 1.5,
"assurers": 1.1,... | |
for c in regions] if regions else None]
# our positive control consists of the reference path and any variant in the sample
if pos_control_sample or neg_control_sample:
control_sample = pos_control_sample if pos_control_sample else neg_control_sample
assert not neg_control_sample or neg_control_sample == control_s... | |
and realtime_start > realtime_end:
raise ValueError('The date set by variable realtime_start ("{}") can not be after the date set by variable realtime_end ("{}").'.format(realtime_start, realtime_end))
df = pd.DataFrame(
self._client.get(
'/fred/series/tags',
'tags',
series_id=series_id,
realtime_start=realtime... | |
to IANA format.
iana_time_zone = win_tz.get(windows_time_zone)
# Use pytz with IANA time zone.
to_zone = timezone(iana_time_zone)
# Convert the start time to the time zone of the user mailbox
start = datetime.datetime.utcfromtimestamp(start_time / 1000)
start_tz = start.replace(tzinfo=pytz.utc).astimezone(to_zo... | |
comb_trainModelWithValid_MobileNetV2(xArr, yArr, xFFT, model, res_path, epos, x_valid, y_valid, num):
s = xArr.shape
#x_train = np.zeros([s[0], s[1], s[2], 2]) # normal amnd fourier space
x_train = np.zeros([s[0], s[1], s[2], 1]) # just one space
#train
x_train[:,:,:,0] = xArr
#x_train[:,:,:,1] = xFFT
xN = n... | |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 30 16:29:39 2020
@author: Abdurrahim
"""
#importing libraries
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
from torch.autograd import Variable
#importing dataset
#s... | |
# generated by datamodel-codegen:
# filename: openapi.yaml
# timestamp: 2021-12-31T02:44:47+00:00
from __future__ import annotations
from datetime import datetime
from enum import Enum
from typing import Annotated, Any, List, Optional
from pydantic import BaseModel, Extra, Field, SecretStr
class EnvValue(BaseModel... | |
):
self.character_face_direction = RIGHT_FACING
if self.health <= 0:
self.change_x = 0
self.change_y = 0
frames = self.cur_death_texture // UPDATES_PER_FRAME
if frames == len(self.texture_dict['death'][0])-1:
self.cur_death_texture = 0
self.kill()
# print(self.name, frames)
self.texture = self.texture_dict... | |
<gh_stars>1-10
# ----------------------------------------------------------------------------
# VectorSK Copyright 2022 <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.a... | |
= 0x0C # pull-up resistors for port A
GPPUB = 0x0D # pull-up resistors for port B
# The INTF register reflects the interrupt condition on the port A pins of
# any pin that is enabled for interrupts. A set bit indicates that the
# associated pin caused the interrupt.
INTFA = 0x0E
# The INTF register reflects the i... | |
element. Typically this is just one, but can be more for
'*'-imports
"""
members = set()
if elem.tag == "import":
alias = elem.get("alias")
symbol_name = elem.get("symbol")
module_name = elem.get("module")
if symbol_name:
import_handler = self.citadel.import_handler_from_lang(
self.trg.lang)
blob = import_ha... | |
<reponame>pecuniafinance/hummingbot
import asyncio
import logging
import time
from collections import defaultdict
from typing import Any, Dict, List, Optional
from bidict import bidict
from hummingbot.connector.exchange.kucoin import (
kucoin_constants as CONSTANTS,
kucoin_utils as utils,
kucoin_web_utils as web_u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.