input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
headers that you use to request news and the JSON response objects that
contain them. For examples that show how to make requests, see `Searching the web for news
<https://docs.microsoft.com/en-us/bing/bing-news-search/overview>`_.
:param x_bing_apis_sdk: Activate swagger compliance.
:type x_bing_apis_sdk: str or ... | |
of app streams
under the property with Id 123: "properties/123".
page_size (int):
The maximum number of resources to return.
If unspecified, at most 50 resources will be
returned. The maximum value is 200; (higher
values will be coerced to the maximum)
page_token (str):
A page token, received from a previous
`... | |
import unittest, math
from eventregistry import *
from eventregistry.tests.DataValidator import DataValidator
class TestQueryArticles(DataValidator):
def createQuery(self):
conceptUri = self.er.getConceptUri("Obama")
self.assertTrue(conceptUri != None)
q = QueryArticles(conceptUri = conceptUri)
return q
def... | |
None):
if outattrorder is None:
outattrorder = ["id", "terrain", "probability", "properties",
"image", "animation"]
return super(TiledTile, self).write_xml(outattrorder)
def write_json(self):
dic = {}
if self.probability is not None:
dic.update({"probability" : self.probability})
if self.terrain is not None:
... | |
* sigma ** 2))
S = yAwareAlignmentUniformity.discrete_kernel(y1[:, 1].reshape(-1, 1), y2[:, 1].reshape(-1, 1))
return rbf * S
@staticmethod
def discrete_kernel(y1, y2):
"""
:param y1: matrix shape [N, *]
:param y2: matrix shape [N, *]
:return: matrix M shape [N, N] where M[i][j] = 1({y1[i] == y2[j]})
"""
M =... | |
import os
from sqlalchemy.orm import sessionmaker, declarative_base, relationship
from sqlalchemy import create_engine, Column, Integer, Float, String, ForeignKey, Boolean, ARRAY, and_, CheckConstraint, DateTime, Time, Table
user = os.environ['USER']
password = os.environ['PASSWORD']
postgres_host = os.environ['POSTG... | |
(1, 2, 0)))
if self.transform is not None:
img = self.transform(img)
if self.target_transform is not None:
target = self.target_transform(target)
return img, target
def __len__(self):
return len(self.data)
def download(self):
md5 = self.split_list[self.split][2]
download_url(self.url, self.root, self.fil... | |
controls.
- **Parameters** *(dict) --*
A description of the parameters for a document.
- *(string) --*
- *(list) --*
- *(string) --*
- **AssociationId** *(string) --*
The association ID.
- **Targets** *(list) --*
The instances targeted by the request.
- *(dict) --*
An array of search criteria that t... | |
<reponame>pbs/django-cropduster
import datetime
import unittest
import os
import hashlib
import shutil
import uuid
from django.conf import settings
PATH = os.path.split(__file__)[0]
from django.db import models
from django.core.files.base import ContentFile
from django.core.exceptions import ObjectDoesNotExist as DNE... | |
(4, 9), (3, 9), (2, 9), (1, 9), (1, 8), (2, 8), (2, 7), (2, 6), (2, 5), (2, 4), (2, 3), (1, 3)]],
'J': [[(0, 3), (1, 3), (1, 4), (0, 4)], [(0, 8), (1, 8), (2, 8), (3, 8), (3, 7), (3, 6), (3, 5), (3, 4), (3, 3), (4, 3), (4, 4), (4, 5), (4, 6), (4, 7), (4, 8), (5, 8), (5, 9), (4, 9), (3, 9), (2, 9), (1, 9), (0, 9)], [(1... | |
rename_broken=True)
ofA = "out/A"
def write_A():
write(ofA, read(temp_file))
fgjob = ppg.FileGeneratingJob(ofA, write_A)
fgjob.depends_on(temp_job)
try:
ppg.run_pipegraph()
raise ValueError("should not be reached")
except ppg.RuntimeError:
pass
assert not (os.path.exists(temp_file))
assert os.path.exists(... | |
the AMI specified in the Launch Template.
"""
return pulumi.get(self, "ami")
@property
@pulumi.getter
def arn(self) -> pulumi.Output[str]:
"""
The ARN of the instance.
"""
return pulumi.get(self, "arn")
@property
@pulumi.getter(name="associatePublicIpAddress")
def associate_public_ip_address(self) -> pulu... | |
GroupSemidirectProduct.__init__(self, E.exp_lattice(), E.classical_weyl(), twist = twist, act_to_right=False, prefix0=E._prefixt, print_tuple = E._print_tuple, category=E.Realizations())
self._style = "PW0"
def _repr_(self):
r"""
A string representing ``self``.
EXAMPLES::
sage: ExtendedAffineWeylGroup(['A',4,2... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pytest
from base64 import b64decode
from cs import CloudStackApiException
from datetime import datetime, timedelta
from time import sleep
from exoscale.api import ResourceNotFoundError
from exoscale.api.compute import *
from .conftest import _random_str
class Tes... | |
= 3
oe.T_IMAGE = 0.0
oe.T_SOURCE = 1.0
beam.traceOE(oe, 171)
pos = calculate_stats(pos, oe)
oe = Shadow.OE()
oe.DUMMY = 1.0
oe.set_empty(ALPHA=0)
oe.FWRITE = 3
oe.T_IMAGE = 0.0
oe.T_SOURCE = 1.0
beam.traceOE(oe, 172)
pos = calculate_stats(pos, oe)
oe = Shadow.OE()
oe.DUMMY = 1.0
oe.set_empty(ALPHA=0)
oe.FWRITE = 3
oe... | |
import json
import sys
import os
import re
import tempfile
import traceback
import backend.barista.caffe_versions as caffeVersions
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtGui import QPixmap, QIcon, QTransform
from PyQt5.QtWidgets import QStyle, QMessageBox
from back... | |
2 * F * r2 / G ** 3
s = (1 + c + np.sqrt(c ** 2 + 2 * c)) ** (1 / 3)
P = F / (3 * (s + 1 / s + 1) ** 2 * G ** 2)
Q = np.sqrt(1 + 2 * e2 ** 2 * P)
t1 = -(P * e2 * r) / (1 + Q)
t2_1 = self.a ** 2 * (1 + 1 / Q) / 2
t2_2 = P * (1 - e2) * z2 / (Q * (1 + Q))
t2_3 = P * r2 / 2
rad_val = t2_1 - t2_2 - t2_3
if rad_val... | |
care
self.assertSetEqual(answer_flags, set(to_bytes(f) for f in expected_flags))
base_flags = ['abc', 'def']
_flagtest(self.client.set_flags, [base_flags], base_flags)
_flagtest(self.client.get_flags, [], base_flags)
_flagtest(self.client.add_flags, ['boo'], base_flags + ['boo'])
_flagtest(self.client.remove_fla... | |
#!/usr/bin/env python
# -------------------------------------------------------------
# Kerala Quiz - A Telegram Bot for playing quiz in communities.
# @author: <NAME> zume
# @github: https://github.com/zume2020
# license: MIT
# -------------------------------------------------------------
import os
import logging
im... | |
<filename>src/util.py
from collections import defaultdict, Counter
import numpy as np
import operator
import random
import argparse
import scipy
from scipy.stats import spearmanr, kendalltau
import math
def save_submission(file_path, prediction, data, method, prediction_type):
""" prediction: [n, num_tags]
data: [n... | |
values must be able to fit in data type for out."""
out = np.zeros(DEFAULT_SHAPE, dtype=np.uint8)
with pytest.raises(ValueError):
rasterize([(basic_geometry, 10000000)], out=out)
def test_rasterize_missing_out(basic_geometry):
"""If both out and out_shape are missing, should raise exception."""
with pytest.raise... | |
appropriate.
if var in self.variables and self._metadata_matches(self.variables.get('metadata', dict())):
return self.variables[var]
# load quantities.
val = load_fromfile_quantities(self, var, panic=panic, save_if_composite=False)
if val is None:
val = load_quantities(self, var, PLASMA_QUANT='',
CYCL_RES='', ... | |
from tkinter import *
from tkinter import ttk
from client import *
from api import *
import _thread as thread
from tabela import Table
from raceTable import RaceTable
#As funções abaixo são responsáveis por transitar entre as telas, sendo acionadas pelos
#botões "Voltar" e "Avançar"
def rfid_carros():
screen1.pack_fo... | |
<reponame>zorlubirhat/natural-language-processing-ngram-language-models
import random
from string import punctuation
import math
from collections import OrderedDict
import re
# TRAIN AND TEST FILES
hamilton_train_files = ['1.txt', '6.txt', '7.txt', '8.txt', '13.txt', '15.txt', '16.txt', '17.txt', '21.txt',
'2... | |
<filename>cgnal/core/data/model/ml.py
"""Module for specifying data-models to be used in modelling."""
import sys
from abc import ABC
from typing import (
Union,
Sequence,
Optional,
TypeVar,
Generic,
List,
Tuple,
Any,
Type,
Dict,
Iterator,
overload,
)
import numpy as np
import pandas as pd
from pandas imp... | |
<gh_stars>100-1000
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# Se... | |
# Copyright: (c) 2021, <NAME>
from __global__ import *
import numpy as np
import pycuda.driver as cuda
from pycuda.compiler import SourceModule
import lib
from lib import cufft
import time
import logging
import os
import scipy
from enum import Enum
log = logging.getLogger(LOG_NAME+'.'+__name__)
# log.setLevel(loggin... | |
<reponame>berland/resqpy
import pytest
import os
import numpy as np
import resqpy.model as rq
import resqpy.grid as grr
import resqpy.fault as rqf
import resqpy.derived_model as rqdm
import resqpy.olio.transmission as rqtr
def test_fault_connection_set(tmp_path):
gm = os.path.join(tmp_path, 'resqpy_test_fgcs.epc')... | |
import glob
import os
import re
import cv2
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from keras.models import load_model
from sofi_extraction.img_utils import resize_keep_aspect
from img_segmentation.image_gen import ImageGenerator
from img_segmentation.utils import load_images, f1_loss, ... | |
potential numerical issues.
:param epsilon:
Magnitude of the entries added to the diagonal of M in order to fix potential numerical issues.
"""
super().__init__()
self.use_double_precision = use_double_precision
self.with_logits = with_logits
self.bce_weight = bce_weight
self.stride = stride
self.downsampling... | |
"""
Unit tests for the puzzle application.
All tests run under the standard Django framework 'manage.py test'.
Unit test functions must start with 'test_' to be automatically detected.
"""
from datetime import timedelta, datetime
from django.test import TestCase
from django.utils import timezone
from django.urls impo... | |
def set_origin(self, point):
angle = -radians(self.last_angle)
orig = self.origin
s = sin(angle)
c = cos(angle)
# normalize (translate point so origin will be 0,0)
dx = point[0] - orig[0]
dy = point[1] - orig[1]
# un-rotate point
xnew = dx * c - dy * s
ynew = dx * s + dy * c
# translate poin... | |
<reponame>AndrewGibbs/vines<gh_stars>1-10
from numba import njit, prange
import numpy as np
def generatedomain(res, dx, dy, dz):
# Get minimum number of voxels in each direction
nx = np.int(np.max((1.0, np.round(dx / res))))
ny = np.int(np.max((1.0, np.round(dy / res))))
nz = np.int(np.max((1.0, np.round(dz / re... | |
values are specified
by keyword argument names and values.
{{value match}}
The special value of `None` selects any construct that
has that property, regardless of the construct's
property value.
If no properties are provided then all constructs that
do or could have CF properties, with any values, are
select... | |
import numpy as np
import scipy.signal as signal
import ecogdata.util as ut
from ecogdata.expconfig.exp_descr import StimulatedExperiment
import ecogdata.parallel.array_split as array_split
def _auto_level(ttl, verbose=False):
"""Iteratively refine an estimate of the high-level cluster
of points in a TTL signal.
... | |
# -*- coding: utf-8 -*-
#-------------------------------------------------
#-- freecad wrapper for pyflow
#--
#-- microelly 2019
#--
#-- GNU Lesser General Public License (LGPL)
#-------------------------------------------------
import os
import sys
import json
os.environ["QT_PREFERRED_BINDING"] = os.pathsep.join([ "... | |
<gh_stars>1-10
import sqlite3 as lite
import os
import shutil
import logging
import numpy as np
import cv2
import re
from PyQt5 import QtCore, QtGui, QtWidgets
class VideoLoadError(Exception):
""" Exception class for video loading problems """
pass
class VideoLoadVideoNotFound(Exception):
""" Exc... | |
#!/usr/bin/env python
# coding: utf-8
# <h1>Table of Contents<span class="tocSkip"></span></h1>
# <div class="toc"><ul class="toc-item"><li><span><a href="#Basic-Data-Types" data-toc-modified-id="Basic-Data-Types-1"><span class="toc-item-num">1 </span>Basic Data Types</a></span></li></ul></div>
# <!--BOOK_... | |
import numpy as np
import scipy.special as ss
from scipy.optimize import root_scalar
from scipy import integrate
from csr2d.core2 import psi_x0, psi_s, Es_case_B, Fx_case_B_Chris, Es_case_A, Fx_case_A, Es_case_C, Fx_case_C, Es_case_D, Fx_case_D, psi_s_case_E, Es_case_E
from csr2d.core2 import alpha_exact_case_B_br... | |
independently to create a holonomic drive
system. A holonomic system is one where number of degrees of freedom in the system is equal to the number of
directly controllable degrees of freedom, so for a chassis intended to move in two dimensions the degrees of freedom
are two axes of translation and one of rotation. ... | |
<gh_stars>1-10
"""
This file contains helper functions for using CNNs with pytorch
"""
# Helper function to read Dicom images
# Arguments:
# im_path: the path to the image to be read
#
# Returns:
# Image as a numpy array with dimension 3
def readDicom(im_path):
import numpy as np
import SimpleITK as sitk
im = si... | |
def test_build_ca_request_with_ec(self, backend):
_skip_curve_unsupported(backend, ec.SECP256R1())
private_key = ec.generate_private_key(ec.SECP256R1(), backend)
request = x509.CertificateSigningRequestBuilder().subject_name(
x509.Name([
x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, u'Texas'),
])
).add_ext... | |
value = lines[i].split("\n")[0].split("#")[0].split("=")[1].split()
input_dat_params[key] = value
else:
pass
#
# if xxx is alraedy in input_dat_params(set from --input_dat_params) and args.xxx is None
# input_dat_params[xxx] will not be control by args.xxx
input_dat_params["SystemName"] = args.systemname ... | |
"metadataonly",
("prop", "1923:51"): "metadataonly",
("prop", "1923:52"): "metadataonly",
("prop", "1923:53"): "metadataonly",
("prop", "1923:54"): "metadataonly",
("prop", "1923:55"): "metadataonly",
("prop", "1923:56"): "metadataonly",
("prop", "1923:57"): "metadataonly",
("prop", "1923:58"): "metadataonly",
... | |
"""Model inputs to run PyGEM"""
# Built-in libraries
import os
# External libraries
import pandas as pd
import numpy as np
#%% Functions to select specific glacier numbers
def get_same_glaciers(glac_fp):
"""
Get same 1000 glaciers for testing of priors
Parameters
----------
glac_fp : str
filepath to where netc... | |
new one by clicking link 'Add Beneficiaries'.": 'إذا كنت لا ترى المستفيد في القائمة، يمكنك إضافة واحدة جديدة بالنقر على رابط "أضف المستفيدين.',
"If you don't see the Cluster in the list, you can add a new one by clicking link 'Add New Cluster'.": 'إذا كنت لا ترى الكتلة في القائمة، يمكنك إضافة واحدة جديدة بالنقر على را... | |
res.sort('id')
assert len(res) == 3
assert res.column_names() == ['id', 'val']
assert res.column_types() == [int, str]
assert res[0] == {'id': 1, 'val': 'a'}
assert res[1] == {'id': 2, 'val': 'b'}
assert res[2] == {'id': 3, 'val': 'c'}
def test_read_parquet_bool(self):
t = XFrame({'id': [1, 2, 3], 'val': [True... | |
data: (axis, data[axis+'speed_integ']*100)],
colors3[2:3], [axis_name+' Rate Integral '+rate_int_limit])
data_plot.change_dataset('vehicle_attitude_groundtruth')
data_plot.add_graph([lambda data: (axis+'speed', np.rad2deg(data[axis+'speed']))],
[color_gray], [axis_name+' Rate Groundtruth'])
plot_flight_modes_backg... | |
'''
[diagnostics_vars.py]
Handles data requirements specifications for visualization globAcc project simulation results. Note: spherical_polar coordinates only!
Author: <NAME>, <EMAIL>
'''
import numpy as np
exec(open("./diagnostics_header.py").read())
def identity (x):
return x
def SQR (x):
return x*x
# Account f... | |
def __str__(self):
gself = self._round(2,0)
return "({1.real:+.{0}f}({2}){1.imag:+.{0}f}({3})j)".format(
gself.precision,
gself.x,
gself.re_u_digits,
gself.im_u_digits
)
#------------------------------------------------------------------------
def sensitivity(self,x):
"""
The partial derivatives with resp... | |
cell == "ABalaaaal":
# print cell, specificDict[cell], generalDict[cell], classDict[cell]
# pdb.set_trace()
print "Ascendants cutoff:", cutAscendants
# define output files:
assayedfile = expressionpath + "mapcells_" + expression_flag + option.name + "_expression_assayed"
startedfile = expressionpath ... | |
<filename>flask.py
# -*- coding: utf-8 -*-
"""
flask
~~~~~
A microframework based on Werkzeug. It's extensively documented
and follows best practice patterns.
:copyright: (c) 2010 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import os
import sys
from threadi... | |
<gh_stars>10-100
# -*- coding: utf-8 -*-
"""The GUI of the data loading module of easylearn
Created on 2020/04
@author: <NAME>
Email:<EMAIL>
GitHub account name: lichao312214129
Institution (company): Brain Function Research Section, The First Affiliated Hospital of China Medical University, Shenyang, Liaoning, PR Chi... | |
from math import cos, sin, atan2
from lib.utility import gravitational_constant, pi, range_setter, time_difference
from datetime import datetime as dt
import json
from functools import lru_cache
class Focus:
"""Object around which satellite will orbit"""
name: str
mass: float
satellite_list: list
def __init__(s... | |
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [x86_const.py]
# X86 registers
X86_REG_INVALID = 0
X86_REG_AH = 1
X86_REG_AL = 2
X86_REG_AX = 3
X86_REG_BH = 4
X86_REG_BL = 5
X86_REG_BP = 6
X86_REG_BPL = 7
X86_REG_BX = 8
X86_REG_CH = 9
X86_REG_CL = 10
X86_REG_CS = 11
X86_REG_CX = 12
X86_REG_DH = 13
X86_REG_DI ... | |
#!/usr/bin/env python3
# biomodel.py
# modeling biography and fiction
# NOTE: this code needs some editing to actually run in the repo.
# Paths need to be changed to point to the copies of allgenremeta
# and subsetmeta in chapter1/metadata, and to point to sourcefiles
# instead of allgenremeta.
# But this is code t... | |
# -*- coding: utf-8 -*-
# author: <NAME>
from __future__ import print_function
import argparse
import bisect
import cProfile
import collections
import csv
import gzip
import itertools
import json
import logging
import math
import os
import os.path
import random
import re
import string
import subprocess as subp
import ... | |
<filename>nlplingo/sandbox/misc/train_test.py
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import codecs
import json
import logging
import os
import pickle
from collections import defaultdict
import numpy as np
from nlplingo.annot... | |
<filename>model/models.py
import sys
sys.path += ['../']
import torch
from torch import nn
from transformers import (
RobertaConfig,
RobertaModel,
RobertaForSequenceClassification,
RobertaTokenizer,
BertModel,
BertTokenizer,
BertConfig,
BertForSequenceClassification,
)
import torch.nn.functional as F
from data... | |
<filename>nar_module/nar/preprocessing/nar_preprocess_cafebiz_2.py<gh_stars>0
import argparse
import glob
import json
import os
import os.path
import re
import sys
from collections import Counter, defaultdict
from datetime import datetime
from os import path
import numpy as np
import pandas as pd
import tensorflow as ... | |
= abs(dists)
ind_pts = dists.argsort()
dists[:] = dists[ind_pts]
pts_new_grid[:, :] = pts_new_grid[:, ind_pts]
pts_new_obj[:, :] = pts_new_obj[ind_pts, :]
pts_new_GCS[:, :] = pts_new_GCS[ind_pts, :]
flg_onsurface, _ = self.graspable.sdf.on_surface(pts_new_grid[:, 0])
if flg_onsurface:
pt_ideal_grid = pts_new_g... | |
<filename>flocker/acceptance/testtools.py
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Testing utilities for ``flocker.acceptance``.
"""
from functools import wraps
from json import dumps
from os import environ
from unittest import SkipTest, skipUnless
from uuid import uuid4
from socket import socke... | |
"""
_prefix = 'spirit-install-instmgr-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.log = None
@property
def _common_path(self):
return '/Cisco-IOS-XR-spirit-install-instmgr-oper:software-install/Cisco-IOS-XR-spirit-install-instmgr-oper:inactive'
def is_config(self):
''' Retu... | |
is None):
raise ValueError("Missing the required parameter `room_id` when calling `get_room_users`")
# verify the required parameter 'account_id' is set
if ('account_id' not in params) or (params['account_id'] is None):
raise ValueError("Missing the required parameter `account_id` when calling `get_room_users`")
... | |
#! /usr/bin/python
# Copyright 2004-2008 <NAME>.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import sys
import _random_
#TODO:
# normal_distribution, cauchy_distribution
# are missed default argume... | |
<reponame>jagapiou/meltingpot
# Copyright 2020 DeepMind Technologies 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | |
import os
import shutil
import sys
class SSHAgentKeyError(Exception):
pass
class SSHAgent:
_myenv = None
def __init__(self, myenv):
self._my = myenv
self._tools = myenv.tools
self._inited = False
self._default_key = None
self.autostart = True
self._DockerFactory = None
self.reset()
def DockerFactory(se... | |
<reponame>qa276390/CenterTrack
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import math
import json
import cv2
import os
from collections import defaultdict
import pycocotools.coco as coco
import pycocotools.mask as mask_utils
import t... | |
""" Base class for simulation objects and their event queues
:Author: <NAME> <<EMAIL>>
:Date: 2016-06-01
:Copyright: 2016-2020, Karr Lab
:License: MIT
"""
from abc import ABCMeta
from copy import deepcopy
from enum import IntEnum
import abc
import heapq
import math
import warnings
from de_sim.config import core
from... | |
r"""
Datatypes for words defined by iterators and callables
"""
#*****************************************************************************
# Copyright (C) 2009 <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public ... | |
writables:
logger.debug('Client is ready for writes, flushing buffer')
self.last_activity = time.time()
# Invoke plugin.on_response_chunk
chunk = self.client.buffer
for plugin in self.plugins.values():
chunk = plugin.on_response_chunk(chunk)
if chunk is None:
break
try:
self.client.flush()
except OSError:
... | |
# 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 Microsoft (R) AutoRest Code Generator.
# Changes may ... | |
= null_evidence
evidences = [prev_evidence]
while keep_going == True:
nwalkers = nwalkers_mult * num_gauss
# generate p0
print('Generating initial positions')
p0 = p0gen(vel_range,num_gauss,data,nwalkers,
seed)
if p0 != []: # assuming p0 didn't fail:
print('Sampling posterior for '+str(num_g... | |
fval_ = self.gds_validate_float(fval_, node, 'vrSalFx')
self.vrSalFx = fval_
elif nodeName_ == 'undSalFixo':
sval_ = child_.text
try:
ival_ = int(sval_)
except (TypeError, ValueError) as exp:
raise_parse_error(child_, 'requires integer: %s' % exp)
ival_ = self.gds_validate_integer(ival_, node, 'undSalFixo')
se... | |
the name of the cluster in which we'll run our
helper tasks
:type clusterName: string
:param yml: the task definition information for the task from our
deployfish.yml file
:type yml: dict
"""
self.clusterName = clusterName
self.ecs = get_boto3_session().client('ecs')
self.commands = {}
self.from_yaml(yml)
s... | |
<filename>modules/skill_map/skill_map_tests.py
# Copyright 2015 Google Inc. 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... | |
"""
satellite_sys = fields["satellite_sys"]
prev_idx = -1
while not satellite_sys:
satellite_sys = cache[prev_idx]["satellite_sys"]
prev_idx -= 1
obs_types = self.header.get("obs_types", dict())
obs_list = obs_types.setdefault(satellite_sys, list())
for field in sorted([f for f in fields if f.startswith("type_... | |
<filename>py_factorio_blueprints/entity_mixins.py
from py_factorio_blueprints.util import (
NameStr, Vector, Color as ColorObj, Condition, obj_set, ControlBehaviorMeta)
from py_factorio_blueprints.exceptions import *
class Base(metaclass=ControlBehaviorMeta):
pass
class BaseMixin(Base):
NR_CONNECTIONS = 1
class... | |
<gh_stars>1-10
#!/usr/bin/env python
"""
Page output and find dimensions of console.
This module deals with paging on Linux terminals and Windows consoles in
a cross-platform way. The major difference for paging here is line ends.
Not line end characters, but the console behavior when the last character
on a line is p... | |
Converter()
>>> # Source dictionary is in metric units
>>> source_dict = {'dateTime': 194758100, 'outTemp': 20.0,\
'usUnits': weewx.METRIC, 'barometer':1015.9166, 'interval':15}
>>> target_dict = c.convertDict(source_dict)
>>> print("dateTime: %d, interval: %d, barometer: %.3f, outTemp: %.3f" %\
(target_dict['dat... | |
import argparse
import os
import random
import yaml
from collections import defaultdict
from enum import IntEnum
from PIL import Image
class FileType(IntEnum):
TRAIN = 0
VALIDATION = 1
TEST = 2
class InputParser:
def __init__(self):
self.parser = argparse.ArgumentParser()
def add_arguments(self, name, defaul... | |
عن تكوينات الخريطة',
'Search Membership': 'البحث عن عضوية',
'Search Offices': 'بحث المكاتب',
'Search Organizations': 'ابحث عن منظمات',
'Search Photos': 'البحث عن صور',
'Search Population Statistics': 'البحث عن الإحصاءات السكانية',
'Search Positions': 'بحث وظائف',
'Search Projections': 'بحث التوقعات',
'Search Re... | |
0, 0, 0, 0],
[792, 62.7, 0, 9999, -9999, 1.0, 100, 1, 62.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[795, 13.6, 0, 9999, -9999, 1.0, 100, 1, 13.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[798, 10.747545, 0, 9999, -9999, 1.0, 100, 1, 319.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[800,... | |
<gh_stars>1-10
from __future__ import annotations
import abc
import enum
import threading
import time
import warnings
import logging
import numpy as np
from typing import Dict, Any, List, Optional, TypeVar, TYPE_CHECKING
from pathlib import Path
from datetime import datetime
import processor.analysis
from processor.... | |
pr_ids = np.array(pr_ids, dtype=int)
pr_authors = np.array(pr_authors, dtype=int)
pr_lines = np.array(pr_lines, dtype=int)
sha_order = np.argsort(merge_shas)
merge_shas = merge_shas[sha_order]
pr_ids = pr_ids[sha_order]
pr_authors = pr_authors[sha_order]
pr_lines = pr_lines[sha_order]
pr_commits = np.zeros_like... | |
env: CylonEnv = None
) -> DataFrame:
"""
sort dataframe based on given columns
Perform distributed sorting on the dataframe.
When DataFrame is sorted in ascending order, After the sorting:
First worker will have the values: [min to smallest(k)]
Second worker will have the values: [smallest(k+1) to smallest(l)]
... | |
<gh_stars>10-100
# 6.0001/6.00 Problem Set 5 - RSS Feed Filter
import feedparser
import string
import time
import threading
from project_util import translate_html
from mtTkinter import Tk, TOP, BOTTOM, RIGHT, END, Text, Button, Frame, \
Label, StringVar, Scrollbar, Y
from datetime import datetime
import pytz
# ---... | |
# Copyright (c) 2018-2019, <NAME> and <NAME>.
#
# Distributed under the 3-clause BSD license, see accompanying file LICENSE
# or https://github.com/scikit-hep/decaylanguage for details.
"""
Submodule with classes and utilities to deal with and parse .dec decay files.
Basic assumptions
-----------------
1) For standa... | |
<reponame>nazrulworld/fhirpath<filename>src/fhirpath/search.py<gh_stars>10-100
# _*_ coding: utf-8 _*_
import logging
import re
from typing import (
TYPE_CHECKING,
Any,
Dict,
List,
Optional,
Pattern,
Set,
Text,
Tuple,
Type,
Union,
cast,
)
from urllib.parse import unquote_plus
from warnings import warn
from... | |
UtilClient.is_unset(request.now_action_executor_id):
body['nowActionExecutorId'] = request.now_action_executor_id
if not UtilClient.is_unset(request.user_id):
body['userId'] = request.user_id
if not UtilClient.is_unset(request.task_id):
body['taskId'] = request.task_id
real_headers = {}
if not UtilClient.is_unse... | |
and v is not None}
header_params = {
"accept": "application/json",
"content-type": "application/json"
}
retry_strategy = self.retry_strategy
if kwargs.get('retry_strategy'):
retry_strategy = kwargs.get('retry_strategy')
if retry_strategy:
return retry_strategy.make_retrying_call(
self.base_client.call_api,... | |
"""
This project lets you practice NESTED LOOPS (i.e., loops within loops)
in the context of SEQUENCES OF SUB-SEQUENCES.
Authors: <NAME>, <NAME>, <NAME>, <NAME>,
<NAME>, <NAME>, <NAME>, their colleagues,
and PUT_YOUR_NAME_HERE.
""" # TODO: 1. PUT YOUR NAME IN THE ABOVE LINE.
import time
import testing_helper
def ... | |
<filename>experiments/scenarios/label_repair.py
from copy import deepcopy
import numpy as np
import pandas as pd
from datascope.importance.common import (
SklearnModelAccuracy,
JointUtility,
SklearnModelEqualizedOddsDifference,
Utility,
compute_groupings,
)
from datascope.importance.shapley import ShapleyImportan... | |
+ 0.08*m.x123*m.x39 + 0.545*m.x129*
m.x45 + 0.08*m.x135*m.x51 + 0.08*m.x147*m.x63 + 0.045*m.x153*m.x69 - m.x45*m.x171 == 0)
m.c87 = Constraint(expr=0.045*m.x94*m.x10 + 0.08*m.x100*m.x16 + 0.045*m.x106*m.x22 + 0.08*m.x124*m.x40 + 0.545*m.x130*
m.x46 + 0.08*m.x136*m.x52 + 0.08*m.x148*m.x64 + 0.045*m.x154*m.x70 - m.x46... | |
FourDBoxExampleWithSliders(ThreeDBoxExampleWithSliders):
CONFIG = {
"n_sliders" : 4,
"center_point" : np.ones(4),
}
def construct(self):
self.list_corner_coordinates()
self.show_16_corner_spheres()
self.show_closest_point()
self.show_real_estate_at_closest_point()
self.reframe_as_inner_sphere_point()
self.co... | |
= None
def update(self, grad, ms):
if self._config.opt_inverse_type == "add":
update = grad / (ms + self._eps)
elif self._config.opt_inverse_type == "pseudo":
condition = tf.greater_equal(ms, self._eps)
update = tf.where(condition, grad / ms, grad)
else:
raise ValueError("opt_inverse_type has invalid value")
... | |
'''
api.py
<NAME>, <NAME>, <NAME>,
10 November 2020
Last update: 23 November 2020
A comprehensive Flask API to support the Lilian Natural Disaster web application.
Endpoints that we have, in the order of code, are:
get_countries() -- line 44,
get_country_ids() -- line 76,
get_disaster_ids() -- line 110,
get_... | |
= Site()
site.names = ['foo', 'bar']
assert site.users == {'names': ['foo', 'bar']}
def test_content_properties():
class Content(object):
meta = {}
content = {}
type = meta_property('type')
name = content_property('name')
value = meta_property('value', default=1)
@name.setter
def name(self, value):
sel... | |
query = {}
if fetch:
query["fetch"] = fetch
return self.get(
f"/api/v6.1.0.3/hubs/{hub}/users/{user}/props", query, {}, None, True
)
def get_hubserver_clock(self):
return self.get("/api/v6.1.0.3/hubserver/clock", None, {}, None, True)
def get_hubserver_dirs(self, path=None, pattern=None):
query = {}
if pa... | |
self.valenceDensityOfStates = 0 #cm^-3
self.intrinsicResistivity = 0 #Ohm-cm
self.opticalPhononEnergy = 0 #eV
self.electronDriftMobility = 0 #cm^2 V^-1 s^-1
self.holeDriftMobility = 0 #cm^2 V^-1 s^-1
self.approxBreakdownField = 0 #V cm^-1
self.thermalConductivity = 0 #W cm^-1 degC^-1
self.thermalDiffusivity = 0 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.