input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
raise IOError('{}: No such directory'.format(dirname))
# Write the file with a header
head = '{}\nWavelength [{}], Flux Density [{}]'.format(name, self.wave_units, self.flux_units)
if isinstance(header, str):
head += '\n{}'.format(header)
t_data = np.asarray(self.spectrum).T
np.savetxt(filepath, t_data, header=h... | |
<reponame>jordiyeh/safrs
#Failed to get col type for columns_priv.Column_priv
#Failed to get col type for event.sql_mode
#Failed to get col type for general_log.user_host
#Failed to get col type for proc.sql_mode
#Failed to get col type for procs_priv.Proc_priv
#Failed to get col type for slow_log.user_host
#Failed to ... | |
import argparse
import os
import random
import shutil
import time
import warnings
import numpy as np
from progress.bar import (Bar, IncrementalBar)
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.o... | |
NotAVerb(Exception):
pass
class NotAWord(Exception):
pass
def _from_idn(self, idn):
"""
Construct a Word from its idn.
:type idn: Number
"""
assert isinstance(idn, Number)
self.lex.populate_word_from_idn(self, idn)
# TODO: Do something with return value?
# NOTE: If this returned True, it already called p... | |
float(x), bbox.split(',')) if bbox!="" else mapExtent,
"mapSize": self.dame_mapserver_size,
"fileName": self.dame_filename,
"mapType": self.tipo_de_mapa,
"metadata": {
"ows_title": unicode(self.dame_titulo).encode('UTF-8'),
"ows_abstract": unicode(self.dame_descripcion.replace('\r\n', ' ')).encode('UTF-8'),
"ows... | |
for project"""
_path = repo.get_project_path()
if not os.path.isdir(_path):
raise click.BadOptionUsage('name', f"Project '{repo.active_project}': Could not find directory '{_path}'")
_l = Task.get_list(_path, repo.active_task)
if not repo.active_project:
output.error(f"No active project selected")
else:
output.... | |
type stringMaxLength30
self.validate_stringMaxLength30(self.addressLine2)
elif nodeName_ == 'addressLine3':
value_ = child_.text
value_ = self.gds_parse_string(value_, node, 'addressLine3')
value_ = self.gds_validate_string(value_, node, 'addressLine3')
self.addressLine3 = value_
self.addressLine3_nsprefix_ = ch... | |
import codecs
from collections import namedtuple
from datetime import datetime, timedelta, timezone
import errno
import fcntl
import html
import os
import pty
import re
from select import select
import shlex
import signal
import tempfile
import traceback
import sublime # type: ignore
import sublime_plugin # type: igno... | |
Constraint(expr= - m.b439 + m.b919 <= 0)
m.c3056 = Constraint(expr= - m.b440 + m.b920 <= 0)
m.c3057 = Constraint(expr= - m.b441 + m.b921 <= 0)
m.c3058 = Constraint(expr= - m.b442 + m.b922 <= 0)
m.c3059 = Constraint(expr= - m.b443 + m.b923 <= 0)
m.c3060 = Constraint(expr= - m.b444 + m.b924 <= 0)
m.c3061 = Constrai... | |
= 0
addButton = QPushButton("+")
addButton.setMaximumSize(25, 25)
addButton.clicked.connect(self._on_add_dynamic_entry)
self.options_layout.addWidget(addButton)
self.count_label = QLabel('0')
self.options_layout.addWidget(self.count_label)
remButton = QPushButton("-")
remButton.setMaximumSize(25, 25)
remButton... | |
"""Initial processing of lib2to3's AST into an easier form.
The AST that lib2to3 produces is messy to process, so we convert it
into an easier format, defined in ast_cooked. While doing this, we
also mark all bindings (Python requires two passes to resolve local
variables, so this does the first pass).
By default, li... | |
# -*- coding: utf-8 -*-
"""The config functions."""
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import atexit
from functools import partial
import json
import os
import os.path as op
import platform
import shutil
import sys
import tempfile
import re
import numpy as np
from .check import _validate_type, _... | |
= np.logical_and(these_t, these_can_adjust)
cNrmNow[these], MPCnow[these] = self.solution[t].cFunc[0][0].eval_with_derivative(self.mNrmNow[these])
if any(these_cant_adjust):
for portfolio_index, portfolio_value in enumerate(self.ShareNow):
these_portfolio = np.equal(portfolio_value, self.RiskySharePrev)
these = n... | |
This will be matched.
children.append(elt)
return Tree(production.lhs().symbol(), children)
def trace(self, trace=2):
"""
Set the level of tracing output that should be generated when
parsing a text.
:type trace: int
:param trace: The trace level. A trace level of ``0`` will
generate no tracing output; and h... | |
> 0 and not panels:
break
ax = axes.ravel()[j]
order_labels = []
for i, n in enumerate(cycle_orders):
z = i / 20
if n not in self.orders_not_excluded and not show_excluded:
# Don't plot orders if we've excluded them
continue
order_label = n if n in [0, 1] else n - 1
if order_label == 0:
order_str = 'LO'
el... | |
running on neighbour device. Thus Interface and MAC
addresses fields could be filled of data without LLDP neighbour
device. Data will be considered as LLDP information is there are
other fields than Interface and MAC addresses are found.
:return: LLDP information of the device
:rtype: dict of list of dict
"""
... | |
from enum import IntEnum
from util import *
class CPU6502_FLAG(IntEnum):
C = (1 << 0)
Z = (1 << 1)
I = (1 << 2)
D = (1 << 3)
B = (1 << 4)
U = (1 << 5)
V = (1 << 6)
N = (1 << 7)
class OP():
def __init__(self, operate, addr_mode, cycles):
self.operate = operate
self.addr_mode = addr_mode
self.cycles = cycl... | |
<reponame>jiangzoi/incubator-tvm
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (... | |
<filename>katcp/test/test_resource_client.py
# Copyright 2014 National Research Foundation (South African Radio Astronomy Observatory)
# BSD license - see LICENSE for details
from __future__ import absolute_import, division, print_function
from future import standard_library
standard_library.install_aliases() # noqa: ... | |
# Watch out for this one! We're not using typical Python 2 floor division in
# this file, but rather floating point division.
from __future__ import division
from math import ceil
from google.appengine.api import namespace_manager
from google.appengine.api import users as app_engine_users
from google.appengine.ext imp... | |
list(
self.labelblocksgroups[0].data.keys() - set(self.keys_ctrl)
)
def fit(
self: Any,
kind: str,
ini: int = 0,
fin: Optional[int] = None,
no_weight: bool = False,
**kwargs: Any
) -> None:
"""Fit titrations.
Here is less general. It is for 2 labelblocks.
Parameters
----------
kind
Titration type {'p... | |
layer (nodes, anchors etc.)
def ObjectInLayer_selected(self):
try:
return self in self.layer.selection
except:
return False
def SetObjectInLayer_selected(self, state):
# Add to selection
if state and self not in self.layer.selection:
self.layer.selection.append(self)
# Remove
elif not state and self in s... | |
worst
and 1 the best score). defaults to false
:returns:
mean_iou : float, the mean intersection over union of the targets and preds array
:example:
>>> from fastdist import fastdist
>>> import numpy as np
>>> true = np.random.RandomState(seed=0).randint(2, size=10000)
>>> pred = np.random.RandomState(seed=1)... | |
<filename>sqlitely/importexport.py
# -*- coding: utf-8 -*-
"""
Functionality for exporting SQLite data to external files.
------------------------------------------------------------------------------
This file is part of SQLitely - SQLite database tool.
Released under the MIT License.
@author <NAME>
@created 21.08.2... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 5 12:42:22 2020
Read NFWF whale and boat observation files and
create Julian Date identifies and detect passbys in whale file.
Then, find corresponding boat observations and
build and save Whale and Boat datastructures for each passbby
@author... | |
<filename>ur5e.py<gh_stars>0
from vrep_api import vrep
import numpy as np
import time
import os
from urx.robot import Robot
import model
import utils
class UR5E(Robot):
def __init__(self):
"""
UR5E Class: Control the Robot
CoppeliaSim(V-rep): vrep-api in Simulation
urx(third party package): urx in Real World
"... | |
series_id = pheno_row_dict["series"]
participant_tuple = (participant_id, series_id)
else:
participant_tuple = (participant_id)
pheno_row_dict[measure] = measure_dict[participant_tuple]
ev_selections["demean"].append(measure)
if "Custom_ROI_Mean" in formula:
# include the means of the specified ROIs as re... | |
labels to network
for item in labels:
network['pore.'+item] = False
network['throat.'+item] = False
# Add connections between parents and clones
if mode == 'parents':
tclone = sp.vstack((parents, clones)).T
extend(network=network, pore_coords=pclone, throat_conns=tclone)
if mode == 'siblings':
ts = network.fin... | |
''' '''
bl_rna = None
''' '''
id_data = None
''' '''
def append(self, draw_func):
'''
'''
pass
def as_pointer(self):
'''
'''
pass
def bl_rna_get_subclass(self):
'''
'''
pass
def bl_rna_get_subclass_py(self):
'''
'''
pass
def draw(self, _context):
'''
'''
pass
def draw_collapsi... | |
<filename>hallucinator/code_rib/bvh_skeleton/humanoid_1205_skeleton.py
from . import math3d # for debug
# from . import math3dkh as math3d # scipy too slow
from . import bvh_helper
# from . import math3dV1 # for debug
import numpy as np
from scipy.spatial.transform import Rotation
class SkeletonConverter(object):
... | |
from .data import CovidData
import datetime as dt
from matplotlib.offsetbox import AnchoredText
import pandas as pd
import seaborn as sns
import geopandas as gpd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
def pan_duration(date):
"""Return the duration in days of the pandemic.
As calcu... | |
shape (n_a, n_x)
Waa -- Weight matrix multiplying the hidden state, numpy array of shape (n_a, n_a)
Wya -- Weight matrix relating the hidden-state to the output, numpy array of shape (n_y, n_a)
b -- Bias, numpy array of shape (n_a, 1)
by -- Bias relating the hidden-state to the output, numpy array of shape (n_y, 1)... | |
bytes]] = None,
fields: typing.Optional[typing.Tuple[typing.Tuple[str, str], ...]] = None,
auth_settings: typing.Optional[typing.List[str]] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
host: typing.Optional[str] = None,
) -> urllib3.HTTPResponse:
# header param... | |
-> None:
with TestClient(app=app, base_url=settings.api_test_url()) as client:
response: requests.Response = client.post(
"/documents",
json={
"email_address": settings.TO_EMAIL_ADDRESS,
"assembly_strategy_kind": "book_language_order",
"resource_requests": [
{
"lang_code": "en",
"resource_type": "tq-wa",
"re... | |
313, 908, 842, 366, 618, 803, 480, 391, 263,
122, 305, 436, 798, 795, 486, 530, 815, 422, 347, 530,
118, 574, 662, 7, 909, 70, 69, 253, 809, 520, 334,
981, 359, 298, 392, 739, 349, 312, 128, 347, 691, 686,
219, 960, 182, 236, 351, 611, 588, 857, 354, 837, 867,
258, 508, 882, 229, 981, 686, 234, 508, 73, 629, 836,
... | |
def check_hostname(self):
return self._check_hostname
@check_hostname.setter
def check_hostname(self, value):
check_hostname = bool(value)
if check_hostname and lib.SSL_CTX_get_verify_mode(self.ctx) == lib.SSL_VERIFY_NONE:
self._set_verify_mode(CERT_REQUIRED)
self._check_hostname = check_hostname
@property
... | |
<gh_stars>1-10
# IDLEX EXTENSION
## """
## Copyright(C) 2011 The Board of Trustees of the University of Illinois.
## All rights reserved.
##
## Developed by: <NAME>
## University of Illinois
##
## Permission is hereby granted, free of charge, to any person obtaining
## a copy of this software and associated documentati... | |
"""
return _casadi.IM_set(self, *args)
def get_nz(self, *args):
"""
get_nz(self, bool ind1, Slice k) -> IM
get_nz(self, bool ind1, IM k) -> IM
"""
return _casadi.IM_get_nz(self, *args)
def set_nz(self, *args):
"""
set_nz(self, IM m, bool ind1, Slice k)
set_nz(self, IM m, bool ind1, IM k)
"""
... | |
<filename>Taxonomie_interface.py
from tkinter import *
from tkscrolledframe import ScrolledFrame
import os
import pathlib
import xml.etree.ElementTree as ET
class TAX_Interface():
def __init__(self, bg_color, button_color, label_color, Button_Font, Label_Font):
self.bg_color = bg_color
self.button_color = button_c... | |
#!/usr/bin/env python
from __future__ import division, absolute_import, print_function
import numpy as np
import scipy.optimize as opt # curve_fit, fmin, fmin_tnc
import jams.functions as functions # from jams
from jams.mad import mad # from jams
import warnings
# import pdb
# -----------------------------------------... | |
Retrieve the information for a specific aggregation account associated with a client. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_aggregation_account_using_get_with_http_info(aggregation_account_id, async_... | |
<gh_stars>0
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import random
import unittest
from collections import namedtuple
from test.multiprocess_tes... | |
import unittest
import datetime
from decimal import Decimal
import pymongo
import gridfs
from mongoengine import *
import mongoengine.connection
from mongoengine.connection import _get_db
from mongoengine.base import _document_registry
mongoengine.connection.set_default_db("test")
class FieldTest(unittest.TestCase)... | |
rv.blit(top, (0, 0), focus=True, main=True)
renpy.display.render.redraw(self, 0)
return rv
class ImageDissolve(Transition):
"""
:doc: transition function
:args: (image, time, ramplen=8, reverse=False, alpha=True, time_warp=None)
:name: ImageDissolve
Returns a transition that dissolves the old scene into the... | |
self.tr("Read Ligand"), '',
# self.tr("PDBQT Files (*.pdbqt);; All files (*)"))
# return filename.encode('ascii', 'replace')
#def getReceptorMapsFilename(self):
# filename, selfilter = QtGui.QFileDialog().getOpenFileName(
# self, self.tr("Read Receptor Maps"), '',
# self.tr("zip Files (*.zip);; All files (*)"))
... | |
<filename>soco_cli/utils.py<gh_stars>10-100
"""Common utilities used across multiple modules."""
import datetime
import logging
import os
import pickle
import signal
try:
import readline
except ImportError:
pass
import sys
from collections.abc import Sequence
from platform import python_version
from time import sle... | |
<filename>pytket/pytket/qasm/qasm.py
# Copyright 2019-2021 Cambridge Quantum Computing
#
# 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
#
# Unles... | |
**red**, **green** and **blue** separately.
"""
),
}
def __init__(self, std: List[Float]):
super().__init__()
self.std = std
def __call__(self, image: torch.Tensor, context: ExpressionContext) -> torch.Tensor:
std = torch.Tensor(context(self.std)).to(image.device)
noise = torch.randn(image.shape).to(image.de... | |
xm = xm - m[n_yi, :][:, np.newaxis]
c[n_yi, :, :] = np.dot(xm, xm.T) / float(ntrl_y[n_yi] - 1)
chc[n_yi, :, :] = np.linalg.cholesky(c[n_yi, :, :])
hcond[n_yi] = np.sum(np.log(np.diagonal(chc[n_yi, :, :]))) + cc * nvarx
# class weights
w = ntrl_y / float(ntrl)
# mixture entropy via unscented transform
# See:
#... | |
<filename>test/api/test_cwl_conformance_required_v1_0.py<gh_stars>0
"""Test CWL conformance for version $version."""
from .test_workflows_cwl import BaseCwlWorklfowTestCase
class CwlConformanceTestCase(BaseCwlWorklfowTestCase):
"""Test case mapping to CWL conformance tests for version $version."""
def test_confo... | |
<reponame>MarcMoylan/BWModProjects
import argparse
import csv
import io
import os
import string
#parse arguments (CSV of paths, BW version (stock, fix, pro)
parser = argparse.ArgumentParser()
parser.add_argument('--csv', help='CSV File containing the paths of the .uc files to parameterize', required=True)
parser.add_a... | |
from shapely.geometry import Point
from shapely.geometry.polygon import Polygon
import os
import pickle
from os import listdir
from os.path import isfile, join
from shapely.ops import cascaded_union
import numpy as np
from datetime import datetime,timedelta
from pytz import timezone
#import folium
from shapely.ops impo... | |
x.str.lower())
A 1
b 2
C 3
d 4
dtype: int64
"""
return super().sort_index(
axis,
level,
ascending,
inplace,
kind,
na_position,
sort_remaining,
ignore_index,
key,
)
def argsort(self, axis=0, kind="quicksort", order=None) -> Series:
"""
Return the integer indices that would sort the Series values.
... | |
<gh_stars>1-10
from __future__ import division, print_function, absolute_import
### THIS SCRIPT IS BASED ON PyTran, WHICH IS PART OF THE COURSEWARE IN
### Pierrehumbert, 2010, Principles of Planetary Climate
###
### MODIFIED BY dkoll
#--------------------------------------------------------
#Description:
# [...]
#
#No... | |
outputs["platform_elem_t"][:nelem] = elem_t
outputs["platform_elem_A"][:nelem] = elem_A
outputs["platform_elem_Asx"][:nelem] = elem_Asx
outputs["platform_elem_Asy"][:nelem] = elem_Asy
outputs["platform_elem_Ixx"][:nelem] = elem_Ixx
outputs["platform_elem_Iyy"][:nelem] = elem_Iyy
outputs["platform_elem_Izz"][:nele... | |
<reponame>sosuperic/sketching-with-language
# segmentation.py
"""
Currently uses trained StrokesToInstruction model to segment unseen sequences.
Usage:
CUDA_VISIBLE_DEVICES=6 PYTHONPATH=. python src/models/segmentation.py -ds progressionpair
"""
import argparse
import copy
from datetime import datetime
import numpy... | |
<reponame>BruceW91/cogdl<filename>cogdl/layers/gcc_module.py
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl.model_zoo.chem.gnn import GATLayer
from dgl.nn.pytorch import NNConv, Set2Set
from dgl.nn.pytorch.conv import GINConv
from dgl.nn.pytorch.glob import Av... | |
if value in visited_sheets:
final = True
else:
final = False
visited_sheets.append(value)
C.add_edge(node,succ)
C.node[succ]['value'] = value
C.node[succ]['label'] = "$%d$"%(value)
C.node[succ]['final'] = final
C.node[succ]['level'] = level+1
C.node[succ]['nrots'] = idx if idx <= n/2 else idx-n
ctr += 1
#... | |
# -*- coding: utf-8 -*-
"""Analysis Pipeline."""
__all__ = [
"Pipeline",
"PipelineResult",
]
##############################################################################
# IMPORTS
# BUILT-IN
import typing as T
import weakref
# THIRD PARTY
import astropy.coordinates as coord
import numpy as np
import typing_e... | |
"""
Author: vigarbuaa
"""
import hashlib
import hmac
import sys
import time
from copy import copy
from datetime import datetime, timedelta
from urllib.parse import urlencode
import pytz
from vnpy.api.rest import Request, RestClient
from vnpy.api.websocket import WebsocketClient
from vnpy.event import Event
from vnpy.... | |
oneup.set_state(-1) if oneup.state == 0 else oneup.set_state(0)
else:
old_state = False
oneup = Oneup(id=uuid4().hex, author=author, parent=self)
self.children.append(oneup)
# Commit 1up
db.session.add(self)
db.session.commit()
app.logger.info("{verb} {obj}".format(verb="Toggled" if old_state else "Added", obj... | |
Preset
:type preset: Union[str, Preset]
"""
preset_list = self.__FormatPresetList(preset)
func_list = []
for preset in preset_list:
func_list.extend([func for func in preset])
self.SelectSpectrumFunctionList(func_list)
def RegisterPreset(self, preset: Preset, is_register=True):
"""Register the presets.
:ty... | |
0)
self.assertEqual(self.op2.get_strategy_count_by_price_type('close'), 3)
self.assertEqual(self.op2.get_strategy_count_by_price_type('open'), 0)
def test_property_strategy_names(self):
""" test property strategy_ids"""
op = qt.Operator('dma')
self.assertIsInstance(op.strategy_ids, list)
names = op.strategy_ids... | |
# coding: utf-8
# # Latent Dirichlet Allocation for Text Data
#
# In this assignment you will
#
# * apply standard preprocessing techniques on Wikipedia text data
# * use GraphLab Create to fit a Latent Dirichlet allocation (LDA) model
# * explore and interpret the results, including topic keywords and topic assign... | |
select_ex: select_text
tool_with_text_input:
tool_id: param_text_option
in:
text_param: select_text
"""
)
with self.dataset_populator.test_history() as history_id:
run_workflow = self._download_workflow(workflow_id, style="run", history_id=history_id)
options = run_workflow["steps"][0]["inputs"][0]["options"]
... | |
# Copyright (c) 2021, <NAME>
# License: MIT License
from typing import Any, List, Dict, Optional
import textwrap
from ezdxf.lldxf.types import (
render_tag,
DXFVertex,
GROUP_MARKERS,
POINTER_CODES,
)
from ezdxf.addons.xqt import QModelIndex, QAbstractTableModel, Qt
from ezdxf.addons.xqt import QStandardItemModel, Q... | |
<filename>dags/itp_audit_dag.py
###########################################################################
#
# Copyright 2020 Google LLC
#
# 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
#
# h... | |
#!/usr/bin/env python
#
# svnrdump_tests.py: Tests svnrdump's remote repository dumping capabilities.
#
# Subversion is a tool for revision control.
# See http://subversion.apache.org for more information.
#
# ====================================================================
# Licensed to the Apache Software Foundat... | |
'xī',
0x72A8: 'chōu',
0x72A9: 'wéi',
0x72AA: 'kuí',
0x72AB: 'chōu',
0x72AC: 'quǎn',
0x72AD: 'quǎn',
0x72AE: 'quǎn,bá',
0x72AF: 'fàn',
0x72B0: 'qiú',
0x72B1: 'jǐ',
0x72B2: 'chái',
0x72B3: 'zhuó,bào',
0x72B4: 'hān,àn',
0x72B5: 'gē',
0x72B6: 'zhuàng',
0x72B7: 'guǎng',
0x72B8: 'mǎ',
0x72B9: 'yóu',
0x72BA... | |
import tensorflow as tf
import pdb
import numpy as np
import os
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
from mpl_toolkits.axes_grid1 import make_axes_locatable
import scipy
import myParams
def getHome():
# return '/home/deni/'
# return '/media/a/f38a5baa-d293-4a00-9f21-ea97f318... | |
<filename>pathplanning/dijkstra.py
#!/usr/bin/env python
'''
BSD 2-Clause License
Copyright (c) 2017, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retai... | |
##
# File: EntityPolymerExtractor.py
# Date: 19-Feb-2019 jdw
#
# Selected utilities to extract entity polymer mapping and feature data
# from the exchange database schema.
#
# Updates:
#
#
##
__docformat__ = "google en"
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__license__ = "Apache 2.0"
import copy
import logging
i... | |
<filename>tests/basic_deployment.py<gh_stars>0
# Copyright 2016 Canonical Ltd
#
# 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 require... | |
FUN = FUN + Data[items[int(o)]]['sym'] + '+'
NAM = NAM + Data[items[int(o)]]['sym'] + '_'
print(' Function ' + FUN + ' is going to be propagated within PPDDM.')
# Parsing and selecting variable dependencies.
fun = parse_expr(FUN, transformations=transformations)
listvar = list(VariableExtractor(FUN))
v = {}; f =... | |
import os
import subprocess
from functools import partial
from pathlib import Path
from typing import Iterable, Union, List, Dict, Optional
import cv2
import tensorflow as tf
import torch
import yaml
from modelci.hub.client.onnx_client import CVONNXClient
from modelci.hub.client.tfs_client import CVTFSClient
from mod... | |
<reponame>cjsteel/python3-venv-ansible-2.10.5<filename>lib/python3.8/site-packages/ansible_collections/netapp_eseries/santricity/plugins/modules/na_santricity_ldap.py
#!/usr/bin/python
# (c) 2020, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ i... | |
each representing a line of the file, with the
last element being empty if the file is terminated with a newline.
"""
for line in lines:
if _SEARCH_C_FILE.search(line):
for category in _DEFAULT_C_SUPPRESSED_CATEGORIES:
_global_error_suppressions[category] = True
def ResetNolintSuppressions():
"""Resets the set... | |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 by <NAME>
import os
import math
import json
import copy
import torch
import logging
import numpy as np
import torch.nn as nn
from tqdm import tqdm
from transformers.data import processors
from transformers.file_utils import is_torch_available
from transformers import glue_... | |
<reponame>nerminsamet/HPRNet
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
from .utils import _gather_feat, _tranpose_and_gather_feat
def _nms(heat, kernel=3):
pad = (kernel - 1) // 2
hmax = nn.functional.max_pool2d(... | |
<gh_stars>0
import argparse
import os
import numpy as np
from tqdm import tqdm
import torch
# from utils.parallel import DataParallelModel, DataParallelCriterion
from modeling.postprocess import LanePostprocess
from apex import amp
from apex.parallel import DistributedDataParallel
from dataloaders import make_data_load... | |
# Copyright (c) 2018-2022 curoky(<EMAIL>).
#
# This file is part of my-own-x.
# See https://github.com/curoky/my-own-x for further info.
#
# 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... | |
<reponame>barryCrunch/cloudvision-python
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
import notification_pb2 as notification__pb2
import router_pb2 as router__pb2
class RouterV1Stub(object):
# missing a... | |
+ 59392 * uk_120
+ 217152 * uk_121
+ 417600 * uk_122
+ 7424 * uk_123
+ 793962 * uk_124
+ 1526850 * uk_125
+ 27144 * uk_126
+ 2936250 * uk_127
+ 52200 * uk_128
+ 928 * uk_129
+ 1623008 * uk_13
+ 64 * uk_130
+ 512 * uk_131
+ 1872 * uk_132
+ 3600 * uk_133
+ 64 * uk_134
+ 4096 * uk_135
+ 14976 * uk_136
+ ... | |
t5_v
station["time_series_dt"] = dt
station["time_series_num_samples"] = num_samples
station["nyquist"] = nyquist
station["luf"] = luf
station["huf"] = huf
station["ufb"] = ufb
station["lup"] = lup
station["hup"] = hup
station["upb"] = upb
station["pga_h1"] = pga1
station["pga_h2"] = pga2
station["pga_v"] ... | |
to a list of spike trains in data. These calls
do not include the statistical testing (for details see the documentation
of spade.spade())
>>> import elephant.spade
>>> import quantities as pq
>>> binsize = 3 * pq.ms # time resolution used to discretize the data
>>> winlen = 10 # maximal pattern length in bins (... | |
1)\
and (range_check(10, -20, phi_dict[resnum_count_dict[count+1]]) == 1)\
and (range_check(10, 154, psi_dict[resnum_count_dict[count+1]]) == 1)
)\
):
return(4)
else:
return(0)
def pp_turn_calc(count):
# returns a different number depending on how many neibghoring residues are E
if (\
(\
(range_check(10, -6... | |
import decimal
import pandas as pd
import datetime
import re
def round_decimal(x, digits=0):
"""This function returns the round up float.
Parameters
----------
x : a float
digits : decimal point
Returns
----------
Rounded up float
"""
x = decimal.Decimal(str(x))
if digits == 0:
return int(x.quantize(deci... | |
<reponame>MartinPdS/PyMieSim
import numpy as np
import matplotlib.pyplot as plt
from PyMieSim.Tools.utils import NA2Angle
from PyMieSim.Tools.units import Area
from PyMieSim.Tools.Directories import *
from mayavi import mlab
from tvtk.tools import visual
from PyMieSim.Tools.utils import Sp2Cart
from PyMieSim.Tools.P... | |
'''VOC and COC Dataloader for Object Detection'''
import glob
import json
import torch
import numpy as np
from sys import stderr
from PIL import Image
from PIL import ImageDraw
from contextlib import contextmanager
from xml.etree import ElementTree as ET
from torch.utils.data import Dataset, DataLoader
try:
from .uti... | |
import os
import copy
from uuid import uuid4
import shutil
import random
import logging
from foresite import utils, Aggregation, AggregatedResource, RdfLibSerializer
from rdflib import Namespace, URIRef
from django.db import models
from django.core.files.uploadedfile import UploadedFile
from django.contrib.contenttyp... | |
<reponame>jfcoz/azure-cli
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ------------------------------------------... | |
<reponame>caiorss/m2py<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import __xsteam__ as xst
def tsat_p(p):
"""
Saturation Temperature as function of Pressure [kPa]
:param p:
:return:
"""
global fromSIunit_T
# Kpa to MPa
p = p / 1000.0
if 0.000611657 < p < 22.06395:
out = xst.fro... | |
<reponame>russellromney/dash-brain<filename>brain_plasma/brain.py
import traceback
from typing import ByteString, Iterable
import hashlib
from pyarrow import plasma
import os
import random
import string
import time
from .brain_client import BrainClient
from .exceptions import (
BrainNameNotExistError,
BrainNamespace... | |
urllib.request.urlopen(createEntityURL)
createResponse2 = urllib.request.urlopen(createEntityURL)
except urllib.error.URLError as e:
testResult = False
notes = e.reason
except Exception as e:
testResult = False
createResponseJson1B = createResponse1.read()
createResponseJson2B = createResponse2.read... | |
<filename>ocr/ocr_crnn_training.py
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/05_ocr_crnn_training.ipynb (unless otherwise specified).
__all__ = ['PAD', 'PAD', 'DATA_PATH', 'crnn_config', 'allowed_chars', 'allowed_fonts', 'TextlineProcessor',
'TextlineAndFont', 'one_hot_text', 'decode_single_ctc', 'decode_ctc', ... | |
import os
import sys
import re
import time
import yaml
import fileinput
import distutils.spawn
from git import Repo
import mysql.connector
import colorama
from colorama import Fore, Style
from mysql.connector import Error, errorcode
from migrations import spell_blobs_to_spell_table
from migrations import unnamed_flags
... | |
<reponame>Wenhao-Yang/DeepSpeaker-pytorch
#!/usr/bin/env python
# encoding: utf-8
"""
@Author: yangwenhao
@Contact: <EMAIL>
@Software: PyCharm
@File: test_accuracy.py
@Time: 19-8-6 下午1:29
@Overview: Train the resnet 10 with asoftmax.
"""
from __future__ import print_function
import argparse
import os
import sys
impor... | |
use:
* 'system': this account is associated directly with the bot (in bots.cfg),
and can be used at any time (when running a task or not).
* 'task': this account is associated with the task currently executing on
the bot, and may be used only when bot is actually running this task.
The flavor of account is specif... | |
list of the time derivatives for q, stored
# in order from present to the past
def ab_blend(dqdt,order):
if order==1:
return dqdt[0]
elif order==2:
return 1.5*dqdt[0]-.5*dqdt[1]
elif order==3:
return (23*dqdt[0]-16*dqdt[1]+5*dqdt[2])/12.
else:
print("order", order ," not supported ")
# In[5]:
def advect(q,... | |
boolean indicating if the buffer data should be updated even
if `scan_time` is <= that in the database.
"""
self._acquire_lock()
try:
# TODO: Canonicalize path (or assert that it is canonicalized)
dir, base = split(buf.path)
# Get the current data, if any.
res_index = self.load_index(dir, "res_index", {})
res... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.