text stringlengths 2 999k |
|---|
import csv
import pickle
from torch.utils.data import Dataset
from torchvision.transforms import Compose
def pad_sequence(sequences, batch_first=False, padding_len=None, padding_value=0):
# assuming trailing dimensions and type of all the Tensors
# in sequences are same and fetching those from sequences[0]
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Este es un módulo que tiene herramientas para ajustar un ciclo M vs H con
una distribución lognormal de Langevins.
======================
How to use it
======================
The module provide a function :func:`new` to load data from a file and... |
"""
test_project: tests Project class and created composite objects
Corey Rayburn Yung <coreyrayburnyung@gmail.com>
Copyright 2020-2021, Corey Rayburn Yung
License: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0)
"""
from __future__ import annotations
import dataclasses
import pathlib
from typing import (Any, ... |
# pylint:disable=unused-variable
# pylint:disable=unused-argument
# pylint:disable=redefined-outer-name
""" Fixtures to create docker-compose.yaml configuration files (as in Makefile)
- Basically runs `docker-compose config
- Services in stack can be selected using 'core_services_selection', 'ops_servi... |
import io
import shutil
import tempfile
import pytest
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import override_settings
from django.urls import reverse
from rest_framework import status
from ..models import (
BarrierPlan,
BarrierPlanFile,
BarrierReal,
BarrierRealF... |
"""Lapis script"""
__author__ = 'Vardë'
import os
import sys
import shlex
import subprocess
from typing import NamedTuple, Optional, Dict, Any
from functools import partial
from pathlib import Path
from adptvgrnMod import adptvgrnMod
import vardefunc as vdf
import muvsfunc as muvf
import mvsfunc as mvf
import G41Fun ... |
# 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 appli... |
# -*- coding: utf-8 -*-
"""
admin security authenticators module.
"""
from pyrin.security.enumerations import InternalAuthenticatorEnum
from pyrin.security.authentication.decorators import authenticator
from pyrin.security.authentication.handlers.internal import InternalTokenAuthenticator
@authenticator()
class Admi... |
class MyverError(Exception):
"""Configuration is invalid."""
def __init__(self, message: str):
self.message: str = message
super().__init__()
class ConfigError(MyverError):
"""Configuration is invalid."""
class BumpError(MyverError):
"""Bumping a version or part failed."""
|
import numpy as np
import pandas as pd
p_ebni_int = pd.read_csv('data/p_ebni_int.csv', header=None, names=['input'], dtype=np.int8)
|
from operator import itemgetter
from stories import arguments
from stories import story
from stories import Success
from stories.shortcuts import contract_in
# Constants.
representations = {
"int_error": "Invalid value",
"list_of_int_error": "Invalid value",
"int_field_repr": "integer",
"str_field_... |
# file: layers.py
# brief: A number of objects to wrap caffe layers for conversion
# author: Andrea Vedaldi
from collections import OrderedDict
from math import floor, ceil
import numpy as np
from numpy import array
import scipy
import scipy.io
import scipy.misc
import copy
import collections
# Recent Caffes just pas... |
"""Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
Original C++ source file: fused_conv2d_bias_activation_op.cc
"""
import collections as _collections
from tensorflow.python.eager import execute as _execute
from tensorflow.python.eager import context as _context
from tensorflow.py... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""This module contains functions to perform aggregation on a list of values obtained from the confirmation measure."""
import logging
... |
#!/usr/bin/env python
import sys
sys.setdlopenflags(0x100|0x2)
import fvm
import fvm.fvmbaseExt as fvmbaseExt
import fvm.importers as importers
import numpy
from mpi4py import MPI
fvm.set_atype('double')
import math
if fvm.atype == 'double':
import fvm.models_atyped_double as models
import fvm.exporters_at... |
import time
from fpie.args import get_args
from fpie.io import read_images, write_image
from fpie.process import BaseProcessor, EquProcessor, GridProcessor
def main() -> None:
args = get_args("cli")
proc: BaseProcessor
if args.method == "equ":
proc = EquProcessor(
args.gradient,
args.backend,
... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved.
from jinja2 import Environment
from resilient_sdk.util import jinja2_filters
def mock_setup_jinja_env():
return Environment()
def test_filter_base64():
mock_text = u"convert ᠭ ᠮ ᠯ me to base64"
fil... |
import tkinter
window = tkinter.Tk()
canvas = tkinter.Canvas(window, width=1000, height=500, bg="white")
canvas.pack()
lastX, lastY = 0,0
colour = "red"
def store_position(event):
global lastX, lastY
lastX = event.x
lastY = event.y
def on_click(event):
store_position(event)
def on_drag(event):
globa... |
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
import time
import os
# from Env.AtariEnv.atari_wrappers import LazyFrames
def ortho_weights(shape, scale=1.):
""" PyTorch port of ortho_init from baselines.a2c.ut... |
"""
Runs shell commands used by the common manageability library
Copyright (C) 2017-2022 Intel Corporation
SPDX-License-Identifier: Apache-2.0
"""
import platform
import os
import shlex
import subprocess
import sys
import logging
import builtins
from datetime import datetime
from subprocess import Pope... |
# 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, software
# distributed ... |
# Copyright 2016 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 applicable law or ag... |
# Copyright (c) 2019-2020 Manfred Moitzi
# License: MIT License
# created 2019-02-15
import pytest
import ezdxf
from ezdxf.entities.polyline import Polyline
from ezdxf.lldxf.const import DXF12, DXF2000
from ezdxf.lldxf.tagwriter import TagCollector, basic_tags_from_text
from ezdxf.math import Vector
TEST_CLASS = Poly... |
from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "WEL"
addresses_name = (
"2021-03-31T10:18:02.280304/Wellingborough Democracy_Club__06May2021 (2).tsv"
)
stations_name = (
"2021-03-31T10:18... |
# Generated by Django 3.0.9 on 2020-08-25 16:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0008_delete_addpost'),
]
operations = [
migrations.AlterField(
model_name='userdetail',
name='image',
... |
from construct import *
from .player_data import PlayerData
GameData = Struct(
"NumPlayers" / VarInt,
"Players" / Struct(
"PlayerId" / Byte,
"data" / PlayerData,
)[this.NumPlayers]
) |
import base64
import hashlib
import json
import string # pylint: disable=deprecated-module
import typing as t
import uuid
from abc import ABCMeta, abstractmethod
import jwt # type: ignore
import requests
from jwcrypto.jwk import JWK # type: ignore
from .actions import Action
from .assignments_grades import Assignm... |
"""This script processes the raw SGML and extracts the relevant bits
(in this case text) from the Reuters data set and throws it into a
more managable CSV format for further processing
"""
import sys
import sgmllib
import glob
import os
import csv
from pprint import pprint
class Parser(sgmllib.SGMLParser):
def __... |
"""
Defines a window which contains either an image or a border.
"""
import curses
from io import BytesIO
try:
from PIL import Image
HAS_PIL = True
except ImportError:
class Image:
class Image:
pass
HAS_PIL = False
try:
import gi
gi.require_version('Rsvg', '2.0')
from ... |
from __future__ import annotations
from datetime import datetime, timedelta
import operator
from typing import (
TYPE_CHECKING,
Any,
Callable,
Optional,
Sequence,
Tuple,
Type,
TypeVar,
Union,
cast,
)
import warnings
import numpy as np
from pandas._libs import algos, lib
from p... |
"""
Custom pagination tools.
"""
class Page(object):
"""Class to represent a page."""
def __init__(self, paginator, pageid, id_start, id_stop, baseurl=None):
"""Constructor."""
self.paginator = paginator
self.number = pageid
self.id_start = id_start
self.id_stop = id_... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-07 16:15
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):
initial = True
dependencies = [
migratio... |
""" This module defines all of work with scores of commands of specific league for the last week """
import requests
from bs4 import BeautifulSoup
from texttable import Texttable
from leagues.utils import shorten_name
def scrape_page(url):
""" Scrape certain web-page, find and retrieve the necessary tag... |
from pathlib import Path
from tqdm import tqdm
import pandas as pd
import argparse
import yaml
from types import SimpleNamespace
import json
from dataclasses import _MISSING_TYPE, dataclass, field
from typing import Any, List, Optional
from src.configs import BasicConfig
@dataclass
class BasicProcessConfig(BasicConfi... |
# -*- coding: utf-8 -*-
"""
This gives other modules access to the gritty details about characters and the
encodings that use them.
"""
import re
import zlib
import unicodedata
import itertools
from pkg_resources import resource_string
from ftfy.compatibility import unichr
# These are the encodings we will try to fix... |
import os
import yaml
import logging
from models import InternalTLS
from g import versions_file_path, host_root_dir, DEFAULT_UID, INTERNAL_NO_PROXY_DN
from utils.misc import generate_random_string, owner_can_read, other_can_read
default_db_max_idle_conns = 2 # NOTE: https://golang.org/pkg/database/sql/#DB.SetMaxIdle... |
#!/usr/bin/env python
#
# Copyright 2016 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 requir... |
# -*- coding: utf-8 -*-
# Django settings for helloworld project.
import os
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
... |
# coding: utf-8
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import re # noqa: F401
import sys # noqa: F401
import nulltype # ... |
"""
Experiment configuration for:
Model: RE-Flex
Benchmark: TACRED
"""
import fasttext
import spacy
import pickle
from reflex.reflex_runner import ReflexRunner
from reflex.utils import setup_experiment, save_reflex_e_list
import os
ex = setup_experiment('RE-Flex TACRED')
@ex.config
def conf():
model_dir = os.path... |
# 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 u... |
#
# This file is part of Python Client Library for STAC.
# Copyright (C) 2019 INPE.
#
# Python Client Library for STAC is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
"""STAC Catalog module."""
import json
from pkg_resources import ... |
import time, sys
import httplib, urllib
#ip_address="192.168.0.100"
#ip_address='10.20.218.197'
ip_address='10.12.19.67'
cost='60'
l_amount='300'
sys.path.append('../..')
import spade
in_use=False
name="light_bulb_agent"
class MyAgent(spade.Agent.Agent):
def _setup(self):
template = spade.Behaviour.ACLTemplate()... |
from __future__ import absolute_import
import logging
import numpy as np
from numpy import asarray
from ..util import gower_normalization
from .core import run_heritability
def binomial_estimate(nsuccesses, ntrials, covariate, K, NP=10):
logger = logging.getLogger(__name__)
logger.info('Gower normalizing')... |
r"""
Work with WAV files
A WAV file is a header specifying format information, followed by a
sequence of bytes, representing the state of some audio signal over a
length of time.
A WAV file may have any number of channels. Typically, they have 1
(mono) or 2 (for stereo). The data of a WAV file is given as a
sequence ... |
# 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, software
# distributed un... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import ArgumentsRequired
fro... |
#
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
#
from __future__ import print_function
import os
import ucf11_utils as ut
if __name__ == "__main__":
os.chdir(os.path.abspath(os.path.dirname(__file__)))
u... |
"""trending_languages URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
... |
from dis import dis
import numpy as np
import pandas as pd
import warnings
from credoai.modules.credo_module import CredoModule
from credoai.utils.constants import MULTICLASS_THRESH
from credoai.utils.common import NotRunError, is_categorical
from credoai.utils.dataset_utils import ColumnTransformerUtil
from credoai.ut... |
import numpy as np
import os
from gantools import utils
from . import path
from . import fmap
from gantools.data import transformation
from gantools.data import *
from functools import partial
from gantools import blocks
def load_samples_raw(ncubes=None, resolution=256, Mpch=70):
''' Load 2D or 3D raw images
... |
#from PyQt5 import QtCore, Qt, QtGui, QtWidgets, uic
from PyQt5 import QtGui, Qt, QtWidgets, uic
import numpy as np
import os
import sys
import time
from set_to_user_friendly_QLineEdit import set_to_user_friendly_QLineEdit
from catch_exception import *
class WaveformGenerator(QtWidgets.QMainWindow):
fs = 125e6
... |
'''
Neural artistic styler
Based on: Leon A. Gatys, Alexander S. Ecker, Matthias Bethge, "A Neural Algorithm of Artistic Style", arXiv:1508.06576
Examples: https://www.bonaccorso.eu
See also: https://github.com/fchollet/keras/blob/master/examples/neural_style_transfer.py
Giuseppe Bonaccorso (https://www.bonaccorso.eu... |
# coding=utf-8
from core import HackINonE
from core import HackINonECollection
class Sqlmap(HackINonE):
TITLE = "Sqlmap tool"
DESCRIPTION = "sqlmap is an open source penetration testing tool that " \
"automates the process of \n" \
"detecting and exploiting SQL injection fl... |
# -*-coding:utf-8 -*-
"""
@author: yansheng
@file: wzry.py
@time: 2019/9/14
"""
# 爬取王者荣耀的英雄皮肤图片
import requests
import json
import os
def mkdirs(path):
"""
辅助函数:创建文件夹
"""
# 去除首末的空格
path = path.strip()
# 去除尾部 \ 符号
path = path.rstrip("\\")
'''
windows下文件名中不能含有:\ ... |
import numpy as np
from numpy.linalg import norm
import PyMeshUtils
class Boundary(object):
def __init__(self, mesh):
self.__mesh = mesh
if mesh.num_voxels == 0:
self.__init_surface_boundaries()
else:
self.__init_volume_boundaries()
def __init_surf... |
#!/usr/bin/env python
import rospy
import numpy as np
import time
from hlpr_manipulation_utils.msg import RLTransitionPlusReward
from hlpr_manipulation_utils.srv import GetActionFromObs
from color_reacher import ColorReacher
from kinova_msgs.srv import ClearTrajectories
from continuous_cartesian import go_to_relative... |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(r'^(?P<competition_pk>\d+)/$', views.TeamDetailView.as_view(), name='team_detail'),
url(r'^(?P<competition_pk>\d+)/create$', views.TeamCreateView.as_view(), name='team_new'),
url(r'^(?P<competition_pk>\d+)/(?P<t... |
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0
from selenium.common.exceptions import NoSuchElementException # for... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Top Block
# Generated: Wed Aug 14 10:43:17 2019
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.sta... |
import asyncio
import json
import time
from collections import OrderedDict
from datetime import datetime
from unittest import TestCase
import numpy as np
from qcodes.utils.helpers import (is_sequence, permissive_range, wait_secs,
make_unique, DelegateAttributes,
... |
from make_datasets_spark import DatasetConverter
from pyspark.sql import SparkSession
import pyspark.sql.functions as F
from pyspark.sql.functions import udf
from pyspark.sql.types import ArrayType, DoubleType, StringType, IntegerType
from pyspark.sql.window import Window
from pyspark.sql.functions import dense_rank
i... |
import labels
import options
from problems import Problem, Comparator, Heuristics, simulator
from structure import Graph, GPSGraph, DriversGraph, DriversStructure, GraphMLParser, Driver
|
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Example with a single node (ACA CCD temperature) with solar heating
(2 bins) and a heat sink.
"""
import xija
name = __file__[:-3]
model = xija.XijaModel(name, start='2015:001', stop='2015:050')
model.add(xija.Node, 'aacccdpt')
model.add(xija.Pitch... |
from .utils.haab import Haab, HAAB_MONTHS
from .utils.tzolkin import Tzolkin, TZOLKIN_DAYS
from .utils.calendar_round import CalendarRound
from .utils.long_count import LongCount, DistanceNumber, kin_to_long_count
from .utils.mayadate import Mayadate, from_dict
from .utils import *
__all__ = [
"Mayadate",
"L... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
#!/bin/env python2
import operator
import sys
import collections
import matplotlib.pyplot as plt
from oslo.config import cfg
from oslo.db.sqlalchemy import utils as db_utils
import pandas as pd
from subunit2sql.db import api
from subunit2sql.db import models
from subunit2sql import shell
CONF = cfg.CONF
SHELL_OPTS... |
#!/usr/bin/env python3
import pydoc
if __name__ == '__main__':
pydoc.cli()
|
# -*- coding: utf-8 -*-
"""The initialization file for the Pywikibot framework."""
#
# (C) Pywikibot team, 2008-2019
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
__version__ = __release__ = '3.1.dev0'
__url__ = 'https://www.mediawiki... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'coursera.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Impor... |
r"""
Ring `\ZZ/n\ZZ` of integers modulo `n`
EXAMPLES::
sage: R = Integers(97)
sage: a = R(5)
sage: a**100000000000000000000000000000000000000000000000000000000000000
61
This example illustrates the relation between
`\ZZ/p\ZZ` and `\GF{p}`. In
particular, there is a canonical map to `\GF{p}`, but not ... |
from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'geotrek.settings.default')
app = Celery('geotrek')
# Using a string here means the worker ... |
# ▄▀▄ ▄▀▄
# ▄█░░▀▀▀▀▀░░█▄
# ▄▄ █░░░░░░░░░░░█ ▄▄
#█▄▄█ █░░▀░░┬░░▀░░█ █▄▄█
###################################
##### Authors: #####
##### Stephane Vujasinovic #####
##### Frederic Uhrweiller #####
##### #####
##### Creation: 2017 #####
###... |
"""
The adapter pattern for applying stack implementation in python using python
List class as underlying storage"""
class Empty(Exception):
"""Error attempting to access an element from an empty container"""
pass
class AarrayStack:
"""LIFO stack implementation using python list as underlying storage"""
... |
# Standard Library ---------------------------------------------------------------------
import os
from typing import List
# Third Party --------------------------------------------------------------------------
import imageio
from dotenv import load_dotenv
load_dotenv()
PLOTS_DIR = os.getenv("PLOTS_DIR")
GIFS_DIR... |
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
from keras.models import Sequential, Model
from keras.layers import Convolution2D, MaxPooling2D, Conv3D, MaxPooling3D, ZeroPadding3D
from keras.layers import Activation, Dropout, Flatten, Dense, BatchNormalization, Input
f... |
import time
from uuid import uuid4
from http import HTTPStatus
from botocore.exceptions import ClientError
from lambda_decorators import (
cors_headers, json_http_resp, load_json_body
)
from common.util import (
event_body, dynamo_table
)
"""
Author: Ron Nathaniel
Release: Candidate
Course: CS 490: 101
"""
... |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
Reads input from OpenShift v3
"""
import json
import os
from atomic_reactor.plugin import InputPlugin
from atomic_reactor.util import get_build... |
#!/usr/bin/python
#
# Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
from django.db import models
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailsearch import index
from portal.base.models import PageBase
class Page(PageBase):
body = RichTextField()
search_fields = PageBase.search_fields + (
... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 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... |
# Copyright (c) 2012, Cloudscaling
# 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... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... |
# -*- coding: utf-8 -*-
"""This package (along with its subpackages) contains the classes used to model
energy systems. An energy system is modelled as a graph/network of entities
with very specific constraints on which types of entities are allowed to be
connected.
This file is part of project oemof (github.com/oemo... |
import sys
import time
import socket
import requests
import dns.resolver
class tools():
def getMx(self,domain):
mxServers = dns.resolver.query(domain, 'MX')[0].to_text().split(' ')[1]
return mxServers
def checkEmail(self,email,mxserver):
s = socket.socket(socket.AF_INET,socket.SOCK_STR... |
molivi = float(4.75)
fulmasteri = float(1.80)
skicnik = float(6.50)
tetradki = float(2.50)
molivi_number = int(input())
fulmasteri_number = int(input())
skicnik_number = int(input())
tetradki_number = int(input())
sum = (molivi*molivi_number) + (fulmasteri * fulmasteri_number) + (skicnik * skicnik_number) + (tetradk... |
from ape import plugins
from .explorer import Etherscan
NETWORKS = {
"ethereum": [
"mainnet",
"ropsten",
"rinkeby",
"kovan",
"goerli",
],
"fantom": [
"opera",
"testnet",
],
}
@plugins.register(plugins.ExplorerPlugin)
def explorers():
for ec... |
import os
from pathlib import Path
def running_in_docker():
path = '/proc/self/cgroup'
return os.path.exists('/.dockerenv') or os.path.isfile(path) and any('docker' in line for line in open(path))
test_src_dir = Path(r'/cfs/home/s/t/stiebesi/code/tests/test_data')
torch_datasets = test_src_dir / "TestSaveDa... |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1Memory... |
# -*- coding: utf-8 -*-
"""
Calculate the size of a continent you are standing on in your 11 x 11 world in Civilization III.
Bonuses for:
1. calculate continent size for all continents in the world
2. random world generator
3. fastest program
4. benchmarking
5. extension of the problem to n x n size world
As... |
# -*- coding: utf-8 -*-
"""Model page layout and callbacks for isotopomer file content."""
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input
from dash.dependencies import Output
from dash.dependencies import State
from dash.exceptions import PreventUpdate
f... |
from functools import partial
from werkzeug.local import LocalProxy, LocalStack
_domain_ctx_err_msg = """\
Working outside of domain context.
This typically means that you attempted to use functionality that needed
to interface with the current domain object in some way. To solve
this, set up an domain context with d... |
import os
import requests
url = "http://api.openweathermap.org/data/2.5/weather?q={city_name}&appid={API_key}&units=metric"
try:
from keys import weather_key
key = weather_key()
except:
key = os.environ.get('WEATHER_KEY')
def currentweather(City):
if key is None:
return "None", "None"
que... |
import json
import os
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, Group
from django.test import TestCase
from django_grainy.models import GroupPermission, UserPermission
import peeringdb_server.models as models
from peeringdb_server import settings as pdb_settings
class Cl... |
import time
import math
import pigpio
import MadgwickAHRS
"""-----センサ用i2c初期化-----"""
MPU_WHO_AM_I = 0x75 # Read Only
MPU_PWR_MGMT_1 = 0x6B # Read and Write
MPU_ADDRESS = 0x68
MPU_REGISTER = 0x3B # Read Only
BYTE = 14 # データが格納されているbyte数
# ライブラリ初期化
pi = pigpio.pi()
# i2c通信開始
sensor = pi.i2c_open(1, MPU_ADDRESS)
# ... |
import sys
sys.path.append("..")
from config import DEFAULT_TABLE
from logs import LOGGER
def do_count(table_name, milvus_cli):
if not table_name:
table_name = DEFAULT_TABLE
try:
num = milvus_cli.count(table_name)
return num
except Exception as e:
LOGGER.erro... |
#
# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
# This module is free software, and you may redistribute it and/or modify
# under the same terms as Python, so long as this copyright message and
# disclaimer are retained in their original form.
#
# IN NO EVENT SHALL BIZAR SOFTWARE PTY LT... |
#!/usr/bin/python3
#-*-coding:utf-8 -*-
import _thread
import re
import requests
from bs4 import BeautifulSoup
from urllib.parse import urlencode, parse_qs, urlsplit, urlunsplit
from urllib.request import urlretrieve
import urllib.request
import os
import time
# 1024 http request header
# 1024 网站请求头
proxt_1024_req_he... |
#!/usr/bin/python3
class RomanNumeralGenerator(object):
def generator(self, arabic):
roman = self.to_roman(arabic)
return roman
def to_roman(self, number):
roman_number = ""
arabic_remainder = number
if (arabic_remainder >= 1000):
roman_number += 'M'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.