text stringlengths 1 927k |
|---|
import os
import re
import math
import json
import tempfile
import zipfile
import bagit
import asyncio
from datetime import datetime
from asyncio import events
from ratelimit import sleep_and_retry
from ratelimit.exception import RateLimitException
from aiohttp import ClientSession, http_exceptions
import internetarch... |
from . import Entity
class Meet(Entity):
"""A meet represents a collection of races occurring at a given track on a given date"""
def __str__(self):
return '{track} on {date:%Y-%m-%d}'.format(track=self['track'], date=self['date'].astimezone(self.provider.local_timezone))
@property
def has_... |
"""
:created: 2017-09
:author: Alex BROSSARD <abrossard@artfx.fr>
"""
from PySide2 import QtWidgets, QtCore, QtGui
from pymel import core as pmc
from auri.auri_lib import AuriScriptView, AuriScriptController, AuriScriptModel, is_checked, grpbox
from auri.scripts.Maya_Scripts import rig_lib
from auri.scripts.Maya_Scri... |
#!/usr/bin/python3
"""https://stackoverflow.com/questions/3362600/how-to-send-email-attachments"""
import argparse
import json
import smtplib
from os.path import basename
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.ut... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack 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 requ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 OpenStack Foundation
# 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.apac... |
import factory
from faker import Faker
from faker.providers import lorem # type: ignore
from organization.tests.factory import OrganizationFactory
faker = Faker()
faker.add_provider(lorem)
class ClientIndustryFactory(factory.django.DjangoModelFactory):
"""Client industry factory"""
class Meta:
mo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np
from gmprocess.core.streamcollection import StreamCollection
from gmprocess.io.read import read_data
from gmprocess.utils.test_utils import read_data_dir
from gmprocess.utils.config import get_config
from gmprocess.waveform_processing.window... |
# Copyright 2013 David Malcolm <dmalcolm@redhat.com>
# Copyright 2013 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
from os.path import split
class Miniconda3(Package):
"""The minimalist bootstrap toolset for con... |
#!/usr/bin/env python
# (c)2010-2012 the Boeing Company
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
#
# List and stop CORE sessions from the command line.
#
import optparse
import socket
from core.api.tlv import coreapi
from core.emulator.enumerations import CORE_API_PORT, MessageFlags, SessionTlvs
de... |
"""
Entry point for training and evaluating a lemmatizer.
This lemmatizer combines a neural sequence-to-sequence architecture with an `edit` classifier
and two dictionaries to produce robust lemmas from word forms.
For details please refer to paper: https://nlp.stanford.edu/pubs/qi2018universal.pdf.
"""
import loggi... |
from itertools import repeat
from collections import Iterable
import vtk
from .color import RED
def linear_path(xyz_list,
color=RED,
alpha=1):
"""
"""
N = len(xyz_list)
if not isinstance(color[0], Iterable):
color = repeat(color, N)
if not isinstance(alp... |
from django.urls import path
from Emailer.authentication.views import LoginView, RegisterView, EditProfileView, LogoutView
urlpatterns = [
path("login", LoginView.as_view(), name="login"),
path("register", RegisterView.as_view(), name="register"),
path("edit-profile", EditProfileView.as_view(), name="edit-... |
import os
import sys
import re
import socket
import pytz
import urllib.request, urllib.parse, urllib.error
import json
from datetime import datetime
from urllib.parse import urljoin
from datetime import datetime, time
from flask import Flask, render_template, request, url_for, Response
from flask_assets import Environm... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# This file is auto-generated by h2o-3/h2o-bindings/bin/gen_python.py
# Copyright 2016 H2O.ai; Apache License Version 2.0 (see LICENSE for details)
#
from __future__ import absolute_import, division, print_function, unicode_literals
from h2o.estimators.estimator_base ... |
# ---------------------------------------------------------------------
# IBM.NOS.get_mac_address_table
# ---------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
imp... |
import entrypoints
from databroker import Broker
def test_load_catalogs():
# Loads all of the catalogs and checks that they are of type Broker.
for key, entry in entrypoints.get_group_named('intake.catalogs').items():
assert isinstance(entry.load(), Broker) |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... |
#ABC045d
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6) |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyNbconvert(PythonPackage):
"""Jupyter Notebook Conversion"""
homepage = "https://github.com/jupyter/nbcon... |
import math
if __name__ == '__main__':
a = int(input())
b = int(input())
max = pow(10, 10)
if a > 1 and a < max:
if b > 1 and b < max:
sum_ = a + b
diff_ = a - b
prod_ = a * b
print(sum_)
print(diff_)
print(prod_)
e... |
# Copyright 2013 Red Hat, 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... |
# Documento responsavel por conter classes e/ou funcoes auxiliares
# TODO escrever controlador de logica para estruturar melhor o projeto
from enum import Enum
class Coord: # Classe auxiliar
def __init__(self, x, y):
self.x = x;
self.y = y;
class SceneState(Enum):
EMPTY = 0,
CREATED = 1,
... |
# 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 distutils.core import setup
import os
from psshlib import version
long_description = """PSSH (Parallel SSH) provides parallel versions of OpenSSH and related tools, including pssh, pscp, prsync, pnuke, and pslurp. The project includes psshlib which can be used within custom applications."""
setup(
name = "p... |
from setuptools import setup
package_name = 'tf2_tools'
setup(
name=package_name,
version='0.26.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
],
inst... |
#!/usr/bin/env python
# Author: Trevor Sherrard
# Course: Directed Research
# Since: 02/06/2021
# Description: This script extracts synced RGB and Depth frames from
# the kinect and attempts to locate a given vision target.
# if the vision target is located, the XYZ coordinates are
# ... |
from django.core import urlresolvers
from django.contrib.sitemaps import Sitemap
class GeoRSSSitemap(Sitemap):
"""
A minimal hook to produce sitemaps for GeoRSS feeds.
"""
def __init__(self, feed_dict, slug_dict=None):
"""
This sitemap object initializes on a feed dictionary (as would b... |
# pylint:disable=too-many-lines
# SPDX-FileCopyrightText: Copyright (c) 2020 Bryan Siepert for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_bno08x`
================================================================================
Helper library for the Hillcrest Laboratories BNO08x IMUs
* Author... |
import random
from model.contact import Contact
def test_delete_some_contact(app, db, check_ui):
if len(db.get_contacts_list()) == 0:
app.form.create(Contact(first_name="VVVVVVV"))
old_contacts_list = db.get_contacts_list()
user = random.choice(old_contacts_list)
app.form.delete_contact_by_id(... |
"""
Django settings for app project.
"""
# pylint: disable=invalid-name
import os
import environ
from django.utils.translation import gettext_lazy as _
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# Load environment variables from .env
env = environ.Env()
env_file = os.path.join(BASE_DIR, ".env")
if os.path.... |
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path("admin/", admin.site.urls),
path("accounts/", include("allauth.urls")),
path("", include("temperatures.urls", namespace="temperatures")),
] |
'''ResNet in PyTorch.
For Pre-activation ResNet, see 'preact_resnet.py'.
Reference:
[1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
Deep Residual Learning for Image Recognition. arXiv:1512.03385
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
expansi... |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... |
# Reverse Linked List
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def __repr__(self):
tail = "<EMPTY>" if self.next is None else repr(self.next)
return f"{self.val} - {tail}"
class Solution:
def... |
import argparse
import csv
import itertools
import json
import math
import subprocess
import sys
import time
# Copy a file to a given host through scp, throwing an exception if scp fails
def scp(host, identity_file, user, local_file, dest_file):
subprocess.check_call(
"scp -q -o StrictHostKeyChecking=no -i %s ... |
#!/usr/bin/env python3
#
# Electrum ABC - lightweight eCash client
# Copyright (C) 2020 The Electrum ABC developers
# Copyright (C) 2014 Thomas Voegtlin
#
# 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 t... |
import time
import numpy as np
import torch
import torch.nn as nn
import pixelssl
def add_parser_arguments(parser):
pixelssl.criterion_template.add_parser_arguments(parser)
def deeplab_criterion():
return DeepLabCriterion
class DeepLabCriterion(pixelssl.criterion_template.TaskCriterion):
def __init_... |
# 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.
# -----------------------------------------------------... |
import time
import cwiid
import pyev3
WAIT_TIME = 0.008 # Seconds 0.008
WHEEL_RATIO_NXT1 = 1.0
WHEEL_RATIO_NXT2 = 0.8
WHEEL_RATIO_RCX = 1.4
KGYROANGLE = 7.5
KGYROSPEED = 1.15
KPOS = 0.07
KSPEED = 0.1
KDRIVE = 0.000
KSTEER = 1.0
EMAOFFSET = 0.0001
TIME_FALL_LIMIT = 1 # Seconds
def clamp(value, lower, upper):
re... |
"""Module with I/O functions."""
import numpy
from matplotlib import pyplot
def plot_vector(gridx, gridy, ivar):
"""Plot the vector for given x, y data.
Arguments
---------
gridx : Grid object
Grid containing the data on x-face.
gridy : Grid object
Grid containing the data on y-f... |
RESOLUTION = (1024, 768) |
# from os import environ
import configparser
import json
import os.path
from logging import getLogger
from codev.core.source import Source
from codev.core.providers.machines import VirtualenvBaseMachine
from codev.core.installer import Installer
from codev.core.settings import BaseSettings, ProviderSettings
from codev... |
# -*- coding: utf-8 -*-
from google.appengine.ext import ndb
__author__ = 'oon arfiandwi'
class DiloEvent(ndb.Model):
"""using Google Datastore as Database
this is Model to save DILo Makassar events.
"""
link = ndb.StringProperty(required=True, indexed=True)
title = ndb.StringProperty(required=... |
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... |
import datetime
import posixpath
from enum import Enum
from fastapi import Form
from pydantic import BaseConfig, BaseModel
from typing import Dict, List, Optional, Set, Type
from ultitrackerapi import ANNOTATION_EXPIRATION_DURATION, ULTITRACKER_AUTH_JWT_ALGORITHM, get_logger
logger = get_logger(__name__)
# NOTE:... |
import pyautogui as pag
pag.moveTo(459,220,0)
pag.scroll(0,10) |
from ..IPacket import IPacket
class AllyHit(IPacket):
"Sent by client when an ally has been hit by a projectile"
def __init__(self):
self.time = 0
self.projectileID = 0
self.objectID = 0
def Read(self, r):
self.time = r.ReadInt32()
self.projectileID = ... |
# 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, ... |
import json
import requests
from app.settings import TOKEN
TELEGRAM_URL_API = 'https://api.telegram.org/bot'
def __build_url(method):
url = '{}{}/{}'.format(TELEGRAM_URL_API, TOKEN, method)
return url
def __post(url, body, params=dict()):
"""
Internal post
:param url:
:param body:
:pa... |
import torch
import numpy as np
import unittest
from his_evaluators.metrics import register_metrics
DEVICE = torch.device("cuda:0")
class MetricTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.paired_metric_dict = register_metrics(types=("ssim", "psnr", "lps"), device=DE... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import torch
import torch.nn as nn
class Flatten(nn.Module):
"""Convenience class that flattens feature maps to vectors."""
def forward(self, x):
# Required for pretrained weights for some reason?
x = x.transpose(3, 2).contiguous()
retur... |
# coding: utf-8
"""
To run:
python2.7 3.py
Problem:
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
"""
import math
import time
NUMBER = 600851475143
def oneliner():
"""
This will "loop" until sqrt(N), which in this case is signifi... |
# -*- coding: utf-8 -*-
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse_lazy
from django.views import View
from explorer import app_settings
from explorer.forms import QueryForm
from explorer.models import Query, QueryLog, MSG_FAILED_BLACKLIST... |
import XBee_Threaded
from time import sleep
if __name__ == "__main__":
xbee = XBee_Threaded.XBee("/dev/ttyACM2") # Your serial port name here
# A simple string message
sent = xbee.SendStr("Hello World")
Msg = xbee.Receive()
if Msg:
content = Msg[7:-1].decode('ascii')
print("Msg: "... |
name = "preprocess_NLP_pkg"
from .load_data import *
from .distance_measures import *
from .feature_selection import *
from .text_processing import *
from .corpus_processor import *
from .stats import * |
#!/usr/bin/env python
# Copyright 2011 Google Inc. All Rights Reserved.
"""Tests for grr.parsers.chrome_history."""
import datetime
import os
from grr.lib import flags
from grr.parsers import chrome_history
from grr.test_lib import test_lib
class ChromeHistoryTest(test_lib.GRRBaseTest):
"""Test parsing of chrom... |
from pyfingerprint.pyfingerprint import PyFingerprint
from pyfingerprint.pyfingerprint import FINGERPRINT_CHARBUFFER1
from pyfingerprint.pyfingerprint import FINGERPRINT_CHARBUFFER2
#from src.mongo import check_person_in_biometrics
from time import sleep
from src.lcd import lcd_write
f = PyFingerprint('/dev/ttyUSB0',... |
#
# Copyright 2017 The E2C 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 applicable l... |
sexo = 'a'
while sexo != 'F' and sexo != 'M':
sexo = str(input('\033[mDigite seu sexo [M/F]: ').upper().strip()[0])
if sexo != 'M' and sexo != 'F':
print('\033[31mDigite um valor válido!!')
print('Sexo {} registrado com sucesso!'.format(sexo)) |
#!/usr/bin/env python
from lib.crc32 import crc32_hash
from multiprocessing.queues import JoinableQueue
try:
import threading as _threading
except ImportError:
import dummy_threading as _threading
class VbucketHelper:
@staticmethod
def get_vbucket_id(key, num_vbuckets):
vbucketId = 0
... |
import pytest
import datagen.builder as builder
from datagen import distributions, DataSpec, SpecException
def test_api_builder():
# raw data for both specs
animal_names = ['zebra', 'hedgehog', 'llama', 'flamingo']
action_list = ['fling', 'jump', 'launch', 'dispatch']
domain_weights = {
"gmail... |
"""
This module lets you practice:
-- ITERATING (i.e. LOOPING) through a SEQUENCE
-- Using OBJECTS
-- DEFINING functions
-- CALLING functions
Authors: David Mutchler, Dave Fisher, Valerie Galluzzi, Amanda Stouder,
their colleagues and Michelle.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
import ... |
# Copyright (c) ByteDance, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""
Mostly copy-paste from beit, timm, mmseg, setr, xcit and swin code bases
https://github.com/microsoft/unilm/tree/maste... |
from django.shortcuts import render, get_object_or_404
from .models import Category, Product
from cart.forms import CartAddProductForm
from django.views.generic import (
ListView,
DetailView
)
'''
class ProductListView(ListView):
template_name = 'shop/product/list.html'
queryset = Product.objects.all(... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""
.. _l-custom-model:
Write your own converter for your own model
===========================================
It might happen that you implemented your own model
and there is obviously no existing converter for this
new m... |
# Copyright 2018-2020 Streamlit 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 wr... |
#!/usr/bin/env python3
from cereal import car
from selfdrive.config import Conversions as CV
from selfdrive.swaglog import cloudlog
import cereal.messaging as messaging
from selfdrive.car import gen_empty_fingerprint
from selfdrive.car.interfaces import CarInterfaceBase
# mocked car interface to work with chffrplus
TS... |
# Copyright (c) 2022, test and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class Terms(Document):
pass |
# Copyright (c) Microsoft Corporation
# 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
#
# THIS CODE IS PROVIDED *AS IS*... |
# Generated by Django 2.1.5 on 2019-02-09 18:18
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('quiz', '0004_answer_stud'),
]
operations = [
migrations.AlterField(
model_name='stud',
... |
from apitax.drivers.Driver import Driver
from apitax.utilities.Files import getAllFiles
from apitax.ah.Options import Options
from pathlib import Path
from apitax.ah.Credentials import Credentials
class ApitaxInfoDriver(Driver):
def isApiAuthenticated(self):
return False
def isTokenable(self):
... |
# Copyright 2020-2021 OpenDR European Project
#
# 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/python3
"""
HyDE Downloading Tool - NWP GEFS 0.25
__date__ = '20210914'
__version__ = '1.0.0'
__author__ =
'Andrea Libertino (andrea.libertino@cimafoundation.org',
'Fabio Delogu (fabio.delogu@cimafoundation.org',
__library__ = 'HyDE'
General command line:
python3 hyde_downloader_nwp_gefs_n... |
from unittest import mock
import pytest
from nanopub import profile
@mock.patch('nanopub.profile.get_profile', return_value={'orcid_id': ''})
def test_no_orcid_id(mock_get_profile):
with pytest.raises(profile.ProfileError):
profile.get_orcid_id() |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from KalinaUtility import Kalina
from Define import Utility
from KalinaUtility import KalinaUtility
# from KalinaWBMonitor import WeiboMonitor
import KalinaCD
import KalinaData
from qqbot import qqbotsched
import random
import time
def onStartupComplete(bot):
"""
... |
#!/usr/bin/env python3
# Creates a ghostunnel. Ensures when server disconnects that the client
# connection also disconnects.
from subprocess import Popen
from test_common import *
import socket, ssl
if __name__ == "__main__":
ghostunnel = None
try:
# create certs
root = RootCert('root')
root.create_... |
from django.db import models
class AsnListModel(models.Model):
asn_code = models.CharField(max_length=255, verbose_name="ASN Code")
asn_status = models.BigIntegerField(default=1, verbose_name="ASN Status")
total_weight = models.FloatField(default=0, verbose_name="Total Weight")
total_volume = models.Fl... |
import os
import datetime
title = input('Title: ')
filename = datetime.datetime.now().strftime("%Y%m%d%H%M-") + title + '.py'
url = f'https://github.com/full-stack-hero/snippet/blob/master/snippet/snippets/{filename}'
print('Create new file', filename)
with open(f'snippets/{filename}', 'w') as f:
f.write(f'# :aut... |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Sylvain Afchain <sylvain.afchain@enovance.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.apach... |
"""
A Simple server used to show altair graphics from a prompt or script.
This is adapted from the mpld3 package; see
https://github.com/mpld3/mpld3/blob/master/mpld3/_server.py
"""
import sys
import threading
import webbrowser
import socket
import itertools
import random
from ._py3k_compat import server, IO
JUPYTER_... |
"""
File for all API endpoints
API Url is read from the config.ini file via the Config module
"""
from mlpipe.schemas.training import TrainingSchema
from mlpipe.utils import Config
import requests
import bson
import json
def test_connection():
"""
Test API connection
:return: http response
"""
end... |
import urllib
from roscraco.response import WirelessSettings
from base import TplinkBase, _extract_js_array_data
class Tplink_WR740N(TplinkBase):
def confirm_identity(self):
self._ensure_www_auth_header('Basic realm="TP-LINK Wireless Lite N Router WR740N"')
def get_wireless_settings(self):
... |
import torch.nn as nn
import torch.nn.functional as F
import torch
class CPM(nn.Module):
def __init__(self, k):
super(CPM, self).__init__()
self.k = k
self.pool_center = nn.AvgPool2d(kernel_size=9, stride=8, padding=1)
self.conv1_stage1 = nn.Conv2d(3, 128, kernel_size=9, padding=4)... |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Baricoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Functionality to build scripts, as well as signature hash functions.
This file is modified from pytho... |
import os
import argparse
from solver import Solver
from data_loader import get_loader
from torch.backends import cudnn
def str2bool(v):
return v.lower() in ('true')
def main(config):
# For fast training.
cudnn.benchmark = True
# Create directories if not exist.
if not os.path.exists(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from docx import Document
from xlwt import Workbook
from docx.enum.dml import MSO_THEME_COLOR_INDEX
from sqlalchemy import desc
from spider163 import settings
from spider163.spider import public as uapi
from spider163.utils import tools
from spider163.utils import pylog
f... |
_base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco_wholebody.py'
]
checkpoint_config = dict(interval=50)
evaluation = dict(interval=50, metric='mAP', key_indicator='AP')
optimizer = dict(
type='Adam',
lr=0.0015,
)
optimizer_config = dict(grad_clip=None)
# learning pol... |
"""DOM models_no_sql."""
import data.models_no_sql.audit
import data.models_no_sql.downloads
import data.models_no_sql.languages
import data.models_no_sql.licenses
import data.models_no_sql.package
import data.models_no_sql.releases
import data.models_no_sql.users
# import data.models_no_sql.all pypi_org/data/models_... |
from djoser.conf import settings
__all__ = ['settings']
def get_user_email(user):
email_field_name = get_user_email_field_name(user)
return getattr(user, email_field_name, None)
def get_user_email_field_name(user):
try: # Assume we are Django >= 1.11
return user.get_email_field_name()
exce... |
import abc
import dataclasses
from dataclasses import dataclass
from typing import ClassVar, Dict, Type, TypeVar
from ..features import Features
T = TypeVar("T", bound="TaskTemplate")
@dataclass(frozen=True)
class TaskTemplate(abc.ABC):
# `task` is not a ClassVar since we want it to be part of the `asdict` out... |
class TestWellsHandler:
pass |
import constants
import frame_subscriber
import frame_receiver
# Income
def create_receiver():
receiver_port = constants.get_meta_frame_server_port()
return frame_receiver.FrameReceiver(port=receiver_port)
def create_subscriber():
subscriber_port = constants.get_meta_frame_server_port()
topic = cons... |
#!/usr/bin/python
import getopt
import sys
import pymqi, CMQC, CMQCFC
STATE_OK = 0
STATE_WARNING = 1
STATE_CRITICAL = 2
STATE_UNKNOWN = 3
STATE_STR = {STATE_OK:"OK",STATE_WARNING:"WARNING",STATE_CRITICAL:"CRITICAL",STATE_UNKNOWN:"UNKNOWN"}
def usage():
print """Usage: rbh_check_mq_oldest_msg_age -H <HostName> -g... |
r"""
Wigner, Clebsch-Gordan, Racah, and Gaunt coefficients
Collection of functions for calculating Wigner 3j, 6j, 9j,
Clebsch-Gordan, Racah as well as Gaunt coefficients exactly, all
evaluating to a rational number times the square root of a rational
number [Rasch03]_.
Please see the description of the individual fun... |
#!/usr/bin/env python
from multiprocessing import cpu_count
from multiprocessing import Pool
def func(temp):
while True:
temp = (temp ** temp )
if(temp > 5000):
temp = 2
def main():
number_of_cores = cpu_count()
print("Number of cores availabe is {}".format(number_of_cores))
use_cpu = 2
pool = Pool(use_... |
import torch.nn as nn
from NeuralBlocks.blocks.convnorm import ConvNorm
class ConvNormPool(nn.Module):
"""
A simply block consisting of a convolution layer,
a normalization layer and a pooling
layer. For example, this is the first block in the
ResNet architecture.
"""
def __init__(self, in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.