input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
"""
nuplandb models, schema version: 3.0, code generated by schema_gen.py.
DO NOT MODIFY THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
"""
from __future__ import annotations # postpone evaluation of annotations
import bisect
import logging
import os.path as osp
from typing import Any, BinaryIO, Dict, List, NamedTuple,... | |
= np.percentile(returns, percentile)
return float(returns[returns <= cutoff].mean())
def expected_return(self, w: Array, rebalance: bool):
r"""
Calculates the annualized expected return given a weight vector
The expected annualized returns is given by
.. math::
\mu_R = \frac{1}{N} \sum^N_i {r_i^{1/y} - 1}
... | |
<gh_stars>1000+
"""
front_end.py: Lexer and parser for the ASDL schema language.
"""
from __future__ import print_function
import re
from asdl import asdl_ as asdl
from asdl.asdl_ import (
Use, Module, TypeDecl, Constructor, Field, Sum, SimpleSum, Product, TypeExpr
)
from core.pyerror import log
_ = log
_KEYWORDS ... | |
return self["Temperature 10"]
@temperature_10.setter
def temperature_10(self, value=None):
"""Corresponds to IDD field `Temperature 10`"""
self["Temperature 10"] = value
@property
def thermal_conductivity_10(self):
"""field `Thermal Conductivity 10`
| for Temperature-Thermal Conductivity function correspondi... | |
# --------------------------------------------------------------------------
# Source file provided under Apache License, Version 2.0, January 2004,
# http://www.apache.org/licenses/
# (c) Copyright IBM Corp. 2017, 2018
# --------------------------------------------------------------------------
# Author: <NAME>, IBM A... | |
e:
print str(k) + "-th attempt to hit enter unsuccessful."
self.close_browser()
raise
time.sleep(1)
is_visible = self.check_visibility_by_id(element_to_disappear_id)
k = k + 1
try:
is_visible
except Exception, e:
print "ERROR: click_by_id_resilient on element by id={0} has failed.".format(element_id)
self.cl... | |
<filename>midpoint.py
#!/usr/bin/python
# --------------------------------------------------------------------
# midpoint.py
# --------------------------------------------------------------------
"""
Find a midpoint of two political districting plans by
building and solving a MIP (mixed-integer (linear) program).
"""... | |
<gh_stars>0
"""UI views for the samplesheets app"""
import datetime
import io
import json
import logging
import os
import pytz
import requests
import zipfile
from cubi_tk.isa_tpl import _TEMPLATES as TK_TEMPLATES
from packaging import version
from django.conf import settings
from django.contrib import messages
from ... | |
<filename>sdk/python/pulumi_gcp/iam/workload_identity_pool_provider.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing ... | |
<gh_stars>10-100
#!/usr/bin/env python
# Copyright 2016 DIANA-HEP
#
# 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 applic... | |
<gh_stars>0
import pdb
import numpy as np
import time
genres = ['Western', 'Comedy', 'Children', 'Crime', 'Musical', 'Adventure', 'Drama', 'Horror', 'War', 'Documentary', 'Romance', 'Animation', 'Film-Noir', 'Sci-Fi', 'Mystery', 'Fantasy', 'IMAX', 'Action', 'Thriller']
# Data is a list of (i, j, r) triples
ratings_sm... | |
from __future__ import annotations
import ast
import asyncio
import itertools
import weakref
from collections import OrderedDict
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import (
Any,
AsyncIterator,
Callable,
Dict,
Iterable,
List,
NamedTuple,
Optional,... | |
import csv
# import json
import logging
import sys
import zipfile
import bson
import dictquery as dq
import orjson
# from xmlr import xmliter
from ..utils import get_file_type, get_option, write_items, get_dict_value, strip_dict_fields, dict_generator
LINEEND = u'\n'.encode('utf8')
class Selector:
def __init__(se... | |
[..., -k_s2_yx, k_s2_yy,...]
eqs_m[1, id1 * 2:id1 * 2 + 2] = k[sec1][2], -k[sec1][3] # [..., k_s1_xx, -k_s1_xy,...]
eqs_m[1, id2 * 2:id2 * 2 + 2] = -k[sec2][2], k[sec2][3] # [..., -k_s2_xx, k_s2_xy,...]
# grouping force in x-direction:
sec_grouping(sec1, sec2, group_x, comb=True)
# grouping force in y-direction:
... | |
ymat[0, 0] = np.cos(yrot)
ymat[0, 2] = np.sin(yrot)
ymat[2, 0] = -np.sin(yrot)
ymat[2, 2] = np.cos(yrot)
zmat[0, 0] = np.cos(zrot)
zmat[0, 1] = -np.sin(zrot)
zmat[1, 0] = np.sin(zrot)
zmat[1, 1] = np.cos(zrot)
return concat(zmat, ymat, xmat)
def axisBounds(shape,
xform,
axes=None,
origin='centre',
bound... | |
go.Figure(data=[trace0, trace1, trace2, trace3], layout=layout)
st.plotly_chart(fig)
elif (company_or_country == 'Companies'):
antonym_pair = st.sidebar.selectbox("Select the Antonymn pair", Antonym_list)
antonym_pair = str(antonym_pair.replace(" ", "_"))
gnews_url = "https://docs.google.com/spreadsheets/d/1co... | |
<gh_stars>0
#!/usr/bin/env python3
#
# Tests Prior functions in Pints
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
from __future__ import division
import unittest
i... | |
to estimate the time of arrival.
Uses a sampled average of the speed based on the 10 last updates.
Very convenient for resuming the progress halfway.
'''
def __init__(self, **kwargs):
ETA.__init__(self, **kwargs)
SamplesMixin.__init__(self, **kwargs)
def __call__(self, progress, data):
elapsed, value = Sampl... | |
" + str(actor_matrix))
print("")
print("informant_vector: " + str(informant_vector))
counter += 1
return actor_matrix, critic_vector, informant_vector
def main():
tot_iterations = 25
judgment_list = list()
endorse_list = list()
for _ in range(tot_iterations):
#- Building the CRITIC
#The critic is a vecto... | |
<filename>scripts/cnn_polycrystals_GPU.py
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 25 16:02:51 2018
@author: leitherer
"""
import matplotlib
matplotlib.use('Agg') # This way do not show plot windows when compute SOAP and FT-SOAP
import matplotlib.pyplot as plt
import os.path
import numpy as np
from argparse... | |
<filename>src/ts_ARGweaver.py
#!/usr/bin/env python3
"""
Various functions to convert a ts file to ARGweaver input format,
and from .arg files to tree seq input.
When run as a script, takes an msprime simulation in .trees format, saves to
ARGweaver input format (haplotype sequences), runs ARGweaver inference on it to
... | |
"""===========================
Pipeline trna
===========================
Overview
========
This pipeline was developed to accurately map small RNA sequencing data and then perform
accurate mapping of tRNA reads and qualitatively analyse the resulting data. trnanalysis
has an emphasis on profiling nuclear and mitochon... | |
"""
Manage communications between the PC and the device.
Requirements:
* pyserial
* continuous_threading
"""
import sys
import time
import serial
import functools
import contextlib
import continuous_threading
from pybk8500.parser import Parser
__all__ = ['CommunicationManager', 'send_msg', 'main']
def pop_messa... | |
= T("Data"),
comment = DIV(_class="tooltip",
_title="%s|%s|%s" % (T("Data"),
T("Optional. The name of an element whose contents should be put into Popups."),
T("If it is a URL leading to HTML, then this will downloaded."))),
),
Field("image",
label = T("Image"),
comment = DIV(_class="tooltip",
_title="%s|%s" %... | |
<filename>dali/test/python/test_dali_variable_batch_size.py
# Copyright (c) 2020, NVIDIA CORPORATION. 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.apach... | |
<gh_stars>0
import abc
from copy import copy
import numpy as np
from data_functions import *
class Condition(object):
"""Class representing a rule condition"""
def __init__(self, attribute):
"""Constructor"""
self._attribute = attribute
@abc.abstractmethod
def __eq__(self, other):
"""Equality check"""
... | |
# -*- coding: utf-8 -*-
import copy
import logging
import os
import re
import shutil
from subprocess import PIPE
from subprocess import Popen
from subprocess import STDOUT
from . import maven_utils
from . import web_utils
from pnc_cli.tools.maven_utils import MavenArtifact
git_version = None
scm_status_cache = {}
... | |
import numpy as np
import pandas as pd
import xarray as xr
import Grid
import pf_dynamic_sph
from scipy.io import savemat, loadmat
import os
from timeit import default_timer as timer
import sys
from copy import deepcopy
if __name__ == "__main__":
start = timer()
# ---- INITIALIZE GRIDS ----
(Lx, Ly, Lz) = (20, 2... | |
<filename>src/fotokilof.py
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long
# pylint: disable=invalid-name
# pylint: disable=bare-except
"""
Copyright (c) 2019-2020 <NAME>, TeaM-TL
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (... | |
#!/usr/bin/env python3
####################################################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
#############################################... | |
"bar": StructuredTensor.from_pyval(
[[{"x": 12}], [{"x": 13}, {"x": 14}]]),
},
"expected_shape": [2], # inferred from field values.
},
# Matrix (rank=2) StructuredTensors.
{
"testcase_name": "Rank2_WithNoFields",
"shape": [2, 8],
"fields": {},
},
{
"testcase_name": "Rank2_WithNoFieldsAndExplicitRowPartition... | |
<filename>ezclimate_matlab/damage_simulation.py
from __future__ import division
import numpy as np
import multiprocessing as mp
from tools import _pickle_method, _unpickle_method
from tools import write_columns_csv, append_to_existing
try:
import copy_reg
except:
import copyreg as copy_reg
import types
... | |
string, found %s %s" % (smooth,type(smooth))
if smooth_kw is None :
smooth_kw = {}
# Use Gaussian filter smoothing (useful for noisy data)
if smooth.lower() == "gaussian_filter" :
from scipy.ndimage.filters import gaussian_filter
assert "sigma" in smooth_kw
assert "order" in smooth_kw
for i,m in enumerate... | |
# repeat should be flattened by multiplying the repeat times together.
return _normalize_row_repeat(
replace(rep,
rows=flattened_rows[0].rows,
times=NaturalLit.of(rep.times.value *
flattened_rows[0].times.value))
)
return _normalize_row_repeat(replace(rep, rows=flattened_rows))
@_flatten.register
def _(pattern... | |
<filename>neurokit2_parallel.py
# This file attempts to replicate the
# neurokit2.ecg_process and ecg_interval_related methods,
# but vectorized to support multi-lead ECGs without loops.
import re
import functools
import warnings
import neurokit2 as nk
import numpy as np
import pandas as pd
import scipy
import scipy.s... | |
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-Kernel-Power
GUID : 331c3b3a-2005-44c2-ac5e-77220c37d6b4
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from et... | |
1, 1, 1, 3, 3, 3])
>>> values = numpy.array([0, 1, 2, 3, 4, 0, 2, 4, 6, 0, 4, 6])
>>> value_at_argmin_by_idx(idx, values, fill=-1)
array([ 0, 0, -1, 0])
>>> value_at_argmin_by_idx(idx, values, minlength=10, fill=-1)
array([ 0, 0, -1, 0, -1, -1, -1, -1, -1, -1])
"""
assert idx.dtype.kind == 'u' or (idx.dtype.kind... | |
respond
malformed_header_sdp_m:
description:
- Action for malformed SDP m line.
type: str
choices:
- discard
- pass
- respond
malformed_header_sdp_o:
description:
- Action for malformed SDP o line.
type: str
choices:
- discard
- pass
- respond
malformed_header_sdp_r:
description:
- Action for malform... | |
try:
module_reload(harvester)
except:
import harvester
# tabnabbing for auto site here
if attack_vector == "tabnabbing" or attack_vector == "webjacking":
# get the url
print_info("Example: http://www.blah.com")
URL = raw_input(
setprompt(["2"], "URL of the website you imported"))
match = re.search("http://",... | |
# Landmark extraction
# Steps
# Add new fields
# Check if fields exists
# Visual
# 3D Visibility 0.5 * 0.5 = 0.25
# Facade area 0.3 * 0.5 = 0.15
# Height 0.2 * 0.5 = 0.1
# Structural
# Area 0.3 * 0.3 = 0.09
# 2D-Advance visibility 0.3 * 0.3 = 0.09
# Neighbours 0.2 * 0.3 = 0.06
# Road distance 0.2 * 0.3 = 0.06
# Seman... | |
<reponame>usegalaxy-no/usegalaxy<filename>venv/lib/python3.6/site-packages/ansible_collections/fortinet/fortios/plugins/modules/fortios_log_setting.py
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019-2020 Fortinet, Inc.
#
# This program is free software: you can redi... | |
channel_info.get("value_ref_enabled", False)
# Use DeviceProxy instead of taurus to avoid crashes in Py3
# See: tango-controls/pytango#292
if _is_referable(full_name) and value_ref_enabled:
continue
channel = Device(full_name)
value_buffer_obj = channel.getValueBufferObj()
if cb is not None:
value_buffer_obj.un... | |
<gh_stars>10-100
# -*- coding: utf-8 -*-
import unittest
import random
from src.heap import Heap
from src.graph import Graph
from src.strongly_connected_components import scc
class TheoryProblems(unittest.TestCase):
def test_problem_1(self):
""" You are given as input an unsorted array of n distinct numbers,
wh... | |
*(dict) --*
A tag consisting of a name/value pair for a resource.
- **Key** *(string) --*
The key, or name, for the resource tag.
- **Value** *(string) --*
The value for the resource tag.
:type ClusterSecurityGroupName: string
:param ClusterSecurityGroupName: **[REQUIRED]**
The name of the security Group fro... | |
#!/usr/bin/env python
#
# Copyright (c) 2019 Opticks Team. All Rights Reserved.
#
# This file is part of Opticks
# (see https://bitbucket.org/simoncblyth/opticks).
#
# 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 ... | |
<filename>main/train.py
# src: https://github.com/facebookresearch/DrQA/blob/master/scripts/reader/train.py
import sys
sys.path.append(".")
sys.path.append("..")
import os
import json
import torch
import logging
import subprocess
import argparse
import numpy as np
import c2nl.config as config
import... | |
in list - this value should be None. If more then one tuple in conditions_list -
this value should be string (e.g. "AND", or "OR")
:return: result if query success
"""
async def func():
if conditions_list:
conditions = LemkPgUtils.get_conditions(conditions_list)
query = f"""SELECT COUNT({column}) FROM {table_na... | |
#########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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 requi... | |
<gh_stars>1-10
#! /usr/bin/python
# Based off the daemon code written by <NAME> http://dan.mandle.me September 2012
# LCD parts from 16x2 LCD Test Script
# which is written by : <NAME> 06/04/2015 (http://www.raspberrypi-spy.co.uk/)
#
# The Rest by <NAME>: https://github.com/kmkingsbury
# License: Apache 2.0
import os
... | |
from datetime import datetime, timedelta, timezone
import logging
from operator import itemgetter
import pickle
import pytest
from rethinkdb import RethinkDB
from . import db_pool
from starbelly.db import (
CrawlFrontierDb,
CrawlExtractorDb,
CrawlManagerDb,
CrawlStorageDb,
LoginDb,
ScheduleDb,
ServerDb,
Subsc... | |
<gh_stars>1-10
#!/usr/bin/python3
import subprocess, shutil, os, sqlite3, re
import utils
from email_validator import validate_email as validate_email_, EmailNotValidError
import idna
def validate_email(email, mode=None):
# Checks that an email address is syntactically valid. Returns True/False.
# Until Postfix sup... | |
> self.END_MOUSE_Y:
for x in range(0, self.NUM_PINS_WIDTH):
for y in range(0, self.NUM_PINS_LENGTH):
if x*(self.BALL_PITCH*self.NUM_PINS_WIDTH)*self.SCALING/self.NUM_PINS_WIDTH+self.OFFSET_X > self.BEGIN_MOUSE_X and \
x*(self.BALL_PITCH*self.NUM_PINS_WIDTH)*self.SCALING/self.NUM_PINS_WIDTH+self.OFFSET_X < self.END_... | |
= self.name + '.' + destdata[0]
self.locals.append(dest)
# clearing an old assignment
else:
if self.refs[dest] in ('e', 'p', '1', '1p', 'p1'): # an entity
self.add_command(clear_tag(dest))
elif self.refs[dest] == 's': # a string
self.raise_exception('Strings are handled at compile time, so overwriting a string ... | |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Possible roles of an agent during task
NO_ROLE = 0
WIZARD = 1
APPRENTICE = 2
IN_TRAINING = 10
WIZARD_IN_TRAINING = WIZ... | |
query string in search query syntax. The query must
be non-empty. Query strings can be simple as "x" or more qualified as:
* name:x * column:x * description:y Note: Query tokens need to have a
minimum of 3 characters for substring matching to work correctly. See
[Data Catalog Search Syntax](/data-catalog/docs/how-t... | |
<filename>project.py<gh_stars>0
import collections
import os
import re
import shutil
import subprocess
import sys
import urllib.request
import zipfile
import string
import logging
import logging.handlers
import struct
import yaml
# from configparser import ConfigParser
from pathlib import Path
import exceptions
if g... | |
import time
import threading
import os
import shutil
import json
import copy
import tempfile
import numpy as np
import collections
import forcebalance
from backend.target_validators import new_validator
from backend.fb_executor import FBExecutor
class FBProject(object):
project_status = {'idle': 0, 'running':1, 'fi... | |
monitor capable of monitoring pools
:type pool_compatible: ``bool``
"""
self.id = id
self.name = name
self.node_compatible = node_compatible
self.pool_compatible = pool_compatible
def __repr__(self):
return (('<NttCisDefaultHealthMonitor: id=%s, name=%s>')
% (self.id, self.name))
class NttCisPersistenceProf... | |
randn()
expected.values[i,j] = val
ix[idx, col] = val
assert_frame_equal(f, expected)
def test_getitem_fancy_boolean(self):
f = self.frame
ix = f.ix
expected = f.reindex(columns=['B', 'D'])
result = ix[:, [False, True, False, True]]
assert_frame_equal(result, expected)
expected = f.reindex(index=f.index[5:... | |
ensemble. The moves that "
r"are invalid for a given ensemble are set to zero. If the default "
r"moves are not being used, all the move frequencies which do not have "
r"default values of zero will need to be set manually so the sum equals "
r"\(DisFreq, RotFreq, IntraSwapFreq, SwapFreq, RegrowthFreq, "
r"CrankSh... | |
"""Utilities for training and evaluating."""
import numpy as np
import matplotlib.pyplot as plt
import torch
import os
import pickle
from torch import Tensor
from torch.optim.optimizer import Optimizer
from torch.utils.data import DataLoader
from torch.distributions import Normal
from gpytorch import settings
from gpyt... | |
not a valid value
Returns:
float: the value of `drybulb_temperature_difference_range_3_upper_limit` or None if not set
"""
return self["Dry-Bulb Temperature Difference Range 3 Upper Limit"]
@drybulb_temperature_difference_range_3_upper_limit.setter
def drybulb_temperature_difference_range_3_upper_limit(self, va... | |
<filename>src/upax/ftlog.py
# dev/py/upax3/upax3/ftlog.py
""" Fault-tolerant log for a Upax node. """
import os
import re
# import sys
from collections import Container, Sized
from xlattice import (HashTypes, check_hashtype, # u,
SHA1_HEX_NONE, SHA2_HEX_NONE, SHA3_HEX_NONE,
BLAKE2B_HEX_NONE)
from upax import UpaxEr... | |
""" This module contains functions to clean a raw dataset of reaction SMILES strings, which includes
operations such as removing atom mapping and checking for invalid molecule SMILES. There is also
a function to generate a list of SMILES strings of all unique molecules in the given dataset.
NOTE: in rxn-ebm, a 'datase... | |
r'<VL Label=\4 Source=Context>\4</VL> <VML Logic=lower Unit\1>\2</VML> - \5 <VML Unit\6>', text)
text = re.sub(r'<VML Unit([^<>]+)>([^<>]+)</VML> (< =|= <) ([a-z]\w+)', r'<VML Logic=greater_equal Unit\1>\2</VML> \4', text)
text = re.sub(r'<VML Unit([^<>]+)>([^<>]+)</VML> (<) ([a-z]\w+)', r'<VML Logic=greater Unit\1>... | |
<gh_stars>10-100
'''
This package contains code for submodular maximization and
structured learning using stochastic gradient decent.
It allows to learn an objective function as a linear combination of simpler functions f, i.e.
.. math:: o(\mathbf{x_\mathcal{V}},\mathbf{y})=\mathbf{w^\mathrm{T}}\mathbf{f}(\mathbf{x_\m... | |
(gdal dataset please read it using gdal library) "
gt_src = RasterA
# we need number of rows and cols from src A and data from src B to store both in dst
gt_src_proj = gt_src.GetProjection()
# GET THE GEOTRANSFORM
gt_src_gt = gt_src.GetGeoTransform()
# GET NUMBER OF columns
gt_src_x = gt_src.RasterXSize
# get ... | |
sum of squares around the cluster
means for the input data set. The value returned for each value of
k is the mean of B2 clusterings.
log(W) : the logarithm of W (see above)
log(W*) : The expectation of log(W) under an appropriate null reference
distribution of the data. This is calculated as the mean log
pooled ... | |
from boa3.boa3 import Boa3
from boa3.exception import CompilerError, CompilerWarning
from boa3.model.type.type import Type
from boa3.neo.vm.opcode.Opcode import Opcode
from boa3.neo.vm.type.Integer import Integer
from boa3_test.tests.boa_test import BoaTest
from boa3_test.tests.test_classes.testengine import TestEngine... | |
.format(out_stem, c, \
str(structure.select('chain {0} and resnum {1}' \
.format(c, resnum)).getResnames()), \
resnum, direction))
for c in chain:
fo = open(pdbOut[n],'w')
for line in lines:
if line.find('ATOM') != 0 and line.find('HETATM') != 0 and line.find('ANISOU') != 0:
fo.write(line)
elif line.find('ATO... | |
<filename>oslo_policy/tests/test_policy.py<gh_stars>0
# Copyright (c) 2012 OpenStack Foundation.
# 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.or... | |
"""
Classes and functions for parsing and inspecting TDL.
This module makes it easy to inspect what is written on definitions in
Typed Description Language (TDL), but it doesn't interpret type
hierarchies (such as by performing unification, subsumption
calculations, or creating GLB types). That is, while it wouldn't b... | |
# -*- coding: utf-8 -*-
# Copyright (c) 2019-2021 <NAME>.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.db import models
from django.utils import timezone
from BasisTypen.models import BoogType, TeamType, IndivWedstrijdklasse, TeamWedstrijdklasse
from Functie.ro... | |
mock_get_member_data, mock_subsystem_exists, mock_get_utc_time,
mock_add_subsystem_identifier, mock_add_subsystem_client, mock_add_client_name):
with self.assertLogs(csapi.LOGGER, level='INFO') as cm:
self.assertEqual(
{
'code': 'CREATED', 'http_status': 201,
'msg': 'New Subsystem added'},
csapi.add_subsystem('M... | |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
-------------------------------------------------... | |
#!/usr/bin/env python
# coding: utf8
#
# Copyright (c) 2021 Centre National d'Etudes Spatiales (CNES).
#
# This file is part of demcompare
# (see https://github.com/CNES/demcompare).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | |
}
}
},
}
}
},
}
configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r3")
for addr_type in ADDR_TYPES:
result = verify_graceful_restart(
tgen, topo, addr_type, input_dict, dut="r1", peer="r3"
)
assert result is True, "Testcase {} : Failed \n Error {}".format(
tc_name, result
)... | |
= self._GetInfo( share_key )
name = info[ 'name' ]
text = info[ 'text' ]
timeout = info[ 'timeout' ]
media_results = info[ 'media_results' ]
return ( name, text, timeout, media_results )
def GetMediaResult( self, share_key, hash ):
with self._lock:
info = self._GetInfo( share_key )
media_result... | |
ddf = dd.from_pandas(df, npartitions=1)
# Ok with 1 partition and filters
ddf.repartition(npartitions=1, force=True).to_parquet(
fn, write_index=False, engine=write_engine
)
ddf2 = dd.read_parquet(
fn, index=False, engine=read_engine, filters=[("at", "==", "aa")]
).compute()
ddf3 = dd.read_parquet(
fn, index=... | |
<filename>ocaml/_rules/ocaml_signature.bzl
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
load("@bazel_skylib//lib:new_sets.bzl", "sets")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("//ocaml/_transitions:ns_transitions.bzl", "nsarchive_in_transition")
load("//ocaml:providers.bzl",
"Ocaml... | |
# Copyright 2019-2020 QuantumBlack Visual Analytics 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
#
# THE SOFTWARE IS PROVIDED "AS IS"... | |
image
hdr = copy.deepcopy(self.header)
hdr['CRPIX1'] += dx
hdr['CRPIX2'] += dy
self.header = hdr
self.wcs = wcs.WCS(hdr)
return result.array
elif method == 'spline':
from scipy.ndimage.interpolation import shift
assert 0 < order <= 5 and isinstance(order, int), 'order of ' + method + ' must be within 0-5.'
re... | |
column
num_cols = len(fmt)
width = [max(0 if isinstance(row, str) else len(row[i]) for row in rows)
for i in range(num_cols)]
for row in rows:
if isinstance(row, str):
# Print a separator line
print_func(' '.join([row * width[i] for i in range(num_cols)]))
else:
print_func(' '.join([align_cell(fmt[i], row[i], ... | |
== 0x21): # (indirect,X)
value = self._get_value_at_indirect_x()
cycles = 6
elif (op_code == 0x31): # (indirect),Y
value = self._get_value_at_indirect_y()
cycles = 5
else:
raise RuntimeError(f"Unknown op code: {op_code}")
self._a = (self._a&value)&0xFF
self._negative = (self._a&0x80) > 0
self._zero = self._... | |
import os
import cv2
import matplotlib.pyplot as plt
import numpy as np
import pymunk
from matplotlib.collections import PatchCollection
from matplotlib.colors import to_rgba
from matplotlib.patches import Circle, Polygon
from pymunk.vec2d import Vec2d
from utils import rand_float, rand_int, calc_dis, norm
class En... | |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | |
<gh_stars>1-10
# coding: utf-8
#
# Copyright 2014 The Oppia 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
#
# Un... | |
"ثٌذ",
"ثٌذکرو",
"ثٌذکرًب",
"ثٌذی",
"ثڑا",
"ثڑوں",
"ثڑی",
"ثڑے",
"ثھر",
"ثھرا",
"ثھراہوا",
"ثھرپور",
"ثھی",
"ثہت",
"ثہتر",
"ثہتری",
"ثہتریي",
"ثیچ",
"ج",
"خب",
"خبرہب",
"خبرہی",
"خبرہے",
"خبهوظ",
"خبًب",
"خبًتب",
"خبًتی",
"خبًتے",
"خبًٌب",
"خت",
"ختن",
"خجکہ",
"خص",
"خططرذ",
"خلذی",
"... | |
#!/usr/bin/env python3
#
# Evolutionary Algorithms
import os
import time
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def check_dir(directory):
"""
:param directory: path to the directory
"""
os.makedirs(directory, exist_ok=True)
def sphere_test(data):
"""
:param data:
:return:
... | |
Target Group.
:param alb_target_group: an ALB Target Group.
"""
return jsii.sinvoke(cls, "application", [alb_target_group])
@jsii.member(jsii_name="classic")
@builtins.classmethod
def classic(
cls, load_balancer: aws_cdk.aws_elasticloadbalancing.LoadBalancer
) -> "LoadBalancer":
"""Creates a new CodeDeploy l... | |
<reponame>jumasy/helita
"""
Set of programs to read and interact with output from Multifluid/multispecies
TODO:
Fix the memory leak...
The following code:
dd = eb.EbysusData(...)
del dd
does not actually free the dd object. It does not run dd.__del__().
This can be proven by defining EbysusData.__del__() to pri... | |
<reponame>ire4ever1190/Not-a-bot
import asyncio
import logging
import random
import shlex
import subprocess
import unicodedata
from datetime import datetime
from datetime import timedelta
import discord
import emoji
from discord.errors import HTTPException
from discord.ext.commands import (BucketType, check, bot_has_p... | |
<gh_stars>0
"""
Distribute jobs over multiple machines by means of ssh.
- find quiet nodes
- start jobs if space
- weight jobs
- get status info
- restart failed
"""
from argparse import ArgumentParser, SUPPRESS
from collections import defaultdict, OrderedDict
from datetime import datetime
from fnmatch import fnmatc... | |
from abc import abstractmethod
from typing import Union, Tuple
import h5py
import numpy as np
import scipy.io as scio
import scipy.sparse
from benchmark_utils import Dataset
__all__ = (
"get_load_fn", "get_cv_fn",
"BaseDataset", "HiggsDataset", "SusyDataset", "MillionSongsDataset",
"TimitDataset", "NycTaxiDataset... | |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013--, biocore development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------... | |
1:len(str)]).find("\"") + pos2 + 1)
if(pos3 != -1):
pos4 = (((str)[pos3 + 1:len(str)]).find("\"") + pos3 + 1)
if(pos4 != -1):
name = ((str)[pos1 + 1:pos2])
texture = ((str)[pos3 + 1:pos4])
self. __names.append(name)
self. __textures.append(texture)
... | |
DIN1.
Example:
bits.RTBoxEnable(mode = ['Down','CB6'])
enable the RTBox emulation to detect Down events on the standard CB6 IR response box keys.
"""
if self.touchEnabled:
warning = ("Cannot use RTBox when touch screen is on")
raise AssertionError(warning)
else:
super(DisplayPlusPlusTouch, self).RTBoxEna... | |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2020, <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 requir... | |
<reponame>ivankreso/semseg
import time
import tensorflow as tf
import argparse
import os, re
import numpy as np
import h5py
import skimage as ski
import skimage.data
import skimage.transform
import cv2
import tensorflow.contrib.layers as layers
from tensorflow.contrib.framework import arg_scope
from tensorpack import... | |
0.5,
)
image = np.random.rand(200, 3600)
other = LinearTimeSpectrogram(
image, np.linspace(0, image.shape[1] - 1, image.shape[1]),
np.linspace(0, image.shape[0] - 1, image.shape[0]),
datetime(2010, 10, 11, 0, 15, 1),
datetime(2010, 10, 11, 1, 15), 901, 1,
)
with pytest.raises(ValueError) as excinfo:
LinearTi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.