text stringlengths 1 927k |
|---|
import json
import re
import numpy as np
import tensorflow as tf
import tqdm
from pkg_resources import resource_filename
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessing import LabelBinarizer
from tensorflow import... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
parse_filesize,
str_to_int,
)
class SnotrIE(InfoExtractor):
_VALID_URL = r'http?://(?:www\.)?snotr\.com/video/(?P<id>\d+)/([\w]+)'
_TESTS = [{
'url': ... |
import tensorflow as tf
from onnx_tf.handlers.backend_handler import BackendHandler
from onnx_tf.handlers.handler import onnx_op
@onnx_op("SequenceErase")
class SequenceErase(BackendHandler):
@classmethod
def chk_pos_in_bounds(cls, input_seq, pos):
"""
Check the position is in-bounds with respect to the... |
from .._database.common import CommonDatabaseInteractions
from .._utilities.defaults import default_sqlite_database_name
from .._configuration import options
from sqlalchemy import select, func
from tempfile import gettempdir
class Create(CommonDatabaseInteractions):
def __init__(self):
super(Create, sel... |
from flask import Blueprint
api = Blueprint('api', __name__)
from . import authentication, posts, users, errors, tables, macros, collections, marketplace |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from time import sleep
from OpenGL.GLUT import *
from OpenGL.GL import *
from OpenGL.GLU import *
animationAngle = 0.0
frameRate = 25
def doAnimationStep():
"""Update animated parameters.
This Function is made active by glutSetIdleFunc"""
globa... |
import unittest
from mock import MagicMock
from dd.api.contexts.local import LocalContext
from dd.api.workflow.actions import Action
from dd.api.workflow.callables import ActionCallableBuilder
class TestActions(unittest.TestCase):
def setUp(self):
self.dataset = MagicMock()
self.context = MagicM... |
import os
import numpy as np
from pydrake.all import PiecewisePolynomial
from examples.setup_simulations import (
run_quasistatic_sim)
from qsim.parser import QuasistaticParser, QuasistaticSystemBackend
from qsim.model_paths import models_dir
from qsim.simulator import GradientMode
#%% sim setup
q_model_path = ... |
"""Calculate the elasticities for a set of built models."""
from os.path import isfile
import micom
from micom import load_pickle
from micom.elasticity import elasticities
from micom.workflows import workflow
logger = micom.logger.logger
try:
max_procs = snakemake.threads
except NameError:
max_procs = 20
d... |
# -*- coding: utf-8 -*-
### Import required python modules
from gevent import monkey; monkey.patch_all()
import platform
import os
from os import listdir, stat, makedirs, mkdir, walk, remove, pardir
from os.path import isdir, isfile, join, splitext, getmtime, basename, normpath, exists, expanduser, split, dirname, ge... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_garbagetruck
----------------------------------
Tests for `garbagetruck` module.
"""
import pytest
from contextlib import contextmanager
from click.testing import CliRunner
from garbagetruck import garbagetruck
from garbagetruck import cli
class TestGarbaget... |
# Generated by Django 3.0.6 on 2020-05-13 20:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('churches', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='... |
from .sequence_generator import SequenceGenerator
from .transformer import TransformerModel |
import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
def requires():
with open("requirements.txt", "r") as f:
return [r.strip() for r in f.readlines()]
setup(name='omamittari',
version='0.9.0',
des... |
#!/usr/bin/env python3
import yaml
import numpy as np
def read_evals(fyml):
with open(fyml, 'r') as f:
evd = yaml.safe_load(f)
elist = evd['evals']
return np.array(elist)
def main():
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('nup', type=int)
parser.add_argumen... |
#создай тут фоторедактор Easy Editor!
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import *
from PIL import Image
from PIL import ImageFilter
from PyQt5.QtGui import QPixmap
app = QApplication([])
window1 = QWidget()
i = 0
spisok = QListWidget()
line1 = QVBoxLayout()
line2 = QVBoxLayout()
line3 = QHBoxLayout()
li... |
from .map_of_commands import *
from .map_of_parsers import *
from .parent_parser import ParentParser
"""
This is where we go through all the parsers and manually attach them to a command
"""
class TabcmdController:
def initialize_parsers(self):
manager = ParentParser()
parent = manager.get_root_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import sys
import re
import pickle
import os
from argparse import ArgumentParser
import six
from six.moves import zip
import mathics
from mathics.core.def... |
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
from .base import * # noqa
import socket
import os
# APP CONFIGURATION
# ------------------------------------------------------------------------------
# INSTALLED_APPS += ['guni... |
'''
HDFS cluster creation wizard with a console UI.
'''
from __future__ import print_function
import sys
import re
import math
import os
from os import path
import simplejson as json
import collections
from linodecommon import logger
from linodecommon import linode_api
from terminaltables import AsciiTable, SingleTa... |
version = (0,0,0) |
# -*- coding: utf-8 -*-
import os
import json
import re
import datetime
import logging
import yaml
import pkg_resources
import time
from zope import component
from zope.interface import Interface
from parametrizer import Parametrizer
logger = logging.getLogger(__name__)
class ICommandProvider(Interface):
""" Ma... |
from pathlib import Path
from typing import Dict, List
import toml
from pydantic import parse_obj_as
from cargo_parse.models.cargo_toml import (
CargoTomlData,
DependencyData,
FeaturesData,
PatchData,
ProfileData,
)
from cargo_parse.models.dependency import Dependency
from cargo_parse.models.featu... |
import asyncio
from pyjamas_core.util import Input, Output, Property
from pyjamas_core.supermodel import Supermodel
class Model(Supermodel):
"""
schedules the func gates of the agent
sets the number of elapsed rounds as output
"""
def __init__(self, uuid, name: str):
super(Model, ... |
# -*- coding: utf-8 -*-
"""Cisco DNA Center Create sensor test template data model.
Copyright (c) 2019-2021 Cisco Systems.
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, inc... |
from django.apps import AppConfig
class DCIMConfig(AppConfig):
name = "nagios"
verbose_name = "NAGIOS" |
"""
sender - SimplE Neuron DEleteR
Deletes the least significant neurons.
Outgoing value of neuron is defined as sum of absolute values of
weights outgoing from neuron divided by sum of absolute values of
weights outgoing from entire layer.
Ingoing value of neuron is defined as sum of absolute ... |
# Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
from typing import Callable
import dill
from pandas import DataFrame
from .connectioninfo import ConnectionInfo
from .sqlqueryexecutor import execute_query, execute_raw_query
from .sqlbuilder import SpeesBuilder, SpeesBuilder... |
###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... |
from django.db import models
from cliente.models import Cliente
from uuid import uuid4
class Transferencia(models.Model):
id_transf = models.UUIDField(primary_key=True, default=uuid4, editable=False)
quantia = models.FloatField()
data_transf = models.DateField()
cliente_cpf_transf = models.ForeignKey(C... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import ba... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The PaydayCoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test longpolling with getblocktemplate."""
from decimal import Decimal
from test_framework.test_fr... |
"""Mass Memory subsystem"""
import array
import pathlib
import time
from rsfsup.common import Subsystem, validate
class MassMemory(Subsystem, kind="Mass Memory"):
"""Mass memory subsystem
Attributes:
instr (Fsup)
"""
@staticmethod
def process_catalog(cat):
"""Process comma separa... |
from django.db.models.aggregates import Sum
from django.forms.models import model_to_dict
from .models import LdaSimilarity
from .lda_model_builder import LdaModelManager
from django.db.models import Q
class ContentBasedRecommender():
def __init__(self, min_sim=0.1):
self.min_sim = min_sim
@st... |
"""Base loader used to create custom loaders for content."""
import yaml
import mdx_math
import abc
import sys
import re
import os.path
from os import listdir
from verto import Verto
from verto.errors.Error import Error as VertoError
from django.conf import settings
from django.utils.translation import to_locale
from ... |
"""Post table
Revision ID: 79db95db1114
Revises: 148200b7a331
Create Date: 2019-11-21 11:03:05.596270
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '79db95db1114'
down_revision = '148200b7a331'
branch_labels = None
depends_on = None
def upgrade():
# ###... |
"""
vtelem - A module implementing a message storage.
"""
# built-in
from contextlib import contextmanager
import os
from tempfile import TemporaryDirectory
from typing import Dict, Callable, List, Optional, Iterator, Tuple
# internal
from vtelem.classes.data_cache import DataCache
from vtelem.frame.fields import to_... |
import _plotly_utils.basevalidators
class DomainValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name='domain', parent_name='layout.ternary', **kwargs
):
super(DomainValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pa... |
# exc. 9.4.1 (Rolling Mission)
def choose_word(file_path, index):
"""
the function gets a string that represent a file route
and a number represent index of a word in the file.
the function return a tuple of:
1) number of different words in the file
2) a word given by the index
"""
# for the rolling mission i ... |
"""
introspect.py
Compute all within-dataset connectivities.
"""
import logging
import sys
import argparse
import broadinstitute_psp.utils.setup_logger as setup_logger
import cmapPy.pandasGEXpress.GCToo as GCToo
import cmapPy.pandasGEXpress.parse as parse
import cmapPy.pandasGEXpress.write_gct as wg
import broadins... |
# Copyright 2018 The TensorFlow Probability 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 o... |
# %%
from CoolProp.CoolProp import PropsSI
import pygmo as pg
import pandas as pd
from matplotlib import pyplot as plt
from orc import ORC_without_ihe, CHPORC
from tespy.components import HeatExchanger, Merge, Pump, Sink, Source, Splitter
from tespy.components.heat_exchangers.condenser import Condenser
from tespy.con... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2019-05-29 08:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('awad', '0010_auto_20190529_1148'),
]
operations = [
migrations.AlterField(
... |
from supabase.lib.storage.storage_bucket_api import StorageBucketAPI
from supabase.lib.storage.storage_file_api import StorageFileAPI
class SupabaseStorageClient(StorageBucketAPI):
"""
Manage the storage bucket and files
Examples
--------
>>> url = storage_file.create_signed_url("something/test2.t... |
import argparse
import os
import sys
import tensorflow as tf
from tensorflow.core.protobuf import saver_pb2
from tensorflow.python.client import session
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import function
from tensorflow.py... |
"""
面试题 18(一):在 O (1) 时间删除链表结点
题目:给定单向链表的头指针和一个结点指针,定义一个函数在 O (1) 时间删除该结点。
"""
class Node:
def __init__(self, val):
self.val = val
self.next = None
def list2link(lst):
root = Node(None)
ptr = root
for i in lst:
ptr.next = Node(i)
ptr = ptr.next
return root.next
d... |
import agpy
from agpy import psf_fitter,asinh_norm
from pylab import *
if __name__ == "__main__":
# numerically determine Airy FWHM
# (see http://en.wikipedia.org/wiki/Airy_disk)
x = linspace(1.5,1.7,100000)
airy_fwhm = x[argmin(abs(agpy.psf_fitter._airy_func(x) - 0.5))] * 2
# numerically determi... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from todo.models import Todo, Board
class TodoInline(admin.TabularInline):
model = Todo
extra = 0
readonly_fields = (
'created',
'updated',
)
class BoardAdmin(admin.ModelAdmin):
mod... |
from dataclasses import dataclass
from mint.consensus.constants import ConsensusConstants
from mint.types.blockchain_format.sized_bytes import bytes100
from mint.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class ClassgroupElement(Streamable):
"""
Represents a classgroup ... |
import os
from unittest import mock
from openml.testing import TestBase
from openml import OpenMLSplit, OpenMLTask
from openml.exceptions import OpenMLCacheException
import openml
import unittest
import pandas as pd
class TestTask(TestBase):
_multiprocess_can_split_ = True
def setUp(self):
super(Tes... |
# This file is part of the GBI project.
# Copyright (C) 2013 Omniscale GmbH & Co. KG <http://omniscale.com>
#
# 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/licens... |
import numpy as np
def iter_loadtxt(filename, delimiter=',', skiprows=0, dtype=np.float32):
def iter_func():
with open(filename, 'r') as infile:
for _ in range(skiprows):
next(infile)
for line in infile:
line = line.rstrip().split(delimiter)
... |
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the... |
from __future__ import absolute_import
from .cloudpickle import *
__version__ = '1.1.1' |
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
load("@rules_python//python:defs.bzl", "py_binary")
def _cc_wrapper_impl(ctx):
cc_toolchain = find_cpp_toolchain(ctx)
feature_configuration = cc_common.configure_... |
#
# This file is part of m.css.
#
# Copyright © 2017, 2018, 2019 Vladimír Vondruš <mosra@centrum.cz>
#
# 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... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from functools import partial
import time
from azure.core.exceptions import ResourceExistsError
from azure.keyvault.administration._internal import parse_folder_url
imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Fichero con la clave de desarrollador para poderlo ignorar en el repositorio.
"""
DEVELOPER_KEY = "YOUR_OWN_YOUTUBE_API_DEVELOPER_KEY_HERE" |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
import re
from ..models import (SequenceGuide,
SequenceGuideStep,
Image)
from ..serializers.guide_serializers import (SequenceGuideSerializer,
... |
#
# PySNMP MIB module F10-OPENFLOW-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/F10-OPENFLOW-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:57:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
#
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by ... |
import os
import shutil
from openeo.file import File
class RESTFile(File):
"""Represents a file of openeo."""
def download_file(self, target):
"""
Downloads a user file to the back end.
:param target: local path, where the file should be saved.
:return: status: Response statu... |
### Case study Distribution of tips by gender
import pandas as pd
import plotly.express as px
df = pd.read_csv("../data/tips.csv")
plot = px.pie(
data_frame=df,
values='tip',
names='sex',
title="Case study Distribution of tips by gender"
)
plot.show() |
from itertools import product
from funcy import group_by, join_with, lcat, lmap
from django.db.models import Subquery
from django.db.models.query import QuerySet
from django.db.models.sql import OR
from django.db.models.sql.query import Query, ExtraWhere
from django.db.models.sql.where import NothingNode, SubqueryCons... |
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Game of life
author: Pleiades
'''
import os
import random
#import functools
width = 60
height = 15
screen = []
def Init():
global screen
screen = [['#' if random.random() > 0.8 else ' ' for i in range(width)]
for j in range(height)]
def Pri... |
from typing import Dict, List
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
special = ['n', 't', '\\', '"', '\'', '7', 'r']
def check_if_found_incident(res: List):
if res and isinstance(res, list) and isinstance(res[0].get('Contents'), dict):
if 'dat... |
"""
Module: 'json' on micropython-maixpy-0.6.2-66
"""
# MCU: {'ver': '0.6.2-66', 'build': '66', 'sysname': 'MaixPy', 'platform': 'MaixPy', 'version': '0.6.2', 'release': '0.6.2', 'port': 'MaixPy', 'family': 'micropython', 'name': 'micropython', 'machine': 'Sipeed_M1 with kendryte-k210', 'nodename': 'MaixPy'}
# Stubber:... |
#!/usr/bin/env python
import sys
import tarfile
import json
import cheesepi as cp
def slurp_file(dao, series, fd):
"""Read a file into the 'series' database"""
content = fd.read()
points = json.loads(content)
dao.slurp(series, points)
def slurp_database(dao, filename):
"""Read a tgz filename into the database"... |
from PyQt5 import QtCore, QtGui, QtWidgets
import SentimentAnalysis
import re, csv
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1248, 804)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.se... |
import sys
import os
import errno
import unittest
import time
import gc
import tempfile
import greentest
import gevent
from greentest import mock
from gevent import subprocess
if not hasattr(subprocess, 'mswindows'):
# PyPy3, native python subprocess
subprocess.mswindows = False
PYPY = hasattr(sys, 'pypy_v... |
from rest_framework import serializers
from thenewboston.utils.fields import all_field_names
from ..models.validator import Validator
class ValidatorSerializer(serializers.ModelSerializer):
class Meta:
exclude = ('id',)
model = Validator
read_only_fields = all_field_names(Validator)
cl... |
import pytest
from indy_common.authorize.auth_actions import AuthActionAdd, AuthActionEdit
from plenum.common.constants import TRUSTEE, STEWARD, VERKEY
from indy_common.constants import ROLE, NYM, TRUST_ANCHOR, NETWORK_MONITOR
@pytest.fixture(scope='module', params=[True, False])
def is_owner(request):
return re... |
# -*- coding: utf-8 -*-
from django.urls import include, path
from rest_framework import routers
from . import views
router = routers.DefaultRouter()
router.register(r'children', views.ChildViewSet)
router.register(r'changes', views.DiaperChangeViewSet)
router.register(r'feedings', views.FeedingViewSet)
router.regist... |
# 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 ... |
""" Util functions for SMPL
@@batch_skew
@@batch_rodrigues
@@batch_lrotmin
@@batch_global_rigid_transformation
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def batch_skew(vec, batch_size=None):
"""
vec is N x 3, batc... |
"""
Tests for TradingCalendarDispatcher.
"""
from unittest import TestCase
from trading_calendars.calendar_utils import TradingCalendarDispatcher
from trading_calendars.errors import (
CalendarNameCollision,
CyclicCalendarAlias,
InvalidCalendarName,
)
from trading_calendars.exchange_calendar_iepa import IE... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Path hack
import os, sys
sys.path.insert(0, os.path.abspath('..'))
try:
import unittest2 as unittest
except ImportError:
import unittest
from threading import Thread
from tests.test_custom_dict import BaseCustomDictTestCase
from requests_cache.backends.storage.d... |
import sys
sys.path.append('./scripts')
from get_parameter import get_parameter
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
nu, Nx, Ny, Nz, dt_fine, dt_coarse, Niter, Tend, do... |
# -*- coding: utf-8 -*-
"""Test fetching within tabix files
"""
import os
from vcfpy import reader
__author__ = "Manuel Holtgrewe <manuel.holtgrewe@bihealth.de>"
# Test fetch with chrom/begin/end ---------------------------------------------
def test_fetch_no_records_values():
path = os.path.join(os.path.dir... |
from brownie import Contract, ZERO_ADDRESS
from yearn.cache import memory
from cachetools.func import ttl_cache
# curve registry documentation https://curve.readthedocs.io/registry-address-provider.html
address_provider = Contract('0x0000000022D53366457F9d5E68Ec105046FC4383')
curve_registry = Contract(address_provider... |
# Copyright The PyTorch Lightning 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.0
#
# Unless required by applicable law or agreed to i... |
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 462756593
"""
"""
random actions, total chaos
"""
board = gamma_new(2, 4, 2, 1)
assert board is... |
"""Django Trips serializers"""
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from django_trips.models import (Category, Facility, Gear, Host, Location,
Trip, Trip... |
import types
from vyper.settings import (
VYPER_ERROR_CONTEXT_LINES,
VYPER_ERROR_LINE_NUMBERS,
)
# Attempts to display the line and column of violating code.
class ParserException(Exception):
def __init__(self, message='Error Message not found.', item=None):
self.message = message
self.li... |
#!/usr/bin/env python3
import logging
import sys
import unittest
import warnings
sys.path.append('.')
from server.in_memory_server_api import InMemoryServerAPI
sample_1700 = {
"cruise": {
"id": "NBP1700",
"start": "2017-01-01",
"end": "2017-02-01"
},
"loggers": {
"knud": {
"configs": ["o... |
# -*- coding: utf-8 -*-
'''
vSphere Cloud Module
====================
.. note::
.. deprecated:: Carbon
The :py:func:`vsphere <salt.cloud.clouds.vsphere>` cloud driver has been
deprecated in favor of the :py:func:`vmware <salt.cloud.clouds.vmware>`
cloud driver and will be removed in Salt ... |
import requests
import json
import numpy as np
with open('./jiuge_7.txt', encoding='utf-8') as f:
poes = json.load(f)
yayun_all = 0
pingze_all = 0
for p in poes:
data = {
"yun": "psy",
"type": "qj_p", # qj_p七言 | wj_p五言
"text": p
}
headers = {
"Host": "www.52shici.com",
... |
import os
import argparse
def get_head_tail(args):
head, tail = None, None
with open(args.head) as f: head = f.read()
with open(args.tail) as f: tail = f.read()
return head, tail
def main(args):
tex = []
head, tail = get_head_tail(args)
tex.append(head)
sections = os.listdir(args.code)
sections.sor... |
# Copyright 1997 - 2018 by IXIA Keysight
#
# 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,... |
#用python绘制坐标
#https://matplotlib.org/examples/axes_grid/demo_axisline_style.html
#https://stackoverflow.com/questions/13430231/how-i-can-get-cartesian-coordinate-system-in-matplotlib
#https://stackoverflow.com/questions/50798265/what-is-subplotzero-documentation-lacking
# notice import as 和 from import有什么区别?
import nu... |
#!/usr/bin/env python
import open3d.visualization.gui as gui
import os.path
import platform
basedir = os.path.dirname(os.path.realpath(__file__))
# This is all-widgets.py with some modifications for non-English languages.
# Please see all-widgets.py for usage of the GUI widgets
MODE_SERIF = "serif"
MODE_COMMON_HANYU... |
# -*- coding: utf-8 -*-
"""
Support for nginx
"""
from __future__ import absolute_import, print_function, unicode_literals
import re
import salt.utils.decorators as decorators
# Import salt libs
import salt.utils.path
# Import 3rd-party libs
from salt.ext.six.moves.urllib.request import urlopen as _urlopen
# Cach... |
"""Welcome to SiPANNs, silicon photonics with artificial neural networks,
documentation.
We leverage various machine learning techniques to simulate integrated
photonic device circuits.
"""
__version__ = "1.4.0"
__author__ = "Easton Potokar, Alec Hammond, R Scott Collings <eastonpost@byu.edu>"
__all__ = [] |
from os import getenv, path
XDG_DATA_HOME = getenv(
'XDG_DATA_HOME', path.expanduser(path.join('~', '.local', 'share')))
XDG_CONFIG_HOME = getenv(
'XDG_CONFIG_HOME', path.expanduser(path.join('~', '.config')))
GLOBAL_CONFIGFILE = path.join(XDG_CONFIG_HOME, 'swsg')
PROJECT_DATA_DIR = path.join(XDG_DATA_HOME, 's... |
from abc import ABCMeta, abstractmethod
class PathFinder(object):
__metaclass__ = ABCMeta
def __init__(self, G, P):
self.G = G
self.P = P
@abstractmethod
def heuristic(self, v, src, dest):
pass
@abstractmethod
def calc(self, src, dest):
pass |
# -*- coding: utf8 -*-
import requests
import hashlib
import json
import time
import random
requests.packages.urllib3.disable_warnings
def md5(code):
res=hashlib.md5()
res.update(code.encode("utf8"))
return res.hexdigest()
def get_information(mobile,password):
header = {
'Content-Type': 'applic... |
# Copyright 2021 Zilliz. 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 agree... |
#!/usr/bin/env python3
"""
CasperLabs Client API library and command line tool.
"""
import sys
import time
import argparse
import grpc
import functools
from pyblake2 import blake2b
import ed25519
import base64
import struct
import json
from operator import add
from functools import reduce
# ~/CasperLabs/protobuf/io/ca... |
from django import VERSION as DJANGO_VERSION
from django.db import transaction
from django.forms import Form
from django.http import HttpResponseRedirect
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import gettext as _
from django.utils.translation import gettext_l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.