input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
#!/usr/bin/env python
import argparse
import logging
import math
import sys
import time
import random
import os
import json
import numpy as np
import pickle
import six
import threading
import pdb
from tqdm import tqdm
import torch
import torch.nn as nn
from pytorch_pretrained_bert import BertTokenizer, OpenAIGPTTok... | |
<filename>framework/generated/vulkan_generators/vulkan_referenced_resource_consumer_body_generator.py
#!/usr/bin/python3 -i
#
# Copyright (c) 2020 LunarG, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# de... | |
<filename>sirepo/template/flash_views.py<gh_stars>10-100
# -*- coding: utf-8 -*-
u"""Flash Config parser.
:copyright: Copyright (c) 2021 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from pykern import pkio
from pykern.pkcollections import PKDict
from pykern.pkdebug ... | |
# -*- coding: utf-8 -*-
"""
This module
"""
import attr
import typing
from ..core.model import (
Property, Resource, Tag, GetAtt, TypeHint, TypeCheck,
)
from ..core.constant import AttrMeta
#--- Property declaration ---
@attr.s
class RuleBatchRetryStrategy(Property):
"""
AWS Object Type = "AWS::Events::Rule.Bat... | |
<reponame>paulzzh/mahjong
# -*- coding: utf-8 -*-
import unittest
from mahjong.constants import EAST, SOUTH, WEST, NORTH, FIVE_RED_SOU
from mahjong.hand_calculating.hand import HandCalculator
from mahjong.hand_calculating.hand_config import HandConfig, OptionalRules
from mahjong.hand_calculating.yaku_config import Yak... | |
_convert_to_numpy_array(wind_speed_array_baseline)
wind_direction_array_baseline = _convert_to_numpy_array(
wind_direction_array_baseline
)
reference_power_controlled = _convert_to_numpy_array(reference_power_controlled)
test_power_controlled = _convert_to_numpy_array(test_power_controlled)
wind_speed_array_cont... | |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''Tests for task decoding'''
import numpy as np
import pytest
import jams
import pumpp
# Sampling rate and hop are simple here to keep things
# divisible for inverse checks
@pytest.fixture()
def sr():
return 10
@pytest.fixture()
def hop_length():
return 1
@pyt... | |
<gh_stars>1000+
# Copyright (c) 2019 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | |
<reponame>ykwang1/PypeIt
""" Routines related to MasterFrames"""
from __future__ import (print_function, absolute_import, division, unicode_literals)
import numpy as np
import os
# import yaml
import json
from astropy.io import fits
from astropy import units
import linetools.utils
from pypeit.par import pypeitpar
f... | |
break
for x in range( start+max_pull, self._exists+1, max_pull ):
if x in self.seqno_cache:
un = self.seqno_cache[x][0]
sn = x
break
if un is None:
sn = self._last_exists
un = self._uid_next - 1
s = ( self._exists / max_pull ) * max_pull
for x in range( s, s0, -max_pull ):
if x in self.seqno_cache:
un = sel... | |
Add nodes to the TensorFlow graph.
if begin_mask is None:
begin_mask = 0
begin_mask = _execute.make_int(begin_mask, "begin_mask")
if end_mask is None:
end_mask = 0
end_mask = _execute.make_int(end_mask, "end_mask")
if ellipsis_mask is None:
ellipsis_mask = 0
ellipsis_mask = _execute.make_int(ellipsis_mask, "el... | |
against known Juju API types.
if changes_ is not None and not isinstance(changes_, (bytes, str, list)):
raise Exception("Expected changes_ to be a Sequence, received: {}".format(type(changes_)))
if error_ is not None and not isinstance(error_, (dict, Error)):
raise Exception("Expected error_ to be a Error, receive... | |
TensorLayerX
>>> import tensorlayerx as tlx
>>> image = (np.random.rand(224, 224, 3) * 255.).astype(np.uint8)
>>> transform = tlx.vision.transforms.RandomCrop(size=50, padding=10, pad_if_needed=False, fill=0, padding_mode='constant')
>>> image = transform(image)
>>> print(image)
>>> image shape : (70,70,3)
"""... | |
# -*- coding: UTF-8 -*-
# From <NAME>'s iSRb tool
from warnings import warn
import numpy as np
#from skimage.measure import profile_line # toolbox implements its own line profle measurement routine
from scipy.optimize import curve_fit, minimize
from scipy.signal import find_peaks, peak_widths
from time import time
i... | |
<filename>src/hapPyTango/CosNotifyComm_skel/__init__.py
""" Module: IDL:omg.org/CosNotifyComm:1.0
Automagically generated by:-
The ORB called Fnorb v1.1.Return.of.Fnorb
"""
_FNORB_ID = "IDL:omg.org/CosNotifyComm:1.0"
# Fnorb modules.
import Fnorb.orb.CORBA
import Fnorb.orb.TypeManager
import Fnorb.orb.Util
class ... | |
<gh_stars>1-10
import cStringIO
import hashlib
import MySQLdb
import os
import random
import signal
import sys
import threading
import time
import string
CHARS = string.letters + string.digits
def sha1(x):
return hashlib.sha1(str(x)).hexdigest()
# Should be deterministic given an idx
def get_msg(do_blob, idx):
ran... | |
<filename>src/outpost/django/research/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-07 14:08
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
class Migration(migrations.Migration):
initial = True
dependencies =... | |
for x in range(z):#Writes second part
if x == 5:
ROM.write(b'\x0A')
Pointer+=1
ROM.write(CrashBomberReceived[x])
Pointer+=1
ROM.write(b'\x0B')
Pointer+=1
if y == 0: #Checks to see what palette value should be written based on position
Value = (b'\x30')
elif y == 1:
Value = (b'\x31')
eli... | |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
from tqdm import tnrange, tqdm_notebook
import collections
import math
import numpy as np
from collections import defaultdict
import threading
import networkx as nx
import pandas as pd
import operator
def graph_dict():
'''
We first choose to use a dictionary for col... | |
<gh_stars>1-10
from django.http import HttpResponse
from django.template import loader
from django.http import JsonResponse
from django.core import serializers
import json
import sys
import io
from contextlib import redirect_stdout
import OmniDB_app.include.Spartacus as Spartacus
import OmniDB_app.include.Spartacus.D... | |
import time
import uuid
import neat
import uuid
import numpy as np
import vrep.vrep as vrep
import threading
import pickle
from datetime import datetime, timedelta
from vision.tracker import get_marker_object
from robot.vrep_robot import VrepRobot
from utility.path_tracking import follow_path, transform_pos_angle, crea... | |
#!/usr/bin/python
"""
dockECR: open consensus docking and ranking protocol for virtual screening of small molecules
Authors: <NAME>, <NAME>, <NAME> and <NAME>
Please also cite:
<NAME>., <NAME>., <NAME>., & <NAME>. (2019).
Exponential consensus ranking improves the outcome in docking and receptor ensemble docking.
Sci... | |
str]] = (),
) -> operation.Operation:
r"""Creates a new DnsAuthorization in a given project and
location.
.. code-block:: python
from google.cloud import certificate_manager_v1
def sample_create_dns_authorization():
# Create a client
client = certificate_manager_v1.CertificateManagerClient()
# Initialize r... | |
from numpy import random
from model import *
from data import *
from custom_metrics import *
from pre_processing_data import *
from pathlib import Path
import sys
import argparse
import os
import os.path
import glob
import traceback
import math
from datetime import datetime
import pytz
import tensorflow as tf
from ten... | |
s.isSignal(s.schedule[5])
return 1
def testIsCheckpoint():
tr = os.environ.get("THRILLE_ROOT")
assert tr is not None
td = os.path.join(tr, "tests", "fwdrev")
assert os.path.exists(td)
test17 = os.path.join(td, "17.sched")
assert os.path.exists(test17)
s = Schedule(test17)
assert s.getNumberOfCheckpoints() =... | |
by timeOfDayIsUTC.
timeOfDayIsUTC - The time zone or zones of the timeOfDay parameter. When
set to false, which is the default value, the timeOfDay
parameter refers to the time zone or zones in which the
facilities are located. Therefore, the start or end times
of the service areas are staggered by time zone.
tra... | |
Evolve a one dimensional MPS, MPO or PMPS state using tMPS as described in
the module's documentation.
The initial state, Hamiltonians and certain parameters are required. The
output is a list of times and a list of the evolved states at these times.
Those states might be subsystems of the whole evolved system,
w... | |
<gh_stars>1-10
import pandas as pd
import os
import datetime
import numpy as np
import statsmodels.formula.api as sml
import QUANTAXIS as QA
import datetime
import numpy as np
import statsmodels.formula.api as sml
from QAStrategy.qastockbase import QAStrategyStockBase
import matplotlib.pyplot as plt
import scipy.stat... | |
<filename>translate/translate_base.py
# coding: UTF-8
import re
import lxml.etree
import lxml.html
import html
import json
import os
import sys
import warnings
from collections import defaultdict
from docx import Document
from google.cloud.translate_v2 import Client
from openpyxl import load_workbook
from openpyxl.ce... | |
20000000000000000000000),
("0x4c4e6f13fb5e3f70c3760262a03e317982691d10", 100000000000000000000),
("0x664e43119870af107a448db1278b044838ffcdaf", 400000000000000000000),
("0x8da1178f55d97772bb1d24111a404a4f8715b95d", 878149000000000000000),
("0x5e6e9747e162f8b45c656e0f6cae7a84bac80e4e", 2000000000000000000000),
("0x... | |
result.shape[:2]
bottom = result[row-2:row, 0:col]
bordersize = 5
result_border = cv2.copyMakeBorder(
result,
top = bordersize,
bottom = bordersize,
left = bordersize,
right = bordersize,
borderType = cv2.BORDER_CONSTANT, value = [0,0,0] )
# same as above
row, col= result_clean.shape[:2]
bottom = result_cl... | |
from builtins import str
from past.builtins import basestring
from builtins import object
from django.conf import settings
from django.core.exceptions import FieldError, ValidationError as DjangoValidationError
from django.template.loader import render_to_string
from django.db.models import Q
import re
from rest_fram... | |
"""
*
* Copyright 2010-2020 Australian Signals Directorate
*
* 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 appl... | |
[6.40000000e-02, 6.40000000e-02, 6.03256858e+08, 6.03256858e+08],
[1.30000000e-01, 1.30000000e-01, 1.66572918e+09, 1.66572918e+09]]
target_total_share_000039 = [[3.5950140e+09, 4.8005360e+09, 2.1573660e+10, 3.5823430e+09],
[3.5860750e+09, 4.8402300e+09, 2.0750827e+10, 3.5823430e+09],
[3.5860750e+09, 4.9053550e+09,... | |
(self.name, self.uid)
else:
if self.parent is None:
label = 'index space %s' % hex(self.uid)
else:
label = 'subspace %s' % self.uid
if self.parent is not None:
color = None
for c, child in self.parent.children.iteritems():
if child == self:
color = c
break
assert color is not None
label += ' (color: %s)'... | |
# coding: utf-8
"""
ww contains convenient wrappers around strings. The Most important one is
StringWrapper, that you will mostly use as the "s()" object.
It behaves like unicode strings (the API is compatible),
but make small improvements to the existing methods and add some new
methods.
It doesn't accept byt... | |
import csv
import shutil
import io
import math
import os
import tempfile
import time
from builtins import zip
import pandas as pd
import pytest
from unittest.mock import call, MagicMock
from tests.unit.test_utils.unit_utils import StringIOContextManager
from synapseclient import client, Entity, Synapse
from synapsec... | |
<filename>plugins/helpers/btree.py<gh_stars>1-10
'''
Copyright 2011 <NAME>, <NAME>
Using New BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copy... | |
skillet_output = skillet.execute(jinja_context)
validation_output = skillet_output.get('pan_validation', dict())
# fix for #169 - add validation output to the context
self.save_dict_to_workflow(validation_output)
context['skillet'] = skillet
context['results'] = validation_output
if 'output_template' in skille... | |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# @Version : Python 3.6
import os
import pdb
import json
import argparse
import warnings
from collections import OrderedDict
from functools import total_ordering
from itertools import combinations
import torch
import torch.nn.functional as F
import numpy as np
from skle... | |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
#from Functions import generate_grid_unit
from Functions import generate_grid
'''
TODOs:
- add dice loss
- add mutual information loss
- add mse loss
'''
# neural network module
class Miccai2020_LDR_laplacian_unit_disp_add_lvl... | |
duplicates except for the first occurrence.
- 'last' : Drop duplicates except for the last occurrence.
- ``False`` : Drop all duplicates.
inplace : bool, default ``False``
If ``True``, performs operation inplace and returns None.
Returns
-------
Series or None
Series with duplicates dropped or None if ``inpla... | |
<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import print_function
# stdlib
import itertools
import pdb
import pprint
import time
import unittest
# local
from ..compat import pickle
from ..util import encode_session_payload, int_time, LAZYCREATE_SESSION
from ..exceptions import (
InvalidSession,
InvalidSessi... | |
= _execute.make_str(container, "container")
if shared_name is None:
shared_name = ""
shared_name = _execute.make_str(shared_name, "shared_name")
_inputs_flat = []
_attrs = ("container", container, "shared_name", shared_name)
_result = _execute.execute(b"IdentityReaderV2", 1, inputs=_inputs_flat,
attrs=_attrs, ct... | |
294, 64, 86, 528, 550, 493, 565, 298, 230, 312, 295, 538, 298, 295,
230, 54, 374, 516, 441, 54, 54, 323, 401, 401, 382, 159, 837, 159,
54, 401, 592, 159, 401, 417, 610, 264, 150, 323, 452, 185, 323, 323,
185, 403, 185, 423, 165, 425, 219, 407, 270, 231, 99, 93, 231, 631,
756, 71, 364, 434, 213, 86, 102, 434, 102, 8... | |
<reponame>valerio-vaccaro/seedsigner<filename>src/seedsigner/controller.py
# External Dependencies
import time
from multiprocessing import Process, Queue
from subprocess import call
# Internal file class dependencies
from .views import (View, MenuView, SeedToolsView,SigningToolsView,
SettingsToolsView, IOTestView)
f... | |
1 or rhov <= rho <= rhol:
def funcion(parr):
rho, T = parr
rhol, rhov, Ps = self._saturation(T)
vapor = self._Helmholtz(rhov, T)
liquido = self._Helmholtz(rhol, T)
vu = vapor["h"]-Ps/rhov
lu = liquido["h"]-Ps/rhol
x = (1./rho-1/rhol)/(1/rhov-1/rhol)
return (vapor["s"]*x+liquido["s"]*(1-x)-s,
vu*x+lu*(1-x)-u)
... | |
-435, "mehX": 436, "agX ": -437, "mXlh": -438,
"Xdev": 439, " aSX": -440, "grXt": 441, "UclX": 442, "rIsX": 443,
"OlgX": 444, "Xbid": 445, "rbrX": 446, "hXnk": 447, "Xhek": -448,
"Xssy": -449, "Xtc ": -450, "sn X": 451, "rlyX": 452, "nXkr": -453,
"Xlot": 454, "Xleg": -455, " sXo": 456, "tesX": 457, "Xkyu": 458,
"X... | |
<filename>metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/indexing_commands.py
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for... | |
actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_tensorboard), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = tensorboard.Tensorboard()
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tensorboard.Ten... | |
<filename>scripts/python/catalyst/tests/test_build_isothermal.py
''' Testing of building an isothermal model '''
import sys
sys.path.append('../..')
import unittest
import pytest
from catalyst.isothermal_monolith_catalysis import *
import logging
__author__ = "<NAME>"
_log = logging.getLogger(__name__)
... | |
:param 'EventSourceMappingSourceAccessConfigurationType' type: The type of source access configuration.
:param str u_ri: The URI for the source access configuration resource.
"""
if type is not None:
pulumi.set(__self__, "type", type)
if u_ri is not None:
pulumi.set(__self__, "u_ri", u_ri)
@property
@pulumi.ge... | |
= [";\n".join(row[i::2]) for i in (0, 1)]
table.append((sort, row))
if not table:
if user:
await ctx.send("User is currently not punished.")
else:
await ctx.send("No users are currently punished.")
return
table.sort()
msg += tabulate.tabulate([k[1] for k in table], headers, tablefmt="grid")
for page in pa... | |
# from errors import incorrectinput
incorrectinput = 'INCORRECT SUBNET OR SUBNET MASK DETECTED NULL RETURNED'
# ----------------------------------------------------------------------------
# Module Functions
# ----------------------------------------------------------------------------
def addressing(subne... | |
i_RES_maxpow or i_RES_idleScale dim inconsistent')
#check enb-route map and res-route map
[self.m_EnbNum, self.m_RtNum]=np.shape(self.i_EnbRouteMat)
t=np.shape(self.i_ResRouteMat)
if t[0]!=self.m_ResNum:
raise Exception('Number of resource mismatch for resource-route map')
if t[1]!=self.m_RtNum:
raise Exc... | |
4lT2OMZKpnxc_F1_4yDJFcqb5CiDSmA-psB2k0JtjxAj4UPI61oONK7z
# zFIu4gBfjJCndsZfdvG7h8wGjV98QhrKEnR7xKZ3KCr0_qR1B-gxpNk3
# xWU",
# "tag": "DKW7jrb4WaRSNfbXVPlT5g"
# }
# Figure 149: General JWE JSON Serialization
# Miller Informational [Page 78]
# RFC 7520 JOSE Cookbook May 2015
# The resulting J... | |
import numpy as np
import math
import time
class PulsedProgramming:
"""
This class contains all the parameters for the Pulsed programming on a memristor model.
After initializing the parameters values, start the simulation with self.simulate()
Parameters
----------
max_voltage : float
The max voltage (V) of a... | |
<gh_stars>1-10
"""Support to send and receive Telegram messages."""
from functools import partial
import importlib
import io
from ipaddress import ip_network
import logging
import requests
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
from telegram import (
Bot,
InlineKeyboardButton,
InlineKeyboardMarkup,... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 27 23:08:38 2021
@author: zengke
"""
from sklearn.base import BaseEstimator,TransformerMixin
import numpy as np
import pandas as pd
import warnings
import re
from BDMLtools.base import Base
from BDMLtools.selector.bin_fun import binFreq,binPretty,bi... | |
<reponame>zhengxiawu/XNAS<gh_stars>10-100
import numpy as np
import copy
import time
import torch
from sklearn.ensemble import RandomForestClassifier
import xnas.algorithms.RMINAS.sampler.sampling as sampling
def softmax(x):
"""Compute softmax values for each sets of scores in x."""
return np.exp(x) / np.sum(np.exp... | |
def showToolTips(self):
#self .setToolTip('This GUI is for browsing log messages')
self.box_txt .setToolTip('Window for log messages')
self.but_close .setToolTip('Close this window')
self.but_save .setToolTip('Save current content of the GUI Logger\nin work directory file: '+os.path.basename(self.fname_log))
self.... | |
<filename>herders/models.py
import uuid
from collections import OrderedDict
from math import floor, ceil
from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField, JSONField
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models imp... | |
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. #
# All rights reserved. #
# This file is part of the Masci-tools package. #
# (Material science tools) #
# #
# The code is hosted on GitHub at ht... | |
"""
helper.py
Copyright 2012 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af 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 version 2 of the License.
w3af is distributed in the hope that it will be u... | |
Collision: {}'.format(
arm, rew, col))
if col == 0:
# We care about reward only before starting exploiting/exploring or if we
# are the leader
self.arms_nselected[arm - 1] += 1
self.arms_reward[arm - 1] += rew
self.arms_emp_avg_reward[
arm -
1] = self.arms_reward[arm - 1] / self.arms_nselected[arm - 1... | |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module implements classes for detecting stars in an astronomical
image. The convention is that all star-finding classes are subclasses of
an abstract base class called ``StarFinderBase``. Each star-finding
class should define a method called ``fin... | |
tmp1.ppf = lambda x: np.where((0 <= x) & (x <= 1), 1, 0)
with pytest.raises(ValueError, match="cdf"):
Cont.from_rv(tmp1)
tmp2 = Tmp()
tmp2.cdf = lambda x: np.where((0 <= x) & (x <= 1), 1, 0)
with pytest.raises(ValueError, match="ppf"):
Cont.from_rv(tmp2)
def test_from_rv_options(self):
norm = distrs.norm
# ... | |
#if piece between src and dst, return false
return True
elif(dx==0 and dy != 0):
#move from source x to destination x, ignoring itself (hence the src[1] +- 1)
for y in range(src[0]+dyDir,dst[0],dyDir):
if(board[y][src[1]] != ""):
return False #if piece between src and dst, return false
return True
elif(abs(dy)... | |
<reponame>medialab/bibliotools3.0
#! /usr/bin/env python
"""
Author : <NAME> (http://www.sebastian-grauwin.com/)
Copyright (C) 2012
All rights reserved.
BSD license.
"""
import os
import sys
import glob
import numpy
import argparse
## ##################################################
## #######... | |
<gh_stars>0
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modification... | |
<reponame>ledatelescope/bifrost_tcc_wrapper
#!/usr/bin/env python
# Copyright (c) 2019-2021, The Bifrost Authors. All rights reserved.
# Copyright (c) 2019-2021, The University of New Mexico. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provi... | |
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
"""
packit started as source-git and we're making a source-git module after such a long time, weird
"""
import logging
import os
import shutil
import tarfile
import tempfile
from pathlib import Path
from typing import Optional, Tuple
from g... | |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import base64
import json
import logging
import re
import sys
from datetime import datetime
from functools import wraps
from io import BytesIO
import boto3
import flask
from flask import request, g
from waitress impo... | |
i
f
i
e
r
.
Type `int`. """
self.servicedDate = None
"""
D
a
t
e
o
r
d
a
t
e
s
o
f
s
e
r
v
i
c
e
o
r
p
r
o
d
u
c
t
d
e
l
i
v
e
r
y
.
Type `FHIRDate` (represented as `str` in JSON). """
self.servicedPeriod = None
"""
D
a
t
e
o
r
d
a
t
e
s
o
f
s
e
r
... | |
#%%
############################################################################
# IMPORTS
############################################################################
import pandas as pd
import numpy as np
from utils import model_zoo, data_transformer
import argparse
import pickle
import os
#%%
####################... | |
<reponame>opensafely-core/stata-docker
'''
*! version 1.0.0 06may2019
'''
__all__ = [
"Characteristic", "Data", "Datetime", "Frame", "FrameError",
"Macro", "Mata", "Matrix", "Missing", "Platform", "Preference",
"Scalar", "SFIError", "SFIToolkit", "StrLConnector", "ValueLabel"]
__version__ = '0.1.0'
__author__ = 'S... | |
<filename>build/env/lib/python2.7/site-packages/ipython-0.10-py2.7.egg/IPython/Extensions/ipy_completers.py<gh_stars>10-100
""" Implementations for various useful completers
See Extensions/ipy_stock_completers.py on examples of how to enable a completer,
but the basic idea is to do:
ip.set_hook('complete_command', s... | |
<filename>train.py
import os
import gc
import random
import pprint
import warnings
from six.moves import range
from time import gmtime, strftime
from timeit import default_timer as timer
from torch.autograd import Variable
import torch
import torch.nn as nn
import torch.optim as optim
import torch.optim.lr_scheduler
f... | |
"""Test cases for Chapter 07."""
import unittest
from os import path
from algs.table import DataTable, SKIP
try:
import networkx as nx
except ImportError:
import ch07.replacement as nx
from ch07.dependencies import tkinter_error
class TestChapter7(unittest.TestCase):
def assert_equal_edges(self, e1, e2):
"""Co... | |
<filename>sdk/python/pulumi_azure_nextgen/security/v20150601preview/_inputs.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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 A... | |
action="BUY" if o.isBuy() else "SELL",
exchange=c.exchange,
)
legs.append(leg)
return Bag(
symbol=contractUnderlying,
exchange=useExchange or exchange,
comboLegs=legs,
currency=currency,
)
async def placeOrderForContract(
self,
sym: str,
isLong: bool,
contract: Contract,
qty: float,
price: float,
or... | |
# Copyright (C) 2019-2021, TomTom (http://tomtom.com).
#
# 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 ... | |
<reponame>trisadmeslek/V-Sekai-Blender-tools<gh_stars>0
# GPLv3 License
#
# Copyright (C) 2020 Ubisoft
#
# This program 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 2 of the License, or
# (at... | |
<gh_stars>1-10
import math
import random
from typing import Optional
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
from torch import nn
from transformers.modeling_outputs import (
BaseModelOutput,
BaseModelOutputWithPastAndCrossAttentions,
Seq2SeqModelOutput,
)
from transformers.model... | |
variable value matches the expected type (e.g. string, integer, list, Boolean, etc.)
if type(variable["Value"]) != variable["Expected Type"]:
print(f'The value provided for the {variable["Name"]} variable is not in '
'the correct format.\n'
f'Please provide a value in the {variable["Expected Type"]} format '
... | |
# Copyright 2021 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", WIT... | |
self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class StormTopology:
"""
Attributes:
- spouts
- bolts
- state_spouts
- worker_hooks
- storm_version
- jdk_version
"""
thrift_spec = (
None, # 0
(1, TType.MAP, 'spouts', (TType.STRING,None,TType.STRUC... | |
<reponame>schardong/visual-scenario-reduction
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Application main window plus tests.
"""
import os
import sys
from PyQt5.QtCore import QDir, Qt, QSize
from PyQt5.QtGui import QIntValidator, QPixmap
from PyQt5.QtWidgets import (QApplication, QCheckBox, QComboBox,
QDeskt... | |
int timeout_headers: Defines the timeout (seconds) while waiting for http headers.
Default: `socket_timeout`.
:param int timeout_backend: Defines the timeout (seconds) when connecting to backend instances.
Default: `socket_timeout`.
"""
super().set_connections_params(
**filter_locals(locals(), ['timeout_head... | |
from __future__ import unicode_literals
import frappe
from frappe import scrub
from textwrap import wrap
from frappe.utils import add_to_date, nowdate, nowtime
from datetime import timedelta
from frappe.model.mapper import get_mapped_doc
from frappe.utils import flt
from frappe import _
# from erpnext.accounts.utils ... | |
<reponame>MJJojo97/openslides-backend<gh_stars>0
import builtins
import re
from collections import defaultdict
from copy import deepcopy
from typing import Any, Dict, List, Literal, Optional, Tuple
from datastore.shared.postgresql_backend import SqlQueryHelper
from datastore.shared.util import DeletedModelsBehaviour
... | |
imu0_data.vel[ts_i]
ba_i = np.array([0.0, 0.0, 0.0])
bg_i = np.array([0.0, 0.0, 0.0])
sb_i = speed_biases_setup(ts_i, vel_i, ba_i, bg_i)
sb_i_id = graph.add_param(sb_i)
sb_est.append(sb_i_id)
for ts_idx in range(start_idx + window_size, end_idx, window_size):
# -- Pose j
ts_j = imu0_data.timestamps[ts_idx]
T_... | |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed May 8 17:57:09 2019
@author: xuc1
"""
import io
import os
import re
import zlib
from itertools import compress
import numpy as np
import pandas as pd
import yaml
from .utils.misc import XY2D
this_dir = os.path.dirname(__file__)
cgc_file = os.path.join(this_dir... | |
<reponame>uclahedp/dataView
import sys
import os
from pathlib import Path as pathlibPath
import traceback
#Used for sci notation spinbox
import re
import h5py
import numpy as np
from astropy import units
from scipy import ndimage
from PyQt5 import QtWidgets, QtGui, QtCore
import matplotlib
from matplotlib.backen... | |
"""
Module to allow Plotly graphs to interact with IPython widgets.
"""
import uuid
from collections import deque
from pkg_resources import resource_string
from requests.compat import json as _json
# TODO: protected imports?
from IPython.html import widgets
from IPython.utils.traitlets import Unicode
from IPython.di... | |
<filename>instructor/real_data/catgan_instructor.py
# -*- coding: utf-8 -*-
# @Author : William
# @Project : TextGAN-william
# @FileName : catgan_instructor.py
# @Time : Created at 2019-07-23
# @Blog : http://zhiweil.ml/
# @Description : CatGAN for category text generation
# Copyrights (C) 2018. All Rights Reserved.
im... | |
<filename>atropos/commands/trim/modifiers.py<gh_stars>0
# coding: utf-8
"""This module implements all the read modifications that atropos supports.
A modifier must be callable. It is implemented as a function if no parameters
need to be stored, and as a class with a __call__ method if there are parameters
(or statistic... | |
"""
CCT 建模优化代码
GPU CUDA 加速 cctpy 束流跟踪
注意测试代码中的 ga32 和 ga64 定义为
ga32 = GPU_ACCELERATOR(float_number_type=GPU_ACCELERATOR.FLOAT32)
ga64 = GPU_ACCELERATOR(float_number_type=GPU_ACCELERATOR.FLOAT64,block_dim_x=512)
2021年6月17日 增加 CPU 模式
作者:赵润晓
日期:2021年5月4日
"""
# 是否采用 CPU 模式运行
from packages.beamline import Beamline
from ... | |
<filename>heat/engine/resources/wait_condition.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
#
# Unless required by applicable law or agree... | |
== 3:
self.previewTile[i][j].Visible = False
j = 3
for i in range(0, 3):
self.previewTile[i] += [RichTile(0.75 * self.normalTileDimension)]
y = i * 0.75 * self.normalTileDimension
self.previewTile[i][j].Location = Point(x, y)
self.previewTile[i][j].BackColor = Color.Black
self.p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.