input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<filename>build_patch.py
#!/usr/bin/python3
import os
import subprocess
import sys
import csv
from ips_util import Patch
import text_util
import gfx_util
class StringPool:
def __init__(self, address, capacity):
self.address = address
self.capacity = capacity
self.pool = bytearray()
def can_add(self, bytes):
... | |
<gh_stars>10-100
# Copyright (c) 2019 - The Procedural Generation for Gazebo authors
# For information on the respective copyright owner see the NOTICE file
#
# 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 t... | |
import uuid
from contextlib import contextmanager
from django.test import TestCase
from django.utils.dateparse import parse_datetime
from celery import states
from celery.exceptions import Ignore
from mock import patch
from casexml.apps.case.mock import CaseFactory, CaseStructure
from casexml.apps.case.tests.util im... | |
"""
This module contains a class for discrete
1-dimensional exponential families. The main
uses for this class are exact (post-selection)
hypothesis tests and confidence intervals.
"""
import numpy as np
import warnings
from ..truncated import find_root
def crit_func(test_statistic, left_cut, right_cu... | |
# coding: utf-8
"""
Healthbot APIs
API interface for Healthbot application # noqa: E501
OpenAPI spec version: 1.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility librar... | |
#!/usr/bin/env python
from __future__ import division
import sys
import copy
import rospy
import geometry_msgs.msg
## END_SUB_TUTORIAL
import tf2_ros
from actionlib import SimpleActionClient
from geometry_msgs.msg import PoseStamped, Quaternion, Point, WrenchStamped
from giskard_msgs.msg import ControllerListGoal, Cont... | |
# -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Crisis Mapping Toolkit (CMT) v1 platform is licensed under the Apache
#... | |
# Copyright 2017 Wind River
#
# 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 writing, softw... | |
share the same object identifier
/some/path - Identifies the object based on path
#SomeBatchReference - Identifies the object in a batch call
:type FilterAttributeRanges: list
:param FilterAttributeRanges: Provides range filters for multiple attributes. When providing ranges to typed link selection, any inexact ... | |
\
str(self.router_db_source_identifier.source_uri) + \
'"' + ' not found or not accessible to this process' + os.linesep + \
'Exception detail: ' + str(fnfex.args)
self.logger.critical(error_string)
raise EmeraldEmailRouterDatabaseInitializationError(error_string)
except Exception as ex:
error_string = 'Exceptio... | |
think this is not a common reason for this mode
if pol == -1:
return 0
elif pol == -0.5:
return 1
elif 90 < pol <= 180:
return 3
else:
return 2
def sample_pol(self, pol):
th = self.rotation_motor.user_setpoint.get()
return (
np.arccos(np.cos(pol * np.pi / 180) * np.sin(th * np.pi / 180))
* 180
/ np.pi
)... | |
<filename>lccserver/frontend/searchserver_handlers.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''searchserver_handlers.py - <NAME> (<EMAIL>) -
Apr 2018
These are Tornado handlers for the searchserver.
'''
####################
## SYSTEM IMPORTS ##
####################
import os
import os.path
i... | |
difficultTwoButton)
window.blit(difficultTwo, difficultTwoRect)
difficultThreeButton = pg.Rect(5 * (widthCheck / 8), 300, widthCheck / 4, 50)
difficultThree = mediumFont.render("Difficulty 3 - Hard", True, WHITE)
difficultThreeRect = difficultThree.get_rect()
difficultThreeRect.center = difficultThreeButton.cente... | |
self.api_sc.get_data("QS407SC", self.region, self.resolution, category_filters={"QS407SC_0_CODE": range(1,10)})
qs407.rename({"QS407SC_0_CODE": "C_ROOMS"}, axis=1, inplace=True)
qs407 = utils.cap_value(qs407, "C_ROOMS", 6, "OBS_VALUE")
#print(qs407.head())
assert qs407.OBS_VALUE.sum() == checksum
#print(self.api_... | |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from collections import namedtuple
from copy import deepcopy
from functools import partial
from jax import random
import jax.numpy as jnp
from jax.tree_util import register_pytree_node, tree_flatten, tree_unflatten
import numpyro
imp... | |
from collections import defaultdict
from copy import deepcopy
import csv
from datetime import datetime
import os
from pprint import pformat
import re
import string
import time
from mintamazontagger.algorithm_u import algorithm_u
from mintamazontagger import category
from mintamazontagger.currency import micro_usd_near... | |
"""
A Trainable ResNet Class is defined in this file
Author: <NAME>
"""
import math
import numpy as np
import tensorflow as tf
from functools import reduce
from configs import configs
class ResNet:
# some properties
"""
Initialize function
"""
def __init__(self, ResNet_npy_path=None, trainable=True, ... | |
return inp[::factor,:,:,:,:]
elif (axis + 8) % 8 == 1:
return inp[:,::factor,:,:,:]
elif (axis + 8) % 8 == 2:
return inp[:,:,::factor,:,:]
elif (axis + 8) % 8 == 3:
return inp[:,:,:,::factor,:]
elif (axis + 8) % 8 == 4:
return inp[:,:,:,:,::factor]
elif inp.ndim == 6:
if (axis + 8) % 8 == 0:
return inp[::... | |
import re
import csv
import logging
import math
import glob
# import argparse
import numpy as np
import os
import pandas as pd
import time
import datetime
import drms
import urllib
# import json
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import astropy.units as u
import telegram_handler
# impo... | |
self.df.repartition(num_partitions).write.csv(path=path, mode=mode, header=header)
else:
self.df.write.csv(path=path, mode=mode, header=header)
def _concat(self, join="outer"):
def concat_inner(self, df2):
col_names_1 = set(self.schema.names)
col_names_2 = set(df2.schema.names)
for col in list(col_names_1.diffe... | |
Layer: ", l)
# First step: set the value of 'in_shape' for current component.
ds_factor = 2 ** l # downsample factor, for l=0,1 will be 1, 2.
if c == 'a' and l > 0:
nb_channels = self.R_stack_sizes[l-1] # nb of input channels
elif c == 'a' and l == 0:
nb_channels = None
elif c == 'ahat':
nb_channels = self.R_... | |
enzyme forms to the model
self.enzyme_module_forms += enzyme_module_forms
# Context manager
context = get_context(self)
if context:
context(partial(self.enzyme_module_ligands.__isub__, ligands))
context(partial(self.enzyme_module_forms.__isub__,
enzyme_module_forms))
def remove_metabolites(self, metabolite_li... | |
import time
import inspect
import uuid
import atexit
import asyncio
import warnings
import requests
from flask import current_app, request, jsonify, abort
from nacl.exceptions import BadSignatureError
from nacl.signing import VerifyKey
from flask_discord_interactions.models.autocomplete import AutocompleteResult
t... | |
j += 1
while 1:
name = op4names[j]
if name == "loop_end" or name == "se_start":
# go on to next se or to residual
break
if name not in nas:
nas[name] = {}
if se == 0 and name == "lambda":
# count number of rigid body modes
nrb = sum(op4vars[j] < 0.005)[0]
nas["nrb"] = nrb
nas["lambda"][0] = abs(op4vars[j].r... | |
def OnParentBackgroundImageChanged(self,*args):
"""
OnParentBackgroundImageChanged(self: Control,e: EventArgs)
Raises the System.Windows.Forms.Control.BackgroundImageChanged event when the
System.Windows.Forms.Control.BackgroundImage property value of the control's container changes.
e: An Sy... | |
is a given column a primary key? foreign key? ...
Serves also as a pythonic 'property descriptor': when instance values are read and a given property is not present, returns None instead of exception"""
column_class = None
default = None
field_template = "%(column)s%(nullable)s%(default)s%(comment)s"
_field_cou... | |
<filename>chainer/training/trainer.py
import collections
import os
import six
from chainer import reporter as reporter_module
from chainer.training import extension as extension_module
from chainer.training import trigger as trigger_module
class _ExtensionEntry(object):
def __init__(self, extension, priority, tri... | |
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, Pomfort GmbH"
__license__ = "MIT"
__maintainer__ = "<NAME>, <NAME>"
__email__ = "<EMAIL>"
"""
import difflib
import filecmp
import glob
import os
import shutil
from importlib import reload
from typing import List
import pytest
from click.testing import CliRun... | |
International, Inc.",
"000436": "ELANsat Technologies, Inc.",
"000437": "Powin Information Technology, Inc.",
"000438": "Nortel Networks",
"000439": "Rosco Entertainment Technology, Inc.",
"00043A": "Intelligent Telecommunications, Inc.",
"00043B": "Lava Computer Mfg., Inc.",
"00043C": "SONOS Co., Ltd.", ... | |
from malaya import home
MALAY_TEXT = home + '/dictionary/malay-text.txt'
MALAY_TEXT_200K = home + '/dictionary-200k/malay-text.txt'
# sorted based on modules, started from augmentation until toxic
PATH_AUGMENTATION = {
'synonym': {
'model': home + '/synonym/synonym0.json',
'model2': home + '/synonym/synonym1.json... | |
'pp': ([],['run_card lpp1 1', 'run_card lpp2 1','run_card nb_proton1 1', 'run_card nb_neutron1 0', 'run_card mass_ion1 -1', 'run_card nb_proton2 1', 'run_card nb_neutron2 0', 'run_card mass_ion2 -1']),
})
self.special_shortcut_help.update({
'ebeam' : 'syntax: set ebeam VALUE:\n This parameter sets the energy to b... | |
<reponame>rsdoherty/azure-sdk-for-python<filename>sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_models_py3.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Lice... | |
0)
m.c1228 = Constraint(expr= - m.x718 - 0.11270166537926*m.x723 - 0.00635083268962935*m.x728 + m.x2228 == 0)
m.c1229 = Constraint(expr= - m.x719 - 0.11270166537926*m.x724 - 0.00635083268962935*m.x729 + m.x2229 == 0)
m.c1230 = Constraint(expr= - m.x720 - 0.11270166537926*m.x725 - 0.00635083268962935*m.x730 + m.x2230... | |
TODO: @montoyjh: what if it's a cubic system? don't need 6. -computron
# TODO: Can add population method but want to think about how it should
# be done. -montoyjh
order = self.get('order', 2)
if order > 2:
method = 'finite_difference'
else:
method = self.get('fitting_method', 'finite_difference')
if method ==... | |
reset_help_menu_entries(self):
"Update the additional help entries on the Help menu"
help_list = idleConf.GetAllExtraHelpSourcesList()
helpmenu = self.menudict['help']
# first delete the extra help entries, if any
helpmenu_length = helpmenu.index(END)
if helpmenu_length > self.base_helpmenu_length:
helpmenu.dele... | |
GetMimeType(*args, **kwargs):
"""GetMimeType(self) -> PyObject"""
return _misc_.FileType_GetMimeType(*args, **kwargs)
def GetMimeTypes(*args, **kwargs):
"""GetMimeTypes(self) -> PyObject"""
return _misc_.FileType_GetMimeTypes(*args, **kwargs)
def GetExtensions(*args, **kwargs):
"""GetExtensions(self) -> PyObje... | |
<reponame>ipmb/salt
# -*- coding: utf-8 -*-
'''
State module to manage Elasticsearch.
.. versionadded:: 2017.7.0
'''
# Import python libs
from __future__ import absolute_import
import logging
# Import salt libs
import salt.utils.json
log = logging.getLogger(__name__)
def index_absent(name):
'''
Ensure that the ... | |
# type: ignore
# MIT License
#
# Copyright (c) 2018-2019 Red Hat, Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, ... | |
<filename>csmserver/views/datatable.py
# =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | |
= gray < threshold_level
# color the pixels in the mask
# crop_img[mask] = (204, 119, 0)
gray = cv2.cvtColor(cropped_y_axis, cv2.COLOR_BGR2GRAY)
# set threshold level
threshold_level = 120
# find coordinates of all pixels below threshold
ycoords = np.column_stack(np.where(gray < threshold_level))
... | |
pc.pos )
return True
def trade_item( self, it, pc, redraw ):
"""Trade this item to another character."""
mymenu = charsheet.RightMenu( self.screen, predraw = redraw )
for opc in self.camp.party:
if opc != pc and opc.is_alright():
mymenu.add_item( str( opc ) , opc )
mymenu.add_item( "Cancel" , False )
mymenu.a... | |
formatted_lines.append(line)
# Here we look for the top months we have in the recorded data.
if len(all_uniques) != 0 and len(all_pageviews) != 0:
top_uniques = max(all_uniques)
top_pageviews = max(all_pageviews)
for key, data in traffic_dictionary.items():
if top_uniques in data:
top_month_uniques = ke... | |
self.right.append(copy.deepcopy(i))
for i in pair[1]:
self.left.append(copy.deepcopy(i))
# self.staffs.append(Staff(None, None, melodyVariable.getText()))
# self.music_stream.insert(0, right)
# if self.checkInst in self.grandInst:
# self.music_stream.insert(0, left)
def checkInListContext(self, ctx):
line = ... | |
from ..v2020_03_01.aio.operations_async import DdosCustomPoliciesOperations as OperationClass
elif api_version == '2020-04-01':
from ..v2020_04_01.aio.operations_async import DdosCustomPoliciesOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return ... | |
= map(int, infile.readline().strip().split())
x += [0] * (37 - n)
x.sort()
cx = list(x)
sx = sum(x)
mx = x[-1]
return mx
def func_608aba9db10b46b3a333d3ed3a42a2c8(infile):
b, n = map(int, infile.readline().strip().split())
x = map(int, infile.readline().strip().split())
x += [0] * (37 - n)
x.sort()
cx = li... | |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Layout Plugin.
"""
# Standard library imports
import configparser as cp
import os
# Third party imports
from qtpy.QtCore import Qt, QByteArray, QSi... | |
<gh_stars>10-100
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version'... | |
64MB
self.realloc_vrom(max_vrom, moveable_vrom)
def realloc_vrom(self, max_vrom, moveable_vrom):
# find strands where vrom isn't taken by an "immoveable vrom file"
vrom_allocator = Allocator()
vrom_allocator.free(0, max_vrom)
for file in self.files:
if file not in moveable_vrom:
vrom_start = file.dma_entry.v... | |
<reponame>yesefujiang/shadowsocksr
ERROR_FIRST = 1000
HASHCHK = 1000
NISAMCHK = 1001
NO = 1002
YES = 1003
CANT_CREATE_FILE = 1004
CANT_CREATE_TABLE = 1005
CANT_CREATE_DB = 1006
DB_CREATE_EXISTS = 1007
DB_DROP_EXISTS = 1008
DB_DROP_DELETE = 1009
DB_DROP_RMDIR = 1010
CANT_DELETE_FILE = 1011
CANT_FIND_SYSTEM_REC = 1012
C... | |
<filename>python/tvm/te/operation.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more ibutor 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 (t... | |
seed : int
Seed value for the random number generator.
show_fig : bool
Whether to show the curve fitting results as a figure.
verbose : bool
Whether to display information (statistics of the loss in each
generation) on the console.
parallel : bool
Whether to use parallel computing across layers, i.e., calculate... | |
from mesa import Model
from mesa.time import BaseScheduler
from mesa.datacollection import DataCollector
from mesa.space import MultiGrid
from mesa.space import ContinuousSpace
import model.ramenScript
from collections import defaultdict
import random
from model.time import Time
from space.room import Room
from space... | |
<reponame>leboncoin/vault-manager<filename>vaultmanager/modules/VaultManagerLDAP.py
import os
import yaml
import logging
import re
from jinja2 import Template
from collections import namedtuple
try:
from lib.VaultClient import VaultClient
from lib.LDAPReader import LDAPReader
import lib.utils as utils
except Import... | |
Session Error", e)
return result, exceptions
def stop_session(self, session_id: int = None) -> bool:
if not session_id:
session_id = self.session.id
result = False
try:
response = self.client.stop_session(session_id)
logging.info("stopped session(%s), result: %s", session_id, response)
result = response.resul... | |
from types import FunctionType
import unittest
from unittest import mock
import uuid
from django.db.utils import ProgrammingError
from django.test import RequestFactory
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from tethys_apps.exceptions import TethysAppSettingDoesNotExist, TethysAppSetti... | |
# coding: utf-8
# In[46]:
import numpy as np
import pandas as pd
#import pyodbc
import pickle
import time
import itertools
from joblib import Parallel, delayed
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.tree import DecisionTreeR... | |
'directors', flag_total, False)
@app.metric('/total-architect-projects', parameters=[ORG.Person],
id='architect-projects', title='Projects of Architect')
def get_total_architects_projects(uid, **kwargs):
flag_total = kwargs.get('begin') is None and kwargs.get('end') is None
args = get_correct_kwargs(kwargs)
retur... | |
= Var(within=Reals,bounds=(0,None),initialize=0)
m.x597 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x598 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x599 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x600 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x601 = Var(within=Reals,bounds=(0,None),initi... | |
= min(1.0, (group_target-group_cum)/(D[prev_node_i,i]))
cone_wt = cone_fraction*D[prev_node_i,i]
group_cum+=cone_wt
group_nodes.append( (prev_node_rho,prev_node_i,
d[prev_node_i] if C else D[prev_node_i,i]) )
if __debug__:
if C:
log(DEBUG-3,"Node %d, added %.2f %% of demand (%.2f)" %\
(prev_node_i, cone_fr... | |
__doc__ = """ Rotation kernels Numpy implementation"""
import functools
from itertools import combinations
import numpy as np
from elastica._linalg import _batch_matmul
@functools.lru_cache(maxsize=1)
def _generate_skew_map(dim: int):
# TODO Documentation
# Preallocate
mapping_list = [None] * ((dim ** 2 - dim) //... | |
kwargs dict and
# cares about presence/absence. So we build a dict to send.
kwargs = {}
if onlySucceeded:
# Check only successful jobs.
# Note that for selectors it is "successful" while for the
# actual object field it is "succeeded".
kwargs['field_selector'] = 'status.successful==1'
if token is not None:
kwa... | |
:] <= self.ymaxgoal):
goalIndices.append(self.nodeList.index(node))
# Select a random node from the goal area
goalNodeIndex = random.choice(goalIndices)
return goalNodeIndex
###########################################################################
def GenerateSamplePath(self, goalIndex):
'''
Generate a li... | |
<filename>backend/machine_learning_main.py
import csv
import json
import numpy as np
import time
from data_class import DataClass
import scipy
# from sklearn.metrics import classification_report
from sklearn.metrics.pairwise import pairwise_distances_argmin
from sklearn.metrics import silhouette_samples, si... | |
0
APPLICANT = 1
INVITEE = 2
class GroupDateRange(Enum):
ALL = 0
PAST_DAY = 1
PAST_WEEK = 2
PAST_MONTH = 3
PAST_YEAR = 4
@dt.dataclass(frozen=True)
class GroupV2Card:
"""A small infocard of group information, usually used for when a list of
groups are returned."""
about: str
avatar_path: str
capabilitie... | |
<filename>src/rightClickHelper/tool/regTool.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json, winreg
from enum import Enum
from src.rightClickHelper.tool.systemTool import SystemTool
class CommandFlag(Enum):
NONE = 0X00000000
HIDE = 0X00000008
class RegEnv(Enum):
# https://docs.microsoft.com/en-us/tro... | |
bernoulli
ind_test = bernoulli[:, 0:test_batch]
prob_hisps.ind_test = ind_test
prob_hisps.x_sync_test = x_sync_test
noise_var = 1 / np.sqrt(M) * math.pow(10., -SNR / 10.)
# bernoulli_ = tf.to_float(tf.random_uniform((N, L)) < pnz)
# xgen_ = bernoulli_ * tf.random_normal((N, L))
# noise_var = pnz * N / M... | |
import asyncio
import base64
import os
import signal
import time
from collections import defaultdict
import pytest
from cryptography.fernet import Fernet
from traitlets import Integer, Float
from traitlets.config import Config
import dask
from dask_gateway import GatewayClusterError, GatewayCluster
from dask_gateway_... | |
<reponame>srihari-nagaraj/anuvaad
from anuvaad_auditor.loghandler import log_info
from anuvaad_auditor.loghandler import log_exception
from anuvaad_auditor.loghandler import log_debug
from collections import namedtuple
from src.utilities.region_operations import collate_regions, get_polygon,sort_regions, remvoe_regions... | |
<reponame>CMPUT404F21-Very-Good-Team/CMPUT404-project-socialdistribution
import json
from functools import partial
import requests
from datetime import datetime, timezone
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth import login as django_login
from django.cont... | |
<reponame>VITA-Group/Audio-Lottery
# 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 l... | |
<reponame>vishalbelsare/DESlib<gh_stars>100-1000
# coding=utf-8
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
import functools
import math
import warnings
from abc import abstractmethod, ABCMeta
import numpy as np
from scipy.stats import mode
from sklearn.base import BaseEstimator, ClassifierMixin
from sklea... | |
<gh_stars>1-10
#!/usr/bin/env python
import numpy
import math
import logging
from scipy.stats import poisson
import networkx as nx
import NetworkX_Extension as nxe
# from GSA import Edge
class NJTree:
logger = logging.getLogger("NJTree")
def __init__(self, mrca, alpha, beta, gamma, gain, loss, synteny):
self.gr... | |
<reponame>rainzhop/ConvNetQuake<gh_stars>0
# coding: utf-8
# The Hazard Library
# Copyright (C) 2013-2016 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3... | |
# Cannot determine a URL to this page - cobble one together based on
# whatever we find in ALLOWED_HOSTS
try:
hostname = settings.ALLOWED_HOSTS[0]
if hostname == '*':
# '*' is a valid value to find in ALLOWED_HOSTS[0], but it's not a valid domain name.
# So we pretend it isn't there.
raise IndexError
except Ind... | |
# Copyright 2016 ETH Zurich
#
# 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 writing, softw... | |
import numpy as np
import os
import os.path as osp
import json
import torch
from rpn.db import SequenceDB, SAMPLE, SEQUENCE
from torch.utils.data import Dataset, Sampler
from torch.utils.data.dataloader import default_collate
from rpn.utils.torch_graph_utils import construct_full_graph, get_edge_features
import rpn.uti... | |
positive is the case where the detector predicts the patch's targeted
class (at a location overlapping the patch). A false positive is the case where the
detector predicts a non-targeted class at a location overlapping the patch. If the
detector predicts multiple instances of the target class (that overlap with the ... | |
# Copyright 2016 <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 or agreed to in writing, software
... | |
import hail as hl
from hail.typecheck import typecheck, sequenceof
from hail.expr.expressions import expr_str, expr_call, expr_locus, expr_array
from typing import List
@typecheck(locus=expr_locus(),
alleles=expr_array(expr_str),
proband_call=expr_call,
father_call=expr_call,
mother_call=expr_call)
def phase_by_t... | |
keypoints_equal(keypoints_aug, keypoints_lr):
nb_keypoints_if_branch += 1
elif keypoints_equal(keypoints_aug, keypoints):
nb_keypoints_else_branch += 1
else:
raise Exception("Received output doesnt match any expected output.")
assert (0.50 - 0.10) <= nb_images_if_branch / nb_iterations <= (0.50 + 0.10)
assert (... | |
elif isinstance(inputstr, unicode):
instr = inputstr.encode("utf8")
else:
return -1
else:
if python.is_string(inputstr):
instr = inputstr
else:
return -1
h = 0x00000000
for i in range(0, len(instr)):
h = (h << 4) + ord(instr[i])
h ^= (h & 0xf0000000) >> 23
h &= 0x0fffffff
return h
def get_focus_widget(... | |
75,20 ), 0 )
bSizer_fuseGroupCtrl3.Add( self.m_textCtrl_fuse6b0, 0, wx.ALL, 5 )
self.m_textCtrl_fuse6c0 = wx.TextCtrl( self.m_panel_fuseUtil, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 75,20 ), 0 )
bSizer_fuseGroupCtrl3.Add( self.m_textCtrl_fuse6c0, 0, wx.ALL, 5 )
self.m_textCtrl_fuse6d0 = wx.Tex... | |
#!/usr/bin/python
#This script is particle filter localization.
#Input: TXT file of map which have [X, Y ,Z, DESCRIPTOR]
#Output: Graphs of visualization for the robot position
# Author : <NAME>
# Contact : <EMAIL>
# Thesis source code, CVUT, Prague, Czech Republic
#Import Libraries
#===================
import numpy... | |
<reponame>ph4m/constrained-rl
# Copyright (c) IBM Corp. 2018. All Rights Reserved.
# Project name: Constrained Exploration and Recovery from Experience Shaping
# This project is licensed under the MIT License, see LICENSE
import pygame
import numpy as np
from enum import Enum
from .nav2d_pos import Nav2dPos
from .obst... | |
StringIO()
rootObj.export(oStreamString, 0, name_="XSDataInputBioSaxsISPyB_HPLCv1_0")
oStreamString.close()
return rootObj
parseString = staticmethod(parseString)
# Static method for parsing a file
def parseFile(_inFilePath):
doc = minidom.parse(_inFilePath)
rootNode = doc.documentElement
rootObj = XSDataInpu... | |
as
# NULL in the db.
cdata = cdata.replace(np.nan, '', regex=True)
cdata = cdata.applymap(lambda x: str(x).strip() if len(str(x).strip()) else None)
return cdata
def get_data_after_colon(row, header):
# return the data after the colon in the row, or None
if ':' in str(row[header]):
colon_loc = str(row[header]... | |
<filename>clever/src/simple_offboard.py
#!/usr/bin/env python
from __future__ import division
import rospy
from geometry_msgs.msg import TransformStamped, PoseStamped, Point, PointStamped, Vector3, \
Vector3Stamped, TwistStamped, QuaternionStamped
from sensor_msgs.msg import NavSatFix, BatteryState
import tf2_ros
imp... | |
# coding: utf-8
"""This module is a wrapper to ``argparse`` module. It allow to generate a
command-line from a predefined directory (ie: a YAML, JSON, ... file)."""
import os
import re
import sys
import importlib
import copy
import pydoc
import argparse
from collections import OrderedDict
#
# Constants.
#
# Get curr... | |
<gh_stars>1-10
import time
import queue
import PySpin
import numpy as np
import multiprocessing as mp
from scipy.ndimage import gaussian_filter as gaussian
_PROPERTIES = {
'FRAMERATE': {
'minimum': 1,
'maximum': 200,
'initial': 30
},
'BINSIZE': {
'initial': (2, 2)
},
'WIDTH': {
'initial': 1440
},
'HEIGHT':... | |
# Copyright 1997 - 2018 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, p... | |
= False
for obj in self.model.grid.get_cell_list_contents(next):
if obj.__class__.__name__ in ["Adult", "Child", "Obstacle", "Fire", "Heat", "Smoke"]:
log("Path blocked by " + obj.__class__.__name__)
# If path blocked by another agent, wait, and move randomly to avoid blockages
if obj.__class__.__name__ in ["... | |
-0.86859548568613],
[-0.73152230491144, 0.62253568842167, -0.89101338351023],
[-1.00000000000000, 0.81459905395471, -0.90729952697735],
[-0.90729952697735, 0.81459905395471, -0.90729952697735],
[-1.00000000000000, 0.93400143040806, -0.93400143040806],
[-1.00000000000000, -1.00000000000000, -0.78448347366314],
[-0... | |
# -*- coding: utf-8 -*-
import io
import requests
from lxml import etree, objectify
from xml.etree import ElementTree as ET
from uuid import uuid4
import pprint
import logging
from odoo.addons.payment.models.payment_acquirer import _partner_split_name
from odoo.exceptions import ValidationError, UserError
from odoo im... | |
#recall that our 3d left and right are approximately cubes in python lists, so put them in zero padded numpy arrays to be actual cubes
left = get_numpy_cube(response_matrices[filter][t], spatial_info_l, 0)
right = get_numpy_cube(response_matrices[filter][t], spatial_info_r, lcount)
#we can lose any notion of 3d spa... | |
<gh_stars>0
#
# MIT License
#
# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limi... | |
#!/usr/bin/env python
"""
Validator script for BOT-level Fe55 analysis.
"""
from __future__ import print_function
import os
import glob
from collections import OrderedDict
import pickle
import numpy as np
from astropy.io import fits
import lcatr.schema
import siteUtils
import eotestUtils
import lsst.eotest.sensor as se... | |
<reponame>ybarancan/STSU
import os
from PIL import Image
import torch
from torch.utils.data import Dataset
from torchvision.transforms.functional import to_tensor
from src.utils import bezier
from .utils import IMAGE_WIDTH, IMAGE_HEIGHT, ARGOVERSE_CLASS_NAMES
from ..utils import decode_binary_labels
import numpy as n... | |
raise TypeError(msg)
# 2.1.5
class WrappingMethod(Enumeration):
def __init__(self, value=None):
super(WrappingMethod, self).__init__(
enums.WrappingMethod, value, Tags.WRAPPING_METHOD)
class EncodingOption(Enumeration):
def __init__(self, value=None):
super(EncodingOption, self).__init__(
enums.EncodingOpti... | |
import socket
import asyncio
import os
import re
import http
import gzip
import select
import signal
import json
import traceback
from .timer import Timer
from urllib.parse import unquote
from .logger import info, error, warning
from typing import Any, Union, Tuple, Dict, Callable, Coroutine, List, Iterabl... | |
super(IKTaskSet, self).adoptAndAppend(aIKTask)
__swig_destroy__ = _tools.delete_IKTaskSet
__del__ = lambda self: None
IKTaskSet_swigregister = _tools.IKTaskSet_swigregister
IKTaskSet_swigregister(IKTaskSet)
def IKTaskSet_safeDownCast(obj):
"""
IKTaskSet_safeDownCast(OpenSimObject obj) -> IKTaskSet
Parameters
-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.