text stringlengths 2 999k |
|---|
#!/usr/bin/python3
# Anything not directly related to processing here
import sys
from math import floor
from pathlib import Path
from random import randint
import matplotlib.pyplot as plt
import numpy as np
from mp3_helper import *
from PIL import Image
np.set_printoptions(threshold=sys.maxsize)
np.set_printoptions(... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import shutil
from abc import ABC
from maro.cli.data_pipeline.utils import convert, download_file, StaticParameter, generate_name_with_uuid
from maro.utils.logger import CliLogger
logger = CliLogger(name=__name__)
class DataPipelin... |
import argparse
import pickle
import time
import pandas as pd
from sklearn.model_selection import train_test_split
from product_utils import *
from willump.evaluation.willump_executor import willump_execute
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--cascades", action="store_true", help="Cascade ... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Book.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import pymysql
pymysql.install_as_MySQLdb()
class Database:
def __init__(self) -> None:
self.__app = Flask(__name__)
self.__app.config['SQLALCHEMY_DATABASE_URI'] ='mysql://root:admin@ctn-mysql-db/school'
self.__db = SQLAlch... |
# -*- coding: utf-8 -*-
"""
Common Utilities
================
Defines common utilities objects that don't fall in any specific category.
References
----------
- :cite:`Kienzle2011a` : Kienzle, P., Patel, N., & Krycka, J. (2011).
refl1d.numpyerrors - Refl1D v0.6.19 documentation. Retrieved January 30,
2015, ... |
#!/usr/bin/env python3
"""
Author : Ken Youens-Clark<kyclark@gmail.com>
Date : 2020-04-01
Purpose: Add census block group to file containing lat/lon
"""
import argparse
import os
import shapefile
import sys
import csv
from shapely.geometry import shape, Point
# --------------------------------------------------
de... |
# 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... |
import os
import spf
import re
import sys
def validate_spf(from_addr, server_ip, server_mx):
try:
x = spf.check2(i=server_ip, s=from_addr, h=server_mx)
if x[0] == "pass":
return {'spf': True, 'data':x[1]}
return {'spf': False, 'data':None}
except Exception as e:
ret... |
import numpy
from hypothesis import given, strategies, Settings
import mwdust
@given(strategies.floats(min_value=0.,max_value=360.,
allow_nan=False,allow_infinity=False),
strategies.floats(min_value=-90.,max_value=90.,
allow_nan=False,allow_infinity=False),
... |
# -*- coding: utf-8 -*-
'''
Try to find out how many zeros a given number has at the end.
Input: A positive Int
Output: An Int.
'''
def end_zeros(number):
# your code here
strNumber = str(number)
count = 0
for value in strNumber[::-1]:
if (value != '0'):
break
count += ... |
#Printing stars in 'U' shape!
'''
* *
* *
* *
* *
***
'''
for row in range(5):
for col in range(5):
if(col==0 or col==4) and( row!=4) or (row==4 and col>0 and col <4):
print('*',end='')
else:
print(end=' ')
print() |
# Copyright 2013 NEC 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('bluesteel', '0003_bluesteellayoutentry_collect_commits_path'),
]
operations = [
migrations.AddField(
model_name=... |
""" test get/set & misc """
from datetime import timedelta
import numpy as np
import pytest
from pandas.core.dtypes.common import is_scalar
import pandas as pd
from pandas import Categorical, DataFrame, MultiIndex, Series, Timedelta, Timestamp
import pandas._testing as tm
from pandas.tseries.offsets import BDay
... |
import csv
import tkinter as tk
import tkinter.ttk as ttk
class App(tk.Tk):
def __init__(self, path):
super().__init__()
self.title("Ttk Treeview")
columns = ("#1", "#2", "#3")
self.tree = ttk.Treeview(self, show="headings", columns=columns)
self.tree.heading("#1", text="L... |
import uuid
from datetime import datetime
import pytest
from sirius_sdk import Agent, Pairwise
@pytest.mark.asyncio
async def test_pairwise_list(agent1: Agent, agent2: Agent):
await agent1.open()
await agent2.open()
try:
did1, verkey1 = await agent1.wallet.did.create_and_store_my_did()
d... |
import numpy as np
from typing import List, Union, NoReturn
from IMLearn.base.base_module import BaseModule
from IMLearn.base.base_estimator import BaseEstimator
from IMLearn.desent_methods import StochasticGradientDescent, GradientDescent
from .modules import FullyConnectedLayer
class NeuralNetwork(BaseEstimator, Ba... |
import re
import string
from collections import Counter
from nltk.tokenize import TreebankWordTokenizer, sent_tokenize
from nltk.translate.meteor_score import single_meteor_score
# from torchseq.utils.bleu import compute_bleu
from torchseq.utils.sari import SARIsent
import sacrebleu
def tokenize(text):
# retur... |
from binance_f import RequestClient
from binance_f.constant.test import *
from binance_f.base.printobject import *
request_client = RequestClient(api_key=g_api_key, secret_key=g_secret_key)
# result = request_client.get_liquidation_orders()
result = request_client.get_top_long_short_accounts(symbol="BTCUSDT", ... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class BeerAdvocatePipeline(object):
def process_item(self, item, spider):
return item
|
import joblib
import pickle
import os
import config
import pandas as pd
import click
def load_model_helper(file_path):
if os.path.split(".")[-1] == "pickle":
return pickle.load(open(file_path, 'wb'))
return joblib.load(file_path)
def fetch_artist_columns(df, artist_list):
return [artist for ... |
import os
from datetime import timedelta
from dotenv import load_dotenv
load_dotenv(os.path.join(os.path.dirname(__file__), '.env'))
class Config:
TEST = {
'database': 'test_default',
}
_DATABASES = {
'type': '',
'username': '',
'password': '',
'host': '',
'... |
import tensorflow as tf
from Models.BasicModel import BasicModel
class Model(BasicModel):
def __init__(self,
learning_rate,
init_word_embed,
init_idiom_embed,
size_embed=200,
num_units=100, # make sure that num_units = size_embed ... |
#!/usr/bin/python3
import os
import boto3
import covid_scraper as cs
from botocore.exceptions import ClientError
from mimetypes import guess_type
INDEX='index.html'
CZECH_DATA='czechia_table.csv'
S3_DIR='data'
TMP='/tmp/'
# Client for operation with S3
# Requires IAM policy for S3 with following permissions:
# GetObj... |
# coding=utf-8
#
# Copyright 2014-2016 F5 Networks 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 la... |
import mkdocs
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from hwt.hdl.constants import Time, READ, WRITE, NOP
from hwtLib.abstract.discoverAddressSpace import AddressSpaceProbe
from hwtLib.amba.axiLite_comp.endpoint_test import AxiLiteEndpointTC, \
addrGetter, structTwoFieldsDense, \
structTwoFieldsDenseStart, AxiLiteEn... |
"""
Copyright 2020 Jackpine Technologies Corporation
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 ... |
from sklearn.base import BaseEstimator
from collections import defaultdict
from lcs import lat_lng
from fastdtw import fastdtw
from haversine import haversine
import numpy as np
class KNN(BaseEstimator):
def __init__(self, n_neighbors=5):
self.n_neighbors = n_neighbors
def fit(self,data,tar... |
# version: 2.001
import time
import telnetlib
"""
<title>Testing Telnet Lib</title>
<description>This test is connecting to a TELNET host, using the default Pythin lib.
If you need something more advanced, use Twister Telnet library.</description>
"""
def test():
'''
Testing Python standard Telnet library.
'''
... |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, 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... |
from ..builder import DETECTORS
from .single_stage import SingleStageDetector
@DETECTORS.register_module()
class FOVEA(SingleStageDetector):
"""Implementation of `FoveaBox <https://arxiv.org/abs/1904.03797>`_"""
def __init__(self,
backbone,
neck,
bbox_head,
... |
"""
Trading-Technical-Indicators (tti) python library
File name: example_machine_learning_dt.py
Example code for the trading technical indicators library, Machine Learning
features (DT model).
"""
import pandas as pd
from tti.ml import MachineLearningDT
# Read data from csv file. Set the index to the correct... |
# 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! ***
# Export this package's modules as members:
from .get_remote_rendering_account import *
from .list_remote_rendering_account_keys import *
from .remote_... |
'''
A module for representing the orthophonology of a language:
the mapping from orthographic representations to IPA symbols.
Based on many ideas in cltk.phonology.utils by Clément Besnier <clemsciences@gmail.com>.
'''
from enum import IntEnum, auto
from copy import deepcopy
from functools import reduce
im... |
r"""
Conductor and Reduction Types for Genus 2 Curves
AUTHORS:
- Qing Liu and Henri Cohen (1994-1998): wrote genus2reduction C
program
- William Stein (2006-03-05): wrote Sage interface to genus2reduction
- Jeroen Demeyer (2014-09-17): replace genus2reduction program by PARI
library call (:trac:`15808`)
ACKNOW... |
# 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 ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
#: A list of Romanian counties as `choices` in a formfield.
COUNTIES_CHOICES = (
('AB', 'Alba'),
('AR', 'Arad'),
('AG', 'Argeș'),
('BC', 'Bacău'),
('BH', 'Bihor'),
('BN', 'Bistrița-Năsăud'),
('BT', 'Botoșani'),
('BV', 'Braș... |
'''
* Project : Screenipy
* Author : Pranjal Joshi
* Created : 28/04/2021
* Description : Class for analyzing and validating stocks
'''
import sys
import math
import numpy as np
import pandas as pd
import talib
import classes.ConfigManager as ConfigManager
f... |
"""
A minimalistic version helper in the spirit of versioneer, that is able to run without build step using pkg_resources.
Developed by P Angerer, see https://github.com/flying-sheep/get_version.
"""
import re
import os
from pathlib import Path
from subprocess import run, PIPE, CalledProcessError
from typing import Nam... |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-12-28 21:12
from hanlp_common.constant import HANLP_URL
SIGHAN2005_PKU_CONVSEG = HANLP_URL + 'tok/sighan2005-pku-convseg_20200110_153722.zip'
'Conv model (:cite:`wang-xu-2017-convolutional`) trained on sighan2005 pku dataset.'
SIGHAN2005_MSR_CONVSEG = HANLP_URL + 't... |
#!/usr/bin/env python3
import json
import os
import shutil
import signal
import tempfile
import unittest
from unittest import mock
from torch.distributed.elastic.multiprocessing.errors import (
ChildFailedError,
ProcessFailure,
record,
)
from torch.distributed.elastic.multiprocessing.errors.error_handler i... |
# plays conway game of life, showing a set of initial boards
# that will lead to the provided end board
import os
##############################
# create combination of characters
# construct recursively
def combSimp(val,numVal,soFar,left,acc):
# go through each val
if len(left) == 0 or numVal == 0:
acc.append... |
import os
# list all include directories
include_directories = [os.path.sep.join(x.split('/')) for x in ['extension/parquet/include', 'third_party/parquet', 'third_party/snappy', 'third_party/thrift', 'third_party/zstd']]
# source files
source_files = [os.path.sep.join(x.split('/')) for x in ['extension/parquet/parquet... |
# -*- coding: utf-8 -*-
"""
Tests for connection shell
"""
__author__ = 'Marcin Usielski, Michal Ernst'
__copyright__ = 'Copyright (C) 2018-2019, Nokia'
__email__ = 'marcin.usielski@nokia.com, michal.ernst@nokia.com'
import getpass
import pytest
from moler.cmd.unix.ls import Ls
from moler.cmd.unix.ping import Ping
... |
print("Starting hyperparameter tuning on Idun")
import os
import helpers.hp_tuning.hp_gen
from tabGAN import TabGAN
from src import constants as const
import numpy as np
import pandas as pd
n_epochs = 100
n_critic = 10
opt_lr = 0.0002
adam_beta1 = 0.5
noise_discrete_unif_max = 0
batch_size = 500
progress... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayUserAntpaasUseridGetResponse(AlipayResponse):
def __init__(self):
super(AlipayUserAntpaasUseridGetResponse, self).__init__()
self._user_id = None
@property... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ..extern import six
from ..extern.six import text_type
from ..extern.six.moves import zip, range
import os
import sys
import re
import numpy... |
import numpy as np
import openmdao.api as om
from ....utils.rk_methods import rk_methods
from ....utils.misc import get_rate_units
from ....options import options as dymos_options
class RungeKuttaKComp(om.ExplicitComponent):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._no_check... |
_base_ = [
'../_base_/models/segformer_mit-b0.py',
'../_base_/datasets/cityscapes_1024x1024_repeat.py',
'../_base_/default_runtime.py',
'../_base_/schedules/schedule_160k_adamw.py'
]
# model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
find_unused_parameters = True
model = dict(
type... |
import torch
import torch.nn as nn
from pytorch_models.MF import BaseMF
class GMF(BaseMF):
def __init__(self, hyper_params):
super(GMF, self).__init__(hyper_params)
self.final = nn.Linear(hyper_params['latent_size'], 1)
self.dropout = nn.Dropout(hyper_params['dropout'])
def g... |
from common.commons import *
if __name__ == '__main__':
try:
args = getRun()
setLogg()
setEnv(args)
job = args.job
# job = "cluster"
ROOT_DIR = os.environ["ROOT_DIR"]
REPO_PATH = os.environ["REPO_PATH"]
CODE_PATH = os.environ["CODE_PATH"]
... |
from .field import Field
from .booleanfield import BooleanField
from .datetimefield import DateTimeField
from .dictionaryfield import DictionaryField
from .floatfield import FloatField
from .foreignfield import ForeignField
from .abstractforeignfield import AbstractForeignField
from .integerfield import IntegerField
f... |
import os, sys, argparse, subprocess
import json
from dcicutils import ff_utils, s3_utils
import boto3
'''
Possible future upgrades:
- Build pubic docker image within post/patch script (would require Dockerfiles for each image)
- Replace try/except with query to database for the post/patch steps
'''
def main(ff_env='... |
# Name: ChgcarSource
import inviwopy as ivw
import ivwdataframe as df
import atomdata
import vasputil
import functools
import math
import numpy
from pathlib import Path
# Descriotion found at https://cms.mpi.univie.ac.at/wiki/index.php/CHGCAR
class ChgcarSource(ivw.Processor):
def __init__(self, id, name):
... |
from model_mommy.recipe import Recipe, seq
from blog.models import Entry
from django.utils import timezone
entry = Recipe(
Entry,
title=seq('Title #'),
content=seq('Bloggerino #'),
created=timezone.now,
modified=timezone.now,
)
|
"""
__M4IfClauseIsolatedConnected_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modify directly)
Author: gehan
Modified: Wed Oct 23 16:58:03 2013
_________________________________________________________________________________________
"""
from stickylink ... |
import h5py as h5
import numpy as np
import configparser
import os
import sharpy.utils.algebra as algebra
case_name = 'smith_g_4deg'
route = os.path.dirname(os.path.realpath(__file__)) + '/'
# flight conditions
u_inf = 25
rho = 0.08891
alpha = 4
beta = 0
c_ref = 1
b_ref = 16
sweep = 0*np.pi/180.
aspect_ratio = 32 #... |
import os
import pickle
import yaml
# first 12 are "things", next 15 are "stuff"
# arbitrary order as long as things first, then stuff
_sorted_coarse_names = [
"electronic-things", # 0
"appliance-things", # 1
"food-things", # 2
"furniture-things", # 3
"indoor-things", # 4
"kitchen-things", # 5
"ac... |
# coding: utf-8
"""
Yapily API
To access endpoints that require authentication, use your application key and secret created in the Dashboard (https://dashboard.yapily.com) # noqa: E501
OpenAPI spec version: 0.0.155
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __fu... |
# Generated by Django 4.0.3 on 2022-03-27 10:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pictures', '0010_galore_image_pic'),
]
operations = [
migrations.AlterField(
model_name='galore',
name='image_pic',
... |
from __future__ import unicode_literals, absolute_import, division, print_function
import json
import re
import logging
import os, sys, time
if __name__ == '__main__':
sys.path.append(os.path.dirname(sys.path[0]))
else:
sys.path.append(sys.path[0]+"\\plugin")
from provider import *
class Proxy(ProxyWithWebd... |
import torch.nn as nn
import torch.nn.functional as F
import torch
from torchvision.models import vgg19
import math
class FeatureExtractor(nn.Module):
def __init__(self):
super(FeatureExtractor, self).__init__()
vgg19_model = vgg19(pretrained=True)
self.feature_extractor = nn.Sequential(*l... |
# bondy documentation build configuration file, created by
# sphinx-quickstart.
#
# 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
# autogenerated file.
#
# All configuration values have a default; values that are co... |
# Generated by Django 2.2 on 2021-06-17 19:36
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('profiles_api', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
""" Webhook.
Do not edit this file by hand.
This is generated by parsing api.html service doc.
"""
from ambra_sdk.exceptions.service import AccountNotFound
from ambra_sdk.exceptions.service import CustomNotHash
from ambra_sdk.exceptions.service import IncompleteFilter
from ambra_sdk.exceptions.service import InvalidCr... |
from django.db import models
from django.contrib.auth.models import User
from django.dispatch import receiver
from django.db.models.signals import post_save
class Area(models.Model):
area_name = models.CharField(max_length=50, blank=True)
area_photo = models.ImageField(upload_to='areapics/')
population = ... |
from __future__ import absolute_import, print_function
from ..utils import logger, get_progress_bar
import numpy as np
import os
from .emcee import Emcee
class Kombine(Emcee):
"""bilby wrapper kombine (https://github.com/bfarr/kombine)
All positional and keyword arguments (i.e., the args and kwargs) passed t... |
import main
import robocup
import behavior
import constants
import enum
import standard_play
import evaluation.ball
import evaluation.passing_positioning
import tactics.coordinated_pass
import tactics.defensive_forward
import tactics.simple_zone_midfielder
import tactics.advance_zone_midfielder
import skills.move
impo... |
#!/usr/bin/python
# Written by Stjepan Horvat
# ( zvanstefan@gmail.com )
# by the exercises from David Lucal Burge - Perfect Pitch Ear Traning Supercourse
# Thanks to Wojciech M. Zabolotny ( wzab@ise.pw.edu.pl ) for snd-virmidi example
# ( wzab@ise.pw.edu.pl )
import random
import sys
sys.path.append("/home/schef/gith... |
"""
Support for deCONZ light.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light.deconz/
"""
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH, ATTR_HS_COLOR,
ATTR_TRANSITION, EFFECT_COLORLO... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import reagent.types as rlt
import torch
from reagent.gym.types import GaussianSamplerScore, Sampler
class GaussianSampler(Sampler):
def __init__(self, actor_network):
self.actor_network = actor_network
de... |
# Copyright 2017 Vector Creations 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 in ... |
import py, sys
from pypy.interpreter.astcompiler import codegen, astbuilder, symtable, optimize
from pypy.interpreter.pyparser import pyparse
from pypy.interpreter.pyparser.test import expressions
from pypy.interpreter.pycode import PyCode
from pypy.interpreter.pyparser.error import SyntaxError, IndentationError
from p... |
from ._anvil_designer import query_viewerTemplate
from anvil import *
import anvil.server
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
class query_viewer(query_viewerTemplate):
def __init__(self, title_label, **properties):
# Set Form properties and Data Bindin... |
"""
sphinx.roles
~~~~~~~~~~~~
Handlers for additional ReST roles.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import warnings
from typing import Any, Dict, List, Tuple, Type
from typing import TYPE_CHECKING
from docutils ... |
from upcloud_api.upcloud_resource import UpCloudResource
class IPAddress(UpCloudResource):
"""
Class representation of the API's IP address. Extends UpCloudResource.
Attributes:
access -- "public" or "private"
address -- the actual IPAddress (string)
family -- IPv4 or IPv6
part_of_plan --... |
"""
Misc. helper functions used in Empire.
Includes:
validate_ip() - uses iptools to validate an IP
validate_ntlm() - checks if the passed string is an NTLM hash
generate_ip_list() - generates an IP range list from a variety of inputs
random_string() - returns a random string of the specified number ... |
from django.dispatch.dispatcher import Signal
from location.models import LocationSnapshot
location_updated = Signal(providing_args=['user', 'from_', 'to'])
location_changed = Signal(providing_args=['user', 'from_', 'to'])
class watch_location(object):
def __init__(self, user):
self.user = user
de... |
from modelseedpy.core.msgenome import MSFeature, MSGenome, parse_fasta_str
def test_parse_fasta_str1():
faa_str = """
>NP_414543.1 fused aspartate kinase/homoserine dehydrogenase 1
MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAA
AQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICR... |
# -*- coding: utf-8 -*-
"""Module for interacting with a Yale Doorman lock."""
from enum import Enum
from typing import TYPE_CHECKING, Any, Dict, Iterator, Optional, cast
from requests import RequestException
from .exceptions import AuthenticationError
if TYPE_CHECKING:
from .auth import YaleAuth
... |
import psutil
import logging
import win32process
import ctypes
import ctypes.wintypes
import rwmem.exception
import rwmem.memory
from typing import Optional
__version__ = "0.0.1"
__author__ = "duel"
__date__ = "23/12/2021"
PROCESS_QUERY_INFORMATION = 0x0400
PROCESS_VM_OPERATION = 0x0008
PROCESS_VM_READ = 0x0010
PR... |
#!/usr/bin/env python
"""Voted ensembling for tagging."""
from typing import Iterable
import argparse
import collections
import logging
import sys
import ensembling
import textproto
def vote(all_tags: Iterable[str]) -> str:
"""Max-voting ensembling strategy.
This implements an unweighted max-voting scheme... |
# 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... |
# Generated by Django 2.1 on 2018-09-01 12:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0011_auto_20180802_0155'),
]
operations = [
migrations.AddField(
model_name='transaction',
name='amount',
... |
# Copyright (c) Matthew David Miller. All rights reserved.
# Licensed under the MIT License.
# Simple script to clear log files I have setup.
# Libraries to import.
import subprocess
# Variables to edit based on configuration.
log_1 = '/home/matthew/logs/update.log'
log_2 = '/home/matthew/logs/send_ip_address.log... |
""" Read position errors from excel for statistical analysis
"""
import os
from stentseg.utils.datahandling import select_dir
import openpyxl # http://openpyxl.readthedocs.org/
import numpy as np
from lspeas.utils.normality_statistics import paired_samples_ttest
def read_error_cam123(exceldir, workbook, pr... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... |
from app.dao.Produto_dao import Produto_dao
class Produto_service(object):
def salvar(self, produto):
p = self.filter_nome(produto.nome)
if p == None:
produto.salvar()
return {'mensagem':'Produto cadastrado com sucesso'}
else:
return {'mensag... |
# Generated by Django 3.1.1 on 2020-12-02 13:26
import uuid
import django.db.models.deletion
import django_extensions.db.fields
from django.conf import settings
from django.db import migrations, models
import grandchallenge.core.storage
class Migration(migrations.Migration):
initial = True
dependencies =... |
"""
Test cases for IRIS SJIMap
"""
import pytest
import astropy.units as u
from sunpy.data.test import get_dummy_map_from_header, get_test_filepath
from sunpy.map.sources.iris import SJIMap
from sunpy.util.exceptions import SunpyMetadataWarning
__author__ = 'Pritish C. (VaticanCameos)'
@pytest.fixture
def irismap(... |
import sys
import unittest
import re
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from Exscript.protocols.osguesser import OsGuesser
from Exscript.protocols import drivers
class OsGuesserTest(unittest.TestCase):
CORRELATE = OsGuesser
def setUp(self):
self.s... |
#!/usr/bin/env python
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
import bcc
import ctypes
import errno
import os
import subprocess
import shutil
import time
import unittest
class TestUprobes(unittest.TestCase):
def test_simple_library(self):
text = """
... |
# author: gorquan <gorquanwu@gmail.com>
# date: 2019.7.21
import json
class RequestMsg():
def __init__(self, comment, flag):
self.comment = comment
self.flag = flag
def accept(self):
replyMessage = {"action": "set_friend_add_request",
"params": {
... |
import src.c2oObject as Node
##-----------------------------BatchNormalization层 = BatchNorm + Scale-------------------------------------##
#获取超参数
def getBNAttri(layer):
#超参数字典
dict = {"epsilon": layer.batch_norm_param.eps, # 滑动系数
"momentum": layer.batch_norm_param.moving_average_fraction
... |
from django.test import TestCase
from taskmaster.models import *
class DependencyTestCase(TestCase):
def setUp(self):
self.group = JobGroup.objects.create(name="pizza maker group")
self.job1 = self.group.new_job(name="tony job")
self.job2 = self.group.new_job(name="steve job")
self.job3 = self.group.new_job(n... |
import json
from io import BytesIO
from unittest.mock import patch
from django.contrib.auth import models as auth_models
from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.http.request import HttpRequest
from django.urls import reverse
from django.utils.encoding impo... |
#!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
# definimos la funcion de callback que sera la que se active cuando recibamos
# un msg
def callback(msg):
print(msg.data)
rospy.init_node('topic_subscriber')
subscriber = rospy.Subscriber('counter', Int32, callback)
rospy.spin()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.