content stringlengths 5 1.05M |
|---|
# Copyright (c) 2021, NVIDIA 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... |
#! /usr/bin/env python
import os
import sys
import setuptools
def load_version():
"""Executes toy_pkg/version.py in a globals dictionary and return it."""
globals_dict = {}
with open(os.path.join('toy_pkg', 'version.py')) as fp:
exec(fp.read(), globals_dict)
return globals_dict
def is_insta... |
# Generated from MATLABLexer.g4 by ANTLR 4.7.2
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2>")
buf.write("\u01a4\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5... |
import test_support
class InconsistentDeclarationParameterNameRuleTest(test_support.TestBase):
def setUp(self):
self.set_default_rules_selection(['InconsistentDeclarationParameterNameRule'])
self.set_default_error_id('inconsistent declaration parameter name')
self.set_default_error_severity... |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber 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
#
# Unles... |
import unittest
import apache_beam as beam
from apache_beam.runners.portability import fn_api_runner
from apache_beam import pvalue
from unittest.mock import patch
import apache_beam.testing.util as beam_util
import pipeline_dp
from pipeline_dp import private_beam
from pipeline_dp import aggregate_params, budget_accou... |
import argparse
import os
import logging
import yaml
import joblib
# import numpy as np
# from matplotlib import pyplot as plt
from mathtools import utils
# from seqtools import fsm
from kinemparse import imu
logger = logging.getLogger(__name__)
def main(
out_dir=None, data_dir=None, scores_dir=None,
... |
# import os
# import spacy
# from spacy.attrs import IS_STOP, IS_PUNCT, IS_SPACE, IS_OOV
# from .dataset import dataset
# from .IdentifyRessource import extract_entities
# import re
# #==========================================Intialisation==================================
# nlp = spacy.load('en_core_web_sm')
# rawte... |
import logging
from datetime import datetime, timedelta
import pytz
from django.db import IntegrityError
from wx.decoders.insert_raw_data import insert
from wx.models import VariableFormat, DcpMessages
tz_utc = pytz.timezone("UTC")
tz_bz = pytz.timezone("Etc/GMT+6")
ELEMENTS = {
"BATTERY": 200,
"RAINFALL": ... |
# Community III
# Two stage-structured consumer species feeding on two resources
# For units and references, see Table S1.2 in Appendix S1
# Created by Wojciech Uszko (2021)
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
# Body masses (ng dry weight):
B_JS = 100 # small juv... |
#coding:utf-8
'''
测试没有成功
2018/06/27
'''
import sys
import requests
requests.packages.urllib3.disable_warnings()
def poccheck(url, cmd='whoami'):
result = False
header = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/5... |
import os
import sys
from setuptools import setup, find_packages, Command
VERSION = __import__("zmqpy").__version__
install_requires = []
try:
import importlib
except ImportError:
install_requires.append("importlib")
is_cpy = sys.version_info
is_pypy = hasattr(sys, "pypy_version_info")
setup(
name="zmq... |
# -*- coding: utf-8 -*-
"""
Created on 2021-03-02 23:42:40
---------
@summary:
---------
@author: Boris
"""
import feapder
class TencentNewsParser(feapder.BatchParser):
"""
注意 这里继承的是BatchParser,而不是BatchSpider
"""
def start_requests(self, task):
task_id = task[0]
url = task[1]
... |
import os
from icrawler.builtin import GoogleImageCrawler
from icrawler import ImageDownloader
from six.moves.urllib.parse import urlparse
import base64
def ensure_dir(directory):
if not os.path.exists(directory):
os.mkdir(directory)
class Base64NameDownloader(ImageDownloader):
def get_filenam... |
#
# PySNMP MIB module CISCO-WLAN-MAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WLAN-MAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:21:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
# Tweepy
# Copyright 2009-2022 Joshua Roesslein
# See LICENSE for details.
from tweepy.mixins import DataMapping, HashableID
class Place(HashableID, DataMapping):
"""The place tagged in a Tweet is not a primary object on any endpoint, but
can be found and expanded in the Tweet resource.
The object is a... |
# Copyright (c) 2020 OUXT Polaris
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
from vpncert import vpncert
import smtplib
import os
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import formatdate
from email import Encoders
from os.path import basename
from glob import glob
import zipfile
from tempfile import... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2010-2018 CNRS / Centre de Recherche Astrophysique de Lyon
Copyright (c) 2016-2018 Simon Conseil <simon.conseil@univ-lyon1.fr>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following condi... |
with open("Output.ini", "a") as text_file:
text_file.write("\nPurchase Amount: %s" % 5)
with open("Output.ini", "r") as text_file:
print text_file.read() |
# coding=utf-8
# Copyright 2015 Square, Inc.
from __future__ import print_function, with_statement
import logging
from pants.task.task import Task
from textwrap import dedent
logger = logging.getLogger(__name__)
class ShowNewIdeaMovedMessage(Task):
"""Displays a message letting people know that the new-idea go... |
# -*- coding: utf-8 -*-
# @Author : liaozhi
# @Time : 2021-07-01
# @Contact : liaozhi_edo@163.com
"""
特征
"""
# packages
import numpy as np
from config import *
from sklearn.preprocessing import LabelEncoder, OneHotEncoder, MinMaxScaler
def extract_features(df, action):
"""
提取特征
:param df: Dat... |
'''
Selection Sort
Time Complexity: O(N*N)
Space Complexity: 1
'''
from algorithms.Algorithm import Algorithm
class SelectionSort(Algorithm):
def __init__(self):
super().__init__("Selection Sort")
def algorithm(self):
for i in range(len(self.array)):
min_index = i
... |
from django.views.generic import TemplateView
from rest_framework import views, serializers, status
from rest_framework.response import Response
class Index(TemplateView):
template_name = 'index.html'
class EncuestasIndex(TemplateView):
template_name = 'encuestas.html'
class MessageSerializer(serializers.... |
import os
import zipfile
from pathlib import Path
from django.core.files.base import ContentFile
from django.test import TestCase
from django.test.client import Client
import pandas as pd
from pm4pymdl.objects.ocel.importer import importer as ocel_importer
from apps.index import models
from modules import utils
STA... |
# 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.
from telemetry.page import page_test
class ProfileCreator(page_test.PageTest):
"""Base class for an object that constructs a Chrome profile."""
def __... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import sys
import typing as t
__author__ = "Benjamin Kane"
__version__ = "0.1.0"
__doc__ = f"""
Pretty-print simple Bash command from one line of stdin
Examples:
echo 'echo "hi there" | awk "{{print $1}}"' | {sys.argv[0]}
Help:
Please see Benjamin Kan... |
import os.path
import unittest
import fluteline
import watson_streaming
import watson_streaming.transcriber
import watson_streaming.utilities
CREDENTIALS_PATH = 'credentials.json'
AUDIO_PATH = 'examples/audio_file.wav'
class TestSanity(unittest.TestCase):
def setUp(self):
if os.path.isfile(CREDENTIALS... |
# Jared Dyreson
# CPSC 386-01
# 2021-11-29
# jareddyreson@csu.fullerton.edu
# @JaredDyreson
#
# Lab 00-04
#
# Some filler text
#
"""
This module contains the Intro display class
"""
import pygame
import functools
import sys
from Invaders.Dataclasses.point import Point
from Invaders.Displays.display import Display
fr... |
import numpy as np
from predicu.data import CUM_COLUMNS
from predicu.preprocessing import preprocess_bedcounts
from predicu.tests.utils import load_test_data
def test_bedcounts_data_preprocessing():
test_data = load_test_data()
preprocessed = preprocess_bedcounts(test_data["bedcounts"])
assert len(prepro... |
import numpy as np
import sys
from scipy import stats
import matplotlib.pyplot as plt
from myfunction import cross_cov
from myfunction import gen_binary_obs
from myfunction import gen_binary
#=========================================================================================
# paramaters:
#l = sys.argv[1] ; t1 =... |
import pytest
from policyglass import EffectivePrincipal, Principal
def test_bad_union():
with pytest.raises(ValueError) as ex:
EffectivePrincipal(Principal("AWS", "arn:aws:iam::123456789012:root")).union(
Principal("AWS", "arn:aws:iam::123456789012:root")
)
assert "Cannot union ... |
import tkinter
mainWindow = tkinter.Tk()
mainWindow.title('Hello World')
mainWindow.geometry('640x40')
# text inside using Label widget
label = tkinter.Label(mainWindow, text='Inside the window')
label.pack(side='top')
# create canvas widget inside
canvas = tkinter.Canvas(mainWindow, relief='raised', borderwidth=5)... |
# sweep_generators.py
#
# This file is part of scqubits.
#
# Copyright (c) 2019, Jens Koch and Peter Groszkowski
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
########################################... |
#!/usr/bin/env python
import os
import pyfwk
from pyfi.entity.entity.db import EntityDB
# -------------------------------ENTITY-FUND------------------------------#
class EntityFund(pyfwk.Model):
model = None
dbase = None
table = None
columns = None
@staticmethod
def instance():
if n... |
"""
This module contains the definition of Preconditions which describes what to do with
the received parameter and does the necessary changes. The preconditions are used to
enable developers skipping or enabling rules based on a set of conditions.
.. warning::
The precondition is for checking that a rule should ... |
from decimal import Decimal
from collections import Counter
from django.contrib.gis.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from django.core.urlresolvers import reverse
from django.contrib.gis.geos import Point
from global_finprint.annotation.models.observation import ... |
'''
Created on 2015-02-16
@author: levi
'''
from xml.dom import minidom
from copy import deepcopy
from core.himesis_utils import graph_to_dot
from collections import defaultdict
class EcoreUtils(object):
'''
a set of utils to deal with ecore files
'''
def __init__(self, xmlfileName):
'''
... |
"""
Supervised Reptile learning and evaluation on arbitrary
datasets.
"""
import random
import tensorflow as tf
import numpy as np
from variables import (interpolate_vars, average_vars, subtract_vars, add_vars, scale_vars,
VariableState)
class Reptile:
"""
A meta-learning session.
... |
from contextlib import contextmanager
from sqlalchemy.engine import create_engine
from sqlalchemy.orm import Session
from pydas_metadata.contexts.base import BaseContext, session_factory
class MemoryContext(BaseContext):
"""
Memory connection context, handles data store session setup and object insertion.
... |
import json
import os
config_file = 'config.json'
config = {}
def create_config():
config = {}
main = {}
main["mister_ip"] = "000.000.00.000"
main["mister_username"] = "root"
main["mister_password"] = "1"
main["change_scenes"] = True
main["debug"] = False
main["custom_text_sources"] ... |
import dolfin as df
import numpy as np
from math import pi
from finmag.util.meshes import sphere
from fk_demag import FKDemagDG as FKDemag
from finmag.util.consts import mu0
radius = 1.0
maxh = 0.2
unit_length = 1e-9
volume = 4 * pi * (radius * unit_length) ** 3 / 3
def setup_demag_sphere(Ms):
mesh = sphere(r=ra... |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... |
#
# Copyright 2004 - 2006 Dave Cridland <dave@cridland.net>
#
# This file forms part of the Infotrope Python Library.
#
# The Infotrope Python Library 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 ver... |
from nose.tools import eq_, raises
from . import BaseTest, Car
from dstore.Error import EventNotFound, EventListenerNotFound, InstanceNotFound
class CancelAdd( BaseTest ):
def before_addd( self, event, model, instance ):
self.action = True
event.cancel()
def test( self ):
Car.events.b... |
#!/usr/bin/env python
""" Implementation of asynchronous pipe that easy to use for parallel
calculations.
FastQueueProcessor -- implementation """
__author__ = "Yaroslav Litvinov"
__copyright__ = "Copyright 2016, Rackspace Inc."
__email__ = "yaroslav.litvinov@rackspace.com"
from multiprocessing import Process
from m... |
# from lxml.html import fromstring, tostring
from lxml.html.clean import autolink_html
def autolink(context={}):
"""The autolink filter automatically add links.
It does this by looking for things that look like links, which includes
anything starting with `http`, `https`, and `mailto` and replaces it
... |
# -*- coding: utf-8 -*-
"""The GUI of the feature_engineering module of easylearn
Created on Wed Jul 4 13:57:15 2018
@author: Li Chao
Email:lichao19870617@gmail.com
GitHub account name: lichao312214129
Institution (company): Brain Function Research Section, The First Affiliated Hospital of China Medical University, S... |
import numpy as np
from cached_property import cached_property
from .utils import slices_intersection, slices_relative, parse_file_order
class CellOccurence:
def __init__(self, frame_number, cell_id, unique_id, position, colour=0):
"""
All parameters should be greater that zero.
Unique_id... |
from __future__ import (division, print_function)
from pomegranate import *
from nose.tools import with_setup
from nose.tools import assert_equal
from nose.tools import assert_not_equal
from nose.tools import assert_raises
import random
import numpy as np
import json
def setup():
'''
Build a model that we want to ... |
# -*- coding: utf-8 -*-
import unittest
import os
from contextlib import contextmanager
import itertools
import threading
import numpy as np
from .test_task import test_task
from .. import h5regulargrid
from ...io import nxfs
from ...utils.tests import genindexing
from .. import utils
from .. import nxwrap
from .. im... |
from os import getenv
from utils.etc import REQ_TYPE, request
async def get_token(code: str) -> dict:
return await request(
REQ_TYPE.POST,
url="https://oauth2.googleapis.com/token",
data={
"code": code,
"client_id": getenv("GOOGLE_CLIENT_ID"),
"client_s... |
class Task(object):
def __init__(self, task_name):
self.task_name = task_name
class Assignment(object):
"""The work assignment
Contains an identifier, a description and a set of ExportActions.
"""
def __init__(self, identifier, description="", export_actions=None):
if ' ' in ident... |
# - Coding UTF8 -
#
# Networked Decision Making
# Site: http://code.google.com/p/global-decision-making-system/
#
# License Code: GPL, General Public License v. 2.0
# License Content: Creative Commons Attribution 3.0
#
# Also visit: www.web2py.com
# or Groups: http://groups.google.com/group/web2py
# For details on the ... |
# Copyright 2018, Michael DeHaan LLC
# License: Apache License Version 2.0
# -------------------------------------------------------------------------
# output.py - applies all output plugins to a message. Output plugins
# can be used to format build output or also redirect it to additional
# sources.
# --------... |
import os, logging, time, json, urllib, socket
from http.cookiejar import MozillaCookieJar
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class AppleFindMy():
terminate = False
online = True
username = None
password = None
deviceId = None
deviceName = None
cookiejar = None
lo... |
import abc
import contextlib
import random
import collections
import copy
import numpy as np
import networkx as nx
"""A general Interface"""
class GraphSimilarityDataset(object):
"""Base class for all the graph similarity learning datasets.
This class defines some common interfaces a graph similarity dataset ... |
#!/usr/bin/env python
# coding: utf-8
"""
QMainWindow based on :mod:`silx.examples.customHdf5TreeModel`
"""
import os
from silx.gui import qt
from sloth import _resourcesPath
from .view import TreeView
from .model import TreeModel
from sloth.gui.plot.plotarea import PlotArea # sloth version
from sloth.gui.console imp... |
"""Extract and merge links from HTML bookmarks files exported from Firefox.
A Firefox bookmarks file doesn't make bookmarks available in a form that's easy to work with.
This tool solves that problem.
"""
import json
import sys
from bs4 import BeautifulSoup
import click
def firefox_link(address, name, attrs):
... |
"""Registering translated models for the ``cmsplugin_blog_seo_addons`` app."""
from simple_translation.translation_pool import translation_pool
from .models import SEOAddon, SEOAddonTranslation
translation_pool.register_translation(SEOAddon, SEOAddonTranslation)
|
#!/usr/bin/env python3
# This file turns the file name that we read into obsidian URL by combining it with the url scheme provided by obsidian
vaultURL = "obsidian://open?vault=Knowledge%20Base&file=52%20-%20Memory%20Base%2F"
def generate(title):
title = encode(title)
title = vaultURL + title
return title
def en... |
from apps.core.errors import ProblemDetailException, ValidationException
from apps.api.response import ErrorResponse, ValidationResponse
class ExceptionMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
return self.get_response... |
################################################################################################################################
# *** Copyright Notice ***
#
# "Price Based Local Power Distribution Management System (Local Power Distribution Manager) v1.0"
# Copyright (c) 2016, The Regents of the University of Califor... |
import hashlib
import os
def read_in_chunks(file_object, chunk_size=1024):
while True:
data = file_object.read(chunk_size)
if not data:
break
yield data
def touch(fname, times=None):
with open(fname, 'a'):
os.utime(fname, times)
def hash_bytestr_iter(bytesiter, ... |
numero = int(input("Por favor, entre com o número de segundos que deseja converter: "))
dias = numero // (3600*24)
numero = numero % (3600*24)
horas = numero // 3600
numero = numero % 3600
minutos = numero // 60
numero = numero % 60
print(dias,"dias,",horas, "horas,",minutos, "minutos e",numero, "segundos.") |
from django.conf.urls import patterns, include, url
from pull.views import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'pull.views.home', name='home'),
# url(r'^pull/', include('pull.foo.url... |
from .seq2seq import RNNSeq2Seq |
import os, cv2
import numpy as np
import tensorflow as tf
from sklearn import preprocessing
class Generator(tf.keras.utils.Sequence):
"""
This is the data generator class that defines the data generator objects that will be used in training and testing the model.
The purpose of the generator is to give the... |
r"""General utilities for Hypothesis."""
import hypothesis
import numpy as np
import torch
def is_iterable(item):
return hasattr(item, "__getitem__")
|
"""This submodule serves the purpose of preparing the frames
for further processing.
"""
import os
from .process import DSLRImage, Color, ImageType, isRaw
from .calibrate import calibrate
import numpy as np
__all__ = ["sort"]
def __listdir(path):
# optimizes the os.listdir function
return [
path ... |
# -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use, line-too-long
"""Tests using pytest_resilient_circuits"""
from __future__ import print_function
import pytest
from fn_cve_search.util.selftest import selftest_function
class TestCVESearch:
opts = {
"fn_cve_search": {
... |
import argparse
import math
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
width = 500
height = 500
viewpoint = []
H = 0
scale = 2
points = []
polygons = []
window: GLint
def center_and_scale_model():
x = [point[0].value for point in points]
y = [point[1].value f... |
import json, subprocess
from ... pyaz_utils import get_cli_name, get_params
def list(period_start_date, period_end_date, account_name=None, profile_name=None):
params = get_params(locals())
command = "az billing invoice list " + params
print(command)
output = subprocess.run(command, shell=True, std... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
-----------------File Info-----------------------
Name: function.py
Description: save code that frequently used
Author: GentleCP
Email: 574881148@qq.com
WebSite: https://www.gentlecp.com
Creat... |
import logging
import os
from dockermake.dockerfile.instructions import Keywords
from dockermake.dockerfile.instructions import InstructionFactory
from dockermake.lint.linter import DockerfileLint
from dockermake.dockerfile.logical_line_extractor import LogicalLineExtractor
class Dockerfile:
def __init__(self):
... |
"""
Escreva um programa que pergunte a quantidade de Km percorridos por um carro alugado
e a quantidade de dias pelos quais ele foi alugado. Calcule o preço a pagar,
sabendo que o carro custa R$ 60 por dia e R$ 0,15 por Km rodado.
"""
# entrada de dados
km_percorrido = float(input('Digite a quantidade de quilometros... |
import os
import socket
from aiohttp import AsyncResolver, ClientSession, TCPConnector
from datetime import datetime
from discord.ext import commands
# All the cogs that are to be loaded on launch
cogs = ['bot.cogs.base',]
class DTSBot(commands.Bot):
def __init__(self):
super().__init__(command_prefix=... |
# -*- coding: utf-8 -*-
import time
import numpy as np
from PyQt4 import QtGui, QtCore
from ..Stage import Stage, MoveFuture, StageInterface
from acq4.drivers.Scientifica import Scientifica as ScientificaDriver
from acq4.util.Mutex import Mutex
from acq4.util.Thread import Thread
from acq4.pyqtgraph import debug, ptime... |
# import gi
import os
import csv
# gi.require_version('Gtk', '3.0')
# from gi.repository import Gtk, Gdk
# from gi.repository import GdkPixbuf
import tkinter as tk
from tkinter import filedialog, StringVar
from PIL import Image, ImageTk
class SingleView(tk.Frame):
def __init__(self, master=None):
if not ... |
"""
This code is taken from PyPi stream_service package
https://github.com/BR1py/stream_service
"""
from __future__ import absolute_import
from .helpers import *
from . import frame
from . import rpc
from . import buffer
|
"""
Conditionals 2.
We extend the language of conditionals from the previous
example by adding the keyword "else". This allows conditionals
to ask two or more sequential questions, each with a different
action.
"""
size(640, 360)
background(0)
for i in range(2, width - 2, 2):
# If 'i' divides by 20 with no r... |
#!/usr/bin/env python
from distutils.core import setup
# setup options
setup(
name='core',
author='Zach Panzarino',
version='1.0.0',
platforms='ANY',
packages=['core'],
) |
import os.path as osp
import numpy as np
from shutil import copyfile
from typing import Optional
import time
import json
import logging
import torch
from omegaconf import DictConfig, OmegaConf
from hydra.utils import instantiate
import torch.nn.functional as F
from terminaltables.ascii_table import AsciiTable
import wa... |
import struct
import time
from ntlm_auth.compute_response import ComputeResponse, get_windows_timestamp
from ntlm_auth.constants import AvId, AvFlags
from ntlm_auth.messages import ChallengeMessage, TargetInfo
class TestGeneric(object):
def test_get_timestamp_format(self):
actual1 = struct.unpack("<q", ... |
from btc import BTCDaemon
class LTCDaemon(BTCDaemon):
name = "LTC"
DEFAULT_PORT = 5001
def load_electrum(self):
import electrum_ltc
self.electrum = electrum_ltc
if __name__ == "__main__":
daemon = LTCDaemon()
daemon.start()
|
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
# Read in and grayscale the image
image = mpimg.imread('exit-ramp.jpg')
plt.imshow(image)
plt.show()
gray = cv2.cvtColor(image,cv2.COLOR_RGB2GRAY)
plt.imshow(gray)
plt.show()
# Define a kernel size and appl... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__all__ = [
'csl',
]
def csl(l):
return ', '.join(str(x) for x in l)
|
#!/usr/bin/env python
import sys
import json
import os
import argparse
import textwrap
import csv
import inspect
def ontology_lookup(name, table):
# takes in accession number outputs the name
filename = inspect.getframeinfo(inspect.currentframe()).filename
path = os.path.dirname(os.path.abspath(filename)... |
# coding=utf-8
# Copyright 2019 The SEED 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 agre... |
import json
import logging
import fiona
from pywps import LiteralInput, ComplexInput, ComplexOutput
from pywps import Process, FORMATS
from rasterio.crs import CRS
from shapely.geometry import shape
from raven.utils import archive_sniffer, crs_sniffer, single_file_check
from raven.utils import geom_transform, geom_pr... |
from keyfunctions import create_key
from keyfunctions import create_element_rand
import keyfunctions.globals as consts
import random
import unittest
import struct
class CoreTestSuite(unittest.TestCase):
"""Testing of core functions."""
def test_createKey(self):
key = create_key([0.2, 0.001, 0.223], 1... |
#!/usr/bin/env python
#
# Modules Import
#
import argparse
import boto3
import json
import os
import requests
import sys
import time
from operator import itemgetter
#
# Variables Definition
#
instance_id_metadata_url = 'http://169.254.169.254/latest/meta-data/instance-id'
#
# Function to parse the input arguments an... |
from .models import Session
from .utils import Utilities
from mongoengine import DoesNotExist
def check_args(required_args: list[str], optional_args: list[str], types: dict[str, tuple[type]]):
def decorator(func):
def wrapper(*_, **args):
for arg in required_args:
if arg not in ... |
# encoding = utf-8
import datetime
import json
import os
import re
import requests
import sys
import time
class Config:
supported_minimum_version: str = "4.4.0"
retry_standoff: list = [0, 5, 10, 15, 30, 60]
request_timeout: int = 900
class API:
def __init__(self, url, api_key, api_secret, verify=Fal... |
#!/usr/bin/env python3
import amino
import os
import getpass
os.system('clear')
print( '\033[1;31m /$$ /$$ ')
print( '\033[1;31m | $$ | $$ ')
print( '\033[1;31m /$$$$$$$| $$$$$$$ /$$$$$$ /$$$$$$$| $$ /$$')
print( '\033[1;31m /$$_____... |
# coding=utf-8
'''
全局数据。包括配置的读取和验证。
对于缺少的配置赋予默认值并暂停警告。
'''
import os.path as spath
import shutil
import logging
from . import mylogging
from sine.utils import EventManager
from .__meta__ import VERSION as version
clocks = []
data = {}
config = {}
timeFormats = []
dateFormats = []
eManager = EventManager(mylogging.get... |
import re
from time import sleep
from wireless.wireless import WirelessDriver, cmd
class WPASupplicantWireless(WirelessDriver):
_file = "/tmp/wpa_supplicant.conf"
_interface = None
# init
def __init__(self, interface=None):
self.interface(interface)
# connect to a network
def connec... |
# Copyright 2018 Robert Adams
#
# 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,... |
"""Utility functions for generating protobuf code."""
_PROTO_EXTENSION = ".proto"
def well_known_proto_libs():
return [
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:api_proto",
"@com_google_protobuf//:compiler_plugin_proto",
"@com_google_protobuf//:descriptor_proto",... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Basic bot framework forked from Andrés Ignacio Torres <andresitorresm@gmail.com>,
all other files by Al Matty <al@almatty.com>.
"""
import time, os
import random
import logging
from telegram.ext import CommandHandler, Filters, MessageHandler, Updater
class MerchBot:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.