text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
from pyswmm import Simulation, Subcatchments
with Simulation('swmm_example.inp') as sim:
S1 = Subcatchments(sim)["S1"]
for step in sim:
print(sim.current_time)
print(S1.runoff)
|
#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE 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-... |
"""
Common helper functions for working with the Microsoft tool chain.
"""
#
# __COPYRIGHT__
#
# 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 limitat... |
# Copyright (c) 2021, NakaMetPy Develoers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# Original source lisence:
# Copyright (c) 2008,2015,2016,2018 MetPy Developers.
#
# kinematics
g0 = 9.81 # 重力加速度 m/s**2
g = g0
g_acceralation = g0 # 重力加速度 m/s**2
Re = 6371.2... |
#
#
# 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 th... |
"""boards URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/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-based ... |
from rlpyt.utils.collections import AttrDict
# Readable-to-less-readable abbreviations.
N_GPU = "gpu"
CONTEXTS_PER_GPU = "cxg" # CUDA contexts.
GPU_PER_RUN = "gpr"
N_CPU_CORE = "cpu"
HYPERTHREAD_OFFSET = "hto" # Can specify if different from n_cpu_core.
N_SOCKET = "skt"
RUN_SLOT = "slt"
CPU_PER_WORKER = "cpw"
CPU_PE... |
from jsonrpc import ServiceProxy
import sys
import string
import getpass
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:41113")
... |
from old.vl8.function.bound_function import BoundFunction
import unittest
class TestBoundFunction(unittest.TestCase):
def test_a_simple_function(self):
f = BoundFunction(
'test.old.function.test_function.simp(required: true)'
)
assert f.missing == set()
assert tuple(f('... |
import pytest
def test_success():
with open('submit.txt') as fin:
d = fin.read()
assert d == ''
|
from ilabs.client import ilabs_api, ilabs_datavault_api
import time
import json
import logging
import uuid
def noop(*av, **kav): pass
class ILabsDatavaultPredictor(ilabs_api.ILabsApi):
@classmethod
def init(cls, domain, collection, input_facet='input', output_facet='output', user_key=None, datavault_key=Non... |
#!/usr/bin/env python
from __future__ import print_function
from mpi4py import MPI
import numpy
import common
def bcast(comm):
n = 8192
print_mpi = common.create_print_mpi(comm)
# Allocate buffer and set value
if comm.rank == 0:
buf = numpy.arange(n).astype(numpy.float32)
else:
... |
from transx2gtfs.data import get_path
import pytest
@pytest.fixture
def test_tfl_data():
return get_path('test_tfl_format')
@pytest.fixture
def test_txc21_data():
return get_path('test_txc21_format')
@pytest.fixture
def test_naptan_data():
return get_path('naptan_stops')
def test_calendar_weekday_inf... |
from time_map import TimeMap
import unittest
class TestTimeMap(unittest.TestCase):
def test_instantiates(self):
"""
Instantiates a new copy of the TimeMap class
"""
result = TimeMap()
self.assertIsInstance(result, TimeMap)
def test_adds_information_to_map(self):
... |
#!/usr/bin/env python
""" Demo logging."""
import logging
LOG_FILE = './output/test.log'
# Get a logger class linked to an id/name
logger = logging.getLogger('MyApp')
# Define a formatter for the messages
formatter = logging.Formatter('%(asctime)s - [%(levelname)s]: %(message)s')
# Create handler for streaming th... |
"""
Local settings for interface_blockchain project.
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
from .base import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with self work for additional information
# regarding copyright ownership. The ASF licenses self file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# -*- coding: utf-8 -*-
#
# 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
#... |
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2016 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use th... |
# Generated by Django 2.2.9 on 2020-01-24 09:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mainpage', '0005_auto_20200114_1157'),
]
operations = [
migrations.AlterField(
model_name='item... |
# -------------------------------------------------------------------------------
# Part of Tweedledum Project. This file is distributed under the MIT License.
# See accompanying file /LICENSE for details.
# -------------------------------------------------------------------------------
from .bitvec import BitVec
from... |
n1 = float(input('Temperatura em °C: '))
n2 = n1*9/5 + 32
print('{:.1f}°C corresponde a {:.1f} °F!'.format(n1, n2)) |
# -*- coding:utf-8 -*-
import werkzeug.routing
"""
routing模块内部有:
- Rule类(用来构造不同的URL模式的对象)
- Map类(存储所有的URL规则)
- BaseConverter的子类(负责定义匹配规则)
- MapAdapter类(负责具体URL匹配的工作)
""" |
# TODO: FIX TESTS!!!
from flask import jsonify
from flask import json
import pytest
from urllib.parse import quote_plus
import jsonpickle
from namex.models import User
from namex.services.name_request.auto_analyse import AnalysisRequestActions, AnalysisResultCodes
# from tests.python import integration_oracle_names... |
#### 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/component/vehicle/shared_extended_fuel_tanks_hvy.iff"
result.attrib... |
# Databricks notebook source
# MAGIC %md
# MAGIC
# MAGIC # PySpark
# MAGIC
# MAGIC by Jacek Laskowski (jacek@japila.pl)
# COMMAND ----------
# MAGIC %md
# MAGIC
# MAGIC ## Exercise 1
# COMMAND ----------
# MAGIC %md
# MAGIC
# MAGIC This exercise prepares you for some data processing, making your data cleaner fo... |
# Copyright 2019 DeepMind Technologies Ltd. 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... |
# Generated by Django 3.0.2 on 2020-02-05 14:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('produto', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='produto',
name='compra_produto',
... |
#!/usr/bin/env python3
import sys
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_boards.platforms import arty
# CRG ----------------------------------------------------------------------------------------------
class CRG(Module):
def __init__(self, platform):
s... |
# Generated by Django 3.1.5 on 2021-01-27 20:01
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
# Generated by Django 3.1.3 on 2021-04-14 10:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('viewer', '0006_auto_20210413_1708'),
]
operations = [
migrations.AddField(
model_name='stream',
name='user_id',
... |
"""List file storage volumes."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import columns as column_helper
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
COLUMNS = [
column_helper.Column('id', ('id',), mask="id"),
column_helper.... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-15 07:29
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('Article', '0001_initial'),
]
o... |
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from sklearn.model_selection import train_test_split
import random, math, os, time
from utils.VLSW import pad_all_cases
# from VLSW import pad_all_cases
# set the random seeds for reproducability
SEED = 1234
random.se... |
print('Kalkulator sederhana menggunakan python ')
import getpass
getpass.getpass("Press Enter to Continue.....")
while True:
try:
firstnum=float(input('masukan angka pertama -> '))
break
except ValueError:
print('Mohon masukan angka!')
continue
while True:
try:
secnum... |
# -*- coding: utf-8 -*-
############################################################################
#
# Copyright © 2013 OnlineGroups.net and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this dis... |
#
# Copyright (c) 2015-2019 Thierry Florac <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRAN... |
# Copyright 2013 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.
from __future__ import print_function
from __future__ import absolute_import
import datetime
import hashlib
import logging
import os
import os.path
import ra... |
"""
Project Euler Problem 234: https://projecteuler.net/problem=234
For any integer n, consider the three functions
f1,n(x,y,z) = x^(n+1) + y^(n+1) - z^(n+1)
f2,n(x,y,z) = (xy + yz + zx)*(x^(n-1) + y^(n-1) - z^(n-1))
f3,n(x,y,z) = xyz*(xn-2 + yn-2 - zn-2)
and their combination
fn(x,y,z) = f1,n(x,y,z) + f2,n(x,y,z) ... |
#! /usr/bin/env python
def hello_command(name, print_counter=False, repeat=10):
"""Print nice greetings."""
for i in range(repeat):
if print_counter:
print i+1,
print 'Hello, %s!' % name
if __name__ == '__main__':
import scriptine
scriptine.run() |
# Copyright 2011 OpenStack Foundation
# 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... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 Pavle Portic <pavle.portic@tilda.center>
#
# Distributed under terms of the BSD-3-Clause license.
from marshmallow import Schema, fields
class ServiceSchema(Schema):
name = fields.Str()
repository = fields.Str()
tag = fields.Str(... |
from django import forms
class PermissionUpdateForm(forms.Form):
remove = forms.MultipleChoiceField()
add = forms.CharField(required=False, label='Grant access to')
def __init__(self, *args, **kwargs):
users = kwargs.pop('users', ())
user_choices = [(u,u) for u in users]
super().__i... |
#!/usr/bin/env python3
measurements = []
with open('input', 'r') as data:
measurements = data.read().splitlines()
three_sums = []
for i in range(len(measurements)):
if i + 3 < len(measurements):
three_sums.append(int(measurements[i]) + int(measurements[i+1]) + int(measurements[i+2]))
print(three_sum... |
from aocd import get_data
from regex import regex
def create_regex(rules):
return regex.compile(r"(?V1)(?(DEFINE){})^(?P>r0)$".format(''.join("(?<r{}>{})".format(k, ''.join(
'|' if t == '|' else t[1] if t[0] == '"' else '(?P>r{})'.format(t) for t in v.split(' '))) for k, v in
... |
from fastapi.testclient import TestClient
from app.main import app
from unittest import mock
from tests.helper import mock_api
import json
client = TestClient(app)
@mock.patch('app.analyzer.analyzer.TorreAPI.search_jobs', return_value=mock_api('torre_jobs'))
def test_post_jobs(mock):
response = client.post(
... |
# Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved
import argparse
import json
import math
import os
import pickle
from collections import Counter, defaultdict
from copy import deepcopy
from functools import partial
from multiprocessing import Pool
from pathlib... |
# -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
class AnkiError(Exception):
def __init__(self, type, **data):
self.type = type
self.data = data
def __str__(self):
m = self.type
if s... |
#!/usr/bin/env python
import argparse
import json
from typing import List
from ltp import LTP
from transformers import BertTokenizer
def _is_chinese_char(cp):
"""Checks whether CP is the codepoint of a CJK character."""
# This defines a "chinese character" as anything in the CJK Unicode block:
# https:... |
import math
def load_data():
with open("aoc20-06-data.txt", "r") as f:
data = f.read()
print("Loaded lines:", len(data))
return data
data = load_data()
records = data.strip().replace('\n\n','|').replace('\n',' ').split('|')
base = set("abcdefghijklmnopqrstuvwxyz")
# base is used here to revmove... |
# Copyright 2010-2021 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 agreed to in writing... |
import kazoo as K
import math
def animate_spectrogram (exponent = 10):
size = 1 << exponent
length = size / 2
audio = K.Audio(size, writing=False)
spec = K.Spectrogram(exponent)
screen = K.Screen(size, length)
sound = K.Complexes()
freq = K.Reals()
audio.reading(sound)
spec.stream_fwd(sound,... |
# -*- coding: utf-8 -*-
import time
from typing import TYPE_CHECKING
from typing import Any
from typing import Dict
from typing import List
from typing import Union
from poetry.core.packages import Dependency
from poetry.core.packages import Package
from poetry.core.packages import ProjectPackage
from poetry.core.sem... |
#!/usr/bin/env python3
import json
import re
import os.path
import sys
problem_dir = sys.argv[1]
analysis = sys.argv[2]
label_file = problem_dir + "/label.json"
node_file = problem_dir + "/sparrow-out/node.json"
alarm_file = problem_dir + "/sparrow-out/" + analysis + "/datalog/Alarm.facts"
groundtruth_file = problem... |
import argparse
import time
import torch
from hivemind.proto.runtime_pb2 import CompressionType
from hivemind.utils.compression import serialize_torch_tensor, deserialize_torch_tensor
def benchmark_compression(tensor: torch.Tensor, compression_type: CompressionType) -> float:
t = time.time()
deserialize_tor... |
from elasticsearch_dsl.analysis import analyzer, token_filter
edge_ngram_analyzer = analyzer(
'edge_ngram_analyzer',
type='custom',
tokenizer='standard',
filter=[
'lowercase',
token_filter(
'edge_ngram_filter',
type='edgeNGram',
min_gram=2,
... |
"""Tests which check the various ways you can set DJANGO_SETTINGS_MODULE
If these tests fail you probably forgot to run "python setup.py develop".
"""
import django
import pytest
BARE_SETTINGS = """
# At least one database must be configured
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlit... |
import yfinance as yf
from pprint import pprint
symbols = ["MSFT", "GOOG", "AAPL", "FB", "PG"]
for sym in symbols:
print("====================")
print(sym)
data = yf.Ticker(sym)
pprint(data.info)
print("====================")
"""
sample data
GOOG
{'52WeekChange': 0.28944457,
'SandP52WeekChange... |
"""
Missions for:
- Testing reactor
- Cleanup with robots/biorobots
- Boron, Sand, helicopters (random helicopter crashes into crane) 422Bad request if helicopter is overloaded
- Reactor building safety - percentages of Boron/Sand bags endpoint
"""
# TODO finish
from collections import namedtuple
from fastapi import A... |
"""
BaseHTTPServer that implements the Python WSGI protocol (PEP 333, rev 1.21).
Adapted from wsgiref.simple_server: http://svn.eby-sarna.com/wsgiref/
This is a simple server for use in testing or debugging Django apps. It hasn't
been reviewed for security issues. Don't use it for production use.
"""
from BaseHTTPSe... |
from isserviceup.services.models.statuspage import StatusPagePlugin
class Box(StatusPagePlugin):
name = 'Box'
status_url = 'https://status.box.com/'
icon_url = '/images/icons/box.png'
|
"""
UnpacMe
# Introduction Welcome to the UNPACME API! All the malware unpacking and file analysis features that you are familiar with on the [unpac.me](https://www.unpac.me/) website are available through our API. You can easily integrate our unpacker into your malware analysis pipeline and begin unpacking a... |
###############################################################################
# Copyright (c) 2017-2020 Koren Lev (Cisco Systems), #
# Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others #
# #
... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... |
system_host_env = "QRADAR_ADVISOR_HOST"
system_token_env = "QRADAR_ADVISOR_TOKEN"
system_verify_env = "QRADAR_ADVISOR_VERIFY"
system_http_proxy = "QRADAR_HTTP_PROXY"
system_https_proxy = "QRADAR_HTTPS_PROXY"
help_basic = "Use env vars QRADAR_ADVISOR_HOST/QRADAR_ADVISOR_TOKEN to specify login info"
class ToolCommand(o... |
# Copyright 2010-2018 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 agreed to in writing... |
#!/usr/bin/env python3
import requests
from PIL import Image
import os
book = {
"chapter1": {
"url": ("https://node2d-public.hep.com.cn/"
"579c75d5b7ce5471acf4396725a6b329.pdf_files/"
"579c75d5b7ce5471acf4396725a6b329.pdf.files/"),
"page": 34
},
"chapter2": {
"url": ("https://... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
from flask import Blueprint
admin = Blueprint('admin', __name__)
from . import view |
import os.path as osp
from cvpods.configs.rcnn_fpn_config import RCNNFPNConfig
_config_dict = dict(
MODEL=dict(
WEIGHTS="detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl",
MASK_ON=True,
RESNETS=dict(
DEPTH=101,
NUM_GROUPS=32,
WIDTH_PER_GROUP=8,
... |
from h5py.h5t import np
class remove_small_holes:
def __init__(self, image=[[0.0]], area_threshold=64, **options):
from skimage import morphology
import numpy as np
self.a = np.array(image, dtype=bool)
for sl1 in range(self.a.shape[2]):
self.a[:, :, sl1] = morphology.... |
from networks import backbone
import tensorflow as tf
import numpy as np
from PIL import Image
import cv2
from utils import generate_anchors, draw_bbox, recover_ImgAndBbox_scale
from config import IMG_H, IMG_W, CLASSES, K
from ops import top_k_score_bbox, sigmoid, offset2bbox
anchors_p3 = generate_anchors... |
""" Test script for the unicodedata module.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import unittest, test.test_support
import hashlib
encoding = 'utf-8'
### Run tests
class UnicodeMethodsTest(unittest.TestCase):
# ... |
import h5
import numpy as np
class MeshFile:
def __init__(self,fpath, mode='r'):
self.h5file = h5.File(fpath,mode)
self.elemInfo = self.get('ElemInfo')
self.nodeCoords = self.get('NodeCoords')
self.domain = np.array([
[self.nodeCoords[:,i].min() for i in range(0,... |
from __future__ import annotations
import functools
from os import DirEntry
from typing import AsyncIterable, Callable, List, TYPE_CHECKING
from .._pathlib import Path, PosixPath, WindowsPath, _NormalAccessor, _Selector,_is_wildcard_pattern, _ignore_error, _Flavour
#from pathlib import Path, PosixPath, WindowsPath,... |
from flask import Blueprint
api = Blueprint('api', __name__, url_prefix='/api')
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Solutions to chapter 7 exercises.
###############################################################################
# chapter7_exercises.py
#
# Revision: 1.00
# Date: 7/02/2021
# Author: Alex
#
# Purpose: Solutions to chapter 7 exercises from "Data... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
import inspect
import marshal
import types
from datetime import datetime
from snorkel.labeling import LabelingFunction as SnorkelLF
from synthesizer.gll import CONDS
from synthesizer.gll import CONNECTIVE
from synthesizer.gll import DIRECTION
from synthesizer.gll import LABEL
from synthesizer.gll import WEIGHT
from ve... |
#coding: utf-8
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import patterns, include, url
urlpatterns = patterns('main.views',
url(r'^$', 'index'),
url(r'^(?P<id>\w+)/?$', 'long_url'),
url(r'^get/short/url/?$', 'short_url'),
) + static(settings.STATIC_... |
#!/usr/bin/env python
"""A serializer that encodes EE object trees as JSON DAGs."""
# Using lowercase function naming to match the JavaScript names.
# pylint: disable=g-bad-name
# pylint: disable=g-bad-import-order
import collections
import datetime
import hashlib
import json
import math
import numbers
import six
... |
# TEST for FiniteElement in coupled problems
# postprocessing of a truss under gravity
# seperately solving laplace -> temperature in the middle and on one side set
import matplotlib.pyplot as plt
import PyFEMP
import PyFEMP.elements.Elmt_BaMo_BaEn_Coupled_1D as ELEMENT
# Create FEM Instance
FEM = PyFEMP.FEM_Simula... |
# Copyright 2017 The Armada 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 agreed to in w... |
from math import sqrt
def x(n):
a=['0','1','4','9']
x=str(n)
for i in x:
if i not in a:
return False
return True
def y():
i=1
p=[]
while i<=sqrt(10000000000):
if x(i*i):
p.append(i*i)
i+=1
return p
def srch(sr,a,b):
c=0
for i in sr... |
# coding: utf-8
# 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"... |
#!/usr/bin/env python
import rospy
from control_msgs.msg import GripperCommandActionGoal
J_POSES = {}
J_POSES["HANDLE_VIEW"] = [[-1.7536862514949982, -0.510532242025934, 1.506756357326197, 0.30385549510146276, -1.9141949703940737, -0.3170866120291951]]
J_POSES["CAN_VIEW"] = [[-1.6884036510616678, -1.1658008977110583,... |
import capture
from face_detection import face_detection
if __name__ == "__main__":
face = face_detection()
cam = capture.cam()
face.detection(cam.capture()) |
import pypandoc
output = pypandoc.convert('README.md', 'rst')
with open('README.txt' 'w+') as f:
f.write(str(output.encode('utf-8')))
readme_rst = open('./README.txt').read()
replace = '''
.. figure:: https://uiux.s3.amazonaws.com/2016-logos/email-logo
%402x.png\n :alt: SendGrid Logo\n\n... |
# Copyright 2020, CS Systemes d'Information, http://www.c-s.fr
#
# This file is part of pytest-executable
# https://www.github.com/CS-SI/pytest-executable
#
# 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... |
"""Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
import pytest
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import coo_matrix
from scipy.sparse import dok_matrix
from scipy.sparse import lil_matrix
from sklearn.utils._testing import assert_a... |
"""Eelbrain GUIs"""
def run(block=False):
"""Hand over command to the GUI (quit the GUI to return to the terminal)
Parameters
----------
block : bool
Block the Terminal even if the GUI is capable of being run in parallel.
Control returns to the Terminal when the user quits the GUI app... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Run as script."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
from epoc_harvester_simulator.__main__ import main
sys.exit(main())
|
"""
Useful functions, mostly related to AWS and STAC
"""
import json
import logging
import os
from concurrent import futures
from pathlib import PurePosixPath
from typing import Tuple, Optional
from urllib.parse import urlparse
import boto3
from toolz import dicttoolz, get_in
LOG = logging.getLogger(__name__)
def s... |
def heap_sort(nums):
# convert nums to heap
length = len(nums) - 1
least_parent = length // 2
for i in range(least_parent, -1, -1):
move_down(nums, i, length)
# flatten heap into sorted array
for i in range(length, 0, -1):
if nums[0] > nums[i]:
swap(nums, 0... |
import turtle
import random #We'll need this later in the lab
import time
turtle.tracer(1,0) #This helps the turtle move more smoothly
SIZE_X=1000
SIZE_Y=1000
turtle.setup(SIZE_X, SIZE_Y) #Curious? It's the turtle window
#size.
turtle.penup()
SQUARE_SIZE = 20
START_LENGTH = 6
TIME_S... |
# import libraries
from pyspark.sql import SparkSession
from pyspark import SparkConf
from pyspark.sql.types import *
from pyspark.sql.functions import col, count, lit, rand, when
import pandas as pd
from math import ceil
#################################################
# spark config
##############################... |
# Copyright 2019, Google LLC 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 a... |
# Copyright 2012 Locaweb.
# 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 appli... |
import unittest
from backend.services.messaging.template_service import (
template_var_replacing,
get_template,
clean_html,
format_username_link,
)
from flask import current_app
class TestTemplateService(unittest.TestCase):
def test_variable_replacing(self):
# Act
content = get_te... |
import os
import pytest
import tempfile
import zipfile
from eth_utils import (
is_checksum_address,
is_dict,
)
from .install_parity import (
get_executable_path,
install_parity,
)
from .utils import (
get_process,
)
KEYFILE_PW = 'web3py-test'
PARITY_2_5_13_FIXTURE = {
'zip': 'parity-2.5.13-... |
# Copyright (C) 2010 Google 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, this list of conditions and the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.