text stringlengths 957 885k |
|---|
<reponame>Hiwen-STEM/MaxHeap
#Author: <NAME>
#Non-Profit Company: Inventorsniche L.L.C
#Project: Memmap Based Binary Tree
#Date Created: May 10th, 2021
#Purpose: The purpose of this project is to create an efficient binary heap
# that re-directs the majority of what would be memory related consumption towards
... |
<filename>pooch/tests/test_processors.py<gh_stars>1-10
"""
Test the processor hooks
"""
from pathlib import Path
from tempfile import TemporaryDirectory
import warnings
import pytest
from .. import Pooch
from ..processors import Unzip, Untar, ExtractorProcessor, Decompress
from .utils import pooch_test_url, pooch_te... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import Imputer... |
from autolens import exc
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import numpy as np
import itertools
from autolens.data.array.plotters import plotter_util
def plot_array(array, origin=None, mask=None, extract_array_from_mask=False, zoom_around_mask=False,
should_plot_border=... |
from collections import OrderedDict
from copy import deepcopy
import json
import re
import datetime
import logging
from string import capitalize
from datawinners.project.views.data_sharing import DataSharing
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _, get_lang... |
'''Game main module.
Contains the entry point used by the run_game.py script.
Feel free to put all your game code here, or in other modules in this "gamelib"
package.
'''
import pygame
import pygame.time
import pygame.display
import pygame.event
import os
import math
import moderngl
import array
import numpy
from ga... |
<filename>snmp/nav/smidumps/NetPing_DKSF_60_5_2_MB_mib.py<gh_stars>0
# python version 1.0 DO NOT EDIT
#
# Generated by smidump version 0.4.8:
#
# smidump -f python DKSF-60-4-X-X-X
FILENAME = "mibs/NetPing/[Pub] DKSF 60.5.2 MB.mib"
MIB = {
"moduleName" : "DKSF-60-4-X-X-X",
"DKSF-60-4-X-X-X" : {
... |
#!/usr/bin/python
#
# Copyright 2018 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 or a... |
<gh_stars>0
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------------------------
# -- IdentifyFeatures.py
# Encapusaltes IdentifyFeatures REST-API from API3 geo.admin.ch
# -- Author: flu, 09.11.2020
# -- commandline:
# -------------------------------------------... |
<reponame>jzuhusky/zbaseball-client
from datetime import datetime
from typing import List
import requests
from .constants import GAME_TYPES
from .exceptions import (
APIException,
ClientException,
GameNotFoundException,
LoginError,
PaymentRequiredException,
PlayerNotFoundException,
TooMany... |
"""
This module file contains Django-specific helper functions, to help save time when
developing with the Django framework.
* handle_error - Redirects normal web page requests with a session error, outputs JSON with a
status code for API queries.
* is_database_synchronized - Check if all migrat... |
"""VPN over DNS protocol utilities."""
import binascii
import collections
import enum
import itertools
import regex
import struct
from vodreassembler import util
from vodreassembler import dnsrecord
DEFAULT_FQDN_SUFFIX = 'tun.vpnoverdns.com.'
class Error(Exception):
pass
class UnknownVersionError(Error):
pass... |
# Copyright 2020 EMBL - European Bioinformatics Institute
#
# 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... |
<reponame>ministryofjustice/moj-product-dashboard
# -*- coding: utf-8 -*-
from datetime import date
from decimal import Decimal
from unittest.mock import patch
import pytest
from ..rate_converter import RateConverter, RATE_TYPES
DAY = RATE_TYPES.DAY
MONTH = RATE_TYPES.MONTH
YEAR = RATE_TYPES.YEAR
@pytest.mark.para... |
#!/usr/bin/python -u
# -*- coding: UTF-8 -*-
# pylint: disable=C0111
import subprocess
import unittest
import binascii
from binascii import a2b_base64
from base64 import standard_b64encode
from pyxmpp2 import sasl
from pyxmpp2.sasl.core import CLIENT_MECHANISMS_D
from pyxmpp2.test import _support
import logging
lo... |
import numpy as np
from mmd.molecule import *
from mmd.realtime import *
from mmd.utils.spectrum import *
import matplotlib.pyplot as plt
from tqdm import tqdm
import matplotlib.colors as colors
import scipy.interpolate
import matplotlib as mpl
import matplotlib.gridspec as gridspec
import sys
h2 = """
0 1
H 0.52 ... |
# -*- coding:utf-8 -*-
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
def find_next_state(current_state):
# to select randomly the action to next state
if np.random.binomial(1, 0.5):
current_state += 1
else:
current_state -= 1
return current_state
class Ra... |
<gh_stars>1-10
import random
import unittest
from src.common.train_test_split import train_test_split_list
from src.common.train_test_split import train_test_split_gt
def dummy_sample(list, n):
return list[:n]
class UnitTests(unittest.TestCase):
def test_train_test_split_list_0_2(self):
lst = [1... |
# -*- coding: utf-8 -*-
"""An exporter for signaling pathway impact analysis (SPIA) described by [Tarca2009]_.
.. [Tarca2009] <NAME>., *et al* (2009). `A novel signaling pathway impact analysis
<https://doi.org/10.1093/bioinformatics/btn577>`_. Bioinformatics, 25(1), 75–82.
.. seealso:: https://biocon... |
<filename>download.py
import os, time, io, re, threading
import requests
from PIL import Image
from PyPDF2 import PdfFileMerger
header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36' }
def mkdir(path):
path = path.strip()
i... |
# -*- coding: future_fstrings -*-
import unittest
import hashlib
import math
import string
import collections
try:
import unittest.mock as mock
except ImportError:
import mock
from os import urandom
from random import choice
from merklelib.compat import is_py2
from merklelib import utils
from merklelib.merkle im... |
<filename>habitat/tasks/rearrange/rearrange_grasp_manager.py
#!/usr/bin/env python3
# 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 magnum as mn
import numpy as np
from habitat.tasks... |
"""ldap client"""
from asyncio import AbstractEventLoop, get_event_loop
from contextlib import asynccontextmanager
from functools import partial
from typing import Any, AsyncGenerator, Dict, List, Tuple, Union
from ldap3 import ALL, ASYNC, SIMPLE, Connection, Server
__all__ = ["LDAPConnection", "Result"]
Controls =... |
import math
import torch
import torch.nn as nn
from torch.nn import init
from torch.autograd import Variable
from torch.nn import Parameter
from torch.nn import functional as F
from torch.nn.modules.utils import _pair
import slowfast.utils.logging as logging
from .build import MODEL_REGISTRY
from slowfast.models i... |
# -*- coding: utf-8 -*-
# Description: bind rndc netdata python.d module
# Author: l2isbad
from base import SimpleService
from re import compile, findall
from os.path import getsize, isfile, split
from os import access as is_accessible, R_OK
from subprocess import Popen
priority = 60000
retries = 60
update_every = 30... |
## TrueTypeFont
##
import struct
from pdfmajor.execptions import CMapNotFound
from pdfmajor.parser.cmapdb import FileUnicodeMap
class TrueTypeFont(object):
def __init__(self, name, fp):
self.name = name
self.fp = fp
self.tables = {}
self.fonttype = fp.read(4)
try:
... |
<filename>generator.py<gh_stars>0
from PIL import Image, ImageDraw
import math
import noise
import random
import numpy as np
MAP_SIZE = (512, 512)
SCALE = 256
EXPO_HEIGHT = 2
COLORS = {
"grass" : (34,139,34),
"forest" : (0, 100, 0),
"sand" : (238, 214, 175),
"water" : (65,105,225),
"rock" : (139, 1... |
<reponame>ankushaggarwal/gpytorch
import torch
import sys
from os.path import dirname, abspath
sys.path.insert(0,dirname(dirname(dirname(abspath(__file__)))))
import gpytorch
import math
from matplotlib import cm
from matplotlib import pyplot as plt
import numpy as np
import numpy as np
data = np.load('MV18242PL-FS.... |
import torch
import torch.nn as nn
from .dual import DualObject
def select_input(X, epsilon, proj, norm, bounded_input, box_bounds=None):
if proj is not None and norm=='l1_median' and X[0].numel() > proj:
if bounded_input:
return InfBallProjBounded(X,epsilon,proj)
else:
ret... |
<gh_stars>1-10
# Copyright (c) 2022, NVIDIA CORPORATION. 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 re... |
from unittest import TestCase, TestLoader, TextTestRunner
from pathlib import Path
import sys
from sndpgen import SndpGraph, Timer, parse_args_sndp_gen, generate_command
class TestSndpGraph(TestCase):
@classmethod
def setUpClass(cls):
SndpGraph.DEBUG = True
def test_init(self):
num_locati... |
<gh_stars>0
import time
import numpy as np
import scipy
import scipy.sparse
import scipy.sparse.linalg
from copy import copy
from thimbles.sqlaimports import *
from thimbles.thimblesdb import ThimblesTable, Base
from sqlalchemy.orm.collections import attribute_mapped_collection
from sqlalchemy.orm.collections import c... |
<reponame>cdlaimin/CoolQBot<filename>src/plugins/morning/__init__.py
""" 每日早安插件
"""
import nonebot
from nonebot import get_bot
from nonebot.adapters import Bot
from nonebot.adapters.cqhttp.event import GroupMessageEvent
from nonebot.adapters.cqhttp.permission import GROUP
from nonebot.log import logger
from nonebot.plu... |
import MySQLdb
import suds
from suds.client import Client
from suds.xsd.doctor import Import, ImportDoctor
from suds.plugin import MessagePlugin
import traceback
class MagentoApiMessagePlugin(MessagePlugin):
def marshalled(self, context):
body = context.envelope.getChild("Body")
call = context.enve... |
from typing import List, Optional
import numpy as np
from django.db.models.aggregates import Sum
from scipy import special
from django.core.exceptions import ObjectDoesNotExist
from django.db import IntegrityError, models
from django_pandas.managers import DataFrameManager
from app.support.repetition import calculat... |
import re
import bempp.api
import os
import numpy as np
import time
import pbj.mesh.mesh_tools as mesh_tools
import pbj.mesh.charge_tools as charge_tools
import pbj.electrostatics.pb_formulation.formulations as pb_formulations
import pbj.electrostatics.utils as utils
class Solute:
"""The basic Solute object
T... |
<gh_stars>0
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from openprocurement.auctions.core.utils import get_now
def post_auction_auction(self):
self.app.authorization = ('Basic', ('auction', ''))
response = self.app.post_json('/auctions/{}/auction'.format(self.auction_id), {'data': {}}, s... |
<gh_stars>1-10
import os
import numpy as np
import tensorflow as tf
import tensorflow.keras.backend as K
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from lib.ml_helpers import custom_loss, moa
from lib.utils import array_trimmer
class TestingGenerator(tf.keras.utils.Sequence):... |
#!/usr/bin/env python
"""
This code holds the solution for part 2 of day 4 of the Advent of Code for 2020.
"""
import re
import sys
def valid_birthday(value):
byr = int(value)
if byr >= 1920 and byr <= 2002:
return True
return False
def valid_issue_year(value):
iyr = int(value)
if iyr >... |
<reponame>claranet/cloud-deploy
from mock import mock, MagicMock, call
from commands.buildimage import Buildimage
from tests.helpers import get_test_application, mocked_logger, LOG_FILE, void
@mock.patch('commands.buildimage.lxd_is_available')
@mock.patch('commands.buildimage.LXDImageBuilder')
@mock.patch('commands.... |
<reponame>VITA-Group/AugMax<gh_stars>10-100
'''
Tiny-ImageNet:
Download by wget http://cs231n.stanford.edu/tiny-imagenet-200.zip
Run python create_tin_val_folder.py to construct the validation set.
Tiny-ImageNet-C:
Download by wget https://zenodo.org/record/2469796/files/TinyImageNet-C.tar?download=1
Run python datal... |
<gh_stars>10-100
import os
import dj_database_url
from dotenv import load_dotenv
from pathlib import Path
from urllib.parse import urlparse
load_dotenv()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY', 'dja... |
<reponame>moreati/python-niceware
# flake8: noqa E122
# 2^16 English wordlist. Derived from
# https://github.com/diracdeltas/niceware/blob/master/lib/wordlist.js
# which in turn, is derived from
# http://www-01.sil.org/linguistics/wordlists/english/.
# Originally compiled for the Yahoo End-to-End project.
# https://gi... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse import csr_matrix, csc_matrix
from exceptions import NotImplementedError, StopIteration
class ESN(object):
"""Methods for training and running an echo state network
"""
def __init__(self, n_neurons, n_input, n_output):
self.n_neu... |
from scipy.spatial import distance
from imutils import face_utils
import imutils
import dlib
import cv2
import multiprocessing as mp
# Define the function for calculating eye aspect ratio with eucilidean distance
def eye_aspect_ratio(eye):
# Calculate the distance between the 3 pairs of point.
A = distance.eu... |
"""
Blackjack.py - <NAME> - Spring 2014
Implementation of Blackjack. Enjoy: http://www.codeskulptor.org/#user31_R8PVRLqskziSghE.py
Although we used class-specific CodeSculptor for graphics, most of the methods
and the rest of the concepts are similar if not the same in other Python librararies,
... |
"""
A simple pytest plugin to test schemas against valid and invalid test data.
When this plugin is activated, subclasses of BaseDatatypeTest define tests for
a JSON schema.
"""
import contextlib
import importlib
import json
import re
from dataclasses import dataclass
from pathlib import Path
from typing import Callab... |
<reponame>tblondelle/TransferLearningProject
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division
from io import open
import unicodedata
import string
import re
import random
import os
import time
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decompositio... |
import sys, os, random, pickle, re, time
import numpy as np
import tensorflow as tf
import sklearn.metrics as skm
# 0.001 uniform for embeddings, 0.1 for adagrad accumulators, learning rate 0.1, 0.8
class CharacterLSTM(object):
def __init__(self, labels, embedding_size=200, lstm_dim=200,
opt... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from glue.core import Hub, HubListener, Data, DataCollection
from glue.core.message import (DataCollectionAddMessage,
DataAddComponentMessage, SettingsChangeMessage)
from .layout import CubeVizLayout
CUBEVIZ_LAYOUT = 'cube... |
<reponame>Json0926/object_detection
import os
import cv2
import time
import argparse
import numpy as np
import tensorflow as tf
from utils.webcam import FPS, WebcamVideoStream
from queue import Queue
from threading import Thread
from analytics.tracking import ObjectTracker
from video_writer import VideoWriter
from det... |
<reponame>jaxsenh/the-devil-that-lurks
# creates datagrams to send to server
from direct.distributed.PyDatagram import PyDatagram
from communications.codes import *
# General
def dg_kill_connection():
dg = PyDatagram()
dg.addUint8(KILLED_CONNECTION)
return dg
# Main menu
def dg_deliver_pid(pid):
dg ... |
"""Bundles common gui functions and classes
When creating a standalone app, you can use :func:`jukeboxcore.gui.main.init_gui` to
make sure there is a running QApplication. Usually the launcher will do that for you.
Then use set_main_style to apply the main_stylesheet to your app.
That way all the plugins have a consis... |
"""
Tests of the src.sample_data module.
"""
import numpy as np
import pandas as pd
import pytest
from collections import namedtuple
from src import sample_data
SampleDataParameters = namedtuple("SampleDataParameters", ["step_order", "n",
"i_max", "v_min", "v_max"])
@pytest.fixture()
def small_sample_condi... |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals, absolute_import
from jsonschema import ValidationError
import io
import logging
import os
import pkg... |
<reponame>nathanjenx/cairis
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor 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... |
<reponame>coll-gate/collgate
# -*- coding: utf-8; -*-
#
# @file descriptorstypes.py
# @brief Setup the types of descriptors.
# @author <NAME> (INRA UMR1095)
# @date 2016-09-01
# @copyright Copyright (c) 2016 INRA/CIRAD
# @license MIT (see LICENSE file)
# @details
DESCRIPTORS = {
'biological_status': {
'id... |
<filename>src/speech/train_ConvLSTM.py
import torch
from torch import optim
from raw_audio_model import RawAudioModel
from ConvLSTM import ConvLSTM
from process_raw_audio_model import IEMOCAP, my_collate_train, my_collate_test
from torch.utils.data import DataLoader
from torch.optim.lr_scheduler import ReduceLROnPlatea... |
<gh_stars>0
# -*- coding: UTF-8 -*-
'''
Created on 31 December 2014
@author: <NAME>
Written By:
<NAME>
@Email: < robert [--DOT--] pastor0691 (--AT--) orange [--DOT--] fr >
@http://trajectoire-predict.monsite-orange.fr/
@copyright: Copyright 2015 <NAME>
... |
<filename>vectorai/utils.py
"""Miscellaneous functions for the client.
"""
import numpy as np
import pandas as pd
import itertools
from functools import wraps
import inspect
import types
import random
from typing import List, Any, Dict, Union
import warnings
class UtilsMixin:
"""Various utilties
"""
def ge... |
"""Cache lines z Python source files.
This jest intended to read lines z modules imported -- hence jeżeli a filename
is nie found, it will look down the module search path dla a file by
that name.
"""
zaimportuj functools
zaimportuj sys
zaimportuj os
zaimportuj tokenize
__all__ = ["getline", "clearcache", "checkcach... |
import pygame;
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GRAY = (30, 30, 30)
pygame.mixer.pre_init(44100, 16, 2, 4096);
pygame.init();
SONG_END = pygame.USEREVENT + 1
DefaultFont = pygame.font.Font('freesansbold.ttf', 50);
### INPUT DEVICES ###
class PyMouse:
def __init__( self ):
self.pos = (0, 0);
... |
<reponame>meyer-lab/bi-cytok<filename>ckine/figures/figure3.py
"""
This creates Figure 1, response of bispecific IL-2 cytokines at varing valencies and abundances using binding model.
"""
from .figureCommon import getSetup
from ..imports import importCITE
from sklearn.decomposition import PCA
from copy import copy
impo... |
import os
import ssl
import unittest
from unittest.mock import patch
import asyncio
from .client import *
from .exceptions import InvalidHandshake
from .http import read_response, USER_AGENT
from .server import *
testcert = os.path.join(os.path.dirname(__file__), 'testcert.pem')
@asyncio.coroutine
def handler(ws,... |
from enum import IntFlag
from .chinese.extractors import *
from recognizers_text import *
from .english.extractors import *
from .english.parsers import *
from .models import *
from .parsers import *
class SequenceOptions(IntFlag):
NONE = 0
class SequenceRecognizer(Recognizer[SequenceOptions]):
def __init__... |
"""Contains dataset importers for NYU Depth Dataset V2 and SYNTHIA-SF"""
from __future__ import absolute_import, division, print_function
import os
import numpy as np
import pandas as pd
import tables
from skimage import img_as_float32
from skimage import img_as_float64
from skimage.io import imread
from skimage.tra... |
from pyalgs.algorithms.commons import util
from pyalgs.data_structures.commons.bag import Bag
class Graph(object):
V = 0
adjList = None
def __init__(self, V):
self.V = V
self.adjList = [None] * V
for v in range(V):
self.adjList[v] = Bag()
def vertex_count(self):
... |
import json
import pytest
from bs4 import BeautifulSoup
from flask import url_for
from freezegun import freeze_time
from app.main.views.jobs import get_time_left
from tests.conftest import (
SERVICE_ONE_ID,
mock_get_notifications,
normalize_spaces,
)
def test_get_jobs_should_return_list_of_all_real_jobs... |
# Copyright (C) 2015-2016 Regents of the University of California
#
# 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 app... |
from __future__ import print_function, absolute_import
import os
from qtpy import QtWidgets, QtCore
from fem.base_app.configuration import BaseConfiguration
from fem.base_app.model import BaseModel
from fem.utilities import BaseObject
from .base_file_menu import BaseFileMenu
from .base_edit_menu import BaseEditMenu... |
<reponame>josephch405/airdialogue<filename>airdialogue/context_generator/src/utils.py
# 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
#
# https://www.apache.or... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import web
import json
import subprocess
import auth
def get():
u,a=auth._auth()
if not a:return 403
ds={'disks':_get_disks(),'raids':_get_raids()}
return ds
def erase():
u,a=auth._auth()
if not a:return 403
rq=web.input()
p=rq['path']
return _erase(p)
def... |
<reponame>Chen-yu-Zheng/Email-System
"""
文件名:send.py
作者:张钊为
介绍:使用构建的SMTP模块实现邮件到SMTP服务器的发送
创建时间:2021/7/30
"""
from module import smtp
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
from email.header import Header
fro... |
<gh_stars>1-10
"""
Scan a storage containing raw geocatalogo datasets; extract candidate URLs
for resources.
"""
from __future__ import print_function
import cgi
import sys
import lxml.etree
import requests
from harvester.utils import get_plugin, XPathHelper
from harvester_odt.pat_geocatalogo.converter import (
... |
<filename>TuneFindFromSeries/tunefind_crawler.py
"""
Download all songs of a TV show from youtube as mp3. Can also download individual songs.
It all started with How I met your mother. As is well known, their music choice is excellent. So I wanted to download all the songs that appeared in HIMYM. So I wrote the follow... |
#!/usr/bin/python
#
# Copyright 2014 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 appl... |
<reponame>MTD-group/amlt
import numpy as np
from . import struct_colors, dyn_markers, dyn_types, struct_types
from . import read_evaluation_data, get_force_list, compute_force_error_list
from . import compute_rms_force_error_by_atom, compute_rms_force_error_by_image
from . import compute_force_norms_by_image, collapse_... |
"""The tests for the analytics ."""
from unittest.mock import AsyncMock, Mock, patch
import aiohttp
import pytest
from homeassistant.components.analytics.analytics import Analytics
from homeassistant.components.analytics.const import (
ANALYTICS_ENDPOINT_URL,
ATTR_BASE,
ATTR_DIAGNOSTICS,
ATTR_PREFEREN... |
from manul_utils import SHM_SIZE
from typing import Tuple
import logging
import numpy as np
import random
import string
from fuzzwatch_state import BITMAP_SIZE, ROW_SIZE
LOG_FILE = 'gui_log.txt'
def get_logger() -> logging.Logger:
logger = logging.getLogger('__FILE__')
logger.setLevel(logging.DEBUG)
# ... |
<reponame>tarun-bisht/security-camera-tflite
import os
import time
import cv2
import secrets
import tensorflow as tf
import numpy as np
from absl import app, flags, logging
from absl.flags import FLAGS
from src.parse_args import get_security_cam_arguments
from src.utils import (
VideoStream,
draw_box... |
<filename>pinax/apps/blog/views.py<gh_stars>0
import datetime
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.uti... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: face_detection.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _s... |
<filename>tests/tests_semantic/test_scripts.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file was part of Flask-Bootstrap and was modified under the terms of
# its BSD License. Copyright (c) 2013, <NAME>. All rights reserved.
#
# This file was part of Bootstrap-Flask and was modified under the... |
<filename>src/main.py
import numpy as np
import pandas as pd
import math
from typing import Sequence
import argparse
def makeA(c: list):
return -np.matrix([
[1, 1, 0, c[0]],
[1, 1, 0, - c[1]],
[1, 0, 1, c[2]],
[1, 0, 1, - c[3]],
[1, -1, 0, c[4]],
[1, -1, 0, - c[5]],... |
<filename>tests/conftest.py
import pytest
from ws_rebalancer.wealthsimple_login import WealthSimpleLogin
class WealthSimpleLoginMock:
"""Mocks the WealthSimpleLogin class which provides the WSTrade API. This
allows us to mock out the API calls we make in the app so that we don't
actually make calls to th... |
import requests
from typing import List, Dict
from data_refinery_common.models import (
Batch,
File,
SurveyJobKeyValue,
Organism
)
from data_refinery_foreman.surveyor import utils
from data_refinery_foreman.surveyor.external_source import ExternalSourceSurveyor
from data_refinery_common.job_lookup impo... |
<reponame>mumupy/mmdeeplearning<filename>src/mtensorflow/tf_bpn.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/10/24 9:03
# @Author : ganliang
# @File : tf_bpn.py
# @Desc : tensorflow反向传播
import os
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import matp... |
<filename>tests/test_utils/test_solver.py<gh_stars>0
import numpy as np
from summer_py.summer_model.utils.solver import solve_with_euler, solve_with_rk4
def test_solve_with_rk4_linear_func():
"""
Ensure Runge-Kutta 4 method can solve a linear function's ODE.
y_0 = 2 * t
y_1 = 1 * t
dy_0/dt = 2
... |
<filename>NonSomeFinder/src/NonSomeFinder.py
'''
Created on Nov 14, 2014
Copied from GitHubResearchDataMiner
@author: bgt
'''
import ConfigParser
import os
import sys
import time
import CsvDao
import GitHubDao
from GitHubFacadeForProcessDistibutionDao import GitHubFacadeForProcessDistibutionDao
from github.GithubExce... |
from tqdm import tqdm
import argparse
import pickle
import numpy as np
import collections
import json
import operator
import torch
from random import shuffle
import gc
import jsonlines
import os
import sys
import operator
import random
random.seed(42)
np.random.seed(42)
def create_social_ranking(fname,scorefname,ou... |
# -*- coding: utf-8 -*-
# Loading libraries
import os
import sys
import time
from networkx.algorithms.centrality import group
import pandas as pd
import re
import csv
from swmmtoolbox import swmmtoolbox as swmm
from datetime import datetime
from os import listdir
from concurrent import futures
from sqlalchemy import cr... |
# -*- coding: utf-8 -*-
#############################################################################
# @package ad_hmi.framework
# @brief init methode of python package ad_hmi.framework.
#############################################################################
# @author <NAME>
# @copyright (c) All rights reserved.... |
"""Vanquisher base terrain code.
This module is concerned with the representation and generation
of specifically terrain. Every world.Chunk has a terrain property
of type TerrainChunk.
"""
import math
import typing
from ...numba import maybe_numba_jit
if typing.TYPE_CHECKING:
from . import generator
try:
f... |
"""Stats command"""
import traceback
import json
import math
import botutils
from library import fancy
from botc import Phase, RoleGuide
from discord.ext import commands
with open('botutils/bot_text.json') as json_file:
language = json.load(json_file)
error_str = language["system"]["error"]
with open('botc/gam... |
<reponame>CoderAariz/Shop-Management-System<gh_stars>1-10
from tkinter import *
from tkinter import messagebox
import mysql.connector
try:
con=mysql.connector.connect(user='root',password='<PASSWORD>',database='shop_management',host='localhost')
cur=con.cursor()
def register():
global regis... |
<gh_stars>1-10
'''
Precondition
successfully pass a users test.
'''
from datetime import datetime, timedelta
import time
import pytest
import requests
from kii import AccountType, exceptions as exc, results as rs
from kii.data import BucketType, clauses as cl
from tests.conf import (
get_env,
get_api_wit... |
<reponame>cfmcdonald-78/Hexcrawler
'''
Created on Jul 25, 2012
@author: Chris
'''
import core.event_manager as event_manager
import core.options as options
import pygame.mixer
import os, random
import gamemap.mask as mask
import gui.component as component
sound_events = [event_manager.UNIT_BLOCK, event_manager.UNIT_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
from string import ascii_lowercase
from random import shuffle, choices
from array import array
import numpy as np
from ETC.seq.check import zeroes
def cast(seq):
if seq is not None:
if isinstance(seq, np.ndarray):
try:
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'responses.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):... |
"""
methods related to conditional likelihood of the data for class ChangepointModel
"""
import numpy as np
import scipy.special as special
def L_(self, i, seg):
x_ = self.x[i][seg[0]:seg[1]]
out = 0.0
if self.x_distr[i] == 'Poisson': # hyper[0] is alpha, hyper[1] is gamma
n = len(x_)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.