text stringlengths 3.07k 12.6k |
|---|
from dataclasses import dataclass
from typing import List
from pyskiplist.skiplist import dumpNodes, SkipList, SkiplistNode # pyskiplist enhancements in djbpitt fork
import pprint # for debugging
pp = pprint.PrettyPrinter(indent=2)
# Dataclasses, variables, and functions for SVG visualization of skiplist
# Input p... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import sys
sys.path.append("../../../")
import numpy as np
from sklearn.svm import SVR
from sklearn.model_selection import KFold, LeaveOneOut, RepeatedKFold, ShuffleSplit
import deepxdeNEW a... |
def heapsort(l):
"""
Sort a list using the heap (assuming there are no repeated values).
>>> heapsort([1, 6, 2, 8, 9, 14, 4, 7])
[1, 2, 4, 6, 7, 8, 9, 14]
"""
q = PQueue()
for (i, x) in enumerate(l): q.update(i, x)
return [ q.pop_smallest()[1] for x in l ]
def _parent(i):
"""
R... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack 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 requ... |
from datetime import datetime
from functools import partial
import logging
import os
import uuid
from urllib.parse import unquote
from rf.models import Band
from rf.models import Scene
from rf.uploads.geotiff import create_geotiff_image
from rf.uploads.modis.create_geotiff import create_geotiffs
from rf.uploads.modis.... |
def get_nba_data(endpoint, params, return_url=False):
"""Retrieves data from http://stats.nba.com
For community documentation, visit
https://github.com/seemethere/nba_py/wiki/stats.nba.com-Endpoint-Documentation.
Args:
endpoint: endpoint specifies data table
params: dicti... |
import os
from twisted.internet import protocol, reactor
from twisted.internet.protocol import Protocol
from twisted.internet.defer import succeed
from twisted.internet.error import ProcessDone
from twisted.python import log
from gi.repository import Gtk
from gridtogo.client.ui.dialog import *
from twisted.web.client i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Test Fixture """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import ... |
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2019 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
import os
import pytest
import numpy as np
from pyuvdata.data import DATA_PATH
from pyuvdata import UVBeam
from pyuvdata.uvbeam.mwa_beam import P1sin, P1sin_array
import pyuvdata.tests a... |
###############################################################################
#
# Copyright (c) 2017 Estimation and Control Library (ECL). All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
... |
import tensorflow as tf
from tensorflow.python.framework import ops
'''
Wrap the module
'''
_nknn_op = tf.load_op_library('slicing_knn.so')
def check_tuple(in_tuple, tuple_name: str, tuple_type: type):
if in_tuple is None:
raise ValueError("<", tuple_name, "> argument is not specified!")
if len(in_t... |
"""
Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : C3510642
# Test Case Title : Check that when no physX terrain component is added, collision o... |
#!/usr/bin/env python3
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed
# under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... |
'''
Generate bounding box as the minimum exterior rectangle of a cluster by searching.
'''
import os
from ctypes import alignment
from frame import get_frames, get_timestamps
import matplotlib.pyplot as plt
import matplotlib.patches as pc
from numpy import ndarray, max, min, abs, zeros, where,array, cov, dot, transp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ##
# @brief [py example simple] motion simple test
# @author <NAME> (<EMAIL>)
import rclpy
import os, sys
import threading, time
import signal
from dsr_msgs2.msg import *
sys.dont_write_bytecode = True
sys.path.append( os.path.abspath(os.path.join(os.path.dirn... |
import os
import time
import torch
import logger
from torch.utils.data import DataLoader, Dataset
from pathlib import Path
from .datatype import Tokens, Function, Instruction
from .model import ASM2VEC
import _pickle as cPickle
logger = logger.get_logger("Utils")
def _unpickle_from_fp(fp):
try:
data = cPi... |
"""
DarkNet-53, implemented in Gluon.
Original source: 'YOLOv3: An Incremental Improvement,' https://arxiv.org/abs/1804.02767.
"""
__all__ = ['DarkNet53', 'darknet53']
import os
from mxnet import cpu
from mxnet.gluon import nn, HybridBlock
from .common import conv1x1_block, conv3x3_block
class DarkUnit(Hybr... |
import numpy as np
import pandas as pd
from interface import implements
from six import viewvalues
from toolz import groupby, merge
from .base import PipelineLoader
from zipline.pipeline.common import (
EVENT_DATE_FIELD_NAME,
SID_FIELD_NAME,
TS_FIELD_NAME,
)
from zipline.pipeline.loaders.frame import Data... |
# Generate a whirlpool (or screw shell) from triangles
# This method is based in the one described in Spirals
# by <NAME> for Whirlpool Spirals.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.path import Path
import matplotlib as mpl
from math import *
import ... |
#!/usr/bin/env python
'''
Utility to generate the shader for materials found in a MaterialX document. One file will be generated
for each material / shader found. The currently supported target languages are GLSL, OSL, MDL and ESSL.
'''
import sys, os, argparse, subprocess
import MaterialX as mx
import MaterialX.PyMat... |
#!/usr/bin/env python
"""
Generates an arbitrated Ethernet mux with the specified number of ports
"""
from __future__ import print_function
import argparse
import math
from jinja2 import Template
def main():
parser = argparse.ArgumentParser(description=__doc__.strip())
parser.add_argument('-p', '--ports', t... |
#!/usr/bin/python3
from tensorflow import keras
import socket
import argparse
import librosa
import audioop
import json
import numpy as np
import io
import soundfile as sf
from preprocess import *
# for testing, use wave lib to save the incoming mic data as audio files on disk
# import wave
def udp_listen(model_type,... |
import logging
from homeassistant.components.media_player import BrowseError, BrowseMedia
from homeassistant.components.media_player.const import (
MEDIA_CLASS_ALBUM,
MEDIA_CLASS_ARTIST,
MEDIA_CLASS_CHANNEL,
MEDIA_CLASS_DIRECTORY,
MEDIA_CLASS_EPISODE,
MEDIA_CLASS_MOVIE,
MEDIA_CLASS_MUSIC,
... |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Licen... |
from matplotlib.patches import Patch
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Ignore the warning generated by Matplotlib for setting a y-lim of 0.01 on a
# log scale
import warnings
warnings.simplefilter("ignore", UserWarning)
# Formatted dataset names
FORMATTED_AA = r'\texttt{WH-aa... |
import numpy as np
import pytest
from deslib.util.prob_functions import ccprmod, log_func, min_difference, softmax, exponential_func, entropy_func
# Example from the original paper "A probabilistic model of classifier competence for dynamic ensemble selection"
@pytest.mark.parametrize("supports, idx_correct_label, e... |
import builtins
from .internal import _curry1, _curry2, _curry_n, _arity, _identity, \
_pipe, _reduce, _is_array, _is_string, _is_object, _concat, _get_arity, \
_is_function, _of
__all__ = ["ap", "always", "apply", "unapply", "curry_n", "curry", "converge",
"empty", "identity", "always",
... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
#! /usr/bin/env python
import os
import re
from datetime import date
from pprint import pprint
import googletrans
import requests
from bs4 import BeautifulSoup
from didyoumean3.didyoumean import did_you_mean
from menu import Diner, Menu
id_lunch = 930
id_diner = 1968
str_date = date.today().strftime("%d-%m-%Y")
url... |
import operator
from datetime import date
from PySide2 import QtCore
class BaseTableModel(QtCore.QAbstractTableModel):
def __init__(self, parent, headers, table_data, function_data_changed):
super().__init__(parent)
self.my_strings = self.parent().my_strings
self.headers = headers
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright 2018-2019 New York University Abu Dhabi
#
# 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, inclu... |
import pyglet
from pyglet.window import key
from characters import Character
#from objects import IngameObjects
from screen import *
from world import *
from testmap import *
ACTIONS = {
'move': 10,
}
ENV_TYPE = {
'impassable': 10,
'door': 20,
'trap': 30,
}
class TestScr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <NAME> <<EMAIL>> <https://hanxiao.github.io>
import tensorflow as tf
from nlp.nn import get_var, linear_logit, get_cross_correlated_mat, get_self_correlated_mat, gate_filter
def CrossStitch(logit_A, logit_B,
pA_given_B, pB_given_A,
pA_... |
# coding=utf-8
# Copyright 2021 The Google Research 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 by applicab... |
# SPDX-FileCopyrightText: Copyright (c) 2021 <NAME>
#
# SPDX-License-Identifier: MIT
"""These tests are run with a sensor connected to confirm that the correct
responses are received from the sensor.
The try - except clauses and an if __name__ == "__main__" allow the code to be
run with pytest on a Raspberry Pi or as ... |
import time
import struct
import sys
import os
import re
import threading
from functools import partial
import wx
import wx.lib.newevent as NE
from i2cdriver import I2CDriver
PingEvent, EVT_PING = NE.NewEvent()
def ping_thr(win):
while True:
wx.PostEvent(win, PingEvent())
time.sleep(1)
class He... |
from collections import deque, OrderedDict
from functools import partial
import numpy as np
from rlkit.core.eval_util import create_stats_ordered_dict
from rlkit.samplers.data_collector.base import PathCollector
from rlkit.samplers.rollout_functions import rollout
class ActionAgent():
def __init__(self):
... |
# This file is part of Rubber and thus covered by the GPL
# (c) <NAME>, 2002--2006
"""
Mechanisms to dynamically load extra modules to help the LaTeX compilation.
All the modules must be derived from the TexModule class.
"""
import imp
from os.path import *
from msg import _, msg
import sys
class TexModule (object):... |
# -*- coding: utf-8 -*-
from django.db import models
from django.core.validators import MinValueValidator
from decimal import Decimal
from django.core.urlresolvers import reverse_lazy
from django.template.defaultfilters import date
import locale
locale.setlocale(locale.LC_ALL, '')
STATUS_CONTA_SAIDA_ESCOLHAS = (
... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 8 16:35:35 2021
@author: abobashe
"""
import os
import datetime
import logging
import sys
#%%
def always_log_exceptions(exctype, value, tb):
#read last element in hope that this is the one we need
#TODO:refactor
logger=[logging.getLogger(name) for name... |
import pygame
import ginit as g
from util import *
# Scroll up and down in a list
class ScrollableBox(pygame.sprite.Sprite):
def border(self):
if self.focus:
return (255,0,0)
else:
return (128,128,128)
def __init__(self,width,height,maxHeight,x,y):
pygame.sprite.Sprite.__init__(self)
self.focus = 1
... |
# -*- coding: utf-8 -*-
import warnings
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
matplotlib.rcParams['agg.path.chunksize'] = 100000
class StepSizeError(Exception):
pass
def nlms_agm_on(alpha, update_count, threshold, d, adf_N, tap_len=64):
"""
Update formula
____________... |
from collections import defaultdict
import numpy as np
from scipy import special as spec
from higrid.utils import sph_jnyn
def getWY(micstruct, Ndec):
"""
Return the array (e.g. em32) specific cubature and the SHD matrices, W and Y.H
:param micstruct: Dictionary containing microphone properties
:para... |
import matplotlib.pyplot as plt
################################################################################################
################################################################################################
#Unit testing
def ekf_unit_test():
pass
#%%
#Phase, Phase Dot, Ramp, Step Lengt... |
import os
import unittest
from collections import OrderedDict
import numpy as np
from pyriemann.estimation import Covariances
from pyriemann.spatialfilters import CSP
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from sklearn.pipeline import make_pipeline
from moabb.datasets.fake import ... |
import os
import sys
import time
import shutil
import tempfile
import functools
import subprocess
import zope.interface
from twisted.python import usage, log
from twisted.protocols.basic import LineReceiver
from twisted.internet import defer, reactor, stdio
import txtorcon
from carml import util
_log = functools.par... |
# Copyright 2016 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.
"""
Cache temperature specifies how the browser cache should be configured before
the page run.
See design doc for details:
https://docs.google.com/document... |
# -*- coding: latin-1 -*-
# -----------------------------------------------------------------------------
# Copyright 2009-2013 <NAME> <<EMAIL>>
#
# Licensed under the EUPL, Version 1.1 or - as soon they
# will be approved by the European Commission - subsequent
# versions of the EUPL (the "Licence");
# You may not us... |
from sacred import Experiment
import tempfile
import os
from tqdm import tqdm
from racer.car_racing_env import car_racing_env, get_env, init_env
from racer.utils import setup_sacred_experiment, load_pickle
from racer.models.simple_nn import SimpleNN, simple_nn, NNAgent
from racer.methods.method import Method
from race... |
import numpy as np
import torch
class FeaturesLinear(torch.nn.Module):
def __init__(self, field_dims, output_dim=1):
super().__init__()
self.fc = torch.nn.Embedding(sum(field_dims), output_dim)
self.bias = torch.nn.Parameter(torch.zeros((output_dim,)))
self.offsets = np.array((0, ... |
# ===============================================================================
# Copyright 2015 <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/LI... |
# Copyright 2022 The FastEstimator 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 appl... |
import csv
from datetime import timedelta
from decimal import Decimal
import logging
from django.conf import settings
from django.db.models import Q, Count
from django.http import StreamingHttpResponse
from django.utils.translation import gettext_lazy as _
from django.utils import formats
from django.template.loader i... |
# Copyright 2019 Jetperch 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,... |
#!/usr/bin/env python3
#-------------------------------------------------------------------------------
# Name : CoinMarketCap Currency Price History
# Purpose : Download provided cryptocurrency's price history in CSV format.
# Author : buraktokman
# Created : 15 Feb 2018
# Copyright : (c) https://github.co... |
# -*- coding: utf-8 -*-
r'''
Saltclass Configuration
=======================
.. code-block:: yaml
master_tops:
saltclass:
path: /srv/saltclass
Description
===========
This module clones the behaviour of reclass (http://reclass.pantsfullofunix.net/),
without the need of an external app, and add sev... |
"""
Real-time information about public transport departures in Norway.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.entur_public_transport/
"""
from datetime import datetime, timedelta
import logging
import voluptuous as vol
from homeassistant... |
# coding: utf-8
from __future__ import absolute_import
from six import iteritems
from thrall.compat import unicode
import pytest
from thrall.amap._models import _suggest_model
class TestSuggestRequestParams(object):
def test_init_ok(self):
model = _suggest_model.SuggestRequestParams(keyword='keyword',
... |
import os
import numpy as np
import pickle as pk
from torch import nn, optim, from_numpy
import torch
from torch.utils.data import Dataset, DataLoader
from mindware.utils.logging_utils import get_logger
from mindware.components.meta_learning.algorithm_recomendation.base_advisor import BaseAdvisor
class CategoricalH... |
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from time import time
from sklearn.model_selection import GridSearchCV
from sklear... |
import torch
import numpy as np
from numbers import Number
from pygelib.SO3TensorArray import SO3TensorArray
from pygelib.utils import move_to_end, move_from_end
from pygelib.rotations import WignerD_list
from pygelib.utils import _convert_to_SO3part_view
from copy import deepcopy
import pygelib_cpp as backend
class ... |
import pytest
from astropy.modeling import models
import numpy as np
from geminidr.gmos.primitives_gmos_image import GMOSImage
from gempy.library import transform
from geminidr.gmos.lookups import geometry_conf as geotable
@models.custom_model
def InverseQuadratic1D(x, c0=0, c1=0, c2=0):
return 0.5 * (np.sqrt(c1... |
# Copyright 2016 <NAME> (https://github.com/mgraffg)
# Copyright 2016 <NAME> <<EMAIL>>
# 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
# Unle... |
import torch
from torch import nn
from torch.nn import functional as F
from torchvision.ops import roi_align
from torchvision import models
def build_model(base: str, n_classes: int, **kwargs) -> nn.Module:
return Model(base=base, n_classes=n_classes, **kwargs)
class Model(nn.Module):
def __init__(
... |
from __future__ import absolute_import
from __future__ import unicode_literals
from corehq.apps.app_manager.models import Application
from corehq.apps.userreports.specs import TypeProperty
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors, FormAccessors
from corehq.util.quickcache import quickcache... |
# Copyright 2016 the GPflow 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 by applicable law or agreed to in writi... |
import datetime
import json
import sqlite3
import sys
from ..shared.inc.helpers.log_helpers import log_message
from ..shared.inc.helpers.db_helpers import truncate_and_load_table_records
from ..shared.inc.helpers.hrdf_helpers import *
def import_db_stop_times(hrdf_path, db_path, db_schema_config):
parser = HRDF_F... |
import os, glob
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from utils import summarize
from statistics import BH_summary, estimator_summary, interval_summary
palette = {'Randomized LASSO':'k',
'Liu':'r',
'Lee':'g',
'Randomized BH':'ta... |
"""Support for Xiaomi Yeelight WiFi color bulb."""
from __future__ import annotations
import asyncio
import logging
from yeelight import BulbException
from yeelight.aio import KEY_CONNECTED
from homeassistant.const import CONF_ID, CONF_NAME
from homeassistant.core import callback
from homeassistant.helpers.dispatche... |
"""Family Style Chat Bot: Group meal ordering made simple
Given a group of Slack users, order the best group meal for them.
"""
from datetime import datetime
import os
import pickle
from random import choice
import string
import sys
import time
from credentials import credentials
import pandas as pd
from slackclient... |
# Copyright (C) 2010 <NAME> (<EMAIL>)
#
# 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
# notice, this list of conditions and the following discla... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
from typing import Optional, Tuple
import numpy as np
from PIL import Image
from torch.utils.data import DataLoader
... |
from oem_framework.core.elapsed import Elapsed
from copy import deepcopy
import inspect
class MinimizeProtocol(object):
__built = False
__encode_map = {}
__protocols = {}
__key__ = None
__ignore__ = False
__process__ = None
__root__ = False
__version__ = None
@classmethod
d... |
from flax import linen as nn, optim
import jax
from jax._src.api import make_jaxpr
import jax.numpy as jnp
import ray
from alpa import DeviceCluster, manual_layer_slicing, mark_pipeline
from alpa.model.bert_model import BertConfig, FlaxBertLayer
class BertLayer_Model(nn.Module):
config: BertConfig
dtype: jnp... |
"""
day 6 of Advent of Code 2018
by <NAME>
"""
from collections import Counter
from dataclasses import dataclass
import copy
import re
@dataclass
class Point:
x: int
y: int
id: int
class DistanceMap:
def __init__(self, xsize, ysize):
self.data = [
[(None, None) for _ in range(0, ... |
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
'''custom layers
'''
class Flatten(nn.Module):
def __init__(self):
super(Flatten, self).__init__()
def forward(self, x):
return x.view(x.size(0), -1)
def __repr__(self):
return self.__cla... |
from math import atan2, cos, sin
from typing import NamedTuple
import cv2
import numpy as np
from numpy.core._multiarray_umath import ndarray
from opsi.util.cache import cached_property
# Also represents dimensions
class Point(NamedTuple):
# implicit classmethod Point._make - create from existing iterable
... |
"""Plugin for telegram input"""
import re
from loguru import logger
from requests.exceptions import HTTPError, RequestException
from flexget.config_schema import one_or_more
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
logger = logger.bind(name='from_telegram')
_TELEGRA... |
"""
stanCode Breakout Project
Adapted from <NAME>'s Breakout by
<NAME>, <NAME>, <NAME>,
and <NAME>
YOUR DESCRIPTION HERE
-----------------------------------
File: breakous.py
Name: Isabelle
"""
from campy.gui.events.timer import pause
from breakoutgraphics import BreakoutGraphics
from campy.gui.events.mouse import on... |
import numpy as np
import pandas as pd
from .io_base import DataTaker
class CAENDT57XX(DataTaker):
"""
decode CAENDT5725 or CAENDT5730 digitizer data.
Setting the model_name will set the appropriate sample_rate
Use the input_config function to set certain variables by passing
a dictionary, thi... |
from collections import OrderedDict
import numpy as np
import torch
from torch import nn
from .rgcn_model import RGCN
class MLPModule(nn.Module):
def __init__(self, parameter):
super(MLPModule, self).__init__()
self.embedding_dim = parameter['embed_dim']
self.out_dim = 1
self.re... |
#!/usr/bin/env python3
# Copyright 2011-2016 <NAME>, <NAME>, and <NAME> and
# Copyright 2017 <NAME>.
#
# This file is part of mumpy. It is subject to the license terms in the file
# LICENSE found in the top-level directory of this distribution. A list of
# mumpy authors can be found in the file AUTHORS.md at the top-l... |
import numpy as np
import tensorflow as tf
import cv2, os, random
import matplotlib.image as mpimg
############ CORE FUNCTIONS
IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_CHANNELS = 240, 640, 3
INPUT_SHAPE = (IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_CHANNELS)
def preprocess_data(last_color_image=None, last_depth_image=None, recursion_f... |
from typing import List, Tuple, Dict
import cv2
import pytesseract
import numpy as np
pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
Coordinate = Tuple[int, int]
grid_size: Tuple[int] = tuple()
DEBUG = False
blocks = []
def set_block(block):
global blocks
blocks =... |
# Set of register writes performed by the reference implementation to initialise RAM.
ACTIONS = [
('write_register', 'CPM.DRCG', 0x00000003),
('write_register', 'CPM.DRCG', 0x00000001),
('write_register', 'DDR.DCTRL', 0x00f00000),
('write_register', 'DDR.DCTRL', 0x00000000),
('write_register', 'DDRP.DTAR', 0x0015... |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
"""The tests for hls streams.
The tests encode stream (as an h264 video), then load the stream and verify
that it is decoded properly. The background worker thread responsible for
decoding will decode the stream as fast as possible, and when completed
clears all output buffers. This can be a problem for the test that ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test for generate_report.py."""
from __future__ import division
from __future__ import print_function
... |
'''
Contents in this file makes use and modification of the source code of
the Python Markdown Project and therefore if used must abide by the
licences imposed by that project.
Python Markdown Project
------------------------
LICENCE:
Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later)
Copyright 2004,... |
#!/usr/bin/python3
"""
tactus2table.py: convert xml files from tactus to csv tables
usage: tactus2table.py file1 [file2 ...]
note: writes output to ../output/emails.csv
20180412 erikt(at)xs4all.nl
"""
import csv
import gzip
import nltk
import operator
import re
import sys
import xml.etree.ElementTree a... |
import argparse
import secrets
import string
import os
# Generate a random password of length len
# if must_be_alphanumeric is TRUE then password will be alphanumeric,
# otherwise it will be alphabetical
def generate_password(len, must_be_alphanumeric):
choices = string.ascii_letters
if must_be_alphanumeric:
... |
from collections import deque
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
from torchvision import models
class ImageCNN(nn.Module):
""" Encoder network for image input list.
Args:
c_dim (int): output dimension of the latent embedding
normalize (bool):... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import GestureAgentsPygame.Screen as Screen
from GestureAgentsTUIO.Gestures2D.RecognizerStick import RecognizerStick
from GestureAgentsTUIO.Gestures2D.RecognizerTap import RecognizerTap
from GestureAgents.AppRecognizer import AppRecognizer, SensorProxy
from RecognizerMove... |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... |
#!/usr/bin/env python3
import sys; assert sys.version_info[0] >= 3, "Python 3 required."
from hashlib import blake2b
import struct
from .transaction import (
LegacyTransaction,
MAX_MONEY,
SAPLING_TX_VERSION,
Script,
)
from .output import render_args, render_tv, Some
from .rand import Rand
from .zip_0... |
#<NAME> 180401068
def matrisOlus(matrisHesapla):
list = matrisHesapla.copy()
satir = len(matrisHesapla)
sutun = len(matrisHesapla[0])
for i in range(satir-1):
for j in range(satir-1-k):
carp = list [j][i]/list[j+1][i]
for k in range(sutun):
li... |
from __future__ import unicode_literals
import re
from ..utils import int_or_none, try_get
# from .cbs import CBSBaseIE
from .common import InfoExtractor
# class CBSSportsEmbedIE(CBSBaseIE):
class CBSSportsEmbedIE(InfoExtractor):
IE_NAME = "cbssports:embed"
_VALID_URL = r"""(?ix)https?://(?:(?:www\.)?cbs|em... |
# -*- coding: utf-8 -*-
"""
This module is used for testing the functions within the pyhpeimc.plat.icc module.
"""
from unittest import TestCase
from pyhpeimc.plat.icc import *
from test_machine import *
#TODO remarked out failing test
class TestGet_cfg_template(TestCase):
def test_get_cfg_template_type(self):... |
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENS... |
import numpy as np
from perm_LQUBO.form_new_LQUBO import NewLQUBO
from perm_LQUBO.population_LQUBO_code.initialize_population import initialize_population
from perm_LQUBO.population_LQUBO_code.tournament_selection import TournamentSelection, BestFitPopulation
from perm_LQUBO.population_LQUBO_code.evaluate_fitness impor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.