content stringlengths 5 1.05M |
|---|
# Import necessary modules
import gzip
import os
import time
import concurrent.futures
import argparse
# Keep track of when the script began
start_time = time.time()
char = '\n' + ('*' * 70) + '\n'
# Argparse Information
parser = argparse.ArgumentParser(description='Phases a trio when gVCF files are \
available f... |
import numpy as np
MLIR_TYPE_TO_NP_TYPE = {
"i8": np.int8,
"i16": np.int16,
"i32": np.int32,
"i64": np.int64,
# 'f16': np.float16, # 16-bit floats don't seem to be supported in ctypes
"f32": np.float32,
"f64": np.float64,
}
|
# Example: List orders using the Mollie API.
#
import os
from mollie.api.client import Client
from mollie.api.error import Error
def main():
try:
#
# Initialize the Mollie API library with your API key.
#
# See: https://www.mollie.com/dashboard/settings/profiles
#
... |
#!/usr/bin/env python
# coding: utf-8
import json
import os
import numpy as np
import tensorflow as tf
import model, sample, encoder
import shanepy
import shanepy as spy
from shanepy import *
# !ln -s ../models models # hack to make models "appear" in two places
model_name = '1558M'
seed = None
nsamples = 10
batch_... |
APPLY = 1
ARRAY = 2
ASSIGN = 3
BREAK = 4
CASE = 5
CLASS_BEGIN = 6
CLASS_END = 7
CONTINUE = 8
FOR_BEGIN = 9
FOR_END = 10
FUNC_BEGIN = 11
FUNC_END = 12
IF_BEGIN = 13
IF_END = 14
RETURN = 15
SWITCH_BEGIN = 16
SWITCH_END = 17
TRANSPOSE = 18
WHILE_BEGIN = 19
WHILE_END = 20
|
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# coding: utf-8
"""
Strava API v3
The [Swagger Playground](https://developers.strava.com/playground) is the easiest way to familiarize yourself with the Strava API by submitting HTTP requests and observing the responses before you write any client code. It will show what a response will look like with differe... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pyatv/protocols/mrp/protobuf/VolumeControlAvailabilityMessage.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
fro... |
"""
Main entry module for easy CLI invocation
"""
from argparse import ArgumentParser
from typing import Sequence, Union, Optional
import asyncio
import json
import sys
from portscanner.scanner import PortScanner
from portscanner.types import ScanInfo, ScanState
from portscanner.utils import cleanup
from portscanner.... |
from model import Model
from elements.create import Create
from elements.process import Process
from elements.dispose import Dispose
# region Task 5
c = Create(2.0)
p1 = Process(2.0, 3)
p1.max_queue = 5
p2 = Process(1.0)
p2.max_queue = 5
p3 = Process(1.0)
p3.max_queue = 5
p4 = Process(1.0)
p4.max_queue = 5
d1, d2... |
from random import shuffle, randint
class HackProof(object):
def __init__(self):
self.alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
self.alphabetCaps = []
for char in self.alphabet:
self.alphabetCaps.append(cha... |
from flask import Flask, session
from flask_socketio import SocketIO
socketio = SocketIO()
games = {}
def create_app(debug=False):
app = Flask(__name__)
app.debug = debug
app.config['SECRET_KEY'] = 'SomeSecretKey'
from .play import play
app.register_blueprint(play)
socketio.init_app(app)
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import calendar
import os
from glob import glob
from io import StringIO
from json import dumps, loads
from pathlib import Path
import dash_core_components as dcc
import dash_html_components as html
import geopandas as gpd
import src.dash_configs as dcf
import src.dash_h... |
import socket
from sqlite3_class import SQLite3_Class
from tkinter import *
import datetime
import os
"homework, output numbers to database (with timestamp)"
class Client:
def __init__(self, ip="127.0.0.1", port=5050, window_title="Server-Client Communication"):
self.ip = ip
self.port = port
... |
####################################################################################
# Copyright (c) 2022 TasteIt #
# Author: Paolo Pertino #
# ... |
from .version import VERSION
__author__ = 'Tomoki Kozuru'
__version__ = VERSION
from .stream import BaseStreamEvent, StreamClient
from .auth import BasicAuth, OAuth1
from .utils import Utils
|
#!/usr/bin/env python
# This script sets the attenuation values based on a csv file
import numpy as np
import katconf
import time
import StringIO
from katcorelib import (
user_logger, standard_script_options, verify_and_connect, colors)
def color_code_eq(value, test, errorv=0.01):
"""
This function r... |
"""Show
Display information about the keys and users that have access to your
account.
"""
import os
import re
import sys
import socket
import textwrap
import promus.core.ssh as ssh
import promus.core.git as git
RE_LINE = re.compile('(?P<stuff>.*?)ssh-(?P<type>.*?) '
'(?P<key>.*?) (?P<desc>.*)'... |
import json
import os
with open("data/datapackage.json") as f:
content = f.read()
json_data = json.loads(content)
print("Updating metadata...")
# Set correct metadata
json_data["name"] = "covid-19"
json_data["title"] = "Novel Coronavirus 2019"
json_data["views"] = [
{
"title": "Total world to dat... |
# Copyright 2018/2019 The RLgraph 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 appli... |
#!/usr/bin/env python3
from itertools import product
n = sum(1 for a, b, c in product(range(0, 10), repeat=3) if a + b + c == 10)
print("réponse:", n)
|
'''
(0-1 Knapsack) example
The example solves the 0/1 Knapsack Problem:
how we get the maximum value, given our knapsack just can hold a maximum weight of w,
while the value of the i-th item is a1[i], and the weight of the i-th item is a2[i]?
i = total item
w = total weigh of knapsack can carry
'''
# a1: item value... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('threshold_value', '0004_auto_20141030_1248'),
]
operations = [
migrati... |
from selenium import webdriver
import time
class Scraper(object):
def __init__(self):
self.path = r'/Users/brunopaes/Documents/OneDrive/Acadêmico/ESPM/misc/05.4 - Python_Playground/drivers/chromedriver'
self.driver = webdriver.Chrome(self.path)
self.url = 'https://www.youtube.com/watch?v=6... |
import logging
import pathlib
import sys
class AssetLoader:
"""
Load model for each element when render is needed.
"""
loader = None
asset_path = None
@staticmethod
def init_loader(pg_world):
"""
Due to the feature of Panda3d, keep reference of loader in static variable
... |
#!/usr/bin/env python
#
# Author: Thamme Gowda [tg (at) isi (dot) edu]
# Created: 5/29/20
import logging as log
import collections as coll
from pathlib import Path
from rtg import TranslationExperiment as Experiment
import numpy as np
from scipy import stats
from functools import partial
log.basicConfig(level=log.INF... |
from .base import *
def build_renderer() -> BaseRenderer:
return BaseRenderer()
|
#!/usr/bin/env python
### FUNCTIONS - START ###
def printHelp(scriptname):
print('\nUsage: ' + scriptname + ' [options]\n')
print('\twhere options are:\n');
print('\t\t-f --conf-file: parse the specified configuration file.\n')
print('\t\t-h --help: print this help message.\n')
print('\nAuthor: Da... |
from click.testing import CliRunner
from envadmin.cli import cli
from tests.utilities import constants
from tests.utilities.fixtures import runner, temp_folder, temp_git_folder, temp_envadmin_folder # noqa: F401
def test_e2e_namespace_create(runner, temp_git_folder, temp_envadmin_folder): # noqa: F811
runner = ... |
import warnings
import torchvision
try:
import torch_extension
_nms = torch_extension.nms
except ImportError:
if torchvision.__version__ >= '0.3.0':
_nms = torchvision.ops.nms
else:
from .python_nms import python_nms
_nms = python_nms
warnings.warn('You are using pytho... |
from django.contrib import admin
from .models import Reaction
class ReactionAdmin(admin.ModelAdmin):
list_display = [
'song',
'comment',
'date',
]
ordering = ['-date']
admin.site.register(Reaction, ReactionAdmin)
|
import sys
class InvalidArgument(Exception):
"""Raised by anything under main() to propagate errors to user.
"""
def __init__(self, message):
self.message = message
Exception.__init__(self, message)
class NoVirtualenvName(InvalidArgument):
"""No virtualenv name was given (insufficien... |
#!/usr/bin/env python3
a = 111
b = 20
print(a / b) # 除算
print(a % b) # 余り
print(a ** b) # べき乗
print(a // b) # 切り捨て除算
# divmod, 商と余りをタプルで返す
res, mod = divmod(a, b)
print(res, mod)
# ビット演算子
print(~a) # ビット反転
print(a & b) # AND:論理積(aもbも1のビットが1)
print(a | b) # OR:論理和(aまたはbが1のビットが1)
print(a ^ b) # XOR:排他的論理和(aまたは... |
# import hashlib
# f = open('C:/Users/Darius/Desktop/Projects/helloworld/Udel/AppliedCrypto/test.txt', 'r+')
# words = [word.strip() for word in f]
# print(words)
# f.close()
import hashlib, cProfile
f=open('C:/Users/Darius/Desktop/Projects/helloworld/Udel/AppliedCrypto/test.txt','r')
words = [word.strip() for wo... |
from typing import TypeVar, List, Optional, Generic
from pydantic import BaseModel
from pydantic.generics import GenericModel
ResultT = TypeVar("ResultT")
class ListResponse(GenericModel, Generic[ResultT]):
resources: List[ResultT]
next_page_token: Optional[str]
class ListRequest(BaseModel):
filter: O... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .cos_client import CosClient
from .cos_client import CosConfig
from .cos_client import CredInfo
from .cos_request import UploadFileRequest
from .cos_request import UploadSliceFileRequest
from .cos_request import UploadFileFromBufferRequest
from .cos_request import Uplo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd #for pandas see http://keisanbutsuriya.hateblo.jp/entry/201\
import argparse
import numpy as np
import math
import subprocess
import glob
import os
from matplotlib import pylab as plt
from numpy.lib.stride_tricks import as_strided
S=['fhs', 'fms', 'mkk'... |
import telebot
import time
bot_token = '1038832449:AAHG2kCCqUecwUW_1vn36FfC6kQg1lbvI7I'
bot = telebot.TeleBot(token=bot_token)
def find_at(msg):
for text in msg:
if '@' in text:
return text
@bot.message_handler(commands=['start'])
def send_welcome(message):
bot.reply_to(message, 'Welcom... |
from redisgears import executeCommand as execute
SIMPLE_HASH_BACKEND_PK = 'SimpleHashBackendPK'
SIMPLE_HASH_BACKEND_TABLE = 'SimpleHashBackendTable'
class SimpleHashConnector():
def __init__(self, newPefix):
self.newPefix = newPefix
def TableName(self):
return SIMPLE_HASH_BACKEND_TABLE
d... |
'''
Feature Extraction and Image Processing
Mark S. Nixon & Alberto S. Aguado
http://www.southampton.ac.uk/~msn/book/
Chapter 10
Reprojection: Compute a projection from seven corresponding image and 3D points and re-project
the image to create a new view of the scene
'''
# Set module functions
... |
import abc
import array
import ctypes
import dataclasses
import enum
import sys
import typing
from dataclasses import field
from typing import Dict, List, Optional, Tuple, Union
from ._utils import ChannelLifeCycle, _SimpleReprEnum
if typing.TYPE_CHECKING:
from ._fields import BitSet, FieldDesc
AddressTuple = Tu... |
import pickle
from py.create_data import BOW, build_vocab, preprocess_df, dump_excel
from sklearn.metrics import classification_report
import numpy as np
import json
import subprocess
from py.calculate_coverage import process_rules, generate_mask
from py.bert_utils import train_bert, test
from py.util import get_distin... |
# 使用Sobel查找图像中的边缘。
from skimage.filters import sobel, sobel_h, sobel_v
from skimage import io, img_as_float
from skimage.morphology import disk
from skimage.color import rgb2gray
image = io.imread('/home/qiao/PythonProjects/Scikit-image_On_CT/Test_Img/4.jpg')
# image = rgb2gray(image)
io.imshow(image)
io.show()
md = ... |
class Solution:
def rearrangeBarcodes(self, barcodes: List[int]) -> List[int]:
|
import botocore.session
import json
import os
import socket
import pytest
import mock
from botocore.stub import Stubber
from botocore.exceptions import ClientError
from botocore.vendored.requests import ConnectionError as \
RequestsConnectionError
from pytest import fixture
from chalice import __version__ as chal... |
from vnpy.app.cta_strategy import (
CtaTemplate,
StopOrder,
TickData,
BarData,
TradeData,
OrderData,
BarGenerator,
ArrayManager,
)
from datetime import datetime as dt
from loguru import logger
import numpy as np
class MStragety1(CtaTemplate):
author = "mc"
fast_window = 10
... |
"""Poisson image editing.
"""
import numpy as np
import os
import cv2
import scipy.sparse
import pickle
from scipy.sparse.linalg import spsolve
from os import path
def laplacian_matrix(n, m):
"""Generate the Poisson matrix.
Refer to:
https://en.wikipedia.org/wiki/Discrete_Poisson_equation
Note: ... |
# Copyright 2020 Google LLC, Stanislav Khrapov
#
# 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 agr... |
# -*- coding: utf-8 -*-
"""
Showcases reflectance recovery computations using *Jakob et al. (2019)* method.
"""
import numpy as np
import colour
from colour.utilities import message_box
message_box('"Jakob et al. (2019)" - Reflectance Recovery Computations')
illuminant = colour.SDS_ILLUMINANTS['D65']
XYZ = np.arra... |
"""empty message
Revision ID: cc3b0f0860d5
Revises: 5871655bb18f
Create Date: 2020-07-23 18:41:02.015852
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = 'cc3b0f0860d5'
down_revision = '5871655bb18f'
branch_labels = None
depe... |
# Objetos en Python por modulos
#
# Debido a que Pyside emplea solo objetos en su estructura profundizare un
# poco en el empleo de objetos. Y ahora voy a partir el archivo en varios para
# tener una especie de libreria de clases.
#
# Notas:
# - Ver que el archivo Clases se llama como si fuera un modulo cual... |
'''
Get the highest answer rate question from a table survey_log with these columns: uid, action, question_id, answer_id, q_num, timestamp.
uid means user id; action has these kind of values: "show", "answer", "skip"; answer_id is not null when action column is "answer", while is null for "show" and "skip"; q_num is ... |
'''
BEGIN GPL LICENSE BLOCK
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it wi... |
__version__ = "2.0.3"
__author__ = "decoxviii"
|
# -*- coding: utf-8 -*-
"""Diogenes, reto-06: clase Configurator."""
# Copyright (c) 2022 José Lorenzo Nieto Corral <a.k.a. jlnc> <a.k.a. JoseLo>
# 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 Sof... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pandas as pd
import time
from copy import copy
import datetime
print("")
print("Ziel ist es diese Seiten zu Scrapen: ")
print("# LINKS:https://www.tuifly.com/flugangebote "
"https://www.kayak.de/flugangebote")
time.sleep(3)
# L... |
from typing import List, Union
from vortexasdk.endpoints.geographies import Geographies
from vortexasdk.api import ID
from vortexasdk.conversions.conversions import _convert_to_ids
def convert_to_geography_ids(
ids_or_names_list: List[Union[ID, str]]
) -> List[ID]:
"""
Convert a mixed list of names or ID... |
import io
import time
from datetime import datetime, timedelta
import requests as reqs
import json
import AirQualityReader
ecobee_base_url = "https://api.ecobee.com/"
api_versioni_url = "1/"
thermostat_request_url = "thermostat"
tokenFileName = "tokens.json"
def readJsonDataFromFile(filename):
with open(filename... |
import pytest
import datetime
from acondbs import ops
##__________________________________________________________________||
@pytest.fixture
def app(app_users):
y = app_users
# Relation types:
# parent <-> child
# plaintiff <-> defendant
# Relations:
# map1 -> beam1
# | ... |
'''
Copyright 2017 Rafael Alves Ribeiro
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... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""A few checks at the VERA Fingervein database.
"""
import os
import numpy
from . import Database, PADDatabase
from .create import VERAFINGER_PATH
import nose.tools
from nose.plugins.skip import SkipTest
def sql3_available(test):
"""Decorator for detecting ... |
from typing import TYPE_CHECKING
from sqlalchemy import BigInteger, Column, ForeignKey, Integer
from .base import Base
if TYPE_CHECKING: # pragma: no cover
from .game import Game # noqa
from .user import User # noqa
class Play(Base):
"""Records of a users game plays."""
__tablename__ = "plays"
... |
def area(largura, comprimeto):
a = l * c
print(f'O tamanho do terreno de {largura}x{comprimeto} é de {a} m²')
print('-' * 20)
print('Tamanho do terreno')
l = float(input('Largura[m]: '))
c = float(input('Comprimento[m]: '))
area(l, c)
|
#python 3.5.2
import sys
while True:
line = sys.stdin.readline()
if not line:
break
num = int(line.split()[0])
min_x = 1e+9
max_x = -1e+9
min_y = 1e+9
max_y = -1e+9
for i in range(num):
line = sys.stdin.readline()
a = list(map(int, line.split()))
... |
# Copyright (c) 2021 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... |
def igcd(a, b):
if a > b:
s = b
if b > a:
s = a
for i in range(1, s + 1):
if a % i == 0 and b % i == 0:
gcd = i
return gcd
class Gcd:
def __init__(self, a, b):
self.a = a
self.b = b
def __call__(self):
if self.a > self.b:
s = self.b
if self.b > self... |
from selfusepy.log import Logger
def log_test():
log = Logger().logger
log.info('sixth')
|
# -*-coding:utf-8-*-
import time
import logging
import logging.config
from logging.handlers import TimedRotatingFileHandler
import os
from uuid import uuid1
from flask import request, g
from flask_login import current_user
from apps.configs.sys_config import LOG_PATH, WEBLOG_NORMAL_FILENAME, WEBLOG_EXCEP_FILENAME, LOG... |
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Callable, Dict, List, Optional, TYPE_CHECKING
from PyQt5.QtCore import pyqtSlot, pyqtProperty, pyqtSignal, QObject, QTimer
from UM.i18n import i18nCatalog
from UM.Logger import Logger
from UM.Util impor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# MIT License
#
# Copyright (c) 2019 Tsutomu Furuse
#
# 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 l... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 1 2021
@author: growolff
Ecuaciones de los limites de los Dedos
"""
import numpy as np
# Largo de cuerda que hay que tirar para cerrar el dedo completo
# depende de los angulos maximos de flexion de las falanges
# y del radio donde se soporta la cuerda
# para el extenso... |
#coding=utf-8
import numpy as np
import functools
import tensorflow as tf
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
import matplotlib.pyplot as plt
plt.switch_backend('agg')
class LossHistory(keras.callbacks.Callback):
def on_train_begin(self, logs={}):
... |
#!/usr/bin/env python3
"""Collates data files from prefix_url on s3 matching regex.
Uploads collated output to a programatically-generated s3 url.
Usage:
./collate.py [prefix_url] [regex]
"""
import boto3
from functools import reduce
from io import StringIO
from iterdub import iterdub as ib
import itertools
from... |
from django.contrib.auth.models import User
from rest_framework.serializers import RelatedField
from .models import (
Obra
)
class UserComentarioRelatedFields (RelatedField):
def to_representation (self, value):
return {
'id': value.id,
'first_name': value.first_name,
... |
import pandas as pd
import numpy as np
import os
from sklearn.metrics import roc_auc_score, accuracy_score
from sklearn import metrics
from scipy.stats import rankdata
import math
import argparse
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--enspath", type=str, default="./da... |
from django.test import TestCase
from robber import expect
from data.factories import AreaFactory, OfficerFactory, PoliceUnitFactory
from search_terms.term_builders import (
AreaTermBuilder, PoliceDistrictsTermBuilder, CommunitiesTermBuilder, NeighborhoodsTermBuilder,
PoliceBeatTermBuilder, SchoolGroundsTermB... |
# -*- coding:utf-8 -*-
from __future__ import print_function
from __future__ import division
import tensorflow as tf
from common import IMAGE_HEIGHT, IMAGE_SIZE, IMAGE_WIDTH, CAPTCHA_LEN, CHAR_SET_LEN, NUM_LABELS
def weight_variable(shape):
initial = tf.random_normal(shape, stddev=0.01)
return tf.Variable(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from alifebook_lib.simulators import AntSimulator
from ant_nn_utils import generate_nn_model, generate_action, decode_weights, CONTEXT_NEURON_NUM
agent_num = []
agent_nn_model_list =... |
from typing import List
from grpc import Channel
from .execution_pb2_grpc import ExecutionServiceStub
from .message import Execution, GetRequest, GetManyRequest
__all__ = ["get_execution", "get_executions"]
def get_execution(channel: Channel, execution_id: str,
with_payload: bool = False) -> Exec... |
import os
from django.core.files.storage import FileSystemStorage
from BosvogelWebPlatform.settings import MEDIA_ROOT
class OverwriteOnSameNameStorage(FileSystemStorage):
media_root = MEDIA_ROOT # to let the unit test change media_root
def get_available_name(self, name, max_length=None):
if self.e... |
from flask import Flask, jsonify, render_template, request, abort, current_app, make_response
from datetime import timedelta
from functools import update_wrapper
from flask_cors import CORS
app = Flask(__name__, static_path='/static')
CORS(app)
import os
import pickle
import subprocess
@app.route("/", methods=['GET'])... |
from jinja2 import Markup
from db import export_sql
def render(vis, request, info):
info["message"] = []
# user parameters
table = request.args.get("table", '')
field = request.args.get("field", '')
where = request.args.get("where", '1=1')
reload = int(request.args.get("reload", 0))
view =... |
from simple_rest_client.resource import Resource
class SystemCMDB(Resource):
actions = {
"dns": {"method": "GET", "url": "/system/dns{}"},
"new_dns": {"method": "PUT", "url": "/system/dns"},
"interfaces": {"method": "GET", "url": "/system/interface{}"},
"interface": {"method": "GET... |
"""dtoolutils package."""
__version__ = "0.2.0"
|
import re
from pytchat.processors.chat_processor import ChatProcessor
superchat_regex = re.compile(r"^(\D*)(\d{1,3}(,\d{3})*(\.\d*)*\b)$")
items_paid = [
'addChatItemAction',
'item',
'liveChatPaidMessageRenderer'
]
items_sticker = [
'addChatItemAction',
'item',
'liveChatPaidStickerRenderer'
]... |
from ndex.networkn import NdexGraph
import sys
def test_types():
G = NdexGraph()
n = G.add_new_node('Node with Types')
n1 = G.add_new_node('A')
n2 = G.add_new_node('B')
G.add_edge_between(n, n1)
G.add_edge_between(n, n2)
G.set_name('Test Types')
G.node[n]['string'] = 'mystring'
G... |
from django.db import models
class ModerationQuerySet(models.QuerySet):
def public(self, user):
if user.is_authenticated and user.is_staff:
return self.all()
else:
q = models.Q(public=True)
if user.is_authenticated:
q |= models.Q(creator=user)
... |
# Copyright 2020, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... |
# Copyright 2014 OpenStack Foundation
# 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 requ... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import math
import time
import random
random.seed(67)
import numpy as np
np.random.seed(67)
import pandas as pd
from scipy.sparse import csc_matrix
from fastFM.als import FMClassification
from sklearn.deco... |
import sys
import json
import logging
import collections
import os
import re
import datetime
# Location where data gets stored after validation
database:str = "database.json"
def check_parameter_type (data, keys, validType):
dict_valueType = []
message:str = ""
# Get value types from data
for key in... |
"""Functions for managing worker state.
In general, one uses these by first calling init_* or set_* to create the
attribute, then calling get_* to retrieve the corresponding value.
"""
from dask.distributed import get_worker
from src.objectives import ObjectiveBase
from src.utils.noise_table import NoiseTable
#
# Ge... |
from broker.base import AccountType
UNIT_RATIO = 100000
class OrderType(object):
MARKET = "MARKET" # A Market Order
LIMIT = "LIMIT" # A Limit Order
STOP = "STOP" # A Stop Order
MARKET_IF_TOUCHED = "MARKET_IF_TOUCHED" # A Market-if-touched Order
TAKE_PROFIT = "TAKE_PROFIT" # A Take Profit Ord... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lexicon', '0034_auto_20160419_1657'),
]
operations = [
migrations.CreateModel(
name='Clade',
fields=... |
from typing import List
from project.car.car import Car
from project.car.muscle_car import MuscleCar
from project.car.sports_car import SportsCar
from project.driver import Driver
from project.race import Race
all_valid_car_types = {"MuscleCar": MuscleCar, "SportsCar": SportsCar}
class Controller:
def __init__(... |
# Generated by Django 2.0.4 on 2018-10-29 17:21
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('core', '0040_auto_20181024_1536'),
]
operations = [
migrations.Al... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#0.1.0
import lldb
import re
import os
# command 是用户输入的符号地址
def gMapSource(debugger, command, result, internal_dict):
print('command: ' + command)
savedFilePath = '/Users/guohongwei719/Desktop/GHWBinaryMapSource/script/path.txt'
localSourcePath = '/Users/guoh... |
import random
import numpy as np
from conform_agent.env.rllib.storage_env import RLLibConFormSimStorageEnv
from conform_agent.models.tf.simple_rcnn import SimpleRCNNModel
import ray
from ray import tune
from ray.tune.registry import register_env
from conform_agent.conform_callbacks import ConFormCallbacks
from ray.rlli... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
# ---------------------------
# Author: deangao
# Copyright: 2016 deangao
# Version: v1.0.0
# Created: 2016/2/3
# ---------------------------
__author__ = 'deangao'
dict1 = {'name': 'deangao', 'address': ['sz', 'wh'], 'sex': 'm'}
print dict1
# ---其它操作---
# 1. pop: 剔除指定key的项... |
# Python - 2.7.6
Test.assert_equals(shortcut('hello'), 'hll')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.