input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
import unittest
import sys
from term import py_codec_impl as py_impl
import term.native_codec_impl as native_impl
from term.atom import Atom, StrictAtom
from term.pid import Pid
from term.reference import Reference
from term.fun import Fun
from term.list import list_to_unicode_str
class TestETFDecode(unittest.TestCa... | |
<gh_stars>0
"""
cppgen.py - AST pass to that prints C++ code
"""
import io
import json # for "C escaping"
import sys
from typing import overload, Union, Optional, Any, Dict
from mypy.visitor import ExpressionVisitor, StatementVisitor
from mypy.types import (
Type, AnyType, NoneTyp, TupleType, Instance, Overloaded, C... | |
[ self._ssl_cert_filename, self._ssl_key_filename ]
def _InitCaches( self ):
pass
def _InitDB( self ):
create_db = False
db_path = os.path.join( self._db_dir, self._db_filenames[ 'main' ] )
if not os.path.exists( db_path ):
create_db = True
external_db_paths = [ os.path.join( self._db_dir, s... | |
<filename>canflood/build/dialog.py<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
ui class for the BUILD toolset
"""
#==============================================================================
# imports-----------
#==============================================================================
#python
import sys, os, d... | |
import os
import time
import json
import uuid
from sqlite3 import connect
# Configuration
DATABASE_FILE = "database.db"
FILE_PATH = os.path.dirname(os.path.realpath(__file__)) + "/" + DATABASE_FILE
ROOT_ID = "root"
## Testing
RECREATE_ENTRIES = True
RECREATE_ENTRIES = False
# # # # # # #
# Interface #
# # # # # # #... | |
= "undefined"
obj_attr_list["target_state"] = "undefined"
_status, _fmsg = self.parse_cli(obj_attr_list, parameters, command)
if not _status :
_status, _fmsg = self.initialize_object(obj_attr_list, command)
_cloud_name = obj_attr_list["cloud_name"]
if _status in [0, 483920, 912543] :
if _status not in [4839... | |
<reponame>jurafish/Paddle<filename>python/paddle/distributed/auto_parallel/context.py
# Copyright (c) 2021 PaddlePaddle 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 Lice... | |
mask
if self.mask is not None:
out |= self.mask
return out
def is_hom(self, allele=None):
"""Find genotype calls that are homozygous.
Parameters
----------
allele : int, optional
Allele index.
Returns
-------
out : ndarray, bool, shape (n_variants, n_samples)
Array where elements are True if the genoty... | |
<reponame>taechanha/JORLDY<gh_stars>0
from collections import deque
import os
import numpy as np
import torch
import torch.nn.functional as F
from torch.distributions import Normal
from .base import BaseAgent
from core.network import Network
from core.optimizer import Optimizer
from core.buffer import ReplayBuffer
c... | |
as '-c annex.largefiles=' option to all git annex calls
in case largefiles setting is not yet defined in "git attributes"
**kwargs : dict, optional
to be passed into AnnexRepo
"""
if path is None:
path = realpath(curdir)
# TODO: commented out to ease developing for now
# self.repo = _call(AnnexRepo, path, **kwa... | |
<filename>ro/determinist/algorithms/planner_MILP.py<gh_stars>1-10
# -*- coding: UTF-8 -*-
import math
import os
import time
import numpy as np
import pandas as pd
import gurobipy as gp
from gurobipy import GRB
from ro.utils import dump_file, build_observations, build_point_forecast
from root_project import ROOT_DIR
i... | |
#!/usr/bin/env python
# @HEADER
# ************************************************************************
#
# TriBITS: Tribal Build, Integrate, and Test System
# Copyright 2013 Sandia Corporation
#
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in... | |
changer does not suppor this operation.")
# It is possible that the following code does work. However, the
# error messages should be changed from STK to IBM if that is
# the case.
"""
__pychecker__ = "unusednames=i"
#do drive cleaning cycle
Trace.log(e_errors.INFO, 'mc:ticket='+repr(inTicket))
classTicket = {... | |
import sys
import os
import subprocess
import asyncio
import time
import json
import websockets
import threading
import queue
import gi
gi.require_version('WebKit2', '4.0')
from gi.repository import Gdk, WebKit2, Gtk
from gi.repository import GObject
import sqlite3
from diode.db_scripts.sql_to_json import MetaFetche... | |
<gh_stars>10-100
import os
import struct
import maya.cmds as cmds
import maya.mel as mel
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
import pymel.core
from process import Process
# Will be populated as materials are registered with Maya
materialNodeTypes = []
#
# XML for... | |
1500000000000000000000),
("0x4adbf4aae0e3ef44f7dd4d8985cfaf096ec48e98", 150000000000000000000),
("0x9a633fcd112cceeb765fe0418170732a9705e79c", 18200000000000000000),
("0x292f228b0a94748c8eec612d246f989363e08f08", 185000000000000000000),
("0x9f3497f5ef5fe63095836c004eb9ce02e9013b4b", 633424000000000000000),
("0x0e6... | |
<reponame>jepegit/cellpy
# -*- coding: utf-8 -*-
"""easyplot module for cellpy. It provides easy plotting of any cellpy-readable data using matplotlib.
Author: <NAME>
Date: 01.07.2021
"""
import logging
import os
import warnings
from pathlib import Path
from re import S
import matplotlib as mpl
import matplotlib.pyp... | |
\
+ 0*If(_id_72, 0, 1 ) \
+ 0*If(wish_list, 0, 1 ) \
+ 0*If(wish_list_saved_after_session, 0, 1 ) \
+ 1*If(email_wish_list, 0, 1 ) \
+ 0*If(_id_73, 0, 1 ) \
+ 0*If(permissions, 0, 1 ) \
+ 1*If(_id_75, 0, 1 ) \
+ 0*If(_id_76, 0, 1 ) \
+ 0*If(_id_77, 0, 1 ) \
+ 1*If(buy_paths, 0, 1 ) \
+ 0*If(_id_78, 0, 1 ) \
... | |
\n \n'REGISTER FD05RYT Joe Bloggs'"
bb_sms_handler.send_sms_notification(SMSTo, SMSFrom, message)
return "<Response></Response>"
def notEnoughDeRegistrationDetails(SMSTo, SMSFrom):
logger.debug("Returning: Not Enough Details Provided")
message = "You have not provided enough details. Please use format: \n \n'UNRE... | |
<filename>4-dccphase_2/src/3_statistical_simulation.py
#-- -- -- -- Statistical Simulation in Python:
# Used for Data Scientist Training Path
#FYI it's a compilation of how to work
#with different commands.
### --------------------------------------------------------
# # ------>>>>> np.random.choice()
# In t... | |
from collections import defaultdict
import numpy as np
import rlf.rl.utils as rutils
import torch
from rlf.storage.base_storage import BaseStorage
from torch.utils.data.sampler import BatchSampler, SubsetRandomSampler
def get_shape_for_ac(action_space):
if action_space.__class__.__name__ == "Discrete":
action_shap... | |
<reponame>mmeyer724/sqlalchemy
"""
a series of tests which assert the behavior of moving objects between
collections and scalar attributes resulting in the expected state w.r.t.
backrefs, add/remove events, etc.
there's a particular focus on collections that have "uselist=False", since in
these cases the re-assignment... | |
import tempfile
import unittest
import docker
from docker import models
from seaworthy.checks import docker_client, dockertest
from seaworthy.helpers import (
ContainerHelper, DockerHelper, ImageHelper, NetworkHelper, VolumeHelper,
_parse_image_tag, fetch_images)
# We use this image to test with because it is a s... | |
<reponame>vanvalenlab/deepcell-spots
# Copyright 2019-2022 The <NAME> at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
#
# Licensed under a modified Apache License... | |
import pytest
pytest.importorskip("numpy")
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
import dask.array as da
from dask.array.overlap import (
boundaries,
constant,
ensure_minimum_chunksize,
nearest,
overlap,
overlap_internal,
periodic,
reflect,
trim_internal,... | |
= Column(INTEGER(255))
noservice = Column(TINYINT(1), server_default=text("'0'"))
plannoservice = Column(TINYINT(1), server_default=text("'0'"))
address = Column(String(255))
status = Column(String(100), server_default=text("'adapting'"))
goal = Column(Text)
comment = Column(Text)
class RaActionsAccountsC(Base)... | |
format_version,
task_manager: aiotools.BackgroundTaskManager,
pool: concurrent.futures.ThreadPoolExecutor,
):
super().__init__(batch_id, user, gsa_key, job_spec, format_version, task_manager, pool)
assert job_spec['process']['type'] == 'jvm'
input_files = job_spec.get('input_files')
output_files = job_spec.get(... | |
for _ in ranges]
# varlist={}
for i, rpart in enumerate(ranges):
varlist = rangedvars[i]
# varlist.clear()
for (varname, partlist) in arr_parts.items():
for (vpart, data) in partlist:
if not shardview.overlaps(rpart, vpart): # skip
continue
# times.append(timer())
# slindex = shardview.to_base_slice(shardview... | |
self.statements[statement.feature].val = statement.val
if updateOperators:
self.statements[statement.feature].op = statement.op
else:
prevStatType = 'binary' if self.statements[statement.feature].binary else 'non-binary'
newStatType = 'binary' if statement.binary else 'non-binary'
raise ValueError(f'Cannot update... | |
ClientMethod: string
:param ClientMethod: The client method to presign for
:type Params: dict
:param Params: The parameters normally passed to\nClientMethod.
:type ExpiresIn: int
:param ExpiresIn: The number of seconds the presigned url is valid\nfor. By default it expires in an hour (3600 seconds)
:type HttpM... | |
#!/usr/bin/env python3
"""
Polyglot v2 node server Russound status and control via RNET protocol
Copyright (C) 2020 <NAME>
"""
try:
import polyinterface
except ImportError:
import pgc_interface as polyinterface
import sys
import time
import datetime
import requests
import threading
import socket
import math
import r... | |
#!/usr/bin/env python
# Copyright 2015 VMware, Inc. All rights reserved. -- VMware Confidential
"""
Utility functions to support certificate-manager
"""
__author__ = '<NAME> (<EMAIL>)'
__copyright__ = 'Copyright 2015, VMware Inc.'
__version__ = 1.0
import logging
import os
import sys
import errno
sys.path.append(os... | |
if not 'timestamp' in quote:
quote['timestamp'] = self.time
if not 'order_id' in quote:
quote['order_id'] = self.next_order_id
self._last_order_timestamp = quote['timestamp']
if quote['quantity'] <= 0:
sys.exit('process_order() given order of quantity <= 0')
if order_type == 'market':
# Tape LOB state before ... | |
subscriber_activity_table,
'total_number_of_events': total_number_of_events,
'number_of_filtered_events': len(events),
'keyword': keyword,
'start_date': context_start_date,
'end_date': context_end_date,
'all_services': all_services,
'checked_services': checked_services,
}
template = get_template('dashboard/su... | |
#!/usr/bin/env python3
# vim: set expandtab tabstop=4 shiftwidth=4:
# Copyright (c) 2021, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the... | |
<reponame>Di-Weng/emotion_classification_blstm
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/7/1 0:32
# @Author : MengnanChen
# @Site :
# @File : audioFeatureExtraction.py
# @Software: PyCharm Community Edition
import numpy
from scipy.fftpack.basic import _fftpack
from scipy.fftpack.basic import _asfar... | |
<filename>reanatempl/util/template/base.py
# Copyright (C) 2019 New York University.
#
# This file is part of REANA Templates. REANA Templates is free software; you
# can redistribute it and/or modify it under the terms of the MIT License; see
# LICENSE file for more details.
"""The workflow template handle provides a... | |
future
- the `start_at` or `end_at` overlaps another shift for the same
employee
- If `Break`s are set in the request, a break `start_at`
must not be before the `Shift.start_at`. A break `end_at` must not be
after
the `Shift.end_at`
Args:
body (CreateShiftRequest): An object containing the fields to POST
for ... | |
import numpy as np
import torch
import yaml
def convert_to_yolo_labels(bbox, S, B, number_of_classes=20):
label = torch.zeros((S, S, (5 * B + number_of_classes)))
for box in bbox:
x, y, w, h, c = box
x_idx = int(x * S)
y_idx = int(y * S)
x_cell = (x * S) - int(x * S)
y_cell = (y * S) - int(y * S)
w, h = w * ... | |
man='22', pin='223344')
self.assertTrue(self.config.ryanpeiko.is_condition_met(self._hand(tiles)))
tiles = self._string_to_34_array(sou='111122223333', man='22')
self.assertTrue(self.config.ryanpeiko.is_condition_met(self._hand(tiles, 1)))
tiles = self._string_to_34_array(sou='112233', man='123', pin='23444')
se... | |
<reponame>AnitaPetzler/AMOEBA
import copy
import emcee
import itertools
import numpy as np
import pickle
from scipy.interpolate import interpn
from scipy.special import logsumexp
import matplotlib.pyplot as plt
'''
......
.. ...
.. ..
.. .. .....
.. .. ... ...
.. .. ... ..
.. .. ... ..
.. .... ..... ..
... | |
...]]:
"""Find all indices of occurrences of self in patt. If the optional colours
are provided, in an occurrences the colours of the patterns have to match the
colours of the permutation.
Examples:
>>> list(Perm((2, 0, 1)).occurrences_in(Perm((5, 3, 0, 4, 2, 1))))
[(0, 1, 3), (0, 2, 3), (0, 2, 4), (0, 2, 5), (1... | |
# -*- coding: utf-8 -*-
"""
Zurich Instruments LabOne Python API Example
Python API Example for the Software Trigger (ziDAQRecorder) Core Module. This
example demonstrates how to obtain bursts of demodulator data when a
demodulator's R value is larger than a threshold (defined above the lowpass
filtered value of the d... | |
versionadded:: 2.0
Attributes
------------
name: :class:`str`
The name of the group. If not given, it defaults to a lower-case
kebab-case version of the class name.
description: :class:`str`
The description of the group. This shows up in the UI to describe
the group. If not given, it defaults to the docstring ... | |
0.1793, "depth": 13}
if obj[10]<=1.0:
return 'False'
elif obj[10]>1.0:
return 'False'
else: return 'False'
elif obj[6]>3:
# {"feature": "Restaurant20to50", "instances": 4, "metric_value": 0.25, "depth": 13}
if obj[1... | |
else ""
PrintColorString("%s %s"% (self._function_description,
waiting_dots), end="")
try:
result = func(*args, **kargs)
result_time = time.time() - timestart
if not self._print_before_call:
PrintColorString("%s (%ds)" % (self._function_description,
result_time),
TextColors.OKGREEN)
if self._print_status:
ev... | |
drawBodePlot(f,mag,phase,title)
Draws a bode plot
Required parameters:
f : Frequency vector (Hz)
mag : Magnitude vector(dB)
phase : Phase vector (deg)
Optional parameters:
title : Plot title
Returns nothing
"""
addBodePlot(f,mag,phase)
showBodePlot(title)
def drawBodeFromComplex(f,v,title='Bode Plot... | |
<filename>openid/test/test_message.py
# -*- coding: utf-8 -*-
from openid import message
from openid import oidutil
from openid.extensions import sreg
import urllib.request
import urllib.parse
import urllib.error
import unittest
def mkGetArgTest(ns, key, expected=None):
def test(self):
a_default = object()
self.a... | |
<gh_stars>1-10
""" Automated model order selection (AMOS) algorithm for spectral graph clustering (SGC)
"""
# Author: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>, <NAME>, Fellow, IEEE <<EMAIL>>
# License: BSD 3 clause
# Copyright: University of Michigan
from __future__ import division
import warnings
from math import asin
fr... | |
<filename>stubs/micropython-v1_17-esp32/builtins.py
"""
Module: 'builtins' on micropython-v1.17-esp32
"""
# MCU: {'ver': 'v1.17', 'port': 'esp32', 'arch': 'xtensawin', 'sysname': 'esp32', 'release': '1.17.0', 'name': 'micropython', 'mpy': 10757, 'version': '1.17.0', 'machine': 'ESP32 module (spiram) with ESP32', 'build... | |
#
# calcpos.py -- module for wrapping astronomical ephemeris calculations
#
import math
# third-party imports
import numpy as np
from datetime import datetime, timedelta
from dateutil import tz
import dateutil.parser
# right now we just have pyephem...
import ephem
# Constants
#earth_radius = 6378160.0
# TODO: more... | |
from functools import reduce
import uuid
import re
import copy
class Expression:
""" Abstract taintable Expression. """
def __init__(self, taint=()):
if self.__class__ is Expression:
raise TypeError
assert isinstance(taint, (tuple, frozenset))
super().__init__()
self._taint = frozenset(taint)
def __repr__(... | |
# 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
# distributed under the Li... | |
# 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... | |
# Copyright 2014-2019 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
"""Default operators defined on any `Produc... | |
<reponame>ivanbgd/Self-Balancing-Binary-Search-Trees
"""
This is an application of Binary Search Trees.
It's used for storing an array in a tree (or two trees), and it was invented to speed things up.
Uses 1-based indexing.
By using AVL trees like here (self balancing trees in general), we keep the maximum height o... | |
>>> thread = api.stop_run_with_http_info(owner, entity, uuid, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str owner: Owner of the namespace (required)
:param str entity: Entity: project name, hub name, registry name, ... (required)
:param str uuid: Uuid i... | |
tariff
level is based on tariff rings (A, B, ...).
- COUNTY tariff level is
based on counties (SE, WL, ...).
- GH tariff level is
based on Großbereich Hamburg/Hamburg AB.
- NET tariff level is
valid in complete tariff net.
- ZG tariff level is
based on payment borders (Zahlgrenzen).
- STADTVERKEHR tariff level is
... | |
import numpy as np
import pickle
import os
from copy import deepcopy
from scipy.special import digamma
from pynverse import inversefunc
from utils import bql_f_inv, \
normal_gamma, \
solve_tabular_continuing_PI
# ============================================================================
# General Tabular agent... | |
<reponame>NeilJ-Thomson/pensa<gh_stars>10-100
import numpy as np
from tqdm import tqdm
from pensa.features import *
from pensa.statesinfo import *
# -- Functions to calculate SSI statistics across paired ensembles --
def ssi_ensemble_analysis(features_a, features_b, all_data_a, all_data_b, torsions=None, pocket_occu... | |
"""A parameter range scaling the simulated kite moments-of-inertia."""
def __init__(self, dim, scales, distribution, body, body_name=''):
"""Constructor.
Args:
dim: Dimension to apply the scaling to (one of 0, 1, 2).
scales: Scale factors to apply.
distribution: Parameter for specifying probability distribution... | |
832, 656, 380, 300, 300, 206, 187, 175,
142, 465, 206, 271, 468, 215, 560, 83, 215, 83, 215, 215, 83, 175,
215, 83, 83, 111, 206, 756, 559, 756, 1367, 206, 559, 1015, 559, 559,
946, 1015, 548, 559, 756, 1043, 756, 698, 159, 414, 308, 458, 997,
663, 663, 347, 39, 755, 838, 323, 755, 323, 159, 159, 717, 159, 21,
41,... | |
#!/usr/bin/env python3.8
# Released under the MIT License. See LICENSE for details.
#
"""BallisticaCore server manager."""
from __future__ import annotations
import json
import os
import signal
import subprocess
import sys
import time
from pathlib import Path
from threading import Lock, Thread, current_thread
from typ... | |
data_models.Vip(subnet_id=t_constants.MOCK_SUBNET_ID,
network_id=t_constants.MOCK_NETWORK_ID)
fake_lb = data_models.LoadBalancer(id='1', vip=fake_lb_vip,
project_id='test-project')
vip = self.driver.allocate_vip(fake_lb)
exp_create_port_call = {
'port': {
'name': 'octavia-lb-1',
'network_id': t_constants.MOCK_N... | |
from PySide import QtGui, QtCore
from PIL import Image, ImageQt, ImageDraw
import os, json
import numpy
import svgwrite
#import PointCloud
from PointCloud import Point2, PointCloud, intersect_line
from gcode import Mach3 as Gc
import re
class Viewer(QtGui.QMainWindow):
def __init__(self, parameters, scale=Point2(1.0... | |
<reponame>vanreusVU/Procedural-Map-Generation
# Default Modules
from typing import List
from random import randrange
import copy
# Custom Modules
from color_constants import Color
from dungeon_tiles import Tile, Tiles
from utilities import Coordinate, checkAlignedBlocks, debugTile, globalToRelative, isWithinBounds
fro... | |
# -*- coding: utf-8 -*-
from linepy import *
import json, time, random
from datetime import datetime, timedelta
from humanfriendly import format_timespan, format_size, format_number, format_length
import json, time, random, sys, json, codecs, threading, glob, re, string, os, requests, six, ast, urllib, urllib3, urllib.... | |
:param str display_name: A filter to return only resources that match the entire display name given.
:param str lifecycle_details: A message describing the current state in more detail. For example, can be used to provide actionable information for a resource in Failed state.
:param Sequence[str] managed_list_types: ... | |
= get_beamline().detector
plot_y = get_beamline().PLOT_Y
#plot_y = pilatus2M.stats4.total
#print("plot_y is {}".format(plot_y))
else:
plot_y = '{}{}'.format(detectors[0].name, detector_suffix)
# Get axes for plotting
title = 'fit_scan: {} vs. {}'.format(detectors[0].name, motor.name)
#if len(plt.get_fig... | |
# use ld_long macro
instruction_name = 'ld_long'
# cannot wrap the address value with square brackets
operand_values.pop()
operand_values.append(hex_word(value))
elif operand == '[$ff00+a8]' or operand == '[a8]' or operand == '[$ffa8]':
length += 1
value = rom.data[pc + 1]
full_value = 0xff00 + value
label =... | |
<filename>nanoraw/nanoraw_helper.py
import sys, os
import re
import h5py
import numpy as np
from collections import defaultdict, namedtuple
NANORAW_VERSION = '0.5'
SMALLEST_PVAL = 1e-20
readData = namedtuple('readData', (
'start', 'end', 'segs', 'read_start_rel_to_raw',
'strand', 'fn', 'corr_group'))
channelIn... | |
# Copyright 2017 The Abseil 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 writi... | |
k.dte.dt('en', u"in order", u"Excellent.")
k.dte.dt('de', u"in ordnung", u"Ausgezeichnet.")
k.dte.dt('en', u"in the bag", u"What bag?")
k.dte.dt('de', u"in der tasche", u"Welche Tasche?")
k.dte.dt('en', u"in the moment not", u"Maybe later?")
k.dte.dt('de', u"im moment nicht", u"Vielleicht später?")
k.dte.dt('e... | |
# (c) 2012-2014, <NAME> <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansi... | |
import uuid
from fhirclient.models import (
observation as obx,
meta as ma,
fhirreference as fr,
fhirdate as fd,
)
from app import (
Coding,
CodeableConcept,
Identifier,
Quantity,
Component
)
# generic FHIR Observation class
class Observation:
def __init__(self, resourceId, profile, identifier, status, ca... | |
{POS: NOUN},
"<cjt>|<np-idf>|N|M|P|@ACC>": {POS: NOUN},
"<cjt>|<np-idf>|N|M|P|@APP": {POS: NOUN},
"<cjt>|<np-idf>|N|M|P|@ICL-<SC": {POS: NOUN},
"<cjt>|<np-idf>|N|M|P|@ICL-N<": {POS: NOUN},
"<cjt>|<np-idf>|N|M|P|@N<": {POS: NOUN},
"<cjt>|<np-idf>|N|M|P|@N<PRED": {POS: NOUN},
"<cjt>|<np-idf>|N|M|P|@NPHR": {... | |
<reponame>ymchen7/bluefog<filename>test/torch_ops_test.py<gh_stars>1-10
# Copyright 2020 Bluefog Team. 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.apac... | |
animations.append(animation)
if len(animations) > 0:
glTF['animations'] = animations
def generateCameras(operator, context, exportSettings, glTF):
"""
Generates the top level cameras entry.
"""
cameras = []
filtered_cameras = exportSettings['filtered_cameras']
activeCam = None
for bl_camera in filtered_... | |
import asyncio
from typing import Optional
from blspy import G2Element
from chia.types.coin_record import CoinRecord
from chia.types.coin_spend import CoinSpend
from chia.types.spend_bundle import SpendBundle
from chia.util.config import load_config, save_config
from operator import attrgetter
import logging
import ... | |
import torch
import torch.nn.functional as F
import numpy as np
import math
def gradient_loss(s, penalty='l1'):
dy = torch.abs(s[:, :, 1:, :,:] - s[:, :, :-1, :,:])
dx = torch.abs(s[:, :, :, 1:,:] - s[:, :, :, :-1,:])
dz = torch.abs(s[:, :, :, :, 1:] - s[:, :, :, :, :-1])
if (penalty == 'l2'):
dy = dy * dy
dx ... | |
def eig_check(self):
"""
Function to perform an eigenvalue based consistency check on the covariance matrix and adjust values accordingly
Algorithm based on 3d NDT Scan Matching and Biber's NDT paper
Using an SVD approach here. For covariance matrices, SVD and eigen decomposition should be the same. SVD
implementa... | |
# :copyright: (c) 2021 by <NAME>.
# :license: MIT, see LICENSE for more details.
"""
yaspin.yaspin
~~~~~~~~~~~~~
A lightweight terminal spinner.
"""
import contextlib
import datetime
import functools
import itertools
import signal
import sys
import threading
import time
from typing import List, Set, Union
from term... | |
# return hud_msg_response
# except (IndexError, requests.exceptions.ReadTimeout) as err_get_hud_msg:
# loguru.logger.debug(err_get_hud_msg)
import urllib.request as r
from tqdm.auto import tqdm
def my_hook(t):
last_b = [0]
def update_to(b=1, bsize=1, tsize=None):
if tsize not in (None, -1):
t.total = tsiz... | |
[True]]),
)
value = PauliList(labels)
self.assertEqual(target, value)
def test_from_labels_1q_with_phase(self):
"""Test 1-qubit from_labels method with phase."""
labels = ["-I", "iZ", "iZ", "X", "-iY"]
target = PauliList.from_symplectic(
np.array([[False], [True], [True], [False], [True]]),
np.array([[False],... | |
<filename>seqpos/lib/python2.7/site-packages/mercurial/setdiscovery.py<gh_stars>0
# setdiscovery.py - improved discovery of common nodeset for mercurial
#
# Copyright 2010 <NAME> <<EMAIL>>
# and <NAME> <<EMAIL>>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License ver... | |
or equal to 0'
m7 = m.copy() # the new vector m1 = gradient input + gradient of phi7
# calculating the product between the diagonals and the slices of m
m7[-1] += m[-1]*2.*alpha
return m7
def phi_1(M, L, m, alpha):
'''
Returns the value for the phi1 constraint.
input
M: integer - number of vertices
L: in... | |
#!/usr/bin/env python
# coding: utf-8
from getpass import getuser
# Settings of the annotation process
############
# How many frames does a batch scan.
# This excludes the very last frame, since we start at 0.
batchsize = 100
# Show every tickskip-th frame for annotation.
tickskip = 5
# Skip so many batches after e... | |
<filename>dibs/src/dibs_main.py
import math
import string
import tempfile
import sys
import re
import os, os.path
import time
import smtplib
from dibs_mod_commands import getstatusoutput
import dibs_constants
import dibs_options
import dibs_database
import dibs_logger
import dibs_daemon
import dibs_crypto
import dib... | |
# 'details' hash (which would have a last line of
# '}')
return last_error.error_message()
else:
return traceback.format_exc().splitlines()[-1].strip()
def _calculate_retry_delay(response, num_attempts):
'''
Returns the time in seconds that we should wait.
:param num_attempts: number of attempts that have bee... | |
"""
webcolors.py by <NAME>.
http://pypi.python.org/pypi/webcolors/
License :: OSI Approved :: BSD License
v.1.4
Utility functions for working with the color names and color value
formats defined by the HTML and CSS specifications for use in
documents on the Web.
What this module supports
-------------------------
... | |
try:
curr_attachment_data = curr_attachment_data['m:Attachments']
except Exception as e:
error_code, error_msg = self._get_error_message_from_exception(e)
error_text = EWSONPREM_EXCEPTION_ERR_MESSAGE.format(error_code, error_msg)
self.debug_print("Could not parse the attachments response", error_text)
continue
... | |
%d %B %Y"))
msgDialog.set_title("Attenzione")
msgDialog.run()
msgDialog.destroy()
ordineDialog = ordini.OrdineDialog(self, idOrdine, mode)
ordineDialog.run()
self.refreshOrder(idOrdine, model, iterator)
# Visualizza Ordine
def viewOrder(self, widget, arg1=None, arg2=None):
model, iterator = self.ordiniTreevi... | |
<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright (c) 2019. <NAME>, <NAME>, <NAME>, #
# <NAME>. All rights reserved. #
# Copyrights licensed under the CC BY 4.0 License. #
# See the accompanying LICENSE file for t... | |
from gssapi.raw import creds as rcreds
from gssapi.raw import named_tuples as tuples
from gssapi._utils import import_gssapi_extension, _encode_dict
from gssapi import names
rcred_imp_exp = import_gssapi_extension('cred_imp_exp')
rcred_s4u = import_gssapi_extension('s4u')
rcred_cred_store = import_gssapi_extension('c... | |
a side effect, builds the _merge_indices specs for generating the merged data.
@see hxl.filters.AbstractBaseFilter.filter_columns
"""
new_columns = list(self.source.columns)
"""The new column list to return."""
merge_column_index = len(self.source.columns)
"""Target index for merging into the output dataset"""... | |
new data cube with the same dimensions. The dimension properties (name, type, labels, reference
system and resolution) remain unchanged, except for the resolution and dimension labels of the given
temporal dimension. The specified temporal dimension has the following dimension labels (`YYYY` = four-
digit year, `MM`... | |
<filename>similarity.py
'''
Table of Contents
Functions and Interdependencies:
proj
orthogonalize
- proj
OLS
EV
pairwise_similarity
best_permutation
- pairwise_similarity
self_similarity_pairwise
- best_permutation
'''
import numpy as np
from numpy.linalg import norm, qr
from scipy.stats import zscore
impor... | |
arraylen; index++) {
if (!(data1[index] %(compare_ops)s data2[index])) {
return 0;
}
}
return 1;
}
#endif
/*--------------------------------------------------------------------------- */
"""
# The actual compare operations using SIMD operations for ARMv8 NEON 64 bit.
ops_simdsupport_armv8 = """
/*----... | |
<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... | |
('remote_address', (YLeaf(YType.str, 'remote-address'), ['str','str'])),
('member_interface', (YLeaf(YType.str, 'member-interface'), ['str'])),
])
self.local_address = None
self.remote_address = None
self.member_interface = None
self._segment_path = lambda: "config"
self._is_frozen = True
def __setattr__(self,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.