text stringlengths 957 885k |
|---|
<reponame>gnzlbg/nmp
import subprocess
import os
import shutil
import copy
import sys
from functools import partial
from operator import itemgetter, attrgetter
def copy_and_overwrite(from_path, to_path):
os.system("cp -rf " + from_path + " " + to_path)
def get_directory_structure(rootdir):
"""
Creates a n... |
<gh_stars>1-10
import os.path
import re
import pickle, hashlib
from sklearn.externals import joblib
from logging import debug, info
from ngram import get_ngrams
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import TruncatedSVD
import numpy as np
def identity(x):
return x
d... |
#!/usr/bin/env python
# encoding: utf-8
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or... |
import sys;
import abc;
import math;
import multiprocessing;
import psutil;
import numpy as np;
from scipy.stats import t, f;
import DataHelper;
class LinearRegression:
__DEFAULT_SIG_LEVEL = 0.05;
@staticmethod
def calcVIF(X):
if X is None:
raise ValueError("matrix X is None");
... |
<reponame>webdevhub42/Lambda<filename>0-notes/job-search/SamplesDSAlgos/data_structures/datastructures-hashtable.py
# HASH TABLE
# array with elements indexed by hashed key
# associative arrays and dictionaries
# objects
# caches (memcached)
# dynamic programming, memoization
# send key through hashing function (MD5, S... |
from django.test import TestCase
from .models import Neighbourhood,Profile,Post,Business
# Create your tests here.
# Create your tests here.
#profile test
class ProfileTestClass(TestCase):
#set Up method
def setUp(self):
self.naiyoma = Profile(id=9000,username = 'naiyoma')
#testing instance
de... |
<gh_stars>1-10
"""
Main function to build PHIQnet.
"""
from image_quality.layers.fusion import fusion_layer, no_fusion
from backbone.ResNest import ResNest
from tensorflow.keras.layers import Input, Dense, Average, GlobalAveragePooling2D, Concatenate
from tensorflow.keras.models import Model
from image_quality.models.p... |
<filename>src/uproot/behaviors/TProfile3D.py
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/main/LICENSE
"""
This module defines the behavior of ``TProfile3D``.
"""
import numpy
import uproot
import uproot.behaviors.TH3
import uproot.behaviors.TProfile
from uproot.behaviors.TH1 import boost_... |
<filename>vect/vector.py
import showRepresentation
import copy
class array:
"""
Array class
"""
def __init__(self, v):
self.vector = v
self.l = len(v)
#Show vector (Raw)
def __repr__(self):
return showRepresentation.vector(self, True)
# (With print)
def __str__(self):
retu... |
import sys
import json
import datetime
import logging
import yagmail
import pywhatkit
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support import expected_... |
import tensorflow as tf
from tensorflow import keras
import keras.backend as K
from tensorflow.keras.layers import Conv3D, Activation, MaxPooling3D, Conv3DTranspose, Add,BatchNormalization, Dropout
from tensorflow.keras.callbacks import ModelCheckpoint, TensorBoard
from tensorflow.keras.models import model_from_json
... |
"""
isicarchive.sampler (Sampler)
This module provides the Sampler helper class and doesn't have to be
imported from outside the main package functionality (IsicApi).
"""
# specific version for file
__version__ = '0.4.8'
# imports (needed for majority of functions)
from typing import Any, List, Union
import warning... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from numpy import linalg as LA
import math
from matplotlib.colors import ListedColormap
from BayesClassifier import BayesClassifier
from GlobalClassifier import GlobalClassifier
# data preprocessing for different datasets
"""
x = pd.read_csv('datas... |
import base64
import csv
import ctypes
import json
from mmt_retrieval.model.models import OSCAR, ClassificationHead
from mmt_retrieval import MultimodalTransformer
import torch
import os
import numpy as np
def convert_finetuned_oscar(oscar_model_folder, model_args={}):
"""
Convert a fine-tuned OSCAR model dow... |
<reponame>alex4200/PyBlock
# Main Code for editing blocks
import glob
import logging
from pathlib import Path
from .block import Block
from .region import Region
from .tools import block_to_region_chunk
from . import converter as conv
from .maze import Maze
L = logging.getLogger("pyblock")
class MCEditor:
__... |
"""Copyright 2008 Orbitz WorldWide
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... |
<reponame>abeja-inc/platform-template-image-segmentation
import http
import os
import traceback
from io import BytesIO
import torch
import torchvision.transforms as T
from PIL import Image
import numpy as np
import json
import base64
import tempfile
from abeja.datasets import Client as DatasetsClient
import train
im... |
from collections import deque
def pawn(pawn_r, num_of_rows):
arr_pawn = [0]*num_of_rows
arr_pawn[pawn_r] = 1
for i in range(num_of_rows - 1):
if arr_pawn[i] > 0:
arr_pawn[i+1] = arr_pawn[i] + 1
return arr_pawn
def col_extract(visited, pawn_c):
arr_knight = []
for j in ... |
<filename>first_order/ig.py
import numpy as np
from optimizer import Optimizer
class Ig(Optimizer):
"""
Incremental gradient descent (IG) with decreasing or constant learning rate.
For a formal description and convergence guarantees, see Section 10 in
https://arxiv.org/abs/2006.05988
... |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Data61, CSIRO
#
# 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 applicabl... |
"""
GPSDataTools.py: Utilities and class definitions for dealing with raw GPS
tracking data.
In general one is only interested in the Route class, which loads GPS data
from the database for a particular route and automatically turns it into
individual trips.
"""
# Copyright (c) 2010 <NAME>, <NAME>
#
# Permission i... |
<gh_stars>0
import pandas as pd
import streamlit as st
import matplotlib.pyplot as plt
import seaborn as sns
from nltk.stem import WordNetLemmatizer
import re
from nltk.corpus import stopwords
import nltk
#from nltk.probability import FreqDist
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
fro... |
import copy
import os
import re
from io import StringIO
import numpy as np
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.table import Table
class Data:
"""
Base class for microlensing data from various observatories.
Subclasses should overload the :func:`Data.__lo... |
# importing the Kratos Library
import KratosMultiphysics as KM
import KratosMultiphysics.ShallowWaterApplication as SW
## Import base class file
from KratosMultiphysics.ShallowWaterApplication.shallow_water_base_solver import ShallowWaterBaseSolver
def CreateSolver(model, custom_settings):
return BoussinesqSolver... |
<gh_stars>0
#!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2020 Huawei Device 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... |
<reponame>leopd/MonsterMirror
"""
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license
(https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
import os
import yaml
import time
import torch
from torch.utils.data import DataLoader
from torchvision... |
<filename>kmip/tests/unit/core/objects/test_objects.py
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory
# 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... |
import argparse
import copy
import json
import os
import pathlib
import queue
import subprocess
import sys
import threading
import time
import traceback
from configparser import ConfigParser
from dataclasses import dataclass, field
from datetime import datetime
from typing import List
import yaml
from mako.template im... |
import itertools
import os
from random import randint, uniform
import numpy as np
import copy as cp
import pandas as pd
from skmultiflow.core import BaseSKMObject, MetaEstimatorMixin, ClassifierMixin
from skmultiflow.data import RandomTreeGenerator, DataStream
from skmultiflow.evaluation import EvaluatePrequential
... |
<gh_stars>0
from conf import *
from torch.utils.data import Dataset, DataLoader, RandomSampler, SequentialSampler
import torch
import albumentations as A
import multiprocessing as mp
import numpy as np
import cv2
def collate_fn(batch):
input_dict = {}
target_dict = {}
for key in ['input']:
input... |
<gh_stars>0
import numpy as np
import pandas as pd
import logging
from ML_Bot_Func.common import *
logger = logging.getLogger('data_parsing')
logger.setLevel(logging.INFO)
def angle(x, y):
radians = math.atan2(y, x)
if radians < 0:
radians = radians + 2 * math.pi
return round(radians / math.pi * ... |
<reponame>tim-we/py-radio
import glob
import os
import random
import time
from threading import Thread
from itertools import chain
from more_itertools import peekable
import re
from typing import List, Iterable
class ClipLibrary:
def __init__(self, folder: str, log: bool = True, auto_update: bool = True):
... |
<reponame>MichaelWS/vix_utils
"""
This module provides both the command line program and a Python interface to provide
the VIX futures term structure, the VIX continuous maturity
term structure, and the VIX cash term structure.
"""
import argparse
import vix_utils.vix_futures_term_struture as v
import vix_utils.vix_ca... |
import os
from typing import List
from enum import IntEnum
import cv2 as cv
import numpy as np
from pydicom import dcmread
from pydicom.dataset import Dataset
from pydicom.sequence import Sequence
from rt_utils.utils import ROIData, SOPClassUID
def load_sorted_image_series(dicom_series_path: str):
"""
File ... |
#!/usr/bin/python
import argparse
import io
import json
import logging
import os
import re
import sys
import bs4
import docker
import docker.errors
import markdown
import requests
docker_hl_client = docker.from_env()
docker_client = docker_hl_client.api
def parse_cmdline():
def check_docker_tag(value):
... |
<reponame>ArenasGuerreroJulian/morph-kgc<filename>src/morph_kgc/mapping/mapping_constants.py
__author__ = "<NAME>"
__credits__ = ["<NAME>"]
__license__ = "Apache-2.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
##############################################################################
#######################... |
"""Unit tests for the :mod:`networkx.algorithms.bipartite.matching` module."""
import itertools
import networkx as nx
import pytest
from networkx.algorithms.bipartite.matching import eppstein_matching
from networkx.algorithms.bipartite.matching import hopcroft_karp_matching
from networkx.algorithms.bipartite.matchin... |
#!/bin/python3
"""
Copyright kubeinit contributors.
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 w... |
<reponame>AliciaCurth/CATENets
import abc
import copy
from typing import Any, Optional, Tuple
import numpy as np
import torch
from sklearn.model_selection import StratifiedKFold
from torch import nn
from catenets.models.constants import (
DEFAULT_BATCH_SIZE,
DEFAULT_CF_FOLDS,
DEFAULT_LAYERS_OUT,
DEFAU... |
<filename>tgbot/receivers.py
import multiprocessing
import signal
import requests
import ssl
import json
import BaseHTTPServer
import subprocess
import os
import sys
import time
import logging
from telegram import BotAPI
class ReceiveProcess(multiprocessing.Process):
def __init__(self, token, q):
multipro... |
<reponame>mberkanbicer/software<gh_stars>1-10
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Chapter10\BackProjectionBH.ui'
#
# Created by: PyQt5 UI code generator 5.10
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWind... |
<reponame>stevenzim/lrec-2018<gh_stars>1-10
from gensim.models.keyedvectors import KeyedVectors
from sklearn.metrics import confusion_matrix, f1_score
from sklearn.model_selection import train_test_split
from src import nlp, helper, evaluation
from src import evaluation
REPORT_FILE_NAME = 'resources/results/wase... |
import argparse
import json
import logging
import os
from os import listdir
from os.path import isfile, join
from collections import Counter
from nlp.data import load_text_file
from nlp.preprocessing import prepareText, frequencies
from echr.utils.folders import make_build_folder
from echr.utils.logger import getlogg... |
import socket
import sys
import typing
from abc import abstractmethod
from asyncio import BaseTransport, Transport, BaseProtocol
from typing import TYPE_CHECKING, Optional
from cryptography.x509 import Certificate
from bxcommon import constants
from bxcommon.network.ip_endpoint import IpEndpoint
from bxcommon.network... |
import math
from math import pi
import numpy as np
import numpy.testing as nt
import unittest
from spatialmath import DualQuaternion, UnitDualQuaternion, Quaternion, SE3
from spatialmath import base
def qcompare(x, y):
if isinstance(x, Quaternion):
x = x.vec
elif isinstance(x, SMPose):
x = x... |
<gh_stars>0
#!/usr/bin/env python
import sys
import unittest
import time
import rostest
import rospy
from geometry_msgs.msg import PoseStamped
from araig_msgs.msg import BoolStamped, Float64Stamped
class TestCalcPoseDelta(unittest.TestCase):
def setUp(self):
_pub_topic_1 = '/test/in_obj_1'
_pub_t... |
#!/usr/bin/env python3
import os
import sys
import subprocess
import time
import operator
import pdb
from os.path import join
from functools import reduce
CUR_DIR = os.path.abspath(os.path.dirname(__file__))
'''
# NOTE
- In order to use PerfMon.LEVEL_PERF_LOCK (i.e., perf lock record),
lockdep and lockstat shou... |
<filename>tests/unit/integration/github/test_utils.py
# 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 agr... |
from Bio import PDB
import numpy as np
import pandas as pd
from biodescriptors.calc import constraints
from biodescriptors.calc import utils
def _calc_dssp_hel(dssp, ref):
"""TODO: Documentation"""
# TODO: Split function into smaller functions
chainA = [key for key in dssp.keys() if key[0] == 'A']
he... |
import streamlit as st
import streamlit.components.v1 as components
import shap
# Text plots return a IPython.core.display.HTML object
# Set diplay=False to return HTML string instead
shap.plots.text.__defaults__ = (0, 0.01, '', None, None, None, False)
from matplotlib.figure import Figure
import matplotlib.pyplot as... |
# American Magnetics, Inc. (AMI) One Axis magnet with PCS_SN14768
import time
import logging
import numpy as np
# from scipy.optimize import brent
# from math import gcd
# from qcodes import Instrument
from qcodes.utils import validators as vals
# from qcodes.instrument.parameter import ManualParameter
from pycqed.ana... |
# 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 u... |
<reponame>TerryS6903/DnD_Project
from TheDice import D20, D12, D10, D8, D6, D4
from CharacterStats import strength, dexterity, constitution, wisdom, intelligence, charisma
from AbilityModifiers import initiative, ability_mod
def main():
character_name = input("What is your characters name?\n")
strength_stat =... |
import json
import pulumi
import pulumi_aws as aws
from pulumi import export, Output, ResourceOptions
import pulumi_redata as redata
from autotag import register_auto_tags
aws_config = pulumi.Config('aws')
aws_account_id = aws.get_caller_identity().account_id
aws_region = aws_config.require('region')
config = pulu... |
# Generated by Django 2.0.1 on 2018-01-29 10:10
import ckeditor.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER... |
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _ICONS
class _Vrt_Light_LightPng(_ICONS):
_type = "VRT_Light_LightPng"
_icon_dir = "../resources/icons/VRT_Icons/VRT_LightPng/VRT_light_LightPng"
class DLaserScanner1LightPng(_Vrt_Light_LightPng):
_icon = "2dlaserscanner1... |
#!/usr/bin/env python
# coding: utf-8
# # Import Libraries and Dataset
# In[21]:
# Installing plotly Library
get_ipython().system('pip install plotly')
# In[84]:
# Importing Libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
impor... |
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
import asyncio
import logging
import time
from abc import ABC, abstractmethod
from datetime import timedelta
from typing import Any, Callable... |
<filename>model/BaseModel.py
# -*- coding: utf-8 -*-
# Created by <NAME> on 2019/11/7
import os
import pathlib
import torch
import torch.nn as nn
from module.bertology_encoder import BERTologyEncoder
class BaseModel(nn.Module):
def __init__(self, args):
super().__init__()
if args.encoder in ['ber... |
__author__ = '<NAME>'
import types
import ast
from ast_tool_box.views.editor_widget import EditorPane
from ast_tool_box.views.search_widget import SearchLineEdit
from ast_tool_box.models.transform_models.transform_file import AstTransformItem, CodeGeneratorItem
from PySide import QtGui, QtCore
DEBUGGING = False
c... |
<gh_stars>1-10
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# 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... |
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from pycocotools import mask as maskUtils
import mmcv
import argparse
from mmdet.datasets import build_dataloader, build_dataset
import os
from mmcv.runner import load_checkpoint
from mmdet.models import build_detector
from mmcv.parallel import... |
<reponame>choco0908/PTWQIProject<gh_stars>0
# fig: 캔버스 같은 역할을 하는 Matplotlib의 Figure 클래스 객체
# axes:차트를 그리기 위한 Matplotlib의 Axes 클래스 객체
# Figure 제목:에포크 및 탐험률
# Axes 1: 종목의 일봉차트
# Axes 2: 보유 주식 수 및 에이전트 행동 차트
# Axes 3: 정책 신경망 출력 및 탐험 차트
# Axes 4: 포트폴리오 가치 차트
import threading
import numpy as np
import matplotlib.pyplot as ... |
<reponame>ShibataLab/cloth_assist_framework
#!/usr/bin/env python
# plotFuncs.py: plot functions for data inspection
# Author: <NAME>
# Date: 2016/02/01
import sys
import GPy
import numpy as np
from matplotlib import cm
from matplotlib import pyplot as plt
############################################################... |
<reponame>lalithr95/competitive-programming
import urllib2
import os
import math
import json
endpoint = "curl --header 'token: <KEY>' https://www.find.foo/api/challenge"
# data = os.system(endpoint)
# print data
import subprocess
result = os.popen(endpoint).read()
data = json.loads(result)
challenge = data['challenge... |
<gh_stars>1-10
from urllib.parse import urlparse
import requests
from bs4 import BeautifulSoup
from Scraper.framework.base_component import BaseComponent
from Scraper.framework.i_components import IComponents
# TODO: Fix a problem where config {tags} used in master dir string
# will be presented in the form of a li... |
#!/usr/bin/env python
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# MINIHACK_RELEASE_BUILD
# If set, builds wheel (s)dist such as to prepare it for upload to PyPI.
#
import os
import setuptools
import subprocess
packages = [
"minihack",
"minihack.envs",
"minihack.scripts",
"minihack.ti... |
# This is a python script to take 2D (in space) passive tracer
# data and calculate the time mean effective diffusivity. The
# effective diffusivity is described in more detail in
# Nakamura (1996), Shuckburgh and Haynes (2003), and Abernathey
# and Marshall (2013).
import matplotlib.pyplot as plt
import matplotlib.p... |
<filename>backend/position/views.py
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import api_view
from utils.generic_json_creator import create_response
from .models import JobPosition, PositionDetail
from .serializers import JobPositionSeriali... |
#!/usr/bin/env python3
"""Finds latest versions of the CSVs for each subsystem, then plots the time
domain and X-Y data.
If provided, the first argument to this script is a filename regex that
restricts which CSVs are plotted to those that match the regex.
"""
import argparse
import matplotlib.pyplot as plt
import nu... |
<filename>aup2rpp.py
import struct
import xml.etree.ElementTree as ET
import uuid
import math
import pprint
import os
import html
import argparse
"""
shermnotes
.AU : A container format, used by Audacity for storage of lossless, uncompressed,
PCM audio data. Not be confused with Sun/NeXT AU files, which are usually ... |
<gh_stars>0
import base64
import hashlib
from http import HTTPStatus
from typing import Optional
from embit import bech32
from embit import compact
import base64
from io import BytesIO
import hmac
from fastapi import Request
from fastapi.param_functions import Query
from starlette.exceptions import HTTPException
fro... |
<gh_stars>100-1000
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import numbers
import warnings
from typing import Optional, Union
import networkx as nx
import numpy as np
from beartype import beartype
from graspologic.embed import LaplacianSpectralEmbed
from graspologic.embed.base import ... |
"""Search Engine"""
import sqlite3
from typing import Iterator, Union
from numpy import array
from pandas import DataFrame, read_sql_query
class SearchEngine:
"""Search Engine
Parameters
----------
database: str, optional, default='data/pubmed.db'
SQL database
articles_table: str, option... |
#import base64
#import binascii
from datetime import datetime
import json
import traceback
from decimal import Decimal
from bson.decimal128 import Decimal128
from pymongo import MongoClient
import pymongo
from google.protobuf.json_format import MessageToJson, Parse, MessageToDict
from utils.getData import *
DB_CO... |
<gh_stars>0
'''
---------------------------------------------
LinkedList - My version of the class List
Author: <NAME>
---------------------------------------------
Description:
This is my version of the python list. It is a double linkedlist, so you can
traverse the linkedlist forward or backward.
'''
from typing imp... |
#!/usr/bin/env python3
import boxx
from boxx import *
from boxx import np
import os
import sys
sys.path.append(".")
import bpy
import bpycv
import random
from bpycv.dataset_utils.dataset_generator import MetaDatasetGenerator, uniform_by_mean
from cfg_utils import get_arguments, get_default_cfg
class LogGenerator(... |
<filename>prose/core.py
from tqdm import tqdm
from astropy.io import fits
from .console_utils import TQDM_BAR_FORMAT
from astropy.wcs import WCS
from . import viz
from . import Telescope
from collections import OrderedDict
from tabulate import tabulate
import numpy as np
from time import time
from pathlib import Path
f... |
# %%
import numpy as np
import pandas as pd
import gurobipy as gp
from gurobipy import GRB
import matplotlib.pyplot as plt
# Global vartiables(sizes):
PV_ARRAY_SIZE_KW = 660 # kWAC rating of the PV array
DIESEL_GEN_SIZE_KW = 1000 # kWAC rating of the diesel generator
# Diesel fuel consumption coefficients from htt... |
<gh_stars>0
from flask import Flask, request, Response, abort
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
import os
import json
import pytz
import iso8601
import requests
import logging
app = Flask(__name__)
logger = None
base_url = "https://consumption.azure.com/"
de... |
<gh_stars>0
#!/usr/bin/env python
try:
import sys
import abc
from pygame_cards import game_object, card, card_sprite, card_holder, animation
except ImportError as err:
print("Fail loading a module in file:", __file__, "\n", err)
sys.exit(2)
class Controller(object, metaclass=abc.ABCMeta):
"""... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Dict, List, Optional, Any
import torch, pdb, math
from torch import nn
from torch.nn import functional as F
import torch.utils.checkpoint as checkpoint
from detectron2.config import CfgNode
from detectron2.layers import Conv2d
f... |
<filename>ukb/models/mri.py
import torch
import logging
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from .frame import LeNetFrameEncoder, FNNFrameEncoder, DenseNet121, vgg16_bn, densenet121, densenet_40_12_bc
from .sequence import RNN, MetaRNN, SeqSumPool... |
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk
from utils.wxlogger import WxLogger
class ElasticService:
"""Elastic Service Class."""
logger = None
def __init__(self, client: Elasticsearch):
if self.__class__.logger is None:
ElasticService.logger = Wx... |
<gh_stars>1-10
import os, binascii
from hashlib import sha256, sha1
try:
import json
json.__version__ # this is really here to hush pyflakes, which gets
# confused by this import-and-alternate pattern
except ImportError:
import simplejson as json
json.__version__
class JPAKEError... |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2020, Battelle Memorial 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... |
# -*- coding: utf-8 -*-
# Create your views here.
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.context_processors import request
from django.core.urlresolvers import reverse
from django.db.models import ProtectedError
from django.utils.decorators import ... |
<reponame>schwettmann/pretorched-x<gh_stars>1-10
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
# The is a pytorch model translated from a Caffe model.
# Note that I left out any dropout layers
# http://memorability.csail.mit.edu/
# Source for the original model:
# Und... |
import sys
import time
import pprint
import time
import urllib.error
import urllib.request
import urllib.parse
import io
import random
import string
import json
from flask import Flask, request, send_file, jsonify, make_response, Response
from werkzeug.wsgi import FileWrapper
import numpy as np
import pandas as pd
f... |
<reponame>andrewsmike/jasmine<gh_stars>1-10
# Generated from SQLParser.g4 by ANTLR 4.9.3
from antlr4 import *
if __name__ is not None and "." in __name__:
from .SQLParser import SQLParser
else:
from SQLParser import SQLParser
"""
Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
Thi... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import logging
import pickle
import sys
import traceback
from typing import Callable, Dict, List, Tuple, Set
from languages import SExpressionLanguage, WebQSPSExpressionLanguage
from sparql_executor import exec_verify_sparql_xsl_only_fix_literal... |
<reponame>ed-ortizm/L-G-opt
#!/usr/bin/env python3
import numpy as np
from annealing import GR
import matplotlib
import matplotlib.pyplot as plt
# Stats for convergence ratios:
# data = np.loadtxt('20_chains_100_runs/conv_rates.txt')
# cr_mean = np.zeros((data.shape[0],2))
# i = 0
# for n in data:
# print('For n =... |
# Standard Library
import asyncio
import gc
import json
import logging
import os
import time
import urllib.request
import zipfile
from collections import defaultdict
# Third Party
import boto3
import numpy as np
import pandas as pd
from botocore.config import Config
from botocore.exceptions import ClientError
from ela... |
<gh_stars>0
import numpy as np
import tensorflow as tf
import Nn
from .base import Base
class MADDPG(Base):
def __init__(self,
s_dim,
a_dim_or_list,
action_type,
base_dir=None,
gamma=0.99,
ployak=0.995,
... |
<filename>pusion/core/dempster_shafer_combiner.py
from pusion.core.decision_templates_combiner import *
class DempsterShaferCombiner(TrainableCombiner):
"""
The :class:`DempsterShaferCombiner` (DS) fuses decision outputs by means of the Dempster Shafer evidence theory
referenced by Polikar :footcite:`poli... |
<gh_stars>1000+
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file convert.py is referred and derived from project NetworkX,
#
# https://github.com/networkx/networkx/blob/master/networkx/convert.py
#
# which has the following license:
#
# Copyright (C) 2004-2020, NetworkX Developers
# <NAME> <<EMAIL>>
# <NAM... |
<filename>examples/examine_local_projects.py<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 <NAME> ( http://krause-software.com/ ).
# You are free to use this code under the MIT license:
# http://opensource.org/licenses/MIT
"""Test local project.pbxproj files.
This script basica... |
from unittest.mock import ANY
from django.urls import reverse
import pytest
from rest_framework import status
from apps.cars.models import Car
from apps.cars.tests.factories import CarFactory, RateFactory
pytestmark = pytest.mark.django_db
class TestCarListView:
def setup(self):
CarFactory.create_batc... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 23 21:32:16 2016
@author: HZJ
"""
import uuid
import numpy as np
from . import FrameCrossSection
from .orm import Material,FrameSection
import logger
class Rectangle(FrameCrossSection):
def __init__(self,mat,h,b,name=None):
"""
h - height\n
... |
from apps.oob.models import project
from django.core.exceptions import ValidationError
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.utils import timezone
from unittest import mock
from datetime import timedelta
from ..models import Project, Task
class ProjectModelTest(T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.