text stringlengths 957 885k |
|---|
<filename>readers/myU3.py
#!/usr/bin/python2.6
'''
Creates a MyU3 class that adds higher-level functionality to the base
LabJack U3 class.
'''
from __future__ import division
import u3
from time import sleep
import math
def getU3(**kargs):
'''Returns an open MyU3 object but retries until successful if errors occu... |
<gh_stars>1-10
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import matplotlib.pyplot as plt
from numpy import ceil, floor
class SoldNumberAnalyzer:
""" 商品销量分析器,由 keywords, 价格生成堆栈图 """
def __init__(self, keywords, db, div=10):
"""
:param keywords: 一个关键词的字典, 关键词的值为一个包含可能的, 示例:
{'小米':... |
import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Categorical
#Hyperparameters
learning_rate = 0.0002
gamma = 0.98
n_rollout = 10
class ActorCritic(nn.Module):
def __init__(self):
super(ActorCritic, self)._... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#!/usr/bin/env python
# This is a temporary version of ariadne as I change argument handling
import sys
import os
import ariadne
import argparse
#from ariadne import plugin
#from ariadne import tools
#from ariadne import pipeline
#from ariadne import deftools
#from ariadne import argparse
plugin=ariadne.plugin
tools=... |
#!/usr/bin/env python3
import cv2 as cv
import json
import math
import numpy as np
import os
import sys
from requests.utils import requote_uri
from geojson import FeatureCollection, Feature, Polygon, dumps
config = json.load(open("config.json","r"))
target = config.get('target')
tilesize = config.get('tilesize')
ma... |
#!/usr/bin/env python
# Copyright 2018 The WPT Dashboard Project. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import json
import gzip
import logging
import os
import platform
import re
import requests
import shutil
import s... |
<reponame>markrofail/multi-modal-deep-learning-for-vehicle-sensor-data-abstraction-and-attack-detection<gh_stars>0
import click
from src.helpers import frame_selector, paths, timeit
from src.helpers.flags import Verbose
from src.regnet.data import kitti
################################################################... |
"""
**results** module provides the logic to format, save and read predictions generated by the *automl frameworks* (cf. ``TaskResult``),
as well as logic to compute, format, save, read and merge scores obtained from those predictions (cf. ``Result`` and ``Scoreboard``).
"""
from functools import partial
import collect... |
<filename>main/views.py
from django.shortcuts import render,redirect
from django.http import HttpRequest
from .forms import CreateUserForm
from django.contrib import messages
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.forms import UserCreationForm
from .models import Category,... |
# -*- coding: utf-8 -*-
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Compare environment variables snapshot with expected and detect changes
"""
import argparse
import difflib
import logging
import pathlib
import re
import os
import sys
import typing
import uuid
def normalize_env_va... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 29 09:40:12 2021
@author: <NAME>
Set up function module that can assist in loading pulse sequences into AWG
and functionalizing Alazar acquiring
"""
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.patches import Ellipse
from sci... |
"""
MIT License
Copyright (c) 2019 - 2022 <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 the rights
to use, copy, modif... |
<reponame>Fingolfin7/Music-Metadata-and-Lyrics<filename>Source/GeniusLyrics.py
import requests
import get_auth_token
from functions import remove_non_ascii
from check_internet import check_internet
from ColourText import format_text
from SongsDict import SongDict
from bs4 import BeautifulSoup
GENIUS_TOKEN = ge... |
<reponame>DreamBoatOve/aia_eis<filename>v0/aia_eis_v0/goa/swarm_based/ant_colony/learning_examples/acopy/acopy/cli.py
# -*- coding: utf-8 -*-
"""Console script for acopy."""
import time
import random
import click
from . import ant
from . import solvers
from . import plugins
from . import utils
def solver_options(f... |
<gh_stars>0
import eqsig
from collections import OrderedDict
import numpy as np
import sfsimodels as sm
import o3seespy as o3
def site_response(sp, asig, linear=0):
"""
Run seismic analysis of a soil profile - example based on:
http://opensees.berkeley.edu/wiki/index.php/Site_Response_Analysis_of_a_Laye... |
<filename>lib/custom_svc.py
from sklearn.svm import SVC
import numpy as np
from sklearn.base import TransformerMixin
from ot_distances import RJW_distance
import time
from scg_optimizer import NonConvergenceError
from sklearn.exceptions import NotFittedError
class InfiniteException(Exception):
pass
class NanError... |
<filename>slate/client.py<gh_stars>0
from __future__ import annotations
import logging
import random
from typing import MutableMapping, Optional, Protocol, Type, Mapping
import aiohttp
import discord
from .bases import BaseNode
from .exceptions import NoNodesAvailable, NodeCreationError, NodeNotFound, PlayerAlready... |
from scipy import stats
from statsmodels.distributions.empirical_distribution import ECDF
import mxnet as mx
import numpy as np
from mxnet import nd, autograd, gluon
# three customized modules
from labelshift import *
from utils4gluon import *
from data_shift import *
from data import *
def correction_experiment(d... |
'''
Created on 24.05.2014
@author: ionitadaniel19
'''
import logging.config
import os
import json
from xlsmanager import easyExcel
from constants import *
import traceback
import copy
def setup_logging(default_path='logging.json', default_level=logging.INFO,env_key='LOG_CFG'):
"""Setup logging conf... |
# Copyright 2019 Nativepython Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
<filename>readthedocs/projects/migrations/0001_initial.py<gh_stars>1-10
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Project'
db.create... |
"""CLI application definition helpers
Implements CLI argument handling for transformation
utilities.
"""
from argparse import ArgumentParser
from collections import OrderedDict
from functools import wraps
import json
import os
from typing import cast, Callable, Dict, List, Mapping, Optional
import uuid
try:
from ... |
<reponame>Koen1999/opendc<filename>opendc-web/opendc-web-api/opendc/util/rest.py<gh_stars>0
import importlib
import json
import os
from oauth2client import client, crypt
from opendc.util import exceptions, parameter_checker
from opendc.util.exceptions import ClientError
class Request:
"""WebSocket message to RE... |
<filename>Scripts/simulation/interactions/utils/loot_ops.py
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\interactions\utils\loot_ops.py
# Compile... |
<filename>emsapi/models/__init__.py
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# ---------------------------------------------... |
<filename>validation/analysis_questionnaire.py
# analysis_questionnaire.py
# function to read out information, create and save data frames to .csv
# files from results .json files from the music
# genre stimuli questionnaire
def analysis_questionnaire(json_file):
'''inputs should be a participant specific question... |
from shutil import which
import subprocess
import json
from urllib import parse
import os
from distutils.dir_util import copy_tree
import shutil
import os
class utility(object):
def __init__(self):
"""
Function to initialize a common status indicator,
This variable should be updated by ever... |
<gh_stars>1-10
import numpy as np
import pandas as pd
from mne_hfo.posthoc import match_detected_annotations
from mne_hfo.sklearn import _convert_y_sklearn_to_annot_df
from mne_hfo.utils import _check_df
def true_positive_rate(y, y_pred):
"""
Calculate true positive rate as: tpr = tp / (tp + fn).
Parame... |
<reponame>nhammond129/libdiana
import struct
import sys
import math
from .encoding import encode as base_pack, decode as unpack
from .object_update import decode_obj_update_packet
from .enumerations import *
def pack(fmt, *args):
return base_pack(fmt, args)
class SoftDecodeFailure(RuntimeError):
pass
PACKETS = {}
... |
#!/usr/bin/python
import os
import sys
import csv
import json
import socket
import base64
import hashlib
import threading
from scapy.all import *
from Crypto import Random
from Crypto.Cipher import AES
from StringIO import StringIO
PROMPT = "DB_LSP > "
counter = 0 # Create a Packet Counter
class AESCi... |
<filename>beetsplug/echonest.py
# This file is part of beets.
# Copyright 2013, <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 t... |
from faker import Faker
from restapi.tests import API_URI, FlaskClient
from tests.custom import SeadataTests
class TestApp(SeadataTests):
def test_01(self, client: FlaskClient, faker: Faker) -> None:
# GET /api/orders/my_order_id
# PUT /api/orders/my_order_id
r = client.get(f"{API_URI}/or... |
#!/usr/bin/env python
import os, sys
sys.path.insert(0, "..")
import matplotlib.pyplot as plt
import numpy as np
import pprint
import time
import torch
from torch.utils.data import Dataset, DataLoader
from diff_gpmp2.env.env_2d import Env2D
from diff_gpmp2.robot_models import PointRobot2D
from diff_gpmp2.gpmp2.diff_gpm... |
<filename>build/lib/brainx/tests/test_weighted_modularity.py<gh_stars>1-10
"""Tests for the weighted_modularity module"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import os
import unittest
#... |
<reponame>codyowl/activitytracker<gh_stars>1-10
"""
Django settings for activitytracker project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths insi... |
import numpy as np
import librosa
import soundfile as sf
class AudioSegment(object):
"""Monaural audio segment abstraction.
:param samples: Audio samples [num_samples x num_channels].
:type samples: ndarray.float32
:param sample_rate: Audio sample rate.
:type sample_rate: int
:raises TypeError... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# 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... |
from flask import Flask, session, request, flash, url_for, redirect, render_template, abort, g, jsonify, Response
from flask_login import login_user, logout_user, current_user, login_required
from webapp import db, app, login_manager, UserType, recaptcha
from .models import *
import sendgrid
import os
from sendgrid.hel... |
<gh_stars>10-100
import pandas as pd
import os
from tqdm import tqdm
import random
from itertools import combinations
from supervised_product_matching.model_preprocessing import remove_stop_words
from src.common import create_final_data
def cpu_variations(cpu):
'''
Creates different forms of a cpu title
Ex... |
<gh_stars>0
import pathlib
from game.casting.color import Color
"""
CONSTANTS: used to declare constants that will be used in the game
"""
# --------------------------------------------------------------------------------------------------
# GENERAL GAME CONSTANTS
# --------------------------------------------------... |
<reponame>arslanahmd/Ghar-Tameer<gh_stars>0
from io import BytesIO
import json
from unittest.mock import Mock, MagicMock
from PIL import Image
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms import HiddenInput
from django.urls import reverse
from django... |
<reponame>SeanFitzpatrick0/BugKiller
import asyncio
import logging
from typing import List, Tuple
from bug_killer_api_interface.schemas.request.project import UpdateProjectPayload, CreateProjectPayload
from bug_killer_app.access.datastore.project import get_user_association_items, create_project_items, \
update_pr... |
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.15.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea_api.configuration import Configuration
clas... |
r"""
This module contains convolutional model blocks.
"""
from torch import nn as nn
from vp_suite.base import VPModelBlock
class DoubleConv2d(VPModelBlock):
r"""
This class implements a 2D double-conv block, as used in the popular UNet architecture
(Ronneberger et al., arxiv.org/abs/1505.04597).
"""... |
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt, QThread
from PyQt5.QtGui import QBrush, QPen, QColor, QImage
from math import *
class MyScene(QtWidgets.QGraphicsScene):
segment_arr = []
first_point = None
link_dist = 10
cut_arr = []
cut_obj = []
cut_p1 = None
cut_p... |
import json
import sys
import requests
import base64
from paynlsdk2.api.requestbase import RequestBase
from paynlsdk2.exceptions import ErrorException
from paynlsdk2.validators import ParamValidator
PAYNL_END_POINT = "https://rest-api.pay.nl"
PAYNL_CLIENT_VERSION = "1.0.0"
class APIAuthentication(object):
"""
... |
<filename>src/busco/busco_tools/Toolset.py
#!/usr/bin/env python3
# coding: utf-8
"""
.. module:: Toolset
:synopsis: the interface to OS enables to run executables / scripts
in external processes
.. versionadded:: 3.0.0
.. versionchanged:: 4.0.0
Copyright (c) 2016-2021, <NAME> (<EMAIL>)
Licensed under the MIT li... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
#!/usr/bin/env python3
#------------------------------------------------------------------------------
# log4sh-detect.py
#
# Tests the Specified Host for the log4shell Vulnerability.
#
# NOTE(s):
#
# * Morty and Morty's Creations ASSUMES ZERO LIABILITY relating to the
# results obtained by this script.
#
# * T... |
<reponame>masayuko/svgplotlib<filename>svgplotlib/TEX/Model.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# TeX-LIKE BOX MODEL
# The following is based directly on the document 'woven' from the
# TeX82 source code. This information is also available in printed
# form:
#
# <NAME>.. 1986. Computers and Typesetting, V... |
import csv
import random
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Lambda
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.preprocessing.image import img_to_array, load_img
from sklearn.model_selection import train_test_split
fr... |
<gh_stars>100-1000
from typing import List
import numbers
import xnmt, xnmt.tensor_tools as tt
from xnmt import expression_seqs, param_collections
from xnmt.transducers import base as transducers
from xnmt.persistence import Serializable, serializable_init
if xnmt.backend_dynet:
import dynet as dy
if xnmt.backend_... |
<reponame>nitanmarcel/scripthookvpy3k<gh_stars>10-100
import logging
import os
import pip.commands
import pip.exceptions
import pkg_resources
from gta.exceptions import *
__all__ = ('Message', 'CurlyBracketFormattingAdapter', 'get_directory', 'setup_logging',
'get_logger', 'install_dependency')
class Mes... |
<gh_stars>10-100
#!/usr/bin/python2.7
import sys
import socket
import threading
import json
from collections import OrderedDict
import binascii
import re
import datetime
import time
import argparse
def server_loop(local_host, local_port, remote_host, remote_port):
# create the server object
server = socket.s... |
<gh_stars>0
"""Methods pertaining to loading and configuring CTA "L" station data."""
import logging
import time
from pathlib import Path
from confluent_kafka import avro
from models import Turnstile
from models.producer import Producer
import asyncio
logger = logging.getLogger(__name__)
class Station(Producer):... |
#######################################################################
# Copyright (C) 2017 <NAME>(<EMAIL>) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
##############################################################... |
<reponame>davidtavarez/weblocator
#!/usr/bin/env python
import argparse
import os
import socket
import threading
from urllib import urlopen
import socks
from helpers import print_message, is_online, split_list, is_path_available
def create_tor_connection(address):
sock = socks.socksocket()
sock.connect(addr... |
<reponame>ConnectedSystems/pyapprox
"""
Design Under Uncertainty
========================
We will ue the Cantilever Beam benchmark to illustrate how to design under uncertainty.
.. figure:: ../../figures/cantilever-beam.png
:align: center
Conceptual model of the cantilever-beam
.. table:: Uncertainties
... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 NORDUnet A/S
# Copyright (c) 2018 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... |
""" Uncertainty Sampling
This module contains a class that implements two of the most well-known
uncertainty sampling query strategies: the least confidence method and the
smallest margin method (margin sampling).
"""
import numpy as np
from libact.base.interfaces import QueryStrategy, ContinuousModel, \
Probabi... |
<gh_stars>1-10
from pymongo.collection import ReturnDocument
from flask_restful import Resource, reqparse
import pymongo
from bson.json_util import dumps
import json
from flask import jsonify, Response
import datetime
from routes.tetra import track, calls_group, calls_subscriber, calls_detail
'''
All the Tetra API ... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Helper classes that make it easier to instrument code for monitoring."""
from infra_libs.ts_mon.common import metrics
import time
class ScopedIncreme... |
<filename>yt/data_objects/index_subobjects/particle_container.py
import contextlib
from more_itertools import always_iterable
from yt.data_objects.data_containers import YTFieldData
from yt.data_objects.selection_objects.data_selection_objects import (
YTSelectionContainer,
)
from yt.utilities.exceptions import (... |
<filename>dataamr.py
from stog.data.dataset_readers.amr_parsing.io import AMRIO
from extra.utils import LongTensor
from extra.settings import PAD_IDX, PAD, OOV, OOV_IDX, BOS, BOS_IDX, \
EOS, EOS_IDX
from tqdm import tqdm
import logging
logger = logging.getLogger(__file__)
def batch_data(amr_data, batch_size=20):... |
<reponame>methylgrammarlab/proj_scwgbs
import argparse
import os
import sys
import warnings
import numpy as np
import pandas as pd
from tqdm import tqdm
import time
warnings.simplefilter(action='ignore', category=FutureWarning)
sys.path.append(os.path.dirname(os.getcwd()))
sys.path.append(os.getcwd())
from commons i... |
<reponame>amakelov/mandala
#!/usr/bin/env python
# coding: utf-8
# # Mandala: self-managing experiments
# ## What is Mandala?
# Mandala enables new, simpler patterns for working with complex and evolving
# computational experiments.
#
# It eliminates low-level code and decisions for how to save, load, query,
# delet... |
<gh_stars>1-10
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
# =================================
# CP2K / FORCE_EVAL /DFT / LOCALIZE
# =================================
class cp2k_dft_localize_print_loc_restart_each:
"""
"""
def __init__(self):
self.params = {
}
... |
<filename>boofuzz/request_definitions/ndmp.py
import struct
import time
from boofuzz import *
ndmp_messages = [
# Connect Interface
0x900, # NDMP_CONNECT_OPEN
0x901, # NDMP_CONECT_CLIENT_AUTH
0x902, # NDMP_CONNECT_CLOSE
0x903, # NDMP_CONECT_SERVER_AUTH
# Config Interface
0x100, # NDMP... |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2014 PyBuilder Team
#
# 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/l... |
<reponame>duncanesmith/lsclib
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 18 10:33:32 2019
@author: smithd24
"""
# import common functions from default python library
import math # import math functions
import random # import random number functions
import numpy as np # import numpy matrix operation... |
<reponame>84KaliPleXon3/sslstrip-hsts-openwrt<gh_stars>1-10
# Copyright 2005 Divmod, Inc. See LICENSE file for details
import itertools
from OpenSSL import SSL
from OpenSSL.crypto import PKey, X509, X509Req
from OpenSSL.crypto import TYPE_RSA
from twisted.trial import unittest
from twisted.internet import protocol,... |
<reponame>floresmatthew/sahasrahbot<gh_stars>0
import asyncio
import datetime
import aiofiles
import logging
import pydle
from alttprbot.database import srl_races
from alttprbot.exceptions import SahasrahBotException
from alttprbot.util.srl import get_all_races, get_race
from alttprbot_srl import commands, racebot
fr... |
import logging
import os
import sys
from antlr4 import *
from antlr4.error.ErrorListener import ErrorListener
from antlr4.tree.Trees import Trees
from FirstPassTwoDimParserListener import FirstPassTwoDimParserListener
from SecondPassTwoDimParserListener import SecondPassTwoDimParserListener
from TwoDimLexer import Tw... |
<reponame>blotspot/expanse-book-analysis<gh_stars>0
# -*- coding: utf-8 -*-
#
# Box-drawing characters are the thin variants, and can be found here:
# https://en.wikipedia.org/wiki/Box-drawing_character
#
""" explacy.py
This module uses unicode box-drawing characters to draw the spacy-derived
dependency tree o... |
import time
import picamera
import apriltag
import cv2
import numpy as np
import math
import threading
from parameters import Parameters
# Create a pool of image processors
done = False
lock = threading.Lock()
pool = []
np.set_printoptions(suppress=True)
###############################################################... |
<filename>gitea_client/models/tracked_time.py
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.1.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Trac... |
"""
Author: <NAME> (@leriomaggio)
Mail: <EMAIL>
"""
from itertools import ifilter, product
from functools import wraps
from math import sqrt
from numpy import sum as np_sum
# --------------------------------------------------------------------------
# Node Similarities (Kernels on Nodes)
# ---------------------------... |
# Copyright 2011 <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 agreed to in writing, softw... |
<filename>spot/crawler/history_api.py
# Copyright 2020 ABSA Group Limited
#
# 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 ... |
<reponame>Francoralite/francoralite
# -*- coding: utf-8 -*-
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Authors: <NAME> / Coopérative ARTEFACTS <<EMAIL>>
"""
DocumentCollection tests
"""
import factory
import py... |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import precision_recall_curve, roc_curve, auc
######################
# ROC and PRC curves #
######################
def calc_metric_curve(preds, target, curve_type, squareform=False):
"""
Calculate ROC or PRC curves and area fo... |
<reponame>zeke/sota-extractor
import io
import logging
from typing import List
import markdown
from markdown.treeprocessors import Treeprocessor
from markdown.extensions.tables import TableExtension
from sota_extractor.taskdb.v01 import Task, Dataset, TaskDB
from sota_extractor.scrapers.nlp_progress.fixer import fix_... |
<filename>code/analysis/plot_mean_activity_correlations.py<gh_stars>1-10
import matplotlib
matplotlib.use('Agg')
import numpy as np
from scipy.stats import alpha
from scipy.stats import pearsonr
import pylab as pl
import seaborn
import sys
import json
import yaml
sys.path.append("code/striatal_model")
import params
fro... |
<reponame>kbhartiya/NeuralPrisma<filename>nst.py
import tensorflow as tf
import numpy as np
import os
import sys
import scipy.io
import scipy.misc
import matplotlib.pyplot as plt
from PIL import Image
from nst_utils import *
import warnings; warnings.filterwarnings("ignore")
def compute_content_cost(a_C, a_G):
"""
... |
################################################################################
# Author: BigBangEpoch <<EMAIL>>
# Date : 2018-12-24
# Copyright (c) 2018-2019 BigBangEpoch All rights reserved.
################################################################################
from cute.common.mapper import pinyin_mapp... |
# -*- coding: utf-8 -*-
# -----------------------------------
# @CreateTime : 2020/3/20 0:49
# @Author : <NAME>
# @Email : <EMAIL>
# ------------------------------------
import sys, os
sys.path.insert(0, os.path.join(__file__, "../.."))
from core.dataloaders import DataLoader
from core.models import Lo... |
<gh_stars>1-10
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013, 2014, 2015 Scalr 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... |
import numpy as np
import networkx as nx
from collections import defaultdict
"""
Reference implementation
https://github.com/nidhisridhar/Fuzzy-Community-Detection
"""
def __reachable(i, theta_cores, fuzz_d, visited):
# Returns indices of cores(in theta_cores) that are reachable from theta_cores[ i ]
reac... |
import logging
import os
from dataclasses import dataclass
from threading import Event
from typing import List
import discord
import discord.ext.commands as commands
from bot.consts import Colors
from bot.bot_secrets import BotSecrets
import bot.extensions as ext
from bot.consts import Colors
from bot.messaging.event... |
import shortuuid
from django_unicorn.utils import generate_checksum
from tests.views.fake_components import FakeComponent
from tests.views.message.test_calls import FakeCallsComponent
from tests.views.message.utils import post_and_get_response
def test_message_hash_no_change(client):
component_id = shortuuid.uui... |
# Copyright [2020] [Two Six Labs, LLC]
# Licensed under the Apache License, Version 2.0
import importlib
import os
from types import MappingProxyType
from flask import Flask
from sqlalchemy.engine.url import URL
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy import create_engine
from flask_sq... |
# 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
# distrib... |
<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 14:09:09 2020
@author: hamishgibbs
"""
import pandas as pd
import re
import numpy as np
#%%
ox = pd.read_csv('https://raw.githubusercontent.com/OxCGRT/covid-policy-tracker/master/data/OxCGRT_latest_withnotes.csv')
#%%
def melt_oxcg... |
<reponame>kokounet/conan-center-index
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
import os
required_conan_version = ">=1.33.0"
class QCoroConan(ConanFile):
name = "qcoro"
license = "MIT"
homepage = "https://github.com/danvratil/qcoro"
url = "https:/... |
import numpy as np
import tensorflow as tf
import sys, os
sys.path.extend(['alg/', 'models/'])
from visualisation import plot_images
from encoder_no_shared import encoder, recon
from utils import init_variables, save_params, load_params, load_data
from eval_test_ll import construct_eval_func
dimZ = 50
dimH = 500
n_cha... |
#! /usr/bin/env python3.3
# Virtual memory analysis scripts.
# Developed 2012-2014 by <NAME>, <EMAIL>
# Copyright (c) 2012-2014 <NAME> and University of Washington
from util.pjh_utils import * #this is going to fail if not in top-level dir...
from ip_to_fn import *
# Main:
if __name__ == '__main__':
tag = 'main'
... |
<filename>plaso/lib/event.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... |
'''
Group discrimination testing for Subject System A
Inputs :
argv[1] : Train file
argv[2] : Sensitive argument
argv[3] : Argument to test discriminationa gainst
For argv[2] and argv[3] : 8 means race and 9 means gender
'''
from __future__ import division
from random import seed, shuffle
import random
... |
<gh_stars>0
from graphsaint.globals import *
import math
from graphsaint.utils import *
from graphsaint.graph_samplers import *
from graphsaint.norm_aggr import *
import torch
import scipy.sparse as sp
import scipy
import numpy as np
import time
def _coo_scipy2torch(adj):
"""
convert a scipy sparse COO matr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.