text stringlengths 3.07k 12.6k |
|---|
from __future__ import absolute_import
#
# Copyright (c) 2020 Juniper Networks, Inc. All rights reserved.
#
import gevent
import logging
import requests
from testtools.matchers import Equals
import unittest
from flexmock import flexmock
import sseclient
from . import test_case
from cfgm_common import vnc_cgitb
from v... |
"""
.. moduleauthor:: <NAME> <<EMAIL>>
based on: https://github.com/chen0040/keras-anomaly-detection/blob/master/keras_anomaly_detection/library/recurrent.py
"""
# standard libraries
import os
# third-party libraries
from keras.layers import Dense, LSTM
from keras.models import Sequential
from keras.callbacks impor... |
import datetime as dt
import src.utils as utils
import src.core.callbacks as cl
import src.custom as custom
from pathlib import Path
from typing import List, Optional
from src.core.callbacks import Callback
from src.core.states import RunningState
class SubRunner:
signature = "sub"
callback_group = "main"... |
info = '''
#==============================================================================#
title :riskCalculator_Nance.py
description :
author :<NAME>
date :2022-04-24
version :1.0
usage :python riskCalculator_Nance.py
notes :
py... |
"""The mesh class and related functions."""
import copy
import logging
import numpy as np
from anytree import Node # , RenderTree
from .grid_mesh import GridMesh
module_log = logging.getLogger(__name__)
def make_gridmesh(mesh):
"""Turn a mesh with 'Grid_Ln_i_j' cell sets into :class:`mocmg.mesh.GridMesh` obje... |
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this... |
"""
Theano is an optimizing compiler in Python, built to evaluate
complicated expressions (especially matrix-valued ones) as quickly as
possible. Theano compiles expression graphs (see :doc:`graph` ) that
are built by Python code. The expressions in these graphs are called
`Apply` nodes and the variables in these grap... |
from petsc4py import PETSc
import unittest
import numpy as np
# --------------------------------------------------------------------
class BaseTestPlex(object):
COMM = PETSc.COMM_WORLD
DIM = 1
CELLS = [[0, 1], [1, 2]]
COORDS = [[0.], [0.5], [1.]]
COMP = 1
DOFS = [1, 0]
def setUp(self):
... |
# Pylint bug - `Callable` is used below
# pylint: disable=unused-import
from typing import Any, Callable, Dict, Generator, List, Optional, Sequence, Tuple, Type, TypeVar, Union, cast
from urllib.parse import urlsplit
import attr
import graphql
import requests
from hypothesis import strategies as st
from hypothesis.str... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 9 14:55:43 2015
This script is to convert the txt annotation files to appropriate format needed by YOLO
@author: <NAME>
Email: <EMAIL>
"""
import os
from os import walk, getcwd
from PIL import Image
#import pandas as pd
#import xml.etree.ElementTree as ET
#from lxml im... |
import gzip
import bz2
import os
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse import save_npz, load_npz
from sklearn.model_selection import train_test_split
from urllib.request import urlretrieve
NP_SUFF='.npy'
NPZ_SUFF='.npz'
def split_data(all_data_matrix, test_size=0.1, seed=0):
"... |
"""
desispec.skymag
============
Utility function to compute the sky magnitude per arcmin2 based from the measured sky model
of an exposure and a static model of the instrument throughput.
"""
import os,sys
import numpy as np
import fitsio
from astropy import units, constants
from desiutil.log import get_logger
from... |
"""Make a directory compatible with mybinder.org and ready for
upload to a Github repo.
"""
from pysph.solver.utils import get_files, mkdir
import os
from shutil import copy
import nbformat as nbf
import argparse
import sys
import re
import glob
from textwrap import dedent
def find_viewer_type(path):
'''
Fin... |
"""
Utilities unit tests
Copyright (c) 2018-2020 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
Redistributions of s... |
__author__ = 'moonkey'
import sys, argparse, logging
import numpy as np
from PIL import Image
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
from model.model import Model
import exp_config
def process_args(args, defaults):
parser = argparse.ArgumentParser()
parser.add_argument('--gpu-i... |
#
# This file has been taken and modified from:
# https://github.com/fchollet/keras/blob/master/examples/conv_filter_visualization.py
#
# COPYRIGHT
#
# All contributions by <NAME>:
# Copyright (c) 2015, <NAME>.
# All rights reserved.
#
# Each contributor holds copyright over their respective contributions.
# The projec... |
import copy as cp
import numpy as np
import numpy.testing as npt
import pytest
import hoomd
def _evaluate_periodic(snapshot, params):
"""Evaluate force and energy in python for Periodic."""
box = hoomd.Box(*snapshot.configuration.box)
positions = snapshot.particles.position
A = params['A']
i = pa... |
'''cms_etl -- Load an i2b2 star schema from CMS RIF data
See README.md background and usage.
Integration Test Usage:
(grouse-etl)$ python cms_etl.py
'''
from datetime import datetime
from typing import Iterable, List, cast
import logging
import cx_ora_fix; cx_ora_fix.patch_version() # noqa: E702
from luigi.pa... |
""" This Class has some functions that are used in Main application """
""" Function : Description """
""" _Json_to_CSV_ : Takes input argment ( JSON file and convert it o CSV file in same folder with same name but with csv extension """
"""
_get_filepaths : This function will generate the... |
from typing import Union
import numpy as np
import numpy.testing as npt
import pytest
import tifffile
import torch
import fnet
from fnet.fnet_model import Model
SOME_PARAM_TEST_VAL = 123
def get_data(device: Union[int, torch.device]) -> tuple:
if isinstance(device, int):
device = torch.device("cuda", d... |
# Copyright 2021 Intel 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
"""
Everything related to IO.
Reading / writing configuration, matrices and permutations.
"""
# Core Library
import csv
import hashlib
import json
import os
from typing import Any, Dict, List, Optional, cast
# Third party
import numpy as np
import yaml
# First party
import clana.utils
INFINITY = float("inf")
cla... |
import pytest
import re
from random import randint
from parsing import *
# Test types, casting, operator overloading
def test_parser_add():
p = constant('foo') + 'bar'
assert(isinstance(p, sequence))
def test_parser_radd():
p = 'foo' + constant('bar')
assert(isinstance(p, sequence))
def test_con... |
import ray
import logging
import grpc
from queue import Queue
import sys
from typing import Any, Iterator, TYPE_CHECKING, Union
from threading import Lock, Thread
import ray.core.generated.ray_client_pb2 as ray_client_pb2
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from ray.util.client.common... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import csv
import codecs
import pprint
import re
import xml.etree.cElementTree as ET
import cerberus
import schema
import audit
OSM_PATH = "singapore.osm"
NODES_PATH = "nodes.csv"
NODE_TAGS_PATH = "nodes_tags.csv"
WAYS_PATH = "ways.csv"
WAY_NODES_PATH = "ways_nodes.cs... |
import astropy.units as u
from sunpy.coordinates.utils import get_rectangle_coordinates
from sunpy.net._attrs import Time, Wavelength
from sunpy.net.attr import AttrAnd, AttrOr, AttrWalker, DataAttr, SimpleAttr
__all__ = ['Series', 'Protocol', 'Notify', 'Segment', 'PrimeKey', 'Cutout']
# Define a custom __dir__ to ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 11 11:57:37 2019
@author: Angie
"""
import os
import sys
import argparse
import numpy as np
import netCDF4
import pandas as pd
#import datetime
#import matplotlib.pyplot as plt
#import xarray as xr
def get_contained_files(a_dir,extension):
return [file for file in o... |
import numpy as np
import scipy.io
import os
import urllib
import tarfile
import zipfile
import matplotlib.pyplot as plt
main_folder = os.path.expanduser('~')+'/DataSets/'
def _make(folder):
if not os.path.isdir(folder):
os.mkdir(folder)
def create_1_hot(y, num_classes=10):
assert 1 in y.shape or l... |
import logging
import struct
import sys
if 'eventlet' in sys.modules:
from eventlet.green import zmq
__using_eventlet__ = True
else:
import zmq
__using_eventlet__ = False
from rflib.defs import *
import rflib.ipc.IPC as IPC
INTERNAL_SEND_CHANNEL = "inproc://sender"
INTERNAL_PUBLISH_CHANNEL = "inproc:... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import functools
import os
import sys
import debugpy
from debugpy import launcher... |
import numpy as np
from skimage.segmentation import (morphological_chan_vese,
morphological_geodesic_active_contour,
inverse_gaussian_gradient,
circle_level_set,
disk_level_set)
from ... |
# -*- coding: utf-8 -*-
"""Implementation of Rapid Automatic Keyword Extraction algorithm.
As described in the paper `Automatic keyword extraction from individual
documents` by <NAME>, <NAME>, <NAME> and <NAME>.
"""
import string
from collections import Counter, defaultdict
from itertools import chain, groupby, produ... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# 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 t... |
from __future__ import annotations
import asyncio
import contextlib
import contextvars
from typing import AsyncIterator, Optional
import asyncpg
import asyncpg.transaction
import typic
from yesql.core import types, support
LOCK: contextvars.ContextVar[Optional[asyncio.Lock]] = contextvars.ContextVar(
"pg_lock",... |
"""pytest-bdd missing test code generation."""
import itertools
import os.path
from mako.lookup import TemplateLookup
import py
from .scenario import (
find_argumented_step_fixture_name,
make_python_name,
)
from .steps import get_step_fixture_name
from .feature import get_features
from .types import STEP_TYP... |
"""Memory footprint container for PyBryt"""
import nbformat
from typing import Any, List, Optional, Set, Tuple, Union
from ..utils import filter_picklable_list, pickle_and_hash
class Counter:
"""
A counter for tacking the step number in the tracing function.
Args:
start (``int``): the starting... |
import tensorflow as tf
import numpy as np
import pickle
import tf_util
import load_policy
def load_rollout(filename):
"""
Extract data related to rollout generated by expert policy.
:param filename - str, name of file.
:return data - A tuple of lists of observations and actions.
"""
with open(f... |
import logging
import sys
import threading
import multiprocessing
import queue as threading_Queue
import Arknights.helper
import config
from connector.ADBConnector import ADBConnector, ensure_adb_alive
from util.excutil import format_exception
from typing import Mapping
config.background = True
logger = logging.getLo... |
#!/usr/bin/python3.4
# -*- coding: utf-8 -*-
import sys
import argparse
import tempfile
import random
import subprocess
import bisect
from copy import deepcopy
# Псевдослучайный генератор уникальных чисел.
# http://preshing.com/20121224/how-to-generate-a-sequence-of-unique-random-integers/
class UniqueRandomGenerator... |
import base64
import click
import json
import time
from . import constants
from . import config as Config
from . import globus_auth as Auth
from .account_map import AccountMap
from .ssh_service import SSHService
from .exceptions import OAuthSSHError
from .policy import Policy
from .token import Token
class NeedToAut... |
"""Test S3 Blob DB
Commands to setup Docker with Riak CS for development/testing
First, [install Docker](https://docs.docker.com/mac/#h_installation). Then
initialize a docker machine for Riak CS:
git clone https://github.com/hectcastro/docker-riak-cs
cd docker-riak-cs
docker-machine create --driver virt... |
import json
import logging
from json import JSONDecodeError
from typing import Optional, Tuple, Type
from urllib.parse import quote, urljoin
import requests
from requests import RequestException
from rest_framework import serializers
from maas.models import MaasOperator, TicketingSystem
from .choices import BookingS... |
import os.path
import random
import string
import pytest
import pyrebase
def test_wrap_mapping():
data = 1
wrapped = pyrebase.wrap_mapping(data)
assert wrapped['.value'] == 1
data = {'foo': 'bar'}
wrapped = pyrebase.wrap_mapping(data)
assert '.value' not in wrapped
assert data == wrappe... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import json
import logging
from typing import Sequence
from urllib.parse import urlparse
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
from opentelemetry.sdk.util import ns_to_iso_str
from opentele... |
from django.conf import settings
from django.db.models import F
from django.utils import timezone
from huey import crontab
from huey.contrib.djhuey import db_task, db_periodic_task
from subprocess import call, check_output, CalledProcessError, STDOUT
import os
from django.core.cache import cache
from .models import Hu... |
#-----------------------robot_arm header-----------------------
import time
import math
import sys
import numpy as np
import Adafruit_PCA9685
#from func_servo import *
################### robot #######################
pwm = Adafruit_PCA9685.PCA9685()
pwm.set_pwm_freq(60)
CURRENT_TH = [1,1,1]
DH = 1 #最高速度
DELTA_TIME... |
import asyncio
import logging
from urllib.parse import quote
import aiohttp
from .Events import TrackEndEvent, TrackExceptionEvent, TrackStuckEvent
from .PlayerManager import DefaultPlayer, PlayerManager
from .Stats import Stats
from .WebSocket import WebSocket
log = logging.getLogger(__name__)
def s... |
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
import sympy
#=================================================================#
class AnalyticalFunction():
"""
computes numpy vectorized functions for the function and its dericatives up to two
for a given expression, derivatives computed with sympy
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Processes trips and turns them into kml files
"""
from __future__ import print_function
import sys
import boto3
import traceback
import uuid
import json
from boto3.dynamodb.conditions import Key, Attr
from botocore.exceptions import ClientError
__version__ = "0.1"
__a... |
import json
import pytest
from urllib.parse import parse_qs
from urllib.parse import urlparse
from urllib.parse import urlunparse
from django.conf import settings
from django.urls import reverse
from shibboleth_discovery.helpers import select2_processor
from shibboleth_discovery.utils import b64encode_idp
from .test... |
#!/usr/bin/env python3
"""Parses SFUSD school bus schedule PDFs and writes them to TSVs.
Run in a directory with SFUSD bus schedule PDFs.
Requires PyPDF2: https://mstamy2.github.io/PyPDF2/
SFUSD bus schedule PDFs can be downloaded from:
https://www.sfusd.edu/en/transportation/school-bus-schedules.html
...specifical... |
"""Dengue."""
import os
from bs4 import BeautifulSoup
from utils import dt, jsonx, timex, www
from dengue._utils import log
RDHS_TO_DISTRCT = {
'Colombo': 'LK-11',
'Gampaha': 'LK-12',
'Kalutara': 'LK-13',
'Kandy': 'LK-21',
'Matale': 'LK-22',
'Nuwara Eliya': 'LK-23',
'Galle': 'LK-31',
... |
"""
Various tool function for Freqtrade and scripts
"""
import gzip
import logging
import re
from datetime import datetime
from pathlib import Path
from typing import Any, Iterator, List
from typing.io import IO
from urllib.parse import urlparse
import rapidjson
from freqtrade.constants import DECIMAL_PER_COIN_FALLBA... |
from django.utils.timezone import now
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
import datetime
class LargeCat(models.Model):
lcat_name = models.CharField(db_column='Lcat_name', primary_key=True, max... |
"""
The online socket of the account object of the API
"""
from consys.errors import ErrorWrong
from api.lib import BaseType, validate, report
from api.models.user import User
from api.models.token import Token
from api.models.job import Job
from api.models.socket import Socket
# from api.models.space import Space
... |
import sys, os
import json
import bpy
import mathutils
import numpy as np
DEBUG = False
VIEWS = 500
RESOLUTION = 800
RESULTS_PATH = 'results'
DEPTH_SCALE = 1.4
COLOR_DEPTH = 8
FORMAT = 'PNG'
RANDOM_VIEWS = True
UPPER_VIEWS = True
CIRCLE_FIXED_START = (.3,0,0)
fp = bpy.path.abspath(f"//{RESULTS_PATH}")
def listify... |
import unittest
import numpy as np
import common
# Values calculated by original BEAM3 source code
mAlpha = [ -74.546372788379358, -85.226686841512077, -80.308489547462131, -60.188167648307171 ]
mBeta = [ -42.391297983281106, -41.131126129267471, -34.123379267040661, -17.527794014278896 ]
# Test data set 4
dataC... |
# -*- coding: utf-8 -*-
"""Luft configuration."""
import os
from configparser import ConfigParser
from pathlib import Path
from typing import Optional
from dotenv import load_dotenv
from luft.common.logger import setup_logger
from luft.common.utils import read_config
# Setup logger
logger = setup_logger('common', 'I... |
from functools import reduce
import torch
from torch import nn, autograd
from torch.autograd import Variable
import gan
import dgr
import utils
from const import EPSILON
class WGAN(dgr.Generator):
def __init__(self, z_size,
image_size, image_channel_size,
c_channel_size, g_channe... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
from itertools import combinations
from typing import Dict
import numpy as np
import pandas as pd
from gensim.models import Word2Vec
from sklearn.decomposition import NMF
def calculate_coherence(w2v_model: Word2Vec, term_rankings: list) -> float:
overall_coh... |
import os
import csv
import argparse
from collections import OrderedDict
def init_config(config, default_config, name=None):
"""Initialise non-given config values with defaults"""
if config is None:
config = default_config
else:
for k in default_config.keys():
if k not in conf... |
import random
import math
from PIL import Image
import numpy as np
"""
Texture generation using Perlin noise. Heavily based on
https://github.com/nikagra/python-noise/blob/master/noise.py
by <NAME>.
"""
class NoiseUtils:
def __init__(self, imageSize):
self.imageSize = imageSize
self.gradientNum... |
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2014-2019 The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this s... |
from random import Random
from multiprocessing import cpu_count
from inspyred import ec
from optimModels.optimization import evaluators, generators, replacers, variators, observers
from optimModels.simulation.simul_problems import KineticSimulationProblem
from optimModels.utils.constantes import optimType
class EACon... |
# -*- coding: utf-8 -*-
"""Functions to handle OAuth2 authentication."""
from datetime import timedelta
import requests
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.core.handlers.wsgi import WSGIRequest
from django.http i... |
"""
Implements the book chapter 7 on Cross Validation for financial data.
"""
import pandas as pd
import numpy as np
from sklearn.metrics import log_loss, accuracy_score, f1_score, precision_score, recall_score, roc_auc_score
from sklearn.model_selection import KFold
from sklearn.base import ClassifierMixin
from skle... |
from typing import Union
import numpy as np
from numpy import log, sqrt
from scipy.optimize import brentq
FLOAT_OR_ARRAY = Union[float, np.array]
def lake_problem(X: FLOAT_OR_ARRAY, a: FLOAT_OR_ARRAY = 0.1,
q: FLOAT_OR_ARRAY = 2.0,
b: FLOAT_OR_ARRAY = 0.42,
eps: FL... |
#
# This file is part of m.css.
#
# Copyright © 2017, 2018 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# t... |
# Copyright 2021 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
#!/usr/bin/env python
from __future__ import division, print_function
import sys
from collections import defaultdict
from kaldi.matrix import DoubleMatrix
from kaldi.transform.cmvn import Cmvn # acc_cmvn_stats, acc_cmvn_stats_single_frame
from kaldi.util.io import xopen, printable_rxfilename
from kaldi.util.options ... |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
from hashlib import md5
import logging
import re
import zlib
import unicodedata
# 3p
import requests
import simplejson as json
# project
from config import get_version
from utils.proxy import set_no_pr... |
# Copyright 2015-present MongoDB, 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 agreed to in wri... |
# ----------------------------------------
# Name: <NAME> and <NAME>
# ID: 1528549 / 1528350
# CMPUT 274, Fall 2018
# Final Project: MazeFun
# ----------------------------------------
import numpy as np
import random as rand
import matplotlib.pyplot as pp
maze_size = 40 # Size of the maze is square of this dimension... |
# coding=utf-8
from __future__ import unicode_literals
import os
import sys
import json
import pandas as pd
import numpy as np
from nose.tools import eq_, raises
from mock import patch, MagicMock
from pyecharts import Bar, Map, jupyter_image
import pyecharts.exceptions as exceptions
from test.constants import CLOTH... |
# Python script
#
# Author: <NAME> <<EMAIL>>
# Date : February 15, 2020
##################################################### SOURCE START #####################################################
import os
import pickle
import subprocess
import hashlib
import tarfile
import numpy as np
### Download a file from the give... |
import pytest
from collections import namedtuple
from autoprotocol_utilities.rectangle import area, area2rect, chop_list, binary_list, max_histogram_area, max_rectangle, \
get_well_in_quadrant, get_quadrant_indices, get_quadrant_binary_list
@pytest.mark.parametrize("wells, chop_length, r", [
([0, 1, 2, 3, 4, ... |
# 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
from ... import _utilities, _tables
from... |
'''
This code is for emotional score generation and emotional distriution genenration
New version: developed by <NAME> (<EMAIL>)
'''
import jieba
import numpy as np
import gzip
import jieba
import re
import json
import tarfile
import configparser
import pickle
import os
import csv
import time
import datetime
import ran... |
import os
from colorama import init
from flask import Flask
from flask import request
from flask import render_template
from flask import redirect
from flask import url_for
from flask import send_file
from flask import after_this_request
from flask_bootstrap import Bootstrap
from coyote_badger.config import SOURCES_T... |
import random
import json
products = [
{"name": "Prod1", "amount": {"min": 10000, "max": 99999}, "price": {"min": 1, "max": 100}},
{"name": "Prod2", "amount": {"min": 10000, "max": 99999}, "price": {"min": 1, "max": 100}},
{"name": "Prod3", "amount": {"min": 10000, "max": 99999}, "price": {"min": 1, "max": ... |
# #############################################################################
# Copyright 2022 <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/L... |
import json
import os
import time
from typing import Tuple, List, Optional
import tweepy
from chalice import Rate, Chalice
from chalice.app import SQSEvent, CloudWatchEvent
from tweepy import Cursor as cursor
from tweepy.models import User
from chalicelib.db import DynamoDBTwitterList as db
from chalicelib.process_fo... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# ufit, a universal scattering fitting suite
#
# Copyright (c) 2013-2019, <NAME> and contributors. All rights reserved.
# Licensed under a 2-clause BSD license, see LICENSE.
# **************************************... |
import time
import os
import random
import base64
import re
from flask_login import login_required
# from app.datahand.Nav_Oklogin import NavOkLoginModel,NavOnLoginModel
from app.datahand.globalmodel.CommentModel import CommentModel
from . import web
from flask import request, g, session, render_template, redirect, u... |
#!/usr/bin/env python
from pathlib import Path
import numpy as np
import cv2
# local import
import histutils.rawDMCreader as rdr
from histutils.sixteen2eight import sixteen2eight
# ------------------------------------
def main(fn, xyPix=(512, 512), xyBin=(1, 1), FrameInd=(0, 0), playMovie=0.01,
Clim=(None, ... |
import csv
import gzip
import io
import re
from pathlib import Path
__all__ = [
'Interval',
'Exon',
'Gene',
'RefGene'
]
class Interval(object):
def __init__(
self,
chrom,
start,
end,
strand='.',
name=None,
**metadata
):
assert i... |
# IEEE 802.1X tests
# Copyright (c) 2013, <NAME> <<EMAIL>>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
import time
import hostapd
import hwsim_utils
logger = logging.getLogger()
def test_ieee8021x_wep104(dev, apdev):
"""IEEE 802.1X conne... |
# Copyright (c) 2019 PaddlePaddle 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 appli... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A series of classes that specify various step size functions."""
import logging
from collections import namedtuple
from itertools import takewhile
from queue import Empty, PriorityQueue
from typing import Dict, Iterable, Iterator, List
logger = logging.getLogger(__nam... |
# import re
from typing import List, Optional, Dict
from pydantic import BaseModel, Field, validator, root_validator
"""
[
{
"testCaseData": {
"name": "Bulk Template Test 1",
"description": "testing this input",
"operatorGuidance": "Do something suspiciou... |
from ctypes import *
from ctypes.util import find_library
import numpy as np
import scipy as sp
from scipy import sparse
from SofaPython import SofaNumpy as sofa_numpy
from contextlib import contextmanager
def set_opaque(obj, name, value):
'''set an opaque data to ctypes value'''
value_type = type(value)
... |
# based on https://github.com/dawenl/vae_cf
import numpy as np
from scipy import sparse
import pandas as pd
import os
import bottleneck as bn
import logging
from recpack.preprocessing.filters import MinItemsPerUser, MinUsersPerItem
from recpack.preprocessing.preprocessors import DataFramePreprocessor
from recpack.sp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 27 14:09:00 2018
@authors: <NAME> (initial), <NAME> (revisions/parallelism)
Extracts metadata from Apple Loops .caf files
"""
import os
import subprocess
import errno
import shutil
from sys import version_info
import glob
from multiprocessing impo... |
"""This modules provides Node class that has tree structure."""
import inspect
from dataclasses import dataclass, field
from typing import Any, Callable, Iterator, List, Optional
from mkapi.core.base import Base, Type
from mkapi.core.object import (from_object, get_object, get_origin,
ge... |
#! python3
# Keras deep learning library to build classification model
# Lancaster stemming library used to collapse distinct word forms
import nltk
from nltk.stem.lancaster import LancasterStemmer
stemmer = LancasterStemmer()
# things we need for Tensorflow
import numpy as np
from keras.models import Sequential
from... |
from time import time
"""
Integrantes
-<NAME>
-<NAME>
Descipcion: Programa con el objetivo de implementar los algoritmos de comparacion de planificadores
"""
"""
Contasntes usadas con el fin de dar una mejor comprension a la logica planeada
"""
DURACION_QUANTUM = 1
ESTADO_LISTO = 0
ESTADO_EJECUCION = 1
EST... |
import sys
import os
import json
from os.path import dirname
from pathlib import Path
import nibabel as nib
from nibabel.processing import resample_to_output
import numpy as np
import torch
from torchvision import transforms
from torch.utils.data import Dataset, DataLoader
from PIL import Image
np.set_printoptions(prec... |
"""Undocumented Module"""
__all__ = ['findClass', 'rebindClass', 'copyFuncs', 'replaceMessengerFunc', 'replaceTaskMgrFunc', 'replaceStateFunc', 'replaceCRFunc', 'replaceAIRFunc', 'replaceIvalFunc']
import types
import os
import sys
def findClass(className):
"""
Look in sys.modules dictionary for a module tha... |
import re
from typing import Tuple
from duty.utils import att_parse, format_response
from duty.objects import MySignalEvent, dp
def delete_template(name: str, templates: list) -> Tuple[list, bool]:
for template in templates:
if template['name'].lower() == name:
templates.remove(template)
... |
# GTP for Trojan-go
# Helper file
import re
def pre_engine(s):
s = re.sub("[^\t\n -~]", "", s)
s = s.split("#")[0]
s = s.replace("\t", " ")
return s
def pre_controller(s):
s = re.sub("[^\t\n -~]", "", s)
s = s.replace("\t", " ")
return s
def gtp_boolean(b):
return "true" if b else "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.