text stringlengths 957 885k |
|---|
<reponame>Troublor/smSymer<filename>smsymerd/wsserver-compile.py<gh_stars>1-10
import asyncio
import json
import os
import subprocess
import sys
import time
from typing import List, Tuple
import websockets
from smsymer import utils, Printer
from smsymer.analyzer import Analyzer
from smsymer.cfg import CFG
from smsyme... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.odr
import itertools
def computeModelDetails(frame):
""" Takes a dataframe and computes columns related to the dynamical frb model """
tauwerror_expr = lambda r: 1e3*r['time_res']*np.sqrt(r['max_sigma']**6*r['min_sigma_error']**2*np... |
<reponame>choderalab/Protons
# coding=utf-8
"""Test the reading of forcefield files included with the package.
Developer Notes
---------------
Do not use protons.app classes for this test module. These files need to be tested to be compatible with original OpenMM.
Note that the Z in the filename is necessary so that fu... |
<gh_stars>0
#
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
... |
"""
Unit test for GaussianGRUPolicy with Model.
This test consists of four different GaussianGRUPolicy: P1, P2, P3
and P4. P1 and P2 are from GaussianGRUPolicy, which does not use
garage.tf.models.GRUModel while P3 and P4 do use.
This test ensures the outputs from all the policies are the same,
for the transition fro... |
#-*- coding: UTF-8 -*-
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# predicted_filename = '/Users/sunguangyu/Downloads/电表/1528641961.4759896df_dh.csv51220predicted_df.csv'
# test_filename = '/Users/sunguangyu/Downloads/电表/1528641961.4759896df_dh.csv51220y_test_df.csv'
predicted_filename = '... |
<gh_stars>1-10
# coding: utf-8
from __future__ import absolute_import
import tempfile
import os
import shutil
import logging
import base64
import nacl.encoding
import subprocess
from bravado.client import SwaggerClient
from bravado.exception import HTTPNotFound
from requests.exceptions import ConnectionError
from n... |
import argparse
import time
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.optim
import torch.utils.data as data
import torch.utils.data.distributed
import torchvision
import torchvision.transforms as tran... |
<gh_stars>1-10
import datetime
from enum import unique, Enum
import json
import related
import requests
from adaptive_alerting_detector_build.config import get_datasource_config
from adaptive_alerting_detector_build.datasources import datasource
from adaptive_alerting_detector_build.detectors import build_detector, Det... |
"""Plots histograms for GridRad dataset.
Specifically, this script plots two histograms:
- number of convective days per month
- number of tornado reports in each convective day
"""
import os.path
import argparse
import numpy
import pandas
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot
from ge... |
"""
NCL_panel_15.py
===============
This script illustrates the following concepts:
- Paneling three plots vertically
- Making a color bar span over two axes
- Selecting a different colormap to abide by best practices. See the `color examples <https://geocat-examples.readthedocs.io/en/latest/gallery/index.html... |
<reponame>plataKwon/KPRN
#***********************************************************
#Copyright 2018 eBay Inc.
#Use of this source code is governed by a MIT-style
#license that can be found in the LICENSE file or at
#https://opensource.org/licenses/MIT.
#***********************************************************
# -*... |
# Generated by Django 2.0 on 2018-01-23 17:05
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operat... |
<filename>tests/providers/test_braket_backend.py<gh_stars>1-10
"""Tests for AWS Braket backends."""
import unittest
from unittest import TestCase
from unittest.mock import Mock
from qiskit import QuantumCircuit, transpile, BasicAer
from qiskit.algorithms import VQE, VQEResult
from qiskit.algorithms.optimizers import (... |
<reponame>forfullstack/slicersources-src
from __future__ import print_function
import unittest
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
class VolumesLogicCompareVolumeGeometryTesting(ScriptedLoadableModuleTest):
def setUp(self):
pass
def test_VolumesLogicCompareVolumeGeometry(... |
"""
Load tests for course import from studio.
By default, this tests loading a relatively small course. I recommend
exporting a large course from edX and using it here.
"""
import os
import sys
# due to locust sys.path manipulation, we need to re-add the project root.
sys.path.append(os.path.dirname(os.path.dirname(o... |
from scapy.all import *
from PyQt5 import QtCore
import threading
def GetProtocol(pkt:Packet):
PktSummary = pkt.summary()
PktSumList = PktSummary.split("/")
ProtocolList1 = ['ARP','RARP','DHCP']
for prtcl in ProtocolList1:
if prtcl in PktSumList[1]:
return prtcl
if 'IPv6' in Pkt... |
# ---------------------------------------------------------------------
# Object segmentation
# ---------------------------------------------------------------------
# Copyright (C) 2007-2015 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modu... |
<gh_stars>1-10
# From the original file example_evaluator.py by <NAME> (https://github.com/AICrowd/aicrowd-example-evaluator)
# Adapted for MEDIQA 2019 by <NAME> --Accuracy for Tasks 1 and 2 (NLI and RQE) & MRR, Accuracy, Precision, and Spearman's rank correlation coefficient.
# Last update on April 16, 2019.
import... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import copy
import utils
import measures as ms
def normal(nHyperplanes,nDimensions):
"""
Returns a set of hyperplanes with random orientations. nHyperplanes is
the number of hyperplanes to return, and nDimension the number of
... |
<reponame>derekhoward/EmbEval
import numpy as np
import pandas as pd
import scipy
from sklearn.metrics.pairwise import euclidean_distances
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.metrics import f1_score
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import StratifiedK... |
from __future__ import division
import os
import time
import math
import numpy as np
import tensorflow as tf
import tensorflow.contrib.slim as slim
from dataloader.supervise_data_loader import DataLoader
from model.net import Net
from utils.tools import *
import matplotlib as mpl
import matplotlib.cm as cm
from tenso... |
import os
import pickle
import matplotlib as mpl
import numpy as np
import seaborn as sns
from cartopy import crs as ccrs
from matplotlib import pyplot as plt
from matplotlib import ticker
from mosaiks import config as c
from mosaiks.plotting.general_plotter import scatter_preds
from mosaiks.utils.io import get_us_fro... |
# 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
# distributed under the... |
<reponame>ivannlin0613/sC-projects<filename>stanCode_Projects/boggle_game_solver/boggle.py
"""
File: boggle.py
Name:
----------------------------------------
TODO:
"""
# This is the file name of the dictionary txt file
# we will be checking if a word exists by searching through it
FILE = 'dictionary.txt'
# List for s... |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdeploy.core import FUNCTION_REWRITER, RewriterContext
from mmdeploy.core.rewriters.function_rewriter import FunctionRewriter
from mmdeploy.utils.constants import Backend
def test_function_rewriter():
x = torch.tensor([1, 2, 3, 4, 5])
y = to... |
# Copyright (c) 2011-2015 by California Institute of Technology
# 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
# notice,... |
############################################
# Copyright (c) 2016 Microsoft Corporation
#
# MSS enumeration based on maximal resolution.
#
# Author: <NAME> (nbjorner)
############################################
"""
The following is a procedure for enumerating maximal satisfying subsets.
It uses maximal resolution t... |
# Copyright 2021 <NAME> <<EMAIL>>.
# SPDX-License-Identifier: MIT
from pytest import fixture, mark
import pytest
from ganjoor import Ganjoor, GanjoorException
from dotenv import load_dotenv
from os import environ
import vcr
from ganjoor.models import Category, Poem, Poet
class TestGanjoor:
@fixture()
def ga... |
# -*- coding: utf-8 -*-
# Copyright European Organization for Nuclear Research (CERN) since 2012
#
# 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-... |
# Copyright 2019 Splunk, Inc.
#
# Use of this source code is governed by a BSD-2-clause-style
# license that can be found in the LICENSE-BSD2 file or at
# https://opensource.org/licenses/BSD-2-Clause
import random
from jinja2 import Environment
from .sendmessage import *
from .splunkutils import *
from .timeutils im... |
<filename>awx/sso/backends.py
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
import logging
import uuid
import ldap
import six
# Django
from django.dispatch import receiver
from django.contrib.auth.models import User
from django.conf import settings as django_settings
from django.core.signals imp... |
<filename>venv/lib/python3.7/site-packages/scapy/contrib/ppi_cace.py
# This file is part of Scapy
# Scapy 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 2 of the License, or
# any later version... |
<reponame>PrincetonUniversity/mcpib<gh_stars>0
#
# Copyright (c) 2014, <NAME>
# All rights reserved.
#
# mcpib is distributed under a simple BSD-like license;
# see the LICENSE file that should be present in the root
# of the source distribution.
#
import unittest
import os
import sys
buildPythonPath = os.path.join(o... |
import torch
from fastprogress.fastprogress import master_bar, progress_bar
import numpy as np
from time import time
from time import strftime, gmtime
import pdb
__all__ = ["LearnerCallback", "Learner"]
class LearnerCallback():
def get_metric_names(self):
return []
def on_train_begin(self):... |
from baconian.test.tests.set_up.setup import TestWithAll
from baconian.common.logging import Logger, ConsoleLogger, Recorder, record_return_decorator
import numpy as np
from baconian.core.core import Basic, EnvSpec
from baconian.algo.dqn import DQN
from baconian.envs.gym_env import make
from baconian.algo.value_func.ml... |
<filename>pizzapi/order.py<gh_stars>0
import requests
from .menu import Menu
from .urls import Urls, COUNTRY_USA
# TODO: Add add_coupon and remove_coupon methods
class Order(object):
"""Core interface to the payments API.
The Order is perhaps the second most complicated class - it wraps
up all the lo... |
import json
import os
from copy import copy
from PyQt5 import QtCore
from PyQt5.QtWidgets import (
QPushButton,
QButtonGroup,
QVBoxLayout,
QGroupBox,
QGridLayout,
QCheckBox,
QComboBox,
QScrollArea,
QTabBar,
QHBoxLayout, QRadioButton)
from PyQt5.QtCore import Qt, pyqtSignal
from... |
<reponame>BookOps-CAT/bookops-callno<filename>bookops_callno/parser.py
# -*- coding: utf-8 -*-
"""
This module contains methods to parse MARC records in a form of pymarc.Record objects
"""
from typing import List, Optional
from pymarc import Record, Field
from bookops_callno.errors import CallNoConstructorError
... |
# WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
import enum
import winsdk
_ns_module = winsdk._import_ns_module("Windows.Media.Capture")
try:
import winsdk.windows.devices.enumeration
except Exception:
pass
try:
import winsdk.windows.foundation
except Exception:
... |
import paddle
import paddle.nn as nn
import paddle.vision.models as models
import paddle.nn.functional as F
class TVLoss(nn.Layer):
def __init__(self,TVLoss_weight=1):
super(TVLoss,self).__init__()
self.TVLoss_weight = TVLoss_weight
def forward(self,x):
batch_size = x.shap... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, get_object_or_404, resolve_url
from django.contrib import messages
from django.templatetags.static import static
from django.contrib.auth import logout
from .forms import UserUpdateForm, ProfileUpdateForm, UpdatePro... |
<filename>PyQt-Sudoku/ui.py
# File: ui.py
# Author: <NAME>
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import sudoku
class SudokuUI(QWidget):
def __init__(self):
super().__init__()
self.gridSize = 9
self.cellSize = 35
self.sudokuGrid = sudoku.... |
<gh_stars>10-100
from dataclasses import dataclass
from typing import Dict, List, Union
import pytest
import yahp as hp
@dataclass
class Foo(hp.Hparams):
baz: int = hp.required(doc='int')
@dataclass
class Bar(hp.Hparams):
baz: int = hp.required(doc='int')
@dataclass
class ParentListHP(hp.Hparams):
h... |
<gh_stars>0
import random
from typing import List
class Solution:
def sortArray(self, nums: List[int]) -> List[int]:
return sorted(nums)
# TLE
def bubble_sort(self, nums):
n = len(nums)
for i in range(n):
for j in range(n - i - 1):
if nums[j] > nums[j +... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
import os.path
import json
import sys
import argparse
# wal_vtop details
VERSION = "0.1.1"
# Get path for vtop themes
vtop_file = "wal.json"
def setConfig():
# Get host OS
hostOS = getOS()
# Get user home directory
home_dir = os.getenv("HOME", os.getenv("USERPROFILE"))
# Set wal colors file
wal_colors = os.pat... |
<reponame>guillemcortes/neural-audio-fp<filename>run.py
# -*- coding: utf-8 -*-
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" run.py """
import os
import sys
import pathlib
import click
import yaml
import numpy as np
import pandas as ... |
import FWCore.ParameterSet.Config as cms
from Configuration.StandardSequences.Reconstruction_cff import *
# muons with trigger info
import PhysicsTools.PatAlgos.producersLayer1.muonProducer_cfi
oniaPATMuonsWithoutTrigger = PhysicsTools.PatAlgos.producersLayer1.muonProducer_cfi.patMuons.clone(
muonSource = 'muons'... |
<reponame>Li-En-Good/VISTA
import numpy as np
import os
import pdb
import scipy
import warnings
import pdb
def normalize(img):
"""Subtract mean, set STD to 1.0"""
result = img.astype(np.float64)
result -= np.mean(result)
result /= np.std(result)
return result
def do_nothing(img):
return img.as... |
# Copyright 2020 PCL & PKU
#
# 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... |
<reponame>chengsoonong/crowdastro-projects
"""Plot a Zooniverse subject.
<NAME> <<EMAIL>>
Research School of Astronomy and Astrophysics
The Australian National University
2017
"""
import aplpy
import astropy.coordinates
import astropy.io.ascii
import astropy.io.fits
import matplotlib.pyplot as plt
import matplotlib.p... |
"""
Get and set environment variables in deployed lambda functions using the SSM param store
variable named "environment".
"""
import os
import sys
import select
import json
import argparse
import logging
import typing
from botocore.exceptions import ClientError
from dss.operations import dispatch
from dss.operations... |
#
# author: <NAME>
#
# Copyright 2010 University of Zurich
#
# 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 applica... |
from flask import Flask
from edmunds.foundation.concerns.config import Config as ConcernsConfig
from edmunds.foundation.concerns.runtimeenvironment import RuntimeEnvironment as ConcernsRuntimeEnvironment
from edmunds.foundation.concerns.serviceproviders import ServiceProviders as ConcernsServiceProviders
from edmunds.... |
import os
import sys
from drake.tools.lint.formatter import IncludeFormatter
def _check_unguarded_openmp_uses(filename):
"""Return 0 if all OpenMP uses in @p filename are properly guarded by
#if defined(_OPENMP), and 1 otherwise.
"""
openmp_include = "#include <omp.h>"
openmp_pragma = "#pragma om... |
#!/usr/bin/env python3
import subprocess
import logging
import collections
import time
import datetime
import threading
from prometheus_client.core import GaugeMetricFamily
import utils
logger = logging.getLogger(__name__)
class nv_host(object):
def __init__(self):
pass
def __enter__(self):
... |
import random
import time
from .room import Room, Tunnel, DeadEnd, Store
from .item import Trash, Stick, Gem, Hammer
from .constants.adjectives import adjectives
from .constants.places import places
class Map:
def __init__(self, size, room_limit):
self.grid = []
row = [0] * size
for i in r... |
<reponame>bitranox/fingerprint
####################################################################################
# DEPRICATED OLD VERSION - WILL BE SPLITTED INTO DIFFERENT FILES, WORK IN PROGRESS #
# THIS FILE IS BROKEN !!! WORK IN PROGRESS #
# --> fp_files_diff.py V2.0.0 (fin... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# -----------------------------------------------------------
# bot
# created 01.10.2021
# <NAME>, <EMAIL>
# https://github.com/kaulketh
# -----------------------------------------------------------
import os
import signal
import time
from multiprocessing import Process
impor... |
# -*- coding: utf-8 -*-
#Scrapped from
#https://www.engineeringtoolbox.com/mineral-density-d_1555.html
densities = \
{'Acanthite': 7200.0, #kg/m^3
'Acmite': 3520.0,
'Actinolite': 3040.0,
'Alabandite': 4000.0,
'Alamandine': 4090.0,
'Albite': 2620.0,
'Allanite': 3300.0,
'Allemontite': 6150.0,
'Allophane': 1900... |
<reponame>harunpehlivan/wav2letter
#!/usr/bin/env python3
import math
import os
import struct
import sys
import numpy as np
from wav2letter.common import Dictionary, createWordDict, loadWords, tkn2Idx
from wav2letter.decoder import (
CriterionType,
DecoderOptions,
KenLM,
SmearingMode,
Trie,
Wo... |
import scrapy
import re
from YFSpider.items import EventItem, EvtProfileItem, EvtSymbolItem
class SurpriseSpider(scrapy.Spider):
name = "surprise-profiles"
allowed_domains = ["biz.yahoo.com", "finance.yahoo.com"]
start_urls = ["http://biz.yahoo.com/z/20110103.html"]
def parse(self, response):
... |
<filename>bcs-ui/backend/templatesets/legacy_apps/configuration/showversion/serializers.py
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reser... |
import datetime
import smtplib
import uuid
from email.header import Header
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from flask import render_template, url_for
from itsdangerous import URLSafeTimedSerializer
TEST_MESSAGES = []
class EmailService:
def __init__(self, app)... |
<gh_stars>1-10
import numpy as np
from typing import Any, Dict, List, Tuple, NoReturn
import argparse
import os
def parse_arguments() -> Any:
"""Parse command line arguments."""
parser = argparse.ArgumentParser()
parser.add_argument(
"--data_dir",
default="",
type=str,
help="Directory where the feature... |
<filename>Bioinformatics_k-mer_generator_with_Flask/venv/Lib/site-packages/Bio/AlignIO/Interfaces.py
# Copyright 2008-2018 by <NAME>. All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see t... |
"""
news page handlers:
news_cnbc
news_reuters
news_cnn
news_inquirer
news_gma
news_bworld
process:
derive data from news front page url as html and json files
get document similarity between header and content
get news summary, applying document similarity measures to skip first co... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
This python script uses XGBoost classifier to detect guanine quadruplexes in DNA sequences.
"""
!pip install xgboost==1.5.1
from typing import List, Dict, Tuple
from dataclasses import dataclass, asdict
import requests
import pandas as pd
import numpy as np
from time import s... |
<reponame>fColangelo/MORA-Multi-Objective-Routing-Algorithm
# -*- coding: utf-8 -*-
import sys
sys.dont_write_bytecode
import json
import os
from geopy.geocoders import Nominatim # https://github.com/geopy/geopy
from geopy.distance import great_circle
from service_flows.data_processor import get_mean_link_bw
import ti... |
import logging
import os
import tkinter
import tkinter.filedialog
import yaml
from msquaredc import persistence
from msquaredc import utils
from msquaredc.ui.gui.widgets import ScaleWidget
class MainFrame(object): # pragma no cover
def __init__(self, widgets):
self.widgets = widgets
self.tk = t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import web, config, json
import datetime
import time
import re
import base64
import sys
import os
import usbauth
import hashlib
import sqlite3
import json2db
session = None
def is_dict(d):
""" additional template function, registered with web.template.render """
return... |
<filename>tools/replay/modeleval.py
import numpy as np
import struct
import imgproc
import ekf
np.set_printoptions(suppress=True)
def replay_LL(fname, f):
x, P = ekf.initial_state()
t0 = None
dt = 1.0 / 30
# gyrozs = []
wheels_last = None
frameno = 0
last_throttle = 0
last_steering =... |
<filename>smartsheet/discussions.py
# pylint: disable=C0111,R0902,R0913
# Smartsheet Python SDK.
#
# Copyright 2016 Smartsheet.com, 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
#
# ... |
<reponame>WNoxchi/rfcx_species_audio_detection<gh_stars>0
# AUTOGENERATED! DO NOT EDIT! File to edit: 01_spectrogram_processor.ipynb (unless otherwise specified).
__all__ = ['parser', 'args', 'fpath', 'num_cpus', 'serial', 'n_fft', 'hop_length', 'n_mels', 'mel_n_fft',
'mel_hop_length', 'frq', 'mel', 'comput... |
# from skimage.io import imread
import datetime
import os
import pickle
import sys
import math
from os import mkdir
# from torchsummary import summary
from os.path import join
from time import time
from memory_profiler import profile
import cv2
import matplotlib.pyplot as plt
import numpy as np
from src.data.utils.uti... |
# 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 ... |
"""
===============================
05. Simulate beta modulated ERP
===============================
This example demonstrates how event related potentials (ERP) are modulated
by prestimulus beta events. Specifically, this example reproduces Figure 5
from Law et al. 2021 [1]_. To be consistent with the publication, the... |
# https://www.nayuki.io/res/number-theoretic-transform-integer-dft/numbertheoretictransform.py
#
# Number-theoretic transform library (Python 2, 3)
#
# Copyright (c) 2017 Project Nayuki
# All rights reserved. Contact Nayuki for licensing.
# https://www.nayuki.io/page/number-theoretic-transform-integer-dft
#
import ite... |
<gh_stars>1-10
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from tqdm import tqdm
import networkx as nx
import uproot
from collections import deque
# !cd tools/ && python setup_opera_distance_metric.py build_ext --inplace
from tools.opera_distance_metric import generate_k... |
<reponame>ghjan/vnpy
# encoding: UTF-8
# 定义Tick数据的格式
# 默认空值
EMPTY_STRING = ''
EMPTY_UNICODE = u''
EMPTY_INT = 0
EMPTY_FLOAT = 0.0
class CtaTickData(object):
"""Tick数据"""
# ----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
self.vtS... |
<filename>code/train_qc_baseline.py<gh_stars>0
# header files
import torch
import torch.nn as nn
import torchvision
from torch.nn import CrossEntropyLoss, Dropout, Softmax, Linear, Conv2d, LayerNorm
from torch.nn.modules.utils import _pair
import numpy as np
import skimage
from skimage import io, transform
import glob
... |
<gh_stars>0
from tkinter import *
from tkinter import font
import string
import pygments
class PygmentsText(Text):
"""Class that uses the pygments syntax-based highlighter to color-code text
displayed in a Tk Text widget. Note that this isn't the same as a code
pretty-printer. It just color-codes. It... |
from functools import wraps
from flask import Flask
from flask import render_template, request, redirect, url_for, jsonify
import json
from post import Post
from comment import Comment
from category import Category
from user import User
app = Flask(__name__)
def require_login(func):
@wraps(func)
def wrapper... |
<gh_stars>0
#!/usr/bin/env python
"""
Generalised class: Displays data sources for a class
"""
import os
import sys
import lib_util
import lib_common
try:
import lib_wbem
wbemOk = True
except ImportError:
wbemOk = False
import lib_wmi
from lib_properties import pc
# Now, adds the base classes of this one, at leas... |
<reponame>Pibben/sim74
from unittest import TestCase
from core import Net
from p74xx import P74161, P74181
from system import System
from util import BinaryBus, SystemClock, Injector, BusInjector
class TestP74161(TestCase):
def test_single(self):
part = P74161("test")
outbus = BinaryBus(("QD", "... |
<reponame>0xecho/botogram<filename>botogram/inline.py
# Copyright (c) 2015-2020 The Botogram Authors (see AUTHORS)
#
# 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, inclu... |
# day 6 Numpy Array Function
import numpy as np
import time
from timeit import timeit
np.random.seed(0)
def compute_reciprocals(values):
output = np.empty(len(values))
for i in range(len(values)):
output[i] = 1.0 / values[i]
return output
# time loop
# value1 = np.random.randint(1, 10, size=5)
... |
# This example is designed to check the likelihood calculation under most models
# supported by Phycas. A data set is simulated under the most complex model, and
# analyzed under a spectrum of simpler models. The data set is saved as a nexus file
# complete with PAUP blocks that allow verification of Phycas's likelihoo... |
#!/usr/bin/env python
'''
estimate % tumour from allele frequencies
'''
import argparse
import logging
import sys
import cyvcf2
import numpy as np
import scipy.stats
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def estimate_percentile(values):
'''
ultra simple approach of just tak... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##########################################################################
#
# AutoTST - Automated Transition State Theory
#
# Copyright (c) 2015-2020 <NAME> (<EMAIL>)
# and the AutoTST Team
#
# Permission is hereby granted, free of charge, to any person obtaining a
# ... |
"""
PRONTO
Captura frame da tela, processa imagem, salva imagem em disco e inicia thread para escutar teclado
"""
import numpy as np
import cv2
import mss.tools
import time
from threading import Thread
import os
import shutil
from captura_teclado import CapturaTeclado
class CapturaTela:
"""Inicializa thread para... |
import json
import requests
from bs4 import BeautifulSoup
#Copyright @Huseyin <NAME>, @Deniz <NAME>
#edit term name to accsess
#Put '{}' in json file before running!
term = "201601"
filename = term + ".html"
with open(filename,"r", encoding="utf8") as html_file:
soup = BeautifulSoup(html_file, 'lxml')
... |
<reponame>IPSW1/bytecode
#!/usr/bin/env python3
import io
import sys
import unittest
import contextlib
from bytecode import (
Label,
Compare,
SetLineno,
Instr,
Bytecode,
ConcreteBytecode,
BasicBlock,
ControlFlowGraph,
)
from bytecode.tests import disassemble as _disassemble, TestCase, WO... |
import xml.etree.ElementTree as ET
import collections
class Node_struct:
def __init__(self):
self.nodeId = None
self.browseName = None
self.isAbstract = True
self.parentNodeId = None
self.dataType = None
self.displayName = None
self.description = None
... |
<filename>workbench/executor.py
import urllib
import json
import google.auth.transport.requests
import google.oauth2.id_token
import uuid
import time
from google.cloud import storage
def execute_local_notebook(gcp_project: str,
location: str,
input_notebook_... |
<reponame>donlo/geopandas
from shapely.geometry import Point
from geopandas import read_file, datasets, GeoSeries
# Derive list of valid query predicates based on underlying index backend;
# we have to create a non-empty instance of the index to get these
index = GeoSeries([Point(0, 0)]).sindex
predicates = sorted(p... |
<gh_stars>1-10
import os
import sys
import getopt
import csv
import numpy as np
import zipfile, glob
import cv2,shutil
import h5py as hf
import matplotlib.pyplot as plt
from faceDetector import FaceDetection
from imageExtractor import ImageExtractor
tmp_path = "tmp/";
fpsNew = 2;
cols = 64;
rows = 64;
database = 0;... |
"""Window utilities and related functions.
A window is an instance of Window
Window(column_offset, row_offset, width, height)
or a 2D N-D array indexer in the form of a tuple.
((row_start, row_stop), (col_start, col_stop))
The latter can be evaluated within the context of a given height and
width and a boo... |
# Copyright (c) 2021 The University of Texas at Austin
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of condi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.