text stringlengths 1 927k |
|---|
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import argparse
import numpy as np
import tensorflow as tf
from tensorflow import keras
parser = argparse.ArgumentParser(description='''Predicts the detectability of input peptides using a single dimension
... |
"""
py-ctrl script
1. generate problem PD file
1.1 save PD file in /inputfiles
2. solve convex hull
2.1 save hull information in /output
2.2 show figure for 10 sec
2.3 save figure in /output
"""
import os
import subprocess
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentPars... |
import asyncio
import errno
import inspect
import io
import os
import socket
import ssl
import threading
import warnings
from distutils.version import StrictVersion
from itertools import chain
from typing import (
Any,
Iterable,
List,
Mapping,
Optional,
Set,
Tuple,
Type,
TypeVar,
... |
# BPlusTree with Python https://github.com/Nero5023/bplustree/tree/main/bplus_tree
import pandas as pd
import bisect
import math
def flatten(l):
return [y for x in l for y in x]
class Leaf:
def __init__(self, previous_leaf, next_leaf, parent, b_factor):
self.previous = previous_leaf
self.nex... |
from .utils import Atom, Residue, ActiveSite
import matplotlib.pyplot as plt
import numpy as np
from .helpers import *
from Bio import pairwise2
import rmsd
from sklearn.decomposition import PCA
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
def compute_similarity(site_a, site_b):
"""... |
# -*- coding: utf-8 -*-
#
# Read the Docs Template documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 26 14:19:49 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenera... |
"""
Transforms of aocd raw input text to something more useful for speed-solving.
Every function here needs to accept one positional argument and return the
'massaged' data.
"""
__all__ = ["lines", "numbers"]
def lines(data):
return data.splitlines()
def numbers(data):
return [int(n) for n in data.splitlin... |
from django.conf.urls import url
from . import views
from . import views_book
from . import views_sysinfo
urlpatterns = [
#########################图书信息#####################
# url(r'test', views.test),
url(r'books', views_book.query),
url(r'book/edit', views_book.edit),
#支持url参数的写法一
#url(r'^book... |
# -*- coding: utf-8 -*-
#
# osc2rtmidi/device.py
#
"""MIDI device abstraction classes."""
import logging
import time
from rtmidi.midiutil import open_midioutput
__all__ = ("RtMidiDevice",)
log = logging.getLogger(__name__)
class RtMidiDevice(object):
"""Provides a common API for different MIDI driver implemen... |
# Copyright (C) 2010 Google Inc. All rights reserved.
# Copyright (C) 2009 Daniel Bates (dbates@intudata.com). 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 co... |
# coding: utf-8
"""
Flat API
The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: * Creating and importing new music scores using MusicXML, MIDI, Guitar Pro (GP3, GP4, GP5, GPX, GP), PowerTab, TuxGuitar and Mus... |
import django
from django import template
from django_countries.fields import Country, countries
register = template.Library()
simple_tag = register.simple_tag
@simple_tag
def get_country(code):
return Country(code=code)
@simple_tag
def get_countries():
return list(countries) |
"""
This python script demonstrates the creation of all parametric reactors available
in the paramak tool
"""
import paramak
def main():
all_reactors = []
my_reactor = paramak.BallReactor(
inner_bore_radial_thickness=50,
inboard_tf_leg_radial_thickness=50,
center_column_shield_radia... |
import numpy as np
class LowLevelController:
"""Low level controller of a point mass robot with dynamics:
x_{k+1} = x_k + v_k * Ts * cos(psi_k)
y_{k+1} = y_k + v_k * Ts * sin(psi_k)
v_{k+1} = v_k + Ts * a_k
psi_{k+1} = psi_k + Ts * omega_k
omega_{k+1} = omega_k + Ts * epsilon_k
Where a_k... |
import json
import threading
import time
import os
import stat
from decimal import Decimal
from typing import Union, Optional
from numbers import Real
from copy import deepcopy
from . import util
from .util import (user_dir, make_dir,
NoDynamicFeeEstimates, format_fee_satoshis, quantize_feerate)
fr... |
# -*- 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
#... |
from pathlib import Path
from sepal_ui import sepalwidgets as sw
from component import parameter as cp
from component.message import cm
class FolderSelect(sw.FileInput):
def __init__(self):
super().__init__([''], label=cm.widget.folder.label, folder=cp.down_dir)
def _on_file_s... |
from pathlib import Path
from typing import Tuple, List, Dict
import pandas as pd
import numpy as np
from tsfresh.utilities.dataframe_functions import roll_time_series
def get_path(df: pd.DataFrame) -> np.array:
out = []
for index, row in df.iterrows():
out.append((row["Latitude"], row["Longitude"]))... |
from rest_framework.permissions import BasePermission
class IsCreator(BasePermission):
def has_object_permission(self, request, view, obj):
user = request.user
creator = obj.created_by
return user == creator
class HasChangePermissions(BasePermission):
def has_object_permission(self, ... |
# Copyright 2014 Google 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
# Copyright (C) 2019-2021 Ruhr West University of Applied Sciences, Bottrop, Germany
# AND Elektronische Fahrwerksysteme GmbH, Gaimersheim Germany
#
# This Source Code Form is subject to the terms of the Apache License 2.0
# If a copy of the APL2 was not distributed with this
# file, You can obtain one at https://www.a... |
#!/usr/bin/env python
import argparse
import math
import matplotlib.pyplot as plt
def file_count(shape, chunkXY, chunkZ=1, chunkT=1, chunkC=1):
t, c, z, y, x = shape
return (
math.ceil(x / chunkXY)
* math.ceil(y / chunkXY)
* math.ceil(z / chunkZ)
* math.ceil(t / chunkT)
... |
# Copyright 2020 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... |
#!/usr/bin/python
import datetime
import socket
LISTENPORT=3141
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('0.0.0.0', LISTENPORT))
while True:
data, addr = sock.recvfrom(1024)
print '%s: %s' % (datetime.datetime.now(), data)
with open('temperature.log', 'a') as f:
f.write('%s,%s\n'... |
"""
The roseguarden project
Copyright (C) 2018-2020 Marcus Drobisch,
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 3 of the License, or (at your option) any later
version.
This pr... |
#!/usr/bin/env python3 -W all
"""
ner-frog.py: perform named entity recognition for Dutch
usage: ner-frog.py < text
notes:
* adapted from: https://www.tutorialspoint.com/python/python_networking.htm
* requires frog running and listening on localhost port 8080
* output lines with format: token SP... |
import shutil
import time
import exifread
import os
if __name__ == '__main__':
photo_directory = input("Please input image directory: ")
filenames = os.listdir(photo_directory)
print(filenames, "\nDirectory contains files above, are you sure to process? (Y/N)")
answer = input("")
while answer != "... |
#!/usr/bin/env python
# coding: utf-8
# # Loading data
import pandas as pd
import plotly.express as px
from tqdm import tqdm
import functools
import numpy as np
from difflib import SequenceMatcher
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
from datetime import d... |
from __future__ import absolute_import, division, print_function
import os
import time
import pandas as pd
import numpy as np
import seaborn as sns
from collections import Counter
import matplotlib.pyplot as plt
from sklearn.externals import joblib
from sklearn.preprocessing import Normalizer
from sklearn.model_select... |
from utils import data_helper
if __name__ == "__main__":
dataset_path = r"../data/raw/cat"
(
train_set_x_orig,
train_set_y,
test_set_x_orig,
test_set_y,
classes,
) = data_helper.load_from_h5(dataset_path, "catvnoncat")
m_train = train_set_x_orig.shape[0]
m_... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Roomscout.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.12.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... |
import os
import os.path as op
from bento.distutils.utils \
import \
_is_setuptools_activated
if _is_setuptools_activated():
from setuptools.command.egg_info \
import \
egg_info as old_egg_info
else:
raise ValueError("You cannot use egg_info without setuptools enabled first")
f... |
import os
import uuid
from contextlib import contextmanager
from datetime import datetime
from xml.etree import cElementTree as ElementTree
from casexml.apps.phone.restore_caching import RestorePayloadPathCache
from corehq.apps.receiverwrapper.util import submit_form_locally
from corehq.form_processor.tests.utils impor... |
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template file: justice_py_sdk_codegen/__main__.py
# justice-iam-service (5.10.1)
# pylint: disable=dup... |
from google.appengine.ext import ndb
class Transaction(ndb.Model):
"""A simple model to store the properties of an order"""
total_amount = ndb.FloatProperty(indexed=False)
transaction_id = ndb.StringProperty(indexed=False)
transaction_ref = ndb.StringProperty(indexed=False)
post_date = ndb.StringPr... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import logging
from decimal import Decimal as D
from django.db.models import Sum
from ralph_scrooge.utils.common import memoize
from... |
# -*- coding: utf-8 -*-
"""Analysis plugin related functions and classes for testing."""
from __future__ import unicode_literals
from plaso.analysis import mediator as analysis_mediator
from plaso.containers import artifacts
from plaso.containers import sessions
from plaso.engine import knowledge_base
from plaso.pars... |
""" .. _BDPReader-api:
BDPReader --- Converts BDP in XML format to in-memory BDP object.
-----------------------------------------------------------------
This module defines the BDPReader class.
"""
#system imports
from xml import sax
import os
# ADMIT imports
import admit.util.bdp_types as bt
import ... |
# Copyright 2020 Adap GmbH. 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 ag... |
from setuptools import setup, PEP420PackageFinder
setup(
name="nilu-api-client",
version="1.0.0",
author="helgehatt",
description="NILU API client",
url="https://github.com/helgehatt/nilu-api-client",
packages=PEP420PackageFinder.find(),
package_data={"": ["**/files/*"]},
install_requir... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent 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
# no... |
# postgresql/psycopg2.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
r"""
.. dialect:: postgresql+psycopg2
:name: psycopg2
:dbapi: psycopg... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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
... |
import asyncio
import discord
import logging
from random import randint
from random import choice as randchoice
from redbot.core import bank, checks, commands, Config
from redbot.core.errors import BalanceTooHigh
from redbot.core.utils.chat_formatting import box, humanize_list, pagify
from .phrases import FRIENDS, SN... |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from datetime import datetime
from logging import getLogger
import collections
from sqlalchemy.sql.expression import tuple_
from ggrc import db
from ggrc import models
from ggrc.automapper.rules import rul... |
# encoding: utf-8
from typing import Optional, Union
class Indent:
class IdentStart:
def __init__(self, text):
self.text = text
class IdentEnd:
def __init__(self, text):
self.text = text
class IdentEndLater:
def __init__(self, text):
self.text ... |
from stix_shifter_utils.modules.base.stix_transmission.base_sync_connector import BaseSyncConnector
from stix_shifter_utils.stix_transmission.utils.RestApiClient import RestApiClient
from stix2matcher.matcher import Pattern
from stix2matcher.matcher import MatchListener
from stix2validator import validate_instance
impo... |
import dlib
class HogDetector:
def __init__(self):
self.detector = dlib.get_frontal_face_detector()
def detect(self, frame):
bboxes = []
# landmarks = []
dets = self.detector(frame, 1)
for k, d in enumerate(dets):
bboxes.append(
(d.left(), d... |
import numpy as np
import cv2
def rodrigues2matrix_cv(params):
rvec = np.array(params,dtype=np.float64)
rvec.shape = (1,3)
Rmat, jacobian = cv2.Rodrigues(rvec)
return Rmat
def rodrigues2matrix(params):
# Written after the docs at
# http://opencv.itseez.com/modules/calib3d/doc/camera_calibratio... |
# -*- coding: utf-8 -*-
import collections
from datetime import datetime
import re
import nose
from nose.tools import assert_equal
import numpy as np
from pandas.tslib import iNaT, NaT
from pandas import Series, DataFrame, date_range, DatetimeIndex, Timestamp, Float64Index
from pandas import compat
from pandas.compat ... |
# Copyright (c) 2017 The Khronos Group 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 ... |
from django.apps import AppConfig
from django.db.utils import OperationalError, ProgrammingError
from django.conf import settings
from django.utils.timezone import activate
import logging
class MoloAppConfig(AppConfig):
name = 'molo.core'
def ready(self):
from molo.core.models import Site, CmsSettin... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
from . import initial, input, message_passing, mlp, readout, update
from .gnn import GNN
from .input import GNNInput, get_dataset_from_files
__all__ = [
"GNN",
"GNNInput",
"get_dataset_from_files",
"initial",
"input",
"message_passing",
"mlp",
"readout",
"update",
] |
import json
import os
from http import HTTPStatus
from typing import Any
import requests
class HTTPClient:
__instance = None
def __new__(cls):
"""
This method creates the only instance of the class(singleton pattern)
:param cls: The class
:return: The method retur... |
"""
Abstract classes for typing purposes only
"""
# pylint: disable=no-self-use,pointless-statement,missing-docstring,invalid-name, too-few-public-methods
from __future__ import annotations
from typing import Optional, Dict, Sequence
class xmlFragment:
"""an abstract class representing the xml fragments returned b... |
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.front.common.partial_infer.utils import int64_array
from openvino.tools.mo.graph.graph import Graph
from openvino.tools.mo.ops.op import Op
class Reverse(Op):
op = 'Reverse'
def __ini... |
# -*- coding: utf-8 -*-
from openprocurement.auctions.core.utils import (
json_view,
context_unpack,
opresource
)
from openprocurement.auctions.core.validation import (
validate_file_update,
validate_file_upload,
validate_patch_document_data
)
from openprocurement.auctions.core.views.mixins impo... |
from typing import List
from core.exceptions.data_exceptions import (DataIndexNotFoundException,
DataIllegalEventTypeException,
DataIllegalActivityTypeException)
from core.exceptions.input_exceptions import (InputFormatException,... |
from boa.builtins import breakpoint
def Main(operation):
result = False
if operation == 1:
m = 3
breakpoint()
result = True
elif operation == 2:
breakpoint()
result = False
elif operation == 3:
b = 'hello'
breakpoint()
j = 32
... |
import argparse
import torch
from transformers import BertForSequenceClassification
def export_onnx_model(args, model, onnx_model_path):
with torch.no_grad():
inputs = {'input_ids': torch.ones(1,args.max_len, dtype=torch.int32),
'attention_mask': torch.ones(1,args.max_len, dtype=t... |
# Copyright 2017 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 pandas as pd
import json, hashlib, os, codecs, base64
from igf_data.igfdb.baseadaptor import BaseAdaptor
from igf_data.igfdb.igfTables import User
class UserAdaptor(BaseAdaptor):
'''
An adaptor class for table User
'''
def _email_check(self, email):
'''
An internal function to check if email_id ... |
# coding: utf-8
import re
class CanonicalPhoneGenerationException(Exception):
pass
def gen_canonical_phone(original_phone, first_number='7', check_code=True):
# удалим все не цифровые символы
phone = re.sub('\D', '', original_phone)
if not (10 <= len(phone) <= 11):
raise CanonicalPhoneGener... |
# -*- coding: utf-8 -*-
import datetime
from collections import OrderedDict
from gluon import current
from gluon.storage import Storage
from s3 import S3Method
from .controllers import deploy_index
RED_CROSS = "Red Cross / Red Crescent"
def config(settings):
"""
Template settings for IFRC's Resource M... |
#!/usr/bin/env python3
"""
Author : mahmoudabdelrahman <mahmoudabdelrahman@localhost>
Date : 2022-01-28
Purpose: Rock the Casbah
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='... |
import os
import argparse
"""
Splits a single file of MEDLINE formatted abstracts
into M files of N abstracts.
"""
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("infile", type=str,
help="MEDLINE file to split")
parser.add_argument("outdir", type=str,
... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
try:
from unittest import mock
except ImportError:
import mock
from azure.core.credentials import AzureKeyCredential
from azure.search.documents... |
# executes the module loader in blender
import os
import subprocess
from shutil import copyfile
from Utility.OS_Extension import get_first_valid_path
from Utility.Config import Config
from Utility.Logging_Extension import logger
# ====== Warning when starting blender ======
# "connect failed: No such file or director... |
from decimal import Decimal
from unittest.mock import patch
import graphene
import pytest
from ....checkout import calculations
from ....payment.error_codes import PaymentErrorCode
from ....payment.gateways.dummy_credit_card import (
TOKEN_EXPIRED,
TOKEN_VALIDATION_MAPPING,
)
from ....payment.interface import... |
from sympy.testing.pytest import raises, XFAIL
from sympy.external import import_module
from sympy import (
Symbol, Mul, Add, Abs, sin, asin, cos, Pow, csc, sec,
Limit, oo, Derivative, Integral, factorial, sqrt, root,
conjugate, StrictLessThan, LessThan, StrictGreaterThan,
GreaterThan, Sum, Product, E,... |
#
# This file is part of LUNA.
#
# Copyright (c) 2020 Great Scott Gadgets <info@greatscottgadgets.com>
# SPDX-License-Identifier: BSD-3-Clause
""" Header Packet Rx-handling gateware. """
import unittest
from nmigen import *
from nmigen.hdl.ast import Fell
from usb_protocol.types... |
# Copyright 2014 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, s... |
import flask
from devices import devices
from models import JsonEncoder
from pins import pins
from settings import settings
app = flask.Flask(__name__)
app.json_encoder = JsonEncoder
app.register_blueprint(devices, url_prefix="/devices")
app.register_blueprint(settings, url_prefix="/settings")
app.register_blueprint(... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
# pylint: disable=protected-access
from typing import (
Any,
IO,
Union,
List,
TYPE_CHECKING
)
from azure.core.tracing.decorator impo... |
import re
import lst_scripts
def test_version():
with open("lstirf/__init__.py") as f:
__version__ = re.search('^__version__ = "(.*)"$', f.read()).group(1)
assert lst_scripts.__version__ == __version__ |
from rest_framework.authentication import SessionAuthentication as RESTSessionAuthentication
class SessionAuthentication(RESTSessionAuthentication):
"""
This class is needed, because REST Framework's default SessionAuthentication does never return 401's,
because they cannot fill the WWW-Authenticate heade... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
#!/usr/bin/env python3
'''
Copyright © 2020 Doug Eaton
USBDecode 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.
usb_decode is distributed... |
import torch
import torch.distributed as dist
from .parallel_mode import ParallelMode
from typing import Tuple
def _check_sanity():
from colossalai.core import global_context as gpc
if gpc.tensor_parallel_size > 1 or gpc.pipeline_parallel_size > 1:
raise NotImplementedError("Moe is not compatible with... |
import numpy as np
import cv2
import time
from grabscreen import grab_screen
import os
from alexnet import alexnet
from keys import key_check, PressKey, ReleaseKey, W, A, S, D
t_time = 0.09
def forward():
PressKey(W)
ReleaseKey(A)
ReleaseKey(D)
ReleaseKey(S)
def left():
PressKey(A)
PressKey(W... |
# Copyright (c) 2021 PaddlePaddle 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 appli... |
from datetime import timedelta
from .activity import Activity
from .activity_helper import ActivityHelper
class ActivityStat:
"""Store and update the amount of time spent in a certain activity"""
def __init__(self, work_time: timedelta = timedelta(),
off_time: timedelta = timedelta()) -> No... |
from fabric.api import cd, env, lcd, local, hosts, prompt, run
from fabric.decorators import runs_once
import os
import time
env.runtime = 'production'
env.hosts = ['newchimera.readthedocs.com',
'newbuild.readthedocs.com',
'newasgard.readthedocs.com']
env.user = 'docs'
env.code_dir = '/home/... |
#!/usr/bin/env python
# Copyright 2015 Criteo. All rights reserved.
#
# The contents of this file are 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.... |
version https://git-lfs.github.com/spec/v1
oid sha256:6c0828479c4167ae77b4de1f98c39749190ceaf383b6046097cfd212b12804de
size 3101 |
# Complete project details at https://RandomNerdTutorials.com
import socket
import network
import machine, onewire, ds18x20, time
sta_if = network.WLAN(network.STA_IF)
print(sta_if.ifconfig())
ds_pin = machine.Pin(4)
ds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin))
def read_ds_sensor():
roms = ds_sensor.scan... |
from molsysmt import puw
from molsysmt.basic import convert, select, get
from molsysmt._private_tools._digestion import digest_engine, digest_target
import numpy as np
def get_sasa (molecular_system, target='atom', selection='all', frame_indices='all', syntaxis='MolSysMT',
engine='MDTraj'):
engine = dig... |
# Graph (vertices and edges) manipulation class.
# Vertex and Edge definition customized for our need.
# Dijkstra stolen at https://www.bogotobogo.com/python/python_graph_data_structures.php
#
import logging
import math
import json
from functools import reduce
from .geo import Point, Line, Polygon, distance, nearestPoi... |
# coding=UTF-8
'''Helper functions
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to templates as 'h'.
'''
import email.utils
import datetime
import logging
import re
import os
import urllib
import urlparse
import pprint
import copy
import urlp... |
# content of test_sample.py
def func(x):
return x * 2
def test_answer():
assert func(5) == 10 |
"""Produce metadata and datasets of NIH Chest Xray images
"""
import os
import numpy as np
import pandas as pd
import tensorflow as tf
def get_metadata(path):
"""Produce metadata with relevant columns from NIH Chest Xray images
Args:
path: Path to NIH dataset
Returns:
metadata Dataframe... |
import argparse
import time
from pathlib import Path
import cv2
import torch
import torch.backends.cudnn as cudnn
from numpy import random
from models.experimental import attempt_load
from utils.datasets import LoadStreams, LoadImages
from utils.general import check_img_size, check_requirements, non_max_suppression, ... |
"""
User app
"""
from django.urls import path,include
from .views import *
__all__=['urlpatterns','app_name']
app_name = 'users'
urlpatterns = [
# 首页
path('', IndexView.as_view(), name='index'),
# 登录
path('login/', LoginView.as_view(), name='login'),
# 登出
path('logout', LogoutView.as_view()... |
from .data_perturb import DataPerturb
from .data_perturb_uniform import DataPerturbUniform
from .data_perturb_normal import DataPerturbNormal |
from typing import Dict, List
import mido
from lss.pad import Pad
from lss.utils import open_input, open_output
class BaseLaunchpad:
row_count: int
column_count: int
name: str
pads: Dict[int, "Pad"] = {}
def __init__(self):
self._outport = open_output(self.name + " In", autoreset=True)... |
#
# 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
# ... |
# -*- coding: utf-8 -*-
# cython: language_level=3
# BSD 3-Clause License
#
# Copyright (c) 2020-2021, Faster Speeding
# 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 sour... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.