text stringlengths 1 927k |
|---|
# Create a figure and an array of axes: 2 rows, 1 column with shared y axis
fig, ax = plt.subplots(2, 1, sharey=True)
# Plot Seattle precipitation data in the top axes
ax[0].plot(seattle_weather["MONTH"], seattle_weather["MLY-PRCP-NORMAL"], color = "b")
ax[0].plot(seattle_weather["MONTH"], seattle_weather["MLY-PRCP-25... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE.txt file in the root directory of this source tree.
from itertools import product
from unittest import TestCase, main
from torchbiggraph... |
#------------------ Gaussian pulse propagation in a homogeneous medium terminated with Absorbing Boundary Condition (ABC)
import numpy as np
import matplotlib.pyplot as plt
#----- Medium ----------
length = 2
eps0 = 8.854e-12
meu0 = 4*np.pi*1e-7
epsr = 1
meur = 1
eps = eps0*epsr
meu = meu0*meur
#---- Signa... |
from django.urls import path
from . import views
urlpatterns = [
path("", views.index, name="home"),
path("register", views.register_view, name="register"),
path("login", views.login_view, name="login"),
path("logout", views.logout_view, name="logout"),
path("error_report", views.error_view, name="error"),
... |
import os
template_dir = os.path.dirname(__file__)
template_fn = 'multiqc_report.html' |
import re
def quote_ifstr(s):
return f"'{s}'" if isinstance(s, str) else s
def make_str_valid_varname(s):
# remove invalid characters (except spaces in-between)
s = re.sub(r"[^0-9a-zA-Z_\s]", " ", s).strip()
# replace spaces by underscores (instead of dropping spaces) for readability
s = re.sub... |
################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... |
"""
WSGI config for Rest_API_Beginner project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJ... |
"""__init__
License: BSD 3-Clause License
Copyright (C) 2018-2019, New York University , Max Planck Gesellschaft
Copyright note valid unless otherwise stated in individual files.
All rights reserved.
""" |
from .proc_table import procedures
#from .driver import *
from .energy import energy, properties
from .gradient import gradient
from .hessian import hessian, frequency
from .optimize import optking, geometric
#from .cbs_helpers import *
#from .yaml import yaml_run
#from .driver_helpers import * |
# vFabric Administration Server API
# Copyright (c) 2012 VMware, Inc. 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
#
# https://www.apache.org/licenses/LICENSE-2.0... |
#
#
# 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 n... |
# Copyright 2015 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 applica... |
import subprocess
def decrypt(message, key):
return subprocess.check_output(['./application.out', message, key, "1"]).decode('utf8').strip()
def encrypt(message, key):
return subprocess.check_output(['./application.out', message, key, "0"]).decode('utf8').strip()
if __name__ == '__main__':
original_msg =... |
# Native
import os
from math import *
from cmath import *
from time import time
# Installed
import cv2 as cv
# Custom Modules
from assets.utils import float_range
from JuliaSet.core import JuliaSet
class Animation:
def __init__(self, range_from: float or int, range_to: float or int, range_step: float, frames_fo... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
#!/usr/bin/env python
#
# 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 o... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... |
from cms import models
def test_create_no_media(db):
"""
Test creating an info panel.
"""
models.InfoPanel.objects.create(
text="The quick brown fox jumped over the lazy dog.", title="No Media"
)
def test_ordering(info_panel_factory):
"""
Panels should be ordered by their ``order... |
# Author: Jochen Gast <jochen.gast@visinf.tu-darmstadt.de>
import torch
import torch.nn as nn
from losses import factory
class ClassificationLoss(nn.Module):
def __init__(self, args, topk=(1, 2, 3), reduction='mean'):
super().__init__()
self.args = args
self.cross_entropy = torch.nn.Cros... |
class BaseHandler:
def send(self, data, p):
pass
def recv(self, data, p):
pass
def shutdown(self, p, direction=2):
pass
def close(self):
pass |
"""Solvers of systems of polynomial equations."""
import collections
from ..core import expand_mul
from ..domains import EX
from ..matrices import Matrix
from ..polys import (ComputationFailed, PolificationFailed, groebner,
parallel_poly_from_expr)
from ..polys.solvers import solve_lin_sys
from .... |
import asyncio
import json
import logging
from aiohttp.web_response import Response
from pybot.plugins.api.request import FailedVerification, SlackApiRequest
logger = logging.getLogger(__name__)
async def slack_api(request):
api_plugin = request.app.plugins["api"]
try:
slack_request = SlackApiRequ... |
import logging
from werkzeug.exceptions import BadRequest, NotFound
from flask import Blueprint, redirect, send_file, request
from apikit import jsonify, Pager, request_data
from aleph.core import archive, url_for, db
from aleph.model import Document, DocumentRecord, Entity, Reference
from aleph.logic import update_do... |
from django.urls import include, path
from . import views
urlpatterns = [
path('', views.index),
path('custom/', views.custom),
path('contact/', include('contactform.urls')),
] |
"""
Django settings for onlineCAL project.
Generated by 'django-admin startproject' using Django 2.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
... |
import ast
import re
from compiler.static import StaticCodeGenerator
from compiler.static.compiler import Compiler
from compiler.static.module_table import ModuleTable
from textwrap import dedent
from .common import StaticTestBase, bad_ret_type
class DeclarationVisitorTests(StaticTestBase):
def test_cross_module... |
import pyttsx3
import datetime
import time as t
import smtplib
import wikipedia
import webbrowser as wb
import os
import string
import wolframalpha
import pyautogui
import psutil
import pyjokes
import random
from colored import fg, attr
import speech_recognition as sr
print(f"""{fg(226)}{attr(1)}
... |
#!/usr/bin/python
#
# Copyright (c) 2015, Arista Networks, Inc.
# 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,
# t... |
import cv2
from pupil_labs.realtime_api.simple import discover_one_device
def main():
# Look for devices. Returns as soon as it has found the first device.
print("Looking for the next best device...")
device = discover_one_device(max_search_duration_seconds=10)
if device is None:
print("No de... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-02 19:03
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... |
# Generated by Django 2.2.5 on 2019-10-01 11:02
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('openbook_posts', '0062_merge_20190920_1428'),
]
operations = [
migrations.AlterField(
model_nam... |
import pytest
import numpy as np
import yaml
from mlagents.trainers.ghost.trainer import GhostTrainer
from mlagents.trainers.ghost.controller import GhostController
from mlagents.trainers.behavior_id_utils import BehaviorIdentifiers
from mlagents.trainers.ppo.trainer import PPOTrainer
from mlagents.trainers.brain im... |
#!/usr/bin/env pytest
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test GDALOverviewDataset
# Author: Even Rouault <even dot rouault at spatialys.com>
#
#####################################################... |
# Copyright © 2019 Province of British Columbia
#
# 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... |
import os
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'docs.db'
SECRET_KEY = 'HASJFDYWQ98r6y2hesakjfhakjfy87eyr1hakjwfa'
CACHE_BACKEND = 'locmem://'
LOCAL_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))
ADMINS = [
('Example Admin', 'admin@example.com'),
] |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... |
# This file is adapted from https://github.com/tensorflow/tensorflow/blob/master
# /tensorflow/python/framework/graph_util_impl.py
#
# Copyright 2015 The TensorFlow Authors, 2019 Analytics Zoo Authors.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file... |
#coding:utf-8
#
# id: bugs.core_2729
# title: Current connection may be used by EXECUTE STATEMENT instead of creation of new attachment
# decription:
# Checked on:
# 4.0.0.1635 SS: 1.326s.
# 4.0.0.1633 CS: 1.725s.
# ... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/booster/shared_bst_incom_intimidator_mk2.iff"
resul... |
"""
Django settings for users project.
Generated by 'django-admin startproject' using Django 1.8.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths ... |
#!/usr/bin/env python
__author__ = 'Sergei F. Kliver'
import sys
import argparse
from RouToolPa.Routines import TreeFamRoutines
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--fam_file", action="store", dest="fam_file", required=True,
help="File with families")
parser.add_argumen... |
"""
Django settings for yatube project.
Generated by 'django-admin startproject' using Django 2.2.19.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
#... |
from django.shortcuts import render
from django.views.generic import TemplateView
from django.utils.translation import ugettext as _
from django.core.mail import send_mail
from django.contrib import messages
from django.conf import settings
import json
from product_app.models import Book
from .utils import get_new_cart... |
"""
Definitions of tasks executed by Celery
"""
import logging
from web_app.extensions import celery
from web_app.extensions import db
from web_app.models.example_table import ExampleTable
from web_app.scheduled_tasks.scheduled_task import example_scheduled_task
@celery.task(name="healthcheck_task")
def healthcheck... |
from __future__ import with_statement
from layout import Layout
from uliweb.core import uaml
from uliweb.core.html import Tag, begin_tag, end_tag, u_str
class FormWriter(uaml.Writer):
field_classes = {
('Text', 'Password', 'TextArea'):'type-text',
('Button', 'Submit', 'Reset'):'type-button',
... |
import os
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import cv2
import tensorflow as tf
from PIL import Image
def image_to_ndarray(image_path: str) -> np.ndarray:
"""
Args:
image_path: 图片文件路径
"""
pass
def read_image(image_path: str):
"""
读取图片
... |
# Checking if two words are anagrams or not
# or without having to import anything
def is_anagram(str1, str2):
return sorted(str1) == sorted(str2)
print(is_anagram('geek', 'eegk'))
print(is_anagram('geek', 'peek')) |
import unittest
def reverse(str) -> str:
if len(str) < 2:
return str
else:
result = ''
for character in reversed(str):
result += character
return result
class TestReverse(unittest.TestCase):
def setUp(self):
pass
def test_string(self):
... |
x = 1
y = 1
result = x + y
print(result) |
# Copyright 2022 highstreet technologies GmbH
#
# 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 agree... |
from django import forms
from django.contrib import admin
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy as _l
from qatrack.notifications import models
from qatrack.qatrack_core.admin import BaseQATrackAdmin
class ServiceEventSchedulingNoticeAdminForm(forms.ModelF... |
# Copyright 2018-2021 Xanadu Quantum Technologies 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... |
"""
Get the highest value from an iterable
--------------------------------------
Input: iterable
Return: highest value
"""
numbers = [6, 5, 2, -1, 0, 1, 2, 3, 4, 5]
print('list: {}\n max: {}'.format(numbers, max(numbers)))
floats = [6.0, 5.1, 2.0, -1.0, 0.5, 1.9, 2.8, 3.4, 4.6, 5.1]
print('\nlist: {}\n max... |
# this file define all constant used in the project
# visualization.py
NODE_COLOR_SCHEME = "dark28"
EDGE_COLOR_SCHEME = "paired12" |
# ***** BEGIN GPL LICENSE BLOCK *****
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distribute... |
#!/usr/bin/env python3.4
import os
import sys
from subprocess import call
from flask_script import Manager
from flask_migrate import MigrateCommand
from config import config
from app import app_factory, db
app = app_factory('development') # TODO implement env variables
manager = Manager(app)
# The migrate comand
m... |
# by Kami Bigdely
# Replace nested conditional with guard clauses
def extract_position(line):
if line is not None and "x:" in line:
start_index = line.find("x:") + 2
pos = line[start_index:] # from start_index to the end.
else:
pos = None
return pos
if __name__ == "__main__":
... |
# -*- coding: utf-8 -*-
"""
This file is designed to be imported and ran only via setup.py, hence it's
dependency on astropy_helpers which will be available in that context.
"""
import os
import copy
from astropy_helpers.commands.test import AstropyTest
class SunPyTest(AstropyTest):
description = 'Run the tests ... |
from pathlib import Path
import snowflake.connector as sf
from snowflake.connector.cursor import SnowflakeCursor
from prefect import Task
from prefect.utilities.tasks import defaults_from_attrs
class SnowflakeQuery(Task):
"""
Task for executing a query against a Snowflake database.
Args:
- accou... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.15.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bu... |
#!/usr/bin/env python
"""
Copyright 2015 SmartBear Software
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 ap... |
"""
Provide a base class for cluster objects in CogAlg.
Features:
- Unique instance ids per class.
- Instances are retrievable by ids via class.
- Reduced memory usage compared to using dict.
- Methods generated via string templates so overheads caused by
differences in interfaces are mostly eliminated.
- Can be extend... |
import time
from unittest import mock
import pytest
from pyramid import testing
from kinto.core.cache import heartbeat
from kinto.core.storage import exceptions
class CacheTest:
backend = None
settings = {}
def setUp(self):
super().setUp()
self.cache = self.backend.load_from_config(self... |
# 참고자료
# 모두를 위한 머신러닝/딥러닝 강의
# 홍콩과기대 김성훈
# http://hunkim.github.io/ml
import tensorflow as tf
import matplotlib.pyplot as plt
x_data = [1., 2., 3.]
y_data = [1., 2., 3.]
W = tf.Variable(tf.random_uniform([1], -10.0, 10.0))
X = tf.placeholder(tf.float32)
Y = tf.placeholder(tf.float32)
hypothesis = W * X
cost = tf.... |
from collections import deque
'''
BFS time complexity : O(|E| + |V|)
BFS space complexity : O(|E| + |V|)
do BFS from (0,0) of the grid and get the minimum number of steps needed to get to the lower right column
only step on the columns whose value is 1
if there is no path, it returns -1
Ex 1)
If grid is
[[1,0,1,1,... |
import os
import lmctl.files as files
import yaml
import lmctl.utils.descriptors as descriptor_utils
import lmctl.project.source.config as project_configs
import lmctl.project.journal as project_journal
import lmctl.project.processes.validation as validation_exec
import lmctl.project.processes.staging as stage_exec
imp... |
# Copyright 2020 Unibg Seclab (https://seclab.unibg.it)
#
# 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 l... |
#!/usr/bin/python3
from US_Model import SEIRD
import re
import json
DATASETS_DIR = "./Datasets/US"
PREDICTIONS_DIR = "./Predictions/US"
INSIGHTS_DIR = "./Insights/US"
usStatesPopulationFile = "./US-population.json"
usStatesPopulation = json.load(open(usStatesPopulationFile))
stateToHeatFactorsMap = dict()
usHeatFact... |
from .from_cycle1 import b
a = 1 |
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 27 12:51:00 2022
@author: Zoletnik
"""
import numpy as np
def apdcam10g_channel_map(camera_type=None,camera_version=1):
"""
Returns a 2D matrix with the ADC channel numbers as one looks onto the detector.
Parameters
----------
camera_type : string
... |
# -*- coding: utf-8 -*-
__version__ = "0.3.0"
__bibtex__ = """
@article{celerite,
author = {{Foreman-Mackey}, D. and {Agol}, E. and {Angus}, R. and
{Ambikasaran}, S.},
title = {Fast and scalable Gaussian process modeling
with applications to astronomical time series},
year = ... |
"""
neupre
Usage:
neupre staticmlp [--onestep --multistep --onestep96] [-f FILE]
neupre staticrecurrent [--onestep --multistep --onestep96] [-f FILE]
neupre onlinemlp --simsteps=<steps> [--buffsize=<days>] [-f FILE]
neupre onlinerecurrent --simsteps=<steps> [--buffsize=<days>] [-f FILE]
neupre -h | --help
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 1 16:23:55 2020
@author: dmattox
"""
import os
import dill
import lec_gly as LecGly
from bSiteResiFeatures import plipFile
os.chdir(LecGly.homeDir)
##########################
outDir = './data/structures/bsites/batchLists/'
if not os.path.exists... |
# Copyright 2020 Dirk Klimpel
#
# 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,... |
from typing import cast, IO, Tuple, List, Any, Union
from threading import Thread
import shlex
import subprocess as sp
import reckon.reckon_types as t
import reckon.client_runner as cr
def spawn(command: List[str]) -> Tuple[t.Client, sp.Popen[bytes]]:
p = sp.Popen(command, stdin=sp.PIPE, stdout=sp.PIPE, stderr=... |
from flask import request, make_response, jsonify
from flask_restful import Resource
from api.interfaces.production.version1 import API as APIv1
from api.domain import production_api_operations, default_error_message
espa = APIv1()
def whitelist(func):
"""
Provide a decorator to enact a white filter on an e... |
# 6.00x Problem Set 6
#
# Part 2 - RECURSION
#
# Problem 3: Recursive String Reversal
#
def reverseString(aStr):
"""
Given a string, recursively returns a reversed copy of the string.
For example, if the string is 'abc', the function returns 'cba'.
The only string operations you are allowed to use are ... |
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import parse_qs, urlparse
# 1. 코드를 보낸다
# 2. 코드를 읽는다
# 3. 분리한다
PORT = 8080
class Handler(BaseHTTPRequestHandler):
# do_GET과 do_POST라는 이름은 바꾸면 안되며 고정이다
# 과제
# do_GET : 검색창 만들기
# do_POST : 검색 결과 보여주기 - 네이버에서 크롤링
def do_GE... |
"""
Evaluation of predictions againsts given dataset (in TXT format the same as training).
We expect that the predictions are in single folder and image names in dataset are the same
python evaluate.py \
--path_dataset ../model_data/VOC_2007_train.txt \
--path_results ../results \
--confide... |
import root_pandas
import basf2_mva
import b2luigi
import pandas as pd
from sklearn.model_selection import train_test_split
def split_sample(
ntuple_file,
train_size,
test_size,
random_seed=42):
"""Split rootfile and return dataframes. Select 0th candidate."""
df = root_pandas.... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ModifyDialogUI.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCor... |
# 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 (t... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
class MapaDeObrasPipeline:
def process_item(self, item, spider):
return item |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 5 1:28pm 2019
Script to automate getting pulsation candidates of a certain frequency range,
and reporting other germane information?
"""
from __future__ import division, print_function
import numpy as np
from scipy import stats, signal
from tqdm imp... |
import pygame, sys, random
WIDTH = 720
HEIGHT = 400
pygame.init()
win = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('Insertion Sort')
clock = pygame.time.Clock()
# Bar Width
n = 4
w = int(WIDTH/n)
h_arr = []
def maps(num, in_min, in_max, out_min, out_max):
return (num - in_min) * (out_m... |
"""
Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key.
The right subtree of a node contains only nodes with keys greater than the node's key.
Both the left and right subtrees m... |
# -*- coding: utf-8 -*-
"""20Newsgroups Data Source.
This is a data source example known from the Scikit-learn API:
https://scikit-learn.org/stable/datasets/index.html#the-20-newsgroups-text-dataset
The 20 newsgroups dataset comprises around 18000 newsgroups posts on 20 topics
split in two subsets: one for training (... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
# $Id: ogr2vrt.py a47364611c193ff14f084bade64d37c7e1443d3b 2020-05-30 17:04:38 +0200 Even Rouault $
#
# Project: OGR Python samples
# Purpose: Create OGR VRT from source datasource
# Author: ... |
import rules
@rules.predicate
def is_project_member(user, project):
return user in project.member
@rules.predicate
def is_project_owner(user, project):
return user in project.owners
@rules.predicate
def is_project_manager(user, project):
return user in project.managers
@rules.predicate
def is_projec... |
from ctypes import Structure, POINTER, c_int, c_char_p, c_void_p, c_float, \
c_double
from .dll import _bind
from .stdinc import Uint8, Uint32, SDL_bool
from .blendmode import SDL_BlendMode
from .rect import SDL_Point, SDL_FPoint, SDL_Rect, SDL_FRect
from .surface import SDL_Surface
from .video import SDL_Window
_... |
""" Deep Q-Learning policy evaluation and improvement
"""
import torch
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
from termcolor import colored as clr
class DQNPolicyImprovement(object):
""" Deep Q-Learning training method. """
def __init__(self, policy, ... |
# Author: Arturs Laizans
import socket
import ssl
import hashlib
import binascii
from .verbose import Log
# Constants - Define defaults
PORT = 8728
SSL_PORT = 8729
USER = 'admin'
PASSWORD = ''
USE_SSL = False
VERBOSE = False # Whether to print API conversation width the router. Useful for debugging
VERBOSE_LOGIC ... |
#-------------------------------------#
# 对单张图片进行预测
#-------------------------------------#
from efficientdet import EfficientDet
from PIL import Image
efficientdet = EfficientDet('./logs/Epoch29-Total_Loss0.7971-Val_Loss0.7432.pth')
while True:
img = input('Input image filename:')
try:
image = ... |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse('user:create')
# TOKEN_URL = reverse('user:token')
ME_URL = reverse('user:me')
def create_user(**param... |
# Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import pandas as pd
import glob
import re
df = []
for file in glob.glob("../output/producto2/*.csv"):
date = re.search("\d{4}-\d{2}-\d{2}", file).group(0).replace("-", "/")
fragment = pd.read_csv(file)
fragment["Fecha"] = date
df.append(fragment)
df = pd.concat(df)
# Reemplaza nombres de comuna, para... |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
incident = demisto.incidents()[0]
accountName = incident.get('account')
accountName = f"acc_{accountName}/" if accountName != "" else ""
stats = demisto.executeCommand(
"demisto-api-post",
{
"uri": f"{accountNam... |
from models import User
user = User(name='jack')
if user in User:
print 'Some one in table is named jack' |
#!/usr/bin/env python
#
# Public Domain 2014-2016 MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.