text stringlengths 1 927k |
|---|
import tensorflow as tf
from net.ops import random_bbox, bbox2mask, local_patch
from net.ops import priority_loss_mask
from net.ops import id_mrf_reg
from net.ops import gan_wgan_loss, gradients_penalty, random_interpolates
from net.ops import free_form_mask_tf
from util.util import f2uint
from functools import partial... |
# Copyright 2016 OpenStack 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
#
# Unless required by applicable law ... |
"""
The GSF service object connects to a GSF Service and its tasks.
"""
from __future__ import absolute_import
from abc import abstractmethod, abstractproperty
from string import Template
from .gsfmeta import GSFMeta
from .utils import with_metaclass
class Service(with_metaclass(GSFMeta, object)):
"""
The GSF... |
from itertools import combinations
import multiprocessing
import scanpy.api as sc
import matplotlib.pyplot as plt
import numpy as np
from sklearn.preprocessing import quantile_transform
from scipy.sparse import csc_matrix
from granatum_sdk import Granatum
# import pandas as pd
# import seaborn as sns
nans = np.arr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2000, Atlantis Scientific Inc. (www.atlsci.com)
# Copyright (C) 2005 Gabriel Ebner <ge@gabrielebner.at>
# Copyright (c) 2009, Even Rouault <even dot rouault at mines-paris dot org>
#
# This library is free software; you can redistribute it and/or
# modify i... |
from dictdiffer import diff
def is_same_dict(dict1, dict2):
result = list(diff(dict1, dict2))
return len(result) == 0, result |
"""The tests for the State vacuum Mqtt platform."""
from copy import deepcopy
import json
import pytest
from homeassistant.components import vacuum
from homeassistant.components.mqtt import CONF_COMMAND_TOPIC, CONF_STATE_TOPIC
from homeassistant.components.mqtt.vacuum import CONF_SCHEMA, schema_state as mqttvacuum
fr... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'ElecData', fields ['end_date', 'office', 'state', 'race_type', 'organization', 'dis... |
from datetime import date, timedelta
INITIAL_OFFSET = timedelta(days=5)
class IntervalException(Exception):
"""
Exception to be raises when interval is behaving
weirdly - as not an interval
"""
def get_dates_for_timedelta(interval_delta, start=None, stop=None,
skip_weeke... |
import six
import threading
import logging
import pickle
from coopy import fileutils as fu
from os import path
if six.PY3:
from pickle import Pickler, Unpickler
else:
from cPickle import Pickler, Unpickler
logger = logging.getLogger("coopy")
class SnapshotManager(object):
def __init__(self, basedir):
... |
# Copyright Contributors to the OpenCue 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 by applicable law or... |
# -*- encoding: utf-8 -*-
from django.core.management import BaseCommand
from django.db.models import CharField, TextField, Q
from django.apps import apps
from bpp.models import Sumy, Typ_KBN, Charakter_Formalny
from bpp.util import usun_nieuzywany_typ_charakter
class Command(BaseCommand):
help = "Usuwa nieuzywa... |
from Registro import Registro
from Compras import Compras
from sqlite3 import OperationalError
import os
import pytest
class TestCompras:
def test_class_declared(self):
objeto = Compras('vendas.db')
assert isinstance(objeto, Compras)
def test_instanciar(self):
objeto = Compras('vendas... |
from pyanoled.Configuration import Configuration
from pyanoled.State import State
from pyanoled.ui.displays.Display import Display
from pyanoled.ui.menus.MainMenu import MainMenu
from logging import Logger
from PIL import Image, ImageDraw
from typing import Type
import importlib
import RPi.GPIO as GPIO
import time
... |
import cv2
import os
camera_url = "rtsp://admin:Villano0603@192.168.1.102"
#camera_url = "twitch.tv/elded"
dataPath = 'C:/Users/carl2/Desktop/Reconocimiento/Datos' #Cambia a la ruta donde hayas almacenado Data
imagePaths = os.listdir(dataPath)
print('imagePaths=',imagePaths)
#face_recognizer = cv2.face.EigenFaceReco... |
"""Create synthetic data to benchmark PyTables queries.
Usage
-----
# Generate 10 datasets of synthetic data
python create_synthetic_data.py -n 1000000
"""
import os
import argparse
import time
import tables as tb
import numpy as np
class SyntheticDataDescription(tb.IsDescription):
unsigned_int_field = tb.UInt8C... |
# https://www.jianshu.com/c/00c61372c46a
username = input('username: ')
print('Welcome', username)
print('Welcome ' + username)
# PEP8
a = 10 + 5 # 变量赋值,自右向左进行
a = a + 10 # 可以简化为以下形式
a += 10
# b += 10 # 错误,因为等价于b = b + 10,b没有提前赋值
print(5 / 2) # 2.5
print(5 // 2) # 2
print(5 % 2) # 只要余数,模运算,1
print(2 ** 3) # ... |
# 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 warnings
import numpy as np
from .perturbation import Perturbation
class StepPerturbation(Perturbation):
"""
This class will simulate a Step perturbation, with a support beginning at _t0 and ending in _t0+_support,
that causes a Petrurbation in the form a Step Function.
Parameters to construct ... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
__version__ = "0.6.0.dev0"
from .accelerator import Accelerator
from .kwargs_handlers import DistributedDataParallelKwargs, GradScalerKwargs
from .l... |
from netapp.netapp_object import NetAppObject
class DefaultGetIterKeyTd(NetAppObject):
"""
Key typedef for table ntdtest_multiple_with_default
"""
_key_2 = None
@property
def key_2(self):
"""
Field sfield3
"""
return self._key_2
@key_2.setter
def key... |
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick, Sean Bell and Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from... |
from messagebird.base import Base
class Links(Base):
def __init__(self):
self.first = None
self.previous = None
self.next = None
self.last = None
class BaseList(Base):
def __init__(self, item_type):
"""When setting items, they are instantiated as objects of type ite... |
import pytest
from GraphModels.graphmodels.graphmodel import GraphModel
nodes_1 = {
'In_1': {'type': 'input',
'unit': '1',
'name': 'Input 1'},
'Par_1': {'type': 'parameter',
'unit': '1',
'name': 'Parameter 1'},
'Var_1': {'type': 'variable',
... |
# Generated by Django 2.1.5 on 2019-02-20 00:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('guests', '0016_party_rehearsal_dinner'),
]
operations = [
migrations.AddField(
model_name='guest',
name='allergies',... |
# Generated by Django 3.1.2 on 2021-07-05 06:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('edukasi', '0031_auto_20210704_1017'),
]
operations = [
migrations.AlterField(
model_name='kegiatan',
name='url_donas... |
# Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# 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, th... |
from util import *
from test import BasicTest
class AdmireWorkTest(BasicTest):
def __init__(self, s):
self._name = "Admire Work Test"
self._socket = s
def run_all_tests(self):
self.admire_before_login()
self.admire_before_drop()
self.admire_after_drop()
self.adm... |
import os
from fabric.api import run, sudo, env, task, put, cd
import fabtools.python
import fabtools.rpm
import fabtools.files
env.forward_agent = True
env.user = 'admin'
TMP_VENV_DIR = '/tmp/copyIndex'
SRC_DIR = os.path.join(TMP_VENV_DIR, 'src')
REMOTE_PY = os.path.join(TMP_VENV_DIR, 'bin', 'python')
HERE = os.p... |
"""Support for Lutron Powr Savr occupancy sensors."""
from pylutron import OccupancyGroup
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OCCUPANCY,
BinarySensorEntity,
)
from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice
def setup_platform(hass, config, add_entities, discovery_... |
# Copyright (C) 2003-2011 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... |
# -*- coding: utf-8 -*-
# cython: language_level=3
# BSD 3-Clause License
#
# Copyright (c) 2020-2022, 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#description:Whois information for domain.
from core.lib import colors
from core.lib import completer
import readline
#requirements
import pythonwhois
#colors
C = colors.Palette()
class module_element(object):
def __init__(self):
self.title = "Whois Domain... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 13 05:13:27 2018
@author: s207
"""
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 10 02:43:10 2018
@author: s207
"""
from keras.callbacks import TensorBoard
from keras.preprocessing.image import ImageDataGenerator
from keras.layers import Conv2D, MaxPooling2D
from keras... |
from __future__ import unicode_literals
from django.contrib.syndication.views import Feed as BaseFeed
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
class GeoFeedMixin(object):
"""
This mixin provides the necessary routines for SyndicationFeed subclasses
to produce simple GeoRSS or W3C ... |
try:
import fmc
except:
import os
import sys
sys.path.append(os.getcwd())
import fmc
metadata = fmc.metadata(
Instances = {
"Description": "Description of Instances",
},
Databases = {
"Description": "Description of Databases",
},
... |
######################### IMPORTS #########################
import ast # Abstract syntax trees
import json # JSON encoder and decoder
import pandas # Python data analysis library
import random ... |
from grammar_productions.production import Production
from grammar_productions.integer import Integer
class MultiplyExpression(Production):
def __init__(self, left_element, right_element):
self.left_element = left_element
self.right_element = right_element
def __repr__(self):
return ... |
'''
Split
-----
'''
from re import Pattern
from typing import Collection, Optional, Tuple, Union
import numpy as np
from anndata import AnnData
import metacells.parameters as pr
import metacells.tools as tl
import metacells.utilities as ut
from .direct import compute_direct_metacells
__all__ = [
'split_groups'... |
"""Convenience methods for plugin_api."""
# The current indirect ij_product mapping (eg. "intellij-latest")
INDIRECT_IJ_PRODUCTS = {
# Indirect ij_product mapping for internal Blaze Plugin
"intellij-latest": "intellij-2021.2",
"intellij-latest-mac": "intellij-2021.2-mac",
"intellij-beta": "intellij-202... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This sphinx extension makes the issue numbers in the changelog into links to
GitHub issues.
"""
from __future__ import print_function
import re
from docutils.nodes import Text, reference
BLOCK_PATTERN = re.compile('\[#.+\]', flags=re.DOTALL)
ISSUE_... |
"""Wrapper for mkvmerge, mkvextract and ffmpeg tools"""
import os
import json
import subprocess
import logging
def gather_video_properties(mkvmerge, video_path):
"""Use the mkvmerge --identify option to extract tracks information from a
video file.
"""
logging.debug(
"Extracting video prope... |
"""Fixtures"""
from pathlib import Path
import pytest
_TEST_FILES = Path(__file__).parent / "test_files"
@pytest.fixture
def p008() -> str:
"""Problem 008 data."""
with open(_TEST_FILES / "problem_008.txt", "r") as f:
return "".join([x.strip() for x in f.readlines()]) |
import json
from notebook.base.handlers import APIHandler
from notebook.utils import url_path_join
import tornado
class RouteHandler(APIHandler):
# The following decorator should be present on all verb methods (head, get, post,
# patch, put, delete, options) to ensure only authorized user can request the
... |
#!/usr/bin/env python3
import random
trivially = [
"Obviously",
"Clearly",
"Anyone can see that",
"Trivially",
"Indubitably",
"It follows that",
"Evidently",
"By basic applications of previously proven lemmas,",
"The proof is left to the reader that",
"It goes without saying tha... |
from django.urls import path
from .views import TransferListCreateAPIView
urlpatterns = [
path('transfers/',
TransferListCreateAPIView.as_view(),
name='transfers'),
] |
from unittest.mock import patch
import numpy as np
import pandas as pd
import pytest
from rayml.model_family import ModelFamily
from rayml.pipelines.components import ExponentialSmoothingRegressor
from rayml.problem_types import ProblemTypes
pytestmark = [
pytest.mark.noncore_dependency,
pytest.mark.skip_dur... |
# Cache Timeouts
TIMEOUT_5_MINUTES = 300
TIMEOUT_60_MINUTES = 3600
TIMEOUT_24_HOURS = 86340
TIMEOUT_12_HOURS = 43140
# Cache keys
def FILE_UPLOAD_SIZE(document_guid): return f'document-manager:{document_guid}:file-size'
def FILE_UPLOAD_OFFSET(document_guid): return f'document-manager:{document_guid}:offset'
def FILE_U... |
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
DATABASE_URL = 'mysql+pymysql://root:@localhost/atcv'
engine = create_engine(DATABASE_URL, convert_unicode=True)
db_session = scoped_session(sessionmaker(autocommit=Fal... |
from typing import Any, Dict, Optional, Mapping, MutableMapping, Text, Tuple
from .exceptions import UnknownUpdateBoardAction
from .templates import TRELLO_SUBJECT_TEMPLATE, TRELLO_MESSAGE_TEMPLATE
SUPPORTED_BOARD_ACTIONS = [
u'removeMemberFromBoard',
u'addMemberToBoard',
u'createList',
u'updateBoard',... |
import pandas as pd
import os
geological_info = pd.read_json('./cities.json')
geological_info = geological_info.drop(['growth_from_2000_to_2013', 'population'], axis=1)
geological_info['city'] = geological_info['city'].apply(lambda x: x.replace(' ', ''))
geological_info['state'] = geological_info['state'].apply(lambda... |
import numpy as np
import prior
import reparameterize
__all__ = ["lnprob", "lnprob_atmosphere"]
################################################################################
def lnprob(Y_array, *args):
"""
Log-probability function for mapping
Parameters
----------
Returns
-------
""... |
import os
import math
import cereal.messaging as messaging
from common.numpy_fast import clip, interp
from selfdrive.swaglog import cloudlog
from common.realtime import sec_since_boot
from selfdrive.controls.lib.radar_helpers import _LEAD_ACCEL_TAU
from selfdrive.controls.lib.longitudinal_mpc import libmpc_py
from sel... |
# probs of shape 3d image per class: Nb_classes x Height x Width x Depth
# assume the image has shape (69, 51, 72)
import numpy as np
import pydensecrf.densecrf as dcrf
from pydensecrf.utils import unary_from_softmax, create_pairwise_gaussian
###
#shape = (69, 51, 72)
#probs = np.random.randn(5, 69, 51).astype(np.flo... |
# 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... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
import math
import sys
import matplotlib
matplotlib.use('Agg') # Avoid tkinter dependency
import matplotlib.pyplot as plt
from . import charset as cset
def string_sequentiality(string, charset, plot_scatterplot=False):
"""
Computes how much a string contains sequence of consecutive or distance-fixed chara... |
#!/usr/bin/env python3
import os
import re
import datetime
import json
import copy
# Parses the md file, outputs html string
def createArticle(mdFileName:str, isBlog=True):
"""
mdFileName: md file name
isBlog: boolean
Returns: { article, postTitle, postSubject, timeCreated }
article: the blog post in HTM... |
from conftest import QL_URL
from reporter.tests.utils import insert_test_data, delete_test_data
import pytest
import requests
import json
import time
entity_type = 'Room'
entity_id = 'Room0'
temperature = 'temperature'
pressure = 'pressure'
n_days = 30
services = ['t1', 't2']
query_url = "{}/op/query".format(QL_URL)
... |
#!/usr/bin/env python3
from websearcher import web_searcher_arg_reader
from websearcher import web_searcher
"""
Search for expression without instantiating an instance. Use command line arguments.
"""
# instantiate arg_reader
web_searcher_arg_reader = web_searcher_arg_reader.WebSearcherArgReader()
web_searcher_args ... |
# -*- coding: utf-8 -*-
import asyncio
import pytest
from poke_env.player.random_player import RandomPlayer
from poke_env.player.utils import cross_evaluate
from poke_env.player_configuration import PlayerConfiguration
from poke_env.server_configuration import LocalhostServerConfiguration
async def simple_cross_eval... |
import csv
import json
import requests
URL = "https://www.cnb.cz/cs/platebni-styk/.galleries/ucty_kody_bank/download/kody_bank_CR.csv"
def process():
with requests.get(URL, stream=True) as fp:
csvfile = csv.reader([line.decode("latin1") for line in fp.iter_lines()], delimiter=";")
return [
... |
import glob
import cv2
import mmcv
import numpy as np
class VideoDemo:
''' Generate video demo given two sets of images.
Please note that there will be video compression when you save the output
as a video. Therefore, the result would be inferior to the actual outputs.
Args:
input_left_dir ... |
#!/usr/bin/env python
# Python bindings to the Google search engine
# Copyright (c) 2009-2016, Mario Vilas
# 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... |
# -*- coding: utf-8 -*-
""" tests for the plugin
Use the aiida.utils.fixtures.PluginTestCase class for convenient
testing that does not pollute your profiles/databases.
"""
# Helper functions for tests
import os
import tempfile
from pathlib import Path
TEST_DIR = Path(__file__).resolve().parent
DATA_DIR = TEST_DIR ... |
import requests
import re
import pandas as pd
import _thread
# 用get方法访问服务器并提取页面数据
def getHtml(cmd, page):
url = "http://nufm.dfcfw.com/EM_Finance2014NumericApplication/JS.aspx?cb=jQuery112406115645482397511_1542356447436&type=CT&token=4f1862fc3b5e77c150a2b985b12db0fd&sty=FCOIATC&js=(%7Bdata%3A%5B(x)%5D%2CrecordsF... |
class Solution(object):
def convert(self, s, numRows):
"""
:s的类型: str
:numRows类型: int
:返回类型: str
"""
if numRows <= 1:
return s
n = len(s)
ans = []
step = 2 * numRows - 2
for i in range(numRows):
one = i
two = -i
while one < n or two < n:
if 0 <= ... |
from transformer import cli
if __name__ == '__main__':
cli.main_group() |
import pytest
from red_panda.aws.athena import AthenaUtils
import logging
LOGGER = logging.getLogger(__name__)
@pytest.fixture
def athena_utils(aws_config, athena_result_location, aws_region):
return AthenaUtils(
aws_config, athena_result_location, region_name=aws_region, work_group="primary"
)
de... |
"""Persistence and serialization tools"""
__author__ = 'thorwhalen' |
import _fib_heap
import random
import time
import matplotlib.pyplot as plt
class graph:
def __init__(self,n):
self.graph=[]
for i in range(n):
temp=[random.randint(0,1001) for i in range(n)]
temp[i]=0
self.graph.append(temp)
def accept(self):
for i in range(len(self.gr... |
# Generated by Django 3.2.4 on 2021-06-12 23:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('news', '0003_headline_time_ago_str'),
]
operations = [
migrations.AlterField(
model_name='headline',
name='title',
... |
"""
Adjacency Class
===============
Nltools has an additional data structure class for working with two-dimensional
square matrices. This can be helpful when working with similarity/distance
matrices or directed or undirected graphs. Similar to the Brain_Data class,
matrices are vectorized and can store multiple matri... |
"""instagram URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-bas... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
# -*- coding: utf-8 -*-
import scrapy
from scrapy.loader import ItemLoader
from mtime.items import MtimeItem
from mtime.loaders import MtimeLoader
class Top100Spider(scrapy.Spider):
name = 'top100'
allowed_domains = ['mtime.com']
start_urls = [
'http://www.mtime.com/top/movie/top100/',
]
... |
import numpy as np
from .regions import Regions
class SplitRegions:
def __init__(self, regions, offsets):
self._regions = regions
self._offsets = offsets
def get_signals(self, bedgraph):
signals = bedgraph.extract_regions(self._regions)
return signals.join_rows(self._offsets)
... |
# ====================================================================
# 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 re... |
# encoding: utf-8
"""
@version: ??
@author: Mouse
@license: Apache Licence
@contact: admin@lovexing.cn
@software: PyCharm
@file: tensorboard.py
@time: 2018/5/10 9:36
"""
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def main():
# 载入数据
mnist = input_data.read_data_sets('M... |
import numpy as np
import pytest
from olfactory import preprocessing
def test_pipe_filter():
class Elem(dict):
def __init__(self, dic):
super().__init__(dic)
self.id = dic['id']
self.flags = set()
def __getattr__(self, attribute):
try:
... |
import re
f=open("input.txt")
Input = f.read().split("\n")
f.close()
regex = r"(.+)-(.+) (.): (.+)"
count = 0
for i in Input:
match = re.match(regex, i)
minOccurrence = int(match.group(1))
maxOccurrence = int(match.group(2))
char = match.group(3)
if(minOccurrence <= match.group(4).count(char) <=... |
"""Presentation exchange record."""
import logging
from typing import Any, Mapping, Union
from marshmallow import fields, Schema, validate
from .....core.profile import ProfileSession
from .....messaging.models.base_record import BaseExchangeRecord, BaseExchangeSchema
from .....messaging.valid import UUIDFour
from ... |
import json
import logging
import time
from six.moves.urllib.request import urlopen
SPACEL_URL = 'https://ami.pbl.io/spacel/%s.json'
logger = logging.getLogger('spacel.aws.ami')
class AmiFinder(object):
def __init__(self, channel=None, cache_bust=None):
self._channel = channel or 'stable'
self.... |
#/usr/bin/env python3
import argparse
import inspect
import __main__
__all__ = ['FuncParser']
def nonempty(item):
return item if item != inspect._empty else None
class FuncParser(argparse.ArgumentParser):
def __init__(self, *args, funclist=None, description=None, **kwargs):
if description is None:
... |
import re, os, sys
#Create an executable build script which builds the library
#given by the "lib" argument.
def create_build_script(absLibDir,lib,buildFlag):
buildScript = absLibDir + '/build.csh'
if os.path.isfile(buildScript):
os.remove(buildScript)
fileObj = open(buildScript, 'w')
fileOb... |
# import the necessary packages
from __future__ import print_function
from batcountry import BatCountry
from PIL import Image
import numpy as np
import argparse
import warnings
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-b", "--base-model", requi... |
from django.db import models
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser
class UserProfilesManager(BaseUserManager):
""" Manager for user creation """
def create_user(self, email, name, password=None):
""" Create new... |
# coding: utf-8
# Author: Leo BRUNEL
# Contact: contact@leobrunel.com
# This file is part of Wizard
# MIT License
# Copyright (c) 2021 Leo brunel
# 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 So... |
__author__ = 'dishantrathi'
from SICCipy.SICCipy import CheckConnection
from CurrencySelection.CurrencySelection import CurrencySelection
from Help.Help import Help
from Credits.Credits import Credits ... |
# -*- coding: utf-8 -*- #
# Copyright 2017 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 requir... |
"""
Copyright (c) 2018-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 law or agreed to in wri... |
#!/usr/bin/env python
# encoding: utf-8
# author:alisen
# time: 2020/4/29 10:47
# import json
import time
import tr
import tornado.web
import tornado.gen
import tornado.httpserver
import base64
from PIL import Image, ImageDraw
from io import BytesIO
import datetime
import logging
from logging.handlers import Rotating... |
#!/usr/bin/env python3
# Copyright (c) 2016 The Uscoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the bumpfee RPC.
Verifies that the bumpfee RPC creates replacement transactions successfully when
its p... |
#
# 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... |
'''
Distributed Node Classification
===============================
In this tutorial, we will walk through the steps of performing distributed GNN training
for a node classification task. To understand distributed GNN training, you need to
read the tutorial of multi-GPU training first. This tutorial is developed on to... |
import asyncio
import logging
import sys
from concurrent.futures import Executor, ProcessPoolExecutor
from datetime import datetime
from functools import partial
from multiprocessing import freeze_support
from typing import Set, Tuple
try:
from aiohttp import web
import aiohttp_cors
except ImportError as ie:
... |
# -*- coding: utf-8 -*-
from sst_unittest import *
from sst_unittest_support import *
import os
import glob
USE_PIN_TRACES = True
USE_TAR_TRACES = False
WITH_DRAMSIM = True
NO_DRAMSIM = False
################################################################################
# Code to support a single instance module i... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import reverse
from tests.utils import pipeline_settings
class MiddlewareTest(TestCase):
def test_middleware_off(self):
response = self.client.g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.