text stringlengths 1 927k |
|---|
#!python
"""Unittesting for the pyross module. Run as python -m unittest pyross.test."""
import sys
#remove pwd from path that tries to import .pyx files
for i in sys.path:
if 'pyross' in i or i == '':
sys.path.remove(i)
# print(sys.path)
import pyross
import unittest
import inspect
import numpy as np
impor... |
#!/usr/bin/python
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
#!/usr/bin/env python3
import time
import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306
#
import RPi.GPIO as GPIO
from signal import pause
#import dht11
import math
#
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
#import subprocess
#
#import sys
import board
import pigpio
import DHT
... |
import functools
import typing
class Accumulate:
@staticmethod
def __call__(
func: typing.Callable,
identity: int,
):
def fn(
a: typing.Iterable[int],
) -> int:
return functools.reduce(
func,
a,
ident... |
#vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
from disco.bot import Plugin
import re
import random
import datetime
class TutorialPlugin(Plugin):
tags = {}
lastTimeSpoke = datetime.datetime.now() + datetime.timedelta(minutes = -240)
@Plugin.listen('MessageCreate')
def on_message_create(self, ev... |
import FWCore.ParameterSet.Config as cms
from Configuration.Generator.Pythia8CommonSettings_cfi import *
from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import *
generator = cms.EDFilter("Pythia8GeneratorFilter",
pythiaHepMCVerbosity = cms.untracked.bool(False),
... |
#!/usr/bin/env python3
"""
Convert COCO17 2D poses to dummy embeddings for 2D-VPD.
"""
import os
import argparse
import numpy as np
from tqdm import tqdm
from util.io import store_pickle, load_gz_json
from vipe_dataset.dataset_base import normalize_2d_skeleton
def get_args():
parser = argparse.ArgumentParser()... |
#! /usr/bin/env python3
import argparse
import csv
import datetime
import json
import os
import sys
roast_fields = [
'dateTime',
'uid',
'roastNumber',
'roastName',
'beanId',
'rating',
'serialNumber',
'firmware',
'hardware',
{'fields': ['ambient', 'ambientTemp'], 'mapped_field... |
"""
owtf.plugin.plugin_params.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Manage parameters to the plugins
"""
import logging
from collections import defaultdict
from owtf.config import config_handler
from owtf.db.database import get_scoped_session
from owtf.managers.error import add_error
from owtf.utils.error import abort_fram... |
# -*- coding: utf-8 -*-
import datetime
import numpy as np
from ..base import Property
from ..models.measurement import MeasurementModel
from ..models.transition import TransitionModel
from ..reader import GroundTruthReader
from ..types.detection import TrueDetection, Clutter
from ..types.groundtruth import GroundTru... |
"""
Basic unit tests for the parser class.
"""
import unittest
from eta.parser import parser
from eta.types import Symbol
from lark.visitors import VisitError
class ParserTest(unittest.TestCase):
def test_basic_expressions(self):
try:
parser.parse("(defun (foo x y) (+ x y))")
pars... |
from unittest.mock import patch
from django.test import TestCase
from bc.search.tests.fixtures import TermFactory
from bc.search.utils import SYNONYMS_CACHE_KEY, cache, get_synonyms
class SynonymTest(TestCase):
def test_basic(self):
TermFactory(canonical_term="foo", synonyms=["soup", "potatoes"])
... |
"""This module contains the general information for BiosSettingRef ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class BiosSettingRefConsts():
IS_DEFAULT_NO = "no"
IS_DEFAULT_YES = "yes"
... |
# Logging level must be set before importing any stretch_body class
import stretch_body.robot_params
#stretch_body.robot_params.RobotParams.set_logging_level("DEBUG")
import unittest
import stretch_body.device
import stretch_body.robot as robot
import numpy as np
class TestTimingStats(unittest.TestCase):
def test... |
import os
from flask_mail import Message
from flask import render_template
from . import mail
def mail_message(subject,template,to,**kwargs):
sender_email =os.environ.get("MAIL_USERNAME")
email = Message(subject, sender=sender_email, recipients=[to])
email.body= render_template(template + ".txt",**kwargs)... |
#!/usr/bin/env python
from pathlib import Path
import trio # type: ignore
from lean_client.trio_server import TrioLeanServer
async def main():
lines = Path('test.lean').read_text().split('\n')
async with trio.open_nursery() as nursery:
server = TrioLeanServer(nursery, debug=False)
await serv... |
"""App drf url tests.
"""
from unittest import mock
import pytest
from django.urls import resolve, reverse
from .factories import ProjectFactory
pytestmark = pytest.mark.django_db
@pytest.mark.fast
@mock.patch(
"vision_on_edge.azure_projects.models.Project.validate",
mock.MagicMock(return_value=True),
)
d... |
# -*- coding: utf-8 -*-
'''
Sentry Logging Handler
======================
.. versionadded:: 0.17.0
This module provides a `Sentry`_ logging handler.
.. admonition:: Note
The `Raven`_ library needs to be installed on the system for this
logging handler to be available.
Config... |
JAPANESE = {
'title': '%プロローグ',
'contents': [
'% |本須 麗乃(もとすうらの)、22歳。',
'% わたしは本が好きだ。',
'$大好きだ。',
'% 三度のご飯より愛してる。',
'%「うっ……」',
],
'notes': {
'pre': [
'%蒼枝と申します。',
'%長編を書くのは初めてです。',
],
'post': [
'%とうとう始めてしまいま... |
# Copyright 2021 SpinQ Technology 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 ... |
import pytest
from copy import deepcopy
from stellar_sdk.keypair import Keypair
from asgiref.sync import async_to_sync
from polaris.models import Transaction, Asset
from polaris.management.commands.watch_transactions import Command
test_module = "polaris.management.commands.watch_transactions"
SUCCESS_PAYMENT_TRANSA... |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By:
# Maintained By:
from ggrc import db
from sqlalchemy.ext.associationproxy import association_proxy
from .categorization import Categorization
from ... |
import operator_benchmark as op_bench
import torch
"""Microbenchmarks for quantized batchnorm operator."""
batchnorm_configs_short = op_bench.config_list(
attr_names=["M", "N", "K"],
attrs=[
[1, 256, 3136],
],
cross_product_configs={
'device': ['cpu'],
'dtype': (torch.qint8,),... |
import Anton as aen
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy.stats import linregress
def changeCelsius(path):
files = aen.searchfiles(path, '.npy')
files.sort()
for i in files:
fname,name = os.path.split(i)
if 'Celsius' in name:
nm = name.split('C... |
# emacs: at the end of the file
# ex: set sts=4 ts=4 sw=4 et:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #
"""
Stub file for a guaranteed safe import of duecredit constructs: if duecredit
is not available.
To use it, place it into your project codebase to be imported, e.g. copy as
... |
"""
This component provides HA sensor for Netgear Arlo IP cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.arlo/
"""
import logging
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant.const impo... |
import re
from billy.scrape.committees import CommitteeScraper, Committee
import lxml.html
class CommitteeDict(dict):
def __missing__(self, key):
(chamber, committee_name, subcommittee_name) = key
committee = Committee(chamber, committee_name)
if subcommittee_name:
committee... |
from dataclasses import dataclass, field
from typing import List
__NAMESPACE__ = "NISTSchema-SV-IV-list-anyURI-length-2-NS"
@dataclass
class NistschemaSvIvListAnyUriLength2:
class Meta:
name = "NISTSchema-SV-IV-list-anyURI-length-2"
namespace = "NISTSchema-SV-IV-list-anyURI-length-2-NS"
valu... |
"""
Здесь собраны все команды настроек
"""
import json
from vkbottle.user import Blueprint, Message
from utils.edit_msg import edit_msg
from utils.emojis import ENABLED, DISABLED, ERROR
from filters import ForEveryoneRule
bp = Blueprint("Settings command")
@bp.on.message(ForEveryoneRule("settings"), text="<prefix>... |
#!/usr/bin/env python
"""Types-related part of GRR API client library."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from typing import Any
from grr_api_client import errors
from grr_api_client import utils
from grr_response_proto import flows_pb2
... |
# Copyright (c) 2016-2017, 2019, 2021 Arm Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of t... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
"""
Django settings for aptitude_32653 project.
Generated by 'django-admin startproject' using Django 2.2.2.
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/
"""
impor... |
#!/usr/bin/env python
# Copyright 2019 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 require... |
import shutil
import os
import string
class ArrangeScripts:
def __init__(self, path_to_folder):
self.folders = ['a_e', 'f_j', 'k_o', 'p_t', 'u_z']
self.folder_mapping = {}
for alphabet in list(string.ascii_lowercase):
if alphabet in list('abcde'):
self.folder_ma... |
# CHILDES XML Corpus Reader
# Copyright (C) 2001-2019 NLTK Project
# Author: Tomonori Nagano <tnagano@gc.cuny.edu>
# Alexis Dimitriadis <A.Dimitriadis@uu.nl>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for the XML version of the CHILDES corpus.
"""
__docformat__ = "... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... |
import requests
from flask import Flask, Response, jsonify
from flask import request as flask_request
from flask_caching import Cache
from ddtrace import tracer, patch
from ddtrace.contrib.flask import TraceMiddleware
from bootstrap import create_app
from models import Thought
from time import sleep
patch(redis=T... |
import rospy
from ackermann_msgs.msg import AckermannDriveStamped
from threading import Thread
import time
import argparse
import numpy as np
try:
from geometry_msgs.msg import PoseStamped
except ImportError:
pass
try:
from car.sensors import Sensors
except ImportError:
from sensors import Sensors
P... |
import os
import sys
import regex as re
from oboe.utils import slug_case, md_link, render_markdown, find_tags
from oboe.format import (
format_tags, format_blockrefs, format_highlights, format_links, format_code_blocks
)
from oboe.Link import Link
from oboe import LOG
from oboe import GLOBAL
import copy
class Not... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Helpers for the mass downloader.
Intended to simplify and stabilize the logic of the mass downloader and make
it understandable in the first place.
:copyright:
Lion Krischer (krischer@geophysik.uni-muenchen.de), 2014-2015
:license:
GNU Lesser General Public Li... |
from flask import Flask
import log_config
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route('/post/<int:post_id>')
def show_post(post_id):
# show the post with the given id, the id is an integer
return 'Post %d' % post_id |
from __future__ import annotations
from abc import ABC
from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict, List, Optional
class MetricStatisticsType(Enum):
MAX: str = 'MAX'
MIN: str = 'MIN'
P90: str = 'P90'
MEAN: str = 'MEAN'
COUNT: str = 'COUNT'
VALUE: str =... |
# coding: utf-8
import torch
from torch import nn
import math
import numpy as np
from torch.nn import functional as F
def position_encoding_init(n_position, d_pos_vec, position_rate=1.0,
sinusoidal=True):
''' Init the sinusoid position encoding table '''
# keep dim 0 for padding t... |
# coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Wflscoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test running wflscoind with the -rpcbind and -rpcallowip options."""
import sys
from test_framework.... |
import nose
import angr
import subprocess
import sys
import logging
l = logging.getLogger('angr.tests.test_signed_div')
import os
test_location = os.path.dirname(os.path.realpath(__file__))
def test_signed_div():
if not sys.platform.startswith('linux'):
raise nose.SkipTest() # this is not technically ... |
import click
from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_processor
from ocrd_anybaseocr.cli.ocrd_anybaseocr_cropping import OcrdAnybaseocrCropper
from ocrd_anybaseocr.cli.ocrd_anybaseocr_deskew import OcrdAnybaseocrDeskewer
from ocrd_anybaseocr.cli.ocrd_anybaseocr_binarize import OcrdAnybaseocrBinarize... |
"""
Argo Workflows API
Argo Workflows is an open source container-native workflow engine for orchestrating parallel jobs on Kubernetes. For more information, please see https://argoproj.github.io/argo-workflows/ # noqa: E501
The version of the OpenAPI document: VERSION
Generated by: https://openapi-g... |
#!/usr/bin/env python
# SMTP transmission with manual EHLO - Chapter 13 - ehlo.py
import sys, smtplib, socket
if len(sys.argv) < 4:
print("usage: %s server fromaddr toaddr [toaddr...]" % sys.argv[0])
sys.exit(2)
server, fromaddr, toaddrs = sys.argv[1], sys.argv[2], sys.argv[3:]
message = """To: %s
From: %s
... |
import setuptools
from os import path
path_to_repo = path.abspath(path.dirname(__file__))
with open(path.join(path_to_repo, 'readme.md'), encoding='utf-8') as f:
long_description = f.read()
required_pypi = [
'corels==1.1.29', # we only provide a basic wrapper around corels
# optionally requires cvxpy for... |
# coding: utf-8
"""
LogicMonitor REST API
LogicMonitor is a SaaS-based performance monitoring platform that provides full visibility into complex, hybrid infrastructures, offering granular performance monitoring and actionable data and insights. logicmonitor_sdk enables you to manage your LogicMonitor account... |
import os
import json
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from collections import OrderedDict
from sg2im.utils import timeit, bool_flag, LossManager
from sg2im.utils import int_tuple, float_tuple, str_tuple
from sg2im.data.vg import... |
# encoding: utf-8
import os
import xlwt
from xlrd import open_workbook
from xlutils.copy import copy
tittle_style = xlwt.easyxf(
'font: height 240, name Arial Black, colour_index black, bold on; align: wrap on, vert centre, horiz center;')
normal_style = xlwt.easyxf(
'font: height 240, name Arial, colour_inde... |
import os
import errno
import math
import shutil
def get_range_paral_chunk(total_num_item, chunk_pair):
num_item_each_chunk = int(math.ceil(float(total_num_item) / float(chunk_pair[1])))
range_lower = num_item_each_chunk * (chunk_pair[0] - 1)
# range_upper = num_item_each_chunk * chunk_pair[0] - 1
ran... |
# encoding: utf-8
"""
@author: sherlock
@contact: sherlockliao01@gmail.com
"""
from .registry import * |
# -*- coding: utf-8 -*-
"""The log2timeline CLI tool."""
from __future__ import unicode_literals
import argparse
import os
import sys
import time
import textwrap
from dfvfs.lib import definitions as dfvfs_definitions
import plaso
# The following import makes sure the output modules are registered.
from plaso impor... |
"""
File: bouncing_ball.py
Name: Ruby
-------------------------
This file uses campy module to
simulate ball bouncing on a GWindow object
"""
from campy.graphics.gobjects import GOval
from campy.graphics.gwindow import GWindow
from campy.gui.events.timer import pause
from campy.gui.events.mouse import onmouseclicked
... |
# flake8: noqa
__docformat__ = "restructuredtext"
# Let users know if they're missing any of our hard dependencies
hard_dependencies = ("numpy", "pytz", "dateutil")
missing_dependencies = []
for dependency in hard_dependencies:
try:
__import__(dependency)
except ImportError as e:
missing_depe... |
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
from functools import reduce
from typing import List, Optional, Union
import requests # type: ignore
from bs4 import BeautifulSoup
from kabutobashi.errors import KabutobashiPageError
from .us... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2016, Virginia Tech
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of condi... |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import subprocess
from hashlib import sha1
from textwrap import dedent
from pex.common import safe_mkdir, safe_open, temporary_dir, touch
from pex.compatibility import to_bytes
... |
import unittest
import logging
from footprint.models import Audio
from footprint.models import Project
import footprint.clients as db
import os
import random
import footprint.tokenizers as tokenizers
import footprint.evaluators as evaluators
import librosa
class TestEvalFingerprintDummy(unittest.TestCase):
'''
Tes... |
r"""
Knots
AUTHORS:
- Miguel Angel Marco Buzunariz
- Amit Jamadagni
"""
#*****************************************************************************
# Copyright (C) 2014 Travis Scrimshaw <tscrim at ucdavis.edu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... |
# -*- coding: utf-8 -*-
#
import matplotlib as mpl
from . import path as mypath
def draw_patch(data, obj):
"""Return the PGFPlots code for patches.
"""
# Gather the draw options.
data, draw_options = mypath.get_draw_options(
data, obj.get_edgecolor(), obj.get_facecolor()
)
if isinsta... |
import os
import time
import subprocess
import signal
import requests
import secrets
print('='*81)
print("Running Integration Test: {}".format(__file__))
nodes = [
['1', '0.0.0.0:8001', '0.0.0.0:81'],
['2', '0.0.0.0:8002', '0.0.0.0:82'],
['3', '0.0.0.0:8003', '0.0.0.0:83'],
['4', '0.0.0.0:8004', '0.0... |
# Copyright 2013 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... |
# 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
# distribu... |
""" string constants for office module """
fed_type = 'federal'
leg_type = 'legislative'
state_type = 'state'
loc_gov_type = 'local government'
office_type_list = [fed_type, leg_type, state_type, loc_gov_type]
office_id_str = 'Office ID '
office_key = 'office'
prezzo = 'President'
mca = 'Member of County Assembly'
wr =... |
# Copyright 2014 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.
import logging
from telemetry.core import util
from telemetry.core.backends import adb_commands
from telemetry.core.platform import device
from telemetry.cor... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The vhkdCoin Core vhkd
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test decoding scripts via decodescript RPC command."""
from test_framework.test_framework import vhkdCoinTe... |
from .retinal_lesion_dataset import RetinalLesionsDataset
from .cityscapes import CityscapesDataset
from .image_folder import ImageFolder
from .build import build_data_pipeline |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import os
class Ferret(Package):
"""Ferret is an interactive computer visualization and analysi... |
from webbot import Browser
import time
web = Browser()
web.go_to('https://www.rubangino.in/')
web.click('ABOUT')
web.click('SKILLS')
web.click('PORTFOLIO')
web.go_to('https://www.rubangino.in/android-app.html') |
"""
This folder contains 3rd party packages that are used in this Weasel project.
You can find a list of these below with their respective version.
Each one has a folder allocated, which contains their own README.md file with their licensing details (all open-source)
- dcm4che Version 5.23.1
- pyqtgraph Version 0.9.1... |
from __future__ import unicode_literals, absolute_import
from .dict import DictWriter
import json
class JsonWriter(DictWriter):
def serialize_content(self, data):
return json.dumps(data, ensure_ascii=False)
@property
def extension(self):
return 'json' |
import time
import unittest
import sys
from pathlib import Path
from base_test_class import BaseTestCase
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver import ActionChains
clas... |
#!/usr/bin/python
# ------------------------------------------------------------------------------
# KVS Regression Testing
# ------------------------------------------------------------------------------
#
# To run regression tests, a environment configuration and simulation setups
# are required. These are two pytho... |
#
# transform.py -- coordinate transforms for Ginga
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import numpy as np
from ginga import trcalc
from ginga.misc import Bunch
__all__ = ['TransformError', 'BaseTransform', 'ComposedTransform',
'In... |
def split_and_join(line):
new = line.split(" ")
return "-".join(new)
if __name__ == '__main__':
line = input()
result = split_and_join(line)
print(result) |
from PIL import Image,ImageDraw
import os
########### showing the image on the screen
image1 = Image.open('icons/io.png')
drawing_object=ImageDraw.Draw(image1)
drawing_object.rectangle((50,0,190,150), fill = None, outline ='red')
image1.show()
#display(image1) |
# 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 not u... |
import datetime
import traceback
import pytz
from rest_framework.fields import CharField
from ledger.accounts.models import EmailUser, Address
from wildlifecompliance.components.legal_case.models import (
LegalCase,
LegalCaseUserAction,
LegalCaseCommsLogEntry,
LegalCasePriority,
LegalCaseRunningSh... |
# -*- 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... |
#!/usr/bin/env python
# coding: utf-8
# # Cantilever beams - End Loaded
# 
# In[1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sn # to draw plots
# import plotly.express as px
# import ... |
"""
OCCAM
Copyright (c) 2011-2017, SRI International
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 con... |
# -*- coding: utf-8 -*-
import datetime
import fuse
import mock
import os
import six
import stat
import tempfile
import threading
import time
from girder.cli import mount
from girder.exceptions import ValidationException
from girder.models.file import File
from girder.models.setting import Setting
from girder.models.u... |
import pytest
from apirel.users.models import User
pytestmark = pytest.mark.django_db
def test_user_get_absolute_url(user: User):
assert user.get_absolute_url() == f"/users/{user.username}/" |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
# BSD 3-clause license
from __future__ import absolute_import
from __future__ import print_function
import math
from six.moves import range
# Find the best implementation available
from aetros.utils.pilutil import imresize
try:
from cStringIO i... |
"""
An example config file to train a ImageNet classifier with detectron2.
Model and dataloader both come from torchvision.
This shows how to use detectron2 as a general engine for any new models and tasks.
To run, use the following command:
python tools/lazyconfig_train_net.py --config-file configs/Misc/torchvision_i... |
##########################################################################
#
# Copyright (c) 2014, Image Engine Design 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:
#
# * Redistrib... |
from django.db import models
from django.urls import reverse
from ordercontact.models import Ordercontactinvoiceaddresse
from ordercontact.models import Ordercontactdeliveryaddresse
from sales.models import ProductionRecordInputMiniGL
from sales.models import BaseModelWithoutBeltDesign
class Minifawnordermodel(BaseM... |
import numpy as np
from .metrics import accuracy_score
class Logisticegression():
def __init__(self):
# 系数
self.coef_ = None
# 截距
self.intercept_ = None
# 向量
self._theta = None
def _sigmoid(self, t):
return 1./(1. + np.exp(-t))
def fit(self, X_train, ... |
############################################
# Copyright (C) 2018 FireEye, Inc.
#
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-BSD-3-CLAUSE or
# https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not ... |
import hycohanz as hfss
raw_input('Press "Enter" to connect to HFSS.>')
[oAnsoftApp, oDesktop] = hfss.setup_interface()
raw_input('Press "Enter" to create a new project.>')
oProject = hfss.new_project(oDesktop)
raw_input('Press "Enter" to insert a new DrivenModal design named HFSSDesign1.>')
oDesign = hfss.insert... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from containerd.services.leases.v1 import leases_pb2 as containerd_dot_services_dot_leases_dot_v1_dot_leases__pb2
from google.protobuf import empty_pb2 as google... |
#!/usr/bin/env python
import subprocess
from snc_config import SncConfig
from datetime import datetime, timedelta
import argparse
from argparse import RawTextHelpFormatter
from color_print import ColorPrint
from plugins import PluginsLoader
import os
from multiprocessing import Pool
import copy_reg
import types
from i... |
import logging
import botocore
import pytest
from flaky import flaky
from ocs_ci.ocs.bucket_utils import retrieve_test_objects_to_pod, sync_object_directory
from ocs_ci.framework import config
from ocs_ci.framework.pytest_customization.marks import acceptance, tier1, tier3
from ocs_ci.ocs.exceptions import CommandFai... |
import unittest
import trw
import torch
import numpy as np
class TestTransformsResizeModuloPadCrop(unittest.TestCase):
def test_crop_mode_torch(self):
batch = {
'images': torch.rand([2, 3, 64, 64], dtype=torch.float32)
}
tfm = trw.transforms.TransformResizeModuloCropPad(60)
... |
import re
from .base import CodingSequence
from ...helpers.files import read_and_parse_fasta_seqio
class GCContentSecondPosition(CodingSequence):
def __init__(self, args) -> None:
super().__init__(**self.process_args(args))
def run(self):
# create biopython object of sequences
record... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.