text stringlengths 1 927k |
|---|
########## Programmable Real-Time Unit -- ######################################
########## -- Industrial Communication Subsystem (PRU-ICSS) ####################
##
## aka PRUSS, but not to be confused with the old one of Freon/Primus.
from uio import Uio
from .cfg import Cfg
from .core import Core
from .intc import I... |
#!/usr/bin/env python3
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
from basecls.configs import HRNetConfig
_cfg = dict(
model=dict(
name="hrnet_w64",
),
)
class Cfg(HRNetConfig):
def __init__(self, values_or_file=None, **kwargs):
super().__init__(_cfg)
self.merge(va... |
# autogenerated by ./scripts/update_backend_index.py
import re
backend_url_patterns = [
("acm", re.compile("https?://acm\\.(.+)\\.amazonaws\\.com")),
("apigateway", re.compile("https?://apigateway\\.(.+)\\.amazonaws.com")),
(
"applicationautoscaling",
re.compile("https?://application-autosc... |
import math
import numpy as np
import tensorflow as tf
import heapq
class Caption(object):
def __init__(self, sentence, img_state, language_state, logprob, score, metadata=None):
"""Initializes the Caption.
Args:
sentence: List of word ids in the caption.
state: Model state after generating the p... |
from providers.a4kScrapers import en as scrapers
from flask_restful import Resource, request
from flask import jsonify
class Scrapers(Resource):
def get(self):
return jsonify(scrapers.get_torrent()) |
import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['MovingAverage'] , ['BestCycle'] , ['MLP'] ); |
from django.shortcuts import render
from django.http import JsonResponse
from zoogle_pb2 import Void, Query
from zoogle.zdocs.models import Zdoc
from zoogle.zmail.models import Zmail
from zoogle.contribs.clients.zmail import zmail_stub
from zoogle.contribs.clients.zdocs import zdocs_stub
def index(request):
retu... |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... |
#!/usr/bin/env python
# encoding: utf-8
"""
@author: Alfons
@contact: alfons_xh@163.com
@file: 07-01-decorator.py
@time: 18-2-26 下午9:27
@version: v1.0
"""
# python 装饰器
# 1.能把被装饰的函数替换成其他函数。
# 2.装饰器在加载模块时立即执行。
# 3.装饰器的强大在于它能够在不修改原有业务逻辑的情况下对代码进行扩展,
# 权限校验、用户认证、日志记录、性能测试、事务处理、缓存等都是装饰器的绝佳应用场景,
# 能够最大程度地对代码进行复用。
print("... |
# 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.
# -----------------------------------------------------... |
import time
import argparse
import tensorflow as tf
import os
import sys
import math
import collections
from tensorflow.python.client import timeline
import json
from tensorflow.python.ops import partitioned_variables
from tensorflow.contrib.rnn.python.ops.core_rnn_cell import _Linear
from tensorflow.python.feature_c... |
import numpy as np
import sys
import os
import time
import pickle
from PIL import Image
from copy import deepcopy
import cv2
import json
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
from torch.autograd import Variable
from torchvision.uti... |
import operator
from pytest import raises
from effect import Effect, Error, base_dispatcher, sync_perform
from effect.fold import FoldError, fold_effect, sequence
from effect.testing import perform_sequence
def test_fold_effect():
"""
:func:`fold_effect` folds the given function over the results of the
... |
from typing import List
from fastapi import APIRouter, Depends
from odp.api.dependencies.auth import Authorizer, AuthData
from odp.api.dependencies.ckan import get_ckan_client
from odp.api.models.auth import Role, Scope
from odp.api.models.project import Project
from odp.config import config
from odp.lib.ckan import ... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
"""Dummy class that does not inherit from the required AbstractObjectDetection."""
class ObjectDetection:
"""Dummy class that does not inherit from the required AbstractObjectDetection.""" |
#!/bin/python
import sys
import os
import argparse
from collections import defaultdict
import PPP.substructure_search as ss
AMINOACIDS = ["VAL", "ASN", "GLY", "LEU", "ILE",
"SER", "ASP", "LYS", "MET", "GLN",
"TRP", "ARG", "ALA", "THR", "PRO",
"PHE", "GLU", "HIS", "HIP", "TYR",... |
from neuron import h
class TransformGC3:
def __init__(self):
# Create a section lookup by section name
# Note: this assumes each section has a unique name
self.name2section = { sec.name(): sec for sec in h.allsec() }
# This will store the new section coordinates
self.secti... |
import numpy
import random
from numpy import arange
#from classification import *
from sklearn import metrics
from sklearn.datasets import fetch_mldata
from sklearn.ensemble import RandomForestClassifier
from sklearn.utils import shuffle
import time
def run():
mnist = fetch_mldata('MNIST original')
#mnist.dat... |
import tensorflow as tf
import numpy as np
from utils import box_utils
def generate(base_size,
stride,
scales,
ratios,
features_height,
features_width,
offset=None):
"""
Args:
base_size: (height, width)
stride: (height, width)
... |
"""
https://docs.djangoproject.com/en/1.11/topics/settings/
https://docs.djangoproject.com/en/1.11/ref/settings/
https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
"""
import os
from collections import OrderedDict
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNIN... |
import os.path
from datetime import datetime
from datetime import timedelta
from urllib.parse import urljoin
import requests
from jwt_auth import make_http_headers
from jwt_auth import generate_access_token
class ZoomJWTClient(object):
BASE_URL = 'https://api.zoom.us/v2/'
def __init__(
self,
... |
from webauthn import webauthn
from django.apps import AppConfig
from django.conf import settings
class TwoFactorConfig(AppConfig):
name = 'two_factor'
verbose_name = "Django Two Factor Authentication"
defaults = {
'TWO_FACTOR_DEVICE_PREFERENCE': {
# a lower value means higher priority... |
#!/usr/bin/python3
"""
Given an n-ary tree, return the postorder traversal of its nodes' values.
For example, given a 3-ary tree:
Return its postorder traversal as: [5,6,3,2,4,1].
Note:
Recursive solution is trivial, could you do it iteratively?
"""
# Definition for a Node.
class Node:
def __init__(self, val, ... |
from firebase_admin import auth
from package_tests.models import User
# Stubs
stub_firebase_token = 'stub_firebase_token'
stub_firebase_uid = 'stub_firebase_uid'
stub_email = 'daniel@danieljs.tech'
stub_username = 'dspacejs'
# Mock classes
class MockUserRecord(object):
email = None
display_name = None
... |
# -*- coding: utf-8 -*-
from SMLite import SMLite
from ItemStruct._SMLite_ConfigState import _SMLite_ConfigState
class SMLiteBuilder (object):
def __init__ (self):
self.__states = {}
self.__builded = False
def Configure (self, state):
if self.__builded:
raise Exception ("shouldn't configure builder after ... |
#!/usr/bin/python
# Copyright (c) 2013, 2014-2017 Oracle and/or its affiliates. All rights reserved.
"""Provide Module Description
"""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
__author__ = "Andrew Hopkinson (Oracle Cloud Solutions A-Team)"
__copyright__ = "Copyright (... |
import json
from django import forms
from histonets.collections.models import Collection
class CollectionForm(forms.ModelForm):
images = forms.CharField(widget=forms.Textarea)
class Meta:
model = Collection
fields = ['label', 'description']
def clean_images(self):
try:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class AlipayMerchantOrderUnlimitedQueryModel(object):
def __init__(self):
self._biz_no = None
self._buyer_id = None
self._order_id = None
@property
def bi... |
from django.conf.urls import url
from django.contrib import admin
from .views import (
CommentCreateAPIView,
CommentDetailAPIView,
CommentListAPIView,
# CommentEditAPIView
)
urlpatterns = [
url(r'^$', CommentListAPIView.as_view(), name='list'),
url(r'^create/$', CommentCreateAPIView.as_view(), ... |
import os
import re
import time
import json
import struct
import datetime
import threading
from ..base import OpenDeviceBase
from ..decorator import with_device_message
from ...framework.utils import (helper, resource)
from . import dmu_helper
from .configuration_field import CONFIGURATION_FIELD_DEFINES_SINGLETON
from ... |
def hello():
return get_greeting()
def get_greeting():
return "Hola Mundo en el curso de Python" |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from datetime import datetime
from django.shortcuts import render, redirect
from django.http import Http404
from alquileres.models import *
# Create your views here.
def index(request):
ciudades = Ciudad.objects.all()
if 'filter' in request.GET:
filtrados = Propiedad.objects.all().filter(ciudad=reques... |
import os
from textwrap import dedent
from django.db import migrations
import pytest
import tests
from djmoney.models.fields import CurrencyField, MoneyField
from .helpers import get_operations
class TestMigrationFramework:
installed_apps = ["djmoney", "money_app"]
migration_output = ["*Applying money_app... |
from django.conf.urls import url
from views import canvas
urlpatterns = [
url(r'^$', canvas),
] |
import os
import uuid
class PageRep:
def __init__(self,
ownerParcelInfoItem,
valueInfoItemList,
saleTransferInfoItemList,
pageUrl
):
self.OwnerParcelInfo = ownerParcelInfoItem
self.ValueInfoItemList = valueInfoItemList
self.SaleTransferInfoList = saleTransferInfoItemLis... |
import math
import numba # type: ignore
@numba.njit(fastmath=True)
def try_sqrt(number: any) -> float:
try:
return math.sqrt(number)
except ValueError:
return 0.0
@numba.njit(fastmath=True)
def is_colliding_rect(rect: any, xy: tuple, offset_x: int = 0, offset_y: int = 0) -> bool:
return... |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
class MandatoryOptions(object):
def __init__(self,options):
self.options=options
def __getattr__(self,name):
call=getattr(self.options,name)
def require(*args,**kwargs):
value=call(*args,*... |
"""A nominal composition value."""
from gemd.entity.value.composition_value import CompositionValue
class NominalComposition(CompositionValue):
"""
Nominal composition, represented as a map from the component names to the quantities.
The quantities do not express an uncertainty but also do not imply that... |
from src.homework.homework11.player import Player
from src.homework.homework11.game_log import GameLog
from src.homework.homework11.die6 import Die6
from src.homework.homework11.die8 import Die8
#write import statements for Die6 and Die8 classes
game_log1 = GameLog()
#ASSIGNMENT 12: Write statements to create Die6 a... |
from os import error
from PIL import Image
def main():
try:
image = open_image('image1.jpg')
newImage = image.resize((200, 200))
newImage.save('image2.jpg')
print("done")
except:
print ("There was an error processing the image.")
def open_image(file_location):
image... |
# vim: set fileencoding=utf-8
# this system uses structured settings as defined in
# http://www.slideshare.net/jacobian/the-best-and-worst-of-django
#
# this is the base settings.py -- which contains settings common to all
# implementations of ona: edit it at last resort
#
# local customizations should be done in sever... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
# Copyright 2015 and onwards Google, 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/license... |
from . import csv_mod
from . import sarif_mod
from . import server_mod |
import re
import pickle
import numpy as np
import pandas as pd
import torch
from string import punctuation
from nltk.stem import WordNetLemmatizer
from nltk.tokenize import sent_tokenize, word_tokenize
from sklearn.feature_extraction.text import CountVectorizer
from flask import Flask, render_template, request, jsonif... |
import pandas as pd
from datetime import datetime
from bokeh.models.widgets import RadioGroup, CheckboxGroup, DateRangeSlider
from bokeh.layouts import column
from ..observer import Observer
from .pandas_functions import create_combinations_of_sep_values
class Settings(object):
"""Settings Object used in BokehA... |
# -*- coding: utf-8 -*-
import hashlib
import itertools
import os
import re
import time
import uuid
from datetime import datetime
from urllib.parse import urlsplit
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import models, transaction
from django.db.models imp... |
import traceback
import os
import sys
import uuid
from collections import defaultdict
from conans.client.output import ScopedOutput
from conans.errors import ConanException, NotFoundException
from conans.client.tools.files import chdir
from conans.util.files import save
attribute_checker_hook = """
def pre_export(ou... |
"""
This module includes functions for experiments with the zero-padding preprocessing pipeline (subtle inverse crime I).
Efrat Shimron (UC Berkeley, 2021).
"""
import numpy as np
from subtle_data_crimes.functions.utils import merge_multicoil_data, calc_pad_half
################################## helper func #######... |
# by @eickenberg
import torch
import numpy as np
from patch_dataset import PatchDataset
from torch.utils.data import ConcatDataset
import glob
import os
import nibabel
class ZipDataset(torch.utils.data.Dataset):
def __init__(self, *datasets):
self.datasets = datasets
def __len__(self):
ret... |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="dht11",
version="0.1.0",
author="Pavel Milanes",
author_email="pavelm@gmail.com",
description="Python library for reading DHT11 sensor on Orange Pi SBCs",
long_descripti... |
import pyaf.Bench.TS_datasets as tsds
import pyaf.tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 7, transform = "Fisher", sigma = 0.0, exog_count = 20, ar_order = 12); |
from collections import Counter
from sklearn.cluster import KMeans
import cv2
sizeX = 600
sizeY = 400
def preprocess(raw):
image = cv2.resize(raw, (sizeX, sizeY), interpolation = cv2.INTER_AREA)
image = image.reshape(image.shape[0]*image.shape[1], 3)
return image
... |
import time
import util.testing
from modern_paste import db
class User(db.Model):
__tablename__ = 'user'
user_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
is_active = db.Column(db.Boolean)
signup_time = db.Column(db.Integer)
signup_ip = db.Column(db.Text)
username = db.Co... |
from flask import request
import python_game_code.random_functions
class room1(object):
which_room = "Finding the Sword"
def choices(self):
return self.room1_scene1
class room1_scene1(room1):
def choices(self):
rocks = [
'throw rock',
'throw rocks',
'throw',
... |
from __future__ import with_statement, absolute_import
from operator import attrgetter
from django.db import connection
from django.test import TestCase, skipIfDBFeature
from django.test.utils import override_settings
from .models import Country, Restaurant, Pizzeria, State, TwoFields
class BulkCreateTests(TestCas... |
# This an autogenerated file
#
# Generated with EnvelopeCurveSpecification
from typing import Dict,Sequence,List
from dmt.entity import Entity
from dmt.blueprint import Blueprint
from .blueprints.envelopecurvespecification import EnvelopeCurveSpecificationBlueprint
from typing import Dict
from sima.riflex.matrixplotfi... |
# Copyright 2015 Ufora Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
# qubit number=4
# total number=44
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += CNOT(0,3) # number=13
... |
""" Various kinds of layout components.
"""
from __future__ import absolute_import
import warnings
import logging
logger = logging.getLogger(__name__)
from ..core import validation
from ..core.validation.warnings import (
EMPTY_LAYOUT,
BOTH_CHILD_AND_ROOT,
)
from ..core.enums import SizingMode
from ..core.p... |
'''
Topic : Algorithms
Subtopic : SolveMeFirst
Language : Python
Problem Statement : sum of the above two integers
Url : https://www.hackerrank.com/challenges/solve-me-first/problem
'''
def solveMeFirst(a:int,b:int):
# Hint: Type return a+b below
return a + b
num1 = int(input())
num2 = int(in... |
from indy import did,wallet,crypto, anoncreds
import asyncio
import base64
import random
import json
class Indy_pdp:
def __init__(self):
with open('conf/indy.conf') as f:
conf = json.load(f)
self.acl = conf['acl']
self.password = conf['admin_password']
def create_nonce(sel... |
# -*- coding: utf-8 -*-
# @Author: Martin Raetz
# @Date: 2019-02-19 18:41:56
# @Last Modified by: Martin Rätz
# @Last Modified time: 29.11.2019
"""
This script demonstrates how a building can be generated by importing building
data from excel.
An appropriate example file with some building data is imported from
exam... |
from . import *
import os
class TestConfigCommand(TestBase):
def test_dump(self):
dump = self._arduino.config.dump()["result"]
self.assertIsInstance(dump, dict)
self.assertIn("directories", dump)
def test_init(self):
config_path = self._arduino.config.init(".")["result"].spli... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
------------------------------------------------... |
"""Test kernel for signalling subprocesses"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
from subprocess import Popen, PIPE
import sys
import time
from ipykernel.displayhook import ZMQDisplayHook
from ipykernel.kernelbase import Kernel
from ipykern... |
from .base import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('{{cookiecutter.author_name}}', '{{cookiecutter.email}}'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '{{cookiecutter.repo_name}}',
'USER': '',
... |
from typing import Dict
from setuptools import find_packages, setup # type: ignore
def long_description() -> str:
return """
## Dagster
Dagster is a data orchestrator for machine learning, analytics, and ETL.
Dagster lets you define pipelines in terms of the data flow between reusable, logical components,
then... |
""" Minimal placeholder module """
from boilerplate import hello
Hello = hello.Hello |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
"""Generated message classes for translate version v3beta1.
Integrates text translation into your website or application.
"""
# NOTE: This file is autogenerated and should not be edited by hand.
from apitools.base.protorpclite import messages as _messages
from apitools.base.py import encoding
from apitools.base.py im... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
import sys
def main(argv):
print("Hello World!")
if __name__ == "__main__":
main(sys.argv[1:]) |
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Matti Hämäläinen <msh@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
from gzip import GzipFile
import os.path as op
import re
import time
import uuid
import numpy as np
from scipy import linalg, sparse
from .constants import FIFF
from ..fixes i... |
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------
im... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch.utils.data
import torchvision
from .coco import build as build_coco
def get_coco_api_from_dataset(dataset):
for _ in range(10):
# if isinstance(dataset, torchvision.datasets.CocoDetection):
# break
if ... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
# -*- coding: utf-8 -*- #
# Copyright 2013 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 2016 Canonical 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 writing, s... |
import functools
from hashlib import md5
import dill
from pandas import DataFrame, Series
# pylint: disable=too-many-return-statements
def to_bytes(obj: object) -> bytes:
"""Convert any object to bytes
@param obj:
@return:
"""
if isinstance(obj, DataFrame):
if obj.empty:
retur... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#arduino_interface.py
#Python-Arduino Interface
#Assumes Arduino on COM4
#Dillon Wong 04/08/2018
#TODO: Wrapper to switch X-Y capacitance meter
#TODO: Wrapper to activate voltage divider relays
import serial
class arduino:
def __init__(self, com_port = 'COM4'):
self.arduino = serial.Serial('COM4', 9600)... |
# Copyright 2019 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -----------------------------------------------------------
# Copyright (c) 2021. Danil Smirnov
# Zoom challenged Flash and offered him a fair fight in the
# form of a race. If Zoom is faster than Flash, you need
# to output "NO", if Flash is faster than Zoom, you need
# to output "YES", if their sp... |
# Always prefer setuptools over distutils
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
import json
import re
here = path.abspath(path.dirname(__file__))
def parse_req_line(line):
line = line.strip()
if not line or line.startswith('--hash') or line[0]... |
import cv2
import numpy as np
import argparse
import os
import json
def iswhite(p):
return p[0] > 180 and p[1] > 180 and p[2] > 180
def convert(o):
if isinstance(o, np.int64):
return int(o)
else:
return o
def avgcolor(img):
total = [0, 0, 0]
ctr = 0
eps = int(0.1 * sum(img.... |
import os
import random
import time
import numpy as np
import torch
import torch.optim as optim
from torch.utils.data import DataLoader
from crossView import PVA_model, Argoverse
from opt import get_args
import tqdm
from datetime import datetime
from utils import mean_IU, mean_precision
import wandb
def readlines(f... |
import cv2
from libs.ffmpeg_reader import FFMPEG_VideoReader
def mat2bytes(image):
image = image[:, :, ::-1]
return cv2.imencode('.jpg', image)[1].tostring()
class VideoCapture:
def __init__(self, video_source, start_frame=0, shift_time=0):
self.video = FFMPEG_VideoReader(video_source, True)
... |
import re
def get_text(string):
"""
normalizing white space and stripping HTML markups.
"""
text = re.sub('\s+',' ',string)
text = re.sub(r'<.*?>',' ',text)
return text
print get_text("<pre>Hi,<br><br>Unless IEm mistaken, this bill has not been paida Do I know if there is a problem or if itEs just... |
import logging
from ...abc.source import Source
#
L = logging.getLogger(__name__)
#
class WebServiceSource(Source):
'''
This source is to be integrated into aiohttp.web as a 'View'.
Example:
async def view(self, request):
await self.WebServiceSource.put(None, data, request)
return aiohttp.web.Response(text... |
import collections
import dataclasses
import datetime
import re
import typing
import uuid
from src import IRCBot, IRCServer, utils
MAX_LINES = 2 ** 10
@dataclasses.dataclass
class BufferLine(object):
sender: str
message: str
action: bool
tags: dict
from_self: bool
method: str
deleted: ... |
import logging
from datetime import datetime
from pathlib import Path
import inflection
from lib.audio.mp3_recorder import MP3Recorder
from lib.entities import Source
from lib.environment import Environment
from lib.library.file_store import FileStore
from lib.pipeline.ffmpeg_file_processor import FFMpegFileProcessor... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# -*- coding: utf-8 -*-
"""CCXT: CryptoCurrency eXchange Trading Library"""
# MIT License
# Copyright (c) 2017 Igor Kroitor
# 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 restricti... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @NetflixMovieslk
import re
import pyrogram
from pyrogram import (
filters,
Client
)
from pyrogram.types import (
InlineKeyboardButton,
InlineKeyboardMarkup,
Message,
CallbackQuery
)
from bot import Bot
from script import script
from databas... |
from atlasclient.client import Atlas
class TestClient():
def test_atlas_client(self):
client = Atlas('localhost', port=21000, username='admin', password='admin')
assert client.base_url == 'http://localhost:21000'
assert 'headers' in client.client.request_params.keys()
assert 'X-R... |
import asyncio
import getpass
import logging
import os
import sys
from asyncio.subprocess import Process
import pytest
from aiofiles.threadpool.binary import AsyncFileIO
from mock import AsyncMock
from further_link.runner.process_handler import ProcessHandler
logging.basicConfig(
stream=sys.stdout,
level=(lo... |
from person import Person
from job import Job
jobprefers = {
'sunday': ['amber', 'lisa', 'ana','matt', 'rob', 'kyle', 'kevin', 'abi', 'amy', 'jack', 'hope', 'mike'],
'monday': ['abi', 'kevin', 'rob', 'matt','amy', 'amber', 'lisa', 'kyle', 'jack','ana', 'hope', 'mike'],
'tuesday': ['rob', 'hope', 'abi', 'matt','lis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.