text stringlengths 2 999k |
|---|
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... |
"""JSON token scanner
"""
import re
def _import_c_make_scanner():
try:
from simplejson._speedups import make_scanner
return make_scanner
except ImportError:
return None
c_make_scanner = _import_c_make_scanner()
__all__ = ['make_scanner', 'JSONDecodeError']
NUMBER_RE = re.compile(
... |
import logging
import sys
import numpy as np
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler(sys.stdout))
# Perform prediction on the deserialized object, with the loaded model
def predict_fn(input_object, model):
logger.info("predict_fn")
logger.in... |
import torch
import torch.nn as nn
import torchvision
class NonLocalBlock(nn.Module):
def __init__(self, channel):
super(NonLocalBlock, self).__init__()
self.inter_channel = channel // 2
self.conv_phi = nn.Conv2d(in_channels=channel, out_channels=self.inter_channel, kernel_size=1, stride=1... |
# 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... |
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
# PKCS#1 syntax
#
# ASN.1 source from:
# ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.asn
#
# Sample captures could be obtained with "op... |
"""
-----
soup:
-----
find
find_all
select
find_by_class
find_by_id
find_by_tag
find_by_text
--------
selenium:
--------
find_element_by_id(id_)
find_elements_by_id(id_)
find_element_by_class_name(name)
find_elements_by_class_name(name)
find_element_by_css_selector(css_selector)
find_elements_by_css_selector(css_select... |
from __future__ import absolute_import, print_function
import codecs
import os
import os.path
import tempfile
from io import BytesIO, StringIO
# Skipped because we have no idea where the "unicode_filename"
# fixture is supposed to come from
import pytest
import ruyaml as yaml
pytestmark = pytest.mark.skip
def tes... |
import requests
import json
import base64
import cv2
def face_landmarking(image):
key = ""
secret = ""
http_url ="https://api-us.faceplusplus.com/facepp/v3/detect"
#if using image from URL
#url = "http://images2.chictopia.com/photos/Thefoxandfern/1491318141/gold-mini-dress-free-people-dress-black-a... |
"""
Mplot demo - run animated example
"""
import enaml
from enaml.qt.qt_application import QtApplication
def run_demo():
with enaml.imports():
from mplot_demo_scatter_animate import Main
app = QtApplication()
view = Main(custom_title='Matplotlib demo', mplot_style='darkish')
view.show()
... |
#tests
from calculus import finitesum
def test2_1():
exp=finitesum('2x^3y^4z^7')
assert(exp.derive('y')=='8x^3y^3z^7')
def test2_2():
exp2=finitesum('2x^2yz^3')
assert(exp2.derive('y')=='2x^2z^3')
def test2_3():
exp3=finitesum('y^3+2y')
assert(exp3.derive('y')=='2+3y^2')
def test2_4():
exp4=finitesum... |
"""Added description requirement config
Revision ID: e4b5bd2a05cc
Revises: 56a1480bb7cc
Create Date: 2020-02-04 03:04:27.899172
"""
# revision identifiers, used by Alembic.
revision = "e4b5bd2a05cc"
down_revision = "56a1480bb7cc"
from alembic import op
from sqlalchemy import orm
from oh_queue.models import *
def ... |
from django import forms
class OAuthValidationError(Exception):
"""
Exception to throw inside :class:`OAuthForm` if any OAuth2 related errors
are encountered such as invalid grant type, invalid client, etc.
:attr:`OAuthValidationError` expects a dictionary outlining the OAuth error
as its first a... |
import logging
import os
#
# Meta
#
BOT_OWNER_NAME = "Dragon#0571"
BOT_OWNER_ID = 263412940869206027
BOT_COMMAND_PREFIX = "slb"
BOT_GAME_NAME = "with rockets"
BOT_GITHUB_URL = "https://github.com/r-spacex/SpaceXLaunchBot"
BOT_CLIENT_ID = 411618411169447950
BOT_INVITE_PERMISSIONS = "19456"
BOT_INVITE_URL = (
"http... |
from __future__ import print_function
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
# If modifying these scopes, delete the file token.json.
SCOPES = 'https://www.googleapis.com/auth/spreadsheets.readonly'
# The ID and range of a sample spreadsheet.... |
from Common_Libraries.q2usb_lib import q2usb
from array import array
import time
import board
import busio
import adafruit_vl6180x
class rotarytable:
# Define class-level variables
_daq = None
# ToF sensors variabls
_i2c = None
_tof_sensor = None
# Initilize rotary t... |
#!/usr/bin/env python
#
# Copyright 2020 GoPro Inc.
#
# 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... |
#!/usr/bin/env python3
# Copyright (c) 2004-present Facebook All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from typing import Dict
from pysymphony import SymphonyClient
from .._utils import get_graphql_property_inputs
from ..common.cache im... |
import math
import random
import os
theFile = open("/afs/cern.ch/user/v/voutsina/Work/SR/data_gen/FCC_TTPLS_BND_18JUL_TA_M38_5MI_INC_TRKS_BOT.DAT") # all impinging photons to the mask
#theFile = open("/afs/cern.ch/user/v/voutsina/Work/SR/data_gen/FCC_TTPLS_BND_18JUL_TA_M38_250MI_ALL_TRKS.DAT") # all scattered photons ... |
import json
from argparse import Namespace
from typing import Dict, Set
from .chromosome import MethodCall
from .crossover_funcs import *
from .mutate_funcs import *
from .mutate_method_call import MutateMethodCall
from .obs_ga import ObsGA
from ..imitation.policy_imitation import PolicyImitation
from ..policy_base im... |
import torch.nn
from torch import nn
class SegmentConsensus(torch.nn.Module):
def __init__(self, consensus_type, dim=1):
super().__init__()
self.consensus_type = consensus_type
self.dim = dim
def forward(self, input_tensor):
if self.consensus_type == "avg":
output ... |
"""Metrics.
Author: Mengye Ren (mren@cs.toronto.edu)
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import sklearn.metrics
def label_equal(pred, label, axis=-1):
return pred == label.astype(pred.dtype)
def top1_correct(pred, la... |
# Copyright 2016 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 applicable ... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import logging
logging.basicConfig(format='%(message)s')
from fairing import builders
class Conf... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
#
""" Userbot module containing hash and encode/decode commands. """
from subprocess import PIPE
from subprocess import ... |
class HashTable:
def __init__(self, size):
self.size = size
self.n = 0
self.key_table = [None] * size
self.value_table = [None] * size
def put(self, key, value, resize = True):
hash_key = hash(key) % self.size
while True:
if self.key_table[hash_k... |
from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.typedef import TypeDef, GetSetProperty
from rpython.rtyper.lltypesystem import rffi, lltype
from pypy.module.cpyext.structmemberdefs import *
from pypy.module.cpyext.api import ADDR, PyObjectP, cpython_api, CONST_STRING
from pypy.module.cpye... |
# -*- coding: utf-8 -*-
# Copyright 2022 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... |
# Generated by Django 2.2.7 on 2019-11-29 10:02
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
... |
#!/usr/bin/python3
import os
import sys
import shutil
import numpy as np
import scipy.io as sio
from tqdm import tqdm
def pack(array):
""" convert a boolean array into a bitwise array. """
array = array.reshape((-1))
#compressing bit flags.
# yapf: disable
compressed = array[::8] << 7 | array[1::8] << 6 ... |
#!/usr/bin/python2
"""
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"); yo... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
from jd.api.base import RestApi
class KplOpenSkuQueryinfoRequest(RestApi):
def __init__(self,domain='gw.api.360buy.com',port=80):
RestApi.__init__(self,domain, port)
self.skuQuery = None
def getapiname(self):
return 'jd.kpl.open.sku.queryinfo'
|
# coding: utf-8
from struct import unpack
from warnings import warn
from .value.values import *
__all__ = ['Flavor', 'FixedFlavor', 'RefFlavor', 'VertexFlavor', 'FaceFlavor', 'BspFlavor',
'F00', 'F01', 'F02', 'F03', 'F04', 'F05', 'F06', 'F07', 'F08', 'F09',
'F10', 'F11', 'F12', 'F13', 'F14', 'F1... |
############################################################################
# #
# Copyright (c) 2017 eBay Inc. #
# #
# Licensed u... |
import asyncio
import base64
import hashlib
import json
import math
import os
import sys
import time
from dataclasses import asdict, dataclass, field, InitVar
from json import JSONDecodeError
from os.path import splitext, basename
from typing import Union, Any
from urllib import parse
from urllib.parse import quote
im... |
import os
import time
not_executed=1
print("Enter the time of the alarm to be set")
x,y=raw_input().split(' ')
while(not_executed):
dt=list(time.localtime())
hour=dt[3]
minute=dt[4]
print("%s and %s , given %s and %s"%(hour,minute,x,y))
if hour==x and minute==y:
print "Insid... |
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Bitcoin Core developers
# Copyright (c) 2018-2021 The EMRALS Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test createwallet arguments.
"""
from test_framew... |
# Artur Mello
# Fuzzy C Means - Algorithm validation and performance analysis
# TP 1 - Sistemas Nebulosos
import matplotlib.pyplot as plt
import numpy as np
from scipy import io
from fuzzy_c_means import fuzzy_c_means
def main():
k = 4
samples = np.asarray(io.loadmat("fcm_dataset.mat")["x"])
avg_iteration... |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from datasets.imdb import imdb
import datasets.ds_utils as ds... |
#!/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', 'app.settings')
try:
from django.core.management import execute_from_command_line
except ImportEr... |
import flare
import numpy as np
flare.flare_dir="../flare"
#file="FisherStudy-most-HH.dat"
#file="FisherStudy.dat"
#label="test11.15"
label="L3LISA-v1-sens-but-5Gm"
file=label+"-FisherStudy.dat"
#flare.FisherPlot(label,9,[1.1,2.0,4.0,10.0],[10,100,1000],[0.1,0.3],file)
#flare.FisherPlot(label,0,[1.1,2,4,10],[10,100,10... |
from collections import abc
from datetime import date, time, timedelta, timezone
from decimal import Decimal
import operator
import os
from dateutil.tz import tzlocal, tzutc
import hypothesis
from hypothesis import strategies as st
import numpy as np
import pytest
from pytz import FixedOffset, utc
import pandas.util.... |
import pandas as pd
from netstats.fsan import Fsan
class ListaDataframe:
def __init__(self, operacao):
self.operacao = operacao
def dataframe(self):
"""
Retorna uma lista de dataframes por FSAN, cada dataframe contém as operações realizadas
com a FSAN.
... |
from __future__ import absolute_import
import unittest
import urllib
from testutils import ADMIN_CLIENT, suppress_urllib3_warning
from testutils import harbor_server
from testutils import TEARDOWN
from library.sign import sign_image
from library.artifact import Artifact
from library.project import Project
from library... |
import requests
import threading
from multiprocessing import Queue
import time
import sys
import json
import tools.Analisis as Analisis
import time
import mimetypes
class Peticion(object):
def __init__(self,url,payload,tipo,headers, auth):
self.payload = payload
if(payload != None):
sel... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-06-15 17:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('services', '0008_auto_20170615_1742'),
]
operations = [
migrations.AddField(
... |
from __future__ import print_function
import sys
from collections import OrderedDict
import numpy as np
def parse_cif(infile):
if isinstance(infile, file):
pass
elif isinstance(infile, str):
infile = open(infile)
else:
raise TypeError("Input should either be a file or string.")
... |
COINBASE_MATURITY = 500
INITIAL_BLOCK_REWARD = 20000
INITIAL_BLOCK_REWARD_POS = 4
INITIAL_HASH_UTXO_ROOT = 0x21b463e3b52f6201c0ad6c991be0485b6ef8c092e64583ffa655cc1b171fe856
#INITIAL_HASH_STATE_ROOT = 0x9514771014c9ae803d8cea2731b2063e83de44802b40dce2d06acd02d0ff65e9
INITIAL_HASH_STATE_ROOT = 0xe347448b257b1ec40ec2ace0... |
import re
from manga_py.provider import Provider
from .helpers.std import Std
from html import escape
class MangaDexOrg(Provider, Std):
__content = None
__chapters = None
__languages = None
__countries = {
'': 'Other',
'bd': 'Bengali',
'bg': 'Bulgarian',
'br': 'Portugue... |
import numpy as np
import pandas as pd
import cv2
from imutils import paths
import argparse
import pickle
import vptree
import matplotlib.pyplot as plt
import time
from tqdm import tqdm
import os
from skimage.io import imread, imshow
import seaborn as sns
from src.helpers import *
MAIN_PATH = "../../data/full_75x75/tr... |
import cutecharts.charts as ctc
import pandas as pd
import numpy as np
# https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html
df=pd.read_csv('catsshouldnt.csv', sep=',')
# https://github.com/cutecharts/cutecharts.py#-usage
chart = ctc.Bar('Follower count for @catsshouldnt',width='500px',hei... |
import time
from typing import List
class Poll:
def __init__(self, chat_id: int, id_: int):
self.title = ''
self.option_list: List[dict] = []
self.open = False
self.start_time = 0
self.last_time = 0
self.readable_time = ''
# if anonymous when the poll is ope... |
"""fresh_shopping URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/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')
Clas... |
from typing import Any, Dict, List, Optional
import pytest
from nuplan.common.actor_state.state_representation import StateSE2
from nuplan.common.maps.abstract_map_objects import AbstractMapObject, Crosswalk, GraphEdgeMapObject, Intersection, \
StopLine
from nuplan.common.maps.maps_datatypes import SemanticMapLaye... |
# Copyright 2018 The TensorFlow Probability 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... |
"""nanopub endpoints"""
# Standard Library
from typing import List
# Third Party
import fastapi
from fastapi import APIRouter, Depends
from loguru import logger
# Local
import bel.nanopub.validate
from bel.api.core.exceptions import HTTPException
from bel.schemas.nanopubs import NanopubR
router = APIRouter()
@rout... |
__author__ = 'jingyu'
from django import template
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
register = template.Library()
url_validator = URLValidator()
@register.filter()
def get_type(value):
"""
Helper function that returns the class name of the varia... |
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
from basicapp.models import UserProfileInfo
@receiver(post_save, sender=User)
def create_profile(sender, instance, created, **kwargs):
if created:
UserProfileInfo.objects.create(... |
#!/usr/bin/env python3
# Greentea host test script for Mbed TLS on-target test suite testing.
#
# Copyright The Mbed TLS Contributors
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
#
# This file is provided under the Apache License 2.0, or the
# GNU General Public License v2.0 or later.
#
# **********
# Apa... |
"""
Constitutive Relations
======================
When solving PDEs using the finite volume approach, inner products may
contain constitutive relations; examples include Ohm's law and Hooke's law.
For this class of inner products, you will learn how to:
- Construct the inner-product matrix in the case of isotropi... |
# -*- coding: utf-8 -*-
# @Time : 2020-07-09 10:16
# @Author : yingyuankai
# @Email : yingyuankai@aliyun.com
# @File : __init__.py
from .qa_with_impossible import *
from .qa_simple import * |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# 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 b... |
# -*- coding: utf-8 -*-
from pandas import DataFrame
from ..utils import get_drift, get_offset, non_zero_range, verify_series
def true_range(high, low, close, drift=None, offset=None, **kwargs):
"""Indicator: True Range"""
# Validate arguments
high = verify_series(high)
low = verify_series(low)
clo... |
AUTHOR_DATE = {
"A.D. 1": [
"0031",
"0041",
"0280",
"0283",
"0347",
"0526",
"0587",
"0619",
"0628",
"0643",
"0648",
"0654",
"0656",
"0716",
"0825",
"0888",
"1004",
"1152",
... |
"""
A set of tests for using the QCEngine project
"""
import copy
import numpy as np
import tempfile
import logging
import math
from geometric.molecule import bohr2ang
logger = logging.getLogger(__name__)
from . import addons
import geometric.optimize as gt
from geometric.internal import CartesianCoordinates,\
... |
"""Fixtures for flight model"""
import pytest
import uuid
import datetime
from src.models import Flight
from src.utilities.enums import FlightStatusEnum
@pytest.fixture(scope='module')
def new_flight(app, init_db, new_airplane):
"""Fixture to create a new flight"""
new_airplane.save()
flight = {
"... |
import os
import os.path
import sys
import logging
import zipfile
import tarfile
import shutil
import subprocess
import tempfile
import datetime
import glob
# -----------------------------------------------------------------------------
class PySparkLogger(object):
def __init__(self, level=logging.NOTSET, stream... |
#!/usr/bin/env python3
# Copyright (c) 2018 The Navcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import NavCoinTestFramework
from test_framework.util import *
import time
... |
"""Exceptions raised by the Route53 service."""
from moto.core.exceptions import RESTError
class Route53ClientError(RESTError):
"""Base class for Route53 errors."""
def __init__(self, *args, **kwargs):
kwargs.setdefault("template", "wrapped_single_error")
super().__init__(*args, **kwargs)
c... |
import sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
import maya.cmds as cmds
# Intro: Move Pivots to object center selected last
# Plug-in information:
kPluginCmdName = 'vsaPivotToLastSelect'
# Special deselect main function
class PivotToLastSelectCommand( OpenMayaMPx.MPxCommand):
d... |
# Generated by Django 2.1.5 on 2019-02-01 14:22
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Circle',
fields=[
('id', models.AutoField(a... |
# Generated by Django 3.0.13 on 2021-03-15 09:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('generic_app', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='singlecharacter',
name='text',
... |
from kapteyn import maputils
from matplotlib import pylab as plt
header = {'NAXIS': 2 ,'NAXIS1':100 , 'NAXIS2': 100 ,
'CDELT1': -7.165998823000E-03, 'CRPIX1': 5.100000000000E+01 ,
'CRVAL1': -5.128208479590E+01, 'CTYPE1': 'RA---NCP', 'CUNIT1': 'DEGREE ',
'CDELT2': 7.165998823000E-03, 'CRPIX2': 5.100000000000E+01,
'CRV... |
# coding=utf-8
# Copyright 2020 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... |
# -*- coding: utf-8 -*-
"""
Stopword extraction and stopword classes.
"""
__title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
import os
import re
import string
from .utils import FileHelper
TABSSPACE = re.compile(r'[\s\t]+')
def innerTrim(value):... |
""" Official evaluation script for SQuAD version 2.0.
Modified by XLNet authors to update `find_best_threshold` scripts for SQuAD V2.0
In addition to basic functionality, we also compute additional statistics and
plot precision-recall curves if an additional na_prob.json file is provided.
This file is expected ... |
import torch
from torch.nn import Module
from torch.nn import init
from torch.nn.parameter import Parameter
# Acknowledgements: https://github.com/wohlert/semi-supervised-pytorch
class Standardize(Module):
"""
Applies (element-wise) standardization with trainable translation parameter μ and scale parameter σ... |
import torch
import torch.nn as nn
import math
import numbers
from torch.nn import functional as F
import numpy as np
def LoG(imgHF): #Laplacian of Gaussian
# The LoG operator calculates the second spatial derivative of an image.
# This means that in areas where the image has a constant intensity (i.e.
#... |
import os
import json
#from dotenv import load_dotenv
#load_dotenv()
FIREBASE_TYPE = os.getenv('FIREBASE_TYPE')
FIREBASE_PROJECT_ID = os.getenv('FIREBASE_PROJECT_ID')
FIREBASE_PRIVATE_KEY_ID = os.getenv('FIREBASE_PRIVATE_KEY_ID')
FIREBASE_PRIVATE_KEY = os.getenv('FIREBASE_PRIVATE_KEY')
FIREBASE_CLIENT_EMAIL = os.get... |
{
"targets": [
{
"target_name": "keyboard-layout-manager",
"sources": [
"src/keyboard-layout-manager.cc"
],
"include_dirs": [
"<!(node -e \"require('nan')\")",
"chrome_headers",
],
"conditions": [
['OS=="mac"', {
"sources": [
... |
import re
import traceback
from typing import Iterable, List, Union
from urllib.parse import urljoin, urlparse
import tqdm
from crawlers.Crawler import Crawler as CrawlerBase
from crawlers.lemonde.Spider import Spider
from crawlers.Types import ArticleReturnType
from models.Article import Article
from playwright.sync_... |
def sum_squares_to(n):
result = 0
for i in range(n+1):
result += i^2
return result
|
from spynnaker.pyNN import *
__version__ = "2016.001"
|
sm.sendSayOkay("I will send you back to your previous location.")
sm.warp(chr.getPreviousFieldID()) |
import numpy
from chainer import cuda
from chainer import function
from chainer.functions import convolution_2d as conv2d_module
from chainer.utils import type_check
class NonparameterizedConvolution2D(function.Function):
"""Two-dimensional nonparameterized convolution class.
Args:
stride (int or (... |
import signal
import sys
import unittest
import warnings
from unittest import mock
import pytest
import asyncio
from asyncio import base_subprocess
from asyncio import subprocess
from .. import utils as test_utils
try:
from test import support
except ImportError:
from asyncio import test_support as support
if ... |
"""
面试题 55(一):二叉树的深度
题目:输入一棵二叉树的根结点,求该树的深度。从根结点到叶结点依次经过的
结点(含根、叶结点)形成树的一条路径,最长路径的长度为树的深度。
"""
class BSTNode:
"""docstring for BSTNode"""
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def connect_bst_nodes(head: BSTNode, left: BSTNode, right: BSTNode) -> BS... |
# coding: utf-8
# Copyright (c) 2016, 2022, 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... |
import logging
import discord
from redbot.core import Config, commands
from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import box, humanize_list
from .utils import Coordinate
log = logging.getLogger("red.craycogs.joinping")
guild_defaults = {
"ping_channels": [],
"delete_after": 2,
... |
import time
import datetime as dt
import json
import logging
import random
from dateutil.parser import parse
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdrive... |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textw... |
srcDir = "/srv/unmix-server/1_sources/RockBand-GuitarHero/"
destDir = "/srv/unmix-server/2_prepared/RockBand-GuitarHero/"
# Handle multitrackdownloads-alphanumeric
# This folder contains mogg files (sometimes directly in song folder, sometimes in subfolder).
# Take those and convert them with ffmpeg.
import subproc... |
#!/usr/bin/env python
#
# Restriction Analysis Libraries.
# Copyright (C) 2004. Frederic Sohm.
#
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
#
"""Restriction Enzyme classes.
Notes abou... |
from contextlib import contextmanager
from pathlib import Path
from textwrap import indent
from typing import Tuple
import pytest
import sqlalchemy
import structlog
from click.testing import CliRunner
from datacube.drivers.postgres import PostgresDb
from datacube.drivers.postgres._core import METADATA as ODC_SCHEMA_ME... |
import sklearn.utils
from river import base
from river import stream
def iter_sklearn_dataset(dataset: "sklearn.utils.Bunch", **kwargs) -> base.typing.Stream:
"""Iterates rows from one of the datasets provided by scikit-learn.
This allows you to use any dataset from [scikit-learn's `datasets` module](https:... |
from pprint import pprint
|
""" testing activitystreams """
from datetime import datetime, timedelta
from unittest.mock import patch
from django.test import TestCase
from django.utils import timezone
from bookwyrm import activitystreams, models
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async")
@patch("bookwyrm.lists_strea... |
class Solution:
def sortedSquares(self, A: List[int]) -> List[int]:
squared=[]
for i in A:
squared.append(i**2)
squared.sort()
return squared
|
from cefpython3 import cefpython as cef
import platform
import sys
def main():
check_versions()
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
cef.Initialize()
cef.CreateBrowserSync(url="https://fortune.chinanews.com/",
window_title="Hello World!")
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.