input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<gh_stars>10-100
import os, sys, json, pickle, io, time, random, copy
import h5py
import pprint
import threading, queue
from tqdm import tqdm
from collections import Counter
from transformers import MobileBertTokenizer
import cv2
from PIL import Image
import numpy as np
import revtok
import torch
sys.path.append(os.p... | |
Loc_MatAYPX(self, X, scale):
return _smg2s.parMatrixSparseRealDoubleLongInt_Loc_MatAYPX(self, X, scale)
def ConvertToCSR(self):
return _smg2s.parMatrixSparseRealDoubleLongInt_ConvertToCSR(self)
def Loc_ConvertToCSR(self):
return _smg2s.parMatrixSparseRealDoubleLongInt_Loc_ConvertToCSR(self)
def ZeroEntries(sel... | |
# coding=utf-8
# Copyright 2017 The Tensor2Tensor Authors.
#
# 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... | |
# Natural Language Toolkit (NLTK) MUC Corpus Reader
#
# Copyright (C) 2001-2011 NLTK Project
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>> (original IEER Corpus Reader)
# <NAME> <<EMAIL>> (original IEER Corpus
# Reader)
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
# Adapted from nltk.corp... | |
max_abs_scaler(input_cols, output_cols=None):
pass
def iqr(self, columns, more=None, relative_error=RELATIVE_ERROR):
"""
Return the column Inter Quartile Range
:param columns:
:param more: Return info about q1 and q3
:param relative_error:
:return:
"""
df = self.root
iqr_result = {}
columns = parse_columns... | |
return
ik_step = Pose()
ik_step.position.x = d * ik_delta.position.x + target_pose.position.x
ik_step.position.y = d * ik_delta.position.y + target_pose.position.y
ik_step.position.z = d * ik_delta.position.z + target_pose.position.z
ik_step.orientation.x = d * ik_delta.orientation.x + target_pose.orientation.x
i... | |
<gh_stars>0
import numpy as np
from numpy.random import randn
import pytest
import pandas as pd
from pandas import DataFrame, Index, MultiIndex, Series
import pandas._testing as tm
from pandas.core.reshape.concat import concat
from pandas.core.reshape.merge import merge
@pytest.fixture
def left():
"""l... | |
<filename>dace/codegen/targets/rtl.py
# Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
import itertools
from typing import List, Tuple, Dict
from dace import dtypes, config, registry, symbolic, nodes, sdfg
from dace.sdfg import graph, state, find_input_arraynode, find_output_arraynode
from... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import version_info
from base64 import b64encode, b64decode
from binascii import hexlify, unhexlify
__all__ = ['encrypt_ecb', 'decrypt_ecb',
'encrypt_cbc', 'decrypt_cbc',
'encrypt', 'decrypt']
if version_info[0] == 2:
# python2
PY2 = True
PY3 = False
el... | |
not None:
pulumi.set(__self__, "delay_evaluation", delay_evaluation)
if evaluation_interval is not None:
pulumi.set(__self__, "evaluation_interval", evaluation_interval)
if truncation_percentage is not None:
pulumi.set(__self__, "truncation_percentage", truncation_percentage)
@property
@pulumi.getter(name="poli... | |
<reponame>aguirguis/python-swiftclient<filename>test/unit/utils.py
# Copyright (c) 2010-2012 OpenStack, 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... | |
return G.internal_scaling_dimension(node)
def __connectivity_func(self, G, node):
return G.connectivity_dimension(node)
def __kcoreness_func(self, G, node, pre_dic):
return pre_dic[node]
def __triangles(self, big_graph, node):
#if 'triangles' in self.__params and len(self.__params['triangles']) == self.... | |
<reponame>ellenjkr/LattesXML2PDF
from docx import Document
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import Pt
from docx.shared import RGBColor
class WordFile():
def __init__(self, resume):
super(WordFile, self).__init__()
self.presentation = resume.presentation
self.abstract = resume.abst... | |
# a string consisting of characters that are valid identifiers in both
# Python 2 and Python 3
import string
valid_ident = string.ascii_letters + string.digits + "_"
def str_to_identifier(s):
"""Convert a "bytes" to a valid (in Python 2 and 3) identifier."""
# convert str/bytes to unicode string
s = s.decode()
... | |
GLfloat, GLfloat) # GL/glext.h:5993
PFNGLPROGRAMPARAMETER4FVNVPROC = CFUNCTYPE(None, GLenum, GLuint, POINTER(GLfloat)) # GL/glext.h:5994
PFNGLPROGRAMPARAMETERS4DVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLuint, POINTER(GLdouble)) # GL/glext.h:5995
PFNGLPROGRAMPARAMETERS4FVNVPROC = CFUNCTYPE(None, GLenum, GLuint, GLu... | |
<reponame>hasii2011/albow-python-3
"""
The resource module exports some utility functions for finding, loading and caching various types of
resources. By default, resource files are looked for in a directory named _Resources_ alongside the
.py file of the program's main module.
Resource names are specified in a platfo... | |
: float, optional
exclude_atoms : tuple of ...
Returns
-------
int
"""
n_res = 0
resids = []
for contact in self.nearby_atoms:
if (contact.atom_name() in exclude_atoms):
continue
if (contact.distance() < distance):
labels = contact.atom.fetch_labels()
other_resname = contact.resname()
other_resid = label... | |
# clip data to time window NOW
# dt = 1000.0 * acqr.sample_interval
dt_seconds = acqr.sample_interval
min_index = int(self.min_time / dt_seconds)
if self.max_time > 0.0:
max_index = int(self.max_time / dt_seconds)
else:
max_index = data.shape[1]
data = data[:, min_index:max_index]
time_base = acqr.time_bas... | |
(dict{str: str}): Dictionary of pairs to find and
replace. ex: {'find': 'replace'}.
skip (list(str), optional): List of values to ignore when
replacing. Defaults to None.
startrow (int, optional): Starting row number where values
begin. Defaults to 1.
Returns:
self: Xlsx object.
"""
if not skip:
skip = []... | |
# (c) 2012, <NAME> <<EMAIL>>
# (c) 2012-2014, <NAME> <<EMAIL>> and others
# (c) 2017, <NAME> <<EMAIL>>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ... | |
(seqName.split("&")[1]).split("_")[0] == "SIZE":
name = seqName.split("&")[0]
size = (seqName.split("&")[1]).split("_")[1]
addx = (seqName.split("&")[2]).split("_")[1]
else:
name = seqName.split("&")[0]
size = "x"
addx = ""
pegoFa = 0
else:
seq1 = line.split()[0]
if z == 2:
add = seq1[-2:]
seq = seq1[:-2]
... | |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Callable, List, Optional, Tuple, Type, Union
import beanmachine.ppl.compiler.bmg_nodes as bn
from beanmachine.ppl.compil... | |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 Samsung Electronics Co., Ltd All Rights Reserved
#
# Contact: <NAME> <<EMAIL>>
#
# 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... | |
<filename>ancom.py
import numpy as np
import pandas as pd
import statsmodels.api as sm
from scipy import stats
from itertools import product
from mytstats import tstatistic
from skbio.stats import composition
from skbio.stats.composition import clr, multiplicative_replacement
__all__ = ['otuLogRatios',
'ancom',
'gl... | |
1:
# Single 2D data
Y, X = data.shape
T, Z = 1, 1
data.shape = T, Z, 1, Y, X, 1 # imageJ format should always have TZCYXS data shape
if metadata is None:
metadata = {}
new_tif.save(data, metadata=metadata)
def getDefaultROI(self):
Y, X = self.img.image.shape
w, h = X, Y
xc, yc = int(round(X/2)), int(round(... | |
"""Filter out instances of Token, leaving only a list of strings.
Used instead of a more specific parsing method (e.g. splitting on commas)
when only strings are expected, so as to be a little lenient.
Apache does it this way and has some comments about broken clients which
forget commas (?), so I'm doing it the ... | |
<filename>qcodes/instrument_drivers/Keysight/KtM960xDefs.py
# KtM960x Definitions
#
# These have been copy/pasted out of KtM960x.h provided by Keysite
#
IVI_ATTR_BASE = 1000000
IVI_INHERENT_ATTR_BASE = (
IVI_ATTR_BASE + 50000
) # base for inherent capability attributes
# base for IVI-defined class attributes
IVI_CLA... | |
discrete
selection. The data value _nearest_ the mouse cursor is added to the
selection. See the [nearest transform](nearest.html) documentation for more
information.
on : VgEventStream
A [Vega event stream](https://vega.github.io/vega/docs/event-streams/)
(object or selector) that triggers the selection. For int... | |
4.83759520e-16, 9.49612632e-06,
# -1.06805612e-06, -1.53743221e-09, 3.63509506e-10], [-1.49006382e-07, -9.89413898e-13, -7.43139226e-15, 1.68328909e-11,
# -3.44796856e-11, -1.56880637e-16, 5.42517639e-16, 8.04661898e-06,
# -1.09156392e-06, -2.36771942e-09, 4.08420695e-10], [-1.47357294e-07, -1.08127351e-12, -5.75445470... | |
<reponame>aerospike/aerospike-admin
# Copyright 2013-2021 Aerospike, 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... | |
VISWANATH_NATARAJAN_2, VISWANATH_NATARAJAN_2E,
VDI_TABULAR, LETSOU_STIEL, PRZEDZIECKI_SRIDHAR]
'''Default rankings of the low-pressure methods.'''
ranked_methods_P = [COOLPROP, LUCAS]
'''Default rankings of the high-pressure methods.'''
obj_references = pure_references = ('Psat', 'Vml')
obj_references_types = pu... | |
#part of the code from openai
#https://github.com/openai/baselines/blob/master/baselines/deepq/replay_buffer.py
import numpy as np
import random
import operator
from numba import njit
class SegmentTree(object):
def __init__(self, capacity, operation, neutral_element):
"""Build a Segment Tree data structur... | |
<reponame>hidaruma/caty
#coding: utf-8
from caty.core.async import AsyncQueue
from caty.core.facility import Facility, AccessManager, FakeFacility, ReadOnlyFacility, EntityProxy, AbstractEntityProxy
from caty.util import cout, error_to_ustr, brutal_error_printer
from caty.util.path import join
from caty.jsontools.util ... | |
a, b = t
return a + b
with self.assertRaisesRegexWithHighlight(RuntimeError, "Provided tuple is not fully defined/refined", "t"):
s = torch.jit.script(fn)
def test_augmented_assign(self):
def foo(a, b):
a += b
a -= b
a /= b
a *= b
return a, b
self.checkScript(foo, (torch.rand(3), torch.rand(3)))
def test_... | |
from entity import *
# instruction centric modeling
# instruction centric checking
# parameterized model
"""
state
d w t : r
d w : L1 L1.fifo.head L1.fifo.tail lock (single)
d : L2 L2.fifo.head L2.fifo.tail lock (addr-> lock)
"""
# make sure you only read once
"""
state(d).L2.isL2()
L2fr x,entity(d) state(d).L... | |
(using link MTU)
IP primary address route-preference: 0, tag: 0
IP unnumbered interface (loopback0)
IP proxy ARP : disabled
IP Local Proxy ARP : disabled
IP multicast routing: disabled
IP icmp redirects: disabled
IP directed-broadcast: disabled
IP Forwarding: disabled
IP icmp unreachables (except port): disa... | |
being written.
dts : datetime64 array
The dts corresponding to values in cols.
cols : dict of str -> np.array
dict of market data with the following characteristics.
keys are ('open', 'high', 'low', 'close', 'volume')
open : float64
high : float64
low : float64
close : float64
volume : float64|int64... | |
4
self.postSynaptic['I3'][self.nextState] += 2
self.postSynaptic['I4'][self.nextState] += 6
self.postSynaptic['I5'][self.nextState] += 3
self.postSynaptic['I6'][self.nextState] += 1
self.postSynaptic['M1'][self.nextState] += 2
self.postSynaptic['M3L'][self.nextState] += 1
self.postSynaptic['MCL'][self.nextState]... | |
<reponame>WitnessNR/Updated_WiNR
from numba import njit
import numpy as np
import matplotlib.pyplot as plt
from solve import *
# from tensorflow.contrib.keras.api.keras.models import Sequential
# from tensorflow.contrib.keras.api.keras.layers import Dense, Dropout, Activation, Flatten, GlobalAveragePooling2D, Lambda
... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2015 Kitware 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... | |
continue
if line.__contains__("Not owner") or \
line.__contains__(" Rewind of device 40") or \
line.__contains__("Stage failed, all retries exhausted") or \
line.__contains__("Request for locked or disabled device") or \
line.__contains__('Unexpected error in LTO Library') or \
line.__contains__('LTO I/O failure... | |
<gh_stars>1-10
#! /usr/bin/env python
#! /opt/casa/packages/RHEL7/release/current/bin/python
#
# AAP = Admit After Pipeline
#
# Example python script (and module) that for a given directory finds all ALMA pbcor.fits files
# and runs a suite of predefined ADMIT recipes on them, in a local directory named madmit_<YMD_HMS... | |
<filename>packages/Qpyl/qgeninp.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# MIT License
#
# Copyright (c) 2018 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software wit... | |
the cached list of resolutions. In the unlikely
case that your device driver is misconfigured and there is no active
resolution, this returns the first resolution."""
for resolution in self._resolutions:
if resolution.is_active:
return resolution
print("No active resolution. Please report this bug to the libratba... | |
range implementation
if self.isVisible():
plot = self.getPlot()
if plot is not None:
plot._invalidateDataRange()
def getRgbaImageData(self, copy: bool = True):
"""Get the displayed RGB(A) image
:returns: Array of uint8 of shape (height, width, 4)
:rtype: numpy.ndarray
"""
return self.getColormap().applyToDa... | |
<reponame>ihgazni2/navegador5
import urllib.parse
import os
import re
from xdict import utils
import elist.elist as elel
def get_origin(url):
rslt = urllib.parse.urlparse(url)
origin = rslt.scheme +'://'+rslt.netloc
return(origin)
def get_base_url(url):
temp = urllib.parse.urlparse(url)
netloc ... | |
"""
- THIS FILE IS GENERATED -
CoveoInterfaces/CoveoInterfaces/IndexService.jid
"""
from attr import attrib, attrs
from datetime import datetime
from enum import auto
from typing import Dict, List, Optional as Opt
from .root import CASING, CoveoInterface, ExceptionBase, JidEnumFlag, JidType, MultiOut, api
from .ind... | |
# Copyright 2022 The Flax Authors.
#
# 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... | |
"""
Author: <NAME>
License: MIT
"""
import numpy as np
from xdgmm import XDGMM
class Empiricist(object):
"""
Worker object that can fit supernova and host galaxy parameters
given noisy inputs using an XDGMM model, and then predict new
supernovae based on this model and a set of new host galaxies.
Parameters
... | |
# Copyright (c) 2009-2016 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause License.
R""" Deprecated initialization routines.
"""
from hoomd.deprecated import _deprecated;
import hoomd;
import math
import os
from hoomd import _hoomd
def read_xml(... | |
i
for i in range(4):
enemy_piece_id_list[31 + i] = 12 + i
enemy_blue_piece_set = set({})
for index, piece_color in enumerate(enemy_pieces):
if piece_color == 1:
enemy_blue_piece_set.add(enemy_piece_id_list[index])
# enemy_blue_piece_setの値を反転させ、推測の際に扱いやすいように変換する
# (このままでは8~15の値をとるが、0~7の値に修正し扱う必要がある)
rev_enemy... | |
<reponame>cmu-db/cmdbac
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
import logging
import requests
import re
import copy
import traceback
import time
import datetime
import json
from library.models import *
from cmudbac.settings import *
import utils
import extract
import submit... | |
# Important librairies.
from PIL import Image
import glob
import numpy as np
import re
import matplotlib.pyplot as plt
from skimage import measure
import scipy.ndimage
import os
import cv2
import pickle
import copy
from tifffile import imsave
# ----------------------------------------------------------... | |
<reponame>BentleyJOakes/rtamt<gh_stars>0
# Generated from StlParser.g4 by ANTLR 4.5.1
# encoding: utf-8
from __future__ import print_function
from antlr4 import *
from io import StringIO
def serializedATN():
with StringIO() as buf:
buf.write(u"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3")
buf.write(u"H\u00... | |
<filename>data/smal_base.py
"""
Base data loading class.
Should output:
- img: B X 3 X H X W
- kp: B X nKp X 2
- mask: B X H X W
# Silvia - sfm_pose: B X 7 (s, tr, q)
- camera_params: B X 4 (s, tr)
(kp, sfm_pose) correspond to image coordinates in [-1, 1]
"""
from __future__ import absolute_import
from __future... | |
<reponame>gneumann333/jumpscaleX_core<filename>JumpscaleCore/clients/tests/manual/test_ssh_client.py
import unittest
from Jumpscale import j
from random import randint
from testconfig import config
from base_test import BaseTest
from parameterized import parameterized
class SshClient(BaseTest):
addr = config["ssh"][... | |
KiB need to add to Memory pool" %self.alloc_mem)
MemoryPool.instance().increase_memory(self.alloc_mem)
self._cleanup_phantom_devs(paths)
self._cleanupVm()
if ("transient" in self.info["other_config"] and \
bool(self.info["other_config"]["transient"])) or \
("change_home_server" in self.info and \
bool(self.inf... | |
"""
Client
======
"""
from collections import namedtuple, deque
from logging import getLogger
import functools
from blinker import Signal
import tornado.ioloop
import zmq
from zmq.eventloop.zmqstream import ZMQStream
from .common import EndpointType, ProtocolError, MessageType
from .common import make_msg, parse_msg... | |
# This file is part of the Indico plugins.
# Copyright (C) 2020 - 2021 CERN and ENEA
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
from flask import flash, has_request_context, request, session
from ... | |
attacks. The following resource gives a detailed insight on secure coding practices. https://wiki.sei.cmu.edu/confluence/display/seccode/Top+10+Secure+Coding+Practices"],
[39, "Hackers will be able to steal data from the backend and also they can authenticate themselves to the website and can impersonate as any user s... | |
Summary: 批量创建全局参数
"""
UtilClient.validate_model(request)
return deps_models.BatchcreateConfigGlobalResponse().from_map(
self.do_request('1.0', 'antcloud.deps.config.global.batchcreate', 'HTTPS', 'POST', f'/gateway.do', TeaCore.to_map(request), headers, runtime)
)
async def batchcreate_config_global_ex_async(
se... | |
" + fastq + "\n")
os.remove(fastq)
def remap_gsnap_bam(bamfn, threads, fastaref, samtofastq, gsnaprefdir, gsnaprefname, mutid='null', paired=True):
""" call gsnap and samtools to remap .bam
"""
assert os.path.exists(samtofastq)
assert os.path.exists(gsnaprefdir)
assert bamreadcount(bamfn) > 0
sam_out = bamfn... | |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import logging
import math
import os
import sys
import time
import warnings
from benchmark_dataset impor... | |
<filename>configs/tupipa/replay_qemu_mem.py
# Copyright (c) 2015-2016 ARM Limited
# All rights reserved.
#
# modified by <NAME>, 2020-06-19
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to... | |
import bs4 as bs
import os
import os.path
import requests
import base64
import json
from datetime import datetime, timezone
from requests.packages import urllib3
# rrdtool dump test.rrd > test.xml
cfg_name = 'config.json'
db_path = '/home/lcladmin/cmstats/data/'
web_path = '/var/www/html/cmstats/'
def main():
with ... | |
# This file was *autogenerated* from the file sidh_pohlig_hellman.sage
from sage.all_cmdline import * # import sage library
_sage_const_0 = Integer(0); _sage_const_2 = Integer(2); _sage_const_1 = Integer(1); _sage_const_6 = Integer(6); _sage_const_3 = Integer(3); _sage_const_5 = Integer(5); _sage_const_20 = Integer(... | |
<gh_stars>100-1000
from veros.core.operators import numpy as npx
from veros import veros_routine, veros_kernel, KernelOutput
from veros.distributed import global_sum
from veros.variables import allocate
from veros.core import advection, diffusion, isoneutral, density, utilities
from veros.core.operators import update,... | |
<reponame>Eastsouthern/datascope<filename>experiments/scenarios/base.py
import collections.abc
import datetime
import logging
import logging.handlers
import numpy as np
import os
import pandas as pd
import random
import re
import string
import sys
import threading
import time
import traceback
import warnings
import yam... | |
<gh_stars>10-100
#!/usr/bin/env python
'''
Script to change the grid to have different resolutions at different depths.
'''
from constants import *
import numpy as np
def regrid(self):
'''
Called in both firn_density_spin and firn_density_nospin
There are 3 subgrids in the regrid module. Grid 1 is the high reso... | |
3: 3, 'a4': 4, 'a5': 5})
assert r.zrevrangebyscore('a', 4, 2) == ['a4', 3, 'a2']
# slicing with start/num
assert r.zrevrangebyscore('a', 4, 2, start=1, num=2) == \
[3, 'a2']
# withscores
assert r.zrevrangebyscore('a', 4, 2, withscores=True) == \
[('a4', 4.0), (3, 3.0), ('a2', 2.0)]
# custom score function
a... | |
import torch
from torch.nn.parameter import Parameter
import numbers
import numpy as np
from scipy.special import factorial
from . import point_process
from . import distributions as dist
from . import base
class count_model(base._likelihood):
"""
Count likelihood base class.
"""
def __init__(self, tbin, ne... | |
for the
calculation of the current U*A-value. Thus this array is
UA : float, int, np.ndarray
Total heat transfer coefficient in [W/K].
T_inf : float, int, np.ndarray
Ambient temperature in [°C] or [K]. If given as array, it must be a
single cell!
"""
# get outer surface temperature, following WTP Formelsammlung... | |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright (c) 2002-2018 "Neo4j,"
# Neo4j Sweden AB [http://neo4j.com]
#
# This file is part of Neo4j.
#
# 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 L... | |
value"),
input_type="tree",
output_type="tree",
)
def highlighted(channel, _, **kwargs):
"""
Set tree list to highlighted nodes
"""
return "tree", list(self.flat(highlighted=True))
@self.console_command(
"targeted",
help=_("delegate commands to sub-focused value"),
input_type="tree",
output_type="tree",
... | |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more information
## Copyright (C) <NAME> <<EMAIL>>
## This program is published under a GPLv2 license
## Copyright (C) 2014 <NAME> <<EMAIL>>
## OpenFlow is an open standard used in SDN deployments.
## Based on OpenFlow v1.0.1
## Specificatio... | |
By nuking the directory,
# the next test run hopefully passes.
path = error.filename
# Be defensive -- only call rmtree if we're sure we aren't removing anything
# valuable.
if path.startswith(test_temp_dir + '/') and os.path.isdir(path):
shutil.rmtree(path)
raise
assert self.old_cwd is not None and self.tmpdir... | |
# encoding: utf-8
import sys
import math
import itertools
import argparse
import networkx as nx
import logbook
from . import casedata as data
from . import casemaker
from . import similarity as sim
from . import pagerank as pr
from . import termexpand as tex
from . import syntaxscore as stx
def termmap(all_terms, lo... | |
limit, function_name, arg_num=None, arg_name=None):
if(arg_num):
arg = arg_num;
msg = "Constraint Mismatch for argument number \"{}\" in function \"{}\".\n".format(arg, function_name);
if(arg_name):
arg = arg_name;
msg = "Constraint Mismatch for argument name \"{}\" in function \"{}\".\n".format(arg, function_nam... | |
<reponame>pombredanne/plyara-1
#!/usr/bin/env python
# Copyright 2014 <NAME>
# Copyright 2020 plyara Maintainers
#
# 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/lice... | |
no hard links and meets the criteria for ratio limit/seed limit for deletion
del_tor_cont = 0 # counter for the number of torrents that has no hard links and meets the criteria for ratio limit/seed limit for deletion including contents
num_untag = 0 # counter for number of torrents that previously had no hard links b... | |
'''
This file contains method for generating calibration related plots, eg. reliability plots.
References:
[1] <NAME>, <NAME>, <NAME>, and <NAME>. On calibration of modern neural networks.
arXiv preprint arXiv:1706.04599, 2017.
'''
import math
import matplotlib.pyplot as plt
import numpy as np
import os
import math
... | |
from math import exp
import os, sys # string, # noqa: E401
current_location = os.path.dirname(__file__)
#####################################################################################
# get parameter file name, with installed path
def getDreidingParamFile():
datadir = os.path.join(current_location, "..", ".."... | |
try:
self.state = 335
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [SygusParser.T__0, SygusParser.T__11, SygusParser.T__12, SygusParser.INTEGER, SygusParser.BVCONST, SygusParser.REALCONST, SygusParser.SYMBOL]:
self.enterOuterAlt(localctx, 1)
self.state = 331
self.gTerm()
self.state = 332
s... | |
# Version 3.1; <NAME>; Polar Geospatial Center, University of Minnesota; 2018
from __future__ import division
import inspect
import os
import re
import sys
import warnings
from glob import glob
from warnings import warn
if sys.version_info[0] < 3:
from StringIO import StringIO
else:
from io import StringIO
import... | |
<filename>examples/Efficient Cavity Control with SNAP Gates.py
#!/usr/bin/env python
# coding: utf-8
# # Introduction
#
# This tutorial reproduces part of [<NAME> et al. (2020)](https://arxiv.org/abs/2004.14256),
# titled **Efficient cavity control with SNAP gates**. The general
# idea is to start in an initial state ... | |
<gh_stars>0
"""
(B^t F^t Cov^-1 d)^a(z) (D dxi_unl/da D^t B^t F^t Cov^-1 d)_a(z)
Only lib_skys enter this. Sign is correct for pot. estimate, not gradient.
This can written as (D_f (Res lms))(z) (D_f P_a Res lms)(z) * |M_f|(z)
Similarly the mean field can be written as the diagonal
|M_f|(z) (i k_a P D^t B^t Covi B D)... | |
<reponame>lucidworks/solr-scale-tk<gh_stars>10-100
from fabric.api import *
from fabric.exceptions import NetworkError as _NetworkError
from fabric.colors import green as _green, blue as _blue, red as _red, yellow as _yellow
from fabric.contrib.files import append as _fab_append, exists as _fab_exists
from fabric.contr... | |
<reponame>qtl-bodc/COAsT<filename>coast/general_utils.py
from dask import delayed
from dask import array
import xarray as xr
import numpy as np
from dask.distributed import Client
from warnings import warn
import copy
import scipy as sp
from .logging_util import get_slug, debug, info, warn, error
import sklearn.neighbo... | |
<gh_stars>1-10
"""Copyright (c) 2018, <NAME>
2021, <NAME>"""
import warnings
import numpy as np
import pandas as pd
from bites.utils import ipcw
from bites.utils import utils, admin
from bites.utils.concordance import concordance_td
class EvalSurv:
"""Class for evaluating predictions.
Arguments:
surv {pd.DataF... | |
sample in out:
sample.input = tuple(reversed(sample.input))
return out
def sample_inputs_std_var(op_info, device, dtype, requires_grad):
tensor_nd = make_tensor((S, S, S), device=device, dtype=dtype,
low=None, high=None, requires_grad=requires_grad)
tensor_1d = make_tensor((S,), device=device, dtype=dtype,
low=... | |
#En cmd se ejecuta con los siguientes comandos
#py -3.1 "C:\Users\juanz\Google Drive\Semestre 6\Laboratorio Electronica Digital\ProyectoTurnero\Clases.py"
import sys
import time
import serial
import pygame
#--------------------------------------------------------------
#---- Inicia --- ClassTurnosDisponibles... | |
<filename>source/tomopy/util/extern/recon.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# #########################################################################
# Copyright (c) 2015-2019, UChicago Argonne, LLC. All rights reserved. #
# #
# Copyright 2015-2019. UChicago Argonne, LLC. This software was produced #
... | |
start = time.time()
self.mode = mode
self.sampling_mode = sampling_mode
self.negative_size = negative_size
self.max_pos_size = max_pos_size
self.expand_factor = expand_factor
self.cache_refresh_time = cache_refresh_time
self.normalize_embed = normalize_embed
self.test_topk = test_topk
self.node_features = gra... | |
#!/usr/bin/env python
'''
This scripts uses python 3 and the following libraries need to be installed 'pandas', 'ete3' and 'argparse' installed.
The blastn file needs NO modification. As long as blastn format 6 output with options
"query.id", "query.length", "pident", "subject.id", "subject.GBid", "evalue", "bit.sc... | |
dwCookie: The connection cookie previously returned from
System.Runtime.InteropServices.UCOMIConnectionPoint.Advise(System.Object,System.
Int32@).
"""
pass
def __init__(self, *args): #cannot find CLR method
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) init... | |
to the resource (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['namespace', 'name', 'path']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpect... | |
"""Test CZT package.
To run:
pytest test_czt.py -v
To run (with coverage):
pytest --cov . --cov-report html test_czt.py
"""
import numpy as np
import matplotlib.pyplot as plt
import pytest
import scipy
import czt
def test_compare_different_czt_methods(debug=False):
print("Compare different CZT calculation m... | |
<reponame>benjamindeleener/brainhack_sc_detection
#!/usr/bin/env python
# check if needed Python libraries are already installed or not
import os
import getopt
import commands
import math
import sys
import scipy
import scipy.signal
import scipy.fftpack
import pylab as pl
import sct_utils as sct
from sct_nurbs import *... | |
#! /usr/bin/env python
#-*- coding: utf-8 -*-
#from __future__ import print_function
############################################## standard libs
import sys
import os
import time
from datetime import datetime
from copy import deepcopy
from math import degrees, radians, floor, ceil
#####################################... | |
"array"):
raise ValueError('invalid action')
num_existing_items = len(sub_data)
if action_type == 'add':
if 'maxItems' not in sub_schema or num_existing_items < sub_schema["maxItems"]:
sub_data.append(generate_placeholder(sub_schema["items"]))
elif action_type == 'delete':
action_index = int(action_index)
if ('... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.