input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
from typing import Callable, Tuple
import numpy as np
def student_id():
"""
Returns a tuple of student's ID and TAU email address.
"""
return '123456789', r'<EMAIL>'
class QuadraticFunction:
"""
Implementation of a quadratice function f(x) = 1/2 * x^T*Q*x + b^T*x
with its gradient and Hessian matrix.
"""
... | |
300
for (sstm, count) in zip(self.sst, range(len(self.sst))):
fullfile = os.path.join(self.file_store, '{:}{:}{:}'.format('particle', str(count + 1), '.dat'))
with open(fullfile, 'w') as out:
frag_count = 1
out.write('{:>12d}\n'.format(frag_count))
out.write('{:>21f}{:>21f}\n'.format(self.temperature, 0))
tmplt... | |
cli_type = get_cfg_cli_type(dut, **kwargs)
if cli_type in ["click", "vtysh"]:
# command = "sonic-clear ip bgp"
command = "clear ip bgp *"
st.config(dut, command, type=cli_type, conf=False)
elif cli_type == 'klish':
command = 'clear bgp ipv4 unicast *'
st.config(dut, command, type=cli_type)
else:
st.error("UNSU... | |
"Values": [
{"FrontEndValue": "Allow",
"BackEndValue": "allow"
},
{"FrontEndValue": "Deny",
"BackEndValue": "deny"
}
]
}
]
def __init__(self,
intersight_api_key_id,
intersight_api_key,
policy_name,
policy_description="",
organization="default",
intersight_base_url="https://www.intersig... | |
import collections
from itertools import chain
from typing import Iterable, List, Mapping, MutableMapping, Optional, Tuple, Union, cast
from adam.language_specific.english.english_integrated_experiment_lexicon import (
INTEGRATED_EXPERIMENT_ENGLISH_LEXICON,
)
from adam.ontology.phase2_ontology import gravitationally_... | |
181,
387,
1075,
3921,
731,
2187,
3335, # 4806
7544,
3265,
310,
313,
3435,
2299,
770,
4134,
54,
3034,
189,
4397,
3082,
3769,
3922,
7545, # 4822
1230,
1617,
1849,
355,
3542,
4135,
4398,
3336,
111,
4136,
3650,
1350,
3135,
3436,
3035,
4137, # 4838
2149,
3266,
3543,
7546,
2784,
39... | |
<gh_stars>10-100
#!/usr/local/bin/python
'''
Training a HyperTree network on CoSTAR Block Stacking Dataset
and cornell grasping dataset for detecting grasping positions.
Author: <NAME>
Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
Small Portions of Cornell Dataset Code Based on:
https://github.com/... | |
to get here is if the search got ENOENT every time.
raise msg
#This is a hack for running duplication on a machine without trusted
# status. We allow for all types of PNFS filesystems to be used.
if intf and getattr(intf, "make_failed_copies", None):
use_path_type = enstore_constants.BOTH
else:
use_path_type = ... | |
<filename>ionoscloud/models/volume_properties.py
# coding: utf-8
"""
CLOUD API
IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts ... | |
<gh_stars>0
import sklearn
import torch
import numpy as np
from torch.utils.data import Dataset, SubsetRandomSampler, Subset
from util.utils import cpuStats
from os import path
from tqdm import tqdm, trange
from util.utils import report_gpumem, cpuStats
from sklearn.preprocessing import StandardScaler, MinMaxSc... | |
'Kuwaiti'
elif doc.one_fm_have_a_valid_visa_in_kuwait:
source_of_hire = 'Local'
if doc.one_fm_have_a_valid_visa_in_kuwait and doc.one_fm_visa_type:
filters['visa_type'] = doc.one_fm_visa_type
filters['source_of_hire'] = source_of_hire
from one_fm.one_fm.doctype.recruitment_document_checklist.recruitment_document... | |
"""A Common Universal Data Structure.
The CUDS object is an ontology individual that can be used like a container. It
has attributes and is connected to other cuds objects via relationships.
"""
import logging
from copy import deepcopy
from uuid import uuid4, UUID
from typing import Any, Dict, Hashable, Iterable, Ite... | |
1
else:
self.item_pool[item.name] = ItemPoolRecord()
def collect_starters(self, state):
for (name, record) in self.starting_items.items():
for _ in range(record.count):
item = ItemFactory("Bottle" if name == "Bottle with Milk (Half)" else name)
state.collect(item)
def pool_replace_item(self, item_pools, ite... | |
check(v, 'userList', list)
for i in v['userList']:
check(i, 'firstname', str)
check(i, 'id', str)
check(i, 'lastname', str)
check(i, 'status', str)
check(i, 'username', str)
@pytest.mark.vcr()
def test_analysis_vulns_trend_tool(sc):
vulns = sc.analysis.vulns(tool='trend', pages=2, limit=5)
for v in vulns:
ass... | |
<filename>src/python/turicreate/toolkits/regression/decision_tree_regression.py
# -*- coding: utf-8 -*-
# Copyright © 2017 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
"""
... | |
to return all possible values
#and overload browser with too much data. This is a version of 'pagination.'
return jsonify(dict(results=record_list[arrayLowerBound:arrayUpperBound], num_entries=(len(record_list)/int(records_per_page))))
else:
return Response('Bad or missing session id.', status=401)
except:
re... | |
<filename>QRegisterConst.py
# built-in package
import os
import sys
import re
# pyside2 package
from PySide2.QtWidgets import QFileDialog, QMessageBox, QProgressDialog
from PySide2.QtCore import Qt, QDir, QCoreApplication
from PySide2.QtSql import QSqlQuery, QSqlQueryModel
from PySide2.QtGui import QColor
# python-do... | |
#!/usr/bin/env python3
# To run this script, I recommend using pipenv to create an isolated Python environment with the
# correct packages so that you do not interfere with other Python projects in your system.
# After installing pipenv, run the following commands from the current folder:
#
# pipenv --python /usr/loca... | |
<filename>src/compas/datastructures/volmesh/volmesh.py<gh_stars>0
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from ast import literal_eval as _eval
from math import sqrt
from copy import deepcopy
from compas.files.obj import OBJ
from compas.g... | |
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------------
# Copyright 2020 VMware, Inc. All rights reserved.
# AUTO GENERATED FILE -- DO NOT MODIFY!
#
# vAPI stub file for package com.vmware.nsx.firewall.
#----------------------------------------------------------------------... | |
from mock import patch, Mock, call, ANY
import tempfile
from django.apps import apps
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.core.files.storage import FileSystemStorage
from django.core.urlresolvers import reverse
from django.http import HttpResponse... | |
def pretty_print(self):
return colored('P0(ell=%1.1f, sf=%1.1f, dim=%s)' % (self.lengthscale, self.output_variance,
','.join([str(x) for x in self.eff_dimensions])), self.depth())
def latex_print(self):
#return 'SE(\\ell=%1.1f, \\sigma=%1.1f)' % (self.lengthscale, self.output_variance)
#return 'SE(\\ell=%1.1f... | |
df[~df.fold.isin(excluded_folds)]
# if not OOD_flag:
val_df = df[df.fold == val_fold]
# else:
# val_df = OOD_df[OOD_df.fold == val_fold]
train_df.reset_index(drop=True, inplace=True)
val_df.reset_index(drop=True, inplace=True)
print(f'The length of the training is {len(train_df)}')
print(f'The length of the va... | |
NameError(
"Operator name %r is already taken "
"(node=%r)." % (
node.name, node))
self.onnx_operator_names.add(node.name)
def rename_onnx_name(self, old_name, new_name):
if new_name in self.variables:
raise RuntimeError(
"Name %r already in variables (%r)." % (
new_name, self.variables[new_name]))
if old_na... | |
<filename>model.py
from typing import Dict
from PySide2.QtCore import Signal, Slot, QObject, QTimer
import cv2, h5py, math
import numpy as np
import matplotlib.pyplot as plt
# YOLOv4 & DeepSORT code is taken from :
# https://github.com/theAIGuysCode/yolov4-deepsort
# deep sort imports
from deep_sort import preproces... | |
<filename>sympy/mpmath/mptypes.py<gh_stars>0
"""
This module defines the mpf, mpc classes, and standard functions for
operating with them.
"""
__docformat__ = 'plaintext'
import re
from string import strip
from operator import gt, lt
from settings import (MP_BASE, MP_ZERO, MP_ONE, int_types, repr_dps,
round_floor, r... | |
list(filter(lambda x: x['name'] == 'TBox' and (x['anglez']>>9) == id, bzs['OBJS']))
if len(tboxs) == 0:
print(tboxs)
obj = tboxs[0] # anglez >> 9 is chest id
patch_tbox_item(obj, itemid)
def rando_patch_item(bzs: OrderedDict, itemid: int, id: str):
id = int(id)
obj = next(filter(lambda x: x['name'] == 'Item' and... | |
<filename>tests/test_ogm.py
import sys
import unittest
import decimal
import os.path
from datetime import datetime
from pyorient import PyOrientCommandException, PyOrientSQLParsingException
from pyorient.ogm import Graph, Config
from pyorient.groovy import GroovyScripts
from pyorient.ogm.declarative import declarativ... | |
503 383
1 1 2 0 500 620
1 1 2 0 500 380
1 1 2 0 497 617
1 1 2 0 497 377
1 1 2 0 494 614
1 1 2 0 494 374
1 1 2 0 491 611
1 1 2 0 491 371
1 1 2 0 488 608
1 1 2 0 488 368
1 1 2 0 485 605
1 1 2 0 485 365
1 1 2 0 482 602
1 1 2 0 482 362
1 1 2 0 479 599
1 1 2 0 479 359
1 1 2 0 476 596
1 1 2 0 476 356
1 1 2 0 473 593
1 1 2 0 ... | |
<filename>tslearn/tests/sklearn_patches.py
from tslearn.generators import random_walk_blobs
from tslearn.preprocessing import TimeSeriesScalerMeanVariance
import sklearn
from sklearn.base import clone
from sklearn.base import is_classifier, is_outlier_detector, is_regressor
from sklearn.base import ClusterMixin
from ... | |
the mouse pointer, if it belongs to
this application. Otherwise it returns None.
"""
return _misc_.FindWindowAtPointer(*args)
def GetActiveWindow(*args):
"""
GetActiveWindow() -> Window
Get the currently active window of this application, or None
"""
return _misc_.GetActiveWindow(*args)
def GenericFindWindow... | |
#
# A convenient, gym-like wrapper for pybullet
# https://github.com/liusida/PyBulletWrapper
#
# Author of this file:
# 2020 <NAME> (<EMAIL>)
# License:
# MIT
# Description:
# This wrapper provides some Python style interfaces to pybullet.
# The original pybullet returns are arrays, but dictionaries are more handy if w... | |
<filename>lecture.py
from trad_chiffre_mot import tradn
import os
import numpy as np
from scipy.sparse import csr_matrix
import pandas as pd
from nltk.tag import StanfordPOSTagger
from nltk.tokenize import RegexpTokenizer
from keras import Input
from keras.layers import Bidirectional, LSTM, Dropout, RepeatVector, Conca... | |
# ------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------------
import binas... | |
> columns:
self.cursor.moveAbsolute(columns - 1, cursorY)
# get cursor position again, maybe it was moved
cursorX, cursorY = self.cursor.getPosition()
qp.setOpacity(0.8)
if self.isInEditMode():
qp.setOpacity(0.5)
# cursor on text
qp.drawRect((self.COLUMNS * 3 + self.gap + cursorX) * self.fontWidth, cursorY * ... | |
of this ComputerGroup. # noqa: E501
:rtype: str
"""
return self._virtual_name
@virtual_name.setter
def virtual_name(self, virtual_name):
"""Sets the virtual_name of this ComputerGroup.
Name of the ComputerGroup as it exists in VMware vCloud. Ignored if the ComputerGroup is not from vCloud. Searchable ... | |
"estimated %sCP zenith Tsys in vacuum= %6.2f" % (pol, Tvac)
self.header.add_history(msg)
# average records here if needed.
subch_IDs = list(range(self.props['num cycles']))
self.logger.debug("fit_mean_power_to_airmass: subchannels: %s",
subch_IDs)
for subch in subch_IDs:
subchannel = subch+1
# Get the data for ... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2020 <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)
from generate_unicode_normalization_data import cccs
from generate_unicode_normalization_... | |
StaticLink(AbstractLink):
def __init__(self, value):
self._value = value
super().__init__()
def execute(self, obj):
return self._value
class MapSubjectLink(AbstractLink):
with open(settings.SUBJECT_SYNONYMS_JSON) as fobj:
MAPPING = json.load(fobj)
def execute(self, obj):
if not obj:
return None
if isin... | |
POST.
.. attribute:: name
Required. The short name or "slug" representing this
action. This name should not be changed at runtime.
.. attribute:: verbose_name
A string which will be rendered as the link text. (Required)
.. attribute:: url
A string or a callable which resolves to a url to be used as the lin... | |
querydict.has_key('buyer_email'):
data['buyer_email'] = querydict['buyer_email']
if querydict.has_key('seller_id'):
data['seller_id'] = querydict['seller_id']
if querydict.has_key('buyer_id'):
data['buyer_id'] = querydict['buyer_id']
if querydict.has_key('notify_time'):
data['notify_time'] = querydict['notify_ti... | |
"""
Gridder class (and directly supporting utils) for efficient and parallelized mapping of
Py-ART Radar objects to a common, regular grid. Supported by the underlying subgrid mapping
of the GatesToSubgridMapper.
Portions inspired by the map_gates_to_grid implementation of Py-ART (license reproduced in
_map_gates_to_s... | |
" + output_folder + "/all_cmds_log.txt"
remove = "rm -r " + output_folder
if os.system(remove) !=0:
errors['remove_folder'] = "Could not detele output_directory"
flash("Warning: Could not delete {}".format(output_folder))
return errors, output_folder
make_dir = 'mkdir ' + output_folder
if os.system(make_dir) != ... | |
# -*- coding: UTF-8 -*-
import logging
import math
import os
import arcpy
from pyspatialopt import version
def generate_query(unique_ids, unique_field_name, wrap_values_in_quotes=False):
"""
Generates a select or definition query that can applied to the input layers
:param unique_ids: (list) A list of ids to que... | |
<filename>ldap2sql.py
#!/usr/bin/python
import inspect
import os
import sys
import urllib
import urllib2
import hashlib
import logging
from sqlalchemy import create_engine
reload(sys)
sys.setdefaultencoding('UTF8')
cmd_folder = os.path.abspath(os.path.join(os.path.split(inspect.getfile(inspect.currentframe()))[0], "c... | |
self._modules.keys()
@_copy_to_script_wrapper
def items(self) -> Iterable[Tuple[str, Module]]:
r"""Return an iterable of the ModuleDict key/value pairs.
"""
return self._modules.items()
@_copy_to_script_wrapper
def values(self) -> Iterable[Module]:
r"""Return an iterable of the ModuleDict values.
"""
return... | |
categoryNode (nodes[proc][chan][category + branchpostfix]
Hstop = len(defineNodes[processName][decayChannel])
#Guard against histogram names already included (via keys in histNodes) as well as variables that aren't present in branches
# print("==============================> {} {} start: {} stop: {}".format(processN... | |
is None else len(roots),
autonomous_exprs=_is_autonomous(self.indep, self.exprs),
**kwargs)
if self.sparse:
self.nnz = len(self._rowvals)
self.linear_invariants = linear_invariants
self.nonlinear_invariants = nonlinear_invariants
self.linear_invariant_names = linear_invariant_names or None
if self.linear_invar... | |
Standard LanguageStandard
Cpp03
Cpp11
Auto
+ TabWidth unsigned
+ UseTab UseTabStyle
Never
ForIndentation
Always
# Clang 3.5
+ Language LanguageKind
None
Cpp
JavaScript
# Clang 3.5
- SpaceAfterControlStatementKeyword bool
+ SpaceBeforeParens SpaceBeforeParensOptions
Never
ControlStatements
Always
# Clang 3.5... | |
<reponame>wycivil08/blendocv
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#... | |
the standard detection models we have around can detect. Also, this little trick might save you if, say for example, you really had to detect the cell tower but there's no EXIF data to be found: then you'd cycle through every rotation, and every flip, spawning many derivatives of this photo and run them all through. Wh... | |
# -*- coding: utf-8 -*-
"""
CLI for running the commands on workers
"""
from __future__ import annotations
import sys
from concurrent.futures import ThreadPoolExecutor
from typing import Optional
import click
from pioreactor.config import config
from pioreactor.config import get_active_workers_in_inventory
from pior... | |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 23 16:01:32 2019
@author: jorge
"""
import re
import networkx as nx
import json
import csv
import os
import VenuesReader
###############################################
## Util functions
###############################################
def getPub... | |
2*self.dC[:, :, :self.N]
elif mode == 'diagonal':
# Eigendecomposition of the A matrix
L, V = torch.linalg.eig(self.dA)
V_inv = torch.linalg.inv(V)
# Check that the eigendedecomposition is correct
if self.verbose:
print("Diagonalization error:", torch.dist(V @ torch.diag_embed(L) @ V_inv, self.dA))
# Change th... | |
<gh_stars>0
#!/usr/bin/env python3
# Copyright (C) 2016 <NAME> <<EMAIL>>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... | |
0:1024].mean(axis=0).values.reshape(1,1024))
df_EFR_a_85_label = pd.DataFrame(df_EFR_a_85_test1.iloc[2*i, 1024:1031].values.reshape(1,7))
df_EFR_a_85_avg = df_EFR_a_85_avg.append(pd.concat([df_EFR_a_85_avg_t, df_EFR_a_85_label], axis=1, ignore_index=True))
# set the title of columns
df_EFR_a_85_avg.columns = np.appen... | |
<filename>tests/test_oauth2_implicit.py
import time
import datetime
import httpx
import pytest
from pytest_httpx import HTTPXMock
from httpx_auth.testing import BrowserMock, create_token, token_cache, browser_mock
from tests.auth_helper import get_header
import httpx_auth
def test_oauth2_implicit_flow_url_is_mandat... | |
import numpy as np
import scipy
from scipy.stats import binom
# numpy.seterr(all='raise')
#
# Decision tree: Regression
#
class Tree():
def __init__(self, X, y, maxDepth, alpha0 = None, baseline_features = None, peek_ahead_max_depth=0, split_val_quantiles = [], peek_ahead_quantiles = [], nSamples = 0, ... | |
4.474091E+05, 4.670263E+05, 4.873326E+05, 5.083460E+05, 5.300849E+05,
5.525683E+05, 5.758153E+05, 5.998453E+05, 6.246787E+05, 6.503350E+05, 6.768352E+05,
7.042000E+05, 7.324508E+05, 7.616091E+05, 7.916970E+05, 8.227364E+05, 8.547503E+05,
8.877616E+05, 9.217938E+05, 9.568705E+05, 9.930163E+05, 1.030255E+06, 1.068612E... | |
# coding=utf-8
import os
import random
import sys
from collections import namedtuple
from enum import Enum
import ccobra
from anytree import AnyNode, LevelOrderIter
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../..")))
from modular_models.util import sylut... | |
self.all_docs[docname] = max(
time.time(), path.getmtime(self.doc2path(docname)))
if self.versioning_condition:
old_doctree = None
if self.versioning_compare:
# get old doctree
try:
with open(self.doc2path(docname,
self.doctreedir, '.doctree'), 'rb') as f:
old_doctree = pickle.load(f)
except EnvironmentError... | |
<gh_stars>1-10
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Calculate fiberloss fractions.
Fiberloss fractions are computed as the overlap between the light profile
illuminating a fiber and the on-sky aperture of the fiber.
"""
from __future__ import print_function, division
import numpy as np
i... | |
request.caller_uid
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = headers.x_acs_dingtalk_access_token
req = open_api_models.OpenApiRequest(
h... | |
<filename>bagpy-sbg/sbg_genpy/_SbgStatus.py<gh_stars>0
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from sbg_driver/SbgStatus.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import sbg_driver.msg
import... | |
<gh_stars>1-10
#
# EOBTidalExternalC
#
# Provides interface to Bernuzzi EOB model, ** C++ implementation ++
#
# REQUIRES
# - /EOB_ihes.out # created by compiling C++ code
#
# PROVIDES
# - hlmoft
#
# COMPARE TO
# NRWaveformCatalogManager3 : very similar interface
debug_output =False
import numpy as np
import os
impo... | |
= kwargs[kw]
if _debug: Choice._debug(" - my_kwargs: %r", my_kwargs)
if _debug: Choice._debug(" - other_kwargs: %r", other_kwargs)
# call some superclass, if there is one
super(Choice, self).__init__(**other_kwargs)
# set the attribute/property values for the ones provided
for element in self.choiceElements:
s... | |
self._debug['u32_0x18']['start'] = self._io.pos()
self.u32_0x18 = self._io.read_u4be()
self._debug['u32_0x18']['end'] = self._io.pos()
class PlatMvspn0x74(KaitaiStruct):
SEQ_FIELDS = ["u32_0x34", "u32_0x38", "u32_0x3c"]
def __init__(self, _io, _parent=None, _root=None):
self._io = _io
self._parent = _parent
s... | |
= -vertices[:, 1]
triangles = np.array(self.car_model_dict[car_name]['faces']) - 1
translation = np.array(translations[gt_car_idx])
Rt = np.eye(4)
Rt[:3, 3] = translation
# project 3D points to 2d image plane
# Apollo below is correct
# https://en.wikipedia.org/wiki/Euler_angles
# Y, P, R = euler_to_Rot_YPR(eu... | |
parameter 'storefront_oid' is set
if ('storefront_oid' not in params or
params['storefront_oid'] is None):
raise ValueError("Missing the required parameter `storefront_oid` when calling `insert_email_postcard`") # noqa: E501
# verify the required parameter 'email_commseq_postcard' is set
if ('email_commseq_postcar... | |
mask_y = mask_y_branch
else:
mask_y = torch.cat([mask_y, mask_y_branch], 1)
return self.model(mask_y)
class MultiCNNMaskRandomBGBlock(nn.Module):
"""Defines the Unet submodule with skip connection.
X -------------------identity----------------------
|-- downsampling -- |submodule| -- upsampling --|
"""
def ... | |
cfab_cmd('interface', 'delete', ports=self.ports) \
+ cfab_cmd('lag', 'add', lag_id='3') \
+ cfab_cmd('ifgroup', 'add', ifg='1', lag_id='3', lag=True) \
+ cfab_cmd('interface', 'add', lag_id='3',
ports=self.ports, lag=True) \
+ cfab_cmd('vlan', 'add', ifg='1')
self.assert_configured(expect)
def test_already_con... | |
minimum power
# #2 at the demand-charge power threshold
# #3 at the new demand rate and power threshold
# #4 at maximum power and demand rate
vertices = [Vertex(0, 0, 0), Vertex(0, 0, 0), Vertex(0, 0, 0), Vertex(0, 0, 0)]
# Evaluate the first of the four vertices
# Segment 1: First-order parameter a1.
# This ... | |
"""
Interactive annotation tool for 3D human pose estimation.
Given an image and a coarse 3D skeleton estimation, the user can interactively
modify the 3D parameters and save them as the ground truth.
"""
from mpl_toolkits.mplot3d import Axes3D
from scipy.spatial.transform import Rotation as R
from cv2 import projectPo... | |
"""
This module contains the `BinaryReader` class, a wrapper for binary I/O streams that offers functions for extracting
binary-encoded data such as ints, strings, structures etc.
"""
import struct
from typing import Union, BinaryIO, Optional, AnyStr, Iterable, Tuple
from io import BytesIO, IOBase, TextIOBase, Unsupp... | |
- m.b3004 <= 0)
m.c515 = Constraint(expr= m.x514 - m.b3004 <= 0)
m.c516 = Constraint(expr= m.x515 - m.b3004 <= 0)
m.c517 = Constraint(expr= m.x516 - m.b3004 <= 0)
m.c518 = Constraint(expr= m.x517 - m.b3004 <= 0)
m.c519 = Constraint(expr= m.x518 - m.b3004 <= 0)
m.c520 = Constraint(expr= m.x519 - m.b3004 <= 0)
m.c... | |
"""
# Get model specific params
if model_params_ann:
model_params = model_params_ann
model_params["x_train"] = ast.Name(id=model_params["x_train"], ctx=ast.Store())
model_params["y_train"] = ast.Name(id=model_params["y_train"], ctx=ast.Store())
else:
model_params = self.get_model_params(elem)
# print(model_par... | |
<reponame>jtran10/pyNastran
"""
This file defines:
- WriteMesh
"""
from __future__ import print_function
import io
import sys
from codecs import open
from six import string_types, StringIO, PY2, iterkeys
from numpy import array, unique, concatenate, intersect1d, where
from pyNastran.bdf.utils import print_filename
f... | |
= kwargs.pop("cls", None) # type: ClsType[JSONType]
error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop("error_map", {}))
content_type = kwargs.pop("content_type", "application/json") # type: Optional[str]
if product is not None:
_json = ... | |
"shrug tone 2",
"unicode": "1f937-1f3fc"
},
":shrug_tone3:": {
"category": "people",
"name": "shrug tone 3",
"unicode": "1f937-1f3fd"
},
":shrug_tone4:": {
"category": "people",
"name": "shrug tone 4",
"unicode": "1f937-1f3fe"
},
":shrug_tone5:": {
"category": "people",
"name": "shrug tone 5",
"unicode"... | |
#
# TODO if this gets slow, use kdtree for neighbor search
# could also use some pre-sorting and heuristics, e.g. keep cells list
# sorted by x,y it's highly unlikely any daughter cell is going to be
# hundreds of pixels away from its parent, so don't need to search the
# whole list and, likely, we ought to do som... | |
<filename>musa/core.py
import torch
from torch.autograd import Variable
import torch.nn.functional as F
from .utils import *
from .datasets.utils import label_parser, label_encoder, tstamps_to_dur
try:
import ahoproc_tools
from ahoproc_tools.io import *
except ImportError:
ahoproc_tools = None
from scipy.io import w... | |
!= top:
[anomalies.append(id) for id in self[p].idx]
elif p == top:
pattern = self[p]
all_idxs = set()
for pat in pattern:
all_idxs.update(pat.idx)
[anomalies.append(ix) for ix in all_idxs if ix not in pattern.idx]
return anomalies
def __hash__(self):
return hash(str(self))
def __eq__(self, other):
eq =... | |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
-------------------------------------... | |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatibleVers... | |
FreeMono18pt7bBitmaps = [
0x27, 0x77, 0x77, 0x77, 0x77, 0x22, 0x22, 0x20, 0x00, 0x6F, 0xF6, 0xF1,
0xFE, 0x3F, 0xC7, 0xF8, 0xFF, 0x1E, 0xC3, 0x98, 0x33, 0x06, 0x60, 0xCC,
0x18, 0x04, 0x20, 0x10, 0x80, 0x42, 0x01, 0x08, 0x04, 0x20, 0x10, 0x80,
0x42, 0x01, 0x10, 0x04, 0x41, 0xFF, 0xF0, 0x44, 0x02, 0x10, 0x08, 0x40,
0... | |
<gh_stars>10-100
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# build index of pali words into JavaScript Array variables
import os, sys
import shutil
import xml.dom.minidom
import json
import urllib
prefix_code = {
# "°" : "uc",
# "-" : "dash",
"a" : "a",
"ā" : "aa",
"b" : "b",
"c" : "c",
"d" : "d",
"ḍ" : "do... | |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate Leakage': 0.00662954,
'Peak Dynamic': 0.0,
'Runtime Dynamic': 0.0,
... | |
import re
import codecs
import os
import shutil
import tempfile
import sys
import zipfile
import base64
import StringIO
import urllib
"""
uglifyjs is a python wrapper for uglifyjs.
See e.g. https://bitbucket.org/chrisk/uglifyjs
It can be any javascript minifyer. The required interface is:
def minify(inpath, outpat... | |
<reponame>supaflysnooka/localstack<gh_stars>1-10
import ast
import asyncio
import base64
import json
import logging
import traceback
import uuid
import requests
import six
import xmltodict
from flask import Response as FlaskResponse
from moto.sns.exceptions import DuplicateSnsEndpointError
from moto.sns.models import ... | |
O
0x80, 0xC2, # O OO O
0x80, 0xC2, # O OO O
0x43, 0xC4, # O OOOO O
0x43, 0x84, # O OOO O
0x23, 0x08, # O OO O
0x18, 0x30, # OO OO
0x07, 0xC0, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @552 '*' (20 pixels wide)
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #... | |
<gh_stars>0
"""
Title: Graph representation learning with node2vec
Author: [<NAME>](https://www.linkedin.com/in/khalid-salama-24403144/)
Date created: 2021/05/15
Last modified: 2021/05/15
Description: Implementing the node2vec model to generate embeddings for movies from the MovieLens dataset.
"""
"""
## Introduction
... | |
<filename>core/domain/suggestion_services_test.py
# Copyright 2018 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | |
: variable_property")
def chaining_meth_base(self, p):
return ChainingStuff([], [p[0]])
@pg.production("chaining_dereference : "
"chaining_dereference [ dim_offset ]")
def chaining_index(self, p):
lst = p[0]
assert isinstance(lst, ChainingStuff)
lst.indices.append(p[2])
return lst
@pg.production("chaining_d... | |
<gh_stars>1-10
"""
Copyright 2013 IO Rodeo Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... | |
deque = Deque()
>>> deque += 'ab'
>>> deque.popleft()
'a'
>>> deque.popleft()
'b'
>>> deque.popleft()
Traceback (most recent call last):
...
IndexError: pop from an empty deque
:return: value at front of deque
:raises IndexError: if deque is empty
"""
default = None, ENOVAL
_, value = self._cache.pull(def... | |
__init__(self,
req,
substrate,
flow_values,
relative_decomposition_abortion_epsilon,
absolute_decomposition_abortion_epsilon,
decomposition_epsilon,
extended_graph=None, # optional, can be provided by the caller to save time
substrate_resources=None, # optional, can be provided by the caller to save time
logge... | |
units_btn.style.button_color = 'tan'
row = [name_btn, self.float717, units_btn, ]
box765 = Box(children=row, layout=box_layout)
name_btn = Button(description='calcification_rate', disabled=True, layout=name_button_layout)
name_btn.style.button_color = 'lightgreen'
self.float718 = FloatText(value='0', step='0.01',... | |
<filename>autoclass/autorepr_.py
# Authors: <NAME> <<EMAIL>>
#
# Copyright (c) Schneider Electric Industries, 2019. All right reserved.
from warnings import warn
try: # python 3+
from inspect import signature
except ImportError:
from funcsigs import signature
try:
from typing import Any, Tuple, Union, Dict, TypeV... | |
cnt += 1
if cnt % 1000 == 0:
print cnt, zl.tock()
zl.tick()
ok = False
for r in doc['relationships']:
pre = r['predicate']
sub_name = r['subject']['name']
obj_name = r['object']['name']
spo = sub_name+'_'+pre+'_'+obj_name
if spo in spo_list:
rcnt+=1
ok = True
if ok:
total_test_cnt += 1
print rcnt,total_t... | |
559831, 559841, 559849, 559859, 559877,
559883, 559901, 559907, 559913, 559939, 559967, 559973, 559991,
560017, 560023, 560029, 560039, 560047, 560081, 560083, 560089,
560093, 560107, 560113, 560117, 560123, 560137, 560149, 560159,
560171, 560173, 560179, 560191, 560207, 560213, 560221, 560227,
560233, 560237, 560... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.