text stringlengths 2 999k |
|---|
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'voteblock.settings')
try:
from django.core.management import execute_from_command_line
except Im... |
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe import _
from erpnext.stock.report.delayed_item_report.delayed_item_report import DelayedItemReport
def execute(filters=None):
columns, data = [],... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, publish... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2019-06-05 18:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0042_add_bio_to_users'),
]
operations = [
migrations.AlterField(
... |
from random import choice
from Solid.GeneticAlgorithm import GeneticAlgorithm
class Algorithm(GeneticAlgorithm):
"""
Tries to get a randomly-generated string to match 000111
"""
def _initial_population(self):
return list(list([choice([0, 1]) for _ in range(6)]) for _ in range(50))
def _fi... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
import hashlib
import hmac
import random
import string
SECRET_KEY = "DebugTalk"
def gen_random_string(str_len):
random_char_list = []
for _ in range(str_len):
random_char = random.choice(string.ascii_letters + string.digits)
random_char_list.append(random_char)
random_string = ''.join(ran... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test read functionality for OGR PGEO driver.
# Author: Even Rouault <even dot rouault at mines dash paris dot org>
#
######################... |
from common.constants import UNKNOWN_LABEL, INIT, FINI, X64_FUN_ARG_REGS, ARM_FUN_ARG_REGS, X86_SOCKETCALL_ARGS
from elements.regs import Reg, RegBase, GivReg
from elements.givs import IntConst, VirtualExp
from elements.elmfactory import mem_addr, make_reg, make_temp_offset
from elements.elmfactory import get_virtual_... |
"""Module implementing Transducer main and auxiliary tasks."""
from typing import Any
from typing import List
from typing import Optional
from typing import Tuple
import torch
from espnet.nets.pytorch_backend.nets_utils import pad_list
from espnet.nets.pytorch_backend.transformer.label_smoothing_loss import (
La... |
"""
Labels module
"""
from .hfpipeline import HFPipeline
class Labels(HFPipeline):
"""
Applies a zero shot classifier to text using a list of labels.
"""
def __init__(self, path=None, quantize=False, gpu=True, model=None):
super().__init__("zero-shot-classification", path, quantize, gpu, mod... |
import warnings
import numpy as np
from scipy import spatial
from skmultiflow.lazy import KDTree
from sklearn import neighbors as ng
from timeit import default_timer as timer
from skmultiflow.data import FileStream
from skmultiflow.transform import OneHotToCategorical
def demo():
""" _test_kdtree_compare
... |
import itertools
from django.conf import settings
from django.db import models
from django.db.models.signals import post_save
from django.utils import timezone
from django.shortcuts import reverse
from django.utils.text import slugify
from django_countries.fields import CountryField
from stdimage import StdImageField
... |
"""
local path implementation.
"""
from __future__ import with_statement
from contextlib import contextmanager
import sys, os, atexit, io, uuid
import py
from py._path import common
from py._path.common import iswin32, fspath
from stat import S_ISLNK, S_ISDIR, S_ISREG
from os.path import abspath, normpath, isabs, exi... |
from chainer import cuda
from chainer import gradient_check
import numpy
import pytest
from chainer_chemistry.config import MAX_ATOMIC_NUM
from chainer_chemistry.models.relgat import RelGAT
from chainer_chemistry.utils.permutation import permute_adj
from chainer_chemistry.utils.permutation import permute_node
atom_si... |
"""Generic training script that trains a model using a given dataset."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from datasets import dataset_factory
from deployment import model_deploy
from nets import nets_factory
from pr... |
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from fast_rcnn.config import cfg
from fast_rcnn.nms_wrapper import nm... |
#ATS:flux SELF FluxDirect 800000
"""A flux machine for ATS
"""
from __future__ import print_function
from ats import machines, debug, atsut
from ats import log, terminal
from ats import configuration
from ats.atsut import RUNNING, TIMEDOUT, PASSED, FAILED, BATCHED, CREATED, SKIPPED, HALTED, EXPECTED, ... |
import threading
import anki_vector
from anki_vector import behavior
from anki_vector.events import Events
import time
from victory_emote import victory_emote
from anki_vector.util import degrees, distance_mm, speed_mmps
said_text = False
crap_shoot = False
def turn_right_two():
with anki_vector.Robot() as robot... |
"""
The class of Neural Network
"""
import numpy as np
from plot import make_confusion_matrix
class NNetwork:
def __init__ (self, num_input, sizes, num_output, batch_size, useRELU=False):
self.sizes = sizes[:]
self.sizes.append (num_output)
self.sizes.insert(0, num_input)
self.batch... |
# -*- coding: utf-8 -*-
from spider_selenium.util.spiderdriver import SpiderWebDriver
if __name__ == '__main__':
webdriver=SpiderWebDriver()
webdriver.open("https://baidu.com")
|
#!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary Dash Core distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $BITCOINDIR/src/qt/locale"%sys.a... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v6/enums/ad_group_status.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflect... |
#!/usr/bin/env python
import sys, os
from opentreetesting import test_http_json_method, config
DOMAIN = config('host', 'apihost')
# this amendment does not exist
SUBMIT_URI = DOMAIN + '/v3/amendment/additions-0000000-99999999'
if test_http_json_method(SUBMIT_URI, 'GET', expected_status=404):
sys.exit(0)
sys.exit(1)... |
"""
Collision models
"""
import torch
from lettuce.equilibrium import QuadraticEquilibrium
from lettuce.util import LettuceException
__all__ = [
"BGKCollision", "KBCCollision2D", "KBCCollision3D", "MRTCollision", "RegularizedCollision",
"SmagorinskyCollision", "TRTCollision", "BGKInitialization"
]
class BG... |
# coding=utf-8
# Copyright 2020 The Allen Institute for AI team and The HuggingFace Inc. 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... |
#!/bin/python3
def minimumNumber(n, password):
numbers = "0123456789"
lower_case = "abcdefghijklmnopqrstuvwxyz"
upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
special_characters = "!@#$%^&*()-+"
digit = 1
lower = 1
upper = 1
special = 1
for c in password:
if c in numbers:
... |
"""authome URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... |
#!/usr/bin/env python
# Copyright 2016 Netfishers
#
# 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 ... |
from app.models import db
from igenwo import create_app
db.create_all(app=create_app())
|
"""
WSGI config for hello 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... |
#!/usr/bin/env python
"""
:Author: Martin Kircher
:Contact: mkircher@uw.edu
:Date: *30.04.2015
"""
import sys, os
from optparse import OptionParser
from sortedcontainers import SortedList
import math
parser = OptionParser()
parser.add_option("-w","--WPS", dest="WPS", help="Window protection score file (def WPS.wig)"... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
from Functions import ServerConnection, setRequestJson
import os
connection = ServerConnection()
while True:
response = connection.send(setRequestJson('getDevicesStatus', 'Server', 0, '.com'))
if response['Friday']['action'] == 1:
os.startfile(os.getcwd().replace('Sexta-Feira(A.I.)', '') + 'Sexta-Fe... |
# Copyright 2020 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... |
# 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)
import sys
import llnl.util.tty as tty
from llnl.util.tty.color import cprint, get_color_when
import spack.cmd
import s... |
"""
Longest Arithmetic Subsequence
Given an array nums of integers, return the length of the longest arithmetic subsequence in nums.
Recall that a subsequence of an array nums is a list nums[i1], nums[i2], ..., nums[ik] with
0 <= i1 < i2 < ... < ik <= nums.length - 1, and that a sequence seq is arithmetic
if seq[i... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
from tkinter import *
import webbrowser
from subprocess import call
def Back():
root.destroy()
call(['python', 'Apps.py'])
def openYogaM():
webbrowser.open(YogaM, new=new)
def openYogaN():
webbrowser.open(YogaN, new=new)
def openGymN():
webbrowser.open(GymN, new=new)
def openZum():
webbrowser.open(Zum, new=n... |
def count_up(start, stop):
"""Print all numbers from start up to and including stop.
For example:
count_up(5, 7)
should print:
5
6
7
"""
while start <= stop:
print(start)
start = start + 1
count_up(5, 7)
|
#!/usr/bin/env python
# coding:utf-8
import os
import urllib2
import json
import time
import threading
import zipfile
import sys
from distutils.version import LooseVersion
from instances import xlog
import config
import uuid
import platform
import update_from_github
#opener = urllib2.build_opener()
#update_url = "h... |
# PyTorch
import torch
from torch.utils.data import IterableDataset, DataLoader
from donkeycar.utils import train_test_split
from donkeycar.parts.tub_v2 import Tub
from torchvision import transforms
from typing import List, Any
from donkeycar.pipeline.types import TubRecord, TubDataset
from donkeycar.pipeline.sequence ... |
def chessKnight(cell):
if(bool(re.search("^[a|h][1|8]$", cell))):
return 2
if(bool(re.search("^[a|h][2|7]|[b|g][1|8]$", cell))):
return 3
if(bool(re.search("^[a|h][3-6]|[c|d|e|f][1|8]|[b|g][2|7]$", cell))):
return 4
if(bool(re.search("^[c|d|e|f][2|7]|[b|g][3-6]$", cell))):
... |
from py2neo.ogm import GraphObject, Property
class User(GraphObject):
__primarylabel__ = "user"
__primarykey__ = "email"
name = Property()
email = Property()
password = Property()
hashed_password = Property()
created_on = Property()
last_logon = Property()
#class Events(G... |
import unittest
import numpy as np
import string
from task import remove_extra_stuff, text
test_text = np.array(['Method #1:', 'Using isdigit() method', ' Method #2:', 'Using regex'])
class TestCase(unittest.TestCase):
def test_array(self):
txt = remove_extra_stuff(text)
np.testing.assert_array_... |
#!/usr/bin/env python
import mirheo as mir
dt = 0.001
ranks = (1, 1, 1)
domain = (12, 8, 10)
rc = 1.0
num_density = 8
u = mir.Mirheo(ranks, domain, dt, debug_level=3, log_filename='log')
pv = mir.ParticleVectors.ParticleVector('pv', mass = 1)
ic = mir.InitialConditions.Uniform(num_density)
u.registerParticleVect... |
from django.utils import timezone
from website.mails import mails
from website.notifications import utils
from website.reviews import signals as reviews_signals
# Handle email notifications including: update comment, accept, and reject of submission.
@reviews_signals.reviews_email.connect
def reviews_notification(se... |
"""
Copyright (c) 2020 OneUpPotato
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, softwar... |
from lxml import etree
from cheshire3.baseObjects import Record
from cheshire3.record import LxmlRecord
class GraphRecord(LxmlRecord):
graph = None
def __init__(self, data, xml="", docId=None, wordCount=0, byteCount=0):
self.dom = None
self.graph = data
self.xml = xml
self.i... |
import datetime
import logging
from celery import Celery
from mail_service.gmail_service import GmailService
celery = Celery('EOD_TASKS')
celery.config_from_object('mail_service.gmail_service.celeryconfig')
@celery.task(name='check_account_v1')
def check_account_v1(email, new_history_id, **kwargs):
gmail = Gmai... |
import torch
import torch.distributions as dist
def unif_sample(sample_shape=[1], low=0, high=1):
"""Generate a sample from U(low, high).
:param sample_shape: The shape S
:param low: Lower bound on uniform
:param high: Upper bound on uniform
:return: A matrix of shape S containg samples from the ... |
import html
import nltk
import time
import logging
import itertools
from collections import defaultdict
import requests
from pytool.lang import Namespace
# API Urls for ease of maintenance and review
urls = Namespace()
urls.shop.listings = 'https://openapi.etsy.com/v2/shops/{shop}/listings/active'
# Request session... |
import random
import sys
from personcompo.framework.gameagent import GameAgent
from personcompo.framework.randombehavior import RandomBehavior
from personcompo.dominoes.dominoesagent import GreedyDominoesBehavior
class tiles:
TABLE = 4
# Debug print
debug_mode = False
def dprint(msg):
if debug_mode:
... |
# Generated by Django 2.0.4 on 2018-04-18 14:22
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('events', '0001_initial'),
migrations.swappable_dependency(setti... |
"""empty message
Revision ID: 2de9749937e4
Revises: 9fac7f545190
Create Date: 2021-06-14 14:44:56.591378
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2de9749937e4'
down_revision = '9fac7f545190'
branch_labels = None
depends_on = None
def upgrade():
# ... |
"""
Methods need to work with Oracle DB(misc)
oracle = OracleDB()
connection, cursor = oracle.connect()
#This is space for you query's.
#For example:
all = Select().Dictionary().all(oracle, cursor))
oracle.close(connection, cursor)
"""
from datetime import datetime
import cx_Oracle as Oracle
from config import Misc
... |
"""
Django settings for nature_school_32724 project.
Generated by 'django-admin startproject' using Django 2.2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
... |
"""Example of private key encryption/decryption with EC multiplication using BIP38."""
import binascii
from bip_utils import Bip38PubKeyModes, Bip38Decrypter, Bip38Encrypter, Bip38EcKeysGenerator, WifEncoder
# BIP38 passphrase
passphrase = "DummyPassphrase"
# Generate an intermediate passphrase without lot and seque... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 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... |
#!/usr/bin/env python
# encoding: utf-8
from datetime import datetime
from unittest import TestCase
import application.models as Models
from application import create_app
class PostModelTest(TestCase):
def setUp(self):
self.app = create_app('TESTING')
Models.Role.objects.create(
id=1,... |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from .common import BaseTest
class CertificateTest(BaseTest):
def test_certificate_augment(self):
factory = self.replay_flight_data("test_acm_certificate_augment")
p = self.load_policy({
'name': 'acm-cert-g... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 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 RPCs related to blockchainstate.
Test the following RPCs:
- getblockchaininfo
- gettxout... |
import numpy as np
import matplotlib.pyplot as plt
import cPickle
import sys
import math
import sklearn
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.preprocessing import MaxAbsScaler
if __name__ == "__main__":
file_name = "log.pick"
if ".pick" in sys.argv[1]:
file_name = sys.argv[1]
... |
#!/usr/bin/env python
# Copyright (c) 2019, NVIDIA CORPORATION. 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, thi... |
# min of string
s = 'abcC'
print(min(s))
for c in s:
print(c, 'unicode value =', ord(c))
# min with tuple
tuple_numbers = (1, 2, 3, 4)
print(min(tuple_numbers))
# min of list
list_numbers = [1, 2, 3, -4]
print(min(list_numbers))
class Data:
id = 0
def __init__(self, i):
self.id = i
def __... |
# -*- coding:utf-8 -*-
import binascii
class ParseMethod(object):
@staticmethod
def parse_default(f, count, offset):
pass
@staticmethod
def parse_latitude(f, count, offset):
old_pos = f.tell()
f.seek(12 + offset)
latitude = [0,0,0]
for i in xrange(count):
byte = f.read(4)
n... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
from typing import Union
table = "fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF"
tr = {}
for i in range(58):
tr[table[i]] = i
s = [11, 10, 3, 8, 4, 6]
xor = 177451812
add = 8728348608
def av2BV(aid: Union[int, str]) -> str:
aid = (aid ^ xor) + add
r = list("BV1 4 1 7 ")
for i in range(... |
import datetime
import xml.etree.ElementTree as ET
from pathlib import Path
from typing import Generator
import darwin.datatypes as dt
def add_subelement_text(parent, name, value):
sub = ET.SubElement(parent, name)
sub.text = str(value)
return sub
def export(annotation_files: Generator[dt.AnnotationFil... |
from .rand2d import RandomSampler2D, AutomatonSampler2D, NoiseSampler2D
from .sampler2d import BlockSampler2DBase
from .wang_tiling import WangTiling
from .worker import Worker
|
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 13 22:45:00 2018
@author: benmo
"""
#from ModelsML import *
#from FinanceML import *
|
import os
import io
import yaml
CACHE_FILE = 'picture_cache.yml'
def _read_cache():
cache = {}
if os.path.exists(CACHE_FILE):
with open(CACHE_FILE, 'rt') as f:
cache = yaml.load(f, yaml.BaseLoader)
assert isinstance(cache, dict)
for k, v in cache.items():
ass... |
from ctm_python_client.jobs.hadoop.spark.python import PythonJob
import os
from ctm_python_client.core.bmc_control_m import CmJobFlow
from ctm_python_client.session.session import Session
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(BASE_PATH, ".secrets"), "r") as fp:
ctm_uri = f... |
#!/usr/bin/env python
"""
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");... |
#!/usr/bin/env python
# coding=utf-8
# pylint: disable=broad-except,unused-argument,line-too-long
# Copyright (c) 2016-2018, F5 Networks, 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... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from itertools import product
from compas.geometry import Geometry
from compas.plugins import pluggable
from compas.utilities import linspace
@pluggable(category='factories')
def new_surface(cls, *args, **kw... |
import pytest
from eth_utils import to_canonical_address
from raiden.constants import BLOCK_ID_LATEST, TRANSACTION_INTRINSIC_GAS
from raiden.exceptions import InsufficientEth
from raiden.network.rpc.client import (
JSONRPCClient,
SmartContractCall,
TransactionEstimated,
discover_next_available_nonce,
... |
"""This file is for testing the bucketing system."""
import testify as T
class TestCaseWithManyTests(T.TestCase):
def test0(self): pass
def test1(self): pass
def test2(self): pass
def test3(self): pass
def test4(self): pass
def test5(self): pass
def test6(self): pass
def test7(self): ... |
#!/usr/bin/env python3
# 🚨 Don't change the code below 👇
row1 = ["⬜️","⬜️","⬜️"]
row2 = ["⬜️","⬜️","⬜️"]
row3 = ["⬜️","⬜️","⬜️"]
map = [row1, row2, row3]
print(f"{row1}\n{row2}\n{row3}")
position = input("Where do you want to put the treasure? ")
# 🚨 Don't change the code above 👆
#Write your code below this row �... |
#Soal Maximum Sequence
#fungsi max sequence
def maxSequence(lst):
Max=None
for i in range(len(lst)):
new=0
for j in range(i,len(lst)):
new=lst[j]+new
if Max==None or new>Max:
Max=new
return Max
#test case
print(maxSequence([-2,1,-3,4,-1,2,1,-5,4]))#6... |
#!/usr/bin/env python
# Zed Attack Proxy (ZAP) and its related class files.
#
# ZAP is an HTTP/HTTPS proxy for assessing web application security.
#
# Copyright 2016 ZAP Development Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... |
"""
scout插件的一些公用数据和方法
可能每个子类需要的流程不太一样
所以子类有可能都是独立的
create by judy 2019/07/10
"""
import json
from datacontract.idowncmd.iscoutcmd import SendCode
import threading
import time
import traceback
from commonbaby.mslog import MsLogger, MsLogManager
from jsonoutputer import Outputjtf
from idownclient.config_task import cl... |
# Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
import entrypoints
hacks = []
entrypoints.GenerateEntrypoints(hacks)
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: oesteban
# @Date: 2015-11-19 16:44:27
""" fmriprep setup script """
def main():
""" Install entry-point """
from setuptools import setup
from setuptools.extension import Extension
from numpy import get_include
from fmriprep.__about__ impor... |
import pytest
from datadog_checks.envoy.errors import UnknownMetric, UnknownTags
from datadog_checks.envoy.metrics import METRIC_PREFIX, METRICS
from datadog_checks.envoy.parser import parse_histogram, parse_metric
def test_unknown_metric():
with pytest.raises(UnknownMetric):
parse_metric('foo.bar')
de... |
import cv2
import mediapipe as mp
import numpy as np
from imread_from_url import imread_from_url
class ExorcistFace():
def __init__(self, exorcist_image_url, show_webcam = True, max_people=1, detection_confidence=0.3):
self.show_webcam = show_webcam
self.initialize_model(max_people, detection_co... |
import tensorflow as tf
__all__ = ["kf", "ks", "kfs"]
from tensorflow_probability.python.distributions import MultivariateNormalTriL
mv = tf.linalg.matvec
mm = tf.linalg.matmul
def kf(lgssm, observations, return_loglikelihood=False, return_predicted=False):
P0, Fs, Qs, H, R = lgssm
dtype = P0.dtype
m0 ... |
spam = "global spam"
def local_test():
def do_local():
spam = "local spam"
def do_nonlocal():
nonlocal spam
spam = "nonlocal spam"
def do_global():
global spam
print('spam in do_global: ' + str(id(spam)))
spam = "IT WORKS"
spam = "my precious"
do_local()
print... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... |
import os
import argparse
import time
import numpy as np
import tensorflow as tf
from tensorflow.python.platform import gfile
from tokenization import BertTokenizer
import modeling
def get_labels(label_file):
with open(label_file, 'r', encoding='utf-8') as f:
labels = f.readlines()
labels = [label.s... |
from github import Github
def get_github_repo(access_token, repository_name):
"""
github repo object를 얻는 함수
:param access_token: Github access token
:param repository_name: repo 이름
:return: repo object
"""
g = Github(access_token)
return g.get_user().get_repo(repository_name)
def upl... |
'''NXOS Implementation for Interface unconfigconfig triggers'''
# Genie Libs
from genie.libs.sdk.libs.utils.mapping import Mapping
from genie.libs.sdk.triggers.unconfigconfig.unconfigconfig import TriggerUnconfigConfig
# ATS
from ats.utils.objects import NotExists, Not
interface_exclude = ['maker', 'last_change','in_... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
from .debug_options import DebugOptions, LogLevel
from . import _utils, ... |
#! /usr/bin/env python
import rospkg
import rospy
from unit_3_service_bb8.srv import BB8CustomServiceMessage, BB8CustomServiceMessageRequest
rospy.init_node('service_move_bb8_in_square_custom_client') # Initialise a ROS node with the name service_client
rospy.wait_for_service('/move_bb8_in_square_custom') # Wait for ... |
from django.apps import AppConfig
class MainConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'main'
# class MainConfig(AppConfig):
# name = 'full.python.path.to.your.app.main'
# label = 'main' # <-- this is the important line - change it to anything other than the defau... |
import pygame
from pygame.sprite import Sprite
from ..assets import shipImage, transparentShipImage
from ..utils.vec2d import Vec2d
from ..utils.timer import Timer
from ..config import keyToTranslationVector, keyToRotationAngle, shipHealth
from ..config import invincibilityDuration
class Ship(Sprite):
"""
Cl... |
# Copyright 2019-2020 Xanadu Quantum Technologies 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... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
import logging
# from mongoengine import connect
import os
import sys
import mongoengine
from src.db.collections.log import Logs
DB_LOG_LEVEL = logging.ERROR
class CustomFormatter(logging.Formatter):
"""Logging Formatter to add colors and count warning / errors"""
BLACK = '\033[0;30m'
RED = '\033[0;31... |
import typing
import sys
import numpy as np
import numba as nb
@nb.njit
def sieve_of_eratosthenes(
n: int,
) -> np.array:
return gpf(n) == np.arange(n)
@nb.njit
def gpf(
n: int,
) -> np.array:
s = np.arange(n)
s[:2] = -1
i = 0
while i * i < n - 1:
i += 1
if s[i] == i: s[i::i] = i
return ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.