content stringlengths 5 1.05M |
|---|
#!/usr/bin/env python3
import sys
def start():
from poshc2.client.command_handlers.ImplantHandler import main
args = sys.argv
args.remove("--client")
args.remove("start.py")
main(args) |
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from .models import Experiment
class EditExperimentForm(forms.ModelForm):
"""From to edit an experiment. Differs from the creation form, as it
does not allow editing of the folder_name, but does ... |
from .camelsplit import camelsplit # noqa
|
#!/usr/bin/env python3
bind = '0.0.0.0:5000'
pid = '/tmp/chat_websocket.pid'
|
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Numpy中实现基本数学计算脚本
Created on 2017-11-16
author: denglelai
"""
import numpy as np
def main():
"""
run basic operations of numpy
"""
# 绝对值,1
a_variable = np.abs(-1)
print "-1的绝对值为:" + str(a_variable)
# sin函数,1.0
a_variable = ... |
# -*- coding:utf-8 -*-
# @time :2020/8/28
# @IDE : pycharm
# @author :lxztju
# @github : https://github.com/lxztju
# @Emial : lxztju@163.com
import torch
def load_checkpoint(filepath):
checkpoint = torch.load(filepath, map_location='cpu')
model = checkpoint['model'] # 提取网络结构
model.load_state_dict(check... |
#PPO-LSTM
import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Categorical
import time
import numpy as np
import sys
sys.path.append(".")
from args.config import PPO_lstm_params as params
class PPO(nn.Module):
def __init__(self, ... |
# -*- coding: utf-8 -*-
"""
Author: Michael Markus Ackermann
================================
"""
from typing import List
import numpy as np
def absorption_coefficient(zc: List[complex], kc: List[complex],
thickness: float, z_air: float):
"""
Returns the Sound Absorption Coefficien... |
# coding: utf-8
from __future__ import unicode_literals
import pytest
from mock import Mock
from attrdict import AttrDict
from ariadne.actions import Visit, Action, FillForm
@pytest.fixture
def ctx_browser():
""" :return: Context with mocked browser. """
mock = Mock()
context = AttrDict({
'brow... |
#!/usr/bin/env python
"""
cTimer: A high resolution, high precision timer.
"""
import os
import sys
from distutils.core import setup, Extension
if sys.platform == 'darwin':
module1 = Extension('cTimer',
sources = ['cTimer.c'])
else:
module1 = Extension('cTimer',
sources = ['cTimer.c'],
extra_link_args = ['-l... |
#! /usr/bin/env python
####################################################################################
# calcSlopeDegrees.py
#
# A Python script to calculate slope from a DEM, where the horizontal spacing is in degrees
# latitude and longitude.
#
# Requires RIOS (https://bitbucket.org/chchrsc/rios/) to read image
... |
from django.db import models
# these are the two classes need to modify default Django user/admin login
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.models import BaseUserManager
from django.conf import settings
class UserProfi... |
import numpy as np
import skimage.color as color
import skimage.transform as transform
rgb2gray = color.rgb2gray
gray2rgb = color.gray2rgb
imresize = transform.resize
imrescale = transform.rescale
def immerge(images, n_rows=None, n_cols=None, padding=0, pad_value=0):
"""Merge images to an image with (n_rows * ... |
"""Finetuning BERT hugging gace (pytorch) model.
Author: Mohit Mayank
- Inspired from Masked Label modelling with BERT article
- Link: https://towardsdatascience.com/masked-language-modelling-with-bert-7d49793e5d2c
"""
# IMPORT =========
import pandas as pd
from tqdm import tqdm
import numpy as np
import numpy as np... |
class OpcoesArquivos:
def __init__(self, diretorio):
self.diretorio = diretorio
def add_zeros(self, valor):
valor = str(valor).replace(',', '.')
valor = str(round(float(valor), 2))
if float(valor) == 0:
valor = '0.00'
else:
cont = -1
... |
import pathlib
from setuptools import setup
setup(
name="pytest-level",
version='0.1.1',
py_modules=["pytest_level"],
description='Select tests of a given level or lower',
long_description=pathlib.Path('README.md').read_text(),
long_description_content_type="text/markdown",
author='Petr Vik... |
from interactable import Interactable, Button, TextBox
from textProcessor import TextProcessor
from imageProcessor import ImageProcessor
import pygame as pg
import config as cfg
class GameNode(Interactable):
def __init__(self, row_id=None, option_id=None, data=None):
self.row_id = row_id
s... |
import heterocl as hcl
def test_tensor_slice_shape():
A = hcl.compute((2,10), lambda i,j: 0)
assert A[0].shape == (10,)
|
BASE_MAPPER = {
'uuid': 'Id',
'name': 'Name',
'state': 'Status'
}
L3_NETWORK_MAPPER = {
'uuid': 'Id',
'name': 'Name',
'l2NetworkUuid': 'NetworkId'
}
PowerState_Mapper = {
'Running': 'POWERED_ON',
'Stopped': 'POWERED_OFF',
'Unknown': 'UNKNOWN',
'other': 'SUSPENDED'
}
|
from dataclasses import asdict, dataclass
from typing import Iterable, Optional, Union
import numpy as np
import pandas as pd
from .dist_funs import DEFAULT_DIST_PAIR_DICT, DistanceNormalizer
@dataclass
class PairBase:
df1: pd.DataFrame
df2: pd.DataFrame
name: Optional[str] = None
def __getitem__(... |
def models(app):
return 'model 1', 'model 2', 'model 3'
__drops__ = models
|
import os, numpy, random, time, math
import torch
import torch.nn.functional as F
from ssl_lib.utils import Bar, AverageMeter
def supervised_train(epoch,train_loader, model,optimizer,lr_scheduler, cfg,device):
model.train()
batch_time = AverageMeter()
data_time = AverageMeter()
losses = AverageMeter... |
import os
import base64
import discord
# HTTP headers
headers = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET",
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Max-Age": "3600",
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/2010... |
"""Run distributed tasks using the Celery distributed task queue.
http://celeryproject.org/
"""
import os
import sys
import time
import contextlib
import multiprocessing
from mako.template import Template
try:
import joblib
except ImportError:
joblib = False
from bcbio import utils
from bcbio.distributed im... |
#!/usr/bin/env python3
"""
Tests for the inner product Tensorflow operation.
.. moduleauthor:: David Stutz
"""
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import ops
from matplotlib import pyplot as plt
Poisson_module = tf.load_op_library('build/libPoissonOp.so')
PoissonGrad_module = tf... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
import re
import six
from monty.io import zopen
from monty.re import regrep
from collections import defaultdict
from pymatgen.core.periodic_table import Ele... |
from datetime import date
ano = date.today().year
nome = input("digite seu nome: ")
idade = int(input("digite sua idade: "))
altura = float(input("digite sua altura: "))
peso = float(input("digite seu peso: "))
ano_nascimento = int(ano) - idade
imc = peso/(altura*altura)
print(f'nome:{nome}, idade:{idade}, altura:{a... |
from enum import Enum
from typing import Any
from app.schemas.debit import DebitCreate, DebitUpdate
from fastapi import APIRouter, Depends, HTTPException
from fastapi import status as sts
from sqlalchemy.orm import Session
from app import crud, models, schemas
from app.api import deps
from app.core.celery_app import ... |
# %%
'''Python Program to check for Stack Permutations.
What are Stack Permutations?
If the elements of the input queue can be permuted into the order of the elements in the output queue using '''
# %%
from queue import Queue
from collections import deque
# %%
def checkStackPermutation(inp, output, length):
... |
import sys
from datetime import datetime
from flask import Flask, g
from flask.json import JSONEncoder
from oslo_config import cfg
from oslo_log import log as logging
from pymsboot import config
from pymsboot.api.v1.movie import bp_movie
from pymsboot.context import make_context
from pymsboot.db.api import db_init, D... |
from django.db import models
from django.contrib.auth.models import User
import os
from django.conf import settings
import json
import logging
from datetime import datetime
import numpy as np
from django.db import transaction
from shutil import rmtree
import struct
import re
from django.contrib import admin
from django... |
"""
Do a search, generate modules for the questions & answers returned.
"""
import logging
from typing import List
from so_pip.commands.vendorize import import_so_question
from so_pip.utils import guards as guards
from so_pip.utils.user_trace import inform
LOGGER = logging.getLogger(__name__)
def import_so_search(
... |
from typing import List, Dict
from cloudrail.knowledge.context.aws.kms.kms_key_manager import KeyManager
from cloudrail.knowledge.context.aws.aws_environment_context import AwsEnvironmentContext
from cloudrail.knowledge.rules.aws.aws_base_rule import AwsBaseRule
from cloudrail.knowledge.rules.base_rule import Issue
fr... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 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... |
import pytest
import os
import numpy as np
import pandas as pd
import io
from nexoclom import __file__ as basefile
from nexoclom.atomicdata import gValue, PhotoRate
from nexoclom.atomicdata.initialize_atomicdata import (make_gvalue_table,
make_photorates_table)
@... |
import pytest
from abuse_whois.matchers.whois import get_contact_from_whois
@pytest.mark.parametrize(
"hostname",
[
"1.1.1.1",
"github.com",
],
)
def test_get_contact_from_whois(hostname: str):
assert get_contact_from_whois(hostname) is not None
|
# Copyright (c) 2021, 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/licenses/LICENSE-2.0
#
# Unless required by appli... |
import copy
import json
import re
import botocore
import skwadon.main as sic_main
import skwadon.lib as sic_lib
import skwadon.common_action as common_action
class ConnectionListHandler(common_action.ListHandler):
def __init__(self, session):
self.session = session
self.glue_client = None
de... |
def loop_example(list_to_loop_through):
""" Assuming each item in list_to_loop_through is a number, return a list of each item in that list squared. """
print "I'm going to begin to loop through this list: ", list_to_loop_through, "\n"
list_items_squared = []
for each_item in list_to_loop_through:
... |
"""
Copyright (c) 2017, Jairus Martin.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
@author jrm
"""
import ctypes
from ctypes.util import find_library
from atom.api import Atom, Float, Value, Str, Int, Typed
from enaml.application import Pr... |
"""
This module houses the GEOS ctypes prototype functions for the
topological operations on geometries.
"""
from ctypes import c_double, c_int
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
from django.contrib.gis.geos.prototypes.errcheck import (
check_geom, check_minus_one, chec... |
import time
import simple_queue
import simple_http_client
class Task(object):
def __init__(self, logger, config, method, host, path, headers, body, queue, url, timeout):
self.logger = logger
self.config = config
self.method = method
self.host = host
self.path = path
... |
try: input = raw_input # checks to see if in Python 3x or 2x to get input() command
except NameError: pass
import praw #Makes sure we can use the module
#The next part will tell reddit that we are who we are, so that we can
#grab info from accounts.
reddit = praw.Reddit(client_id='<YOUR CLIENT ID HERE>',
... |
__author__ = 'Tony Beltramelli - www.tonybeltramelli.com'
__modified = 'Kevin Kössl'
CONTEXT_LENGTH = 48
IMAGE_SIZE = 160
BATCH_SIZE = 64
EPOCHS = 10
STEPS_PER_EPOCH = 72000
|
#!/usr/bin/env python
# Copyright 2014-2021 The PySCF Developers. 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
#
# U... |
#!/usr/bin/env python
#
# Copyright (c) 2013-2016, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
import sys
i... |
import os
import argparse
from em import molecule
from dataset.metrics import matching_iou
from evoseg import evolutionary_segmentation as evo_seg
from evoseg import miscellaneous as misc
import numpy as np
import pandas as pd
import pickle
import copy
import glob
MAX_NUMBER_SEGMENTS=60
if __name__ == '__main__':
... |
#!/env/python
# -*- encoding: utf-8 -*-
"""
@version: 0.1
@author: wenzhiquan
@contact: wenzhiquanr@163.com
@site: http://github.wenzhiquan.com
@software: PyCharm
@file: __init__.py.py
@time: 15/12/7 15:17
@description: null
"""
def func():
pass
class Main():
def __init__(self):
pass
if __name__ ... |
from test_utils import run_query
def index_key(item):
return item['index']
def test_quadbin_kring_distances():
"""Computes kring"""
result = run_query('SELECT QUADBIN_KRING_DISTANCES(5209574053332910079, 1)')
expected = sorted(
[
{'index': 5208043533147045887, 'distance': 1},
... |
from django.http import Http404
from django.shortcuts import render, redirect
from haystack.generic_views import SearchView, FacetedSearchView, FacetedSearchMixin
from nuremberg.documents.models import Document
from .forms import DocumentSearchForm
from .lib.digg_paginator import DiggPaginator
from .lib.solr_grouping_b... |
Y,X,d = [int(x) for x in input().split()]
arr = []
for _ in range(Y):
xs = [int(x) for x in input().split()]
arr.extend(xs)
arr.sort()
hi = max(arr)
for i in range(Y*X):
arr[i] -= hi
if all(map(lambda x: x % d == 0, arr)):
total = 0
med = arr[(Y*X) // 2]
# print(med)
for x in arr:
... |
#!/usr/bin/env python3
plink = 'https://www.udemy.com/course/python-1000/?referralCode=D3A7B607149F46D12A28'
doc = f'''
> This file was created by [this](./missions.py) Python script.
Learn what Python scripts [can do]({plink}) for you!
'''
import os
ofile = './MISSIONS.md'
mfile = 'MISSION.md'
def get_mission(afile,... |
# Copyright (c) ACSONE SA/NV 2021
# Distributed under the MIT License (http://opensource.org/licenses/MIT).
"""Utilities to work with PEP 503 package indexes."""
import logging
import os
from io import StringIO
from pathlib import PosixPath
from subprocess import CalledProcessError
from typing import Iterator, Optional... |
from com.hhj.pystock.search_engine.Bloomfilter import Bloomfilter
from com.hhj.pystock.search_engine.Segments import segments
class SplunkM(object):
def __init__(self):
self.bf = Bloomfilter(64)
self.terms = {} # Dictionary of term to set of events
self.events = []
def add_event(self... |
"""打印输出乘法表(内部函数)"""
upper = int(input('从1到几:'))
def multiplication_table(n: int) -> bool:
"""打印输出数字1~n的乘法表"""
def put_bar(n: int) -> None:
"""连续打印输出n个'-'并换行"""
print('-' * n)
if 1 <= n <= 3: w = 2
elif 4 <= n <= 9: w = 3
elif 10 <= n <= 31: w = 4
... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyDaskMl(PythonPackage):
"""Scalable Machine Learning with Dask."""
homepage ... |
#
# dcolumn/dcolumns/tests/urls.py
#
try:
from django.urls import re_path
except:
from django.conf.urls import url as re_path
from . import views
urlpatterns = [
re_path(r'^test-book-create/$', views.test_book_create_view,
name='test-book-create'),
re_path(r'^test-book-update/(?P<pk>\d+)/$',... |
#input para pegar valor da variavel
valor = input('digite algo: ')
#variaveis gerais
tipo = type(valor)
espaco = valor.isspace()
numero = valor.isnumeric()
alfabetico = valor.isalpha()
alfanumerico = valor.isalnum()
maiscula = valor.isupper()
minuscula = valor.islower()
maiscula_e_minuscula = valor.istitle()
#transform... |
import ctypes
import numpy as np
from AnyQt.QtCore import QRectF
from pyqtgraph.graphicsItems.ImageItem import ImageItem
# load the C++ library; The _grid_density is build and distributed as a
# python extension but does not export any python objects (apart from PyInit),
from . import _grid_density
lib = ctypes.pyd... |
# Generated by Django 3.1.1 on 2020-09-14 04:11
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('organization', '0002_auto_20200913_1430'),
]
operations = [
migrations.RemoveField(
model_name='organization',
name='group',... |
from distutils.core import setup, Extension, Command
from distutils import sysconfig
from distutils.command.build_ext import build_ext
import os, shutil, re, subprocess
class my_build_ext (build_ext):
def run(self):
cmd = self.reinitialize_command('build_dylib')
cmd.run()
build_ext.run(sel... |
from lx16a import *
from math import sin, cos, pi
import time
import xlwt
import pandas as pd
import numpy as np
from xlwt import Workbook
class RecordMotorData():
def __init__ (self, servo):
self.servo = servo;
self.id = [];
self.angleOffset = [];
self.physicalPos = [];
self.virtualPos = [];
self.temp = ... |
from django.views.generic import TemplateView
class HistorySupportTabTemplateView(TemplateView):
template_name = "history_support/base.html"
class HistorySupportTab1TemplateView(TemplateView):
template_name = "history_support/frags/tab_1.html"
class HistorySupportTab2TemplateView(TemplateView):
templa... |
from Crypto.PublicKey import RSA
from Crypto.Util.number import *
#e, n, c
params = open("parameters.txt").read().split("\n")
for l in params:
if len(l) == 0:
continue
exec(l)
'''
#export public key pair to public.pem
public_key = RSA.construct((n, e))
with open("public.pem", "w") as f:
f.write(public_key.expo... |
#
# (c) 2017, Forcepoint
# Documentation fragment. This fragment specifies the top level
# requirements for obtaining a valid session to the Forcepoint NGFW Management
# Center.
class ModuleDocFragment(object):
# Standard documentation fragment
DOCUMENTATION = '''
options:
filter:
description:
- S... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : github.py.py
# @Author: guq
# @Date : 2022/4/19
# @Desc :
import base64
import hashlib
from core.uploader_base import BaseUploader, init_server_decor
class GithubUploader(BaseUploader):
name = 'github'
is_repo = True
def __init__(self, access... |
#from .sparseDatasetLoader import SparseDatasetLocator, SparseDataset
from .denseDatasetLoaderHDF5_v2 import DenseDatasetFromSamples_v2
from .adaptiveDatasetLoader import getSamplePatternCrops, AdaptiveDataset
from .datasetUtils import getCropsForDataset, Normalization, getNormalizationForDataset
from .stepsizeDatasetL... |
from pydantic import BaseModel
class Configuration(BaseModel):
latitude: str
longitude: str
|
import cv2
import numpy as np
import math
import socket
import time
UDP_IP = "localhost"
UDP_PORT = 5065
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
time_counter = 0 # For counting time
frequency_tracker_left = [0]*6
frequency_tracker_right = [0]*6
def get_max(arr):
e = -1
freq = -123456
fo... |
#! /usr/bin/python3
import sys
import json
import argparse
import logging
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--add", nargs='+', type=str, required=False,
help="List of strings to add to the vocab at the end.")
args = parser.parse_args()
... |
from .SCM import SCM
__all__ = ['SCM']
|
from uFire_ISE import uFire_ISE
mv = uFire_ISE()
mv.measuremV()
print("mV: " + str(mv.mV))
|
from smpl_tools.actions import _determine_output_samplenames, _process_naming_pattern
import unittest
class SplitSilenceTest(unittest.TestCase):
def test_determine_multiple_filenames_extensionless_names_kept(self):
extensionless_name = "my_src"
result = _determine_output_samplenames(None, extens... |
"""
notes:
? docs:
? I said pick up the can.
§ TODO:
§ Amplify weapons on Wallhammer.
% FIXME:
% Target compromised: move in, move in.
& FIX:
& Overwatch, target one sterilized.
µ WHYNOT:
µ make a floor list with room class instances, use index wit... |
__author__ = 'dimd'
from zope.interface import Interface, Attribute
class IValidator(Interface):
is_valid = Attribute('is this message valid')
message_type = Attribute('show us the type of the message')
def validate():
"""
Validate incoming message for our supported types
:retur... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
__copyright__ = ('Copyright Amazon.com, Inc. or its affiliates. '
'All Rights Reserved.')
__version__ = '2.6.1'
__license__ = 'MIT-0'
__author__ = 'Akihiro Nakajima'
__url__ = 'https://github.com/aws-s... |
import os
from nacl.encoding import Base64Encoder, HexEncoder, URLSafeBase64Encoder
from nacl.signing import SigningKey
key_length = 32
private_key_signature = b"\x00\x00\x00\x40"
public_key_signature = b"\x00\x00\x00\x20"
device_ip_cache_filename = ".device_ip.cache"
def read_device_ip_from_cache(device_id: str):
... |
# 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 ... |
# Copyright 2016 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 or at
# https://developers.google.com/open-source/licenses/bsd
"""Unit test for User Group creation servlet."""
from __future__ import print_function
from __f... |
from ..extensions import db
class Election(db.Model):
""" Implements an object to represent all data relating to a specific
election """
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.Text, unique=True, nullable=False)
voters = db.relationship('Voter',
... |
import os
import cv2
import datetime
def read_image(img_path):
img = cv2.imread(img_path)
img[:,:,::-1] = img
return img
def rgb2gray(img):
return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY).squeeze()
def save_image(img_path, img):
cv2.imwrite(img_path, img[:,:,::-1])
def get_all_paths(folder, ext=Non... |
from model.contact import Contact
def test_add_contact(app):
old_contact = app.contact.get_contact_list()
contact = Contact(firstname="Ivan", lastname="Ivanov")
app.contact.add(contact)
assert len(old_contact) + 1 == app.contact.count()
new_contact = app.contact.get_contact_list()
old_contact.a... |
# Copyright 2019-2020 Not Just A Toy Corp.
#
# 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... |
import functools
import os
import subprocess
import sys
import click
# TODO: CAMPid 0970432108721340872130742130870874321
def import_it(*segments):
import importlib
import pkg_resources
major = int(pkg_resources.get_distribution(__name__.partition('.')[0]).version.partition(".")[0])
m = {
"... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'publish_progress_form.ui'
#
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from tank.platform.qt import QtCore, QtGui
class Ui_PublishProgressForm(object):
def setupUi(self... |
import sys
import os
from pathlib import Path
import shutil
unary_op = ['-', '~']
op = ['+', '*', '&', '<', '>', '/', '|', '-', '=']
class_var_dec = ['field', 'static']
types = ['int', 'char', 'boolean']
statements = ['let', 'while', 'if', 'do', 'return']
subDec = ['constructor', 'method', 'function']
keywo... |
from django.db import models
import django
import datetime
from django.conf import settings
# Create your models here.
class category(models.Model):
"""docstring for category"""
categoryName = models.CharField(max_length=50, primary_key=True)
categoryCount = models.IntegerField(default=0)
def __str__(self):
ret... |
# -*- coding: utf-8 -*-
'''
Use the cloud cache on the master to derive IPv4 addresses based on minion ID.
This roster requires that the minion in question was created using at least the
2015.2.0 version of Salt Cloud. Starting with the 2015.2.0 release, Salt Cloud
maintains an index of minions that it creates and del... |
import cv2
import numpy as np
from base_camera import BaseCamera
def merge(left_image, right_image):
return np.concatenate((left_image, right_image), axis=1)
class Camera(BaseCamera):
video_source_1 = 1
video_source_2 = 2
@staticmethod
def set_video_sources(source_1, source_2):
Camera.vi... |
# Authors: Cicely Motamedi, Adam Robinson
# Description: This file contains the main code for the microscope user interface.
# Some of the more complicated functionality is found in other files.
from kivy.app import App
from kivy.uix.scatter import Scatter
from kivy.uix.label import Label
from kivy.... |
from ttypes import *
# Alias for rpc_storage_mode
class StorageMode:
""" Confluo storage modes.
Attributes:
IN_MEMORY: Data stored in memory.
DURABLE_RELAXED: Relaxed (no linearizable guarantees).
DURABLE: Data is persisted.
"""
def __init__(self):
pass
IN_MEMORY... |
# -*- coding: utf-8 -*-
class ThreadSafeCreateMixin(object):
"""
ThreadSafeCreateMixin can be used as an inheritance
of thread safe backend implementations
"""
@classmethod
def create(cls):
"""
Return always a new instance of the backend class
"""
return cls()
... |
"""Amendment of the DataLad `GitRepo` base class"""
__docformat__ = 'restructuredtext'
from . import utils as ut
from datalad.support.gitrepo import (
GitRepo as RevolutionGitRepo
)
obsolete_methods = (
'is_dirty',
)
# remove deprecated methods from API
for m in obsolete_methods:
if hasattr(RevolutionGit... |
from django.db.models import Q
from rest_framework import serializers, viewsets
from brambling.api.v1.permissions import BaseOrderPermission
from brambling.models import (
Attendee,
EnvironmentalFactor,
Order,
)
class AttendeePermission(BaseOrderPermission):
def has_permission(self, request, view):
... |
c.NotebookApp.ip = '0.0.0.0' #'localhost' # 指定
c.NotebookApp.open_browser = False # 关闭自动打开浏览器
#c.NotebookApp.ip = '*'
c.NotebookApp.allow_root = False
c.NotebookApp.port = 8889
c.NotebookApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$zoyBM4a1oUIpw4bO/mciVQ$JN/sGgvyOhVpbpzU/z4u8HsAWG3dYXfavHFeaxADLgA'
|
"""Tests for letsencrypt.le_util."""
import errno
import os
import shutil
import stat
import tempfile
import unittest
import mock
from letsencrypt import errors
class MakeOrVerifyDirTest(unittest.TestCase):
"""Tests for letsencrypt.le_util.make_or_verify_dir.
Note that it is not possible to test for a wron... |
import unittest
from source_document import SourceDocument
from test_tagged_document import create_test_repo
from tagged_document import TaggedDocument
class SourceDocumentTests(unittest.TestCase):
"""Unit tests for the Document class"""
def test_cleaning(self):
# Tests removing snippets
input... |
from dataclasses import dataclass
from typing import Optional
import hyperstate as hs
@dataclass(eq=True)
class DeepInner:
x: int
@dataclass(eq=True)
class PPO:
inner: Optional[DeepInner] = None
cliprange: float = 0.2
gamma: float = 0.99
lambd: float = 0.95
entcoeff: float = 0.01
value_l... |
# Copyright 2021 DeepMind Technologies Limited. 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 ... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# -----------------------------------
# pylint: disable=line-too-long
# This is to allow complete package description on PyPI
"""
Core component of the Microsoft Graph Python SDK consisting of HTTP/Graph Cli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.