text stringlengths 1 927k |
|---|
"""
Construction and Manipulation of Package/Recipe Graphs
"""
import logging
from collections import defaultdict
from fnmatch import fnmatch
from itertools import chain
import networkx as nx
from . import utils
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
def build(recipes, config, black... |
# Copyright (c) 2018 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 app... |
"""
Flask API main module.
"""
from __future__ import absolute_import
import logging
from flask import Flask
from flask_restplus import Api, Resource, fields
from pytom2.source.pdb_parser_module import PDB
logging.info("Initializing Flask objects...")
APP = Flask(__name__)
API = Api(APP)
logging.info("Initializing mo... |
# Copyright 2000 by Jeffrey Chang. All rights reserved.
# 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.
"""
This module is OBSOLETE.
Most of the functionality in this module has moved to Bio.ExPASy.... |
import pandas as pd
import boto3
import json
import configparser
config = configparser.ConfigParser()
config.read_file(open('dwh.cfg'))
KEY = config.get('AWS','KEY')
SECRET = config.get('AWS','SECRET')
DWH_CLUSTER_TYPE = config.get("DWH","DWH_CLUSTER_TYPE")
DWH_NUM_NODES ... |
"""Unit tests for numbers.py."""
import math
import unittest
from numbers import Complex, Real, Rational, Integral
from test import test_support
class TestNumbers(unittest.TestCase):
def test_int(self):
self.assertTrue(issubclass(int, Integral))
self.assertTrue(issubclass(int, Complex))
s... |
while 1==1:
import bot |
# Copyright (c) 2008, 2010 Aldo Cortesi
# Copyright (c) 2010 matt
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2012 Tim Neumann
# Copyright (c) 2013 Craig Barnes
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 Tycho Andersen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# o... |
# Copyright (2013) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
# retains certain rights in this software.
#
# This software is released under the FreeBSD license as described
# in License.txt
import time as Timer
import datetime
import string
impor... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 Northwestern University.
#
# invenio-subjects-lcsh is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""MeSH subject terms for InvenioRDM."""
from .version import __version__
__all__ = (... |
import pandas as pd
from autokeras import auto_model
from autokeras.hypermodel import head
from autokeras.hypermodel import node
class SupervisedImagePipeline(auto_model.AutoModel):
def __init__(self, outputs, **kwargs):
super().__init__(inputs=node.ImageInput(),
outputs=outputs... |
from nempy import markets, historical_spot_market_inputs |
from os.path import abspath, dirname, join
from fnmatch import fnmatchcase
from operator import eq
from robot.api import logger
CURDIR = dirname(abspath(__file__))
def output_should_be(actual, expected, **replaced):
actual = _read_file(actual, 'Actual')
expected = _read_file(join(CURDIR, expected), 'Expect... |
# 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 applica... |
# Import from individual files
from .dataframe import *
# Remove dunders
__all__ = [f for f in dir() if not f.startswith("_")] |
import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.SMO/Serif_8/udhr_Latn.SMO_Serif_8.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True)) |
from django.shortcuts import render
def accounts(request):
return render(request, 'accounts/account.html') |
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def getPoint(self):
return (self.x, self.y) |
from pyrogram import Client, filters
import asyncio
import os
from pytube import YouTube
from pyrogram.types import InlineKeyboardMarkup
from pyrogram.types import InlineKeyboardButton
from youtubesearchpython import VideosSearch
from AlexaSongBot.mrdarkprince import ignore_blacklisted_users, get_arg
from AlexaSongBot ... |
"""Support for the GIOS service."""
from homeassistant.components.air_quality import (
ATTR_CO,
ATTR_NO2,
ATTR_OZONE,
ATTR_PM_2_5,
ATTR_PM_10,
ATTR_SO2,
AirQualityEntity,
)
from homeassistant.const import CONF_NAME
from .const import ATTR_STATION, DATA_CLIENT, DEFAULT_SCAN_INTERVAL, DOMAIN,... |
#!/usr/bin/env python
# coding: utf-8
# ## Problem 1: Simple scatter plot using random
#
# We can generate random numbers using using a method `random.rand()` from the [NumPy package](https://numpy.org/). This example generates 10 random values:
#
# ```
# import numpy as np
# random_numbers = np.random.rand(10)
#
... |
# qubit number=2
# total number=13
import cirq
import qiskit
from qiskit import IBMQ
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy a... |
import neighborhoods_api
import apartments_scrape
import queries_from_terminal
import sys
print(f"We're in file {__file__}")
#Require the user to input this driver and source option
#Will prompt the user to enter a source argument (remote or local)
if len(sys.argv) < 2:
print('To few arguments, please put in LA_A... |
#!/usr/bin/env vpython
# Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
# Disable 'Access to a protected member', Unused argument', 'Unused variable'.
# pylint: disable=W0212,W0612,W0613
# pylint... |
"""
WSGI config for purnkleen project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... |
# python has several data types
# numeric data types -
# int, float
# int for whole numbers
x = 10 + 2
# python is dynamically typed, so we can assign whatever value we want to
# any variable... but type annotations are a good way to keep organized.
# float for fractional numbers or very large numbers
y: float = 10.... |
import re
from HouseMarketTracker.parser.ImagesParser import ImagesParser
from HouseMarketTracker.parser.ParseUtil import ParseUtil
class HouseHomePageParser():
def parse(self, response):
meta = response.meta
item = meta['item']
item['house_layout'] = self.parse_layout(response)
... |
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 de... |
from flask_restful import Resource, reqparse
from flask import Flask,request, make_response
from passlib.hash import pbkdf2_sha256 as sha256
users_list = []
class User():
def __init__(self, email, password):
self.user_id = len(users_list)+1
self.email = email
self.password = password
... |
#!/usr/bin/env python
# version: 3.001
#
# -*- coding: utf-8 -*-
#
# File: PacketSniffer.py ; This file is part of Twister.
#
# Copyright (C) 2012-2013 , Luxoft
#
# Authors:
# Adrian Toader <adtoader@luxoft.com>
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except... |
from estimate.constants import * |
import math
import numpy as np
import matplotlib.pyplot as plt
class OneDConsolidation:
"""
z = 0, free flow boundary condition
z = H, impermeable boundary condition
Parameters:
1. Cv, coefficient of consolidation;
2. Es, one dimensional compressive modulus
3. u0, initial pore p... |
#!/usr/bin/env python
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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. ... |
import requests
import json
import requests
def remote_named_entity_recognition(document, ner_api_secret):
assert ner_api_secret and ner_api_secret != 'PLEASE_ADD_YOUR_OWN_GOOGLE_API_KEY_HERE', "Please add you Google API Key for Named Entity Recognition"
payload = {
"document": {
"type"... |
# P2P helper functions
# Copyright (c) 2013-2015, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import threading
import time
import Queue
import hwsim_utils
MGMT_SUBTYPE_PROBE_REQ = 4
MGMT_SU... |
"""
Given the root of a binary tree, return the length of the diameter of the tree.
The diameter of a binary tree is the length of the longest path between any two nodes in a tree.
This path may or may not pass through the root.
The length of a path between two nodes is represented by the number of edges between th... |
import spacy
# Importe le Matcher
from spacy.____ import ____
nlp = spacy.load("fr_core_news_sm")
doc = nlp("Le constructeur Citröen présente la e-Méhari Courrèges au public.")
# Initialise le matcher avec le vocabulaire partagé
matcher = ____(____.____)
# Crée un motif qui recherche les deux tokens : "e-Méhari" et... |
from electrum_zaap.i18n import _
fullname = 'TREZOR Wallet'
description = _('Provides support for TREZOR hardware wallet')
requires = [('trezorlib','github.com/trezor/python-trezor')]
registers_keystore = ('hardware', 'trezor', _("TREZOR wallet"))
available_for = ['qt', 'cmdline'] |
from typing import Iterable
__all__ = ['in_', 'not_in', 'exists', 'not_exists', 'equal', 'not_equal']
class Operator:
def __init__(self, op_name: str, op: str, value=None):
self.op = op
self.value = value
self.op_name = op_name
def encode(self, key):
return f"{key}{self.op}{s... |
'''
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 use this ... |
import os
import numpy as np
import json
import time
from keras.callbacks import Callback
from deephar.data import BatchLoader
from deephar.utils import *
def eval_singleclip_gt_bbox_generator(model, datagen, verbose=1):
num_blocks = len(model.outputs)
num_samples = len(datagen)
start = time.time()
... |
import os
os.environ["CUDA_VISIBLE_DEVICES"]="0" #CUDA_VISIBLE_DEVICES=0 (always use the first GPU only)
import time
import string
import argparse
import torch
import torch.backends.cudnn as cudnn
import torch.utils.data
from utils import AttnLabelConverter
from model import Model
from demo import detect_ocr
from ... |
"""Session implementation for CherryPy.
You need to edit your config file to use sessions. Here's an example::
[/]
tools.sessions.on = True
tools.sessions.storage_class = cherrypy.lib.sessions.FileSession
tools.sessions.storage_path = "/home/site/sessions"
tools.sessions.timeout = 60
This sets th... |
"""
Copyright 2008 Online Agility (www.onlineagility.com)
Copyright 2009 John D'Agostino (http://www.mercurycomplex.com)
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/lic... |
"""Configuration file loader for the experiments configuration."""
import yaml
def load_config():
"""Load the app configuration file."""
with open('../conf/experiments.yaml', 'r') as config_file:
try:
return yaml.safe_load(config_file)
except yaml.YAMLError as exc:
prin... |
import abc
import builtins
import datetime
import enum
import typing
import jsii
import publication
import typing_extensions
import constructs._jsii
import ros_cdk_core._jsii
__jsii_assembly__ = jsii.JSIIAssembly.load(
"@alicloud/ros-cdk-rocketmq",
"1.0.3",
__name__[0:-6],
"ros-cdk-rocketmq@1.0.3.jsi... |
from django.shortcuts import get_object_or_404
from rest_framework import generics, status
from rest_framework.response import Response
from rest_framework.views import APIView
from dualtext_api.models import Project
from dualtext_api.serializers import ProjectSerializer
from dualtext_api.permissions import MembersRead... |
import os
import shutil
import random
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from PIL import Image
random.seed(2020)
IMG_CROP = True
# save gt_image_2 into gt_image, so that road is assigned to 255 and non-road is 0
train_gt_path = "../../data_road/training/gt_image_2/"
save_gt_path... |
from django.db import migrations
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site")
custom_domain = "cv01-33948.botics.co"
site_params = {
"name": "cv01",
}
if custom_domain:
site_params["domain"] = custom_domain
Site.objects.update_or_create(default... |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import time
# DEFINICIÓ DE CONSTANTS (per fer més comprensible l'anàlisi del codi):
DELETION_COST = 2
INSERTION_COST = 1
SUBSTITUTION_COST = 1
def main():
pattern = "ALGORITHM"
text = "ADVANCED"
t = time.clock()
print u"DISTÀNCIA DE LEVENSHTEIN:... |
# Generated by Django 2.1 on 2018-10-14 02:57
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.functions.comparison
import re
class Migration(migrations.Migration):
replaces = [('journeylog', '0001_initial'), ('journeylog', '0002_aut... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from __future__ import annotations
from pathlib import Path, PurePath, PurePosixPath, PureWindowsPath
from random import randint
from typing import Any, Dict, Iterable, List, Optional, Type, TypeVar, Union, cast
from lisa import schema
from lis... |
from django.contrib import admin
from imagekit.admin import AdminThumbnail
from mptt.admin import DraggableMPTTAdmin
from ad.models import City, \
Category, AdvertisementImage, Advertisement
class SubCategoryInline(admin.TabularInline):
model = Category
extra = 14
exclude = ('icon', 'slug')
class ... |
from click import Option
from unleash import opts, log, commit
from unleash import __version__ as unleash_version
PLUGIN_NAME = 'footer'
# make sure version info is written first, so the footer does not get
# overwritten
PLUGIN_DEPENDS = ['versions']
FOOTER_FORMAT = u'\n[commit by unleash {}]\n'
def setup(cli):
... |
"""
Low-level LAPACK functions (:mod:`scipy.linalg.lapack`)
=======================================================
This module contains low-level functions from the LAPACK library.
The `*gegv` family of routines have been removed from LAPACK 3.6.0
and have been deprecated in SciPy 0.17.0. They will be removed in
a f... |
import os
import time
from random import SystemRandom
from django.contrib.auth.models import User, Group
from django.http import HttpResponse
from prometheus_client import Counter, Gauge, Summary, Histogram, Info, Enum
from rest_framework import viewsets, permissions
from metrics_app.models import MyModel
from metric... |
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import xgboost as xgb
import h5py
import os
from data_clean import pre_process,get_agg
#------------------------------定义评估标准---------------------------
def map5eval(preds,dtrain):
actual = dtrain.get_label()
predicted =... |
"""A script to run inference on a set of image files.
NOTE #1: The Attention OCR model was trained only using FSNS train dataset and
it will work only for images which look more or less similar to french street
names. In order to apply it to images from a different distribution you need
to retrain (or at least fine-tu... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class AKCItem(scrapy.Item):
image_urls = scrapy.Field()
images = scrapy.Field()
breed = scrapy.Field()
link = scrapy.Field()
desc... |
"""empty message
Revision ID: 4432129ea292
Revises:
Create Date: 2020-05-13 18:27:44.141674
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4432129ea292'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
"""
C13751579: Asset Picker UI/UX
"""
import os
import sys
from PySide2 import QtWidgets, QtTest, QtCore
from ... |
#!/Users/mcmenamin/.virtualenvs/py3env/bin/python
from lxml import html
import requests
from datetime import date
import numpy as np
import pandas as pd
import re as re
from itertools import chain
import pickle
from tqdm import tqdm
def getURLforYear(year, archiveURL='http://www.uexpress.com/dearabby/archives'):
... |
import json
import os
import subprocess
import zipfile
import hashlib
import pytest
import py.path
import exifread
EXECUTABLE = os.getenv("MAPILLARY_TOOLS_EXECUTABLE", "python3 -m mapillary_tools")
IMPORT_PATH = "tests/integration/mapillary_tools_process_images_provider/data"
USERNAME = "test_username_MAKE_SURE_IT_IS... |
from gym.envs.mujoco import HalfCheetahEnv
import argparse
import gym
import rlkit.torch.pytorch_util as ptu
from rlkit.data_management.env_replay_buffer import EnvReplayBuffer
from rlkit.envs.wrappers import NormalizedBoxEnv
from rlkit.launchers.launcher_util import setup_logger
from rlkit.samplers.data_collector impo... |
def simpleArraySum(ar):
# sum() function works on lists
return sum(ar) |
import operator
from torchmetrics.utilities.imports import _compare_version
_LIGHTNING_GREATER_EQUAL_1_3 = _compare_version("pytorch_lightning", operator.ge, "1.3.0") |
import calendar
import sys
from collections import defaultdict
from datetime import date, datetime, timedelta
from decimal import Decimal
from importlib import import_module
import isoweek
import pytz
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.db.models import (
... |
import setuptools
setuptools.setup(
name="jupyter-rsession-proxy",
version='1.0dev',
url="https://github.com/jupyterhub/jupyter-rsession-proxy",
author="Ryan Lovett & Yuvi Panda",
description="Jupyter extension to proxy RStudio's rsession",
packages=setuptools.find_packages(),
keywords=['Jupyt... |
from __future__ import absolute_import, division, print_function
import k8spackage
from k8spackage.commands.command_base import CommandBase
class VersionCmd(CommandBase):
name = 'version'
help_message = "show version"
def __init__(self, options):
super(VersionCmd, self).__init__(options)
... |
# This file is part of the Pattern and Anomaly Detection Library (openclean_pattern).
#
# Copyright (C) 2021 New York University.
#
# openclean_pattern is released under the Revised BSD License. See file LICENSE for
# full license details.
"""A collection of useful utility methods"""
import re
from abc import ABCMeta... |
"""
WSGI config for project project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings.production")
from dja... |
import pytest
from d3rlpy.dynamics.torch.probabilistic_ensemble_dynamics_impl import (
ProbabilisticEnsembleDynamicsImpl,
)
from d3rlpy.models.encoders import DefaultEncoderFactory
from d3rlpy.models.optimizers import AdamFactory
from tests.algos.algo_test import DummyActionScaler, DummyScaler
from tests.dynamics.... |
#!/usr/bin/env python
"""Lambda Lets-Encrypt Configuration/Setup Tool
This is a wizard that will help you configure the Lambda function to
automatically manage your SSL certifcates for CloudFront Distributions.
Usage:
setup.py
setup.py (-h | --help)
setup.py --version
Options:
-h --help Show this screen
... |
# 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... |
# -*- coding: utf-8 -*-
from . import db;
from . import network; |
# Copyright 2015 gRPC 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 or agreed to in writing... |
# Generated by Django 2.2.2 on 2019-06-24 15:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0030_auto_20190624_1458'),
]
operations = [
migrations.AlterField(
model_name='contact',
name='tipom',
... |
# Copyright 2017-2020 EPAM Systems, Inc. (https://www.epam.com/)
#
# 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... |
# Copyright 2022 The T5X 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 or agreed to in writ... |
import matplotlib.pyplot as plt
import numpy as np
light="#FFFCDC"
light_highlight="#FEF590"
mid="#FDED2A"
mid_highlight="#f0dc05"
dark="#EECA02"
dark_highlight="#BB9700"
green="#00FF00"
light_grey="#DDDDDD"
def is_sorted(a):
'''Check if numpy 1d-array is sorted
'''
return np.all(a[:-1] <= a[1:])
def ribb... |
# Generated by Django 3.1.1 on 2020-09-21 16:14
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("carbon_quiz", "0039_auto_20200921_1212"),
]
operations = [
migrations.AlterField(
model_na... |
#!/usr/bin/env python3
# coding=utf-8
# author: @netmanchris
# -*- coding: utf-8 -*-
"""
This module contains functions for authenticating to the ServerTech
"""
class STAuth:
def __init__(self, ipaddr, rostring, rwstring, Port="161"):
self.ipaddr = ipaddr
self.rostring = rostring
self.rws... |
# -*- coding: utf-8 -*-
from bdea.client import BDEAStatusResponse
class TestBDEAStatusResponse(object):
RESPONSE = {
'apikeystatus': 'active',
'commercial_credit_status': 'exhausted',
'commercial_credit_status_percent': 0,
'credits': '0',
'credits_time': '2015-10-24 13:15... |
# -------------------------------------------------------------------#
# Written by Mrinal Haloi
# Contact: mrinal.haloi11@gmail.com
# Copyright 2016, Mrinal Haloi
# -------------------------------------------------------------------#
import numpy as np
import tensorflow as tf
import numbers
from functools import parti... |
def extractWaterBlog(item):
'''
Parser for 'water.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loiterous', ... |
# This file is part of beets.
# Copyright 2013, Adrian Sampson.
#
# 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 limitation the rights to use, copy, ... |
#!/usr/bin/env python
# coding: utf-8
# @Author: lapis-hong
# @Date : 2018/8/14
"""This module contains several models for Knowledge Graph Embedding
All model classes must inherit class `BaseModel` (defined in model.py)
"""
# import selected Classes into the package level so they can be convieniently imported from ... |
#-*- coding: utf-8 -*-
# pysqlite2/dbapi.py: pysqlite DB-API module
#
# Copyright (C) 2007-2008 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from... |
"""位元運算子
@詳見:https://www.w3schools.com/python/python_operators.asp
我們可以透過位元運算子在位元層級執行數學運算
"""
def test_bitwise_operators():
"""位元運算子"""
# 及閘(AND Gate)
# 當兩個輸入皆為 1 時,輸出才為 1
#
# 範例:
# 5 = 0b0101
# 3 = 0b0011
assert 5 & 3 == 1 # 0b0001
# 或閘(OR Gate)
# 當兩個輸入任一為 1 時,輸出為 1
#... |
import os
from flask import Flask
def create_app(test_config=None):
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY = "DEVELOPMENT",
DATABASE=os.path.join(app.instance_path, "portal.sqlite3"),
)
if test_config is None:
#load instance conf... |
RGB_CLASS_NAMES = [
'kickflip',
'360_kickflip',
'50-50',
'nosegrind',
'boardslide',
'tailslide',
'fail'
]
RGB_CLASS_NAME_TO_IDX = {class_name: idx
for idx, class_name in enumerate(RGB_CLASS_NAMES)}
RGB_N_CLASSES = 7
RGB_FRAME_HEIGHT = 224
RGB_FRAME_WIDTH = 224
CHAN... |
from pydra.engine import specs
from pydra import ShellCommandTask
import typing as ty
input_fields = [
(
"in_file",
specs.File,
{
"help_string": "input filename",
"argstr": "{in_file}",
"copyfile": False,
"mandatory": True,
"positi... |
from heapq import nlargest
from typing import List
Scores = List[int]
def latest(scores: Scores) -> int:
"""The last added score."""
return scores[-1]
def personal_best(scores: Scores) -> int:
"""The highest score."""
return max(scores)
def personal_top_three(scores: Scores) -> Scores:
"""The... |
# ! /usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lice... |
from rest_framework import serializers
from gathering.models import Gathering
class GatheringSerializer(serializers.ModelSerializer):
"""活动序列化器"""
class Meta:
model = Gathering
fields = '__all__' |
from .visitor import TypeAnnotationVisitor
from .nodes import *
from .aliasreplacement import AliasReplacementVisitor
from .erasure import EraseOnceTypeRemoval
from .inheritancerewrite import DirectInheritanceRewriting
from .pruneannotations import PruneAnnotationVisitor
from .rewriterulevisitor import RewriteRuleVisi... |
#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework for ogfuncoin utils.
Runs automatically during `make check`.
... |
# -*- coding: utf-8 -*-
import os
import numpy
import pandas
import itertools
from matplotlib import pyplot as plt
import matplotlib.lines
from matplotlib.gridspec import GridSpec
from matplotlib.lines import Line2D
from matplotlib.legend_handler import HandlerLine2D
from scipy.stats import gaussian_kde
import matplot... |
import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum
from electrum.bitcoin import TYPE_ADDRESS
from electrum import WalletStorage, Wallet
from electrum_gui.kivy.i18n import _
from electrum.paymentrequest import InvoiceStore
from electr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.