text stringlengths 957 885k |
|---|
<filename>nlgeval/pycocoevalcap/answerability/answerability_scorer.py<gh_stars>0
#!/usr/bin/env python
# answerability_scorer.py
import codecs
import json
import logging
import os
import sys
import tempfile
import numpy as np
import six
from six.moves import reload_module
from ..bleu.bleu import Bleu
from ..rouge.r... |
# Copyright (c) 2020, Build-A-Cell. All rights reserved.
# See LICENSE file in the project root directory for details.
import copy
from typing import List, Union
from warnings import resetwarnings, warn
from .chemical_reaction_network import ChemicalReactionNetwork
from .component import Component
from .global_mecha... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 6 15:47:09 2017
@author: noore
"""
import logging
from numpy import matrix, array, load, zeros, logaddexp, sqrt, log
import os
import json
import gzip
import types
import re
COMPOUND_JSON_FNAME = 'cc_compounds.json.gz'
PREPROCESS_FNAME = 'cc_prep... |
"""
Command line interface from Line Track Designer
"""
import click
from pathlib import Path
import logging
import webbrowser
from line_track_designer.track import Track
from line_track_designer.tile import Tile, Tiles
@click.group()
@click.option('-v', '--verbosity', is_flag=True, help='Set the verbosity')
def line... |
__author__ = '<NAME>'
import numpy as np
from pypet.parameter import Parameter
from pypet.utils.explore import cartesian_product
from pypet.environment import Environment
from pypet import pypetconstants
import logging
import os
import time
from scipy.stats import pearsonr
from pypet.tests.testutils.ioutils import r... |
<filename>scratch.py
import os
import urllib
import time
from dependencies.instagram import InstagramAPI, InstagramAPIError, InstagramClientError
from dependencies.instagram import models
from string import Template
import subprocess
from operator import attrgetter
from my_instagram_api import MyInstagramAPI, UserSet
i... |
r"""
Module for distributions to specify secret and error distributions.
Contains Uniform and Gaussian distributions with various constructors and utility methods. Instances can be transformed to bounds in various norms.
We write ``sigma`` to denote the standard deviation :math:`\sigma` and :math:`s` to denote the... |
<filename>pywt/_mra.py
from functools import partial, reduce
import numpy as np
from ._multilevel import (_prep_axes_wavedecn, wavedec, wavedec2, wavedecn,
waverec, waverec2, waverecn)
from ._swt import iswt, iswt2, iswtn, swt, swt2, swt_max_level, swtn
from ._utils import _modes_per_axis, _... |
import math
import numpy as np
from matplotlib import pyplot as plt
import root_finder
import random
import pylab
class ProblemParameters:
def __init__(self):
self.L0 = 0.01
self.H0 = 0.005
self.U0 = 0.31297739987328533717
self.epsilon = self.H0 / self.L0
self.A1 = 0.001
... |
# Copyright (C) 2017-2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
import os
import run_utils as utils
import numpy as np
from dpbench_datagen.blackscholes import gen_data_to_file, gen_rand_data
from dpbench_python.blackscholes.bs_python import black_scholes_python
# make xrange available in python 3
try:
... |
# Copyright 2014 Scalyr 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 writing, so... |
import ast
import copy
import math
import typing
from collections import OrderedDict
from typing import MutableMapping, List, Set, Tuple, Mapping, Optional
from willump import *
from willump.graph.array_count_vectorizer_node import ArrayCountVectorizerNode
from willump.graph.array_tfidf_node import ArrayTfIdfNode
from... |
<filename>omorfi/omorfi_parse.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import codecs
import locale
import re
import sys
import gzip
from collections import defaultdict
excluded_fields = ["BLACKLIST", "WORD_ID"]
MAX_NUM_ANALYSES_PER_WORD = 15
TAG_SEPARATOR = ","
def _read_analyses_file(anal... |
<filename>docs/HVAC_Tutorial.py
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <headingcell level=1>
# HVAC Loops
# <headingcell level=2>
# Conceptual Introduction to HVAC Loops
# <markdowncell>
# Eppy builds threee kinds of loops for the energyplus idf file:
#
# 1. Plant Loops
# 2. Condensor Loops
# 3. Air... |
import ast
import time
from typing import Union, Dict
import requests
import pickle
import os
import asyncio
from asyncirc.protocol import IrcProtocol
from asyncirc.server import Server
from irclib.parser import Message
from database import User
import database
import contexts
import commands
from termcolor import colo... |
<gh_stars>1-10
# layerindex-web - view definitions
#
# Copyright (C) 2013-2018 Intel Corporation
#
# Licensed under the MIT license, see COPYING.MIT for details
import os
import sys
import re
from datetime import datetime
from itertools import islice
import reversion
from django import forms
from django.contrib impor... |
<gh_stars>0
'''
Any questions ask Mikkel
'''
import os
import math
import csv
import numpy as np
import matplotlib.pyplot as plt
from shapely.geometry.polygon import LinearRing
from scipy.spatial.distance import cdist
from utm import utmconv
import pandas as pd
class Pathplanclass():
def __init__(self):
... |
#!/usr/bin/env python
import time
import PyKDL
import tf
import rospy
import roslibpy
from tf_conversions import posemath
from geometry_msgs.msg import Twist, Pose, PoseStamped
from move_base_msgs.msg import MoveBaseGoal, MoveBaseFeedback, MoveBaseAction
class SwarmClient():
def __init__(self):
# base r... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
import numpy as np
import scipy.misc
from alexnet import *
from matplotlib import pyplot as plt
from skimage import io, transform
from scipy.misc import imread, imresize
from data_processing import DataLoader_vessel as DataLoader
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
from . import transformation as trans
import numpy as np
import vg
import itertools as it
from scipy.spatial import ConvexHull
class ConvexPolyhedron(object):
""" Root class for convex polyhedra.
"""
def __init... |
#
# Copyright (c) 2019 ISP RAS (http://www.ispras.ru)
# Ivannikov Institute for System Programming of the Russian Academy of Sciences
#
# 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
#
# h... |
<gh_stars>0
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 re... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing import MinMaxScaler
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM, Dropout
from math import sqrt
from matplotlib import pyp... |
import requests
import pyjokes
from datetime import datetime
from itertools import islice
from .utils import correction
from .errors import BaseError, ArgumentError
URL = "http://api.brainshop.ai/get"
class ChatBot:
def __init__(self, brainid="", apikeyuser="", uiiduser="PythonChatbot", history=False, debug=Fal... |
import FWCore.ParameterSet.Config as cms
###################################################################################
# pp iterative tracking modified for hiOffline reco (the vertex is the one reconstructed in HI)
################################### 4th step: large impact parameter tracking using mixed-triplet... |
<reponame>orjanj/twitter-incident-visualizer
#!/usr/bin/python
import twitter
class TIVTwitter:
""" Base class for connecting and fetching data from Twitter API. """
def __init__(self, config, db, gmaps):
""" Instance constructor
:return: none
"""
self.db = db
self.gmap... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import random
from collections import deque, defaultdict
import typing
from rasa_core.domain import Domain
from typing import List, Text, Dict, Optional
from rasa_core.i... |
import os
import shutil
from sklearn.model_selection import train_test_split
from examples.word_level.common.util import reader, prepare_testdata
from examples.word_level.wmt_2020.en_de.microtransquest_config import TRAIN_PATH, TRAIN_SOURCE_FILE, \
TRAIN_SOURCE_TAGS_FILE, \
TRAIN_TARGET_FILE, \
TRAIN_TARG... |
<reponame>dengemann/mne-bids-pipeline
"""
=================================
13. Group average on source level
=================================
Source estimates are morphed to the ``fsaverage`` brain.
"""
import itertools
import logging
import mne
from mne.parallel import parallel_func
from mne_bids import BIDSPath... |
<gh_stars>10-100
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import rospy
import tf
import math
from actionlib_msgs.msg import GoalID
from geometry_msgs.msg import PoseWithCovarianceStamped
from geometry_msgs.msg import PoseStamped
from visualization_msgs.msg import Marker
class VisualizationClass:
de... |
import gym
import np
import numpy
# hyperparameters
episode_number = 0
batch_size = 10
gamma = 0.99 # discount factor for reward
decay_rate = 0.99
num_hidden_layer_neurons = 200
n = 80
input_dimensions = 80 * 80
learning_rate = 1e-4
def average_color(a,b,c,d,i):
return (int(a[0]) + int(b[0]) + int(c[0]) + int(d[0... |
<reponame>takase/alone_seq2seq
import math
import os
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class OneEmbed(nn.Module):
def __init__(self, num_embeddings, embedding_dim, padding_idx=None, one_emb_type='binary', dropout=0.5, std=1.0, codenum=64, codebooknum=8, layernum=1, inter... |
import pygame
from sys import exit
width=360
height=515
fps = 30
black = (0,0,0)
bar_img_active_horizontal = pygame.image.load('bar.png')
bar_img_active_vertical = pygame.transform.rotate(bar_img_active_horizontal,90)
bar_img_deactive_horizontal = pygame.image.load('bar2.png')
bar_img_deactive_vertical =... |
<reponame>parenthetical-e/fmri
""" Another (sub)set of models, this one contains only those with literature
driven RL (or related) terms. Prior analyses were more exploratory.
In this set we allow for seperate regressors matching behavoiral accuracy,
as well as inverted and positive-value-only coding schemes. """
f... |
<filename>urop/exploit.py
#!/usr/bin/env python3
from os import sys, path
sys.path.append(path.join(path.dirname(path.dirname(path.abspath(__file__))), "build"))
from target_360 import Rop360, G, F
from util import p32, p8
from rop import Ret, Load
from krop import krop
from sys import argv, exit
thread_attr = 0x10... |
<reponame>jrsherry/terraform-compliance<filename>terraform_compliance/steps/given/i_have_name_section_configured.py
# -*- coding: utf-8 -*-
from radish import world
from terraform_compliance.common.bdd_tags import look_for_bdd_tags
from terraform_compliance.common.helper import (
get_resource_address_list_from_sta... |
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from param import args
class ObjEncoder(nn.Module):
''' Encodes object labels using GloVe. '''
def __init__(self, vocab_size, embeddi... |
import sys
from setuptools import setup, Extension
libraries = ['pdcurses', 'user32', 'advapi32', 'gdi32', 'comdlg32', 'shell32']
define_macros = [
('PDC_WIDE', None),
('HAVE_NCURSESW', None),
('HAVE_TERM_H', None),
('HAVE_CURSES_IS_TERM_RESIZED', None),
('HAVE_CURSES_RESIZE_TERM', None),
('H... |
<reponame>piyawath/azure-sdk-for-python<filename>sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
<gh_stars>1-10
import base64
def getFilePathBase():
"""
获取请求url文件的文件路径
:return: php->base64 code
"""
code = """
@ini_set("display_errors","0");
@set_time_limit(0);
@set_magic_quotes_runtime(0);
header("Content-Type:application/json");
$res = array();$res["path"] = dirname(__FILE__);
... |
'''
DataBear database manager class
- init: Connect to database (databear.db) or create if none
- load_sensor: Loads measurements to database from sensor_class
- Various get/set methods
'''
import os
import sys
import sqlite3
import importlib
#-------- Database Initialization and Setup ------
class DataBearDB:
... |
<reponame>zx9r/RobosatsTwitterOrderbook
# From https://github.com/Reckless-Satoshi/robosats/blob/main/frontend/static/assets/currencies.json
CURRENCIES = {
"1": "USD",
"2": "EUR",
"3": "JPY",
"4": "GBP",
"5": "AUD",
"6": "CAD",
"7": "CHF",
"8": "CNY",
"9": "HKD",
"10": "NZD",
... |
import argparse
import os
import numpy as np
import cv2
import time
import pandas as pd
from tqdm import tqdm
from joblib import Parallel, delayed
def parse_args():
"""
Helper function to parse command line arguments
"""
parser = argparse.ArgumentParser(
description="dump epic kitchens flow i... |
from aeternity.contract_native import ContractNative
from aeternity import hashing, utils
from tests.conftest import random_domain
import pytest
contractAens = """contract DelegateTest =
// Transactions
stateful payable entrypoint signedPreclaim(addr : address,
chash ... |
<filename>crystalpy/examples/main.py
import numpy as np
import matplotlib.pyplot as plt
from crystalpy.diffraction.DiffractionSetupSweeps import DiffractionSetupSweeps
from crystalpy.diffraction.Diffraction import Diffraction
from crystalpy.examples.Values import Values
from crystalpy.examples.PlotData1D import PlotDa... |
<reponame>Raddock/MountWizzard4<filename>mw4/gui/messageW.py
############################################################
# -*- coding: utf-8 -*-
#
# # # # # # #
# ## ## # ## # #
# # # # # # # # # # #
# # ## # ## ## ######
# # # # # # #
#
# Python-based Tool... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# Copyright (C) 2020 Wheatfield Media INC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#import stdin
#import argparse
import re
"""
Script para determinar las posibles tonalidades a partir de las notas insertadas
Las notas se puede insertar del siguiente modo:
C
Cmaj7
Cmin7
Csus
C#
Por ahora, no se soporta poner "b". Cualquier bemol debe meterse como "#"
"""... |
# -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil 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
#
# Unles... |
<reponame>vi-robotics/framegraph<gh_stars>0
from typing import Tuple, List, Union
from numbers import Number
import numpy as np
class NpArrayList():
"""A wrapper around an ndarray which provides an axis along the array
a constant time amortized append operation. The axis cannot be changed after
initializa... |
#!/usr/bin/env python3
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the... |
<reponame>ma-kast/AMfe
# Copyright (c) 2018, Lehrstuhl für Angewandte Mechanik, Technische Universität München.
#
# Distributed under BSD-3-Clause License. See LICENSE-File for more information
#
#
from unittest import TestCase
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_array_equal... |
"""
player
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import uuid
from PySide import QtGui
from PySide.QtCore import Qt
import itertools
from mcedit2.command import SimpleRevisionCommand
from mcedit2.ui.panels.player import Ui_playerWidget
from mcedit2.ut... |
<filename>src/blade/dependency_analyzer.py<gh_stars>0
# Copyright (c) 2011 Tencent Inc.
# All rights reserved.
#
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# Date: October 20, 2011
"""
This is the dependencies expander module which accepts the targets... |
from __future__ import print_function
import argparse
from bs4 import BeautifulSoup, SoupStrainer
from datetime import datetime
import hashlib
import logging
import os
import ssl
import sys
from urllib.request import urlopen
import urllib.error
"""
MIT License
Copyright (c) 2017 <NAME>, <NAME>
Please share comments ... |
import numpy as np
import pytest
from utils.helpers import (Game, tuple_to_str, str_to_tuple, array_in_list, moving_average,
state_to_actions, check_states, state_transforms, reverse_transforms, reverse_function,
play_game, value_frequencies, moving_value_frequencies)
@pytest.mark.parametrize(
"... |
<reponame>remtav/SpaceNet7_Multi-Temporal_Solutions
import csv
import logging
import numbers
import subprocess
from pathlib import Path
from typing import Sequence, List
import torch
# import torch should be first. Unclear issue, mentioned here: https://github.com/pytorch/pytorch/issues/2083
from torch import nn
impor... |
<reponame>Landanjs/composer
# Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
"""A wrapper for a dataloader to include metrics that apply to a specific dataset."""
from __future__ import annotations
import copy
from typing import Any, Callable, Dict, Iterable, Optional, Union
from tor... |
<gh_stars>0
from copy import deepcopy
from django.conf import settings
from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
from django.urls import resolve, Resolver404
from django.utils.deprecation import MiddlewareMixin
class ModelAdminReorder(MiddlewareMixin):
settings_vari... |
from __future__ import print_function
import numpy as np
import cv2
import os
import math
import sys
import random
from utils.config import config
def brightness_aug(src, x):
alpha = 1.0 + random.uniform(-x, x)
src *= alpha
return src
def contrast_aug(src, x):
alpha = 1.0 + random.uniform(-x, x)
coef = np.array(... |
import os
from pathlib import Path
from resolwe.flow.models import Data
from resolwe.test import tag_process, with_resolwe_host
from resolwe_bio.utils.test import KBBioProcessTestCase, skipUnlessLargeFiles
class UploadProcessorTestCase(KBBioProcessTestCase):
@tag_process("upload-bam", "upload-bam-indexed")
... |
<gh_stars>0
import unittest
import random
from Crypto.Cipher import AES
from set1 import fromAscii, toAscii, fromB64
from set1 import fixedXor
from set1 import isECBEncrypted
def pkcs7Padding(data, blockSize=16):
missingBytesNumber = (-len(data))%blockSize
if missingBytesNumber == 0:
missingBytesNumb... |
<reponame>xphade/aoc2021<gh_stars>1-10
#!/usr/bin/env python3
from aoc_utils import get_input_path, print_elapsed_time
import re
from timeit import default_timer as timer
from typing import Iterable, List, Tuple
def extract_ranges(raw_content: str) -> Tuple[Iterable[int], Iterable[int]]:
"""Extract the x and y t... |
<reponame>ZiyueXu77/NVFlare
# Copyright (c) 2021-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... |
#!/usr/bin/env python3
"""Test the mib_essswitch module."""
import os
import sys
import unittest
from mock import Mock
# Try to create a working PYTHONPATH
TEST_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
SWITCHMAP_DIRECTORY = os.path.abspath(os.path.join(TEST_DIRECTORY, os.pardir))
ROOT_DIRECTORY = os.pa... |
# encoding: utf-8
from base import APITestCase
from vilya.libs.store import store
from vilya.models.gist_comment import GistComment
class GistTest(APITestCase):
def setUp(self):
store.execute('delete from gist_stars where id<10')
super(GistTest, self).setUp()
self.gist1 = self._add_gist(
... |
<reponame>wheeler-microfluidics/flatland-fork<gh_stars>0
# -*- coding: utf-8; fill-column: 78 -*-
"""Class attribute-style declarative schema construction."""
from flatland.schema.base import Element
from flatland.schema.containers import Dict
__all__ = 'Form',
class _MetaForm(type):
"""Allows fields to be spec... |
import pigpio
from pupper.HardwareInterface import HardwareInterface
from pupper.Config import PWMParams, ServoParams
import numpy as np
def get_motor_name(i, j):
motor_type = {0: "abduction", 1: "inner", 2: "outer"} # Top # Bottom
leg_pos = {0: "front-right", 1: "front-left", 2: "back-right", 3: "back-left... |
<reponame>julienschuermans/fb-analysis
import logging
import plotly.express as px
import dash_core_components as dcc
import dash_html_components as html
from modules.network import plot_graph
from modules.messages import *
from config import MY_NAME
def get_layout(df):
total_sent = len(df.loc[df.sender_name ==... |
<filename>WeChatPayment.py
import random
import requests
import urllib.parse
import datetime
import hashlib
from random import Random
from bs4 import BeautifulSoup
from . import conf
def get_sign(data_dict, key):
"""
签名函数
:param data_dict: 需要签名的参数,格式为字典
:param key: 密钥 ,即上面的API_KEY
:return: 字符串
... |
<gh_stars>10-100
# Copyright 2020 StreamSets 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... |
<filename>pyeccodes/defs/grib1/localConcepts/efkl/cfVarName_def.py
import pyeccodes.accessors as _
def load(h):
def wrapped(h):
table2Version = h.get_l('table2Version')
indicatorOfParameter = h.get_l('indicatorOfParameter')
if table2Version == 253 and indicatorOfParameter == 228:
... |
<reponame>SUNET/ici-acme
#!/usr/bin/env python3
#
# Copyright 2019 SUNET. All rights reserved.
#
# 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 not... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Python projects\DPR\Source\GUI.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, Mai... |
<reponame>Bot-Ro-Bot/Parsing-Audio-Data<gh_stars>0
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import wavfile
from scipy import fftpack
from scipy import signal
from scipy.stats import zscore
import os
from sklearn import svm
# import soundfile as sf
#import pyAudioAnalysis
#m... |
<reponame>zhiiker/donbot
import time
import click
from utils.utils import get_config
NOINPUT = 'noinput'
class MyIntParamType(click.ParamType):
name = 'myinteger'
def convert(self, value, param, ctx):
if value in (NOINPUT, ):
return NOINPUT
try:
return int(value)
... |
<reponame>simonkowallik/as3ninja<filename>tests/test_types.py
# -*- coding: utf-8 -*-
import pytest
from as3ninja.types import F5IP, F5IPv4, F5IPv6
class Test_type_F5IPx:
test_params = [
# IP version, IP Address, Valid(True/False)
["ipv4", "192.168.0.1%123/32", True],
["ipv4", "192.168.0.... |
import importlib
from logging import getLogger
from IPython.display import display
from boruta import BorutaPy
from category_encoders import (
CountEncoder,
OneHotEncoder,
OrdinalEncoder,
TargetEncoder
)
import numpy as np
import pandas as pd
import scipy.sparse as sp
from scipy.stats import ks_2s... |
<reponame>chidinzerem/chidinzerem.github.io<filename>code/WEBSCRAPER PYTHON/status.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ------------------------
# Penji OpDev Fall 2019
# Check Status of School
# Author: <NAME>
# Updated: 02.08.2019
# ------------------------
# General
import os
import shutil
import pick... |
# 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
# (the "License"); you may not use ... |
#! /usr/bin/env python3
# encoding: utf-8
'''
Wrapper to install Acpera with Terraform on AWS.
@author: <NAME>
@license: Apache License 2.0
@contact: <EMAIL>
'''
from argparse import ArgumentParser
from argparse import RawDescriptionHelpFormatter
from configparser import ConfigParser
from itertools import c... |
import json
import sqlite3
from typing import Dict, List, Set, Union
from .database import Database
from .edge import Edge
from .node import Node
class Graph:
"""Graph representation from SQLite db."""
def __init__(self, db_path: str) -> None:
"""Database initialization from new or existing path.
... |
<gh_stars>0
import numpy as np
import pandas as pd
import argparse
import copy
import pathlib
import pdb
import pickle
from model_eval import model_evaluation, utils
def main():
parser = argparse.ArgumentParser(description="Run evaluation on aspirin dataset")
parser.add_argument("--max_order", type=int, requ... |
<reponame>HemaZ/pyroomacoustics
# Single Channel Noise Removal using Spectral Subtraction
# Copyright (C) 2019 <NAME>, <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restri... |
<filename>ExternalTools/DelayThread.py
import logging
import pexpect
import threading
from multiprocessing import Process
import sys
class DelayMonitor():
def __init__(self, client_ip, client_user, client_pass, server_ip, ping_count):
#threading.Thread.__init__(self)
log_namespace = "Monitor."+__nam... |
#############################FILE AND LABEL CHECKS############################
if not os.path.exists (__flocation__):
sys.exit("Please add "+ rawDataFolder + " folder to current folder")
if ietCalSuffix1 == "alphabet":
calFiles = alphabet
elif ietCalSuffix1 == "numbers":
calFiles = numbers
else:
sys.ex... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
import os
import sys
import json
import traceback
import six
import yaml
import requests
from scalrctl import click, defaults, settings, commands, utils
__author__ = '<NAME>, <NAME>'
def _get_spec_path(api_level, extension):
return os.path.join(defaults.CONFIG_DIRECTORY,
... |
# def self_training(args):
# """Perform self-training
#
# First load decoding results on disjoint data
# also load pre-trained model and perform supervised
# training on both existing training data and the
# decoded results
# """
#
# print('load pre-trained model from [%s]' % args.load_model... |
"""ESpeak like synthesize to be used with aeneas."""
import argparse
import os
import time
import tensorflow as tf
from hparams import hparams
from infolog import log
from tacotron.synthesizer import Synthesizer
from tqdm import tqdm
def prepare_run(args):
modified_hp = hparams.parse(args.hparams)
os.environ['TF... |
# -*- coding: utf-8 -*-
# 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/LICENSE-2.0
#
# Unless required by applicable law or ag... |
import numpy as np
from aiida.engine import calcfunction
from aiida.plugins import DataFactory
from phonopy.structure.atoms import PhonopyAtoms
from aiida.orm import Bool, Str, Int, load_node
@calcfunction
def get_phonon_setting_info(phonon_settings,
structure,
... |
<reponame>lifehackjim/pytan3<filename>pytan3/tests/test_adapters/test_adapters_all_soap.py
# -*- coding: utf-8 -*-
"""Test suite for pytan3."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pytan3
import pytes... |
<reponame>2133649586/Coronavirus-Tracker<gh_stars>0
import ssl
# 全局取消证书验证
ssl._create_default_https_context = ssl._create_unverified_context
import pandas as pd
from bokeh.core.properties import value
from bokeh.layouts import column, row
from bokeh.models import CustomJS, DatePicker, Div, ColumnDataSource, TableColum... |
<reponame>burgerdev/hostload
"""
Extensions for pylearn2 training algorithms. Those are either reimplemented to
suit the execution model of this package, or new ones for recording metrics.
"""
import os
import cPickle as pkl
import numpy as np
from pylearn2.train_extensions import TrainExtension
from .abcs import ... |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.1
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... |
# The MIT License (MIT)
# Copyright (c) 2016. <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... |
<reponame>hidaruma/caty
# coding: utf-8
import xjson
from caty.core.command import Builtin
from caty.core.exception import *
import caty.jsontools as json
import caty.jsontools.stdjson as stdjson
from caty.util.collection import conditional_dict
from StringIO import StringIO
from caty.util.web import find_encoding
cla... |
#!/usr/bin/env python
"""
Copyright (c) 2016-2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, p... |
<reponame>yuxiaoguo/VVNet
# MSRA Internal Graphics
#
"""
Examples:
"""
import os
import logging
import tensorflow as tf
import models
from scripts import dataset
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def loss(logit, label, depth, scene_info, categories=12, scope='loss'):
with tf.name_scope(scope) as _:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.