input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
following kwargs.
# name: The name of the LLDP policy
# state: enabled | disabled
# Note: The configured state is deployed to both Tx and Rx
# status: created | created,modified | deleted
def lldp(self, **kwargs):
required_args = {'name': '',
'state': '',
'status': ''}
optional_args = {}
templateVars = proce... | |
from
https://github.com/nrontsis/PILCO/blob/6a962c8e4172f9e7f29ed6e373c4be2dd4b69cb7/pilco/models/mgpr.py#L81,
reinterpreted from tensorflow to pytorch
Args:
state_mu (torch.Tensor): mean value of the input distribution. Dim=(Ns + Na,)
state_var (torch.Tensor): covariance matrix of the input distribution. ... | |
# Copyright 2016-2020 Blue Marble Analytics 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 agreed... | |
x in util.elements_in_index_level(df,'dispatch_feeder') if x in self.dispatch_feeders], self.dispatch_feeders)
distribution_df = self.outputs.clean_df(distribution_df)
distribution_df.columns = [cfg.calculation_energy_unit.upper()]
distribution_df = DfOper.mult([distribution_df, self.distribution_losses, self.transm... | |
<filename>cross_loss_influence/helpers/influence_function.py
# Created by <NAME>
# Extensions to https://github.com/nimarb/pytorch_influence_functions
import torch
import time
import datetime
import numpy as np
import copy
import logging
from torch.autograd import grad
import random
from cross_loss_influence.helpers.b... | |
<filename>escape/escape/infr/topology.py
# Copyright 2017 <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... | |
#{n_detectors_found}: Detector: {detector_name}.")
fpath_out = save_data_to_hdf5(
fpath_out,
new_data,
metadata=mdata,
fname_add_version=fname_add_version,
file_overwrite_existing=file_overwrite_existing,
create_each_det=create_each_det,
)
d_dict = {"dataset": new_data, "file_name": fpath_out, "detector_name"... | |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import bytes
from builtins import chr
from builtins import range
from builtins import object
from future.utils import python_2_unicod... | |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_impor... | |
from userbot.events import javes05
from userbot import bot, BOTLOG_CHATID
import asyncio
from telethon import events
from telethon.tl.functions.channels import EditBannedRequest
from telethon.tl.types import (PeerChat, PeerChannel,ChannelParticipantsAdmins, ChatAdminRights,ChatBannedRights, MessageEntityMentionName,Mes... | |
<reponame>pshchelo/kopf
"""
Kubernetes watching/streaming and the per-object queueing system.
The framework can handle multiple resources at once.
Every custom resource type is "watched" (as in ``kubectl get --watch``)
in a separate asyncio task in the never-ending loop.
The events for this resource type (of all its ... | |
returned JSON
#convert to JSON
finishedJSONquery = json.dumps(finishedJSONquery)
print >>sys.stderr, "Timer End"
return HttpResponse(finishedJSONquery, content_type="application/json")
ERROR_MESSAGE += "Error: Trying to access missing or forbidden data"
ERROR_MESSAGE += "Error: You have not submitted throug... | |
###############################################################################
#
# Package: RoadNarrows Robotics Laelaps Robotic Mobile Platform ROS Package
#
# Link: https://github.com/roadnarrows-robotics/laelaps
#
# ROS Node: laelaps_panel, laelaps_range
#
# File: RangeSensorWin.py
#
## \file
##
## \brief Laelaps ... | |
if UseCapturedNS_ and self.ns_prefix_:
namespaceprefix_ = self.ns_prefix_ + ':'
showIndent(outfile, level, pretty_print)
outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
already_processed = set()
self.exportAttributes(outfile, level, already_processed, namespacepr... | |
#!/usr/bin/env python
__author__ = ('<NAME> (<EMAIL>), '
'<NAME> (<EMAIL>), '
'<NAME> (<EMAIL>), '
'<NAME> (<EMAIL>), '
'<NAME> (<EMAIL>), '
'<NAME> (<EMAIL>)')
__version__ = '3.0.32'
__date__ = '19 May 2020'
import sys
import glob
import os
import argparse as ap
from urllib.request import urlretrieve
import t... | |
# -*- coding: utf-8 -*-
# _mapCtoD.py
# Module providing the mapCtoD function
# Copyright 2013 <NAME>
# This file is part of python-deltasigma.
#
# python-deltasigma is a 1:1 Python replacement of Richard Schreier's
# MATLAB delta sigma toolbox (aka "delsigma"), upon which it is heavily based.
# The delta sigma toolbox... | |
<filename>quant_weights.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | |
import sys
import numpy as np
import matplotlib.pyplot as plt
from mlportopt.util.helperfuncs import gen_real_data, train_test, merge_clusters, get_full_weights
from mlportopt.preprocessing.preprocessing import preprocess
from mlportopt.flatcluster.flatcluster import DPGMM, TFSOM, GPcluster
from mlportopt.hiercluster.... | |
import time
import numpy as np
import vtk
from vtk.util import numpy_support
from svtk.lib.toolbox.integer import minmax
from svtk.lib.toolbox.idarray import IdArray
from svtk.lib.toolbox.numpy_helpers import normalize
import math as m
class VTKAnimationTimerCallback(object):
"""This class is called every few mill... | |
The ARM ID of the subnet where the control
plane load balancer is deployed. When unspecified, it defaults to
AzureControlPlane.subnet_id. Example: "/subscriptions/d00494d6-6f3c-4280
-bbb2-899e163d1d30/resourceGroups/anthos_cluster_gkeust4/providers/Micro
soft.Network/virtualNetworks/gke-vnet-gkeust4/subnets/subneti... | |
<reponame>horizonfleet/horizon
'''
Speed_Layer.py
@author: davidrundel, janders
The speed layer is responsible for (near) real-time data aggregation, enrichment and inference,
as well as ensuring ground-truth data is saved into the batch-database.
'''
import os, json
from pyspark import SparkContext
from pyspark.st... | |
"""Keeping track of mapping and reduce operations over tasks."""
from copy import deepcopy
from . import helpers_state as hlpst
from .helpers import ensure_list
from .specs import BaseSpec
class State:
"""
A class that specifies a State of all tasks.
* It's only used when a task have a splitter.
* It contains al... | |
[2.658419759563575, 44.02221909387343, 0.2523467042002105],
[14.51709249202439, 6.983205119480762, 28.393455696095884],
[0.5813684255696072, 19.786932694371394, 15.41750901086601],
[7.25570681241572, 1.0927440074874795, 91.84582406284943],
[0.0009872251043546506, 0.9053174962382692, 133.8246713127458],
[8.11908781... | |
# Copyright 2015, 2016 IBM Corp.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | |
<li> Data ONTAP 8.2 or later operating in Cluster-Mode if the
relationship control plane is 'v1'.
</ul>
"""
return self.request( "snapmirror-destroy-async", {
'source_vserver': [ source_vserver, 'source-vserver', [ basestring, 'None' ], False ],
'source_volume': [ source_volume, 'source-volume', [ basestring, 'No... | |
c.argument('bucket_id', type=str, help='Bucket ID to which the task belongs. The bucket needs to be in the '
'plan that the task is in. It is 28 characters long and case-sensitive. Format validation is done '
'on the service.')
c.argument('checklist_item_count', type=int, help='Number of checklist items that are pre... | |
# <<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>>
"""Energy distribution classes."""
import math
from pqu import PQU as PQUModule
from fudge.core.utilities import brb
import ... | |
from datetime import date, timedelta
from urllib import urlencode
import pytest
from tornado.httpclient import HTTPError
from fixtures import fe_app as app
from fixtures import standard_graph, users, graph, groups, session, permissions # noqa
from grouper.model_soup import Group, User
from grouper.models.public_key i... | |
top_ks = [max(int(num_pred * top_k), 1) for num_pred in num_preds]
else:
top_ks = [min(num_pred, 1) for num_pred in num_preds]
pgt_scores_idxs = [
torch.topk(prev_pred_score, top_k, dim=0)
for prev_pred_score, top_k in zip(prev_pred_scores, top_ks)
]
pgt_scores = [item[0] for item in pgt_scores_idxs]
pgt_idxs =... | |
30,'AN'],
['BC05', 'C', 30,'AN'],
['BC06', 'C', (2,2),'AN'],
['BC07', 'C', 2,'AN'],
],
'BCA': [
['BOTSID', 'M', 3,'AN'],
['BCA01', 'M', (2,2),'AN'],
['BCA02', 'C', (2,2),'AN'],
['BCA03', 'M', 22,'AN'],
['BCA04', 'C', 30,'AN'],
['BCA05', 'C', 8,'AN'],
['BCA06', 'M', (6,6),'DT'],
['BCA07', 'C', 45,'AN'],
['BC... | |
<filename>choking_commonality.py
#help("modules") #
import urllib.request
import math
import statistics
import collections
import ast
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
"""
Hypothesis 2: A refutation of the more wins and/or better percentage i... | |
'region': 0, 'zone': 0, 'weight': 80,
'ip': '127.0.0.0', 'port': 10000, 'device': 'sdc'})
rb.add_dev({'id': 3, 'region': 0, 'zone': 0, 'weight': 80,
'ip': '127.0.0.0', 'port': 10000, 'device': 'sdd'})
rb.add_dev({'id': 4, 'region': 0, 'zone': 0, 'weight': 80,
'ip': '127.0.0.0', 'port': 10000, 'device': 'sde'})
r... | |
from __future__ import division
import warnings
import gc
import numpy as np
import random, string
from subprocess import Popen, PIPE
import ConfigParser
import math
import cPickle as pickle
from scipy.sparse.linalg import *
from scipy.sparse import csr_matrix, coo_matrix
import myenums
configParser = ConfigParser.Co... | |
window=window, window_p=window_p
)
self.processed_data[i, 0 : len(fid)] = fid
self.processed_data[i, len(fid) :] = np.zeros(self.ft_points[1] - len(fid))
if self.acq[1] != 5:
self.processed_data[i, :] = np.fft.fftshift(
np.fft.fft(
self.processed_data[i, :] * np.exp(1.0j * (phase / 180) * np.pi)
)
)[::-1]
... | |
"""
Calculates port ranks and distributes ports.
The rank of a port is a floating point number that represents its position
inside the containing layer. This depends on the node order of that layer and on the
port constraints of the nodes. Port ranks are used by {@link ICrossingMinimizationHeuristics
for calculating b... | |
of axes are
combined into a single composite image before
saving a figure as a vector graphics file,
such as a PDF.''').tag(config=True, kind='')
#
# CONTOUR PLOTS
#
contour_negative_linestyle = Enum(['dashed', 'solid'], default_value='dashed', help=r'''dashed | solid''').tag(
config=True, kind='')
contour_cor... | |
####################################################
####################################################
# functions and classes used in conjunction with
# pipeline_metaomics.py
####################################################
####################################################
# import libraries
import sys
impo... | |
<filename>aydin/it/classic_denoisers/spectral.py
import math
from functools import partial
from typing import Optional, Union, Tuple, Sequence
import numpy
from numba import jit, prange
from numpy.fft import fftshift, ifftshift
from scipy.fft import fftn, ifftn, dctn, idctn, dstn, idstn
from aydin.util.array.outer imp... | |
import collections
from collections import defaultdict as ddict
import itertools
from .. import graph_util
from ..ssa import objtypes, ssa_jumps
from ..ssa.exceptionset import ExceptionSet
from .setree import SEBlockItem, SEIf, SEScope, SESwitch, SETry, SEWhile
# This module is responsible for transforming an arbitr... | |
"""@file anchor_deepattractornet_softmax_loss.py
contains the AnchorDeepattractornetSoftmaxLoss"""
import loss_computer
from nabu.neuralnetworks.components import ops
import warnings
import tensorflow as tf
class AnchorDeepattractornetSoftmaxLoss(loss_computer.LossComputer):
"""A loss computer that calculates the l... | |
# -*- coding: utf-8 -*-
import copy
from functools import total_ordering
from django.urls import reverse
from django.utils.encoding import force_bytes
from django.utils.translation import ugettext_lazy as _
from olympia.constants.applications import ANDROID, FIREFOX
from olympia.constants.base import (
ADDON_DICT, ... | |
import itertools as itl
import NodosAST as ast
import visitor
from cool_utils import *
from cool_errors import *
ERROR = 0
INTEGER = 1
class TypeCollectorVisitor:
def __init__(self,scope):
self.context = scope
@visitor.on('node')
def visit(self, node):
pass
@visitor.when(ast.ProgramNode)
def visit(self, no... | |
<gh_stars>0
# Copyright 2018 Iguazio
#
# 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 writi... | |
# Ensure output is in float32 for softmax operation
x = x.float()
logits = F.softmax(x, dim=1)
return logits
def training_step(self, batch, batch_idx):
x, y = batch
logits = self.forward(x)
loss = F.cross_entropy(logits, y)
self.log("train_loss", loss, prog_bar=True)
self.log("train_acc", self.train_acc(logit... | |
######################################################################
# #
# Copyright 2009-2020 <NAME>. #
# This file is part of gdspy, distributed under the terms of the #
# Boost Software License - Version 1.0. See the accompanying #
# LICENSE file or <http://www.boost.org/LICENSE_1_0.txt> #
# #
####################... | |
# mechanism_dvs.py
#
# Copyright 2014 Cybercom Finland Oy
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | |
###########################################
# Project: CMSIS DSP Library
# Title: node.py
# Description: Node class for description of dataflow graph
#
# $Date: 29 July 2021
# $Revision: V1.10.0
#
# Target Processor: Cortex-M and Cortex-A cores
# -------------------------------------------------------------------- */... | |
<filename>libs/logdb.py
"""Logging database
This file implements a logging database optimized to store sequential
data provided for example by sensors. The data is stored in the CSV
format. A definable portion of the data is kept in the RAM to provide
them in a fast way if requested.
Copyright (C) 2020 <NAME>
See t... | |
<reponame>Edgencio/pybel
# -*- coding: utf-8 -*-
"""Constants for PyBEL.
This module maintains the strings used throughout the PyBEL codebase to promote consistency.
"""
from .config import connection
def get_cache_connection() -> str:
"""Get the preferred RFC-1738 database connection string.
1. Check the envir... | |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import gzip
import json
import time
from datetime import datetime
import networkx as nx
import warnings
warnings.filterwarnings("ignore")
import plotly.graph_objects as go
import matplotlib.pyplot as plt
from collections import Counter
import copy
#... | |
their original values as defined in the parent meme(s)
and removes custom properties.
Two params: entity, drilldown (optional)'''"""
# revertPropertyValues(self, drillDown = False)
def execute(self, params):
drillDown = False
try:
if len(params) == 2:
drillDown = params[1]
except: pass
try:
entity = entity... | |
compute left/right vacancy
occupied = map(lambda x: x > 0, _tile_occ['c'])
left = occupied.index(True)
right = occupied[::-1].index(True)
# compute bottom/top vacancy
occupied = map(lambda x: x > 0, _tile_occ['r'])
bot = occupied.index(True)
top = occupied[::-1].index(True)
_vacancy = [left, right, ... | |
"""
Created on 2020-10-11
@author: cheng.li
"""
from sqlalchemy import (
Column,
INT,
FLOAT,
Date,
Index,
Text,
text
)
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class _StkDailyPricePro(Base):
__tablename__ = 'stk_daily_price_pro'
__table_arg... | |
is different from provided value list('+str(len(value_list))+')')
print('Cannot update field:', field_name)
else:
print('Updating values for field:', field_name)
for row in range(len(db1)):
rec = db1[row]
rec[field_name] = value_list[row]
rec.store()
db1.close()
updated = True
except:
db1.close()
add_fie... | |
error details in log file: {}.\n If needed, please reach out to tool support at: <EMAIL>, with your report and log file. \033[0;0m'.format(log_file_path))
log_file_logger.exception('{}\n'.format(e))
#20:Check:Controllers:vEdge list sync
print(' #20:Checking:Controllers:vEdge list sync')
log_file_logger.... | |
over the given axis, ignoring NaNs.
"""
y = array(a,subok=True)
if not issubclass(y.dtype.type, _nx.integer):
y[isnan(a)] = _nx.inf
return y.min(axis)
def nanargmin(a, axis=None):
"""Find the indices of the minimium over the given axis ignoring NaNs.
"""
y = array(a, subok=True)
if not issubclass(y.dtype.type... | |
# 2021.05.07-Changed for IPT
# Huawei Technologies Co., Ltd. <<EMAIL>>
import os
from importlib import import_module
import torch
import torch.nn as nn
import torch.nn.parallel as P
import torch.utils.model_zoo
class Model(nn.Module):
def __init__(self, args, ckp):
super(Model, self).__init__()
print('Making mode... | |
<gh_stars>1-10
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Determine functional groups present in a Molecule.
"""
import copy
from pymatgen.analysis.graphs import MoleculeGraph
from pymatgen.analysis.local_env import OpenBabelNN
from pymatgen.core.structure impor... | |
0.53958),
(0.00000, 0.47610, 0.52371),
(0.00000, 0.49197, 0.50784),
(0.00000, 0.50784, 0.49197),
(0.00000, 0.52371, 0.47610),
(0.00000, 0.53958, 0.46023),
(0.00000, 0.55545, 0.44436),
(0.00000, 0.57132, 0.42849),
(0.00000, 0.58719, 0.41262),
(0.00000, 0.60306, 0.39675),
(0.00000, 0.61893, 0.38088),
(0.00000,... | |
import torch
import numpy as np
import copy
import itertools
from offpolicy.utils.util import huber_loss, mse_loss, to_torch
from offpolicy.utils.popart import PopArt
from offpolicy.algorithms.base.trainer import Trainer
class R_MADDPG(Trainer):
def __init__(self, args, num_agents, policies, policy_mapping_fn, device... | |
array to a raster
#Byte, UInt16, Int16, UInt32, Int32, Float32, Float6
def write_raster(numpy_array,output_name, template = '', df = 'HFA', dt = 'Int16', width = '', height = '', bands = 1, projection = '', transform = '', ct = '', names = '', out_no_data = '',assume_ct_names = True, compress = False):
df = format_di... | |
<reponame>tandriamil/BrFAST<gh_stars>1-10
#!/usr/bin/python3
"""Module containing the FPSelect exploration algorithm."""
from datetime import datetime
from math import ceil
from multiprocessing import Pool
from multiprocessing.managers import ListProxy
from os import cpu_count
from typing import Any, Dict, List, Set, ... | |
"""
main.py
main.py is the main program of SonaScan and contains most of the GUI functions.
"""
# Global includes
import asyncio
import shutil
import time
import urllib
import webbrowser
from datetime import datetime
from os.path import basename
from src.forge import process_scan, monitor_scan_dir, get_obj, get_for... | |
`Maximum Setpoint Humidity Ratio`"""
self["Maximum Setpoint Humidity Ratio"] = value
@property
def reference_setpoint_node_name(self):
"""field `Reference Setpoint Node Name`
| The current setpoint at this node is the
| desired condition for the Mixed Air Node
| This node must have a valid setpoint
| which ha... | |
<filename>packages/pegasus-python/src/Pegasus/db/schema.py
#!/usr/bin/env python
#
# Copyright 2018-2020 University Of Southern California
#
# 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
#
# ... | |
import numpy as np
import scipy.linalg as linalg
from pyriemann.estimation import Covariances
from pyriemann.utils.mean import mean_covariance
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.cross_decomposition import CCA
from sklearn.utils.validation import check_is_fitted
from .utils import filt... | |
= self._expect_num()
if n_bits not in {8, 16, 32, 64}:
self._parse_error("expected 8, 16, 32, or 64")
self._expect_token("<")
self._parse_cells(prop, n_bits//8)
elif tok.val == "[":
self._parse_bytes(prop)
elif tok.id is _T_STRING:
prop._add_marker(_TYPE_STRING)
prop.value += self._unescape(tok.val.encode("u... | |
<reponame>code-backdoor/code-backdoor
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same director... | |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_impor... | |
#!/usr/bin/python3
"""This script wraps up running clang tidy to acheive the goals listed below.
1. Support specifying a yaml configuration file on the command line (-config-file)
2. Optionally run the `run-clang-tidy` python wrapper, which supports job threads
3. Filter redundant output from `run-clang-tidy`
4. Mutat... | |
"/" + version + "/jsonFile")
self.projectDict = {
"projectPath": self.projectPath,
"version": [version],
"groupIDStart": 1,
"taskIDStart": 1,
"elementIDStart": 1,
"templateIDStart": 1,
"TaskImagePath": {
"element": {},
"template": {}
},
"GameOverIDStart": 1,
"CloseIconIDStart": 1,
"DeviceCloseIDStart":1,
... | |
first 10 ids only
chunk = self.get_ids_chunk(ids['id'], 0, 10)
return chunk
def blockcos_bulkpost(self, ids):
return self.__blockcos_bulkget_reps(ids)
def __blockcos_bulkget_ids(self):
return self.api('GET', URI_BLOCKVPOOLS_BULKGET)
def __blockcos_bulkget_reps(self, ids):
return self.api('POST', URI_BLOCKVPO... | |
None:
return []
written_methods.add((self.version, self.op_id))
parameters = self.prep_inbound_params()
if self.is_staticmethod and self.self_param:
parameters.append(self.self_param)
lines = []
lines.extend(self.get_meth_decorators())
lines.append(self.get_meth_defline(parameters=parameters))
ds = self.make_d... | |
<gh_stars>1-10
import warnings
warnings.filterwarnings('ignore')
import argparse
import math
from math import log10
import os
from collections import defaultdict
import itertools
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import DataLoader
#fro... | |
<gh_stars>1-10
# coding: utf-8
# SQLAlchemy Mappings generated from Rfam 14.0 using sqlacodegen (https://pypi.org/project/sqlacodegen/)
# sqlacodegen mysql+mysqlconnector://rfamro@mysql-rfam-public.ebi.ac.uk:4497/Rfam --outfile rfam_db.py
import sqlalchemy.orm
import sqlalchemy.engine.url
from sqlalchemy import CHAR,... | |
# coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may ch... | |
"""
Sets the value of the `configuration` property.
"""
Struct._check_type('configuration', value, Configuration)
self._configuration = value
@property
def timezone(self):
"""
Returns the value of the `timezone` property.
"""
return self._timezone
@timezone.setter
def timezone(self, value):
"""
Sets the... | |
<filename>connectomics/utils/evaluate.py<gh_stars>0
import numpy as np
import scipy.sparse as sparse
import h5py
from scipy import ndimage
__all__ = [
'get_binary_jaccard',
]
def adapted_rand(seg, gt, all_stats=False):
"""Compute Adapted Rand error as defined by the SNEMI3D contest [1]
Formula is given as 1 - the... | |
= K8sHelper('VirtualMachinePool')
disk_node_name = get_node_name(disk_heler.get(params.vol))
pool_node_name = get_node_name(pool_helper.get(params.pool))
pool_info = get_pool_info_from_k8s(params.pool)
check_pool_active(pool_info)
poolname = pool_info['poolname']
disk_info = get_vol_info_from_k8s(params.vol)
ol... | |
pass
try:
os.remove("gauss.emcee")
except:
print("Could not remove file: gauss.emcee")
try:
os.remove("musig.emcee")
except:
print("Could not remove file: musig.emcee")
def sanity_MCMCSampler(self):
# Import some required modules
from numpy import arange, sqrt, exp, pi, random, ones
import matplotlib.pyla... | |
<filename>lib/python/batch_sim/parameter_tables.py
# Copyright 2020 Makani Technologies 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
#
# ... | |
<gh_stars>100-1000
"""
Composition featurizers for compositions with ionic data.
"""
import itertools
import numpy as np
from pymatgen.core.composition import Composition
from matminer.featurizers.base import BaseFeaturizer
from matminer.featurizers.utils.stats import PropertyStats
from matminer.featurizers.utils.oxi... | |
= 2.0e3
self.n = 4.0
self.E = 471e3
self.V = 0
self.tensorCorrection = "UniAxial"
self.MPa = True
self.C_OH_0 = 1
self.r = 0
elif flowLaw == "Quartz_Diorite-Hansen_Carter_1982":
# taken from Carter and Tsenn (1986). Flow properties of continental lithosphere - page 18.
self.A = pow(10,-1.5)
self.n = 2.4
... | |
<reponame>agdsn/pycroft<filename>pycroft/lib/user.py
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
"""
pycroft.lib.user
~~~~~~~~~~~~~~
This module contains.
... | |
<reponame>lixinsu/Lion
#!/usr/bin/env python
# coding: utf-8
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import six
import copy
import spacy
import logging
import unicodedata
import collections
from shutil import copyfile
import jieba
import jieba.posseg as pseg
lo... | |
#
# $Id: sphinxapi.py 1216 2008-03-14 23:25:39Z shodan $
#
# Python version of Sphinx searchd client (Python API)
#
# Copyright (c) 2006-2008, <NAME>
# Copyright (c) 2006, <NAME>
# All rights reserved
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public... | |
start=start,
end=end,
code="P_WRONG_PREP_AF",
text=text,
detail=detail,
original=match.tidy_text,
suggest=suggest,
)
)
def wrong_preposition_vitni_af(self, match: SimpleTree) -> None:
"""Handle a match of a suspect preposition pattern"""
# Find the offending nominal phrase
np = match.first_match(". >> { 'v... | |
#! usr/bin/python3.6
"""
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-07-06 14:02:20.222384
.. warning::
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
They are there as a guide as to how the visual basic / catscript functions work
and thus hel... | |
#!/usr/bin/python
from __future__ import print_function
import os
import shlex
import signal
import subprocess
import sys
import time
import random
import string
import stat
from optparse import OptionParser
from threading import Thread
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, ... | |
using ZLib level 6 compression flag (default recommended value)
PNG_Z_DEFAULT_COMPRESSION = 0x0006
# save using ZLib level 9 compression flag (default value is 6)
PNG_Z_BEST_COMPRESSION = 0x0009
PNG_Z_NO_COMPRESSION = 0x0100 # save without ZLib compression
# save using Adam7 interlacing (use | to combine with ot... | |
limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir
"""
return pulumi.get(self, "size_limit")
def _translate_property(self, prop):
return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop
@pulumi.output_type
class DatadogAgentSpecAgentConfigVolumesEmptyDirSizeLimit(dict):
def ... | |
sweetish sweetmeat sweetmeats
swellhead swellheaded swellheads swelter sweltered sweltering
swelterings swelters swiftness swimmer swimmers swimsuit swimsuits
swinger swingers swinish swirlier swirliest swirly switchback
switchbacks switchblade switchblades swordplay swordsman swordsmen
sybarite sybarites sybaritic syc... | |
#!/usr/bin/env python
'''
Copyright 2017, Fujitsu Network Communications, 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 applicabl... | |
= len(self.config[component].get(ck.PARTIAL_REPAIR, {}))
if num_repair_modes != 1 and num_repair_modes != num_failure_modes:
raise CaseError(
f"Number of concurrent repairs for component '{component}' must be 1 or equal to the number of concurrent failures"
)
for failure, fail_config in self.config[component].get... | |
version of 10557.epub.images"
http.queue_response(**epub10557_updated)
imported_editions, pools, works, failures = importer.import_from_feed(
self.content_server_mini_feed
)
assert {e_10441, e_10557} == set(imported_editions)
assert 4 == len(s3_for_books.uploaded)
assert epub10441_updated["content"] in s3_for_... | |
<reponame>ubragg/endpoints-management-python
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | |
<reponame>vespa-mrs/vespa
#
# Some of the code in this file was derived from the Python package
# pfile-tools project, https://github.com/njvack/pfile-tools
# and as such we have included their BSD statement in this file.
#
# Copyright (c) 2012, Board of Regents of the University of Wisconsin
# All rights reserved.
# ... | |
name_='userParameterStringType', fromsubclass_=False, pretty_print=True):
if pretty_print:
eol_ = '\n'
else:
eol_ = ''
if self.name is not None:
showIndent(outfile, level, pretty_print)
outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_format_string(quote_xml(self.name).encode(ExternalEncoding), inpu... | |
"void DrawFlask__6GPanelP7PanelXYP12PlayerStruct(struct GPanel *this, struct PanelXY *XY, struct PlayerStruct *Plr)")
del_items(0x80097824)
SetType(0x80097824, "unsigned char SpdTrimCol__Fs(short col)")
del_items(0x8009785C)
SetType(0x8009785C, "void DrawSpeedBar__6GPanelP7PanelXYP12PlayerStruct(struct GPanel *this, st... | |
#!/usr/bin/env python3
# vim: set fileencoding=utf-8 :
# Standard library
from urllib.parse import urljoin, urlsplit
import argparse
import sys
import time
import traceback
import os
# Third-party
from bs4 import BeautifulSoup
import grequests # WARNING: Always import grequests before requests
from junit_xml import T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.