input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
"""Randomly dilate binary masks.
Args:
keys (Sequence[str]): The images to be resized.
get_binary (bool): If True, according to binary_thr, reset final
output as binary mask. Otherwise, return masks directly.
binary_thr (float): Threshold for obtaining binary mask.
kernel_min (int): Min size of dilation kernel.
... | |
shape
"encoder_output_shape": (8, 8, 5),
# Utilized fourier input features in decoder
"decoder_fourier_input_features": True,
# Type of decoder to be utilized
"decoder": ResidualCBNDecoder,
# Decoder features to be used
"decoder_features": ((320 + 35 + 7 ** 3, 512), (512, 512), (512, 512), (512, 512), (512, 512... | |
= No. of epochs you plan to use (Only relevant if using DEMON)
# step_per_epoch = No. of iterations in an epoch (only relevant if using DEMON)
# weight decay = decorrelated weight decay value
# use_gc = bool to determine whether to use gradient centralization or not.
# use_diffgrad = bool to determine whether to us... | |
import os
import pygame
import pygame_gui
import pytest
from pygame_gui.core.interfaces import IUIManagerInterface
from pygame_gui.core.ui_container import UIContainer
from pygame_gui.elements.ui_selection_list import UISelectionList
from pygame_gui.ui_manager import UIManager
from tests.shared_comparators import comp... | |
whitespace added where necessary.
def yield_table_chunks(text):
if debug['lots']: errprint("Entering yield_table_chunks: [%s]" % text)
# Given a single line or part of a line, and an indication (ATSTART) of
# whether we just saw a beginning-of-line separator, split on within-line
# separators (|| or !!) and remove... | |
rules: list[Any] = [rule.to_v1_primitive() for rule in self.rules] or [None]
annotations = self.annotations.copy()
metadata = {"name": self.name, "annotations": annotations}
spec: dict[str, Any] = {"rules": rules}
primitive: dict[str, Any] = {"metadata": metadata, "spec": spec}
if self.ingress_class:
annotations.... | |
<gh_stars>1-10
"""
mbed SDK
Copyright (c) 2011-2013 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 agr... | |
import numpy as np
from configparser import ConfigParser
from astropy import units as u
DEFAULT_INI = '../set/set_experiment.ini'
def is_number(string):
try:
float(string)
return True
except ValueError:
return False
except TypeError:
return False
def choice_yn(string, default_choice=None):
if string.lower(... | |
= Constraint(expr= m.x689 >= 0)
m.c543 = Constraint(expr= m.x690 >= 0)
m.c544 = Constraint(expr= m.x691 >= 0)
m.c545 = Constraint(expr= m.x692 >= 0)
m.c546 = Constraint(expr= m.x693 >= 0)
m.c547 = Constraint(expr= m.x694 >= 0)
m.c548 = Constraint(expr= m.x695 >= 0)
m.c549 = Constraint(expr= m.x696 >= 0)
m.c550 ... | |
<filename>ba/eval.py
import ba.utils
from functools import lru_cache as cache
import ba.plt
import copy
from matplotlib import pyplot as plt
import numpy as np
import skimage.transform as tf
from scipy.ndimage import distance_transform_cdt
from scipy.misc import imread
from tqdm import tqdm
def extract_mean_evals(ite... | |
<reponame>beta-nu-theta-chi/ox-dashboard
import datetime
import os
import django.utils.timezone
from django.contrib.auth.models import User
from django.core.validators import RegexValidator
from django.db import models
from django.db.models import Q
from django.urls import reverse
from django.utils.translation import ... | |
'''
High level geo file image access
Base GeoImage class is a wrapper around gdal providing easy access to
image metadata, file read/write, and i/o. Higher level classes (such
as DGImage) can build on this class to provide data specific metadata and
spectral transformations.
'''
from __future__ import division
from ... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from keras.layers import Input, Concatenate, Lambda
from keras.layers import Layer
from keras.models import Model
import numpy as np
import tensorflow as tf
# Custom trainable layer with scalar variable
class Scalar(Layer):
def __init__(self, output_dim=1, name='unkno... | |
# -*- test-case-name: mqtt.client.test.test_base -*-
# ----------------------------------------------------------------------
# Original Copyright (C) 2012 by <NAME>
# Modifications and redesign by <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated... | |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Abstract interface for parallel execution of multiple jobs.
The main class is `ScatterGather`, which can submit many instances
of a job with different configurations.
"""
from __future__ import absolute_import, division, print_function
import sys
imp... | |
request, station_id, *args, **kwargs):
""" Handle the POST message and update the database """
super(ReturnToEarth, self).post(request, *args, **kwargs)
# Get input parameters from URL and/or POST data
m,response = self.validateJSONFields(request, ("reg_code","message",))
if m is None:
return response
team, re... | |
from typing import List
from src.settings import (TeacherKey, ClassRoomKey,
CoursesKey, LessonTtKey,
DaysKey, TermsKey,
YearKey, GroupKEY
)
from src.utils import get_sup_dict
# timetable groups
# timetable teachers
# time table rooms
# freerooms_tp
# freerooms_salle
# freerooms_control
# available_teachers
# bl... | |
# Copyright 2011 <NAME>
# Copyright 2012 <NAME>
#
# This file is part of POX.
#
# POX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | |
<reponame>Bachibouzouk/epa
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Row, Column, Field, Fieldset, ButtonHolder
from django import forms
from django.forms import ModelForm
from django.core.valida... | |
Grey":0x696969,
"Diminished Blue":0xbce1eb,
"Diminished Brown":0xe7ded7,
"Diminished Green":0xe3e6d6,
"Diminished Lime":0xedf5dd,
"Diminished Mint":0xe9f3dd,
"Diminished Orange":0xfae9e1,
"Diminished Pink":0xf1e5e0,
"Diminished Red":0xe8d8da,
"Diminished Sky":0xd3f2ed,
"Diminishing Green":0x062e03,
"Diminutive Pink":0x... | |
#-------------------CONRETE---------------#
from EtherCost import tools
import networkx as nx
import matplotlib.pyplot as plt
from networkx.drawing.nx_agraph import write_dot
import _pickle as pickle
import json
target = [] #source file split by lines
translation = [] #list of program opcodes replaced by Souper IR opc... | |
<reponame>sh0nk/simple-db-migrate
#-*- coding:utf-8 -*-
import unittest
import sys
import simple_db_migrate.core
from mock import patch, Mock, MagicMock, call, sentinel
from simple_db_migrate.oracle import Oracle
from tests import BaseTest
class OracleTest(BaseTest):
def setUp(self):
super(OracleTest, self).setUp()... | |
in matrices:
operators_id += [O.id for O in M.operators]
operators_id = list(_np.unique(_np.asarray(operators_id)))
operators = [self.com.operators[id] for id in operators_id]
list_grids_id_o = [self.com.spaces[O.space.id].grids.id for O in operators]
list_grids_id_f = [self.com.spaces[F.space.id].grids.id for F ... | |
assert latex(A * B) == r'\hat{A}^{(q_{1})} \hat{B}^{(q_{1})}'
assert latex(A * C) == r'\hat{A}^{(q_{1})} \hat{C}^{(q_{2})}'
assert latex(2 * A) == r'2 \hat{A}^{(q_{1})}'
assert latex(2j * A) == r'2i \hat{A}^{(q_{1})}'
assert latex((1+2j) * A) == r'(1+2i) \hat{A}^{(q_{1})}'
assert latex(gamma**2 * A) == r'\gamma^{2... | |
the
terminal (see :class:`~humanfriendly.terminal.spinners.Spinner`),
:data:`False` to skip the interactive spinner or
:data:`None` to detect whether we're connected to an
interactive terminal.
:returns: A list of :class:`PackageFile` objects.
This works by parsing and resolving the dependencies of the given pac... | |
<reponame>pabloduque0/cnn_deconv_viz
import numpy as np
import cv2
from keras.models import Model, Sequential
from keras.layers import Input, Dense, Reshape, Flatten
from keras.layers.convolutional import Convolution2D, Conv2DTranspose
from keras.layers.normalization import BatchNormalization
from keras.layers.advance... | |
# -*- coding: utf-8 -*-
"""Objects."""
from functools import wraps
try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc # type: ignore
from ._applications import Action
from ._bases import MISSING
from ._constants import BASE_STRING_TYPES
from ._data import DataR... | |
= mx.symbol.Activation(name='res4b4_relu', data=res4b4, act_type='relu')
res4b5_branch2a = mx.symbol.Convolution(name='res4b5_branch2a', data=res4b4_relu, num_filter=256, pad=(0, 0),
kernel=(1, 1), stride=(1, 1), no_bias=True)
bn4b5_branch2a = mx.symbol.BatchNorm(name='bn4b5_branch2a', data=res4b5_branch2a, use_glob... | |
#
# Copyright 2021 Mobvista
#
# 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, softw... | |
<reponame>mike0615/curie<gh_stars>1-10
#
# Copyright (c) 2017 Nutanix Inc. All rights reserved.
#
import cPickle as pickle
import errno
import json
import logging
import os
import shutil
import threading
import time
import warnings
from collections import OrderedDict
from enum import Enum
from pkg_resources import res... | |
# Starts off assuming all submodels form independent blocks. We will merge from there.
#block_list = set([(frozenset(deps),frozenset([i])) for i,deps in enumerate(self.submodel_deps)])
block_list = set([Block(deps,[i]) for i,deps in enumerate(self.submodel_deps)])
no_merge_occurred = False
while not no_merge_occurr... | |
<filename>build_beta.py
#!/usr/bin/env python
"""
This script is part of TeX Live Utility. Various paths are hardcoded near
the top, along with other paths that are dependent on those.
Running build_beta.py does the following:
1) bump the version in Info.plist by 0.1 if it is not a beta, and appends b1;
otherwise, ... | |
call_args = call_args_list[1].args
assert call_args == (member.id,
{MemberKey.VER_STATE: State.AWAIT_APPROVAL})
# Ensure no side effects occurred.
member.add_roles.assert_not_called()
db.set_member_data.assert_not_called()
@pytest.mark.asyncio
async def test_proc_exec_approve_standard():
"""Exec approving verif... | |
chooses coinbase
log.info("fillMenu() filling with %s accounts: %s", len(accounts), accounts)
mainbutton = TwoLineListItem(
text='Coinbase (click to change)',
secondary_text='Select Account' if self.coinbase == '' else self.coinbase,
font_style='Subtitle2',
secondary_font_style='Subtitle1'
)
def doit(y):
seta... | |
<filename>datmo/core/controller/environment/driver/dockerenv.py
import ast
import os
import json
import subprocess
import platform
from io import open
try:
to_unicode = unicode
except NameError:
to_unicode = str
try:
def to_bytes(val):
return bytes(val)
to_bytes("test")
except TypeError:
def to_bytes(val):
re... | |
Constraint(expr=m.x13*m.x2513 + m.x638*m.x2519 + m.x1263*m.x2525 + m.x1888*m.x2531 <= 8)
m.c657 = Constraint(expr=m.x14*m.x2513 + m.x639*m.x2519 + m.x1264*m.x2525 + m.x1889*m.x2531 <= 8)
m.c658 = Constraint(expr=m.x15*m.x2513 + m.x640*m.x2519 + m.x1265*m.x2525 + m.x1890*m.x2531 <= 8)
m.c659 = Constraint(expr=m.x16*m... | |
(u, v)
# using a string IDs + dictionary for quick
# tracking of pos/norm/uv combo's that we've seen.
comp_str = '{},{},{}:{},{},{}:{},{}'.format(pos[0], pos[1], pos[2], norm[0], norm[1], norm[2], uv[0], uv[1])
if not positions[ids[x]]:
positions[ids[x]] = pos
normals[ids[x]] = norm
uvs[ids[x]] = uv
tracker[co... | |
# -*- coding: utf-8 -*-
IPMI_FRU_SAMPLE = """\
FRU Device Description : Builtin FRU Device (ID 0)
Product Manufacturer : Oracle Corporation
Product Name : ILOM INTEGRATED SP
Product Serial : 00:11:22:33:44:55
FRU Device Description : /SYS (ID 3)
Board Mfg Date : Mon Jan 1 00:00:00 1996
Board Product : ASSY,MOTHE... | |
= len(t338)
t340 = t338 != self.get_ex_3()
t341 = t338 > self.get_ex_3()
t342 = iter(t338)
assert self.cond_2(t342, t338), "Failed postcondition: 'CommonSet.equalset(<returned value>, x)'"
t343 = t338 == self.get_ex_3()
t344 = t338 <= self.get_ex_3()
t345 = t338 >= self.get_ex_3()
t346 = t338
t346 &= [1]
asse... | |
= new_prefix
def cook_row(self, row, header, method):
cooked_vals = []
if not self.cook_function.get(method):
return row
if len(row) != len(header):
logger.error('Unable to cook row with non-matching number of header and value columns: ' +
'row {0} header {1}'.format(row, header))
cook_fn = self.cook_function[... | |
boxes
for each image. Element i has shape (Ri, K * B) or (Ri, B), where Ri is
the number of predicted objects for image i and B is the box dimension (4 or 5)
"""
return self._predict_boxes().split(self.num_preds_per_image, dim=0)
def predict_boxes_for_gt_classes(self):
"""
Returns:
list[Tensor]: A list of Tens... | |
<filename>src/redhat_support_tool/helpers/common.py
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Red Hat, 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/lic... | |
import json
import math
import sys
import time
from PIL import ImageGrab
from PyQt5 import QtGui, QtCore
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import QApplication, QVBoxLayout, QPushButton, QDoubleSpinBox, \
QLabel, QFileDialog, QAbstractItemView, QTreeView, QListView, QDialog, QCh... | |
= median(array(ccc)) * 0.288
else:
fwhmgessime = 9999
ellgess3 = median(array(ell3))
else:
fwhmgess3 = 9999
fwhmgessime = 9999
ellgess3 = 9999
if _instrume == 'efosc':
mbkg3 = median(bkg3)
ntt.util.updateheader(
img, 0, {'MBKG': [mbkg3, 'background level']})
else:
mbkg3 = readkey3(hdr, 'MBKG')
if fwhmgess... | |
<filename>context_free_grammars.py<gh_stars>0
class CFG:
def __init__(self, rules):
if len(rules) == 0:
raise NoStatic_RulesError
self.tokens = set()
self.rules = set(rules)
start_variable = rules[0].lhs
self.start_token = Token(name = "<start>", cfg = self)
self.rules.add( Static_Rule(self.start_token... | |
import random
import os
import time
import sys
from PIL import Image
import numpy as np
import pandas as pd
import scipy
from sklearn import datasets, linear_model, preprocessing, model_selection
from sklearn.metrics import mean_squared_error, r2_score, roc_curve, auc
from scipy.interpolate import interp1d
from multip... | |
<filename>shabanipy/jj/plotting_general.py
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2020 by ShabaniPy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the MIT license.
#
# The full license is in the file LICENCE, distrib... | |
Any]:
"""
Prepare masked tokens inputs/labels for masked language modeling: 80% MASK, 10% random, 10% original.
"""
import numpy as np
labels = np.copy(inputs)
# We sample a few tokens in each sequence for MLM training (with probability `self.mlm_probability`)
probability_matrix = np.full(labels.shape, self.mlm... | |
<reponame>LonelyFantasy/Chiyuki-Bot
import math
from collections import defaultdict
from typing import List, Dict, Any
from nonebot import on_command, on_message, on_notice, on_regex, get_driver
from nonebot.log import logger
from nonebot.permission import Permission
from nonebot.typing import T_State
from nonebot.ada... | |
<reponame>jacorbal/minml
#!/usr/bin/env python3
# vim: set ft=python fenc=utf-8 tw=72:
# MINML :: Minimal machine learning algorithms
# Copyright (c) 2019-2020, <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# “Software... | |
if is_fp:
is_positive_test = True
else:
is_positive_test = False
# push test result with delay to the event queue
if t + self.test_reporting_lag < self.max_time:
self.queue.push(
(t + self.test_reporting_lag, 'test', i, None, None,
TestResult(is_positive_test=is_positive_test,
trigger_tracing_if_positive=tri... | |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the te... | |
<reponame>CospanDesign/nysa
# Copyright (c) 2013 <NAME> (<EMAIL>)
#
# This file is part of Nysa.
#
# (http://wiki.cospandesign.com/index.php?title=Nysa.org)
#
# Nysa is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundat... | |
= None, self._offset + 2
if max1 <= self._input_size:
chunk1 = self._input[self._offset:max1]
if chunk1 == '!=':
address0 = self._actions.two_sided_operator(self._input, self._offset, self._offset + 2, [])
self._offset = self._offset + 2
else:
address0 = FAILURE
if self._offset > self._failure:
self._failure =... | |
True.
Returns
-------
out : ndarray
Array of `fill_value` with the same shape and type as `a`.
See Also
--------
zeros_like : Return an array of zeros with shape and type of input.
ones_like : Return an array of ones with shape and type of input.
empty_like : Return an empty array with shape and type of inpu... | |
by another change of variable ->try to improve that
#check if the third level if free
try:
mother1=block.out_part[0].mother
mother2=mother1.mother
if self.how_gen[mother2].chgt_var not in ['','0','1','2','D']:
return
except:
return
#PASS ALL CONDITION
#so pass block A->B
blockA=self.how_gen[mother1]
#chan... | |
<filename>Blender/appdata_common/Blender Foundation/Blender/BLENDER_VERSION/scripts/addons/DTB/DtbShapeKeys.py
import os
import sys
import math
import json
import bpy
from . import Util
from . import Versions
from . import DataBase
from . import Global
sys.path.append(os.path.dirname(__file__))
class DtbShapeKeys:
... | |
var_list[0].name = 'time'
var_list[1].name = 'spkir_abj_cspp_downwelling_vector'
var_list[2].name = 'int_ctd_pressure'
var_list[0].data = np.array([])
var_list[1].data = np.array([])
var_list[2].data = np.array([])
var_list[0].units = 'seconds since 1900-01-01'
var_list[1].units = 'uW cm-2 nm-1'
var_lis... | |
<reponame>mdavid/nuxleus<filename>linux-distro/package/nuxleus/Source/Vendor/Microsoft/IronPython-2.0.1/Lib/headstock/example/microblog/microblog/jabber/client.py
# -*- coding: utf-8 -*-
"""
This module is a simple XMPP chat client demonstrating the use of headstock.
Many Kamaelia components are created to manage diffe... | |
# encoding: utf-8
# module Wms.RemotingObjects.Purchase calls itself Purchase
# from Wms.RemotingObjects,Version=1.23.1.0,Culture=neutral,PublicKeyToken=null
# by generator 1.145
# no doc
# no important
from __init__ import *
# no functions
# classes
class DtoErrorDetails(object):
""" DtoErrorDetails() "... | |
for key in results:
if key not in stdResults.keys() and results[key][0] == "Normal":
message += "\t" + key + "\n"
stdResults[key] = results[key]
with open(AUTOMATIONDIR + GOLDSTANDARDS, "w") as ldata:
ldata.write("stdResults = " + str(stdResults).replace("], ", "],\n ") + "\n\n")
# Commit changes and push t... | |
<filename>pydart/apps/turtle/example_turtle_torque.py
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
import pydart
import controller
import gl_render
import numpy as np
import math
import basics
import deepRL
import nn
import environment as env
import tensorflow as tf
import mmMath
import pi... | |
(hd.sharkdata['mgas_bulge'] + hd.sharkdata['mgas_disk'] +
hd.sharkdata['mstars_bulge'] + hd.sharkdata['mstars_disk'])
#shark halo ids and fix shark id issues of old version
shark_haloes_match = hd.sharkdata['id_subhalo_tree']
if old_shark_version:
replace = np.where(shark_haloes_match > (hd.snapshot+1)*hd... | |
<gh_stars>10-100
#!/usr/bin/env python
#
# Copyright 2020 Xilinx 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 app... | |
<gh_stars>1-10
from collections import namedtuple
import os.path
import numpy as np
import scipy.io
import common.time as time
from sklearn import cross_validation, preprocessing
from sklearn.metrics import roc_curve, auc
TaskCore = namedtuple('TaskCore', ['cached_data_loader', 'data_dir', 'target', 'pipeline', 'class... | |
"""
repo.py contains code to control the local cache for umpire. It is not a module.
"""
#TODO: Add support for tbz/tar.bz
import os, shutil, time, traceback
import configparser
import maestro.tools.path
import maestro.tools.file
import maestro.core.module
from . import unpack
from maestro.tools.os_tools import check_... | |
from Queue import Empty, Queue
import collections
import ipaddress
import netifaces
import pwd
import signal
import socket
from subprocess import Popen
from threading import Thread
################################################################################
#### String utils
def newline( *args ):
class SingleLin... | |
0 24 51
1 1 2 0 24 42
1 1 2 0 24 33
1 1 2 0 24 15
1 1 2 0 23 77
1 1 2 0 23 68
1 1 2 0 23 59
1 1 2 0 23 50
1 1 2 0 23 41
1 1 2 0 23 32
1 1 2 0 23 14
1 1 2 0 22 76
1 1 2 0 22 67
1 1 2 0 22 58
1 1 2 0 22 49
1 1 2 0 22 40
1 1 2 0 22 31
1 1 2 0 22 13
1 1 2 0 21 75
1 1 2 0 21 66
1 1 2 0 21 57
1 1 2 0 21 48
1 1 2 0 21 39
1 1 ... | |
from __future__ import unicode_literals
from __future__ import division
from past.utils import old_div
from builtins import object
import six
from datetime import timedelta
from numbers import Number
from .exceptions import CaptionReadError, CaptionReadTimingError
# `und` a special identifier for an undetermined lang... | |
# encoding: utf-8
from nose.tools import (
set_trace,
eq_,
assert_raises,
assert_raises_regexp,
)
from datetime import datetime, timedelta
import json
import os
import pkgutil
import random
from . import (
DatabaseTest,
sample_data
)
from core.metadata_layer import (
ReplacementPolicy,
TimestampData,
)
from ... | |
E501
ResolveHosts adds vulnerability data for the given host # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.api_v1_hosts_evaluate_post_with_http_info(async_req=True)
>>> result = thread.get()
:param api_res... | |
** y)
return op(x, y)
_ARITHMETIC_AND_BITWISE_OPS = _ARITHMETIC_OPS.union(_BITWISE_OPS)
_ARITHMETIC_AND_COMPARISON_OPS = _ARITHMETIC_OPS.union(_COMPARISON_OPS)
_ALL_OPS = _ARITHMETIC_AND_COMPARISON_OPS.union(_BITWISE_OPS)
def setup_binops():
# We check NaN and infitity immediately; not all
# symbolic floats sup... | |
from common.dp_encryption.base import BaseDataPathEncryption
from builtins import range
from tcutils.wrappers import preposttest_wrapper
from common.firewall.base import BaseFirewallTest
from tcutils.util import get_an_ip
from port_fixture import PortFixture
from vn_test import VNFixture
from tcutils.tcpdump_utils impo... | |
'w', # \N{MATHEMATICAL BOLD FRAKTUR SMALL W}
0x1d5d0: 'w', # \N{MATHEMATICAL SANS-SERIF SMALL W}
0x1d604: 'w', # \N{MATHEMATICAL SANS-SERIF BOLD SMALL W}
0x1d638: 'w', # \N{MATHEMATICAL SANS-SERIF ITALIC SMALL W}
0x1d66c: 'w', # \N{MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL W}
0x1d6a0: 'w', # \N{MATHEMATICAL MONOSP... | |
<reponame>politbuero-kampagnen/onegov-cloud
import mimetypes
import shutil
import os
from collections import OrderedDict
from onegov.core.csv import convert_list_of_dicts_to_csv
from onegov.core.csv import convert_list_of_dicts_to_xlsx
from onegov.core.csv import convert_excel_to_csv
from onegov.core.csv import CSVFil... | |
overloading for setting the L{callback<AbstractToken.callback>} of a token whose initializer you do not call directly, such as the result of combining tokens with L{+<__add__>} or L{|<__or__>}.
@param callback: An L{AbstractToken}-compatible callback.
@type callback: callable
@return: A copy of C{self} with the L{... | |
# ===============================================================================
# Copyright 2012 <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/LI... | |
of W matrix (creates two matrices if not None)
uRank = rank of U matrix (creates two matrices if not None)
wSparsity = intended sparsity of W matrix(ces)
uSparsity = intended sparsity of U matrix(ces)
Warning:
The Cell will not automatically sparsify.
The user must invoke .sparsify to hard threshold.
alphaInit... | |
<filename>moonworm/crawler/log_scanner.py<gh_stars>1-10
# Used example scanner from web3 documentation : https://web3py.readthedocs.io/en/stable/examples.html#eth-getlogs-limitations
import datetime
import json
import logging
import time
from typing import Any, Callable, Iterable, List, Optional, Tuple
from eth_abi.co... | |
0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0],
[0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1],
[0... | |
<reponame>OscarEngelbrektson/SyntheticControl<filename>SyntheticControlMethods/optimize.py
# 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... | |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class NodeSpec:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in defi... | |
than the number of "
"classifiers (%d)" % (max_classfiers, len(self.classifiers)))
if num_samples is None and num_batches is None:
sample_count = 1
elif num_samples is None and num_batches is not None:
sample_count = num_batches * self.num_batches
elif num_samples is not None and num_batches is None:
sample_cou... | |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import datetime, re
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.shortcuts import render
from modelcluster.fields import ParentalKey
from wagtail.core.mode... | |
from functools import partial
from . import utils
import numpy as np
import jax.numpy as jnp
import jax.random as random
from jax import grad, jit, vmap, lax, jacrev, jacfwd, jvp, vjp, hessian
#class Lattice(seed, cell_params, sim_params,
def random_c0(subkeys, odds_c, n):
"""Make random initial conditions give... | |
n_cursors)
if self.multicursor is None:
raise TrailDBError("Failed to allocate memory for multicursor")
self.reset()
# mapping of the traildb pointer to the TrailDB object
# we need this to get the configured traildb in python since we get a pointer to the tdb from the multi event
self._traildbs = {tdb._db: tdb ... | |
"""
Copyright 2012-2019 <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 applicable law or agreed to in writing, software
distr... | |
+= [bt['sponge']]
else:
facetFlags += [bt['x-']]
elif vertices[s[0]][0] == vertices[s[1]][0] == x0-x_n and x_n > 0:
volumes[self.regionIndice['x-']][0] += [len(facetFlags)]
facetFlags += [bt['x-']]
elif vertices[s[0]][0] == vertices[s[1]][0] == x1:
if y_n > 0 and (vertices[s[0]][1] == y0-y_n or vertices[s[1]][1]... | |
<gh_stars>10-100
# <Copyright 2022, Argo AI, LLC. Released under the MIT license.>
"""Unit tests for PinholeCamera model."""
from pathlib import Path
from typing import Tuple
import numpy as np
import pytest
from av2.datasets.sensor.constants import RingCameras
from av2.geometry.camera.pinhole_camera import Intrins... | |
transition to the next stage (outbound).
"""
pass
def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):
"""
Generate a presigned url given a client, its method, and arguments
:type ClientMethod: string
:param ClientMethod: The client method to presign for
:type Param... | |
<reponame>Geode-solutions/OpenGeode
# -*- coding: utf-8 -*-
# Copyright (c) 2019 - 2021 Geode-solutions
#
# 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 withou... | |
<reponame>DNPLab/DNPLab
from warnings import warn
from . import return_data, dnpdata, dnpdata_collection
from . import dnpMath, dnpNMR
import numpy as np
import scipy.integrate
from scipy.special import wofz
from .mrProperties import gmrProperties, radicalProperties
def baseline(
all_data,
dim="f2",
type="polyno... | |
<reponame>SEDSCelestiaBPGC/quantum-algorithms
import qiskit
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import Aer, execute
from qiskit.quantum_info.operators import Operator
from qiskit.extensions import UnitaryGate, Initialize
from qiskit import IBMQ
import math
backend ... | |
<reponame>JonathanGailliez/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by M... | |
<reponame>nzagorsky/django-autofixture
# -*- coding: utf-8 -*-
import datetime
import uuid
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
try:
from django.utils import lorem_ipsum
except ImportError:
# Support Django < 1.8
from django.contrib.webdesign import lor... | |
value_prev ) and (
value <= value_next): # local min
max_min_list.append(value)
max_min_d_list.append(d)
return max_min_d_list,max_min_list
def get_c_star_list(f_array=None,
zero_index_a=0,zero_index_b=1,zero_index_c=2):
c_star_list=[]
for value,(indices,d) in zip(f_array.data(),
f_array.d_spacings()):
if ind... | |
<filename>crispr_cas9/count_indels.py
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 20 17:02:21 2018
@author: babin
"""
""" run_count_indels.py
this script count exact number of indels in "fasta" file
and writes results into the excel spreadsheet.
it takes 'fasta' file imported from Geneious as an input
'fasta' file m... | |
<gh_stars>1-10
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests exercising chromiumsync and SyncDataModel."""
import pickle
import unittest
import autofill_specifics_pb2... | |
"""Undocumented Module"""
__all__ = ['enumerate', 'unique', 'indent', 'nonRepeatingRandomList',
'writeFsmTree', 'StackTrace', 'traceFunctionCall', 'traceParentCall',
'printThisCall', 'tron', 'trace', 'troff', 'getClassLineage', 'pdir',
'_pdir', '_is_variadic', '_has_keywordargs', '_varnames', '_getcode',
'Signature',... | |
= 'deleted'
class CarrierGatewayIdSet(BaseModel):
__root__: list[CarrierGatewayId]
class CarrierGatewayMaxResults(BaseModel):
__root__: conint(ge=5, le=1000)
class CertificateAuthentication(BaseModel):
ClientRootCertificateChain: Optional[String] = None
class CertificateAuthenticationRequest(BaseModel):
Cli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.