content stringlengths 5 1.05M |
|---|
from selenium.webdriver.common.by import By
from pom.base import Base
from time import sleep
class HomePage(Base):
"""
百度首页
"""
# 输入框元组
input_locator = (By.ID, 'kw')
# 按钮元组
btn_locator = (By.ID, 'su')
# 第一条数据
item_locator = (By.XPATH, '//*[@id="1"]/h3/a')
def search(self, text... |
#!/usr/bin/env python
'''XML Namespace Constants'''
class Namespaces():
'''Static data on XML Namespaces'''
ns = {
"media": "http://vectortron.com/xml/media/media",
"movie": "http://vectortron.com/xml/media/movie"
}
@classmethod
def nsf(cls, in_tag):
'''return ... |
from subprocess import Popen, PIPE
import os
import shlex
import sys
import kosh
import hashlib
import numpy
from .wrapper import KoshScriptWrapper # noqa
def compute_fast_sha(uri, n_samples=10):
"""Compute a fast 'almost' unique identifier for a given uri
Assumes the uri is a path to a file, otherwise simpl... |
#!/usr/bin/env python
#
# To start off, we just want to make a map out of tiles.
#
# Simon Heath
# 15/9/2005
import os, pygame
from pygame.locals import *
if not pygame.font: print 'Warning, fonts disabled'
if not pygame.mixer: print 'Warning, sound disabled'
# Test tile image
if pygame.image.get_extended():
IMAG... |
from datetime import timedelta
from hypothesis import settings, Verbosity
settings.register_profile("default",
max_examples=10,
deadline=timedelta(milliseconds=1000),
database=None)
settings.register_profile("ci",
max_examples=10,
deadline=timedelta(milliseconds=10000),
... |
from dtc.enums.message_types import MessageTypes
from lib.base_message_type import BaseMessageType
class AccountBalanceAdjustmentReject(BaseMessageType):
def __init__(self,
request_id=None,
reject_text=None):
self.Type = MessageTypes.ACCOUNT_BALANCE_ADJUSTMENT_REJECT
... |
"""
Copyright 2020 The OneFlow 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 applicable law or agr... |
# coding=utf-8
# Copyright 2016 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 requ... |
""" Admin for channels """
from django.contrib import admin
from moira_lists.models import MoiraList
class MoiraListAdmin(admin.ModelAdmin):
"""Admin for Moira Lists"""
model = MoiraList
search_fields = ("name", "users__email")
readonly_fields = ("users", "name")
def has_change_permission(self,... |
import math
from typing import Tuple
from utils.points import generate_square
import numpy as np
import torch
class PatchesProcessor:
def __init__(self, points_per_side: int, total_patches: int, seed: int = 0xCAFFE) -> None:
self.total_patches = total_patches
self.rng = np.random.RandomState(seed... |
######## Image Object Detection Using Tensorflow-trained Classifier #########
#
# Author: Evan Juras
# Date: 1/15/18
# Description:
# This program uses a TensorFlow-trained neural network to perform object detection.
# It loads the classifier and uses it to perform object detection on an image.
# It draws boxes, scores... |
#%%
# imports
import urllib
from bs4 import BeautifulSoup
from pprint import pprint
import pandas as pd
# %%
# Notes
# The websites that were scraped:
# https://www.eventbrite.com/blog/70-event-ideas-and-formats-to-inspire-your-next-great-event-ds00/
# https://www.updater.com/blog/resident-event-ideas
# %%
# Defini... |
from moodle.base.general import GeneralStatus
class AgreeSitePolicyResponse(GeneralStatus):
"""Agree the site policy for the current user.
Args:
status (int): Status: true only if we set the policyagreed to 1 for the user
warnings (List[Warning]): list of warnings
"""
pass
|
from datetime import timedelta
import os
import jwt
from dotenv import load_dotenv
from rpc.gen.file.download.errors.ttypes import TDownloadError, TDownloadErrorCode
from .general_key import GeneralKeyModel
# MODELS MUST ONLY USE THRIFT ENUM AND EXCEPTIONS
# MODELS MAY NOT USE THRIFT STRUCTS
load_dotenv()
ENC_FILE =... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Created by Mingfei Chen (lasiafly@gmail.com)
# Created On: 2020-2-20
# ------------------------------------------------------------------------------
import cv2
import json
import numpy as np
import os
import os.p... |
# encoding=utf-8
from rest_framework.views import APIView
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import viewsets, mixins
from rest_framework.routers import DefaultRouter
from lepus.models import *
from lepus.internal.serializers import AttackPoi... |
from setuptools import find_packages
from distutils.core import setup, Extension
with open('README.rst') as readme_file:
readme = readme_file.read()
setup(
name='WUDESIM_Py',
version='0.2.3',
description='A model for simulating water quality in the dead-end branches of drinking water distributio... |
class NazwaKlasy:
# pola składowe
a=0
d="ala ma kota"
# metody składowe
def wypisz(self):
print(self.a + self.b)
# warto zauważyć jawny argument
# w postaci obiektu tej klasy
# w C++ także występuje ale nie jest
# jawnie deklarowany, ani nie trzeba
# się nim jawnie posługiwać
# metody statyczna
@stat... |
# -*- coding: utf-8 -*-
# loadlimit/cli.py
# Copyright (C) 2016 authors and contributors (see AUTHORS file)
#
# This module is released under the MIT License.
"""Define CLI"""
# ============================================================================
# Imports
# ===================================================... |
#pthhon3
import mmh3
import requests
import codecs
response = requests.get('https://yoursite path.com/favicon.ico')
favicon = codecs.encode(response.content,"base64")
hash = mmh3.hash(favicon)
print(hash)
|
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import unittest.mock
import pytest
from datahub.ingestion.api.common import PipelineContext
from datahub.ingestion.source.sql.oracle import OracleConfig, OracleSource
def test_oracle_config():
base_config = {
"username": "user",
"password": "password",
"host_port": "host:1521",
}
... |
import os
import pprint
from argparse import ArgumentParser
from subprocess import check_call
from collections import OrderedDict as ODict
from margrie_libs.utils.folder_operations import folders_starting_with
from calcium_recordings.correct_folders import getDepthDirs, setRecNbs
from calcium_recordings.re... |
# Author: Jacob Hallberg
# Last Edited: 12/30/2017
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_HuffmanEncode(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(772, 832)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.ce... |
import json
import os
import time
from itertools import chain
from functools import reduce
import pathlib
import numpy as np
from matplotlib import pyplot
import matplotlib
from keras.callbacks import TensorBoard, ModelCheckpoint
from keras.utils import plot_model
from keras.models import load_model
from keras import... |
from .bit import *
from .inception import *
from .inception_resnet import *
from .mobilenet import *
from .resnet import * |
#!/usr/bin/env python
from setuptools import setup
from Cython.Build import cythonize
setup(
name = 'pogle',
version = '0.1',
author = 'Clement Jacob',
author_email = 'clems71@gmail.com',
description = ('Python OpenGL Engine : a simplistic OpenGL engine for python'),
url='https://github.com/cl... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 24 12:42:27 2020
@author: vxr131730
"""
import pygame
import math
def draw_ellipse(A, B, width, color, line):
"""
draws ellipse between two points
A = start point (x,y)
B = end point (x,y)
width in pixel
color (r,g,b)
lin... |
#!/usr/bin/env python Sample Test passing with nose and pytest
import unittest
import numpy as np
from gcode_gen import point
class TestPoint(unittest.TestCase):
def test_2d(self):
actual = point.Point(1, 2).arr
expect = np.asarray((1, 2, 0))
self.assertTrue(np.allclose(actual, expect), '... |
from __future__ import unicode_literals, division, absolute_import
class TestRegexExtract(object):
config = """
tasks:
test_1:
mock:
- {title: 'The.Event.New.York'}
regex_extract:
prefix: event_
field: title
regex:
... |
# -*- coding: utf-8 -*-
def main():
n, c, k = list(map(int, input().split()))
t = sorted([int(input()) for _ in range(n)])
remain_seats = c - 1
departure_time = t[0] + k
bus_count = 1
# See:
# https://www.youtube.com/watch?v=cJ-WjtA34GQ
for i in range(1, n):
if ... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# This script reuses some code from https://github.com/nlpyang/BertSum
"""
Utility functions for downloading, extracting, and reading the
Swiss dataset at https://drive.switch.ch/index.php/s/YoyW9S8yml7wVhN.
"""
import nltk
# nltk.dow... |
import logging
import yaml
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("grafana-ldap-sync-script")
class config:
def __init__(self):
self.load_config("")
def __init__(self, config_path):
self.load_config(config_path)
GRAFANA_AUTH = ""
GRAFANA_URL = ""
LDA... |
"""
ARCHES - a program developed to inventory and manage immovable cultural heritage.
Copyright (C) 2013 J. Paul Getty Trust and World Monuments Fund
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Founda... |
import numpy as np
import cv2
from pylab import *
from sklearn.svm import SVC
from scipy.ndimage import zoom
from sklearn.externals import joblib
#loading a classifier model
svc_1 = joblib.load('smile.joblib.pkl')
def detect_face(frame):
cascPath = "haarcascade_frontalface_default.xml"
faceCasc... |
import math
from .json_map_data import polys, county_names, refs
from shapely.geometry import Point, Polygon
def get_circle_coord(theta, x_center, y_center, radius):
x = radius * math.cos(theta) + x_center
y = radius * math.sin(theta) + y_center
return [round(x), round(y)]
# This function gets all the p... |
def skyhook_calculator(upper_vel,delta_vel):
Cmax = 4000
Cmin = 300
epsilon = 0.0001
alpha = 0.5
sat_limit = 800
if upper_vel * delta_vel >= 0:
C = (alpha * Cmax * upper_vel + (1 - alpha) * Cmax * upper_vel)/(delta_vel + epsilon)
C = min(C,Cmax)
u = C * del... |
import pytest
from prefect.tasks.sql_server import (
SqlServerExecute,
SqlServerExecuteMany,
SqlServerFetch,
)
class TestSqlServerExecute:
def test_construction(self):
task = SqlServerExecute(db_name="test", user="test", host="test")
assert task.commit is False
def test_query_str... |
"""
| Copyright (C) 2014 Daniel Thiele
| TU Braunschweig, Germany
| All rights reserved.
| See LICENSE file for copyright and license details.
:Authors:
- Daniel Thiele (thiele@ida.ing.tu-bs.de)
Description
-----------
XLS parser example
"""
from pycpa import util
from pycpa import xls_parser
import sys
... |
# coding=utf-8
from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField
from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde
# Generated with OTLEnumerationCreator. To modify: extend, do not edit
class KlLuchtkwaliteitOpstellingMerk(KeuzelijstField):
"""Het merk van een onderdeel u... |
# if you want to train without using the disentanglement_lib infrastructure
# you can train using this file.
# This file's train method is very, very similar to
# jlonevae_lib/train/train_jlonevae_models.py's train method
# This is just an object-oriented version of that more script-based version
# this file's train m... |
import urllib2
import urllib
import json
import pprint
import base64
import pprint
import redis
import os
#from confluent_kafka import Producer
#from hdfs import TokenClient
#from hdfs import InsecureClient
#client = TokenClient('http://node-1.testing:50070/', 'root', root='/user/root/data_trentino')
#client = Insecur... |
import pyautogui
pyautogui.FAILSAFE = True
time1 = 8
time2 = 8
time3 = 8
#go to top right of dock, cook food
pyautogui.PAUSE = time1
pyautogui.click(1828, 119)
pyautogui.click(1707, 614)
pyautogui.click(1643, 615)
pyautogui.click(1833, 933)
pyautogui.click(1050, 530)
pyautogui.press('space')
input("R... |
#
# PySNMP MIB module Wellfleet-SPAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-SPAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:41:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
# -*- coding: utf-8 -*-
"""
Created on Apr 27, 2016
@author: Aaron Ponti
"""
class GlobalSettings(object):
'''
Store global settings to be used in the dropbox.
'''
# Image resolutions to be used to generate the images ("thumbnails") that
# are displayed in the image viewer. Examples:
#
... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft and contributors. 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 ... |
"""
Inspired by EnsembleStrategy from https://github.com/joaorafaelm/freqtrade-heroku/
Created by https://github.com/raph92/
"""
from __future__ import annotations
import concurrent
import logging
import sys
import time
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
from pathlib import ... |
"""Structures that transport call parameters and input data.
Requests are objects created from incoming calls, thus they shall deal with
things like incorrect values, missing parameters, wrong formats, etc. and
transport data from outside the application into the interactors layer.
"""
from typing import Dict, Optiona... |
"""
Django settings for belajar_online project.
Generated by 'django-admin startproject' using Django 3.0.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
impor... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... |
import operator
import unittest
import os
from securitytxt.securitytxt import SecurityTXT
class TestFromFile(unittest.TestCase):
def test_from_file(self):
files_dir = f"{os.path.dirname(os.path.realpath(__file__))}/files/"
folders = next(os.walk(files_dir))[1]
for folder in folders:
... |
from tethys_sdk.base import TethysAppBase, url_map_maker
from tethys_sdk.app_settings import CustomSetting, PersistentStoreDatabaseSetting
class HydroshareTimeseriesManager(TethysAppBase):
"""
Tethys app class for HydroShare Time Series Manager.
"""
name = 'HydroShare Time Series Manager'
index =... |
from django.core.mail import EmailMessage, SMTPConnection
from django.http import HttpResponse
from django.shortcuts import render_to_response
def no_template_view(request):
"A simple view that expects a GET request, and returns a rendered template"
return HttpResponse("No template used")
|
"""
The Cibin package.
"""
__version__ = "0.0.1"
from .cibin import *
|
import torch.nn as nn
from torchvision.models import resnet34, resnet18, resnet50 , resnet101, resnet152
from base import BaseModel
class ResNet152(BaseModel):
def __init__(self, num_classes=196, use_pretrained=True):
super(BaseModel, self).__init__()
self.model = resnet152(pretrained=use_pretrai... |
from zeroconf import ServiceBrowser, ServiceListener, Zeroconf
import socket
"""
Class for mDNS. Will search for services on local network and once found each service
"""
class mDNS():
"""
Searches for service by type and name on local network, within default 3 second timeout
returns ipv4 address... |
import argparse
import datetime
import os
import time
import paddle
import paddle.distributed as dist
import json
from pathlib import Path
from engine import train_one_epoch, evaluate
import utils
from dataset import CycleMLPdataset, build_transfrom
from losses import DistillationLoss, SoftTargetCrossEntro... |
from django.conf import settings
settings.MIDDLEWARE += (
'djangosessionnotifier.middleware.NotifierMiddleware',
)
|
from PIL import ImageGrab
import win32gui
import sys
import cv2 as cv
import numpy as np
def list_window_names():
# get list of running apps
top_list, win_list = [], []
def enum_cb(hwnd, results):
win_list.append((hwnd, win32gui.GetWindowText(hwnd)))
win32gui.EnumWindows(enum_c... |
#!/usr/bin/env python3
"""
A simple script that fixes up post-pnr verilog and SDF files from VPR:
- Removes incorrect constants "1'b0" connected to unconnected cell port,
- Disconnects all unconnected outputs from the "DummyOut" net,
- appends a correct prefix for each occurrence of a binary string in round
b... |
import os.path, gzip
from whoosh import analysis, fields
from whoosh.support.bench import Bench, Spec
class VulgarTongue(Spec):
name = "dictionary"
filename = "dcvgr10.txt.gz"
headline_field = "head"
def documents(self):
path = os.path.join(self.options.dir, self.filename)
f = gz... |
# encoding: latin2
"""global inequality change test
"""
__author__ = "Juan C. Duque, Alejandro Betancourt"
__credits__ = "Copyright (c) 2009-11 Juan C. Duque"
__license__ = "New BSD License"
__version__ = "1.0.0"
__maintainer__ = "RiSE Group"
__email__ = "contacto@rise-group.org"
__all__ = ['inequalityDynamic']
from ... |
def solveQuestion(stepSize, insertCount):
currentPos = 0
buffer = [0]
for i in range(1, insertCount + 1):
currentIndexJump = currentPos + stepSize
currentIndexActual = (currentIndexJump % len(buffer)) + 1
buffer.insert(currentIndexActual, i)
currentPos = currentIndexAct... |
# coding:utf-8
import MySQLdb
class MysqlHelper:
def __init__(self,host='localhost',port=3306,db='meizi',user='root',passwd='123456',charset='utf8'):
self.conn = MySQLdb.connect(host=host, port=port, db=db, user=user, passwd=passwd, charset=charset)
def insert(self,sql,params):
return self... |
from spinup import trpo_tf1 as trpo
import tensorflow as tf
import gym
env_fn = lambda : gym.make('Ant-v2')
ac_kwargs = dict(hidden_sizes=[64,64], activation=tf.nn.relu)
logger_kwargs = dict(output_dir='../data/trpo/bant_4000_750', exp_name='ant_trpo')
trpo(env_fn=env_fn, ac_kwargs=ac_kwargs, steps_per_epoch=4000, ... |
import torch
from torch import nn
from ...config import prepare_config
from collections import OrderedDict
from .resnet_fpn_extractor import ResnetFPNExtractor
from .predictor import BaselinePredictor
from .postprocessor import LocMaxNMSPostprocessor
EXTRACTORS = {
"resnet_fpn": ResnetFPNExtractor,
}
P... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 1 08:32:09 2020
@author: ayjab
"""
import torch
import time
import numpy as np
from lib import my_models,fast_wrappers
env_name = 'PongNoFrameskip-v4'
env = fast_wrappers.make_atari(env_name,skip_noop=True, skip_maxskip=True)
env = fast_wrappers.wrap_deepmind(env, py... |
#!/usr/bin/python
# everscan/everscan.py
from modules.scanning import ScanningManager
from modules.evernote import EvernoteManager
from modules.interface import InterfaceManager
from modules.imaging import ImagingManager
class EverscanMaster:
"""
Everscan master class.
Facilitates communicati... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
def display(d):
print('#0', end='')
for y in range(4):
print('01', end='')
for x in range(8):
print('%02x' % d, end='')
print('')
def brightness(b):
print('#0', end='')
for y... |
import json
import re
from gendocs import DEPRECATED_INFO_FILE, DeprecatedInfo, INTEGRATION_DOCS_MATCH, findfiles, process_readme_doc, \
index_doc_infos, DocInfo, gen_html_doc, process_release_doc, process_extra_readme_doc, \
INTEGRATIONS_PREFIX, get_deprecated_data, insert_approved_tags_and_usecases, \
fi... |
"""Settings and configuration
"""
import os
from copy import deepcopy
import yaml
HOME = os.path.expanduser('~')
"""Full path to your home directory."""
BASE = f"{HOME}/github"
"""Local directory where all your local clones of GitHub repositories are stored."""
ORG = "among"
"""Organization on GitHub in which this ... |
from .algorithm1 import Algorithm
from .cp_ortools import CPModel1
from .Milp1 import Milp1
from .Iterator1 import Iterator1
solvers = \
dict(default=Algorithm,
Milp_LP_HL = Milp1,
ortools=CPModel1,
Iterator_HL = Iterator1
)
# factory of solvers
def get_solver(name='default'):
re... |
import sys
import os
from pathlib import Path
cwd = str(os.getcwd())
parent_dir = str(Path(os.getcwd()).parent)
sys.path.append(f'{parent_dir}/short_text_tagger/') # if testing from within tests/
sys.path.append(f'{cwd}/short_text_tagger/') # if testing from parent directory
from short_text_tagger.edgelist import Ed... |
import bob.bio.base
preprocessor = bob.bio.base.preprocessor.Filename()
|
# -*- coding:UTF-8 -*-
import json
class Vin:
'解析所有汽车公司的VIN码,参数:VIN规则json文件和vin码;返回解析结果。'
__content = None # json文件内容dict类型变量
def __init__(self, filename, vin):
self.filename = filename
self.vin = vin
try:
fo = open(filename, 'r')
self.__content... |
import torch
import matplotlib.pyplot as plt
def show_frame(frame: torch.tensor):
fig = plt.figure(figsize = (16,12)) # create a 5 x 5 figure
ax = fig.add_subplot(111)
ax.imshow(frame.numpy(), interpolation='bicubic')
def show_frames(frames: torch.tensor, nrows=10, ncols=10, figsize=(20,16)):
fi... |
# Generated by Django 3.1.5 on 2021-03-16 14:02
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
("currencies", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="currency",
... |
from datetime import datetime, timedelta
from django.test import TestCase
from freezegun import freeze_time
from tests.models import TimeStamp, TimeStampWithStatusModel
class TimeStampedModelTests(TestCase):
def test_created(self):
with freeze_time(datetime(2016, 1, 1)):
t1 = TimeStamp.objec... |
# A solution to the British Informatics Olympiad 2012 Question 1
# Scores 24/24 Marks
from math import sqrt
n = int(input())
a = int(sqrt(n))
numbers = set(range(2, a))
primes = set()
while numbers:
curr = min(numbers)
primes.add(curr)
numbers.discard(curr)
for i in range(curr*2, a, curr):
n... |
from setuptools import setup, find_packages
setup(
name='openassetio',
version="0.0.0",
package_dir={'': 'python'},
packages=find_packages(where='python'),
python_requires='>=3.7',
)
|
"""
The best way to open and close the file automatically is the with(type)
"""
with open('with.text','r') as f:
a=f.read()
# with open('with.text','w') as f:
with open('with.text','a') as f:
a=f.write('\nthis is write')
print(a)
|
import math
import weakref
import inspect
import arrow
import numpy as np
from numbers import Number
from collections.abc import Sequence, Mapping
from intervalpy import Interval
from .const import GOLD
from . import util
MIN_STEP = 1e-5
# TODO: Implement Duration and use its next ad previous methods
# Or make a supe... |
/home/runner/.cache/pip/pool/71/fb/dc/ddd9d4c4d76c4a0959ece9968a38e3b0429b9b6157ec9afb70da86d584 |
"""mhc_dashboard URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class... |
name='gMLPhase'
# from .gMLP_utils import *
from .gMLP_torch import *
from .trainer import trainer
from .tester import tester
# from .tester import tester
# from .predictor import predictor
# from .mseed_predictor import mseed_predictor
|
from tempfile import TemporaryDirectory
from finntk.utils import ResourceMan, urlretrieve
import os
# If we don't ensure this, we might end up with a relative path for LEMMA_FILENAME
os.makedirs(os.path.expanduser("~/.conceptnet5"), exist_ok=True)
from conceptnet5.language.lemmatize import LEMMA_FILENAME # noqa
cla... |
# -*- coding: utf-8 -*-
"""HDF5 Dataset Generators
The generator class is responsible for yielding batches of images and labels from our HDF5 database.
Attributes:
dataset_path (str):
Path to the HDF5 database that stores our images and corresponding class labels.
batch_size (int):
Size of min... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn import neighbors, datasets
k = 15 # Number of neighbors
h = .02 # step size in the mesh
# Create color maps
cmap_light = ListedColormap(['#FFAAAA', '#AAFFAA', '#AAAAFF'])
cmap_bold = ListedColormap(['#FF00... |
__all__ = ["cli", "sf2heat"] |
# following PEP 386
__version__ = "0.6.7"
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Seismic phase picking on continuous data
Input: SAC
Output: SAC
@author: wuyu
"""
import os
import logging
import numpy as np
import tensorflow as tf
from glob import glob
from obspy import read
from ARRU_tools.multitask_build_model import unets
from ARRU_tools.data_... |
from .shadow import Shadow
__all__ = ["Shadow"]
|
# Generated from Dynabuffers.g4 by ANTLR 4.7
from antlr4 import *
if __name__ is not None and "." in __name__:
from .DynabuffersParser import DynabuffersParser
else:
from DynabuffersParser import DynabuffersParser
# This class defines a complete generic visitor for a parse tree produced by DynabuffersParser.
... |
class Track:
_counter = 0
def __init__(self, name, path):
self._name = name
self._path = path
Track._counter += 1
def get_name(self):
return self._name
def get_path(self):
return self._path
@staticmethod
def get_counter():
return Track._counter... |
# coding: utf-8
"""
ELEMENTS API
The version of the OpenAPI document: 2
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from elements_sdk.configuration import Configuration
class TimelineExportRequest(object):
"""NOTE: This class is auto generate... |
import os
import unittest
from sakuyaclient.NotificationCentre import NotificationCentre
class NotificationCentreTest(unittest.TestCase):
def setUp(self):
self._notifications = NotificationCentre(300)
def test_poll(self):
results = self._notifications.poll()
self.assertIsNotNone(res... |
import responses
import pytest
from urllib.parse import urlencode
from tests.util import random_str
from tests.util import mock_http_response
from binance.spot import Spot as Client
from binance.error import ParameterRequiredError
mock_item = {"key_1": "value_1", "key_2": "value_2"}
key = random_str()
secret = rando... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import collections
import json
import os
import time
from functools import wraps
import flask
from flask import (Flask, request, render_template, json as flask_json,
redirect, session, url_for)
from launchpadlib.credentials import Crede... |
#!/usr/bin/env python3
import uavcan, time
# Waiting until new nodes stop appearing online.
# That would mean that all nodes that are connected to the bus are now online and ready to work.
def wait_for_all_nodes_to_become_online():
num_nodes = 0
while True:
node.spin(timeout=10)
new_num_nodes... |
#################################################################
# #
# Wilfred #
# Copyright (C) 2020-2021, Vilhelm Prytz, <vilhelm@prytznet.se> #
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.