input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<gh_stars>1-10
#!flask/bin/python
from flask import render_template, flash, redirect, session, url_for, \
request, g, send_file, abort, jsonify
from flask_login import current_user
from flask_qrcode import QRcode
from app import app, db, lm
from datetime import datetime, timedelta
from config import STREAMLABS_CLIEN... | |
"""
Template for Characters
Copy this module up one level and name it as you like, then
use it as a template to create your own Character class.
To make new logins default to creating characters
of your new type, change settings.BASE_CHARACTER_TYPECLASS to point to
your new class, e.g.
settings.BASE_CHARACTER_TYPEC... | |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import ast
import errno
import json
import os
import subprocess
import sys
import tempfile
import threa... | |
nonlinear random projections of one or several input vectors.
The `fit1d` or `fit2d` method must be called before, for setting vector dimensions
or online option.
If you need to transform one vector after each other, add `online=True` in the fit function.
Parameters
----------
X: np.ndarray or torch.Tensor
inp... | |
<reponame>Gaurav7888/vision
import os
import os.path
import hashlib
import gzip
import re
import tarfile
from typing import Any, Callable, List, Iterable, Optional, TypeVar, Dict, IO, Tuple
from urllib.parse import urlparse
import zipfile
import lzma
import contextlib
import urllib
import urllib.request
import urllib.e... | |
<filename>cytomineprojectmigrator/importer.py
# -*- coding: utf-8 -*-
# * Copyright (c) 2009-2019. Authors: see NOTICE file.
# *
# * 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
# *
# * h... | |
output: a tensor of the same shape as x
"""
with tf.variable_scope(
name, default_name="right_shift_blockwise", values=[x]):
x_list_shape = x.get_shape().as_list()
x_shape = common_layers.shape_list(x)
# Add a dummy dimension for heads.
x = tf.expand_dims(x, axis=1)
x = pad_to_multiple_2d(x, query_shape)
padde... | |
NT 5.0; de-DE; rv:1.7.10)',
'Mozilla/5.0 (Windows; U; Windows NT 5.0; de-DE; rv:1.7.12)',
'Mozilla/5.0 (Windows; U; Win98; de; rv:1.8.0.1)',
'Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.1)',
'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; de; rv:1.8.0.1)',
'Mozilla/5.0 (Windows; U; Windows NT 5.1; ... | |
# Copyright 2017-2022 RStudio, PBC
#
# 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... | |
import random
import _jsonnet, json
import logging
import hashlib
import os
from copy import deepcopy
import pandas as pd
from tqdm import tqdm
import math
from LeapOfThought.resources.teachai_kb import TeachAIKB
from LeapOfThought.common.general import num2words1, bc
from LeapOfThought.common.data_utils import unifor... | |
<gh_stars>100-1000
"""Decorators for confirming shapes are correct at runtime."""
import copy
import functools
import inspect
import textwrap
import typing
from typing import Any, Dict, Mapping, Tuple, Union
import tensor_annotations.jax as tjax
import tensor_annotations.tensorflow as ttf
import tree
# TODO: Replac... | |
self.chessboard[3][0] = 3
self.users[0].health = 100
self.users[1].x = 15
self.users[1].y = 12
self.users[1].items[2] = 9
self.users[80].health = self
self.users[80].items[3] = self
self.person.head = 555
self.person.arms[0].elbow = 556
self.person.arms[0].fingers[0] = 557
self.person.arms[0].fingers[4] = 558... | |
#!/usr/bin/python
# -*- coding: utf8 -*-
from __future__ import print_function
"""
.. currentmodule:: pylayers.antprop.interactions
.. autosummary::
:members:
"""
import doctest
import os
import sys
import glob
import pdb
import doctest
if sys.version_info.major==2:
import ConfigParser
else:
import configparser
im... | |
<filename>aws-frauddetector-detector/src/aws_frauddetector_detector/helpers/update_worker_helpers.py
import logging
from typing import Tuple, Set
from cloudformation_cli_python_lib import (
exceptions,
)
from . import validation_helpers, api_helpers, common_helpers, model_helpers, util
from .. import models
# Use t... | |
else:
if (file is not None) and (file != ""):
if (
not self.__props__["limbdarkened"]
and projection == STARRY_ORTHOGRAPHIC_PROJECTION
):
fig.subplots_adjust(
left=0.01, right=0.99, bottom=0.01, top=0.99
)
fig.savefig(file, bbox_inches="tight")
if not custom_ax:
plt.close()
elif not custom_ax:
plt.show()
... | |
import random
import pylab
from gurobipy import *
"""
Optimal Keyboard Layout
A standard English keyboard has three rows, with 10, 9 and 7 keys on each. We will label these keys 0, ..., 25, with
keys 0,...,9 on the first row, 10,...,18 on the second row, and 19,...,25 on the third row.
Suppose we know the average t... | |
<filename>chord_sim/modules/stabilizer.py
# coding:utf-8
from typing import Dict, List, Optional, cast, TYPE_CHECKING
import sys
import modules.gval as gval
import traceback
from .chord_util import ChordUtil, KeyValue, NodeIsDownedExceptiopn, AppropriateNodeNotFoundException, \
InternalControlFlowException, DataIdAn... | |
# Copyright 2013-2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | |
mapping process is enabled for the ``layer`` or not.
:param layer: layer name
:type layer: str
:return: enabled value (default: True)
:rtype: bool
"""
try:
return self.__config[layer]['PROCESSOR']['enabled']
except KeyError:
return False
def get_threaded (self, layer):
"""
Return with the value if the map... | |
includes both system and HTTP errors.
# Retry with exponential backoff.
logger.warning(err)
path.unlink()
if i + 1 == max_tries:
logger.error(f'download of {path.name} failed, giving up')
raise err
else:
delay = 2**i
logger.warning(f'download of {path.name} failed, retrying in {delay}s')
sleep(delay)
continu... | |
# ----------------------------------------------------------------------------
# Copyright (c) 2020, <NAME>.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------... | |
<reponame>patymori/scielo-manager
#coding: utf-8
import json
import datetime
from django_webtest import WebTest
from django_factory_boy import auth
from journalmanager.tests import modelfactories
from editorialmanager.tests import modelfactories as editorial_modelfactories
from api.resources_v2 import (
JournalResou... | |
<filename>guildwars2/guild/sync.py
import asyncio
import discord
from discord.ext import commands
from discord.ext.commands.cooldowns import BucketType
from ..exceptions import APIError, APIForbidden, APIKeyError, APINotFound
class SyncGuild:
@commands.guild_only()
@commands.has_permissions(administrator=True)
@... | |
from copy import copy
from re import findall
import sys
global_labels = {
'vPC': 0x0016,
'vAC': 0x0018,
'vACH': 0x0019,
'vLR': 0x001a,
'vLRH': 0x001b,
'sysFn': 0x0022,
'r1': 0x0030,
'r2': 0x0032,
'r3': 0x0034,
'r4': 0x0036,
'r5': 0x0038,
'r6': 0x003a,
'r7': 0x003c,
'r8': 0x003e,
'r9': 0x0040,
'r10': 0x... | |
import json
import os
import xml.etree.ElementTree as ET
import numpy as np
import pybullet as p
import trimesh
from IPython import embed
from PIL import Image
import igibson
from igibson.external.pybullet_tools.utils import get_center_extent, stable_z_on_aabb
from igibson.objects.articulated_object import Articulate... | |
<reponame>hussamnasir/geni-ch
# ----------------------------------------------------------------------
# Copyright (c) 2013-2016 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction... | |
<gh_stars>1-10
# Copyright (C) 2009-2014 <NAME>
#
# The following terms apply to all files associated
# with the software unless explicitly disclaimed in individual files.
#
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any purpose, provide... | |
import asyncio
import importlib
import json
import logging
import os
import warnings
from copy import deepcopy
from inspect import isclass
from typing import Any, Coroutine, Dict, List, Optional, Tuple, Type, Union, cast
from pypika import Table
from tortoise.backends.base.client import BaseDBAsyncClient
from tortois... | |
particleID)
#
# -> This is the vectorSpaceGetAllSTIXParticle function that implements the get
# all STIX/Prediction particles that are in the vector space functionality.
#
def vectorSpaceGetAllSTIXParticle(self):
return self._vectorSpace.getAllSTIXParticles()
#
# -> This is the vectorSpaceGetAllEventParticle f... | |
resp['tags']]
# Try to get the restricted tag as the viewer and expect to fail
extra_environ = {'test.authentication.id': contributor_id,
'test.application_settings': True}
response = self.app.get(url('form', id=restricted_form_id), headers=self.json_headers,
extra_environ=extra_environ, status=403)
resp = json.... | |
= Var(within=Binary,bounds=(0,1),initialize=0)
m.b1878 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b1879 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b1880 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b1881 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b1882 = Var(within=Binary,bounds=(0,1),initialize=0... | |
Find lip:process tags and fill in uuid dictionaries
findprocesstags(xmldocu,xmldocu.getroot(),None,processtagbyuuid,childuuidbyuuid,processtagsnouuid)
obsoleteprocesstagbyuuid={} # Will move from processtagbyuuid into here as we determine tags are obsolete
obsolete_root_uuids=[]
for uuid in list(processtagbyuuid... | |
# Copyright (c) 2017–2018 crocoite contributors
#
# 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, ... | |
# Lint as: python2, python3
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | |
is enabled for load balancing or not. By default, origin is always enabled.
"""
return pulumi.get(self, "enabled")
@enabled.setter
def enabled(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "enabled", value)
@property
@pulumi.getter(name="httpPort")
def http_port(self) -> Optional[pulumi.Input[i... | |
<filename>Mstdfxmltoxlsx2map.py
"""
The MIT License (MIT)
Copyright (c) 2020 <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 rig... | |
or full; defaults to full
item_type = models.CharField(
max_length=1,
choices=ITEMTYPE_CHOICES,
default=FULL,
help_text="Portion of the work that is included; used to determine icon for public display.",
)
#: book or journal title for excerpt or article
book_journal = models.TextField(
"Book/Journal title",
h... | |
#!/usr/bin/env python3
""" greylost - DNS threat hunting. """
import os
import sys
import json
import copy
import argparse
import signal
import pickle
import atexit
import syslog
import statistics
from base64 import b64encode
from time import sleep, time
from datetime import datetime
import dnslib
from dmfrbloom.tim... | |
'items': items_chunk,
'items_m2m': items_m2m_chunk,
}
if wait_for_completion is not None:
data['wait_for_completion'] = wait_for_completion
self.api.put(path=path, data=data, timeout=60)
@require_login
def partial_update_item(self, item, create_if_missing=None):
"""
Partially update some properties of an item... | |
<reponame>ludaavics/numba
import numpy as np
from numba.cuda.cudadrv import devicearray
from numba import cuda
from numba.cuda.testing import unittest, CUDATestCase
from numba.cuda.testing import skip_on_cudasim
class TestCudaNDArray(CUDATestCase):
def test_device_array_interface(self):
dary = cuda.device_array(sha... | |
<filename>scripts/exp-application/fwt_oTree/fwt/models.py
from otree.api import (
models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer
)
author = '<NAME>'
doc = """
This app is designed to investigate the forward testing effect
"""
class Constants(BaseConstants):
name_in_url = 'fwt'... | |
fullnameIN[:-3]+out_ext+'.nc'
#Append extension, in any:
if parser.parse_args().ext:fullnameOUT=fullnameOUT[:-3]+'_'+parser.parse_args().ext+'.nc'
fdiurn = Dataset(fullnameIN, 'r', format='NETCDF4_CLASSIC')
var_list = filter_vars(fdiurn,parser.parse_args().include) # get all variables
#find time of day vari... | |
<gh_stars>0
THE_BOOK_OF_EXPERIMENTS = {
"brahmaputra": {
"imdb": [
{
"experiment_name": "SA_EMBED_NGRAM_CNN_RNN",
"experiment_description": "Train with preloaded spacy vectors. "
"Here we see the impact of freezing the"
" embedding layer. This is a regression "
"experiment without rescaling the ground "
"truth... | |
= SourceRecord.get_sources_search_of_user_as_editor(current_user, status=status)
editor = []
for hit in sources:
editor.append(
{
'id': hit['id'],
'name': hit['name'],
'source_status': hit['source_status'],
'version_to_review': True
}
)
sources_terms = get_arguments_for_source_from_action(
current_user, 'so... | |
# k-fold CV (>=2)
self.parameters['CV_repeat'] = 1 # repeated k-fold CV
self.parameters['n_out'] = 100 # number of top models to be output, off when =0
# overwrite parameter values if specified in advanced_parameters
if not advanced_parameters is None:
for key, value in advanced_parameters.iteritems():
self.para... | |
# -*- coding: utf-8 -*-
"""
S3 Microsoft Excel codec
@copyright: 2011-2021 (c) Sahana Software Foundation
@license: MIT
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... | |
<filename>src/amuse/community/kepler/interface.py
from amuse.community import *
from amuse.community.interface.common import CommonCodeInterface, CommonCode
from amuse.support.options import option
from amuse.units import units
import os.path
class KeplerInterface(CodeInterface,
CommonCodeInterface):
"""
Kepler orb... | |
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.173353,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic':... | |
<reponame>burningmantech/ranger-deploy
##
# See the file COPYRIGHT for copyright information.
#
# 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
#
... | |
== '--clean':
ff = open(path,'w')
ff.write("# %s \n" % card)
ff.write("%s \n" % line.split(None,2)[2])
ff.close()
logger.info("writing the line in %s (empty file) the line: \"%s\"" %(card, line.split(None,2)[2] ),'$MG:BOLD')
elif args[1].startswith('--line_position=afterlast'):
#position in file determined by us... | |
% start_hour
jsonp += '"end_hour":"%s",' % end_hour
jsonp += '"dow":"%s",' % dow
jsonp += '"data":{"average":"%s"}' % average
jsonp += '}'
return StreamingHttpResponse(jsonp, content_type='application/json')
def averages(request, library, start, end, start_hour, end_hour, dow, filter_on):
dates = calculate_date... | |
<gh_stars>1-10
import discord
import re
from enum import Enum
from datetime import datetime
# SDDB uses a Discord guild as a ghetto database and supports simple DB operations - create, select, update, delete.
# The │ character ASCII(0x2502) is used as a global delimiter, and is not allowed under any circumstances.
# A... | |
return getattr(self, field, '').strip()
@property
def custom_collection_family_metafield_value_value(self):
field = 'metafield_value_collection_family_custom_value'
value = getattr(self, field, '').strip()
if not value:
return None
return json.loads(value)
@property
def custom_collection_tag_names_value(self... | |
<filename>pilot/user/atlas/container.py
#!/usr/bin/env python
# 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
#
# Authors:
# - <NAME>, <EMAIL>, 2017... | |
<gh_stars>1-10
##############################################################################
#
# Copyright (c) 2004 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distributi... | |
<gh_stars>100-1000
# This script is used to compute CSIG, CBAK and COVL,
# and it is from https://github.com/facebookresearch/denoiser/blob/main/scripts/matlab_eval.py
from scipy.linalg import toeplitz
from tqdm import tqdm
from pesq import pesq
import librosa
import numpy as np
import os
import sys
def eval_composi... | |
<reponame>davidkhala/oci-designer-toolk
# Copyright (c) 2020, 2021, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
"""Provide Module Description
"""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | |
if kw.has_key('state') and kw['state'] != u'':
try:
state = str(kw['state'])
state = state.replace(',', '.')
except Exception as msg:
flash(l_(u'Float required: %s' % msg), 'error')
redirect(request.headers['Referer'])
if scompound.state != float(state):
scompound.state = float(state)
schanges += u'; State.[m... | |
<reponame>wenhaoyong/stylegan2-ada-pytorch
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure o... | |
0~19 | DELAY SUB TYPE *note P17 |
+---------+-------+---------+---------------------------------------------+
| 101 | L:0~7 | 0~1023 | DELAY TIME |
| 102 | H:0~1 | | |
+---------+-------+---------+---------------------------------------------+
| 103 | L:0~7 | 0~1023 | DELAY DEPTH |
| 104 | H:0~1 | | |
+---------+------... | |
<reponame>CarlFK/veyepar
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2008 <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
# w... | |
self.dest_init])
prev_initial_version = self.initial_version
self.initial_version = self.upgrade_versions[0]
self._install(self.servers[self.src_init + self.dest_init:])
self.create_buckets()
self._join_all_clusters()
if float(prev_initial_version[:2]) < 3.0:
self.pause_xdcr_cluster = None
bucket_default = se... | |
c.function_test('int', 'const pthread_attr_t*', 'struct sched_param*')
pthread_attr_getschedpolicy = c.function_test('int', 'const pthread_attr_t*', 'int*')
pthread_attr_getscope = c.function_test('int', 'const pthread_attr_t*', 'int*')
pthread_attr_getstack = c.function_test('int', 'const pthread_attr_t*', 'void**'... | |
+ "/write?port=" + fullPortName
try:
req = urllib2.urlopen(url, qs["data"][0])
output = req.read()
self.writeChunk(output)
except Exception as e:
self.writeChunk("hostUnreachable")
def serveListen(self, qs):
self.setSession(qs)
self.send_response(200)
self.sendDefaultHeaders()
self.end_headers()
motesTex... | |
None:
pulumi.set(__self__, "x509_store_name", x509_store_name)
@property
@pulumi.getter(name="commonNames")
def common_names(self) -> Optional[Sequence['outputs.ServerCertificateCommonNameResponse']]:
"""
The list of server certificates referenced by common name that are used to secure the cluster.
"""
return ... | |
<reponame>geobarry/line-simplipy
#-------------------------------------------------------------------------------
# Name: geom utils
# Purpose: various geometry functions
# License: MIT License
#-------------------------------------------------------------------------------
import data_utils as d
import math as __m
im... | |
')' if _tagset else '()'
_badset = ' '.join(sorted(t for t in self.badset))
badset = ' (' + _badset + ')' if _badset else ' ()'
_ontid_all_tags = ' '.join(sorted(t.curie for t in self.ontid_all_tags))
ontid_all_tags = ' (' + _ontid_all_tags + ')' if _ontid_all_tags else ' ()'
return f'{self.__class__.__name__}.by... | |
Temporal Relation Network Module in use'
print(msg, ['%d-frame relation' % i for i in self.scales])
def forward(self, input):
# the first one is the largest scale
act_all = input[:, self.relations_scales[0][0] , :]
act_all = act_all.view(act_all.size(0), self.scales[0] * self.img_feature_dim)
act_all = self.fc_f... | |
from the .ibd file is needed (getspectrum calls will not work)
"""
ImzMLParserBase.__init__(self)
t_start = time.time()
# custom map sizes are currently not supported, therefore mapsize is hardcoded.
# ElementTree requires the schema location for finding tags (why?) but
# fails to read it from the root element. A... | |
pool.map(self._interp_temporal, job_args)
del job_args
for i, j, res in job_result:
interp_data[:, i, j] = res
interp_data = np.squeeze(interp_data)
self.data = np.squeeze(self.data)
if use_to_data:
self.time = new_time.copy()
self.data = interp_data.copy()
else:
return interp_data, new_time
def _ascend... | |
[3.3, 5.5, 6.6], [1e23, 2e23, 1e24]):
assert len(data) == 3
_ = self.func(data)
def testInPlaceModification(self):
# Test that the function does not modify its input data.
data = [3, 0, 5, 1, 7, 2]
# We wish to detect functions that modify the data in place by
# sorting, which we can't do if the data is already... | |
H[11], D[12], H[0]})
STRAIGHT_HHHDD = []
for i in range(13):
for j in range(1, 13):
for k in range(2, 13):
for l in range(3, 13):
for m in range(4, 13):
if m == l + 1 and l == k + 1 and k == j + 1 and j == i + 1:
STRAIGHT_HHHDD.append({H[i], H[j], H[k], D[l], D[m]})
STRAIGHT_HHHDD.append({H[9], H[10], H[11], D[1... | |
dict(self.visualization)["color"]
class VObjectContactCircleCable2D:
def __init__(self, show = True, drawSize = -1., color = [-1.,-1.,-1.,-1.]):
self.show = show
self.drawSize = drawSize
self.color = color
def __iter__(self):
yield 'show', self.show
yield 'drawSize', self.drawSize
yield 'color', self.color
c... | |
#! /usr/bin/env python2
# v0.11
#///////////////////////////////////////////////////////////////////////////////
#/ MIT License //
#/ //
#/ Copyright (c) [2015] [<NAME>] //
#/ //
#/ Permission is hereby granted, free of charge, to any person obtaining a //
#/ copy of this software and associated documentation files ... | |
<gh_stars>100-1000
""" This file defines general utility functions and classes. """
import math
import numpy as np
# import sys
#
# sys.path.append('/home/rkojcev/ros_python3/devel/lib')
import PyKDL as kdl
class BundleType():
"""
This class bundles many fields, similar to a record or a mutable
namedtuple.
"""
d... | |
"""Functions for reading Schedule input files: net, cnt, tub, ev
"""
from datetime import datetime
import roxar
import roxar.events
def _get_wellname(schedname):
"""Based on Schedule well name, including branch symbol, return well and wellbore names
"""
iloc = schedname.find('%')
if iloc > 0:
well_... | |
"""
Multilayer VAE + Pixel CNN
<NAME>
"""
import os, sys
if 'ISHAAN_NN_LIB' in os.environ:
sys.path.append(os.environ['ISHAAN_NN_LIB'])
else:
sys.path.append(os.getcwd())
N_GPUS = 1
try: # This only matters on Ishaan's computer
import experiment_tools
experiment_tools.wait_for_gpu(tf=True, n_gpus=N_GPUS)
except ... | |
cam = GD.cam()
lens_type = GD.cam.lens_type
near_point = Point3()
far_point = Point3()
GD.cam.lens.extrude(screen_pos, near_point, far_point)
rel_pt = lambda point: grid_origin.get_relative_point(cam, point)
near_point = rel_pt(near_point)
far_point = rel_pt(far_point)
if lens_type == "persp":
# the selected... | |
1, 2, 3], #
[0, 1, 2, 3], #
[0, 1, 2, 3], #
[-1, 0, 1, 2], #
[-1, 0, 1, 2], #
[-1, 0, 1, 2], #
[-2, -1, 0, 1], #
[-2, -1, 0, 1], #
[-2, -1, 0, 1], #
[-3, -2, -1, 0], #
[-3, -2, -1, 0], #
[-3, -2, -1, 0]
], #
[
[0, 1, 2, x], #
[0, 1, 2, x], #
[0, 1, 2, x], #
[-1, 0, 1, x], #
[-1, 0, 1, x], #
[-1, 0, 1... | |
`items` list will be empty.
async_req (bool, optional):
Request runs in separate thread and method returns
multiprocessing.pool.ApplyResult.
_return_http_data_only (bool, optional):
Returns only data field.
_preload_content (bool, optional):
Response is converted into objects.
_request_timeout (int, optional):
... | |
import bpy
from . import mcdata
from .mcutils import *
from .mccolutils import *
# Operator to add the right click button on properties
class MC_AddProperty(bpy.types.Operator):
"""Add the property to the menu"""
bl_idname = "mc.add_property"
bl_label = "Add property to Menu"
@classmethod
def poll(cls, context):... | |
"""
This module implements multioutput regression and classification.
The estimators provided in this module are meta-estimators: they require
a base estimator to be provided in their constructor. The meta-estimator
extends single output estimators to multioutput estimators.
"""
# Author: <NAME> <<EMAIL>>
# ... | |
<filename>vrobbie.py
#!/usr/bin/python
import json
import logging
import requests
import collections
import time
import re
import sys
import os
from threading import Thread
from operator import itemgetter
from itertools import groupby
from flask import Flask, render_template
from flask_ask import Ask, statement, quest... | |
#
# This file is subject to the terms and conditions defined in the
# file 'LICENSE', which is part of this source code package.
#
from enum import Enum
from rdr_service.model.bq_base import BQTable, BQSchema, BQView, BQField, BQFieldTypeEnum, BQFieldModeEnum
from rdr_service.genomic_enums import GenomicSetStatus as _... | |
self.silent:
print("after expansion we have {} distractor images".format(len(overall_distractor_ids)))
distractors_by_partition.append((qud, overall_distractor_ids, overall_similar_ids))
return distractors_by_partition
# Step 2: retrieve each image
# with a cap, exceed the cap, we shuffle the cell list, pick fi... | |
# -*- coding: utf-8 -*-
"""
@author : <NAME>
"""
import numpy as np
import torch
import os
from collections import OrderedDict
from torch.autograd import Variable
# from torch.optim import lr_scheduler
import itertools
import util.util as util
from util.image_pool import ImagePool
from . import networks
import sys
imp... | |
# MIT License
#
# Copyright (c) 2018-2019 Red Hat, Inc.
# 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, m... | |
be equal to the shape of transpose input embeddings: {}".
format(
output_embeddings.weight.shape,
input_embeddings.weight.shape,
input_embeddings.weight.t().shape, ))
if getattr(output_embeddings, "bias", None) is not None:
if output_embeddings.weight.shape[
-1] != output_embeddings.bias.shape[0]:
raise ValueEr... | |
import numpy as np
import pickle
from riglib.filter import Filter
from riglib.bmi.goal_calculators import ZeroVelocityGoal_ismore
from scipy.signal import butter,lfilter
from ismore import ismore_bmi_lib
import tables
from ismore.invasive.make_global_armassist_hull import global_hull
# Path:
# 7742 -- constant assist... | |
<filename>pygeopressure/basic/seisegy.py
# -*- coding: utf-8 -*-
"""
class for interfacing with segy file.
Created on Feb. 7th 2018
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
__author__ = "yuhao"
from builtins import range, open
import json
from shutil import copyfile
f... | |
<gh_stars>10-100
"""
Container for the class Track
"""
import collections
import copy
import logging as log
import os
import time
from typing import List
import librosa
import numpy as np
from pkg_resources import resource_filename
from automix import config
from automix.model.inputOutput.serializer.featureSerializer... | |
= [ (trimmed_vals,ii) ]
else:
d[ other ].append((trimmed_vals,ii) )
#msge("RETURNING FROM PARTITION: %s" % ( str(d.keys())))
return (d, list(all_values.keys()) )
def all_same_operand_decider(ilist,bitpos):
"""Return false if not all of the next bits are the same
operand-decider, also return operand decider if... | |
<gh_stars>1-10
# 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, Sequence, Union, overload... | |
STATES = (
('AK', 'Alaska'),
('AL', 'Alabama'),
('AR', 'Arkansas'),
('AZ', 'Arizona'),
('CA', 'California'),
('CO', 'Colorado'),
('CT', 'Connecticut'),
('DC', 'District of Columbia'),
('DE', 'Delaware'),
('FL', 'Florida'),
('GA', 'Georgia'),
('HI', 'Hawaii'),
('IA', 'Iowa'),
('ID', 'Idaho'),
('IL', 'Illi... | |
<gh_stars>1-10
#!/usr/bin/env python3
import sys
import getopt
import xml.etree.ElementTree as ET
def processVendors(outFile, vendors):
outFile.writelines(["\nconstexpr std::array<std::string_view, ", str(
len(vendors)), "> vendors = {{\n"])
for vendor in vendors:
outFile.writelines([' \"', vendor.tag, '\",\n'])... | |
import os
import pickle
import re
from abc import ABCMeta, abstractproperty
from itertools import chain
from numbers import Number
from types import MethodType
from typing import Dict, Generator, Iterable, List, Optional, Tuple, Union
from typing_extensions import Literal
from urllib.request import urlretrieve
from odi... | |
# -*- coding: utf-8 -*-
from cmath import log
from fedscale.core import response
from fedscale.core.fl_aggregator_libs import *
from fedscale.core.resource_manager import ResourceManager
from fedscale.core import events
from fedscale.core import job_api_pb2
import fedscale.core.job_api_pb2_grpc as job_api_pb2_grpc
im... | |
= []
if testPlot:
print ('voxels count ', len(voxel_stack))
for ii in range(0,len(voxel_stack),len(voxel_stack)//10):
f, ax = plt.subplots(1, 2, figsize=(6,3))
ax[0].imshow(voxel_stack[ii, 0, dim // 2],cmap=plt.cm.gray)
ax[1].imshow(vmask_stack[ii, 0, dim // 2],cmap=plt.cm.gray)
return voxel_stack, vmask_st... | |
current_state
class GaussianState(State):
"""Gaussian State type
This is a simple Gaussian state object, which, as the name suggests,
is described by a Gaussian state distribution.
"""
covar: CovarianceMatrix = Property(doc='Covariance matrix of state.')
def __init__(self, state_vector, covar, *args, **kwargs... | |
= False
self.show()
ok, msg = settings_ok("IPD", self.settings, self.log)
if not ok:
QMessageBox.warning(self, "Missing IPD settings", msg)
self.close()
def define_sections(self):
"""defining the dialog's sections
"""
self.define_section1()
self.define_section2()
self.define_section3()
self.define_section4... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.