input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
ddt) list."""
if self._status == 0:
assert type(self._n_div) is int, (
"The number of division must be defined and it must be an integer type."
);
assert self._d_set and hasattr(self._d_set, '__iter__'), (
"The dataset must be not null and iterable type."
);
size = len(self._d_set);
ndiv = self._n_div;
# div... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui # Import the PyQt4 module we'll need
import sys # We need sys so that we can pass argv to QApplication
import os
import subprocess # So pyoperant can run for each box without blocking the rest of the GUI
import serial # To connect directly to... | |
result: {}'.format(check_result))
log_file_logger.error('#06: Check Analysis: {}\n'.format(check_analysis))
writeFile(report_file, 'Result: ERROR - {}\n'.format(check_analysis))
writeFile(report_file, 'Action: {}\n\n'.format(check_action))
else:
log_file_logger.info('#06: Check result: {}'.for... | |
<filename>udd-mirror/scraper.py
#! /usr/bin/env python3
#
# Copyright (c) 2018-2020 FASTEN.
#
# This file is part of FASTEN
# (see https://www.fasten-project.eu/).
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work fo... | |
<filename>wc_model_gen/eukaryote/initialize_model.py
""" Initialize the construction of wc_lang-encoded models from wc_kb-encoded knowledge base.
:Author: <NAME> <<EMAIL>>
:Date: 2019-01-09
:Copyright: 2019, Karr Lab
:License: MIT
"""
from wc_utils.util.chem import EmpiricalFormula, OpenBabelUtils
from wc_utils.util.... | |
isInsideRegion(self, maxWidth, maxHeight):
if self.left >= 0 and self.top >= 0 and self.right < maxWidth and self.bottom < maxHeight:
return True
else:
return False
def isValid(self):
if self.left>=self.right or self.top>=self.bottom:
return False
if min(self.rect()) < -self.MAX_VALID_DIM or max(self.rect()) >... | |
uk_107
+ 445500 * uk_108
+ 5177717 * uk_109
+ 8774387 * uk_11
+ 2693610 * uk_110
+ 359148 * uk_111
+ 5955871 * uk_112
+ 6734025 * uk_113
+ 2693610 * uk_114
+ 1401300 * uk_115
+ 186840 * uk_116
+ 3098430 * uk_117
+ 3503250 * uk_118
+ 1401300 * uk_119
+ 4564710 * uk_12
+ 24912 * uk_120
+ 413124 * uk_121
... | |
import math
import itertools
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
import scipy.stats as ss
import scikit_posthocs as sp
from dash_table.Format import Format, Scheme
from Bio import Phylo
from ete3 import Tree
from plotly.subplots import make_subplots
# -... | |
"/location/location",
"/location/citytown",
"/user/joehughes/default_domain/transit_service_area",
"/location/dated_location",
"/location/statistical_region",
"/government/governmental_jurisdiction"
],
"id": "/en/duluth",
"name": "Duluth"
},
"id": "/en/bob_dylan"
}
"""
self.DoQuery(query, exp_response=exp_... | |
# # PACKED-BED REACTOR MODEL
# # -------------------------
# # import packages/modules
# import math as MATH
# import numpy as np
# from library.plot import plotClass as pltc
# from scipy.integrate import solve_ivp
# # internal
# from core.errors import errGeneralClass as errGeneral
# from data.inputDataReactor import... | |
<reponame>MechMaster48/RainbowSixSiege-Python-API<gh_stars>100-1000
"""
Copyright (c) 2016-2020 jackywathy
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 li... | |
grep LISTEN | grep usbredir | awk '{print $4}' | awk -F ':' '{ print $4 }'")
if r != 0:
rsp.success = False
rsp.error = "unable to get started usb server port"
return jsonobject.dumps(rsp)
existPort = o.split("\n")
for value in cmd.portList:
uuid = str(value).split(":")[0]
port = str(value).split(":")[1]
if po... | |
<filename>ndmaze/src/ndmaze.py
#! /usr/bin/env python3
import numpy as np
from enum import Enum
from random import randint
import argparse
import sys
def matrix_to_graph(matrix):
graph = dict()
for i, cell in enumerate(matrix):
if cell == 0:
graph[i] = matrix.getOrthogonalNeighbors()
class nd_maze():
def _... | |
Input: height = [4,2,0,3,2,5]
Output: 9
"""
def trap(self, height: List[int]) -> int:
l, r = 0, len(height) - 1
l_max = r_max = area = 0
while l < r:
if height[l] < height[r]:
if height[l] < l_max:
area += l_max - height[l]
else:
l_max = height[l]
l += 1
else:
if height[r] < r_max:
area += r_max - heig... | |
'┠'
rb = '┨'
anim1 = ['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷']
anim2 = ['⣷', '⣯', '⣟', '⡿', '⢿', '⣻', '⣽', '⣾']
bs = len(ls) + len(anim1[0]) + len(lb) + len(rb) + len(anim2[0])
maxlen = 0
f = min(len(anim1), len(anim2))
barlength = None
minpctsz = len("─1%─┤")
cd = lambda x: colored(x, 'yellow')
def eraseLine(... | |
of corruption to use
corruption_level = T.scalar('corruption')
# momentum rate to use
momentum = T.scalar('momentum')
assert method in ['cm','adagrad','adagrad_momentum']
# begining of a batch, given `index`
batch_begin = index * batch_size
# ending of a batch given `index`
batch_end = batch_begin + batch_... | |
18.1043],
[6002500, 2, 0, 4, 4, 19.5111],
[6021120, 13, 1, 1, 2, 16.7469],
[6048000, 8, 3, 3, 1, 16.1748],
[6050520, 3, 2, 1, 5, 22.1156],
[6075000, 3, 5, 5, 0, 17.0911],
[6096384, 9, 5, 0, 2, 16.3736],
[6123600, 4, 7, 2, 1, 16.1739],
[6125000, 3, 0, 6, 2, 18.9867],
[6144000, 14, 1, 3, 0, 17.1476],
[6146560, 9, 0, 1, 4... | |
<filename>src/keras/tests/keras/engine/test_topology.py
import pytest
import json
import numpy as np
from keras.layers import Dense, Dropout, Conv2D, InputLayer
from keras import layers
from keras.engine import Input, Layer, saving, get_source_inputs
from keras.models import Model, Sequential
from keras import... | |
<gh_stars>10-100
import os
import sys
import numpy as np
import tensorflow as tf
sys.path.append('util')
import vis_primitive
import vis_pointcloud
from data_loader import *
from encoder import *
from decoder import *
from loss_function import *
tf.app.flags.DEFINE_string('log_dir', 'log/initial_traini... | |
<reponame>erich666/apitrace
#!/usr/bin/env python
##########################################################################
#
# Copyright 2011 <NAME>
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softw... | |
<reponame>WertiaCoffee/GeminiMotorDrive
# Copyright 2014-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 appl... | |
<filename>tests/test_steady_db.py<gh_stars>100-1000
"""Test the SteadyDB module.
Note:
We do not test any real DB-API 2 module, but we just
mock the basic DB-API 2 connection functionality.
Copyright and credit info:
* This test was contributed by <NAME>
"""
import unittest
from . import mock_db as dbapi
from dbu... | |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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, Optional, Sequence, Union, overload
from ... import _utilities
fro... | |
<reponame>gabrielgomesml/AlgorithmAndDataStructureActivities<gh_stars>0
class GrafoLista:
def __init__(self, iteravel, ponderado=False, direcionado=False):
self.iteravel = iteravel
self.ponderado = ponderado
self.direcionado = direcionado
self.listaDeAdj = {}
self.criarListas(iteravel, ponderado, direcionado)
d... | |
<gh_stars>1-10
#!/usr/bin/env python3 # NOQA
# -*- coding: utf-8 -*-
"""ruamel_config, yaml based config object using the ruamel python module"""
# pylint: disable=line-too-long
# pylint: disable=W1202
# TODO: 2/24/2018 - Try to get the most simplified ruamel config working
#################################
# NOTE:... | |
8))
(Re,) = unpack("=1d", stateFile.read(1 * 8))
(tilt_angle,) = unpack("=1d", stateFile.read(1 * 8))
(dt,) = unpack("=1d", stateFile.read(1 * 8))
(itime,) = unpack("=1i", stateFile.read(1 * 4))
(time,) = unpack("=1d", stateFile.read(1 * 8))
ny_half = ny // 2
nxp, nzp = nx // 2 - 1, nz // 2 - 1
header = (forci... | |
"param3": "https://foo.com",
},
},
{
"component_ref": {"hub": "echo"},
"name": "C",
"params": {
"param1": "{{ ops.A.outputs.x }}",
"param2": "{{ ops.B.outputs.x }}",
},
},
{
"component_ref": {"hub": "echo"},
"name": "D",
"dependencies": ["B", "C"],
},
],
}
config = DagConfig.from_dict(config_dict)
c... | |
<filename>differint/differint.py
import numpy as np
import math
def isInteger(n):
assert (n >= 0 and (type(n) is type(0))), "n must be a positive integer or zero: %r" % n
def checkValues(alpha, domain_start, domain_end, num_points):
""" Type checking for valid inputs. """
assert type(num_points) is type(1), "num... | |
<gh_stars>0
# -*- coding: utf-8 -*-
"""parking_model_based.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/github/eleurent/highway-env/blob/master/scripts/parking_model_based.ipynb
# Model-Based Reinforcement Learning
## Principle
We consider the optimal... | |
<reponame>monotropauniflora/PartSeg<filename>package/PartSeg/common_gui/algorithms_description.py
import collections
import typing
from abc import ABCMeta, abstractmethod
from copy import deepcopy
from enum import Enum
from qtpy.QtCore import Signal
from qtpy.QtGui import QHideEvent, QPainter, QPaintEvent
from qtpy.Qt... | |
<reponame>nazihkalo/Crypto-Social-Scraper-App
import json
import os
from pathlib import Path
import time
from typing import List
import pandas as pd
import requests
from dotenv import load_dotenv
from rich import print
from rich.progress import track
from tqdm import tqdm
# from top_github_scraper.utils import ScrapeG... | |
<filename>pygame_vkeyboard/vtextinput.py<gh_stars>0
#!/usr/bin/env python
# coding: utf8
"""
Text box to display the current text. The mouse events are
supported to move the cursor at the desired place.
"""
import pygame # pylint: disable=import-error
from .vrenderers import VKeyboardRenderer
class VBackground(pyg... | |
from datetime import datetime
import tensorflow as tf
import os
import numpy as np
from typing import List
class TransferVGG(object):
@classmethod
def get_model(cls, img_w=256, img_h=256, decoding_start_f=512, keep_last_max_pooling=True, fine_tuning=True):
vgg: tf.keras.Model = tf.keras.applications.VGG19(includ... | |
1)
m.c1916 = Constraint(expr= m.b203 - m.b204 + m.b280 <= 1)
m.c1917 = Constraint(expr= m.b203 - m.b205 + m.b281 <= 1)
m.c1918 = Constraint(expr= m.b203 - m.b206 + m.b282 <= 1)
m.c1919 = Constraint(expr= m.b203 - m.b207 + m.b283 <= 1)
m.c1920 = Constraint(expr= m.b203 - m.b208 + m.b284 <= 1)
m.c1921 = Constraint(... | |
<reponame>zhammer/dd-trace-py<gh_stars>1-10
import grpc
from grpc._grpcio_metadata import __version__ as _GRPC_VERSION
import time
from grpc.framework.foundation import logging_pool
from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY
from ddtrace.contrib.grpc import patch, unpatch
from ddtrace.contrib.grpc import c... | |
import pytest
from textwrap import dedent
import attr
import numpy as np
import re
from bionic.descriptors.parsing import dnode_from_descriptor
from bionic.exception import CodeVersioningError
from bionic.utils.misc import single_element, single_unique_element
import bionic as bn
from ..helpers import import_code
... | |
from math import gcd
from ..utils.math import cartesian
import numpy as np
import warnings
import copy
from .array_elements import ISOTROPIC_SCALAR_SENSOR
from .perturbations import LocationErrors, GainErrors, PhaseErrors, \
MutualCoupling
class ArrayDesign:
"""Base class for all array designs.
Arrays can be 1D, 2... | |
import datanator.config.core
from datanator.util import mongo_util
from datanator.util import file_util, chem_util
from datanator.util import molecule_util
import requests
from xml import etree
import libsbml
import re
import datetime
import bs4
import html
import csv
import pubchempy
import sys
import Bio.Alphabet
imp... | |
<filename>algorithm.py
import copy
import numpy as np
class FFDAlgorithm(object):
def __init__(self, num_x, num_y, num_z, filename, object_points): #定义三坐标轴上控制点个数
self.cp_num_x = num_x
self.cp_num_y = num_y
self.cp_num_z = num_z
self.object_points_initial = object_points
def cover_obj(self, initial=True): #对obj... | |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 applicab... | |
None): # noqa: E501
raise ApiValueError("Missing the required parameter `name` when calling `get_component_version_stages`") # noqa: E501
collection_formats = {}
path_params = {}
if 'owner' in local_var_params:
path_params['owner'] = local_var_params['owner'] # noqa: E501
if 'entity' in local_var_params:
path_... | |
<gh_stars>0
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# pylint: disable=protected-access,too-many-lines
"""Integration tests for `WithSOX302Flow` logic."""
import collections
import ddt
from ggrc.converters import errors
from ggrc.models import ... | |
"""
Dictionaries containing basic atomic data.
The periodic tabla data is from: http://periodic.lanl.gov/index.shtml
"""
import collections
import astropy.units as u
_PeriodicTable = collections.namedtuple(
"periodic_table", ['group', 'category', 'block', 'period']
)
_Elements = {
"H": {
"atomic number": 1,
"a... | |
return _STEPConstruct.STEPConstruct_AP203Context_GetApproval(self, *args)
def GetApprover(self, *args):
"""
:rtype: Handle_StepBasic_ApprovalPersonOrganization
"""
return _STEPConstruct.STEPConstruct_AP203Context_GetApprover(self, *args)
def GetApprovalDateTime(self, *args):
"""
:rtype: Handle_StepBasic_Appr... | |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# ... | |
# -*- coding: utf-8 -*-
import os
import unittest.mock as mock
import pytest
from unidiff import PatchSet
from badwolf.spec import Specification
from badwolf.context import Context
from badwolf.lint.processor import LintProcessor
from badwolf.utils import ObjectDict
CURR_PATH = os.path.abspath(os.path.dirname(__fil... | |
# Copyright 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.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by... | |
verbose=False, i_up=None, i_G1=None, UW=None, UUW=None, h2=0.5, **kwargs):
'''
For a given h2, finds the optimal kernel mixture weight a2 and returns the negative log-likelihood
Find the optimal a2 given h2, such that K=(1.0-a2)*K0+a2*K1. Performs a double loop optimization (could be expensive for large grid-sizes... | |
that contains classes sub-packages from the
For a split package this contains a list of classes in that package that are
provided by the bootclasspath_fragment and a list of classes
"""
# The list of classes/sub-packages that is provided by the
# bootclasspath_fragment.
bcpf: typing.List[str]
# The list of cla... | |
<gh_stars>0
from __future__ import absolute_import
from __future__ import division
from builtins import map
from builtins import range
from past.utils import old_div
from builtins import object
from .consts import *
from .utils import *
from six.moves import map
from six.moves import range
class _dumb_repr(object):
d... | |
from collections import OrderedDict
import os
import json
import re
import sys
import pytest
import yaml
from conda_build import api, exceptions, variants
from conda_build.utils import package_has_file, FileNotFoundError
thisdir = os.path.dirname(__file__)
recipe_dir = os.path.join(thisdir, 'test-recipes', 'variants... | |
<gh_stars>10-100
"""
Code generator for ECOS C folder.
Spits out
Makefile
socp2prob.(c/h)
prob2socp.(c/h)
Will copy files to a folder with name "name". Produce a Makefile that compiles
the object files. Only really need one copy of qcml_utils across all generated
code....
Need to compile qcml_utils.c to a qcml_util... | |
#Standard python libraries
import os
import warnings
import copy
import time
import itertools
import functools
#Dependencies - numpy, scipy, matplotlib, pyfftw
import numpy as np
import matplotlib.pyplot as plt
import pyfftw
from pyfftw.interfaces.numpy_fft import fft, fftshift, ifft, ifftshift, fftfreq
from scipy.int... | |
pylint: disable-msg=too-many-arguments
def show_slide(self, slide_name: str, transition: Optional[str] = None,
key: Optional[str] = None, force: bool = False, priority: int = 0,
show: Optional[bool] = True, expire: Optional[float] = None,
play_kwargs: Optional[dict] = None, **kwargs) -> bool:
"""
Request to show ... | |
LayerStack.
`layers` is a list of TransformerLayer objects representing the
building blocks of the transformer model, e.g.
transformer_layers.SelfAttention.
In addition, there are a bunch of other transformations which occur around
the layer body, and at the beginning and the end of the layer stack. We
call the... | |
example, the
actual exponentiation is done by Python at compilation time, so while
the expression can take a noticeable amount of time to compute, that
time is purely due to the compilation:
In [5]: time 3**9999;
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
In [6]: time 3**999999;
CPU ... | |
min(minimum_x, x)
maximum_x = max(maximum_x, x)
minimum_y = min(minimum_y, y)
maximum_y = max(maximum_y, y)
return P2D(minimum_x, minimum_y), P2D(maximum_x, maximum_y)
# SimplePolygon.corner_arc_append():
def corner_arc_append(self, corner: P2D, corner_radius: float,
flags: str, tracing: bool = False) -> None:
... | |
...]]
"""
return list(product(*(factor.levels for factor in self.window.factors)))
@dataclass(eq=False)
class ElseLevel(Level):
# TODO: I'm honestly not sure what this kind of level is for, semantically.
"""A :class:`.Level` for... something.
:param name:
The name of the level.
"""
def derive_level_from_lev... | |
"b24-31-cap29": {
"ap_mac": "6c71.edff.0593",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B24_B24-3_fed6b",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b24-21-cap33": {
"ap_mac": "6c71.edff.0597",
"site_tag_name": "default-site-tag-fabric",
"poli... | |
2),('yi', 1),
]),
(7,[('cheng', 2),('xiang', 4),('ci', 2),('tang', 2),('he', 2),('chu', 4),('xun', 2),
('jin', 3),('guan', 1),('cheng', 2),('wai', 4),('bai', 3),('sen', 1),('sen', 1),
('ying', 4),('jie', 1),('bi', 4),('cao', 3),('zi', 4),('chun', 1),('se', 4),
('ge', 2),('ye', 4),('huang', 2),('li', 2),('kong', 1),... | |
np.sum(a['chfhat'][ :, : , ntask, 1, 1 ], axis = 0) + \
np.sum(a['ghfhat'][ :, : , ntask, 1, 1 ], axis = 0)), \
np.sum(a['ghfhat'][ :, : , ntask, 0, 0 ], axis = 1)))
"""
#DEBUG. #############################################
import pdb; pdb.set_trace();
vd = np.zeros((n_total,n_total))
vd[ np.eye(n_total).asty... | |
<gh_stars>10-100
import argparse
import glob
import os
import re
import sys
import types
if sys.version_info >= (3, 0):
from io import StringIO
else:
from StringIO import StringIO
if sys.version_info < (2, 7):
from ordereddict import OrderedDict
else:
from collections import OrderedDict
ACTION_TYPES_THAT_DONT_N... | |
import numpy as np
import os
import os.path as osp
from unittest import TestCase
from datumaro.components.dataset_filter import (
XPathDatasetFilter, XPathAnnotationsFilter, DatasetItemEncoder)
from datumaro.components.dataset import (Dataset, DEFAULT_FORMAT, ItemStatus,
eager_mode)
from datumaro.components.environ... | |
(A user's username.), parameter "public_read" of Long,
parameter "at_least" of type "boolean" (A boolean value, 0 for
false, 1 for true.), parameter "as_admin" of type "boolean" (A
boolean value, 0 for false, 1 for true.)
"""
return self._client.run_job('SampleService.update_sample_acls',
[params], self._service_... | |
"""
Class Features
Name: driver_data_io_dynamic
Author(s): <NAME> (<EMAIL>)
Date: '20210408'
Version: '1.0.0'
"""
######################################################################################
# Library
import logging
import os
import numpy as np
import pandas as pd
import xarray as xr
from copy import deepc... | |
from logs import logDecorator as lD
import jsonref, pprint
import numpy as np
import matplotlib.pyplot as plt
import csv, json
from psycopg2.sql import SQL, Identifier, Literal
from lib.databaseIO import pgIO
from collections import Counter
from textwrap import wrap
from tqdm import tqdm
from multiprocessing import... | |
tf.stop_gradient(out)
return out
class CpcLearner(tf.keras.Model):
"""A learner for CPC."""
def __init__(self,
state_dim,
action_dim,
embedding_dim = 256,
num_distributions = None,
hidden_dims = (256, 256),
sequence_length = 2,
ctx_length = None,
ctx_action = False,
downstream_input_mode = 'embed',
lear... | |
import logging
logger = logging.getLogger(__name__)
from pyramid.view import view_config
from pyramid.security import authenticated_userid
import models
from pyramid.httpexceptions import HTTPFound
from owslib.wps import WebProcessingService
import os
DEFAULTQUALITYSERVER="http://suffolk.dkrz.de:8094/wps"
@view_confi... | |
<filename>annofabapi/generated_api2.py
# flake8: noqa: W291
# pylint: disable=too-many-lines,trailing-whitespace
"""
AbstractAnnofabApi2のヘッダ部分
Note:
このファイルはopenapi-generatorで自動生成される。詳細は generate/README.mdを参照
"""
import abc
import warnings # pylint: disable=unused-import
from typing import Any, Dict, List, Optional,... | |
mailsane.normalize(request.json['email'])
if address.error:
return jsonify({'message' : str(address), 'valid' : False})
if dbworker.getUser(str(address)) is None:
return jsonify({'message' : 'Email address not found', 'valid' : False})
return jsonify({'message' : None, 'valid' : True})
@app.route('/api/loghou... | |
<filename>dev/Tools/build/waf-1.7.13/lmbrwaflib/third_party.py<gh_stars>0
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software... | |
from __future__ import print_function, division, absolute_import
from collections import defaultdict, deque
from datetime import timedelta
from importlib import import_module
import heapq
import logging
import os
import random
import tempfile
from threading import current_thread, Lock, local
from timeit import default... | |
<reponame>Mattlau04/Splatnet2-Rich-Presence
import json
import math
import os
import time
import pypresence
import click
import nso_functions
from pypresence import Presence
from datetime import datetime, timedelta
from config.logger import logger
# this acts as the core controller which allows us to interface with t... | |
"""
interface_wrapper.py - EXCALIBUR high level API for the ODIN server.
<NAME>, DLS
"""
import sys
import traceback
import logging
import json
from datetime import datetime
import time
import threading
import getpass
is_py2 = sys.version[0] == '2'
if is_py2:
import Queue as queue
else:
import queue as queue
from e... | |
'fn(i32, const u8*, usize) -> errsize',
source=self.__argname__), False
yield Export(
'__box_%s_flush' % box.name,
'fn(i32) -> err',
source=self.__argname__), False
# exports that need linking
for export in parent.exports:
if any(link.import_.box == box for link in export.links):
yield export.prebound(), len(... | |
<filename>bayesian_framework/inference/stochastic_models/stochastic_models.py
from __future__ import annotations
import collections
from abc import ABC, abstractmethod
from typing import NoReturn, Tuple, Union
import numpy as np
from scipy.stats import gamma, multivariate_normal
import bayesian_framework.shared.cova... | |
mnemonic_builder[precision](precision, cond_specifier)
def expand_sse_avx_bool_comparison(optree):
""" Expand a comparison between numeric values to a boolean output
to a comparison with numeric format for result (supported by SSE/AVX)
and a cast to boolean format to match operand prototype """
lhs = optree.get_i... | |
<reponame>yuanyuan-deng/RDM-osf.io
# -*- coding: utf-8 -*-
# mAP core Group / Member syncronization
import time
import datetime
import logging
import os
import sys
import requests
import urllib
import re
from operator import attrgetter
from pprint import pformat as pp
from urlparse import urlparse
from django.utils ... | |
keep it
# in the `endpoint` command we use the standard
if ip_as_string and isinstance(ip, list):
ip = ip[0]
os_type = convert_os_to_standard(single_endpoint.get('os_type', ''))
endpoint = Common.Endpoint(
id=single_endpoint.get('endpoint_id'),
hostname=hostname,
ip_address=ip,
os=os_type,
status=status,
is_... | |
This creates a new copy of the message in the destination folder and
removes the original message.
### Parameters
----
message_id : str
The ID of the message you wish to move.
destination_id : str
The name of the folder you want to move it to.
### Returns
----
Dict
If successful, this method returns 201 C... | |
import os
import numpy as np
import argparse
import time
import torch
import torchvision
import cv2
def yolo_forward_dynamic(output, num_classes, anchors, num_anchors, scale_x_y):
# Output would be invalid if it does not satisfy this assert
# assert (output.size(1) == (5 + num_classes) * num_anchors)
... | |
<filename>coral_model_v0/RunTimeD3D.py
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 13 10:37:17 2020
@author: hendrick
"""
# =============================================================================
# # # # import packages
# =============================================================================
import nu... | |
'US IMAGE IOD': ['Study'],
'GENERAL ECG IOD': ['Study'],
'XRF IMAGE IOD': ['Study'],
'ENCAPSULATED CDA IOD': ['Study'],
'ENHANCED SR IOD': ['Study'],
'VL PHOTOGRAPHIC IMAGE IOD': ['Study'],
'GENERAL AUDIO WAVEFORM IOD': ['Study'],
'MR IMAGE IOD': ['Study'],
'OPHTHALMIC TOMOGRAPHY IMAGE IOD': ['Study'],
'VIDEO ... | |
conversion to records on 1D series"
series = ts.time_series([1, 2, 3],
start_date=ts.Date('M', '2001-01-01'),
mask=[0, 1, 0])
ndtype = [('_dates', int), ('_data', int), ('_mask', bool)]
control = np.array([(24001, 1, False),
(24002, 2, True),
(24003, 3, False)], dtype=ndtype)
test = series.torecords()
assert_e... | |
media."""
return await self.request(ep.MEDIA_CLOSE)
async def rewind(self):
"""Rewind media."""
return await self.request(ep.MEDIA_REWIND)
async def fast_forward(self):
"""Fast Forward media."""
return await self.request(ep.MEDIA_FAST_FORWARD)
# Keys
async def send_enter_key(self):
"""Send enter key."""
r... | |
not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ipv4_acl_cfg as meta
return meta._meta_table['Ipv4AclAndPrefixList.Accesses.Access.AccessListEntries.AccessListEntry.NextHop.NextHop1']['meta_in... | |
# compute gradient and do update step
optimizer.zero_grad()
loss.backward()
optimizer.step()
# model_grad = get_network_grad_flow(model)
# model_grads.update(model_grad)
# measure accuracy and record loss
losses.update(loss.item(), input.size(0))
diversity_losses.update(diversity_loss.item(), input.size(0))
... | |
"""
Copyright 2019 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | |
<reponame>sthagen/numba-numba
import math
import operator
import sys
import pickle
import multiprocessing
import ctypes
import warnings
from distutils.version import LooseVersion
import re
import numpy as np
from numba import njit, jit, vectorize, guvectorize, objmode
from numba.core import types, errors, typing, com... | |
#=================================================================================================
##################################################################################################
# TODO:
#
# 1. Resolve: Is the q-integrand that of Essig's Eq. 3.13 or a mix of 3.13 and 4.4? (correction_option==0,1)
# ... | |
import datetime as dt
from io import StringIO
import logging
import numpy as np
import os
import pytest
import warnings
import aacgmv2
class TestConvertArray:
def setup(self):
self.out = None
self.ref = None
self.rtol = 1.0e-4
def teardown(self):
del self.out, self.ref, self.rtol
def evaluate_output(self, i... | |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
_weights_dict = dict()
def load_weights(weight_file):
if weight_file == None:
return
try:
weights_dict = np.load(weight_file, allow_pickle=True).item()
except:
weights_dict = np.load(weight_file, allow_pickle=True... | |
<reponame>kanzeparov/NuCypher
"""
This file is part of nucypher.
nucypher 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 version.
nucypher is distr... | |
= re.sub(
r"CMD .*\n",
'CMD ["coverage", "run", "/usr/share/scalyr-agent-2/py/scalyr_agent/agent_main.py", '
'"--no-fork", "--no-change-user", "start"]',
new_dockerfile_source,
)
with open("Dockerfile", "w") as file:
file.write(new_dockerfile_source)
tar.add("Dockerfile")
tar.add(source_tarball)
tar.close()... | |
for balls, need to scale?#by default : 0.3?
sphers=[]
k=0
n='S'
AtmRadi = {"A":1.7,"N":1.54,"C":1.7,"P":1.7,"O":1.52,"S":1.85,"H":1.2}
if R == None : R = 0.
if scale == 0.0 : scale = 1.0
if mat == None : mat=create_Atoms_materials()
if name.find('balls') != (-1) : n='B'
if geom is not None:
coords=geom.g... | |
<filename>Alignment/OfflineValidation/python/TkAlAllInOneTool/dataset.py
from __future__ import print_function
from __future__ import absolute_import
# idea stolen from:
# http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/
# PhysicsTools/PatAlgos/python/tools/cmsswVersionTools.py
from builtins import range
import bisect... | |
<reponame>raphaelsulzer/convolutional_occupancy_networks<gh_stars>0
import os
import glob
import random
import sys
from PIL import Image
import numpy as np
import trimesh
from src.data.core import Field
from src.utils import binvox_rw
from src.common import coord2index, normalize_coord
class IndexField(Field):
''' ... | |
<reponame>Taye310/Shift-Net_pytorch<gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
# For original shift
from models.shift_net.InnerShiftTriple import InnerShiftTriple
from models.shift_net.InnerCos import InnerCos
# For res shift
from models.res_shift_net.innerResShiftTriple import Inne... | |
<reponame>bryanchriswhite/agents-aea
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | |
<reponame>phrb/orio_experiments
# ZestyParser 0.8.1 -- Parses in Python zestily
# Copyright (C) 2006-2007 <NAME>
#
# 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, includi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.