input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
common.assert_isclose(koila.run(a), c),
[
[LazyTensor(arr).min(), arr.min()],
[LazyTensor(arr).min(1)[0], arr.min(1)[0]],
[LazyTensor(arr).min(1)[1], arr.min(1)[1]],
],
)
def test_min_function() -> None:
arr = torch.randn(6, 7, 8)
brr = torch.randn(1, 7, 8)
la = typing.cast(Tensor, LazyTensor(arr))
lb = typ... | |
+ random() * 2) * choice([1, -1])
ball = vector(0, 0)
aim = vector(value(), value())
state = {1: 0, 2: 0}
def move(player, change):
"Move player position by change."
state[player] += change
def rectangle(x, y, width, height):
... | |
u('\u5e7f\u4e1c\u7701\u6cb3\u6e90\u5e02')},
'861581929':{'en': 'Zhaoqing, Guangdong', 'zh': u('\u5e7f\u4e1c\u7701\u8087\u5e86\u5e02')},
'86158193':{'en': 'Zhongshan, Guangdong', 'zh': u('\u5e7f\u4e1c\u7701\u4e2d\u5c71\u5e02')},
'861581930':{'en': 'Zhaoqing, Guangdong', 'zh': u('\u5e7f\u4e1c\u7701\u8087\u5e86\u5e02')... | |
"""Base class for the tidal database models."""
# 1. Standard python modules
from abc import ABCMeta, abstractmethod
from datetime import datetime
import math
# 2. Third party modules
import numpy
import pandas as pd
from pytides.astro import astro
# 3. Aquaveo modules
# 4. Local modules
from .resource import Resour... | |
import logging
from nes.instructions import INSTRUCTION_SET, PyNamedInstruction, AddressModes
#from nes import LOG_CPU
class MOS6502:
"""
Software emulator for MOS Technologies 6502 CPU
References:
[1] https://www.masswerk.at/6502/6502_instruction_set.html
[2] http://www.obelisk.me.uk/6502/addressing.html
[3]... | |
<filename>lib/model/fpn/resnext_IN.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 27 19:14:38 2019
@author: Administrator
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
sys.path.append("../..")
from model.utils.config import... | |
"""Detect all Python scripts in HTML pages in current folder and subfolders.
Generate brython_modules.js, a bundle with all the modules and packages used
by an application.
Generate a Python package ready for installation and upload on PyPI.
"""
import os
import shutil
import html.parser
import json
import traceback
... | |
<filename>code/src/formatting_functions/formatter.py
import glob
import os
import re
import h5py
import logging
from copy import deepcopy
from joblib import Parallel, delayed
import numpy as np
import scipy.io
import scipy.signal
import mne
from ..preprocessing import filtering
class Formatter:
'''
Base class for... | |
from msg import ReqMsg
from cmds import Cmd
class Window(Cmd):
def __init__(self, session):
self._session = session
# Function: window_get_buffer
# Parameters Window: window
# Returns Buffer
# Recieves channel id False
# Can fail True
def get_buffer(self, window):
return self.send_sync(ReqMsg('window_get_b... | |
the between operator the value will be treated as an Array if comma delimited string is passed, and it must contain an even number of values.
:type op_ConfigLocked: String
| ``api version min:`` None
| ``api version max:`` None
| ``required:`` False
| ``default:`` None
:param val_f_ConfigLocked: If op_ConfigLoc... | |
*(dict) --*
Information about a Session Manager connection to an instance.
- **SessionId** *(string) --*
The ID of the session.
- **Target** *(string) --*
The instance that the Session Manager session connected to.
- **Status** *(string) --*
The status of the session. For example, "Connected" or "Terminated"... | |
formatted using
d3-format's syntax %{variable:d3-format}, for example
"Price: %{y:$.2f}". https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format for
details on the formatting syntax. Dates are formatted
using d3-time-format's syntax %{variable|d3-time-
format}, for example "Day: %{2019-01... | |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may ch... | |
= int(len(working_objects[no_of_fractions])/2)
tick_tock = False
else:
lower_idx = int(len(working_objects[no_of_fractions])/2) - 1
upper_idx = -1
tick_tock = True
#print(no_of_fractions, int(ceil(len(working_objects[no_of_fractions])/2)))
obj_start, obj_stop = copy.deepcopy(working_objects[no_of_fractions][low... | |
"""
University of Minnesota
Aerospace Engineering and Mechanics - UAV Lab
Copyright 2019 Regents of the University of Minnesota
See: LICENSE.md for complete license details
Author: <NAME>
Analysis for Thor RTSM
"""
#%%
# Import Libraries
import numpy as np
import matplotlib.pyplot as plt
# Hack to allow loading the... | |
<reponame>andycasey/gap_tellurics
# coding: utf-8
""" Basic functionality to treat spectra as mutable objects. """
from __future__ import division, print_function
__author__ = "<NAME> <<EMAIL>>"
# Standard library
import json
import logging
import os
from shutil import copyfile
# Third-party
import numpy as np
im... | |
bytes_transferred, dst_uri)
def _PerformDownloadToStream(self, src_key, src_uri, str_fp, headers):
(cb, num_cb, res_download_handler) = self._GetTransferHandlers(
src_uri, src_key.size, False)
start_time = time.time()
src_key.get_contents_to_file(str_fp, headers, cb=cb, num_cb=num_cb)
end_time = time.time()
byt... | |
= fmr.TwistToScrew(self.screw_list[:, i])
#Convert TwistToScrew
self.joint_poses_home[0:3, i] = joint_pose_temp; # For plotting purposes
self.end_effector_home = new_end_effector_home
self.original_end_effector_home = self.end_effector_home.copy()
if len(self.link_home_positions) != 1:
new_link_mass_transforms = ... | |
in self.all_text_fields:
attr_input = getattr(batch, name)
embeddings = inv_freq_pool(embed[name](attr_input))
attr_embeddings[name].append(embeddings.data.data)
# Compute the first principal component of weighted sequence embeddings for each
# attribute.
pc = {}
for name in self.all_text_fields:
concatenated ... | |
<reponame>dmort27/kairos-yaml
"""Converts CMU YAML into KAIROS SDF JSON-LD."""
import argparse
from collections import Counter, defaultdict
import itertools
import json
import logging
from pathlib import Path
import random
import typing
from typing import Any, List, Mapping, MutableMapping, Optional, Sequence, Tuple, ... | |
from django import forms
from django.shortcuts import get_object_or_404, render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from django.core.cache import cache
from django.core.context_processors import csrf
from django.core.urlresolvers import reverse
from django.db.models import Avg, Max, M... | |
'''
(c) 2014 <NAME> and <NAME>
Fast block jackknives.
Everything in this module deals with 2D numpy arrays. 1D data are represented as arrays
with dimension (N, 1) or (1, N), to avoid bugs arising from numpy treating (N, ) as
a fundamentally different shape from (N, 1). The convention in this module is for the
first ... | |
# Copyright (c) 2016 by <NAME> and the other collaborators on GitHub at
# https://github.com/rmjarvis/Piff All rights reserved.
#
# Piff is free software: Redistribution and use in source and binary forms
# with or without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributi... | |
<reponame>mcoirad-gmmb/civis-python
from functools import lru_cache
import logging
import warnings
import civis
from civis.resources import generate_classes_maybe_cached
from civis._utils import get_api_key
from civis._deprecation import deprecate_param
log = logging.getLogger(__name__)
RETRY_CODES = [429, 502, 503... | |
from sqlalchemy.sql import and_, func, text
from sqlalchemy.sql.expression import select
from sqlalchemy.orm import aliased, backref, deferred, mapper, relationship, reconstructor
from sqlalchemy.orm.collections import attribute_mapped_collection
from sqlalchemy.ext.hybrid import hybrid_method
try: from rdkit.Chem imp... | |
that all the (required) outputs were actually created and are newer than all input files specified so
far.
If successful, this marks all the outputs as up-to-date so that steps that depend on them will immediately
proceed.
"""
self._become_current()
missing_outputs = False
assert self.step is not None
did_sl... | |
<reponame>thunderhoser/GeneralExam<filename>generalexam/evaluation/object_based_evaluation_test.py
"""Unit tests for object_based_evaluation.py."""
import copy
import unittest
import numpy
import pandas
from gewittergefahr.gg_utils import nwp_model_utils
from generalexam.evaluation import object_based_evaluation as ob... | |
'status': 'Active',
'valueLengthMax': '20',
'valueLengthMin': '1'}]
>>> r = client.discover_and_add_accounts(100000, **{
'Banking Userid': 'direct',
'Banking Password': '<PASSWORD>',
})
>>> r
<AggCatResponse 201>
>>> r.content
<Accountlist object [<Creditaccount object @ 0x10d12d790>,<Loanaccount object @ 0x1... | |
<reponame>Rademacher/ONIX
from .functions import *
import ast
import re
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import os
import onix.data as d
#import pylab
def read_nuclide_reac_rank(nuclide, step, path):
file = open(path, 'r')
lines = file.readlines()
zamid = name_to_zamid(nucl... | |
import itertools
import os
import sys
import threading
import getopt
import time
from threading import Timer
from subprocess import Popen, PIPE
class Setting:
'''
General setting class
rootpath is the directory where the .pv and .pvl files put
'''
rootpath = os.getcwd() + "/"
reg_set_type_row = 4 #indicate whic... | |
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozil... | |
default running in one or more connection multiplexer subprocesses spawned
off the top-level Ansible process.
"""
def on_strategy_start(self):
"""
Called prior to strategy start in the top-level process. Responsible
for preparing any worker/connection multiplexer state.
"""
raise NotImplementedError()
def on... | |
u('\u6c5f\u82cf\u7701\u6cf0\u5dde\u5e02')},
'861811411':{'en': '<NAME>', 'zh': u('\u6c5f\u82cf\u7701\u65e0\u9521\u5e02')},
'861811410':{'en': '<NAME>', 'zh': u('\u6c5f\u82cf\u7701\u65e0\u9521\u5e02')},
'861811419':{'en': '<NAME>', 'zh': u('\u6c5f\u82cf\u7701\u626c\u5dde\u5e02')},
'861811418':{'en': '<NAME>', 'zh': ... | |
# Copyright (C) 2010 Apple Inc. All rights reserved.
#
# 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 copyright
# notice, this list of conditions and the follow... | |
class NativeTypeIndex(object):
def __init__(self):
self.Object:int = 0
self.AnnotationManager:int = 1
self.AssetDatabaseV1:int = 2
self.AssetMetaData:int = 3
self.BuiltAssetBundleInfoSet:int = 4
self.EditorBuildSettings:int = 5
self.EditorExtension:int = 6
self.Component:int = 7
self.Behaviour:int = 8
self.A... | |
components : List[str]
the degree of freedoms to constrain (e.g., '1', '123')
enforced : List[float]
the constrained value for the given node (typically 0.0)
comment : str; default=''
a comment for the card
Notes
-----
len(nodes) == len(components) == len(enforced)
.. warning:: Non-zero enforced deflection r... | |
<filename>Keysight_M8195_AWG/Keysight_M8195_AWG.py
#!/usr/bin/env python
import InstrumentDriver
from VISA_Driver import VISA_Driver
import numpy as np
class Driver(VISA_Driver):
"""This class implements the Keysight M8195
The driver currently only implements operations on extended memory.
"""
# define channel... | |
<gh_stars>0
# script for generate analysis for datasets
import os
import json
from typing import Tuple
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from functools import partial
from utils.data import Dataset
from utils.data import create_adult_dataset, create_bank_data... | |
first two assumptions are checked. The third is not checked
and could cause indexing failures if it is not true.
"""
# check for channels:
if channels is not None:
err = 0
for item in channels:
if item not in dct:
err = 1
print(f"Channel {item} not found in `dct`.")
if err:
raise ValueError(
"`dct` does not... | |
all_data = {'AK': {'Aleutians East': {'population': 3141, 'tracts': 1},
'Aleutians West': {'population': 5561, 'tracts': 2},
'Anchorage': {'population': 291826, 'tracts': 55},
'Bethel': {'population': 17013, 'tracts': 3},
'Bristol Bay': {'population': 997, 'tracts': 1},
'Denali': {'population': 1826, 'tracts': 1},... | |
import numpy as np
inc = [87,7,82,21,47,88,12,71,24,35,10,90,4,97,30,55,36,74,19,50,23,46,13,44,69,27,2,0,37,33,99,49,77,15,89,98,31,51,22,96,73,94,95,18,52,78,32,83,85,54,75,84,59,25,76,45,20,48,9,28,39,70,63,56,5,68,61,26,58,92,67,53,43,62,17,81,80,66,91,93,41,64,14,8,57,38,34,16,42,11,86,72,40,65,79,6,3,29,60,1]
ta... | |
<filename>scripts/ini_editor.py
#!/usr/bin/python
#
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A script to modify dsp.ini config files.
A dsp.ini config file is represented by an Ini object... | |
"""
Inspired by:
1. RLKit: https://github.com/rail-berkeley/rlkit
2. StabelBaselines: https://github.com/hill-a/stable-baselines
3. SpinningUp OpenAI: https://github.com/openai/spinningup
4. CleanRL: https://github.com/vwxyzjn/cleanrl
"""
import os, subprocess, sys
import argparse
import importlib
import datetim... | |
__license__ = """
Copyright (c) 2012 mpldatacursor developers
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, mer... | |
stations = { 'acheng': 'ACB',
'aershan': 'ART',
'aershanbei': 'ARX',
'aihe': 'AHP',
'aijiacun': 'AJJ',
'ajin': 'AJD',
'akesu': 'ASR',
'aketao': 'AER',
'alashankou': 'AKR',
'alihe': 'AHX',
'alongshan': 'ASX',
'amuer': 'JTX',
'ananzhuang': 'AZM',
'anda': 'ADX',
'ande': 'ARW',
'anding': 'ADP',
'angangxi': ... | |
# coding=utf-8
from __future__ import unicode_literals
import io
from copy import deepcopy
from mock import patch
from snips_nlu_utils import hash_str
from snips_nlu.constants import (
DATA, ENTITY, RES_ENTITY, RES_INTENT, RES_INTENT_NAME,
RES_PROBA, RES_SLOTS, RES_VALUE, SLOT_NAME, TEXT, STOP_WORDS)
from snips_nl... | |
%(fail)s
}
break;
case 2: // backprop wrt. inputs
// output is bottom: (batchsize, num_channels, height, width, depth)
// height, width and depth: bottom = (top - 1) * sample + (weights-1)*dil + 1 - 2*pad
out_dim[0] = PyGpuArray_DIMS(top)[0];
out_dim[1] = PyGpuArray_DIMS(weights)[1] * numgroups;
out_dim[2] = (%... | |
of the Jacobian matrix.
If `as_linear_operator` is True returns a LinearOperator
with shape (m, n). Otherwise it returns a dense array or sparse
matrix depending on how `sparsity` is defined. If `sparsity`
is None then a ndarray with shape (m, n) is returned. If
`sparsity` is not None returns a csr_matrix with sha... | |
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import requests
import json
import traceback
from datetime import datetime, timedelta
import time
# Disable insecure warnings
requests.packages.urllib3.disable_warnings() # pylint: disable=no-member
# flake8: noqa
''... | |
Side),
UnaryExpression(Keyword('flagtexture'), Object, String),
UnaryExpression(Keyword('fleeing'), Object, Boolean),
UnaryExpression(Keyword('floor'), Number, Number),
UnaryExpression(Keyword('for'), String, ForType),
UnaryExpression(Keyword('for'), Array, ForType),
UnaryExpression(Keyword('forceatpositionrtd'),... | |
== key.BRACKETLEFT:
if self.highlighted_cell_one > 1:
self.highlighted_cell_one -= 1
elif self.highlighted_cell_one == 1:
self.highlighted_cell_one = self.get_max_label()
if self.highlight:
self.update_image = True
# ENTER EDIT MODE
if symbol == key.E:
self.edit_mode = True
# update composite with changes, i... | |
from typing import (
Any,
Callable,
List,
NamedTuple,
Optional,
Tuple,
Type,
Union,
overload,
)
import numpy as np
from scipy import special
Array = Union[np.ndarray]
Numeric = Union[int, float]
# Lists = Union[Numeric, List['Lists']]
Tuplist = Union[Tuple[int, ...], List[int]]
Dim = Union[int, Tuplist]
Arra... | |
<gh_stars>1-10
import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
from scipy.sparse.linalg.eigen.arpack import eigsh
import sys
import tensorflow as tf
import os
import time
import json
from networkx.readwrite import json_graph
from sklearn.metrics import f1_score
import multiproces... | |
<filename>projects/DensePose-Teacher/densepose/engine/trainer.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import imp
import logging
import os
from collections import OrderedDict
from typing import List, Optional, Union
import weakref
from detectron2.engine.defaults import default_writers
... | |
[]
for ((kk,bb),y1) in buildfftup(uu,vv,ff,xx,xxp,xxrr,xxrrp):
for qq in parter(uu,kk,bb,y1):
for (yy,pp) in roller(qq):
for (jj,p) in zip(yy,pp):
if max(p) + 1 < len(p):
ii = list(zip(cart(uu,jj),p))
ll0.append(ii)
ll = []
for (b,ii) in enumerate(ll0):
w = VarPair((VarPair((VarInt(f),VarInt(l))),Va... | |
of enable_validation. When enabled, if both disable_local_accounts and
enable_local_accounts are specified, raise a MutuallyExclusiveArgumentError.
:return: bool
"""
# read the original value passed by the command
disable_local_accounts = self.raw_param.get("disable_local_accounts")
# In create mode, try to read... | |
"""
This module implements basic kinds of jobs for VASP runs.
"""
import logging
import math
import os
import shutil
import subprocess
import numpy as np
from monty.os.path import which
from monty.serialization import dumpfn, loadfn
from monty.shutil import decompress_dir
from pymatgen.core.structure import Structure... | |
0],
# [0, 1, 0, 0, 0],
# [0, 1, 0, 0, 0],
# [0, 1, 0, 0, 0],
# [0, 1, 0, 0, 0]])
#
# is_finite = ad.helper.statistics.is_finite_object(img, is_continuous_image=True)
# assert is_finite == False
#
# is_finite = ad.helper.statistics.is_finite_object(img, is_continuous_image=False)
# assert is_finite == False
#
#
# ######... | |
<reponame>calemen/permafrostanalytics<filename>ideas/eternal_sunshine/christian/resnet.py
#!/usr/bin/env python3
# Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... | |
'\\textnormal{L}', '\\textnormal{C}', '\\tau', \
'\\rho', 'S_0', '\\textnormal{Q}', '\\omega 0']
if len(params_priors) > 1:
fout.write('\\noalign{\\smallskip}\n')
fout.write('Additional parameters{}\n'.format(linend))
fout.write('\\noalign{\\smallskip}\n')
for post in params_priors:
s_param = '~~~'
if post ==... | |
import codecs
import locale
import sys
import logging
import random
import time
import traceback
from optparse import OptionGroup, OptionParser
from typing import List, Tuple
from collections import deque
from operator import itemgetter
from concurrent.futures import ThreadPoolExecutor, wait, ALL_COMPLETED
from clickho... | |
<reponame>chris-price19/cell-mech-memory
#!/usr/bin/python
import math
import numpy as np
import scipy
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
import sys
import re
# import autograd as ag
import torch
from torch.autograd import grad, Variable
from torch.utils.data import Sam... | |
image as a temporary file and return the path
:param path: where temporary files to be stored
:param filename: name(prefix) of the temporary file
:param clean: True if temp files are tobe deleted once the object
is to be destroyed
:param kwargs: used for overloading the PIL save methods. In particular
this method... | |
<gh_stars>0
# -*- coding: utf-8 -*-
'''
saveLoadableOIM.py is an example of a plug-in that will save a re-loadable JSON or CSV instance.
(c) Copyright 2015 Mark V Systems Limited, All rights reserved.
'''
import sys, os, io, time, re, json, csv
from decimal import Decimal
from math import isinf, isnan
from collection... | |
'''
Created on 2020-06-20
@author: wf
'''
import yaml
import io
import json
import jsons
import os
import re
from collections import OrderedDict
from pyparsing import Keyword,Group,Word,OneOrMore,Optional,ParseResults,Regex,ZeroOrMore,alphas, nums, oneOf
# wait for version 3
#from pyparsing.diagram import to_railroad,... | |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Akshita.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui... | |
id(self) -> pulumi.Input[str]:
"""
A relative uri containing either a Platform Image Repository or user image reference.
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: pulumi.Input[str]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def lun(self) -> Optional[pulumi.Input[int]]:
... | |
def setXAxisLogarithmic(self, flag):
"""Set the bottom X axis scale (either linear or logarithmic).
:param bool flag: True to use a logarithmic scale, False for linear.
"""
self._xAxis._setLogarithmic(flag)
def isYAxisLogarithmic(self):
"""Return True if Y axis scale is logarithmic, False if linear."""
return ... | |
import sys
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot as plt
from matplotlib import gridspec
from matplotlib.font_manager import FontProperties
from matplotlib.patches import Rectangle
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.text import Text... | |
<gh_stars>0
from django.contrib.auth.models import User
from django.db import models
# Create your models here.
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
HTTP_CHOICE = (
('HTTP', 'HTTP'),
('H... | |
<filename>CCPD_Demo.py
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.5.2
# kernelspec:
# display_name: Python(comb_demo)
# language: python
# name: comb_demo
# ---
# %% [markd... | |
The string that contains the
System.Windows.Automation.AutomationProperties.ItemStatus that is returned by
System.Windows.Automation.AutomationProperties.GetItemStatus(System.Windows.Depe
ndencyObject).
"""
pass
def GetItemTypeCore(self, *args): #cannot find CLR method
"""
GetItemTypeCore(self: U... | |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
from typing import List
from math import isclose
import collections.abc
import azlmbr.bus as bus
import azlmbr... | |
coordinates loaded into RAM
PARAMS['marked_imgs'] = []
# find the index of the selected image in the new list
n = image_list.index(file_name)
## update the global
PARAMS['index'] = n
# print(" image index = %s, name = %s" % (n, PARAMS['image_list'][n]))
## redraw canvas items with updated global values as the ... | |
sklearn.pipeline import Pipeline
from sklearn.model_selection import GridSearchCV
import matplotlib.pyplot as plt
from .fasta import count_missed_cleavages, count_internal_cleavages
def get_ML_features(df: pd.DataFrame, protease: str='trypsin', **kwargs) -> pd.DataFrame:
"""
Uses the specified score in df to filt... | |
import unittest
from unittest import mock
import os
import yaml
import dbt.flags
import dbt.parser
from dbt.exceptions import CompilationException
from dbt.parser import (
ModelParser, MacroParser, DataTestParser, SchemaParser, ParseResult,
SnapshotParser, AnalysisParser
)
from dbt.parser.schemas import (
Testable... | |
<reponame>mdivband/arcade_swarm<filename>simulation.py
import arcade
from threading import *
import numpy as np
import random
import scipy, scipy.ndimage
import math
import time
from matplotlib import pyplot as plt
import collections
import os
import timeit
import requests
from fps_test_modules import FPSCo... | |
bias group.
"""
_, _, channels, groups = self.get_master_assignment(band)
chs_in_group = []
for i in range(len(channels)):
if groups[i] == group:
chs_in_group.append(channels[i])
return np.array(chs_in_group)
@set_action()
def get_group_number(self, band, ch):
"""
Gets the bias group number of a band, chann... | |
optimal_ra, optimal_dec = -0.2559168059473027, 0.81079526383
time = time_in_each_ifo("H1", optimal_ra, optimal_dec, 0)
light_time = 6371*10**3 / (3.0*10**8)
assert -np.round(light_time, 4) == np.round(time, 4)
ra = np.random.uniform(-np.pi, np.pi, 100)
dec = np.random.uniform(0, 2*np.pi, 100)
time = np.random.un... | |
<reponame>anxhelahyseni/nball4tree
import os
import decimal
from collections import defaultdict
from nltk.corpus import wordnet as wn
from nball4tree.config import DECIMAL_PRECISION
from nball4tree.util_vec import vec_norm
decimal.getcontext().prec = DECIMAL_PRECISION
def create_ball_file(ballname, word2ballDic=dict... | |
canonical order
ignore_empty_rows (:obj:`bool`, optional): if :obj:`True`, ignore empty rows
group_objects_by_model (:obj:`bool`, optional): if :obj:`True`, group decoded objects by their
types
validate (:obj:`bool`, optional): if :obj:`True`, validate the data
Returns:
:obj:`dict`: model objects grouped by :obj... | |
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
import os
import argparse
import csv
import copy
import datetime
import subprocess
import numpy as np
import matplotlib.pyplot as plt
from pymatflow.cmd.structflow import read_structure
"""
Piezoelastic Strain Tensor: IBIRION = 8, LEPSILON = T
Elastic tenso... | |
Screens)
self.mw.resizable(0, 0) #Don't allow resizing in the x or y direction
back = tk.Frame(master=self.mw,bg='Grey')
back.pack_propagate(0) #Don't allow the widgets inside to determine the frame's width / height
back.pack(fill=tk.BOTH, expand=1) #Expand the frame to fill the root window
#Buttons
Stop_OP25 = t... | |
from flask import Flask, render_template, request, jsonify, redirect, url_for, session, flash, Response
from flaskext.markdown import Markdown
from pymongo import MongoClient
from steem import Steem
from datetime import date, timedelta, datetime
from dateutil import parser
from slugify import slugify
import sys, traceb... | |
<reponame>sagieppel/Instance-and-semantic-segmentation-of-materials-phases-and-vessels-in-chemistry-laboratory-
#Reader for the coco panoptic data set for pointer based image segmentation
import numpy as np
import os
import scipy.misc as misc
import random
import cv2
import json
import threading
import random
########... | |
Constraint(expr=m.x1516*(118.743516912 + m.x2036) - m.x3954 == 0)
m.c1517 = Constraint(expr=m.x1517*(54.5829056 + m.x2037) - m.x3955 == 0)
m.c1518 = Constraint(expr=m.x1518*(22.880176696 + m.x2038) - m.x3956 == 0)
m.c1519 = Constraint(expr=m.x1519*(10.749094 + m.x2039) - m.x3957 == 0)
m.c1520 = Constraint(expr=m.x1... | |
"""
test_scope component that checks for errors related to yields in async code.
This does the following three checks:
- yielding the same thing more than once in the same yield
- yielding an async task in a non-async function
- yielding before using the result of the previous yield
"""
import ast
from ast_decompil... | |
value**(0.5)
xleg.append('%s\n%.2f'%(k,value))
ind = np.arange(len(v))
k = 0
p = 0
c = 0
sindx = 0
cv = ColorConverter()
rects1 = list()
rects2 = list()
if (len(v)==2):
pass
for i in range(len(v)):
ind[i]=k
col = colors[c]
rects = self.mpl.axes.bar(k, v[i],color=cv.to_rgb(col))
rects2.append(rects)
... | |
in def_prm:
if type(def_prm[name]) != bool:
add_general_opt_arg(parser, def_prm, name, type=type(def_prm[name]), help_str=help_dict[name])
else:
add_boolean_opt_arg(parser, def_prm, name, help_str=help_dict[name])
# Post-processing
args = parser.parse_args()
args_dict = args.__dict__
# Create a dict of only p... | |
<filename>src/azure-cli/azure/cli/command_modules/acr/manifest.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --... | |
<reponame>MyWay404/WordMaker<gh_stars>0
#!/usr/bin/python3
# Import Modules
try:
import os,sys,time,random,threading,platform,readline,configparser,functools
except Exception as F:
exit("\x1b[1;31m [!] \x1b[0;32m%s"%(F)+"\x1b[0;39m")
# Color
A = "\x1b[1;32m"
B = "\x1b[1;31m"
C = "\x1b[1;33m"
D = "\x1b[1;36m"
E = "\x1... | |
testIntToTFIDFWithoutSmoothing(self):
def preprocessing_fn(inputs):
out_index, out_values = tft.tfidf(inputs['a'], 13, smooth=False)
return {'tf_idf': out_values, 'index': out_index}
input_data = [{'a': [2, 2, 0]},
{'a': [2, 6, 2, 0]},
{'a': [8, 10, 12, 12, 12]},
]
input_metadata = tft_unit.metadata_from_featur... | |
the preceding }')
# If braces come on one side of an else, they should be on both.
# However, we have to worry about "else if" that spans multiple lines!
if Search(r'else if\s*\(', line): # could be multi-line if
brace_on_left = bool(Search(r'}\s*else if\s*\(', line))
# find the ( after the if
pos = line.find('e... | |
delete this lval.
if ccp_attr.value_type == 'integer':
field_val = None
try:
field_val = int(shpfeat['properties'][field_name])
except KeyError:
# Not set in source Shapefile, so just ignore.
pass
except TypeError:
log.warning(
'edited_item_update_item: field not integer: %s / %s'
% (field_name, shpfeat,))
... | |
from selenium import webdriver, common
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import math
import time
import os
import demjson
driver = None
all_pokemon_data = demjson.decode(open('pokemon_data.txt', 'r').read())
own_team = []
opponent_team = [N... | |
<reponame>jalalium/pyccel<filename>tests/pyccel/test_pyccel.py
# pylint: disable=missing-function-docstring, missing-module-docstring/
import subprocess
import os
import shutil
import sys
import re
import pytest
import numpy as np
#==============================================================================
# UTILIT... | |
= None, name = 'conv_8_2') # 500
#features = tl.layers.BatchNormLayer(features, beta_init = w_init, gamma_init = w_init, is_train = is_train, name='bn1')
#feature2 = PReluLayer(feature2, channel_shared = True, name='conv1_2_relu')
#feature3 = Conv1d(sequences, 300, 20, stride = 1, dilation_rate = 4, act = None... | |
#!/usr/bin/env python
#####
#Description reframe the barcode extraction script to do the following.
#1. Improve speed by storing barcodes by position instead of string searching for them.
#2. Support sequence error handling by filtering and correcting barcodes on the fly using hamming distance.
# Filtering this way w... | |
create_dataset(self, force=False, save=True):
data_file = Path('data/data.csv')
t0 = time()
if data_file.is_file() is False or force is True:
self.load()
self.create_order_features()
self.create_product_features()
self.create_user_features()
# print(self._users.shape)
# print(tt_orders.shape)
self._users ... | |
<reponame>gpooja3/pyvcloud
# VMware vCloud Director Python SDK
# Copyright (c) 2018 VMware, 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.