text stringlengths 2 999k |
|---|
"""
Scope = The region that a variable is recognized;
A variable is only available from inside the region it is created;
A global and locally scoped versions of a variable can be created
"""
name = "Trevi" # global scope (available inside & outside functions)
print(f"Global Scope: {name}")
def display... |
#!/usr/bin/env python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the follo... |
# Adam Vilmin
# Illinois State Geological Survey, University of Illinois
# 2015-05-31
from distutils.core import setup
import py2exe
setup(
options = {'py2exe': {'bundle_files': 1}},
zipfile = None,
console = [
{
"script": "main.py",
"icon_resources": [(0, "icon.ico")]
... |
# coding: utf-8
"""
学堂在线公开课爬虫
需要:
1.浏览器访问xuetangx.com, 登录后复制Cookie填写到代码中
2.进入课程页面(如: http://www.xuetangx.com/courses/course-v1:TsinghuaX+10421094X_2015_2+sp/courseware/76976b23e6b24131a5fc9b5e3426e573/b45d1e9e41e14ff89721ede4c3547978/',
保存html源码为'xuetangx.html'用于解析
"""
import os
import re
from cont... |
from flask import Blueprint
bp = Blueprint('api', __name__)
# 写在最后是为了防止循环导入,ping.py文件也会导入 bp
from app.api import ping, tokens, errors, users, posts, comments, notifications, messages
|
"""
Adding __str__() to models
Although it's not a strict requirement, each model should have a ``_str__()``
method to return a "human-readable" representation of the object. Do this not
only for your own sanity when dealing with the interactive prompt, but also
because objects' representations are used througho... |
from PyQt5.QtCore import QFileInfo
class File:
@staticmethod
def get_file_names(file_paths):
file_names = []
iteration_length = range(len(file_paths))
for file_path in iteration_length:
file_info = QFileInfo(file_paths[file_path])
file_names.append(file_info.fi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Найти сумму целых положительных чисел, больших 20, меньших 100 и кратных 3.
if __name__ == '__main__':
Sum = 0
i = 21
while 20 < i < 100:
if i % 3 == 0:
Sum += i
else:
Sum += 0
i += 1
print("... |
import aiohttp
import datetime
from utils.metrics import created_feedbacks, count_feedbacks
async def createFeedback(request):
try:
body = await request.json()
response = request.app["tarantool"].call("postForm", body.get("type"), body.get("firstname", None), body.get("lastname", None), body.get("number", None), ... |
# vim:ts=4:sw=4:et:
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# no unicode literals
import pywatchman
import WatchmanTestCase
@WatchmanTestCase.expand_matrix
class TestLog(Watchma... |
"""
Compile a very strict subset of Python (in which the only types are floats)
to WASM.
"""
import ast
import inspect
import types
from ...common import SourceLocation, CompilerError
from ...wasm import Module, Func
def syntax_error(filename, node, message):
""" Raise a nice error message as feedback """
l... |
import uuid
import time
from lib import log_info
def _job_id():
return str(uuid.uuid4())
def is_partitioned(table):
if table.partitioning_type == 'DAY': return True
else: return False
def is_daily(table):
if 'timestamp' in [c.name for c in table.schema]: return True
else: False
def has_sche... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sgnb_addition_request.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from googl... |
input_data = input()
input_list = [int(x) for x in input_data]
matrix = [[(x * y) for x in range(input_list[1])] for y in range(input_list[0])]
print(matrix)
|
# -*-coding:utf-8-*-
from setuptools import setup
setup(
name='rocketchat_API',
version='0.6.11',
packages=['rocketchat_API', 'rocketchat_API.APIExceptions'],
url='https://github.com/jadolg/rocketchat_API',
license='MIT',
author='Jorge Alberto Díaz Orozco',
author_email='diazorozcoj@gmail.... |
# The db object is used as a singleton throughout the application
db = None
def init_db(db):
"""Import the Models and create the database tables."""
from cred.models.apikey import APIKey
from cred.models.client import Client
from cred.models.event import Event
from cred.models.subscribe import Sub... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
import sys
from setuptools import setup, find_packages
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.md') as history_file:
history = history_file.read()
requirements = [
'future>=0.16.0',
'... |
import json
from datetime import timedelta, datetime
from peewee import JOIN
from active_migration import ActiveDataMigration, ERTMigrationFlags
from data.database import (BuildTriggerService, RepositoryBuildTrigger, Repository, Namespace, User,
RepositoryBuild, BUILD_PHASE, db_random_func... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 1 09:46:24 2020
@author: Lobel001
"""
# Adapted from plot_Ts_Vs_2004_allsizes.py but only for particles released in N Pacific and run for 3 yrs
import matplotlib.pyplot as plt
from netCDF4 import Dataset
import numpy as np
import cartopy
from ma... |
from __future__ import unicode_literals
import datetime
import boto
import boto3
from boto.redshift.exceptions import (
ClusterNotFound,
ClusterParameterGroupNotFound,
ClusterSecurityGroupNotFound,
ClusterSubnetGroupNotFound,
InvalidSubnet
)
from botocore.exceptions import (
ClientError
)
impo... |
######### PHYSICAL UNIT NAMES #####################
#------------------------------------ Dan Goodman -
# These are optional shorthand unit names which in
# most circumstances shouldn't clash with local names
"""Optional short unit names
This module defines the following short unit names:
mV, mA, uA (micro_amp), nA,... |
import torch
from math import sqrt
from functools import reduce
from torch.optim.sgd import SGD
import logging
log = logging.getLogger(__name__)
# from https://github.com/scipy/scipy/blob/master/scipy/optimize/linesearch.py
def _scalar_search_armijo(phi, phi0, derphi0, args=(), c1=1e-4, alpha0=1, amin=1.0e-8):
"""... |
"""
DESAFIO 088: Palpites Para a Mega Sena
Faça um programa que ajude um jogador da MEGA SENA a criar palpites. O programa vai perguntar quantos jogos
serão gerados e vai sortear 6 números entre 1 e 60 para cada jogo, cadastrando tudo em uma lista composta.
"""
from random import randint
from time import sleep
sortei... |
"""Utils."""
import numpy as np
def bin_to_dec(array):
"""Convert binary vector to decimal."""
return sum((array > 0) * 2 ** np.arange(len(array)))
def _format_number(num):
return '"0"' if num == 0 else f'"{str(num)}"'
def volumes_to_string(volumes):
"""Convert volumes vector to string."""
if... |
import csv
import logging
from typing import *
class Metadata:
def __init__(self, keys: List, values: List, types: Iterable) -> None:
self.types = dict(zip(keys, types))
self.dict = dict(zip(keys, values))
for ix in range(len(keys)):
setattr(self, keys[ix], values[ix])
class ... |
import os
import numpy as np
import pytest
import matplotlib as mpl
mpl.use("Agg")
from mikeio import Dfsu, Mesh
##################################################
# these tests will not run if matplotlib is not installed
##################################################
pytest.importorskip("matplotlib")
def test_... |
import transaction
from websauna.system.user.models import User
from websauna.tests.utils import create_logged_in_user
from websauna.utils.slug import uuid_to_slug
GROUP_NAME = "Sample Group"
def get_user(dbsession):
return dbsession.query(User).first()
def test_add_group(web_server, browser, dbsession, init)... |
import requests
import json
milvus_dev = "https://registry.hub.docker.com/v2/repositories/milvusdb/milvus-dev/tags?ordering=last_updated"
milvus = "https://registry.hub.docker.com/v2/repositories/milvusdb/milvus/tags?ordering=last_updated"
def get_tag(url):
payload = {}
headers = {}
response = requests.... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 24 00:32:05 2021
@author: Q35joih4334
"""
import textacy.datasets
import itertools
from text_tree import text_tree
# Examples
texts = ['Sentence one starts with the same word as sentence two. Sentence two continues a bit differently. Sentence two is also shorter. Last... |
# -*- coding:utf-8 -*-
__author__ = 'Randolph'
import os
import sys
import time
import logging
import numpy as np
import tensorflow as tf
from tensorboard.plugins import projector
from text_crnn import TextCRNN
from utils import checkmate as cm
from utils import data_helpers as dh
from sklearn.metrics import precisio... |
#Parser Imports
from control.parse.base.baseparser import baseparser
from xml.etree.cElementTree import iterparse
from utils.singleton import singleton
#Graph Imports
from model.graph import GraphIncidenceSet as Graph
from utils.map_utils import geo_distance
#Support Data-Structres Imports
from sets import Set
#Source ... |
from model.group import Group
import random
def test_edit_group_name(app, db, check_ui):
if len(db.get_group_list()) == 0:
app.group.create(Group(name="test"))
old_groups = db.get_group_list()
random_group_to_edit = random.choice(old_groups)
updated_group_info = Group(name="New name")
app.... |
# This file is a part of Arjuna
# Copyright 2015-2021 Rahul Verma
# Website: www.RahulVerma.net
# 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... |
from flask_migrate import MigrateCommand
from flask_script import Manager, Server
from app import create_app
app_init = create_app()
manager = Manager(app=app_init)
manager.add_command('start', Server(host='127.0.0.1', port=8888))
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run(... |
#!/usr/bin/python
#
# Copyright 2014 Google Inc. 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... |
__version_info__ = (0, 1, 3, None)
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join([str(i) for i in __version_info__[:-1]])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
|
# -*- coding: utf-8 -*-
"""
Setup.py for Skyperious.
------------------------------------------------------------------------------
This file is part of Skyperious - Skype chat history tool.
Released under the MIT License.
@author Erki Suurjaak
@created 10.12.2014
@modified 01.08.2021
--------... |
import re
import asyncio
import lavalink
from random import randrange
from lavalink.events import PlayerUpdateEvent
from time import time as current_time
from utils.db import SettingsDB
from utils.blindtest.blindtest import BlindTest
from utils.watora import def_time
class CustomPlayer(lavalink.DefaultPlayer):
... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class AddonInstance:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is a... |
#!/usr/bin/env python
"""
.. py:currentmodule:: FileFormat.test_FileReaderWriterTools
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Tests for the module `FileReaderWriterTools`.
"""
# Script information for the file.
__author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca)"
__version_... |
import socket
import select
import ast
HEADER_LENGTH = 10
# IP = "10.52.3.25"
IP = "127.0.0.1"
# IP = '25.135.227.60'
PORT = 5000
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ## just opening the socket for the server.
#Af: address family, inet is just internet.
server_socket.setsockopt(socket.S... |
"""
KUEventParser Library
---------------------
KUEventParser is a library to parse events of Kyoto_univ
usage:
# >>> import kueventparser
# >>> events = kueventparser.get_all()
# >>> list(events)
[<events.Events
The other methods are supported - see `kueventparser.api`. Full documentation
is got by sphinx... |
from .server import app, run_server
from .driver import BaseDriver, AffairDriver
from .logging import logger
__version__ = "0.4a6"
__all__ = ["app", "logger", "run_server", 'BaseDriver', 'AffairDriver']
|
from setuptools import setup
import re
requirements = []
with open("requirements.txt") as f:
requirements = f.read().splitlines()
version = ""
with open("ampharos/__init__.py") as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
if not version:
raise Runt... |
from io import open
from setuptools import setup
with open('README.md', 'r') as f:
long_description = f.read()
setup(
name='django-bootstrap-daterangepicker',
version='1.0.5',
description='A Django form field and widget wrapper for bootstrap-daterangepicker',
long_description=long_description,
... |
import torch
import numpy as np
from detectron2.utils.colormap import random_color
from detectron2.utils.visualizer import ColorMode, GenericMask, Visualizer, _create_text_labels
_SMALL_OBJECT_AREA_THRESH = 1000
_LARGE_MASK_AREA_THRESH = 120000
_OFF_WHITE = (1.0, 1.0, 240.0 / 255)
_BLACK = (0, 0, 0)
_RED = (1.0, 0, ... |
"""Test the parsing utilities for ArraySchema
"""
import os
import pytest
import six
from pytest import raises
from kipoi.specs import DataLoaderDescription, example_kwargs, RemoteFile
from related import from_yaml
# Class to test
CLS = DataLoaderDescription
# common header
inp_targ = """
"""
GOOD_EXAMPLES = ["""
ty... |
import numpy as np
import matplotlib.pyplot as plt
course=np.array(['c','c++','java','python'])
girl=np.array([40,50,45,20])
boy=np.array([45,43,37,50])
fig=plt.figure()
ax=fig.add_axes([0.1,0.1,0.5,0.5])
ax.bar(course,girl,color='red',width=.30)
ax.bar(course,boy,color='yellow',bottom=girl,width=.30)
ax.legend(['girl'... |
"""
This file offers the methods to automatically retrieve the graph pkustk09.
The graph is automatically retrieved from the NetworkRepository repository.
References
---------------------
Please cite the following if you use the data:
```bib
@inproceedings{nr,
title = {The Network Data Repository with Interact... |
#!/usr/bin/env python3
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Python script to output the given list as a space-delimited string to a file.
path/to/write_args.py --output filename -- arg1 a... |
def cover_point(diagram, x1, y1):
if diagram[y1][x1] == ".":
diagram[y1][x1] = 0
diagram[y1][x1] += 1
def create_diagram(data):
x_max = 0
y_max = 0
for line in data:
for point in line:
x_max = max(x_max, point[0])
y_max = max(y_max, point[1])
diagram = [... |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 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 proper accounting with a double-spend conflict
#
from test_framework.test_framework import Bitc... |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class EiacrawlerSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scr... |
# -*- coding: utf-8 -*-
import numpy as np
import math
from scipy.stats.qmc import Sobol, Halton, LatinHypercube
from src.functions.particle import Particle
from src.functions.moment_matching import shift_samples
class Samples:
"""
Class for generating list of Particles given various initial conditions.
... |
import os
import re
import logging
logger = logging.getLogger(__name__)
def test_no_duplicate_ids():
found_ids = {}
root_dir = os.path.abspath(
os.path.join(os.path.split(__file__)[0], '..', '..', 'dash_docs')
)
id_regex = re.compile(r'\Wid\s*[=:]\s*(\'([^\']*)\'|"([^"]*)")')
cnt = 0
... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from config import Config
app = Flask(__name__)
app.config.from_object(Config)
db = SQLAlchemy(app)
migrate = Migrate(app, db)
login = LoginManager(app)
login.login_view = 'login'
fro... |
""" Data selections for EO Tasks
"""
from collections import OrderedDict
__all__ = ["EoDataSelection"]
class EoDataSelection:
""" Specifies data for an EO Task
Parameters
----------
queryString : `str`
The string used in the 'pipetask' -d query
selectionFunction : `function(expandedData... |
#
# Methods around reading and parsing service logs
#
import datetime
import itertools
import os
import psutil
import re
import signal
import shutil
import time
import traceback
import yaml
from flask import Flask, jsonify, abort, request, flash
from subprocess import Popen, TimeoutExpired, PIPE
from common.config ... |
from .openapi import OpenAPI
# these imports appear unused, but in fact load up the subclasses ObjectBase so
# that they may be referenced throughout the schema without issue
from . import info, servers, paths, general, schemas, components, security, tag, example
from .errors import SpecError, ReferenceResolutionError... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Midokura Japan K.K.
# Copyright (C) 2013 Midokura PTE LTD
# 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 th... |
from typing import Any, Callable, Type, TypeVar
T = TypeVar("T")
K = TypeVar("K")
class AbstractFactory:
def parser(self, class_: Type):
raise NotImplementedError
def serializer(self, class_: Type):
raise NotImplementedError
def json_schema(self, class_: Type):
raise NotImpleme... |
import datetime
from typing import Optional
from graphql.pyutils import snake_to_camel
from graphql.type.definition import (
GraphQLField,
GraphQLObjectType,
)
from graphql.type.schema import GraphQLSchema
from pydantic import constr
from flask_resql import resql as rs
from flask_resql.apps.user.types import ... |
class Foo(object):
bar = True
class FooMakerAnc(object):
def __call__(self):
return Foo()
class FooMaker(FooMakerAnc):
pass
fm = FooMaker()
f3 = fm()
f3.bar |
import os
import glob
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
def add_xml_node(xml_file, tag, img_dir):
'''
往xml文件中增加一个节点
Args:
tag: 要增加的节点的名字,比如:'path','name'
xml_file: 要增加节点的xml文件
Returns:None
'''
tree = ET.parse(xml_file)
root = tree.g... |
from shop.shopmodels.notification import Notification, NotificationAttachment
|
import readline, glob, sys
import logging
#from yaml import full_load, load, FullLoader
from helper import read_config_file
from load import orchestrate_measure
def main(config_file):
"""Main function.
This will orchestrate the measurement
"""
# read the given config file and store values
logging.... |
from django.core.mail import send_mail
def send_mail_note(email, etext):
send_mail(
'Django Notice', etext, 'djangodev108@gmail.com',
email, fail_silently=False
)
print('etext')
return True
def send_mail_note1(email, etext, header):
send_mail(
header, etext, 'djangodev108@... |
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status
from api.serializers import technology_serializer
from api.services import technology_service
from api.entities import technology
class Technol... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v6/services/product_group_view_service.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf ... |
#! /usr/bin/python3
from subprocess import PIPE, Popen
import fcntl
import os
import select
import time
import re
class MainTest(object):
def __init__(self, args):
self.process = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
flags = fcntl.fcntl(self.process.stdout, fcntl.F_GETFL)
fcntl... |
from __future__ import division
import argparse
from mmcv import Config
from mmcv.runner import load_checkpoint
from mmfashion.apis import get_root_logger, init_dist, test_predictor
from mmfashion.datasets.utils import get_dataset
from mmfashion.models import build_predictor
def parse_args():
parser = argparse.... |
from revibe.exceptions.api import * |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
install_requires = [
"python-dateutil",
"requests"
]
setuptools.setup(
name="emailrep",
version="0.0.3",
author="Sublime Security",
author_email="hi@sublimesecurity.com",
description="Python interface fo... |
# -*- coding: utf-8 -*-
import sys
def failfast(response):
try:
print("Error code: " + str(response.status_code) + " - " + response.json()["error"])
print(response.json()["message"])
except:
print("Unexpected error while failing fast because of invalid request. " + sys.exc_info()[0])
... |
# -*- coding: utf-8 -*-
import sys
import os
PROJECT_HOME = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../'))
sys.path.append(PROJECT_HOME)
from flask_testing import TestCase
import unittest
from google.protobuf.json_format import MessageToDict
from adsmsg import DataLinksRecordList, DocumentRec... |
"""
Configuration for docs
"""
# source_link = "https://github.com/[org_name]/szamlazz_agent_connector"
# docs_base_url = "https://[org_name].github.io/szamlazz_agent_connector"
# headline = "App that does everything"
# sub_heading = "Yes, you got that right the first time, everything"
def get_context(context):
cont... |
# 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 may ... |
from django.urls import path
from candev_finstat.users.views import (
user_list_view,
user_redirect_view,
user_update_view,
user_detail_view,
)
app_name = "users"
urlpatterns = [
path("", view=user_list_view, name="list"),
path("~redirect/", view=user_redirect_view, name="redirect"),
path(... |
# Copyright 2021 StreamSets 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 writi... |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Find-ComputerField',
'Author': ['@obscuresec', '@harmj0y'],
'Description': ("Searches user object fields for a given word (default *pass*). Default field bein... |
import itertools as it
from zenmai.actions import import_ # NOQA
def suffix(d, suffix=":"):
return {k + suffix: v for k, v in d.items()}
def ntimes(d, n=2):
return list(it.chain.from_iterable(it.repeat(d, n)))
def inc(n):
return n + 1
def inc2(n):
return {"$inc": n + 1}
if __name__ == "__main... |
class Solution(object):
def XXX(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
half = [[]]
for i in range(len(nums)):
for j in range(1 << i):
half.append( half[j] + [nums[i]] )
full = half
return full
|
import random
import requests
#from pycep_correios import get_address_from_cep, WebService
def get_list_ceps_bairros(estado='sp', municipio='piracicaba', loops=20):
"""
Função que auxilia na definição de endereços aleatórios em uma cidade.
:param estado: sigla da unidade da federação (default: "sp")
... |
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
""" A command line tool to verify PurpleDome configuration files """
import argparse
from pprint import pprint
import sys
import argcomplete
import yaml
from app.config_verifier import MainConfig
def load(filename):
""" Loads the config file and feeds it into the b... |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import absolute_import, division, print_function, unicode_literals
from argparse import (ArgumentParser as ArgumentParserBase, REMAINDER, RawDescriptionHelpFormatter,
SUPPRESS, _Coun... |
import pytest
from ipytone import transport
from ipytone.core import Param
from ipytone.signal import Signal
from ipytone.source import Oscillator
from ipytone.transport import Transport, schedule, schedule_once, schedule_repeat
def test_transport():
# singleton
assert Transport() is transport
assert is... |
# encoding=utf-8
# python3.6
# bear_export_sync.py
# Developed with Visual Studio Code with MS Python Extension.
'''
# Markdown export from Bear sqlite database
Version 1.4, 2020-01-11
modified by: github/andymatuschak, andy_matuschak@twitter
original author: github/rovest, rorves@twitter
See also: bear_import.py for... |
import numpy as np
import numpy.linalg as linalg
A = np.random.random((3,3))
print A
eigenValues,eigenVectors = linalg.eig(A)
print eigenValues
print eigenVectors
idx = eigenValues.argsort()[::-1]
eigenValues = eigenValues[idx]
eigenVectors = eigenVectors[:,idx]
print eigenValues
print eigenVectors
|
'''
SPDX-License-Identifier: Apache-2.0
Copyright 2017 Massachusetts Institute of Technology.
'''
import os
import logging
import sys
from keylime import config
from keylime import crypto
from keylime import json
from keylime import keylime_logging
from keylime.requests_client import RequestsClient
from keylime impor... |
import requests
def Get_NGROK_Tunnel(ip='ngrok', port=4040):
header = {"content-type": "application/json"}
response = requests.request("GET", 'http://ngrok:4040/api/tunnels', headers=header, data='')
#response = requests.request("GET", 'http://localhost:4040/api/tunnels', headers=header, data='')
retu... |
"""View configuration helpers."""
# BBB
from websauna.system.core.viewconfig import * |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-26 13:44
from __future__ import unicode_literals
import ckeditor.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0031_auto_20170925_1638'),
]
operations = [
migratio... |
#!/usr/bin/python
from flask import Flask,render_template
from Blueprints.ProjetosView import projetos
from Blueprints.ClientesView import clientes
from Blueprints.GerentesView import gerentes
from Blueprints.TarefasView import tarefas
from Models.TerminusModel import db
app = Flask(__name__)
app.register_blueprint(... |
import os
import subprocess
from base import FuseBase
class FuseSshfs(FuseBase):
def __init__(self, cfg):
FuseBase.__init__(self)
self.target = cfg["target"]
self.path = cfg.get("path", "")
def mount(self, mount_path, parent_path=None):
FuseBase.mount(self, mount_path, parent_path)
res = subprocess.call... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
# Generated by Django 3.0.3 on 2020-04-11 21:07
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('myapp', '0005_property_model'),
]
operations = [
migrations.RemoveField(
model_name='suggestion_model',
name='author',
... |
"""
Example parameters:
Common:
--x-start=-2695000.0
--x-count=386
--x-step=14000.0
--y-start=-2331000.0
--y-count=334
--y-step=14000.0
--orig-lat=88.9899731326
--orig-lon=-129.805571092
--adjust-angle=-39.805571092
For Polar stereographic:
--proj-name=stereo
--true-scale-lats=71.6577131288
For Mercator:
--proj-name=... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( n ) :
dp = [ 0 for _ in range ( n + 1 ) ]
for i in range ( 1 , n + 1 ) :
if i <= 3 :
dp... |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2021 ARC Centre of Excellence for Climate Extremes
# author: Paola Petrelli <paola.petrelli@utas.edu.au>
#
# 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... |
#!/usr/bin/env python
# encoding: utf-8
"""
Pbxproj.py
Working with the pbxproj file format is a pain in the ass.
This object provides a couple basic features for parsing pbxproj files:
* Getting a dependency list
* Adding one pbxproj to another pbxproj as a dependency
Version 1.1.
History:
1.0 - October 20, 2010:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.