text stringlengths 2 999k |
|---|
import json
import logging
import logging.config
import os
class MyLogger(object):
def __init__(self, name: str):
file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "logging.json")
logging.config.dictConfig(json.load(open(file_path)))
self.logger = logging.getLogger(name... |
from flask import (
Blueprint,
abort,
flash,
redirect,
render_template,
request,
url_for,
make_response,
current_app
)
from flask_login import current_user, login_required
from flask_rq import get_queue
from app import db
from app.admin.forms import (
ChangeAccountTypeForm,
... |
# Copyright 2013 Canonical 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 the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
import logging
from datetime import datetime, timedelta
from integration_tests.utils import populate_mock_db
from src.models import AggregateIntervalPlay, TrackTrendingScore, TrendingParam
from src.tasks.index_aggregate_plays import _update_aggregate_plays
from src.trending_strategies.ML51L_trending_tracks_strategy im... |
import albumentations as albu
import matplotlib.pyplot as plt
import numpy as np
import torch
from torch.autograd import Variable
def matplotlib_imshow(img, one_channel=False):
if one_channel:
img = img.mean(dim=0)
img = img / 2 + 0.5 # unnormalize
npimg = img.numpy()
if one_channel:
... |
"""
SetDefaultParameterValues.py
Author: Jordan Mirocha
Affiliation: University of Colorado at Boulder
Created on 2010-10-19.
Description: Defaults for all different kinds of parameters.
"""
import os, imp
import numpy as np
from ares import rcParams
from ..physics.Constants import m_H, cm_per_kpc, s_per_myr, E_LL
... |
from pypy.module.marshal import interp_marshal
from pypy.interpreter.error import OperationError
from pypy.objspace.std.intobject import W_IntObject
import sys
class AppTestMarshalMore:
spaceconfig = dict(usemodules=('array',))
def test_marshal_bufferlike_object(self):
import marshal, array
s... |
from django.views.generic import ListView
from utils.utils import PaginatorMixin
from django.urls import reverse
from braces.views import LoginRequiredMixin, StaffuserRequiredMixin
from .models import ImageSource
from django.views.generic.edit import FormView
from .forms import ImageUploadForm
# Create your views ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... |
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="farasapy",
version="0.0.13",
author="MagedSaeed",
author_email="mageedsaeed1@gmail.com",
description="A Python Wrapper for the well Farasa toolkit",
long_descriptio... |
#Melhore o jogo do DESAFIO 028 onde o computador vai "pensar" em um número entre 0 e 10.
# Só que agora o jogador vai tentar adivinhar até acertar, mostrando no final quantos palpites foram necessários para vencer.
import random
from time import sleep
num = random.randint(0, 10)
numtent = 1
print('-=-'*20)
print('Vo... |
#
# PySNMP MIB module CISCO-DYNAMIC-TEMPLATE-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DYNAMIC-TEMPLATE-TC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:39:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... |
from collections import Iterable
import numpy as np
def format_float(value):
"""Nice float formatting into strings."""
return f'{value:0.3g}'
def status_format(value):
"""Return a "nice" string representation of a value.
Parameters
----------
value : any type
The value to be printed... |
from __future__ import print_function
import pickle
import os.path
import io
# noinspection PyPackageRequirements
from googleapiclient.http import MediaIoBaseDownload
# noinspection PyPackageRequirements
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
# noinspection Py... |
import os
import subprocess
dir_path = os.path.dirname(os.path.realpath(__file__))
dir_path = dir_path.replace('\\', '/')
for root, dirs, files in os.walk(dir_path):
for file in files:
if file.endswith(".png"):
input_file = os.path.join(root, file)
output_file = input_file.replace("... |
import math
import random
def weighted_draw(probs):
z = random.random() # between 0 and 1
cumulative_prob = 0.0
for i, prob in enumerate(probs):
cumulative_prob += prob
if cumulative_prob > z:
return i
return len(probs) - 1 # last index
class AnnealingSoftmax:
def _... |
from chessgame.piece import Piece
class Bishop(Piece):
def __init__(self, color: bool):
super().__init__(color)
def available_moves(self):
"""
:return moves: list:
"""
moves = []
# TODO: create the rules for the bishop to move
# TODO: create the rul... |
"""Cryptocurrency Discovery Controller"""
__docformat__ = "numpy"
# pylint: disable=R0904, C0302, W0622, C0201
import argparse
import difflib
from typing import List, Union
from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.helper_funcs im... |
import torch
import torch.nn.functional as F
from yolact.layers.box_utils import decode, jaccard, index2d
from yolact.utils import timer
from yolact.data import cfg, mask_type
import numpy as np
class Detect(object):
"""At test time, Detect is the final layer of SSD. Decode location preds,
apply non-maximu... |
import _plotly_utils.basevalidators
class BarmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name='barmode', parent_name='layout.polar', **kwargs
):
super(BarmodeValidator, self).__init__(
plotly_name=plotly_name,
parent_name... |
#!/usr/bin/env python
import argparse
import os
from distutils.spawn import find_executable
from flask import Flask
from os.path import dirname
from puncover.collector import Collector
from puncover.builders import ElfBuilder
from puncover.middleware import BuilderMiddleware
from puncover import renderers
from puncove... |
import json
import pytz
import datetime
from urllib.parse import urlsplit, parse_qsl, urlencode, urlunsplit, SplitResult
class JSONEncoderPlus(json.JSONEncoder):
"""
JSONEncoder that encodes datetime objects as Unix timestamps.
"""
def default(self, obj, **kwargs):
if isinstance(obj, (datetime... |
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-server/
# The scancode-server software is licensed under the Apache License version 2.0.
# Data generated with scancode-server require an acknowledgment.
#
# You may not use this software except in c... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-12-31 22:00
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mascotas', '0010_estado'),
]
operations = [
... |
import os
from pathlib import Path
from gendiff.parser import parse_data
from gendiff.formatter import format_tree
from gendiff.tree import make_diff
def get_format(path):
return Path(path).suffix.lower()[1:]
def generate_diff(path1, path2, out_format='stylish'):
data1 = open(os.path.abspath(path1))
dat... |
# Generated by Django 2.1.7 on 2019-03-23 10:52
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('main', '0002_auto_20190323_1255'),
]
operations = [
migrations.RemoveField... |
from os import path
from setuptools import setup, find_packages
this_dir = path.abspath(path.dirname(__file__))
with open(path.join(this_dir, "README.md"), encoding="utf-8") as f:
long_description = f.read()
setup(
name="smarts",
description="Scalable Multi-Agent RL Training School",
long_description=... |
import random
import math
import torch
from torch import nn, Tensor
import torchvision
from torch.jit.annotations import List, Tuple, Dict, Optional
from torchvision.ops import misc as misc_nn_ops
from .image_list import ImageList
from .roi_heads import paste_masks_in_image
@torch.jit.unused
def _resize_image_and_ma... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-09 14:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('houses', '0091_auto_20170109_1536'),
]
operations = [
migrations.AddField(
... |
import os
import re
import yaml
import glob
import urllib
from functools import wraps
from flask import request, abort, current_app, url_for
from flask.ext.login import current_user
from flask.ext.babel import gettext as _, lazy_gettext as _l
from sqlalchemy.orm import class_mapper
from munimap.model import Protecte... |
# -----------------------------------------------------------------------------
# Copyright (c) Equinor ASA. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------
"""Test cas... |
#!/usr/bin/env python
# Needed for antipackage with python 2
from __future__ import absolute_import
import datetime
import fnmatch
import glob
import io
import json
import os
import os.path
import re
import socket
import subprocess
import sys
from collections import OrderedDict
from os.path import expandvars
REPO_R... |
import rope.base.pyobjects
from rope.base import exceptions, utils
class PyName(object):
"""References to `PyObject`\s inside python programs"""
def get_object(self):
"""Return the `PyObject` object referenced by this `PyName`"""
def get_definition_location(self):
"""Return a (module, li... |
from flax.protocols import full_node_protocol, introducer_protocol, wallet_protocol
from flax.server.outbound_message import NodeType
from flax.server.ws_connection import WSFlaxConnection
from flax.types.mempool_inclusion_status import MempoolInclusionStatus
from flax.util.api_decorators import api_request, peer_requi... |
# encoding=utf8
import sys
import random
import logging
from numpy import asarray, savetxt, set_printoptions
from NiaPy import Runner
from NiaPy.util import Task, TaskConvPrint, TaskConvPlot, OptimizationType
from cecargparser import getDictArgs
logging.basicConfig()
logger = logging.getLogger('cec_run')
logger.setLe... |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .viewsets import (
PaymentTransactionViewSet,
TaskerPaymentAccountViewSet,
TaskerWalletViewSet,
PaymentMethodViewSet,
CustomerWalletViewSet,
)
router = DefaultRouter()
router.register("taskerwallet", TaskerW... |
from azureml.core import Workspace, Experiment, ScriptRunConfig
ws = Workspace.from_config()
compute_target = ws.compute_targets['V100-4']
# compute_target = ws.compute_targets['K80']
command = [
"pip install torch transformers datasets flaml[blendsearch,ray] && ",
"python test_electra.py"]
config = ... |
from disco.test import TestCase, TestPipe
from disco.worker.pipeline.worker import Stage
from disco.compat import str_to_bytes
def map(interface, state, label, inp):
out = interface.output(0)
for e in inp:
out.add(e, '')
class RawJob(TestPipe):
pipeline = [("split", Stage("map", process=map))]
cl... |
"""
The main file used to train student and teacher models. Mainly based on [GitHub repository](https://github.com/intersun/PKD-for-BERT-Model-Compression) for [Patient Knowledge Distillation for BERT Model Compression](https://arxiv.org/abs/1908.09355).
"""
import logging
import os
import random
import pickle
import... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import json
from unittest import TestCase, main
from copy import deepcopy
import torch
from nni.algorithms.hpo.networkmorphism_tuner import NetworkMorphismTuner
from nni.algorithms.hpo.networkmorphism_tuner.graph import graph_to_json, json_to_gr... |
from difflib import SequenceMatcher
class OverallDetails:
def __init__(self, db):
self.db = db
self.retrieve_table_name_query = "SELECT table_name FROM information_schema.tables where table_schema='" + \
db.database_name + "'"
self.tables = list()
self.t... |
import unittest
from app.models import User
class UserModelTest(unittest.TestCase):
def setUp(self):
'''
testcase to create an instance of User class.
'''
self.new_user = User(password = 'banana')
def test_password_setter(self):
'''
testcase to ... |
import matplotlib.pyplot as plt
import numpy as np
data = {
'Chipotle': 0.4,
'Qdoba': 0.3,
'Local Chain': 0.1,
'Taco Bell': 0.2}
restaurants, pcs = list(data.keys()), list(data.values())
y = 100 * np.array(pcs)
x = np.arange(len(y))
width = 0.4
fig, ax = plt.subplots()
ax.set_ylabel('%')
ax.set_titl... |
"""Utility functions to help with pure numpy stuff."""
from typing import TypeVar
import numpy as np
import scipy.linalg as la
# Type variable for ArrayLike arguments
FloatArrayLike = TypeVar("FloatArrayLike", float, np.ndarray)
def save_ndarray_list(fname, la):
"""Save a list of numpy arrays to disk.
Thi... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/... |
import numpy as np
STRUCT_FORMAT_ALIASES = {"c": "B", "l": "i", "L": "I"}
class Resource:
pass
class Buffer(Resource):
"""A buffer object represents a piece of memory to the GPU, that can be
used as index buffer, vertex buffer, uniform buffer, or storage buffer.
You can provide (and update data for... |
# from __future__ import division, print_function, absolute_import
import numpy as np
from dipy.viz.colormap import colormap_lookup_table
from dipy.viz.utils import lines_to_vtk_polydata
from dipy.viz.utils import set_input
# Conditional import machinery for vtk
from dipy.utils.optpkg import optional_package
# Allo... |
from . import cli, server # noqa: F401
|
import numpy as np
from ctapipe.image.cleaning import mars_cleaning_1st_pass
try:
from pywicta.denoising.wavelets_mrtransform import WaveletTransform
from pywicta.denoising import cdf
from pywicta.denoising.inverse_transform_sampling import EmpiricalDistribution
from pywicta.io import geometry_converte... |
#!/usr/bin/env python
from datetime import datetime
from bs4 import BeautifulSoup
def count_word(content):
# return 10
# counts the words
words = content.split(' ')
return len(words)
# BSoup can read from a string or a file handle to parse XML/HMTL
with open('data/movies.xml') as handle:
soup =... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
from cv2 import VideoCapture, imwrite
from tqdm import tqdm
import os
path = os.path.abspath(os.path.dirname(__file__))
images = f"{path}/data/images"
videos = f"{path}/data/videos"
listdir = os.listdir(videos)
# parameter
interval = 1
for rep in listdir:
cap = VideoCapture(videos+'/'+rep)
if not cap.isOpen... |
#!/usr/bin/env python3
"""
Bundle into an sdist-like tar.gz an installed python module suitable
for unzipping into a robot's python site-packages directory.
"""
import argparse
import io
import os
import tarfile
import pkg_resources
def build_tar(pkgname: str, outdir: str):
os.makedirs(outdir, exist_ok=True)
... |
import math
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
df = pd.read_csv('h... |
#**********************************************************************
# Copyright 2020 Advanced Micro Devices, 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.o... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Hoverlabel(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "splom"
_path_str = "splom.hoverlabel"
_valid_props = {
"align",
"alignsr... |
# -*- coding: utf8 -*-
# Copyright (c) 2019 Niklas Rosenstein
#
# 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, mo... |
import FreeCAD
import FPEventDispatcher
from FPInitialPlacement import InitialPlacements
import FPSimServer
import FPUtils
pressEventLocationXY = dict()
rotationAngleAtPress = dict()
class FPSimRotaryPotentiometer(InitialPlacements):
def __init__(self, obj):
InitialPlacements.__init__(self, obj)
o... |
"""Tokenize recipes."""
import _pickle as pickle
from os import path
from nltk.tokenize import word_tokenize
from nltk import download
import config
import prep_data
from parse_ingredients import parse_ingredient_list
def tokenize_sentence(sentence):
"""Tokenize a sentence."""
try:
return ' '.join(li... |
from django.http.response import HttpResponseRedirect
from django.shortcuts import render, redirect
from django.urls import reverse
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login as session_login, logout as session_logout
from .models import JokeCount
imp... |
"""
@Pedro Santana Abreu (https://linktr.ee/pedrosantanaabreu)
@Icev (https://somosicev.com)
PT-BR:
Desenvolva um algoritmo que receba as informações
necessárias, calcule e exiba o valor do salário líquido de um
trabalhador, detalhando o valor calculado para o INSS e
imposto de renda.
"""
# Recebendo valores
salario_... |
# Copyright 2017 The TensorFlow 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 applica... |
import pytest
import warnings
from unittest import TestCase
from biocrnpyler.sbmlutil import *
from biocrnpyler.species import Species, Complex
from biocrnpyler.compartments import Compartment
from biocrnpyler.propensities import MassAction, HillPositive, HillNegative, ProportionalHillPositive, ProportionalHillNegative... |
import json
import random
import requests
import string
import time
HEADERS = {
"Content-Type": "application/json"
}
field1 = ['a', 'b', 'c', 'd', 'e']
field2 = [1, 2, 3, 4, 5]
def create_table(table):
request = {
"name": table,
"ttl": 30
}
requests.post(url="http://localhost:17000/f... |
"""
An example of creating an MPI Logger to be used directly with
structlog.
Example
-------
>>> import structlog
>>> from mpi_logger import MPIStreamIO, MPILoggerFactory, DEFAULT_PROCESSORS
>>> out_stream = MPIStreamIO('example.log')
>>> structlog.configure(
processors=DEFAULT_PROCESSORS,
logger_factor=MPILoggerFact... |
# Base class. Uses a descriptor to set a value
class Descriptor:
def __init__(self, name=None, **opts):
self.name = name
self.__dict__.update(opts)
def __set__(self, instance, value):
instance.__dict__[self.name] = value
# Descriptor for enforcing types
class Typed(Descriptor):
exp... |
#####################################################################################
# MIT License #
# #
# Copyright (C) 2019 Charly Lamothe, Guillaume Ollier, Bal... |
"""
Author:
Yiqun Chen
Docs:
Main functition to run program.
"""
import sys, os, copy
import torch, torchvision
from configs.configs import cfg
from utils import utils
from models import model_builder
from data import data_loader
from generate import generate
def main():
# Build model.
model = model... |
import socket
HOSTS = [
'apu',
'pymotw.com',
'www.python.org',
'nosuchname',
]
for host in HOSTS:
try:
name, aliases, addresses = socket.gethostbyname_ex(host)
print('Hostname:',name)
print('Aliases:',aliases)
print('Addresses:',addresses)
except... |
# 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.
# C... |
import unittest
from unittest.mock import patch
from broker import Receiver, Sender
from configuration import QUEUE_NAME
class TestReceiver(unittest.TestCase):
@patch('broker.pika')
def test_receiver(self, mock_pika):
r = Receiver()
r.connect()
r.queue = QUEUE_NAME
r.declare_q... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reorderList(self, head: ListNode) -> None:
"""
Do not return anything, modify head in-place instead.
"""
# 1.find... |
#
# Copyright 2020 Logical Clocks 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 ag... |
import os
import sys
import argparse
import torch
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.join(__file__, os.pardir))))
from allennlp.common.tqdm import Tqdm
from allennlp.common import Params
from allennlp.models.archival import load_archive
from allennlp.data.iterators import BasicIterator
from ... |
"""
File description.
This file is mainly to load some response of the home page
such as the title of the article, the author, fill a few, etc.
encoding: utf-8
@author: Zhang Jiajun
@contact: jz272381@gmail.com
@software: Pycharm
@time: 2022/1/12
@gituhb: sanxiadaba/pythonBlog
"""
import math
from flask import Blue... |
# 자작 문제풀이
# Question number. 003
# Author: Lee Jeongwoo
# Github name: zao95
# ========== Question ==========
# python-packer를 이용하여 실행파일 제작
# ==============================
def abc():
print("a")
abc()
print(hex(id(abc())))
print(hex(id("abc"))) |
"""
An app script for running calibration of a camera from the command line.
Copyright (C) Microsoft Corporation. All rights reserved.
"""
# Standard Libraries.
import argparse
# Calibration tools.
from camera_tools import calibrate_camera
# --------------------------------------------------------------------------... |
#!/usr/bin/env python3
# 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
# "L... |
# --------------------------------------------------------
# OpenVQA
# Written by Yuhao Cui https://github.com/cuiyuhao1996
# --------------------------------------------------------
from importlib import import_module
class DatasetLoader:
def __init__(self, __C):
self.__C = __C
self.dataset = __... |
"""
Django settings for the_goutam_behera_34028 project.
Generated by 'django-admin startproject' using Django 2.2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, pointless-string-statement
import os
import pytest
from ..api import guessit, properties, GuessitException
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__f... |
#############################################################################
#
#
# Base Request Handler network Module to BFA Master
#
#
#############################################################################
""" This module handles base requests from the BFA Client. Comments in this file and the corresponding... |
# Generated by Django 2.2.1 on 2019-06-07 14:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('babybuddy', '0006_auto_20190502_1744'),
]
operations = [
migrations.AlterField(
model_name='settings',
name='languag... |
"""Netmiko Cisco WLC support."""
from typing import Any, Union, Sequence, TextIO
import time
import re
import socket
from netmiko.exceptions import NetmikoAuthenticationException
from netmiko.base_connection import BaseConnection
class CiscoWlcSSH(BaseConnection):
"""Netmiko Cisco WLC support."""
def __init... |
from pyteal import *
from .math import ilog10
ascii_offset = Int(48) # Magic number to convert between ascii chars and integers
@Subroutine(TealType.uint64)
def ascii_to_int(arg: TealType.uint64):
return arg - ascii_offset
@Subroutine(TealType.bytes)
def int_to_ascii(arg: TealType.uint64):
# return arg +... |
from ignite.metrics import Metric
from ignite.exceptions import NotComputableError
# These decorators helps with distributed settings
from ignite.metrics.metric import sync_all_reduce, reinit__is_reduced
import torch
import pandas as pd
import argparse
import os
import numpy as np
class ContactPredictionMetrics(Metr... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
# -*- coding: utf-8 -*-
from allink_core.core.loading import get_model
from allink_core.core.sitemap import HrefLangSitemap
People = get_model('people', 'People')
class PeopleSitemap(HrefLangSitemap):
changefreq = "never"
priority = 0.5
i18n = True
def __init__(self, *args, **kwargs):
self... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-20 17:44
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('references', '0005_auto_20160920_1732'),
]
operations = [
migrations.RenameField(
... |
from flask import request
from flask import Flask
import datetime
import json
from GPG_Functions import GPG_Functions
from Database_Functions import Database_Functions
# all api Functions
def startApi(db, privatekey , publickey):
print("Starting API")
app = Flask("SecApi")
@app.route('/')
def index()... |
from django.urls import path, include
from . import views
app_name= "challenges"
urlpatterns = [
path('',views.home,name='challenges-home'),
#path('robots/robots.txt',views.read_file,name='robots_txt')
] |
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... |
"""
Submodules of Hecke modules
"""
# ****************************************************************************
# Sage: System for Algebra and Geometry Experimentation
#
# Copyright (C) 2005 William Stein <wstein@gmail.com>
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# T... |
import mmcv
import numpy as np
import torch
class Charset:
def __init__(self, vocab_path):
self.vocab_dict = mmcv.load(vocab_path)
self.BOS_TOKEN = self.vocab_dict['stoi']['<s>']
self.EOS_TOKEN = self.vocab_dict['stoi']['</s>']
self.UNKNOWN_TOKEN = self.vocab_dict['stoi']['<unk>']
... |
import os
import pprint
import tensorflow as tf
# from VanillaInfoGAN import VanillaInfoGAN
from InfoDCGAN import InfoDCGAN
pp = pprint.PrettyPrinter()
flags = tf.app.flags
flags.DEFINE_integer('input_dim', 784, 'dimension of the discriminator input placeholder [784]')
flags.DEFINE_integer('z_dim', 14, 'dimension ... |
def read_token(token='NjE2MDkyNzUwMDUxNDA5OTI4.XWXmOw.KHpmNS6gQQupNcMv8I8d5KxKOG8'):
return token
|
"""Test file loaders."""
|
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"say_hello": "00_core.ipynb"}
modules = ["core.py"]
doc_url = "https://blackcherry88.github.io/test_nbdev/"
git_url = "https://github.com/blackcherry88/test_nbdev/tree/master/"
def custom_doc_links(name):... |
# --------------
#Importing header files
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Path of the file
data = pd.read_csv(path)
#Code starts here
data.rename(columns={"Total":"Total_Medals"},inplace=True)
data.head(10)
# --------------
#Code starts here
df = pd.DataFrame(data... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.