text stringlengths 2 999k |
|---|
import defaultValues_global
defaultValues_global.chpl_setup()
e = 3
defaultValues_global.foo(e)
defaultValues_global.foo()
defaultValues_global.chpl_cleanup()
|
"""
Test script for doctest.
"""
from test import support
import doctest
import functools
import os
import sys
# NOTE: There are some additional tests relating to interaction with
# zipimport in the test_zipimport_support test module.
######################################################################
## S... |
from gym.envs.maithra.erdosgame import ErdosGameEnv
from gym.envs.maithra.erdosgameselfplay import SelfPlayErdosGameEnv
from gym.envs.maithra.erdosgameattacker import ErdosGameAttackerEnv
from gym.envs.maithra.erdosgamecattacker import ErdosGameCAttackerEnv
from gym.envs.maithra.erdosgame_smallK import ErdosGameSmallKE... |
# -*- coding: utf-8 -*-
from email.header import Header
from openprocurement.api.utils import get_now
def not_found(self):
response = self.app.get("/contracts/some_id/documents", status=404)
self.assertEqual(response.status, "404 Not Found")
self.assertEqual(response.content_type, "application/json")
... |
# 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 4.0.2 on 2022-02-14 15:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("spid_cie_oidc_entity", "0003_federationentityconfiguration_constraints"),
]
operations = [
migrations.AlterField(
model_name="fe... |
import sys
import pathlib
# Append parent directory of this file to sys.path,
# no matter where it is run from
base_path = pathlib.Path(__file__).parent.parent.absolute()
sys.path.insert(0, base_path.as_posix())
import pickle
import os
import torch
import torch.nn.functional as F
import torch.nn as nn
import torchvis... |
import logging
import warnings
from marvin.tools.maps import Maps
import astropy.units as u
import astropy.wcs as wcs
import astropy.constants as constants
from astropy.cosmology import WMAP9
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from... |
import os
from pathlib import Path
import pytest
from starkware.starknet.public.abi import get_selector_from_name
from starknet_py.contract import Contract
from starknet_py.net.client import BadRequest
from starknet_py.net.models import InvokeFunction
from starknet_py.tests.e2e.utils import DevnetClient
from starknet... |
"""Ledger admin routes."""
from aiohttp import web
from aiohttp_apispec import docs, querystring_schema, request_schema, response_schema
from marshmallow import fields, validate
from ..admin.request_context import AdminRequestContext
from ..messaging.models.openapi import OpenAPISchema
from ..messaging.valid import ... |
"""
Tests for utilities.py
"""
import unittest
from src import constants as c
from src import data_loader as dload
class TestDataLoader(unittest.TestCase):
"""Test utilities"""
# ------------------------------ io ------------------------------------------------------------
def test_dropbox_connecto... |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'APITestProject.settings')
try:
from django.core.management import execute_from_command_line
exce... |
#!/usr/bin/env python
#
# phm documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# 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 con... |
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2018 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... |
# 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 torch
import random
import numpy as np
import torch.nn.functional as F
from torch import optim, nn
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torchvision import transforms
import time
from config import *
from resnext import D4Net
# from util.folder_mvtec im... |
from typing import List, Union
from sympy import Symbol
def apply_add_mul_operator(operator: str, operand_1, operand_2):
if operator == "*":
return operand_1 * operand_2
elif operator == "+":
return operand_1 + operand_2
def postfix_tokens_to_symbol(postfix_token_symbols: List[Union[str, Sy... |
import json
import torch
from torch.autograd import Variable
from warpctc_pytorch import CTCLoss
import torch.nn.functional as F
import sys
### Import Data Utils ###
sys.path.append('../')
from experiments.ml.specaugment.mlcommons.training.speech_recognition.data.bucketing_sampler import BucketingSampler, Spectrogr... |
import json
RESPONSE = """
<!DOCTYPE html>
<html>
<head>
<title>Clear-Site-Data</title>
<script src="test_utils.sub.js"></script>
</head>
<body>
<script>
/**
* A map between a datatype name and whether it is empty.
* @property Object.<string, boolean>
*/
var report = ... |
# coding: utf-8
# pylint: disable = invalid-name, W0105, C0111, C0301
"""Scikit-learn wrapper interface for LightGBM."""
from __future__ import absolute_import
import numpy as np
import warnings
from .basic import Dataset, LightGBMError
from .compat import (SKLEARN_INSTALLED, _LGBMClassifierBase,
... |
from django.shortcuts import render
# Create your views here.
def index(request):
return render(request, 'index.html', {}) |
__all__ = [
'TreeNode',
'MAryTreeNode',
'LinkedListNode',
'BinomialTreeNode',
'AdjacencyListGraphNode',
'AdjacencyMatrixGraphNode',
'GraphEdge',
'Set',
'CartesianTreeNode'
]
_check_type = lambda a, t: isinstance(a, t)
NoneType = type(None)
class Node(object):
"""
Abstract c... |
from django.shortcuts import render, redirect
from django.contrib.auth import update_session_auth_hash
from bank.app.forms.register import RegisterForm
from bank.app.forms.profile import ProfileForm, ChangePasswordForm
def index(request):
return render(request, 'app/index.html', {'request': request})
# Registr... |
"""
@author: krakowiakpawel9@gmail.com
@site: e-smartdata.org
"""
from mrjob.job import MRJob
from mrjob.step import MRStep
class MRFlight(MRJob):
def steps(self):
return [
MRStep(mapper=self.mapper,
reducer=self.reducer)
]
def mapper(self, _, line):
(... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib as mpl
import VariousFunctions_FC
fc_all = pd.read_csv('/Users/mistral/Documents/CUBoulder/Science/Sulzer/data/meteo/FC_Water_all_Elevations.csv')
#fc_all.plot(x='time', y=["2100",'2200','2300','2400', "2500", '2600', '2700'], fi... |
#
# Copyright (C) 2006, 2007, 2008, 2009 Loic Dachary <loic@dachary.org>
# Copyright (C) 2006 Mekensleep <licensing@mekensleep.com>
# 24 rue vieille du temple, 75004 Paris
#
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute and/or modify this program under t... |
# Copyright (c) Facebook, Inc. and its affiliates.
import os
import sys
import numpy as np
import cv2
import torch
import torchvision.transforms as transforms
from PIL import Image
##Yolo related
yolo_path = './PyTorch-YOLOv3'
sys.path.append(yolo_path)
try:
from models import Darknet
from utils.utils impor... |
#!/usr/bin/python
import sys
from workflow import Workflow
from workflow import web
from const import Const
LOG = None
class Params:
def __init__(self, (text, itc, num)):
self.text = text
self.itc = itc
self.num = num
self.ie = 'utf-8'
self.oe = 'utf-8'
self.app =... |
import numpy as np
import random
import copy
from collections import namedtuple, deque
from .model import Actor, Critic
import torch
import torch.nn.functional as F
import torch.optim as optim
BUFFER_SIZE = 100000 #int(1e5) # replay buffer size
BATCH_SIZE = 256 #128 # minibatch size
GAMMA = 0.9 #0.99 ... |
"""
This file offers the methods to automatically retrieve the graph Arthrobacter sp. yr096.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein... |
import inspect
import sys
import threading
from twisted.python import log
from functools import wraps
# Configure a standard python logger for stdout use during bootstrap
import logging
bootstrap_logger = None
bootstrap_logger_enabled = False
DEFAULT_FORMAT = "[{}] %(asctime)s [-] [%(name)s] [%(levelname)s] %(messag... |
#!/usr/bin/env python3
'''
This is a service that broadcast dp config values to openpilot's messaging queues
'''
import cereal.messaging as messaging
import time
from common.dp_conf import confs, get_struct_name, to_struct_val
from common.params import Params, put_nonblocking
import subprocess
import re
import os
from... |
#!/usr/bin/env python
# Copyright 2021 Intel 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 ... |
#
# Copyright (c) 2019 UAVCAN Development Team
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel.kirienko@zubax.com>
#
from __future__ import annotations
import abc
import typing
class CRCAlgorithm(abc.ABC):
"""
Implementations are default-constructible.
"... |
import torch
from torch import nn, optim
from torch.autograd import Variable
from torch.utils.data import DataLoader
from helperFunctions import classes, get_accuracy
from dataGenerators import ImagesAll, TestImages, my_collate
from featureModels import resnet_model
import numpy as np
import scipy.io as spio
import g... |
# coding: utf-8
from sqlalchemy.testing import eq_
from sqlalchemy import *
from sqlalchemy import types as sqltypes, exc, schema
from sqlalchemy.sql import table, column
from sqlalchemy.testing import fixtures, AssertsExecutionResults, AssertsCompiledSQL
from sqlalchemy import testing
from sqlalchemy.util import u, ... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
from flask import Flask
from ambition.config import Config
from flask_compress import Compress
from flask_caching import Cache
compress=Compress()
cache = Cache(config={'CACHE_TYPE': 'simple'})
from ambition.routes import routes
def create_app(config_class=Config):
app=Flask(__name__)
app.config.from_object(Config... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Unit tests for Decrypter in `decryptoquote` package."""
from typing import List, Dict, Tuple
import pytest
import mongomock
from decryptoquote.decrypter import Decrypter
from decryptoquote.cypherlettermap import CypherLetterMap
from decryptoquote.wordpatterns import W... |
import pyodbc
try:
connection = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\micha\Documents\Database3.accdb;')
print("Database is connected")
Fullname = "Michael Paul Meneses"
user_id = 6
Address = "Valenzuela"
user_id = 6
Contact = 587
... |
"""unittests for the serial NNPS
You can run the tests like so:
$ pytest -v test_nnps.py
"""
import numpy
from numpy import random
# PySPH imports
from pysph.base.point import IntPoint, Point
from pysph.base.utils import get_particle_array
from pysph.base import nnps
from compyle.config import get_config
# Carr... |
#!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Recipes for NativeClient toolchain packages.
The real entry plumbing is in toolchain_main.py.
"""
import collections
import f... |
# Copyright (c) 2013, 2017 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 the function... |
import pycrfsuite
import sklearn
from itertools import chain
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.preprocessing import LabelBinarizer
import re
import json
annotypes = ['Participants', 'Intervention', 'Outcome']
annotype = annotypes[1]
path = '/nlp/data/romap/crf/'
set_path ... |
from django.contrib import admin
from django.contrib.auth.models import User as AuthUser
from django.contrib.contenttypes.models import ContentType
from django.core import checks, management
from django.db import DEFAULT_DB_ALIAS, models
from django.db.models import signals
from django.test import TestCase, override_se... |
endpoint = {
"ANTI_DDOS": {
"public": "https://antiddos.%(region)s.%(domain)s/v1/%(project_id)s"
},
"AUTO_SCALING": {
"public": "https://as.%(region)s.%(domain)s/autoscaling-api/v1/%(project_id)s"
},
"VOLUME": {
"public": "https://evs.%(region)s.%(domain)s/v2/%(project_id)s"
},
"BMS": {
"p... |
# Copyright 2016-2017 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import mock
from .common import BaseTest
class ShieldTest(BaseTest):
# most of the shield tests are embedded in other resources
def test_shield_sync(self):
# shield resour... |
from typing import Optional, Dict
ERROR_CODES = {
# our codes:
423: "Locked",
428: "Precondition Required",
# JSON RPC Prefedined codes
-32700: "Parse error",
# Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
-32600: "Invalid Request", ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
# Package meta-data.
NAME = 'segmentation_models_pytorch_single'
DESCR... |
"""This module is common core functions for datalight."""
import sys
import logging
import pathlib
import configparser
from typing import Union
from os import getcwd
import yaml
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logger = logging.getLogger('datalight')
class DatalightException(Exception):
... |
import warnings
import sys
import errno
import functools
import logging
import socket
from nose.plugins.skip import SkipTest
from urllib3.exceptions import MaxRetryError, HTTPWarning
from urllib3.packages import six
# We need a host that will not immediately close the connection with a TCP
# Reset. SO suggests this ... |
##
# Copyright (c) 2005-2015 Apple 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 l... |
from django import forms
from django_select2 import *
from .models import Employee, Dept, ClassRoom, Lab, Word, School, Tag, Question, WordList
from .fields import GetSearchTestField, GetModelSearchTestField
from django.core.exceptions import ValidationError
def validate_fail_always(value):
raise ValidationErr... |
from random import randint
class Rect:
def __init__(self, x, y, w, h):
self.x1 = x
self.y1 = y
self.width = w
self.height = h
self.x2 = x + w
self.y2 = y + h
def center(self):
center_x = int(self.x1 + (self.width // 2))
center_y = int(self.y1 + (... |
import json
from click.testing import CliRunner
from dagster import (
DependencyDefinition,
InputDefinition,
Int,
OutputDefinition,
PipelineDefinition,
RepositoryDefinition,
lambda_solid,
seven,
)
from dagster.utils import script_relative_path
from dagster_graphql.cli import ui
@lam... |
"""
Django settings for locallibrary project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import... |
import mmap
import argparse
import typing
import time
from .directory_tree import DirectoryTree, Node
from .matcher import Matcher
class LineCounter:
def __init__(self) -> None:
self.total_files = 0
self.total_lines = 0
def lines_from_path(self, path: str, matcher: typing.Optional[Matcher] ... |
import datetime
import os
from trello.trelloclient import TrelloClient
TRELLO_API_KEY = os.getenv('TRELLO_API_KEY')
TRELLO_API_SECRET = os.getenv('TRELLO_API_SECRET')
TRELLO_TOKEN = os.getenv('TRELLO_TOKEN')
BOARD_ID = os.getenv('TRELLO_BOARD', '5f7f61eda018ce481185be8f')
HIGHLIGHTS_BOARD_ID = os.getenv('HIGHLIGHTS_... |
# Copyright 2022 Garda Technologies, 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 applic... |
from http_stubs.models import AbstractHTTPStub, AbstractLogEntry
class TestAbstractHTTPStub:
"""Tests for AbstractHTTPStub class."""
model = AbstractHTTPStub(
method='test_method',
path='test_path',
)
def test_str(self):
"""Test magic method __str__."""
assert str(sel... |
import time
import redis
from flask import Flask
app = Flask(__name__)
cache = redis.Redis(host='redis', port=6379)
def get_hit_count():
retries = 5
while True:
try:
return cache.incr('hits')
except redis.exceptions.ConnectionError as exc:
if retries == 0... |
import sys
import serial
import pprint
import time
import enum
import queue
from queue import Queue
from os.path import join, dirname, abspath
from qtpy.QtCore import Slot, QTimer, QThread, Signal, QObject, Qt, QMutex
class GcodeStates(enum.Enum):
WAIT_FOR_TIMEOUT = 1
GCODE_SENT = 2
READY_TO_SEND = 3
clas... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^([0-9]+)/([-\w.]+)', views.project, name='project'),
] |
from __future__ import absolute_import
import errno
import logging
import sys
import warnings
from socket import error as SocketError, timeout as SocketTimeout
import socket
from .exceptions import (
ClosedPoolError,
ProtocolError,
EmptyPoolError,
HeaderParsingError,
HostChangedErr... |
# 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... |
# A part of pdfrw (pdfrw.googlecode.com)
# Copyright (C) 2006-2009 Patrick Maupin, Austin, Texas
# MIT license -- See LICENSE.txt for details
'''
Objects that can occur in PDF files. The most important
objects are arrays and dicts. Either of these can be
indirect or not, and dicts could have an associated
stream.
''... |
import mock
from unittest import TestCase
from http.client import RemoteDisconnected
import pytest
from aiodns.error import DNSError
# Incidentally test that 'import *' works
from async_http import *
from async_http.errors import RequestBodyNotBytes
from async_http.errors import TimeoutError
from async_http.http_util... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from typing import List, Union, Tuple
from macrosynergy.management.simulate_quantamental_data import make_qdf
from macrosynergy.management.check_availability import reduce_df
def correl_matrix(df: pd.DataFrame, xcats: List[s... |
from __future__ import with_statement
from tempfile import mktemp
from h5py import tests
import h5py
class FileBase(tests.HTest):
def setUp(self):
self.f = None
self.name = None
def tearDown(self):
import os
try:
if self.f:
self.f.close()
... |
"""
Convert the LRUpdaterHook in mmcv to a PyTorchCallback.
See: https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/hooks/lr_updater.py.
"""
from typing import Any, Dict, Optional, cast
import mmcv
import mmcv.runner.hooks as mmcv_hooks
import determined.pytorch as det_torch
class DummyDataloader:
def _... |
"""
Python 'utf-32-be' Codec
"""
import codecs
### Codec APIs
encode = codecs.utf_32_be_encode
def decode(input, errors='strict'):
return codecs.utf_32_be_decode(input, errors, True)
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
return codec... |
from brainscore import score_model
from candidate_models import brain_translated_pool
def run_benchmark(benchmark_identifier, model_name):
print(f'>>>>>Start running model {model_name} on benchmark {benchmark_identifier}')
model = brain_translated_pool[model_name]
score = score_model(model_identifier=mode... |
from __future__ import with_statement
from nose.tools import assert_true
from os.path import exists
import numpy as np
from nibabel import Nifti1Image
from numpy.testing import assert_equal
from ...utils.simul_multisubject_fmri_dataset import surrogate_3d_dataset
from ..bsa_io import make_bsa_image
from nibabel.tmpdirs... |
import tensorflow as tf
import tensorflow as tf
import tensorflow.contrib as tfcontrib
from tensorflow.python import keras
from tensorflow.python.keras import layers
from tensorflow.python.keras import losses
from tensorflow.python.keras import models
from tensorflow.python.keras import backend as K
# -------... |
#!/usr/bin/python3
#
# MIT License
#
# Copyright (c) 2021 Arkadiusz Netczuk <dev.arnet@gmail.com>
#
# 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 limi... |
class InputDevice(DispatcherObject):
""" Abstract class that describes an input devices. """
ActiveSource=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets the System.Windows.PresentationSource that is reporting input for this device.
Get: Active... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from pymongo import MongoClient
import os
import json
from bson.json_util import dumps
import datetime
dbuser = ""
_id = ""
dbpassword = ""
uri = f"mongodb://{dbuser}:{dbpassword}@ds043972.mlab.com:43972/{_id}"
stable = {
'Oxidising Gas': 400,
'Reducing ... |
"""
tests.pytests.unit.beacons.test_diskusage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
disk usage beacon test cases
"""
from collections import namedtuple
import pytest
import salt.beacons.diskusage as diskusage
from tests.support.mock import MagicMock, Mock, patch
@pytest.fixture
def configure_loader_... |
"""Ingest the PRISM data into a local yearly netCDF file
1. Download from their FTP site
2. Unzip into /mesonet/tmp
3. Open the actual BIL file with rasterio
4. Copy data into netcdf file
5. Cleanup
"""
from __future__ import print_function
import sys
import datetime
import os
import subprocess
import rasterio
impor... |
#!/bin/python3
import sys
import os
import os.path as osp
from PIL import Image
import argparse
import logging
from plan2scene.config_manager import ConfigManager
from plan2scene.texture_gen.custom_transforms.random_crop import RandomResizedCropAndDropAlpha
if __name__ == "__main__":
"""
This script is used ... |
#!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkmeshreader.py,v $
## Language: Python
## Date: $Date: 2006/07/17 09:53:14 $
## Version: $Revision: 1.16 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is distr... |
"""
This module contains some specific functions for
to parse and trime FASTQ files
"""
import re
def coroutine(func):
"""
Coroutine decorator, starts coroutines upon initialization.
"""
def start(*args, **kwargs):
cr = func(*args, **kwargs)
cr.__next__()
return cr
retu... |
# 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... |
from django.apps import AppConfig
class GameFinderConfig(AppConfig):
name = 'game_finder'
|
import os, shutil
import torch
from argparse import ArgumentParser
from pytorch_lightning import Trainer
from cifar10_module import CIFAR10_Module
def main(hparams):
# If only train on 1 GPU. Must set_device otherwise PyTorch always store model on GPU 0 first
if type(hparams.gpus) == str:
if len(hp... |
from utils import create_newfig, create_moving_line, create_still_segment, run_or_export
func_code = 'ah'
func_name = 'test_line_line_intr_later'
def setup_fig01():
fig, ax, renderer = create_newfig('{}01'.format(func_code))
create_moving_line(fig, ax, renderer, (5, 4), (6, 3), (-2, -2), 'topright')
crea... |
# -*- 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... |
# Copyright 2018, The TensorFlow Federated 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 o... |
#!/usr/bin/env python3
from __future__ import print_function
import os
import errno
import sys
import time
from intelhex import IntelHex
import binho # pylint: disable=unused-import
from binho import binhoHostAdapter # pylint: disable=unused-import
from binho.utils import log_silent, log_verbose, binhoArgumentPars... |
#!/usr/bin/env python
# encoding: utf-8
import sys
import hashlib
class CrackExQuilla(object):
def __init__(self, email, expired_date):
self.email = email
self.expired_date = expired_date
self.license = None
def crack(self):
str_tmp = "%s,%s,%s,%s" % ("EX1", self.email, self.exp... |
# Script to train model
from __future__ import division, print_function
import argparse
from time import time
import numpy as np
from plankton import utils
from plankton import get_net
parser = argparse.ArgumentParser()
parser.add_argument('net_name')
parser.add_argument('--X_train_train_npy', default='data/X_train... |
import time
from display_layouts.absolute_layout import AbsoluteLayout
from blinka_displayio_pygamedisplay import PyGameDisplay
import os
os.chdir("..")
display = PyGameDisplay(width=800, height=600)
f = open("layouts/progress_bar_test.json", "r")
layout_str = f.read()
f.close()
main_layout = AbsoluteLayout(display, l... |
import sys
from cliff.commandmanager import CommandManager
from .datakit_app import Datakit
def main(argv=sys.argv[1:]):
if len(argv) == 0:
print("You must invoke a command, or try --help")
else:
myapp = Datakit(
description='datakit',
version='0.3.0',
com... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from pytils import dt
# действие ru_strftime аналогично оригинальному strftime
# только в %a, %A, %b и %B вместо английских названий будут русские
d = datetime.date(2006, 9, 15)
# оригинал
print d.strftime("%d.%m.%Y (%a)")
# -> 15.09.2006 (Fri)
# теперь... |
import numpy as np
from skimage.transform import resize as imresize
def batch(batch):
format_size = batch[0][0].shape[1]
format_batch = []
for index, item in enumerate(batch):
original_image = item[0]
transpose_image = np.transpose(original_image, (1, 2, 0))
resized_image = imresi... |
"""
A helper to alleviate some of the weirdness with django.utils.timezone.
This file also provides other additional methods to be used when
dealing with datetime.
To use exactly as django.utils.timezone do the following:
from zc_common import timezone
timezone.now()
timezone.get_current_timezone()
"""
import datetime... |
import sys
import os
from diskcache import Cache
sys.path.append("..")
from config import DEFAULT_TABLE
from logs import LOGGER
# Get the path to the image
def get_imgs(path):
pics = []
for f in os.listdir(path):
if ((f.endswith(extension) for extension in
['.png', '.jpg', '.jpeg', '.PNG... |
# This example requires the 'members' privileged intents
import diskord
class MyClient(diskord.Client):
async def on_ready(self):
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
async def on_member_join(self, member):
guild = member.guild
if guild.syste... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.