text stringlengths 2 999k |
|---|
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
# -*- coding: utf-8 -*-
"""Cisco DNA Center getInterfaceInfoById data model.
Copyright (c) 2019-2021 Cisco Systems.
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 ... |
# This is script for measurement of Photocurrent spectera
#
# project libraries imports:
# instruments:
from instruments.Devices import Clock, Monochromator, Electrometer, LockIn,FastVoltmeter, PowerSource
#from instruments.TimeMeter import MainTimerClass
#from instruments.Keithley import Electrometer6517
#from instru... |
"""
Defines the Widget base class which provides bi-directional
communication between the rendered dashboard and the Widget
parameters.
"""
from six import string_types
import param
import numpy as np
from bokeh.models import CustomJS
from bokeh.models.formatters import TickFormatter
from bokeh.models.widgets import ... |
# Copyright 2021 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... |
from decimal import Decimal
from io import BytesIO
from PIL import Image
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.core.files.images import ImageFile
from django.db.utils import IntegrityError
from django.test import TestCase
from .... |
# coding: utf-8
import pprint
import re
import six
class SearchUsersRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value... |
from argparse import ArgumentParser
from pathlib import Path
from tqdm import tqdm, trange
from tempfile import TemporaryDirectory
import shelve
from random import random, randrange, randint, shuffle, choice, sample
from pytorch_pretrained_bert.tokenization import BertTokenizer
import numpy as np
import json
class D... |
from django.urls.conf import path
from core import views
app_name = 'core'
urlpatterns = [
path('', views.HomeView.as_view(), name='home')
]
|
# Generated by Django 2.0.3 on 2020-07-04 09:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hitcount', '0003_auto_20190608_1004'),
]
operations = [
migrations.AlterField(
model_name='hitcount',
name='object_p... |
""" Directed graph.
In a directed graph, the edges have a direction.
"""
from collections import defaultdict
from .graph import BaseGraph, Node
class DiGraph(BaseGraph):
""" Directed graph. """
def __init__(self):
super().__init__()
self.suc_map = defaultdict(set)
self.pre_map = def... |
import os
import glob
from tornado.httpclient import AsyncHTTPClient
from kubernetes import client
from z2jh import get_config, get_secret, set_config_if_not_none
# Configure JupyterHub to use the curl backend for making HTTP requests,
# rather than the pure-python implementations. The default one starts
# being too ... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
"""
ASGI config for django_project_nikitin project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.envi... |
# -*- coding: utf-8 -*-
from declarativeunittest import *
from construct import *
from construct.lib import *
def test_bytes():
d = Bytes(4)
common(d, b"1234", b"1234", 4)
assert d.parse(b"1234567890") == b"1234"
assert raises(d.parse, b"") == StreamError
assert raises(d.build, b"looooooooooooooo... |
import json
from typing import Dict, List, Optional, Set
import pytest
from google.cloud import ndb
from pyre_extensions import none_throws
from backend.common.cache_clearing.get_affected_queries import TCacheKeyAndQuery
from backend.common.consts.api_version import ApiMajorVersion
from backend.common.deferred.client... |
#!/usr/bin/env python
"""
=================================================
sMRI: Regional Tessellation and Surface Smoothing
=================================================
Introduction
============
This script, tessellation_tutorial.py, demonstrates the use of create_tessellation_flow from nipype.workflows.smri.f... |
from time import time
from typing import Optional
import re
from tools.timer import getPrevTime
def hex_to_rgb(hex_string):
r_hex = hex_string[1:3]
g_hex = hex_string[3:5]
b_hex = hex_string[5:7]
return int(r_hex, 16), int(g_hex, 16), int(b_hex, 16)
def wheel(pos):
"""Generate rainbow colors acr... |
from typing import Union
import numpy as np
from spikeinterface.core import (BaseRecording, BaseSorting,
BaseRecordingSegment, BaseSortingSegment)
class NewToOldRecording:
"""
This class mimic the old API of spikeextractors with:
* reversed shape (channels, samples):
... |
# 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 law or agreed to in... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
"""
Pipelines for processing raw logs to structured data
including sampling (optional), log parsing, log sequence generation by windowing, and train test splitting
"""
import os
import pickle
from dataset import SimpleParserFactory, split_train_test_aiia, generate_test_set_aiia, sample_raw_data
# define options
op... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import datetime
import glob
import heapq
import logging
import os
import os.path
import random
import re
import shutil
import subprocess as subprocess
import... |
#!/usr/bin/env python
import max7219.led as led
import max7219.canvas as canvas
import time
font5x3 = { # python data type dictionary for the pixelfont
"0" : [0b01110, 0b10001, 0b01110], # "0"
"1" : [0b10010, 0b11111, 0b10000], # "1"
"2" : [0b11001, 0b10101, 0b10010], # "2"
"3" : [0b10001,... |
"""Proposal for a simple, understandable MetaWorld API."""
import abc
import pickle
from collections import OrderedDict
from typing import List, NamedTuple, Type
import metaworld.envs.mujoco.env_dict as _env_dict
import numpy as np
EnvName = str
class Task(NamedTuple):
"""All data necessary to describe a singl... |
#!/usr/bin/env python
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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
... |
from mmcv.runner import OptimizerHook
class DistOptimizerHook(OptimizerHook):
def __init__(self, update_interval=1, grad_clip=None, coalesce=True, bucket_size_mb=-1):
self.grad_clip = grad_clip
self.coalesce = coalesce
self.bucket_size_mb = bucket_size_mb
self.update_interval = up... |
from django.contrib import admin
from .models import Profile, Message
admin.site.register(Profile)
admin.site.register(Message) |
from .nolinks import NoLinks
__red_end_user_data_statement__ = "This cog does not persistently store data or metadata about users."
def setup(bot):
bot.add_cog(NoLinks(bot))
|
from django.http import HttpResponse, HttpResponseNotFound
from biostar.apps.posts.models import Tag
from biostar.apps.users.models import Profile
from django.shortcuts import redirect
from energyuse.eserver import views as eviews
from django.contrib import messages
def subscribe(request,topic):
context = {}
... |
import sys
import typing
import bpy
import mathutils
class AddObjectHelper:
def align_update_callback(self, _context):
'''
'''
pass
def add_object_align_init(
context: 'bpy.types.Context',
operator: 'bpy.types.Operator') -> 'mathutils.Matrix':
'''Return a matrix usin... |
from cvpods.layers import ShapeSpec
from cvpods.modeling.backbone import Backbone
from cvpods.modeling.backbone.fpn import build_resnet_fpn_backbone
from cvpods.modeling.meta_arch.rcnn import GeneralizedRCNN
from cvpods.modeling.proposal_generator import RPN
from cvpods.modeling.roi_heads import StandardROIHeads
from c... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import subprocess
import sys
from test_util import TestFailedError, run_command, \
serializeIncrParseMarkupFile
def main():
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
... |
"""Base Datapoint Types
``DataPointType`` Metaclass
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: nc5ng.types.DataPointType
:members:
"""
import logging
class DataPointType(type):
""" Metaclass for DataPoints, defines class creation and class/hierarchy member variables
The meta-class in part, hides ... |
"""
Functions to do with masks and mixing matrices.
"""
import copy
import time
import warnings
import healpy as hp
import matplotlib.cm
import matplotlib.pyplot as plt
import numpy as np
import pymaster as nmt
def generate_mask(wmap_mask_path, nside, target_fsky, mask_save_path):
"""
Generate a Stage-IV-li... |
##############################################################################
# Copyright 2016-2017 Rigetti Computing
#
# 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... |
from copy import deepcopy
class Movel:
"""
Super class para móveis interativos
"""
def __init__(self, name, message):
self.name = name
self.message = message
self.itens = []
self.nomes = []
def olhar(self):
"""
Método que retorna uma breve descr... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-unsafe
import json
import unittest
from pathlib import Path
from unittest.mock import MagicMock, patch
from ... import commands, find... |
# -*- coding: utf-8 -*-
import csv
import numpy as np
class CSVHandle():
def __init__(self):
pass
def read(self, file):
data = []
data_title = []
with open(file, 'r') as csv_file:
rows = csv.reader(csv_file)
for row in rows:
coulmn =... |
__all__ = ['reorient_image',
'center_of_mass']
import os
import numpy as np
from tempfile import mktemp
from . import apply_transforms
from .. import lib
_reorient_image_dict = {
'float': {
2: lib.reorientImageF2,
3: lib.reorientImageF3,
4: lib.reorientImageF4
}
}
_c... |
#!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# 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 must retain the above copyright
# notice, this list... |
# Copyright 2016 Capital One Services, 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 agreed to in... |
#encoding:utf-8
import cv2
import numpy as np
import matplotlib.pyplot as plt
#读取图片
img = cv2.imread('scenery.png')
src = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
#图像翻转
#0以X轴为对称轴翻转 >0以Y轴为对称轴翻转 <0X轴Y轴翻转
img1 = cv2.flip(src, 0)
img2 = cv2.flip(src, 1)
img3 = cv2.flip(src, -1)
#显示图形
titles = ['Source', 'I... |
# test_client.py -- Compatibilty tests for git client.
# Copyright (C) 2010 Google, Inc.
#
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
# General Public License as public by the Free Software Foundation; version 2.0
# or (at your option) any later version. You can redistribute it and/or
... |
import torch
import torch.nn as nn
from torch.hub import load_state_dict_from_url
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnext50_32x4d', 'resnext101_32x8d',
'wide_resnet50_2', 'wide_resnet101_2']
model_urls = {
'resnet18': 'https://download.py... |
"""
Defines the Session class to create and destroy a GMT API session and provides access to
the API functions. Uses ctypes to wrap most of the core functions from the C API.
"""
import sys
import ctypes as ctp
from contextlib import contextmanager
from packaging.version import Version
import numpy as np
from ..excep... |
from django.db import models
from cms.models import CMSPlugin
from cms.models.fields import PlaceholderField
from cms.utils.copy_plugins import copy_plugins_to
class PlaceholderReference(CMSPlugin):
cmsplugin_ptr = models.OneToOneField(
CMSPlugin,
on_delete=models.CASCADE,
related_name='c... |
"""
Test script for doctest.
"""
from test import support
import doctest
import functools
import os
import sys
import importlib
import unittest
import tempfile
# NOTE: There are some additional tests relating to interaction with
# zipimport in the test_zipimport_support test module.
###########################... |
import datetime
import logging
from flask import url_for, g, session
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import LoginManager, current_user
from flask_openid import OpenID
from flask_babel import lazy_gettext as _
from .views import AuthDBView, AuthOIDView, ResetMyP... |
import logging
from traveler_client import form, client
def test_get_all():
form_client = form.Form('https://localhost:3443', 'api_write', 'api_write_password')
form_response = form_client.get_all()
assert client.Client.is_json(form_response)
logging.info(form_response.json())
|
import re
def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
"""
alist.sort(key=natural_keys) sorts in human order
http://nedbatchelder.com/blog/200712/human_sorting.html
(See Toothy's implementation in the comments)
"""
return [atoi(c) for ... |
# Copyright 2021 Jonathan Carter
# 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 ... |
"""
View.py
Author: Matthew Yu, Array Lead (2020).
Contact: matthewjkyu@gmail.com
Created: 11/17/20
Last Modified: 11/24/20
Description: The View class is a concrete base class that provides a common API
for derived classes to use. It manages the widgets within each tab during their
lifetimes. A View roughly correspo... |
import sys
import json
import os
from collections import defaultdict
def load_label_set(filepath, delimiter=None, increment_enc=None):
"""Loads the given file and reads the labels in. Expects label per line.
Parameters
----------
filepath : str
The filepath to the file containing the labels
... |
import pandas
f = r'C:\Users\Ciaran\Documents\LargeStudy\GSS2375_WB_NewDur_Grant\GSS2375_RNA.xlsx'
data = pandas.read_excel(f)
import matplotlib.pyplot as plt
plt.figure()
plt.hist(data['Yield(ug)'],bins=50)
plt.show() |
# Copyright 2012, Red Hat, 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 agr... |
"""
Django settings for widget_feature project.
Generated by 'django-admin startproject' using Django 1.11.29.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
i... |
import sys
import argparse
import copy
import random
import torch
import torch.utils.data as data
from random import shuffle
from collections import OrderedDict
import continual_benchmark.dataloaders.base
import continual_benchmark.agents as agents
import continual_benchmark.dataloaders as dataloaders
from continual_b... |
"""Routines to make lines
"""
from Numeric import *
from math import cos, sin, pi, atan2
def R(theta):
array = zeros([3,3], Float)
array[0,0] = array[1,1] = cos(theta)
array[0,1] = sin(theta)
array[1,0] = -sin(theta)
array[2,2] = 1
return array
def T(tx, ty):
array = zeros([3,3], Float)
... |
# Generated by Django 3.2.6 on 2021-08-23 02:32
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('accounts', '0... |
# pylint: disable=too-many-lines
# 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) AutoRe... |
class Solution:
def XXX(self, nums: List[int], target: int) -> int:
left = 0
right = len(nums) - 1
ans = len(nums)
while(left<=right):
mid = (right + left) >> 1
if(target<=nums[mid]):
right = mid-1
ans = mid
else:
... |
from ctypes import windll
from ... import output
from accessible_output import paths
from main import OutputError, ScreenreaderSpeechOutput
class Dolphin (ScreenreaderSpeechOutput):
"""Supports dolphin products."""
name = 'Dolphin'
def __init__(self, *args, **kwargs):
super(Dolphin, self).__init__(*args, **kwa... |
#!/usr/bin/env python
"""Driver program for Voronoi Voids (V^2) void finder module using the ZOBOV
algorithm.
"""
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from vast.vsquared.zobov import Zobov
p = ArgumentParser(description='Voronoi Voids (V^2) void finder.',
formatter_cla... |
# https://github.com/z0ph/MAMIP.git
import os
import json
import re
PRIVESC_ACTIONS = [
"iam:PassRole",
"iam:CreatePolicyVersion",
"iam:SetDefaultPolicyVersion",
"iam:CreateAccessKey",
"iam:CreateLoginProfile",
"iam:UpdateLoginProfile",
"iam:AttachUserPolicy",
"iam:AttachGroupPolicy",
... |
# =============================================================================== #
# #
# This file has been generated automatically!! Do not change this manually! #
# ... |
'''
Ahocorasick implementation entirely written in python.
Supports unicode.
Quite optimized, the code may not be as beautiful as you like,
since inlining and so on was necessary
Created on Jan 5, 2016
@author: Frederik Petersen (fp@abusix.com)
'''
from builtins import object
"""
edit by gavin:
在代码中:
State类可以理解为... |
import glob
import csv
import re
def load_i18n(path):
# Read data from i18n files
files = glob.glob(path + ".*.i18n")
if len(files) == 0:
return None, None
data = {}
langs = []
for p in files:
lang = re.search("\\.(.+)\\.i18n$", p).group(1)
langs.append(lang)
... |
from django.urls import path
from .views import IndexView, JobTimePeriodDetailView
app_name = 'jobHistory'
urlpatterns = [
path('', IndexView.as_view(), name='index'),
path('<int:pk>/', JobTimePeriodDetailView.as_view(), name='job-time-period-detail'),
]
|
import os
import re
import requests
from behave import given, then, when
def get_plus_string(group_name):
# To keep things short I've truncated the stage name
# in the plus string from the longer name used in the
# ENVIRONMENT env var
stages = {"testing": "test", "staging": "stage"}
env = stages... |
"""
Django settings for Market_Manager_V2 project.
Generated by 'django-admin startproject' using Django 1.11.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
... |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 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 the prioritisetransaction mining RPC."""
import time
from test_framework.messages import COIN, M... |
import boto3
import json
class SQSClient:
def __init__(self, profile, queue):
session = boto3.Session(profile_name=profile)
self.queue = session.resource(
'sqs').get_queue_by_name(QueueName=queue)
def recieve(self):
return self.queue.receive_messages(MaxNumberOfMessages=1,... |
# Copyright (c) 2020 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 applic... |
# -*- coding: utf-8 -*-
from django.urls import path, include
from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings
admin.autodiscover()
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('base.urls')),
]
if settings.DEBUG:
import de... |
# ======================================================================== #
# BLOSPRAY - OSPRay as a Blender render engine #
# Paul Melis, SURFsara <paul.melis@surfsara.nl> #
# Render engine definition #
# ==========... |
import random
import json
from sklearn.model_selection import train_test_split
import argparse
import json
from os.path import exists
from tqdm import tqdm
from underthesea import sent_tokenize
import random
with open('zalo_v2.0.json','r',encoding='utf-8') as json_file:
data = json.load(json_file)
da... |
# Copyright 2019 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... |
"""
HUMAnN2: translated_search module
Run alignment, find unused reads
Copyright (c) 2014 Harvard School of Public Health
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, incl... |
"""
TODO - basic:
- tbl.index.name setting
- tbl adding data - setting columns, appending, etc.
TODO - groupby:
- groupby options - groupby indexing (esp for expr groupbys)
- groupby push out VirtualTables
- groupby aggregate multiple agg types, dict agg
- groupby transform / apply?
TODO - joins:
- https://panda... |
"""
Copyright (c) 2017 Dependable Systems Laboratory, EPFL
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, modify, merge,... |
import re
from io import StringIO
import requests
import imdb
from lxml import etree
from ..logger import get_logger
from ..helpers import get_headers, tokenize_text
logger = get_logger(__name__)
class ImdbClient:
MOST_POPULARS_MOVIES_URL = 'https://www.imdb.com/chart/moviemeter/?sort=rk,asc'
IMDB_IDS_... |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2020 AVSystem <avsystem@avsystem.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 ... |
# -*- coding: utf-8 -*-
import skimage, numpy
import imageio
import scipy.ndimage.filters as filters
import collections
import skimage.morphology
import skimage.filters
import re
import io
import unetsl.data
DEFAULT_CUTOFFS = ( 0.5, 0.8, 0.95)
point_kernel = numpy.array(
[
... |
# Copyright 2017, OpenCensus 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 w... |
#!/usr/bin/env python
# coding: utf-8
import sys
import json
# {
# "MsgId": "", // 无用
# "FromUserName": "", // 发消息的人, 可以用于回复消息
# "ToUserName": "", // 接收消息的人, 就是自己, 无用
# "MsgType": 1, // 无用
# "Content": "hhh", // 原始消息内容 (可能包含@)
# "AtMe": false, // 是否@我, 在 FromGroup 为 true 时有效
# "FromGroup": true, // 是否组... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# "Fuzzing with Generators" - a chapter of "The Fuzzing Book"
# Web site: https://www.fuzzingbook.org/html/GeneratorGrammarFuzzer.html
# Last change: 2022-01-24 10:56:04+01:00
#
# Copyright (c) 2021 CISPA Helmholtz Center for Information Security
# Copyright (c) 2018-2020... |
# Copyright The PyTorch Lightning team.
#
# 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... |
# This file deletes a list of documents
# from the meta_container collection.
# ObjectId's to be deleted should be in ids.txt
# one id per line.
import pathmagic
from db_pool import *
from bson.objectid import ObjectId
def main():
collection = db[envget('db_metadata_collection')]
f = open("ids.txt", "r")
... |
from collections import Counter
from re import split
from sys import version_info
import pandas as pd
from scattertext.Common import GENERAL_INQUIRER_URL
from scattertext.features.FeatsFromSpacyDoc import FeatsFromSpacyDoc
class FeatsFromGeneralInquirer(FeatsFromSpacyDoc):
def __init__(self,
use_lem... |
"""Class-based views."""
from functools import wraps
from typing import (
Any,
Awaitable,
Callable,
ClassVar,
Mapping,
MutableMapping,
Type,
Union,
cast,
no_type_check,
)
from faust.types import AppT, ModelT
from faust.types.web import ViewDecorator, ViewHandlerFun
from yarl imp... |
# Copyright 2019 The Keras Tuner 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
from peachpy import *
from peachpy.x86_64 import *
def add_offset(int_size, array, offset):
if int_size == 64:
SHL(offset, 3)
elif int_size == 32:
SHL(offset, 2)
ADD(array, offset)
return array
class MM:
gen_reg = [rax, rbx, rcx, rdx,
rsi, rdi, r8, r9,
... |
from functools import wraps
from typing import Any, Callable, Union, Iterable, Iterator, List, Tuple, TypeVar
Number = TypeVar('Number', bound='numbers.Number')
MatBaseType = TypeVar('MatBaseType', bound='matrix.MatrixBase')
MatType = TypeVar('MatType', bound='matrix.Matrix')
MatProxyType = TypeVar('MatProxyType', bo... |
import os.path
import pypandoc
from mkdocs.config import config_options
from mkdocs.plugins import BasePlugin
class BibTexPlugin(BasePlugin):
"""
Allows the use of bibtex in markdown content for MKDocs.
Options:
bib_file (string): path to a single bibtex file for entries, relative to mkdocs.yml.... |
import math
class RegularNumber:
def __init__(self, value, level, index):
self.value = value
self.level = level
self.index = index
class SnailNumber:
def __init__(self, numbers: list[RegularNumber]):
self.numbers = numbers
def must_be_reduced(self):
for number in... |
# coding=utf-8
"""Settings for the tests."""
# Future
from __future__ import absolute_import, unicode_literals
# Standard library
import os
DEBUG = True
USE_TZ = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "l7k&kv64%i8&vit684(m_#jqzhh1_r^u6cbv+f&e1%-imz#p6h"
# Build paths... |
from example.flaskr import create_app
from example.flaskr.db import init_db
def build_app():
# Create and set up the app
# Do all the app config + pre launch setup here
app = create_app({'TESTING': True})
# Set up the database - this also drops existing tables
with app.app_context():
init_... |
from colorama import init, Fore
import os
import cv2
import sys
import shutil
from PIL import Image
import subprocess
import pygame
import fpstimer
class AsciiConverter:
def __init__(self, image, nb):
# ascii characters used to build the output text
self.ASCII_CHARS = ["@", "#", "S",... |
NAME_PROP = "name"
USE_CASE_PROP = "useCase"
STATELESS_PROP = "stateless"
KEEP_IN_CACHE_PROP = "keepInCache"
LAST_FLOW_PROP = "lastUse"
CALLBACK_ERROR_STRATEGY_ARG = "on_key_changed_callback_error_strategy"
KEEP_IN_CACHE_ARG = "keep_in_cache"
STATELESS_ARG = "stateless"
USE_CASE_ARG = "use_case"
SECRET_KEY_TYPE_NAME =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.