content stringlengths 5 1.05M |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
modify dns settings for hosting.de with rest api
https://github.com/lemo/hosting.de_update.py
"""
__author__ = "Alexander Goltz"
__copyright__ = "Copyright 2019"
__credits__ = ["Alexander Goltz"]
__license__ = "MIT"
__status__ = 'Prototype'
import sys
import s... |
# -*- coding: utf-8 -*-
# This work is licensed under the MIT License.
# To view a copy of this license, visit https://opensource.org/licenses/MIT
# Written by Abdullah Diab (mpcabd)
# Email: mpcabd@gmail.com
# Website: http://mpcabd.xyz
from __future__ import unicode_literals
import os
from configparser import Co... |
from setuptools import setup
from setuptools import find_packages
VERSION = "0.0.1.dev0"
INSTALL_REQUIRES = [
"zope.interface==4.6.0",
"certbot",
"aliyun-python-sdk-alidns",
"aliyun-python-sdk-core-v3"
]
setup(
name="certbot-dns-aliyun",
version=VERSION,
description="Aliyun DNS Authentica... |
# Copyright (C) 2018 Shriram Bhat
#
# 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,... |
from .window import Window # noqa: F401
|
import requests
import time
import re
class GetInformation:
def __init__(self, ip, port):
self.ip = ip
self.port = port
def get_switch_id(self):
url = 'http://' + self.ip + ':' + self.port + '/stats/switches'
re_switch_id = requests.get(url=url).json()
switch_id_hex = ... |
"""
MIT License
Copyright (c) 2019-2020 mathsman5133
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, publ... |
import graphene
from ...site import AuthenticationBackends
from ..core.utils import str_to_enum
AuthorizationKeyType = graphene.Enum(
"AuthorizationKeyType",
[
(str_to_enum(auth_type[0]), auth_type[0])
for auth_type in AuthenticationBackends.BACKENDS
],
)
testType = graphene.Enum(
'te... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth import get_user_model
User = get_user_model()
class MyUserAdmin(UserAdmin):
list_filter = ('email', 'first_name',)
admin.site.unregister(User)
admin.site.register(User, MyUserAdmin)
|
import tensorflow as tf
import numpy as np
def compute_euclidean_distance(x, y):
"""
Computes the euclidean distance between two tensorflow variables
"""
d = tf.square(x-y)
d = tf.sqrt(tf.reduce_sum(d, axis=1)+1e-8) # What about the axis ???
return d
def compute_triplet_loss(anchor_feature, ... |
VERSION = (
0,
20,
0,
)
__version__ = ".".join(map(str, VERSION))
|
import re
import logging
class Invoice:
def __init__(self, structured_text):
self.structured_text = structured_text
self.customer_name: str = 'Not Found' # default value in case parsing fails
self.customer_address: str = 'Not Found'
self.loan_balance: dict = {'key': 'Not found', '... |
"""
Generic tools for representing object differences in an easy to apply way.
Diffs will be stored in the format:
[key, action, param]
key should be a complete dotted path to a given property, e.g.:
- last_name
- other_identifiers.2
- ids.twitter
action should be one of:
- set: obj[key] = param
... |
# Copyright 2019-2020 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 or agreed to in writin... |
from PyQt5.QtCore import Qt,pyqtSignal
from PyQt5.QtWidgets import QMainWindow,QLabel,QVBoxLayout,QWidget,QHBoxLayout,QPushButton,QFrame,QApplication,QDesktopWidget
from PyQt5.QtGui import QImage,QPixmap,QIcon
from numpy import where,uint8,int16,float32
from SimpleITK import GetImageFromArray
from copy import deepcopy
... |
import logging
def enableCache():
import requests_cache
requests_cache.install_cache()
def enableLogger():
try:
import http.client as http_client
except ImportError:
# Python 2
import httplib as http_client
http_client.HTTPConnection.debuglevel = 1
# You must initial... |
import nltk
import random
from . import wordlogic
grammatical_exclusions = ['RB', 'VBP', 'VBZ', 'IN', ',', '.', '?', '!']
def translate(sentence, temperature):
tagged = nltk.pos_tag(nltk.word_tokenize(sentence))
words = [item for item in tagged if item[0] != 'I' and item[1] not in grammatical_exclusions]
... |
import numpy as np
from matplotlib import pyplot as plt
import scipy.stats as st
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
from particles import resampling as rs
from niscv.basic.kde import KDE
class KDE2:
def __init__(self, centers, weights, bw, mode=1, factor='scott', l... |
#emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### ### ### ### #... |
"""Fuzzy finder for AWS Shell.
This is a fuzzy finder used for the autocompleter
that I've tried to optimize for the AWS CLI set
of commands.
There doesn't seem to be a generic algorithm that
does exactly what I want. Changing any of these
heuristics so far means that you have to give up
some other component of the ... |
import os
from tictactoe.kivy.tic_tac_toe_game_controller import TicTacToeGameController
def run():
"""Run the kivy App."""
image_path = os.path.abspath("images")
controller = TicTacToeGameController(image_path)
controller.run()
|
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from pony.orm import db_session
import pytest
from acid.tests import DatabaseTestCase
from ..exceptions import PageOutOfRange
from ..service import BuildSetsPaginated
from ..model import ZuulBuildSet
from ..model import ZuulBuild
@pytest.mark.unit
@... |
from .print_err import print_err
__all__ = [print_err]
|
# Features:
# 62 features - 26 MFCCs (mean) and 26 MFCCs (standard deviation), 7 spectral contrast (mean), 2 poly features (mean), and 1 RMS (mean).
#
#*************************************************************************************
import pandas as pd
import math
import time
import numpy as np
import matplotlib.... |
"""
test_wasm
~~~~~~~~~
This module implements tests for the WebAssembly module binary format.
"""
import io
import os
import leb128
import pytest
from anytree import RenderTree, find
from binalyzer import Binalyzer, ValueProperty, AutoSizeValueProperty
@pytest.fixture
def binalyzer():
return Binaly... |
from rope.base.oi.type_hinting.resolvers import interfaces
class Resolver(interfaces.IResolver):
def __init__(self, *delegates):
"""
:type delegates: list[rope.base.oi.type_hinting.resolvers.interfaces.IResolver]
"""
self._delegates = delegates
def __call__(self, hint, pyobjec... |
"""Unit test package for ebm_onnx."""
|
# -*- coding: utf-8 -*-
import pytest
@pytest.fixture
def arg2(request):
pytest.raises(Exception, request.getfixturevalue, "arg1")
|
import datetime
from django import forms
from django.forms import ModelForm
from applications.visitor_hostel.models import *
from .models import Inventory
#class booking_request(forms.Form):
CHOICES = (('A', 'A',), ('B', 'B',), ('C', 'C',), ('D', 'D',))
class ViewBooking(forms.Form):
date_from = forms.DateField(i... |
from .wsgi import make_app
app = make_app()
|
import os
from pythonrouge.pythonrouge import Pythonrouge
data_dir = ".." + os.path.sep + "project-data"
for entry in os.scandir(data_dir):
if not entry.is_dir():
continue
sum_dir = entry.path + os.path.sep + "sum"
print("\nEvaluating summaries in directory:", sum_dir)
summary_filenames = lis... |
# Copyright (c) 2012 Stellenbosch University, 2012
# This source code is released under the Academic Free License 3.0
# See https://github.com/gvrooyen/SocialLearning/blob/master/LICENSE for the full text of the license.
# Author: G-J van Rooyen <gvrooyen@sun.ac.za>
"""
The paramest.Hat class provides algorithms to es... |
# Written by David Harrison
from BTL.platform import bttime as time
from BTL.rand_tools import iter_rand_pos
import logging
logger = logging.getLogger( "DownloadRateLimiter" )
log = logger.debug
from twisted.internet import task
class ThrottleListener(object):
def throttle_connections(self):
pass
def ... |
#
# 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... |
from random import randint, uniform
def gen_data(myfunc,n):
R=[]
for i in range(n):
RR=[]
t = i+uniform(-0.2,0.2)
RR.append(t)
RR.append(myfunc(t)*uniform(0.8,1.2))
R.append(RR)
return R
from my_or_tools import ObjVal, SolVal, newSolver
def solve_model(D,deg=1,obje... |
import keras
import numpy as np
(X_train_full, y_train_full), (X_test, y_test) = keras.datasets.fashion_mnist.load_data()
X_train_full = X_train_full / 255.0
X_test = X_test / 255.0
X_valid, X_train = X_train_full[:5000], X_train_full[5000:]
y_valid, y_train = y_train_full[:5000], y_train_full[5000:]
pixel_means = X_... |
from antlr4 import CommonTokenStream
from antlr4.error.ErrorListener import ErrorListener
from antlr4.error.Errors import InputMismatchException
from antlr4.Token import CommonToken
from chcli.grammar.ClickHouseLexer import ClickHouseLexer
from chcli.grammar.ClickHouseParser import ClickHouseParser, InputStream
clas... |
from mock import patch
import statsdecor
from statsdecor.context import StatsContext
class _DerivedContext(StatsContext):
def __init__(self):
super(_DerivedContext, self).__init__('test.hello')
self.add_tag('always', 'yup')
def exit_hook(self, a, b, c):
self.add_tag('exit', 'yup')
... |
""" SCC.py: contains the definition of the SpatialCluster object that performs the
Hebert & Macaire algorithm """
import numpy as np
from sklearn.cluster import KMeans
class SpatialColorClassifier(object):
"""
A class to perform the spatial-color pixel clustering algorithm of
https://ieeexplore.ieee.o... |
import requests
from bs4 import BeautifulSoup
import os
proxies = []
page = requests.get('https://free-proxy-list.net/')
soup = BeautifulSoup(page.text, 'html.parser')
table = soup.find('table', attrs={'id':'proxylisttable'})
body = table.find('tbody')
for row in body.find_all('tr'):
cols = row.find_all('td')[:... |
import struct
import datetime
from .package_version import PackageVersion
class PackageFileHeader:
def __init__(self):
# Magic Number - Should always = 'DBPF' in .package files
self.mnFileIdentifier = None
self.mnFileVersion = None
self.mnUserVersion = PackageVersion(major=0, minor=... |
###########################
#
# #394 Eating pie - Project Euler
# https://projecteuler.net/problem=394
#
# Code by Kevin Marciniak
#
###########################
|
# -*- coding: utf-8 -*-
# (C) Copyright 2014 Voyager Search
#
# 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 l... |
# Licensed under a 3-clause BSD style license - see LICENSE
'''
Provides the framework for simulating brightness distributions of galaxies
in any chosen filterset by parameterised double Schechter functions.
'''
import numpy as np
from astropy.modeling.models import Linear1D, Exponential1D
from astropy.cosmology impor... |
'''
签到系统配置文件
'''
# 每日运势最小值
LUCKY_MIN = 1
# 每日运势最大值
LUCKY_MAX = 100
# 每次签到获得的好感度
FRIENDLY_ADD = 1
# 每次签到金币底薪
GOLD_BASE = 10
# 幸运值影响金币因子
LUCKY_GOLD = 1
# 签到随机语录
RANDOM_SAID = [
'在好几个瞬间,都觉得自己很落单。',
'我好花心,你每天的样子我都好喜欢。',
'有些异性不能拿来做恋人,却也舍不得给别人。',
'麻烦自己活的酷一点,对自己好一点。',
'一路走来,我用我的善良,喂了不少没有良心的狗!',
... |
# Generated by Django 3.2.8 on 2021-11-11 16:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_news'),
]
operations = [
migrations.RemoveField(
model_name='news',
name='image',
),
]
|
from django.contrib import admin
# Register your models here.
from ems_auth.models import User, SolitonUser
admin.site.register(User)
admin.site.register(SolitonUser)
|
from remote_safe_client.files.file_base import FileBase
from remote_safe_client.files.file_type import FileType
class File(FileBase):
def get_dict(self) -> dict:
return {"name": self.name, "type": FileType.FILE}
|
import json
import tempfile
from ._base_subcommand import BaseSubcommand
class Subcommand(BaseSubcommand):
def add_arguments(self, parser):
parser.add_argument(
'--job_dict',
help="JSON string for a job dict",
required=True, type=json.loads
)
parser.ad... |
# find all pairs of elements that produce a given sum
def get_char_count_map(char_list):
char_count_map = dict()
for char in char_list:
lowercased_char = char
if isinstance(char,str):
lowercased_char = char.lower()
if lowercased_char in char_count_map:
... |
"""Migration for the Submitty master database."""
def up(config, database):
"""
Run up migration.
:param config: Object holding configuration details about Submitty
:type config: migrator.config.Config
:param database: Object for interacting with given database for environment
:type database:... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: houzhiwei
# time: 2019/5/17 20:14
from gensim.summarization import keywords
test = "Creates an indicator grid (1,0) of upward curved grid cells according to the Peuker and Douglas algorithm.\
With this tool, the DEM is first smoothed by a kernel with weights at... |
# coding=utf-8
from django.contrib.auth.models import User
from django.test import TestCase
from pagelink.models import PageLink
from pagelink.tests.fixtures import create_default_links_and_users
class TestLinkManager(TestCase):
@classmethod
def setUpTestData(cls):
cls = create_default_links_and_use... |
import collections
import os
from typing import Tuple, Dict, Union
import torch
import torch.nn.functional as F
from pytorch_toolbelt.datasets import INPUT_IMAGE_KEY
from torch import nn
__all__ = ["get_geopose_model", "model_from_checkpoint", "wrap_model_with_tta"]
from geopose import INPUT_GROUND_SAMPLE_DISTANCE, ... |
import subprocess
import sys
import os
def install(package, file_link=None, r=False, e=False):
if file_link:
output = subprocess.run(
[sys.executable, "-m", "pip", "install", package, "-f", file_link],
capture_output=True,
)
elif r:
output = subprocess.run(
... |
from typing import Tuple, Sequence
from .. import (ServerMechanism, ClientMechanism, ServerChallenge,
ChallengeResponse, UnexpectedChallenge)
from ..creds import AuthenticationCredentials
__all__ = ['LoginMechanism']
class LoginMechanism(ServerMechanism, ClientMechanism):
"""Implements the LOGI... |
data["z"] = [ 3.52941176, 3.59477124, 3.66013072, 3.7254902 , 3.79084967,
3.85620915, 3.92156863, 3.9869281 , 4.05228758, 4.11764706,
4.18300654, 4.24836601, 4.31372549, 4.37908497, 4.44444444,
4.50980392, 4.5751634 , 4.64052288, 4.70588235, 4.77124183,
4.83660131, 4.901... |
import os
from logging import getLogger
import click
import toml
from clinicadl.utils import cli_param
from clinicadl.utils.caps_dataset.data import CapsDataset
@click.command(name="train", no_args_is_help=True)
@click.argument(
"network_task",
type=click.Choice(["classification", "regression", "reconstruct... |
#!/usr/bin/python
#Import required python libraries
import os
import sys
import time
import pipes
import shutil
import pymongo
import paramiko
#Import required custom python libraries
import dbtools
import sshtools
import functionstools
"""
FUNCIONES GLOBALES ESTABLECIDAS COMO MODULOS
PARA CREAR EL TEST DE CONECCIÓ... |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.... |
import click
from schedule import command as client_command
@click.group()
@click.pass_context
def cli(ctx):
pass
cli.add_command(client_command.all)
|
from .common import StaticTestBase
class LintTests(StaticTestBase):
def test_lint(self) -> None:
code = """
def f():
x: int = 'abc'
b: str = 42
"""
errors = self.lint(code)
errors.check(
errors.match("str cannot be assigned to... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import logging
from ._utils import default_output
logger = logging.getLogger()
def reverse(filename, output=None, *, engine='pdftk'):
"""
reverse a PDF
:param filename: PDF filepath
:param output: PDF output
"""
if output is N... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import sys
from typing import Any, List, Optional
from antlr4.error.Errors import LexerNoViableAltException, RecognitionException
from hydra._internal.grammar import grammar_functions
from hydra._internal.grammar.functions import Functions
from hy... |
#!/usr/bin/python
import pandas as pd
data = [['Alex', 10], ['Ronald', 18], ['Jane', 33]]
df = pd.DataFrame(data, columns=['Name', 'Age'])
df.to_csv("users.csv", index=False)
|
v = [3,2,1]
v.sort()
print v[0]
|
from .__version__ import __version__
from .appbundler import AppBundler
from .appbundler import Config
from .appbundler import SupplementalData
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(Profile)
admin.site.register(Recipe)
admin.site.register(Ingredient)
admin.site.register(IngredientInRecipe)
admin.site.register(Category)
admin.site... |
#!/usr/bin/env python
"""
EODataDown - provide the main class where the functionality of EODataDown is accessed.
"""
# This file is part of 'EODataDown'
# A tool for automating Earth Observation Data Downloading.
#
# Copyright 2018 Pete Bunting
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you m... |
"""
Basic Operation example using TensorFlow Library
"""
import tensorflow as tf
def constant_operation():
pass
# Basic constant operations
# The value returned by the constructor represents the output of the constant op.
a = tf.constant(2)
b = tf.constant(3)
with tf.Session() as sess:
... |
from typing import Optional
import uuid
from google.cloud.storage import Blob
from google.cloud.storage.blob import Blob
from testconfig import TEST_ARG
from csfutils import (
add_access_token,
delete_access_token,
get_access_token,
init_storage,
upload_from_filename_for_firebase,
)
class TestAc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""main.py: Main module."""
from kivy.base import runTouchApp
from kivy.uix.relativelayout import RelativeLayout
from dpad import Dpad
from buttonpad import ButtonPad
from gameobject import GameObject
__author__ = "Victor RENÉ"
__copyright__ = "Copyright 2014, Kivy wid... |
# -*- coding: utf-8 -*-
__author__ = "Sören Gebbert"
__copyright__ = "Copyright 2018, Sören Gebbert, mundialis"
__maintainer__ = "Soeren Gebbert"
__email__ = "soerengebbert@googlemail.com"
GET_DATA_1 = {
"title": "Get a raster layer",
"description": "This process is the source for a raster layer",
"proces... |
import komand
from .schema import ShowAccessRulebaseInput, ShowAccessRulebaseOutput, Input, Output, Component
# Custom imports below
import requests
from komand.exceptions import PluginException
class ShowAccessRulebase(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
... |
def FordFulkerson(graph,start,end):
n = len(graph)
GPrime = [[None]*n for _ in range(n)]
for v in range(n):
for u, w in graph[v]:
GPrime[v][u] = w
for v in range(n):
for u in range(n):
if GPrime[v][u] != None and GPrime[u][v] == None:
GPrime[u][v] ... |
# Copyright 2021 BlobCity, 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 agreed to in writing,... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-03-28 21:53
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mathswizard', ... |
from datetime import datetime
from django.shortcuts import render_to_response
from newspaper.news.models import News
def news_list(request):
news = News.objects.filter(
publish_date__lte=datetime.now()).order_by('publish_date')
return render_to_response("news/news_list.html",
... |
def test_get_collection_exercise_events_page(client, requests_mock):
requests_mock.get('/collectionexercises/123', json={})
requests_mock.get('/surveys/BRES', json={})
response = client.get('/survey/BRES/collection/123/event')
assert response.status_code == 200
def test_create_collection_exercise_ev... |
# Copyright (c) 2016 Cisco Systems
# 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 require... |
import importlib
from abc import ABC, abstractmethod
from datetime import date
from django.conf import settings
class BaseCrptoEngine(ABC):
@abstractmethod
def get_current_price(self):
raise NotImplementedError('Function need to implemented by derived class')
@abstractmethod
def get_historic... |
from ..utils import TranspileTestCase
class ScopeTests(TranspileTestCase):
def test_simple(self):
# This test will run both in global scope, and in a
# function.
self.assertCodeExecution("""
x = 1
print('x =', x)
print('Done.')
""")
def ... |
"""Top-level package for skippa.
The pipeline module defines the main Skippa methods
The transformers subpackage contains various transformers used in the pipeline.
"""
__author__ = """Robert van Straalen"""
__email__ = 'tech@datasciencelab.nl'
from .pipeline import Skippa, SkippaPipeline, columns
|
from torch import nn
from pytorch_pretrained import BertModel
class Ernie(nn.Module):
def __init__(self, config):
super(Ernie, self).__init__()
self.ernie = BertModel.from_pretrained('pretrained/ernie')
for param in self.ernie.parameters():
param.requires_grad = True
... |
from paktrack.common.base_model import BaseModel
SHOCK_COLLECTION = "shock"
class Shock(BaseModel):
def __init__(self, db_host, db_port, db, db_user="", db_pass=""):
super(Shock, self).__init__(
db_host, db_port, db, db_user, db_pass, SHOCK_COLLECTION)
|
# coding: utf-8
"""
Ory Kratos
Welcome to the ORY Kratos HTTP API documentation! # noqa: E501
The version of the OpenAPI document: v0.4.6-alpha.1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from ory_kratos_client.configuration import Configur... |
from dataclasses import dataclass
from enum import Enum
from typing import List, Optional, Dict
import textwrap
from fastclasses_json.api import dataclass_json
from fastclasses_json import core
# These tests are only keeping an eye on the innards. It's fine for them
# to break and need to be rewritten or deleted.
... |
from flask_restplus import fields
from pengrixio.api.restplus import api
appSerializer = api.model('Apps', {
'name': fields.String(required=True, description='app name'),
'uid': fields.String(required=True, description='app uuid'),
'catalog': fields.String(required=True, description='app from catalog'),
... |
"""
Paser output from terraform and generate necessary cluster definition files to track public and
private IP addresses. This file will generate the file "infrastructure_provisioning.out.yml"
"""
import logging
import sys
from six.moves import range
LOG = logging.getLogger(__name__)
class TerraformOutputParser: ... |
"""
To run:
python example-IO.py
If you've been using virtual environments, you may get: No module named 'requests' No module named 'pandas'
If so, install requests and pandas in a virtual environment using these four lines:
python3 -m venv .venv
source .venv/bin/activate
pip3 install requests
pip3 install pandas
"... |
#!/usr/bin/env python3
import os
import yaml
import requests
import logging
import pprint
logging.basicConfig(level=logging.INFO)
pp = pprint.PrettyPrinter(indent=4)
DEFAULT_SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
DEFAULT_CONFIG_FILE = "%s/config.yaml" % DEFAULT_SCRIPT_DIR
DEFAULT_API_ENDPOINT = "cl... |
import os
import logging
class StorageClient(object):
def __init__(self, account):
self.service = account.create_file_service()
def create_share(self, name):
self.service.create_share(name)
def create_directory(self, share_name, name):
self.service.create_directory(share_name, n... |
class Solution:
def search(self, nums, target):
if len(nums) <= 1:
if len(nums) == 1:
return 0 if nums[0] == target else -1
return -1
# 寻找旋转位置,返回转折点结束的位置
for i in range(len(nums) - 1):
if nums[i] > nums[i+1]:
break
i... |
import os, random, discord, ffmpeg, textwrap, json, googleapiclient.discovery, requests, pytesseract, nltk, re, \
asyncio, math, io, traceback, time
from discord.ext import tasks
from PIL import Image, ImageDraw, ImageFont
from urllib.parse import parse_qs, urlparse
from datetime import datetime, timedelta
from dateut... |
from .custom_op import AddJitterOp, AddJitterOpProp
class SliceException(Exception):
pass
|
#** Computing the complexity related statistic (the size of the compressed image), and appending it to the statistics data file
# (Requires that the FLIF image compressor is installed on the system)
import os
import torch
import pickle
import torchvision.utils as utils
import argparse
#bias that must be added to ima... |
### Start of importing dependecies
import cv2 as cv
import numpy as np
import mediapipe as mp
import time
from kivymd.app import MDApp
from kivymd.uix.button import MDRaisedButton
from kivy.uix.image import Image
from kivymd.uix.label import MDLabel
from kivy.clock import Clock
from kivymd.uix.boxlayout impor... |
# Generated by Django 2.1.2 on 2018-10-23 11:31
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('openbook_follows', '0002_auto_20181023_1255'),
]
operations = [
migrations... |
#!/usr/bin/env python
import webapp2
import urllib
import urllib2
from google.appengine.api import memcache
import json
PRIVACY_HTML = ('<!DOCTYPE html><html><head><title>acd_cli_oa privacy info</title></head>'
'This app does not save any personal data. You may view <a href="./src">the source code</a>... |
# These statements import python modules that will be used below...
import glob
import os
import string
from pyraf import iraf
from shutil import copyfile
# Load necessary IRAF (pyraf) modules...
iraf.stsdas()
iraf.hst_calib()
iraf.synph
# cd to current working directory
iraf.cd(os.getcwd())
# This creates a list of... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.