input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
0.00000000048 * mu.cost(2.95878690387 + 11527.12508919240 * x)
R1 += 0.00000000052 * mu.cost(0.01971915447 + 8226.57883637840 * x)
R1 += 0.00000000045 * mu.cost(5.07966377852 + 3318.76159737340 * x)
R1 += 0.00000000043 * mu.cost(1.23879381294 + 7218.02936549500 * x)
R1 += 0.00000000058 * mu.cost(5.58121433163 + 664... | |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
from collections import defaultdict
from itertools import groupby
from odoo import api, fields, models, _
from odoo.exceptions import AccessError, UserError
from odoo.tools import date_utils, float_compa... | |
2.0 specification.
# All multiple-byte fields are represented in host-endian format.
class libusb_device_descriptor(Structure):
_fields_ = [
# Size of this descriptor (in bytes)
('bLength', c_uint8),
# Descriptor type. Will have value LIBUSB_DT_DEVICE in this
# context.
('bDescriptorType', c_uint8),
# USB specif... | |
ClusterAddonsConfigGcePersistentDiskCsiDriverConfig.from_proto(i)
for i in resources
]
class ClusterNodePools(object):
def __init__(
self,
name: str = None,
config: dict = None,
initial_node_count: int = None,
locations: list = None,
self_link: str = None,
version: str = None,
instance_group_urls: list = N... | |
from autogoal.exceptions import InterfaceIncompatibleError
# import types
import inspect
# import pprint
from typing import Mapping
from autogoal.grammar import Symbol, Union, Empty, Subset
# from scipy.sparse.base import spmatrix
# from numpy import ndarray
# def algorithm(input_type, output_type):... | |
# TODO: Add description to the integration in <root>/Packs/Coralogix/Integrations/Coralogix/Coralogix_description.md
from datetime import timezone
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import json
import requests
import urllib3
import dateu... | |
<reponame>arevi9176/Lightweight-Covid-Dashboard
#!/usr/bin/env python3
#
# LCD - Lightweight Covid Dashboard
# 28.03.20 (v0.1.0) - initial version
# 02.04.20 (v0.2.0) - added dataframe cache and view 'Average percentage increase in the last seven days'
# 03.04.20 (v0.2.1) - changed 'Average percentage increase' to 'Ave... | |
<reponame>homebysix/grahampugh-recipes
#!/usr/local/autopkg/python
"""
JamfPackageUploader processor for AutoPkg
by <NAME>
Developed from an idea posted at
https://www.jamf.com/jamf-nation/discussions/27869#responseChild166021
"""
import os
import re
import hashlib
import json
import base64
import subprocess
impo... | |
<filename>ionoscloud/api/nat_gateways_api.py
from __future__ import absolute_import
import re # noqa: F401
import six
from ionoscloud.api_client import ApiClient
from ionoscloud.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)
class NATGatewaysApi(object):
def __init__(self, api_client=None):
if ... | |
# Copyright 2020-2022 OpenDR European Project
#
# 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... | |
<filename>sdk/python/pulumi_github/outputs.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Opti... | |
source project
# otherwise we won't be able to find them
for repoView in manifest.repositories.values():
repoSpec = repoView.repository
if repoSpec.name == "self":
continue
repo = sourceProject.find_git_repo_from_repository(repoSpec)
if repo:
targetProject.find_or_clone(repo)
def _create_ensemble_repo(manifes... | |
to map it to an entity within this project.
If the entity is found, returns a FigsharePath object with the entity identifiers included.
Otherwise throws a 404 Not Found. Will also assert that the entity type inferred from the
path matches the type of the entity at that url.
:param str path: entity path from the v1... | |
= {}
result['auth_token'] = self.auth_token
result['product_instance_id'] = self.product_instance_id
result['region_name'] = self.region_name
result['mobile'] = self.mobile
return result
def from_map(self, map={}):
self.auth_token = map.get('auth_token')
self.product_instance_id = map.get('product_instance_id'... | |
/ abc[NPA - 1])
elif NPA == 2:
abc[0] = abc[1]
abc[2] = (volume / x)(thickness1 ** 2)
elif NPA == 1:
abc[1] = abc[0]
abc[2] = (volume / x) / (thickness1 ** 2)
para = np.array([abc[0], abc[1], abc[2], alpha, beta, gamma])
a, b, c = abc[0], abc[1], abc[2]
maxvec = (a * b * c) / (minvec ** 2)
# Define limits ... | |
4096)
self.assertEqual(c2.fetchone()[0], 4096)
c1.execute("pragma branches")
c2.execute("pragma branches")
self.assertListEqual(c1.fetchall(), [("master",),("test",),("sub-test1",),("sub-test2",)])
self.assertListEqual(c2.fetchall(), [("master",),("test",),("sub-test1",),("sub-test2",)])
# try to rename an unex... | |
[float(atom.Coords.x) for atom in forced_atomGroup[0]]
y_coordinates = [float(atom.Coords.y) for atom in forced_atomGroup[0]]
x_bins = np.arange(x_min, x_max, (x_max - x_min)/num_x_bins)
y_bins = np.arange(y_min, y_max, (y_max - y_min)/num_y_bins)
atom_x_bin = np.digitize(x_coordinates, x_bins)
atom_y_bin = n... | |
<reponame>tonsky/intellij-community<filename>python/helpers/generator3.py
# encoding: utf-8
import atexit
import zipfile
from pycharm_generator_utils.clr_tools import *
from pycharm_generator_utils.util_methods import *
# TODO: Move all CLR-specific functions to clr_tools
debug_mode = True
quiet = False
# TODO move... | |
<reponame>Bob-Chou/analytics-zoo
#
# Copyright 2018 Analytics Zoo Authors.
#
# 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 b... | |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'FormGuncellee.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# 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,... | |
<gh_stars>1-10
import logging
import numpy as np
import xarray as xr
from scipy.ndimage import uniform_filter
from wind_repower_usa.calculations import calc_simulated_energy
from wind_repower_usa.constants import KM_TO_METER
from wind_repower_usa.geographic_coordinates import geolocation_distances
from wind_repower_u... | |
# Import Google TransitFeed
import transitfeed
from transitfeed import ServicePeriod
# Version
mjts_version = "0.0.2"
# New Schedule
schedule = transitfeed.Schedule()
# Create Agency
schedule.AddAgency("Moose Jaw Transit Service", "http://www.moosejaw.ca/?service=city-of-moose-jaw-transit-division",
"America/Regina... | |
setting the value, but the module that
is checking the value has its own __context__.
Returns:
bool: ``True`` if successful, otherwise ``False``
"""
if "lgpo.adv_audit_data" not in __context__ or refresh is True:
system_root = os.environ.get("SystemRoot", "C:\\Windows")
f_audit = os.path.join(system_root, "secu... | |
import json
from sklearn.linear_model import LinearRegression,Lasso,Ridge
from sklearn.datasets import load_boston
import os
import sys
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = curPath
for i in range(2):
rootPath = os.path.split(rootPath)[0]
sys.path.append(rootPath)
import numpy as np
import... | |
<reponame>tgweber/breadp
################################################################################
# Copyright: <NAME> 2019
#
# Apache 2.0 License
#
# This file contains code related to evaluation objects
#
################################################################################
from collections import ... | |
########################
# Created 3-8-17 by JJW
# Some general use functions for the Fragile Families Challenge
#
#
########################
import pickle
import numpy as np
import csv
import os.path
# A dict to reference outcomes by their index in the data read in
outcome_indices = {'ID': 0, 'gpa': 1, 'grit': 2, '... | |
bool
_os: str
_platform: str
_python: str
_require_service: str
_runqueue_item_id: str
_save_requirements: bool
_service_transport: str
_start_datetime: datetime
_start_time: float
_tmp_code_dir: str
_tracelog: str
_unsaved_keys: Sequence[str]
_windows: bool
allow_val_change: bool
anonymous: str
api_key... | |
<reponame>zhu-xlab/So2Sat-LCZ-Classification-Demo
"""
Created on Fri June 29 15:09:53 2018
@author: <NAME>
"""
# Last modified: 10.04.2020 00:22:09 <NAME>
# commented messages
import os
import glob
import numpy as np
from osgeo import gdal
import sys
gdal.UseExceptions()
def saveProbabilityPrediction(probPred,tiffPa... | |
Build Chunk A
fake_timestamp = datetime.utcnow() - timedelta(days=10)
create_chunk(cgraph,
vertices=[to_label(cgraph, 1, 0, 0, 0, 0)],
edges=[(to_label(cgraph, 1, 0, 0, 0, 0), to_label(cgraph, 1, 1, 0, 0, 0), 0.5)],
timestamp=fake_timestamp)
# Preparation: Build Chunk B
create_chunk(cgraph,
vertices=[to_label(... | |
vpc_name
) # Add : to separate vpc name from ou/account
else:
attachment_name += vpc_name
if attachment_name != "": # If the name is not null tag it:
truncated_attachment_name = attachment_name[:255]
self.event["AttachmentTagsRequired"]["Name"] = truncated_attachment_name
self.logger.debug(
f"The appended TGW ... | |
<filename>cumm/conv/main_real.py
# Copyright 2021 <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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | |
import errno
import logging
import os
import subprocess
import sys
from unittest.mock import patch
import pytest
import runez
from runez.conftest import exception_raiser
from runez.program import RunAudit, RunResult
CHATTER = runez.DEV.tests_path("chatter")
def simulate_os_error(code):
e = OSError(code)
e.errno... | |
dweeks - days * ddays - hours * dhours - minutes * dmins - seconds) * 1000),
3))
if milliseconds.is_integer():
int(milliseconds)
result = []
if years != 0:
if years == 1:
s = ""
else:
s = "s"
result.append(f"{years} year{s}")
if month != 0:
result.append(f"{month} month")
if weeks != 0:
if weeks == 1:
s ... | |
import glob
import math
import warnings
import boto3
import numpy as np
from statsmodels.tools.sm_exceptions import ConvergenceWarning
from torch import optim
from codes.rl.upbit_rl_replay_buffer import PrioritizedReplayBuffer, ReplayBuffer
warnings.filterwarnings("ignore")
with warnings.catch_warnings():
warnings.... | |
Python 2 native strings
are stored as bytes. In Python 3 native strings are stored as
unicode.
"""
if not self.enabled:
return ''
if self._state != self.STATE_RUNNING:
return ''
if self.ignore_transaction:
return ''
# Only generate a footer if the header had already been
# generated and we haven't alrea... | |
"""Functions for generating random quantum objects and states.
"""
import os
import math
import random
from importlib.util import find_spec
from functools import wraps, lru_cache
from numbers import Integral
import numpy as np
import scipy.sparse as sp
from ..core import (qarray, dag, dot, rdmul, complex_array, get_t... | |
import time
import curses
import sys
import os
import multiprocessing as mp
import pandas as pd
import numpy as np
import emcee
import h5py
from radvel import utils
import radvel
class StateVars(object):
def __init__(self):
self.oac = 0
self.autosamples = []
self.automean = []
self.automin = []
self.automax... | |
color='r'))
if Rx != []:
irx = np.unique(sig[nz[1:-1] - 1], return_index=True)[1]
irx2 = np.kron(irx, [1, 1])
rx = ps[irx2]
rx[range(0, len(rx), 2)] = Rx
lines.extend(ax.plot(rx[:, 0], rx[:, 1], color='b'))
return (fig, ax, lines)
# lines=[]
# for s in sig:
# l=[self.Gs.pos[s[ii]] for ii in xrange(len(s))]
# if... | |
<gh_stars>0
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
import copy
from collections import OrderedDict
import numpy as np
import astropy
from astropy.coordinates import SkyCoord
import fermipy.skymap
from fermipy.data_struct import Mu... | |
#!/usr/bin/env python2.7
""" Guidelines for Object Oriented Analysis and Design:
1. Write down about the problem
2. Extract Key cnocepts from #1 and reseach them
3. Create a class hierarchy and object map for the concepts - in object has-a is-a fastion
4. Code the classes and a test to run them
5. Repeat and refine i... | |
<filename>mi/instrument/seabird/sbe16plus_v2/ctdbp_no/driver.py<gh_stars>0
"""
@package mi.instrument.seabird.sbe16plus_v2.ctdbp_no.driver
@file mi/instrument/seabird/sbe16plus_v2/ctdbp_no/driver.py
@author <NAME>
@brief Driver class for sbe16plus V2 CTD instrument.
"""
__author__ = '<NAME>'
__license__ = 'Apache 2.0'... | |
#!/usr/bin/env python3
import tensorflow as tf
import numpy as np
import os
import math
import foolbox
import scipy
import matplotlib.pyplot as plt
from PIL import Image
#Utilizes the FoolBox Python library (https://github.com/bethgelab/foolbox) to implement a variety
#of adversarial attacks against deep-learning mo... | |
<filename>liberapay/utils/i18n.py
# encoding: utf8
from __future__ import print_function, unicode_literals
from collections import namedtuple, OrderedDict
from datetime import date, datetime, timedelta
from decimal import Decimal, InvalidOperation
from hashlib import md5
from io import BytesIO
import re
from unicodeda... | |
<gh_stars>0
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Types for building models of metric description xml files.
UMA uses several XML files to allow clients to describe the metrics that they
colle... | |
"2016"}},
{"aggregated_amount": 0, "time_period": {"fiscal_year": "2017"}},
{"aggregated_amount": 8018.0, "time_period": {"fiscal_year": "2018"}},
{"aggregated_amount": 8019.0, "time_period": {"fiscal_year": "2019"}},
{"aggregated_amount": 0, "time_period": {"fiscal_year": "2020"}},
]
assert resp.status_code == s... | |
input-gzip.nbt > output.nbt` or
* `python3 -c "import sys, gzip; sys.stdout.buffer.write(
gzip.decompress(sys.stdin.buffer.read()) )" < input-gzip.nbt > output.nbt`
* `application/zlib`, you can use
* `openssl zlib -d -in input-zlib.nbt -out output.nbt` (does not work on most systems)
* `python3 -c "import sys, zl... | |
if self._Version == None:
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_VERSION", File=self.MetaFile)
return self._Version
## Retrieve platform description file version
def _GetDscSpec(self):
if self._DscSpecification == None:
if self._Header == None:
self._GetHeaderInfo()
if self._Ds... | |
<reponame>vijayraghu/testoptustwil<filename>main.py
# -*- coding: utf-8 -*-
import os
import sys
import urllib
import requests
import json
from google.protobuf.json_format import MessageToJson
import re
import datetime
from flask import Flask, request, Response, make_response, jsonify, url_for
from contextlib import cl... | |
,f"orgchartportal_manage_permissions_view: context variable division_list either has more data than allowed ({from_api_division_list - required_division_list}) or has less data than allowed ({required_division_list - from_api_division_list})")
self.assertEqual(from_api_wu_desc_list, required_wu_desc_list
,f"orgchartp... | |
ax.axvline(i, color='white')
return ax
def matrix_waterfall_matched(
self, af, patient_col, group_col, group_order, count=10
):
"""
Compute a matrix of variant classifications with a shape of
(gene-group pairs, patients).
Parameters
----------
af : AnnFrame
AnnFrame containing sample annotation data.
pat... | |
missing and v is not None}
retry_strategy = self.retry_strategy
if kwargs.get('retry_strategy'):
retry_strategy = kwargs.get('retry_strategy')
if retry_strategy:
return retry_strategy.make_retrying_call(
self.base_client.call_api,
resource_path=resource_path,
method=method,
path_params=path_params,
header_p... | |
<filename>src/test_derlite.py
import derlite
from derlite import Tag, Oid, DecodeError
import codecs, datetime, unittest
try:
codecs.lookup('Teletex')
teletex_available = True
except LookupError:
teletex_available = False
class Test (unittest.TestCase):
def around(self, enc, der):
der = bytes.fromhex(der)
go... | |
= info_row.split()
info_id = int(info_list[0])
info_var = info_list[12]
if info_id >= 0:
list_vars.append(info_var)
var_box = list(set(list_vars))
ids_info = [str(id_start), str(id_end), str(id_period)]
ids_box = '/'.join(ids_info)
return var_box, ids_box
# -------------------------------------------------... | |
# Copyright 2022 Quantapix Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | |
# -*- coding: utf-8 -*-
# pylint: disable=too-many-lines
"""
Tools for parsing QE PW input files.
"""
import re
from typing import Tuple
import numpy as np
from .. import CONSTANTS
from ..exceptions import ParsingError, InputValidationError
from .._qe_version import parse_version
RE_FLAGS = re.M | re.X | re.I
__a... | |
def __init__(
self,
*,
id: Optional[str] = None,
additional_properties: Optional[Dict[str, object]] = None,
auth_methods: Optional[List[Union[str, "MicrosoftGraphRegistrationAuthMethod"]]] = None,
is_capable: Optional[bool] = None,
is_enabled: Optional[bool] = None,
is_mfa_registered: Optional[bool] = None,
is... | |
<filename>openmdao/utils/file_wrap.py
"""
A collection of utilities for file wrapping.
Note: This is a work in progress.
"""
import re
from pyparsing import CaselessLiteral, Combine, OneOrMore, Optional, \
TokenConverter, Word, nums, oneOf, printables, ParserElement, alphanums
import numpy as np
def _getformat(... | |
"""Test Contract() with no mining delay class"""
# Uses ganache with automining set to 'on'
import pytest
from simpleth import Blockchain, Contract, SimplEthError, Results
import testconstants as constants
class TestContractConstructorGood:
"""Test case for Contract() with good args"""
def test_constructor_with_... | |
#!/usr/bin/env python3
''' Program to make tests for metrics testing '''
import argparse, glob, os, pickle, re, requests, subprocess
def create_n_file(id, compare_name, desc, file_lines):
if id in all_n_ids:
exit("Found {} a second time. Exiting.".format(id))
compare_lines = p_files[compare_name]
# Check if nothi... | |
'x']))
self.assertEqual('poly', cladistic(tree2, ['g', 'h']))
msg = 'Node y is not in self'
with self.assertRaisesRegex(MissingNodeError, msg):
cladistic(tree2, ['y', 'b'])
assign_taxa(tree2)
self.assertEqual('uni', cladistic(tree2, ['a']))
self.assertEqual('mono', cladistic(tree2, ['a', 'b']))
self.assertEqua... | |
# -*- coding: utf-8 -*-
# Copyright © 2016, German Neuroinformatics Node (G-Node)
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of the Project.
import warnings
from numbers ... | |
"""Complex msg exchange scenarios"""
import misc
import srv_msg
from forge_cfg import world
def _to_list(val):
if val is not None:
if not isinstance(val, list):
return [val]
return val
#########################################################################
# DHCPv4
def _send_discover(chaddr=None, client_id=N... | |
if redirects_remaining > 0:
location = (response.getheader('Location')
or response.getheader('location'))
if location is not None:
m = re.compile('[\?\&]gsessionid=(\w*)').search(location)
if m is not None:
self.__gsessionid = m.group(1)
# Make a recursive call with the gsession ID in the URI to follow
# the re... | |
0, 0, 0, 0],
[1498, 24.278857, 0, 9999, -9999, 1.0, 100, 1, 105.800802, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1499, 0.328342, 0, 9999, -9999, 1.0, 100, 1, 2.286676, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1500, 0.094494, 0, 9999, -9999, 1.0, 100, 1, 0.154817, 0.0, 0, 0, 0, 0, 0, 0,... | |
<filename>digsby/src/gui/pref/prefcontrols.py<gh_stars>10-100
'''
Utility functions for building GUI controls bound to the preference dictionary.
'''
from __future__ import with_statement
from wx import Choice, EXPAND, LEFT, EVT_CHOICE, BOTTOM, ALIGN_CENTER_VERTICAL, ALL, \
EVT_LEFT_DOWN, EVT_LEFT_UP, HORIZONTAL,VER... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 15 11:15:29 2020
@author:
Dr. <NAME>
European Space Agency (ESA)
European Space Research and Technology Centre (ESTEC)
Keplerlaan 1, 2201 AZ Noordwijk, The Netherlands
Email: <EMAIL>
GitHub: mnguenther
Twitter: m_n_guenther
Web: www.mnguenther.com
"... | |
# Generated from LTLfFormulaParser.g4 by ANTLR 4.9
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786... | |
current CUDS object.
Result type is a list, if more than one CUDS object is
returned.
"""
check_arguments(Cuds, *args)
old_objects = self.get(*[arg.uid for arg in args])
if len(args) == 1:
old_objects = [old_objects]
if any(x is None for x in old_objects):
message = 'Cannot update because cuds_object not added... | |
"""\
This implements a command line interpreter (CLI) for the concur API.
OAuth data is kept in a JSON file, for easy portability between different
programming languages.
Currently, the initialization of OAuth requires the user to copy a URL
into a web browser, then copy the URL of the resulting page back to this
scr... | |
# Copyright (c) "Neo4j"
# Neo4j Sweden AB [http://neo4j.com]
#
# This file is part of Neo4j.
#
# 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
#
#... | |
_responds(RESULT_SUCCESS, showDict)
class CMD_ShowAddExisting(ApiCall):
_help = {"desc": "add a show in sickbeard with an existing folder",
"requiredParameters": {"tvdbid": {"desc": "thetvdb.com unique id of a show"},
"location": {"desc": "full path to the existing folder for the show"}
},
"optionalParameters": ... | |
Keys or strings
rpc: datastore.RPC to use for this request.
Raises:
TransactionFailedError, if the Delete could not be committed.
"""
rpc = GetRpcFromKwargs(kwargs)
keys, multiple = NormalizeAndTypeCheckKeys(keys)
if multiple and not keys:
return
req = datastore_pb.DeleteRequest()
req.key_list().extend([ke... | |
'config_filepath' : None, 'weight_filepath' : None, 'nms': True, 'nms_thresh': 0.80, 'test_gid_list': test_gid_list, 'species_mapping': species_mapping, 'species_set': set(['zebra'])},
# {'label': 'Zebra NMS 90%', 'grid' : False, 'algo': 'azure', 'config_filepath' : None, 'weight_filepath' : None, 'nms': True, 'nms_th... | |
<gh_stars>0
# ## Importing necessary modules
#Our old friends
import numpy as np
import tensorflow as tf
#Our Model class
from Model import *
#Collect datasets
from datasets import *
#Set random seed
np.random.seed(912)
def train_model(data, labels, params):
"""Train a model.
Args:
data (numpy array): all of th... | |
in h_pos_goal:
h_filter_goal[(pos - 1) * atom_num:pos * atom_num] = True
del pos
goal_cont_h = np.logical_and(goal_contacts, h_filter_goal)
h_pos_init = parse_top_for_h(topol_file_init)
h_filter_init = np.zeros(atom_num * atom_num, dtype=np.bool)
for pos in h_pos_init:
h_filter_init[(pos - 1) * atom_num:pos * a... | |
<filename>configure_machine/bootstrap_bevy_member_here.py
#!/usr/bin/env python3
# encoding: utf-8-
"""
A utility program to install a SaltStack minion, and optionally, a master with cloud controller.
arguments: add one or more file_roots and pillar_roots entries. Spaces are not permitted.
--file_roots=/absolut... | |
from __future__ import print_function
import torch
import torch.nn as nn
from torch.nn import functional as F
from utils.metric import AverageMeter, Timer
import numpy as np
from models.resnet import BiasLayer
from .default import NormalNN, accumulate_acc, loss_fn_kd, Teacher
import copy
class LWF(NormalNN):
def __i... | |
<reponame>grlee77/nipype
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""SPM wrappers for preprocessing data
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> ... | |
<gh_stars>0
"""An optical ray tracing module with a function for dealing with spherical
surfaces as well as planar surfaces, and also with opaque detector surfaces.
Module is also capable of plotting ray paths and surfaces, tgogether with an
illustration of the distribution of rays at the output. Function can be used t... | |
<gh_stars>1-10
###############################################################
# ubervotebot is a bot made for Telegram and was written by
# <NAME>. It helps you manage polls and show the
# results in a variety of formats. This project was built
# ontop of @yukuku's telebot project.
####################################... | |
<filename>config_system/generator/generate.py
# Copyright (c) 2015 <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:
# 1. Redistributions of source code must retain the above copyright
# not... | |
class=pluginurl align=absmiddle title="%s" src="images/pluginurl.png"></a>' %
(p.group(1).replace('"', ''), p.group(1).replace('"', '')), output)
if output.endswith(" </A>"):
output = output[:-11]
return output
def format_exception():
import traceback
return traceback.format_exc()
# Debug log... | |
revision history.
Reference RFC 7231, Section 6.5.8
Keyword Args:
description (str): Human friendly description of the error.
title (str): Error title (default '409 Conflict')
headers (dict): A dict of header names and values to set.
href (str): An href that can be used for more information.
"""
def __init__(... | |
# coding=utf-8
from __future__ import print_function
import os
from six.moves import xrange as range
import math
from collections import OrderedDict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.utils
from torch.autograd import Variable
import torch.nn.functional as F
from torch.nn.utils.rnn i... | |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from datetime import datetime
import pytest
from mock import MagicMock
from intelliflow.api_ext import *
from intelliflow.core.application.application import Application
from intelliflow.core.platform.definitio... | |
<gh_stars>0
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the ... | |
"void SetRGB__6DialogUcUcUc(struct Dialog *this, unsigned char R, unsigned char G, unsigned char B)")
del_items(0x80083CF8)
SetType(0x80083CF8, "void SetBack__6Dialogi(struct Dialog *this, int Type)")
del_items(0x80083D00)
SetType(0x80083D00, "void SetBorder__6Dialogi(struct Dialog *this, int Type)")
del_items(0x80083D... | |
id (str): Room streamId
session_token (str): Session authentication token.
payload (UserId):
Keyword Args:
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decod... | |
1),
# (val_sub, ":player_slot_index", 1),
# (multiplayer_get_my_player, ":my_player_no"),
# (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
(troop_get_slot, ":item_no", "trp_temp_troop", 0),
(troop_get_slot, ":item_imod", "trp_temp_troop", 10),
(assign, ":target_obj", "$g_inside_obj_1"),
(... | |
combinations of queries to it were seen. For the purposes of calcuating these metrics, query strings and path parameters are both
considered query arguments, so that both <tt>http://example.com/foo?bar</tt> and <tt>http://example.com/foo;baz=bat</tt> would be collpased
into the URL above (contributing to the 250 figur... | |
"xbrli:booleanItemType",
"xbrli:dateItemType", "num:percentItemType",
"xbrli:anyURIItemType"]
# There is type-checking we can do for these unitless types but we'll handle
# it elsewhere
required_type = self.get_concept(concept).get_details("type_name")
if required_type in unitlessTypes:
if unit_id is None:
ret... | |
we should exit the loop.
guard_val = eval_arg(self.guard, context)
if (self.loop_type.lower() == "until"):
guard_val = (not guard_val)
if (not guard_val):
break
# Execute the loop body.
done = False
context.goto_executed = False
for s in self.body:
if (log.getEffectiveLevel() == logging.DEBUG):
log.debug('... | |
'\a', end='')
sys.stdout.flush()
except Exception as e:
print(e)
def handler(signal_received, frame):
pretty_print(
'sys0', get_string('sigint_detected')
+ Style.NORMAL + Fore.RESET
+ get_string('goodbye'), 'warning')
_exit(0)
# Enable signal handler
signal(SIGINT, handler)
def load_config():
global user... | |
get_abs_path_from_package_name(packagename):
"""Get absolute file path of the package.
In order to retrieve the path, the package module will be imported.
Args:
packagename: The full package name, e.g., package.subpackage.
Returns:
An absolute path or None if path does not exist.
Raises:
TypeError: Wrong in... | |
import logging
import os
import copy
import mxnet as mx
from .classifier import Classifier
from .dataset import get_dataset
from .nets import *
from .pipeline import train_image_classification
from .utils import *
from ..base import BaseTask, compile_scheduler_options, create_scheduler
from ...core import *
from ...co... | |
group in new_answer_groups:
new_rule_specs = []
for rule_spec in group['rule_specs']:
if is_valid_math_equation(
rule_spec['inputs']['x']):
new_rule_specs.append(rule_spec)
group['rule_specs'] = new_rule_specs
# Otherwise, if at least one rule_input is an algebraic
# expression, we remove all other rule inputs ... | |
<gh_stars>1-10
import pyaudio
import wave
import sys
import os
import subprocess
from keeb_async import KeyboardThread
from sig_proc import SigProc
import numpy as np
import matplotlib.pyplot as plt
import time
import asyncio
class AudioStim:
def __init__(self, send_stim_data, set_stim_mode):
#audio
self.CHUNK = 10... | |
function loads splitten datasets from files (created by `create_splits´ function).
We assume to have those files in a fixed path, hence no file name as input is needed.
'''
# loading train set...
train_set = []
with open(PREFIX_COLAB + f"dataset/splits_frac_{FRAC}/train_set.txt", 'r') as f:
for line in f.readlin... | |
<filename>cwmud/core/shells.py
# -*- coding: utf-8 -*-
"""Shell management and client input processing."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2017 <NAME>
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
from weakref import WeakValueDiction... | |
r += math.sqrt(imps_and_chrates[w, 0] * imps_and_chrates[w, 1])
s = sum(imps_and_chrates[:, 1])
idxs_and_value_ratios.sort(key=itemgetter(0))
rem_bandwidth = bandwidth
for w in range(len(idxs_and_value_ratios)):
if (imps_and_chrates[idxs_and_value_ratios[w][1], 0] * imps_and_chrates[idxs_and_value_ratios[w][1], 1]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.