content stringlengths 5 1.05M |
|---|
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2019 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... |
from rest_framework import serializers
from django.contrib.auth import get_user_model
from ...models import OverallRating, Rating
class UserSerializer(serializers.ModelSerializer):
shortName = serializers.CharField(source='short_name')
fullName = serializers.CharField(source='full_name')
class Meta:
... |
from django.contrib import admin
# import inventory.models
from .models import Fixture, Source, Source_Type, Fixture_Type, Manufacturer
# Register your models here.
admin.site.register(Fixture)
admin.site.register(Fixture_Type)
admin.site.register(Source)
admin.site.register(Source_Type)
admin.site.register(Manufactur... |
import claripy
import nose
from claripy.vsa import MaybeResult, BoolResult, DiscreteStridedIntervalSet, StridedInterval, RegionAnnotation
def vsa_model(a):
return claripy.backends.vsa.convert(a)
def test_fucked_extract():
not_fucked = claripy.Reverse(claripy.Concat(claripy.BVS('file_/dev/stdin_6_0_16_8', 8, ... |
import unittest
class WindowsSanityTestCase(unittest.TestCase):
'''
This test case is a no-op, and exists only to ensure that windows paths work
as part of the windows sanity ci test.
'''
def test_windows_sanity(self):
print('sanity passed - test was run')
|
# flake8: noqa
from .bot_setting import BotSettingViewSet
from .deleted_message import DeletedMessageViewSet
from .documentation_link import DocumentationLinkViewSet
from .infraction import InfractionViewSet
from .nomination import NominationViewSet
from .off_topic_channel_name import OffTopicChannelNameViewSet
from .o... |
import os
from montreal_forced_aligner.g2p.trainer import PyniniTrainer as Trainer
from montreal_forced_aligner.dictionary import Dictionary
from montreal_forced_aligner.exceptions import ArgumentError
from montreal_forced_aligner.config import TEMP_DIR
from montreal_forced_aligner.utils import get_available_dict_lang... |
# Copyright 2020 Ram Rachum and collaborators.
# This program is distributed under the MIT license.
from __future__ import annotations
import functools
import warnings
import re
import json
import urllib.parse
import threading
import pathlib
import requests
import logging
from typing import (Optional, Tuple, Union, C... |
# -*- coding: utf-8 -*-
import json
import pytest
from mock import patch, Mock
from sceptre.connection_manager import ConnectionManager
from sceptre.exceptions import UnsupportedTemplateFileTypeError
from sceptre_migration_tool import template
from sceptre_migration_tool.exceptions import ImportFailureError
from sc... |
from data_structures.graph import Graph
from data_structures.tests.test_union_find import equal_sets_collection
def test_basic():
adj_list = {
1: [],
2: [3, 4],
3: [1, 3],
4: [],
}
G = Graph()
for v1, edges in adj_list.items():
G.add_vertex(v1)
for v2 ... |
#!/usr/bin/env python
"""
Removes a dataset file ( which was first renamed by appending _purged to the file name ) from disk.
Usage: python remove_renamed_datasets_from_disk.py renamed.log
"""
from __future__ import print_function
import os
import sys
assert sys.version_info[:2] >= (2, 4)
def usage(prog):
print... |
from .inference_methods import (inference_qpbo, inference_dai, inference_lp,
inference_ad3, inference_ogm,
inference_dispatch, get_installed,
compute_energy)
__all__ = ["inference_qpbo", "inference_dai", "inference_lp", "in... |
import tensorflow as tf
def gated_linear_layer(inputs, gates, name=None):
activation = tf.multiply(x=inputs, y=tf.sigmoid(gates), name=name)
return activation
# Why not BN but IN? original article use BN (IN is for CycleGAN-VC)
def instance_norm_layer(inputs, epsilon=1e-05, activation_fn=None, name=None):... |
"""
Tests the performance of all of the solutions listed in the following article:
https://therenegadecoder.com/code/how-to-convert-an-integer-to-a-string-in-python/
"""
from test_bench import test_bench
def control(_):
"""
Provides a control scenario for testing. In this case, none of the functions
shar... |
from flasker.redis_client import RedisConn
ITEM_ADDED_SUCCESSFULLY_BLOOM_FILTER = 1
ITEM_FOUND_IN_BLOOM_FILTER = 1
ITEM_NOT_FOUND_IN_BLOOM_FILTER = 0
def add_bloom_filter(bloom_filter, item):
"""
Adds item to specified bloom filter.
Keyword arguments:
bloom_filter -- the bloom filter
item -- the... |
from google.cloud import datastore
# The kind for the new entity
kind = 'Task'
# The name/ID for the new entity
name = 'sampletask1'
# The Cloud Datastore key for the new entity
task_key = datastore_client.key(kind, name)
# Prepares the new entity
task = datastore.Entity(key=task_key)
task['description'] = 'Buy milk'... |
#!/usr/bin/env python
import mapnik
m = mapnik.Map(1000, 1000, '+init=epsg:4326') # create a map with a given width and height in pixels and projected in WGS 84.
m.background = mapnik.Color('#87CEFF') # set background colour.
ssStyles = mapnik.Style() # style object to hold rules for Study Site
ssRules = mapnik.Rul... |
"Testcases for photo messages"
from .. import Case
from bobot.Rule import Rule
from bobot.Response import Photo
responsePhotoWithoutCaption = Case.Case([
Rule({
'match': 'p',
'response': {
'photo': {
'photo': './test/files/image.png'
}
}
})
], [... |
from django.conf import (
settings,
)
from django.core.management.base import (
BaseCommand,
)
from django.utils import (
timezone,
)
from ...models import (
EmailTracker,
MonthlyStat,
)
class Command(BaseCommand):
help = 'Updates monthly stats with data from email trackers and deletes outda... |
# -*- coding: utf-8 -*-
from ._version import version as __version__
from .data import *
from .era5_download import *
from .era5_tables import *
from .logging_config import *
from .processing_workers import *
del _version
|
import re
from tqdm import tqdm
from awa.data_source import DataSource
from awa.cached import Cached
class AIHRCReports(DataSource):
def __init__(self):
DataSource.__init__(
self,
"Afghanistan Independent Human Rights Commission",
"https://www.refworld.org/publisher/AI... |
from scrapy.utils.log import configure_logging
import logging
import os
# Scrapy settings for scrapy_scout project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/sett... |
from typing import *
if TYPE_CHECKING:
from django_hint import *
__all__ = [
"get_ip", "get_previous_site"
]
def get_ip(request: "RequestType") -> str:
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
if x_forwarded_for:
ip = x_forwarded_for.split(',')[0]
else:
ip = req... |
from django.apps import AppConfig
class HatvanhatConfig(AppConfig):
name = 'hatvanhat'
|
import click
import json
import operator
def pwdpolicy(passwords, minlength=0, need_lower=0, need_upper=0, need_number=0, need_special=0, need_families=0):
valid = []
for password in passwords:
if not password:
continue
if len(password) < minlength:
continue
... |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import theanets
from utils import load_mnist, plot_layers
train, valid, _ = load_mnist(labels=True)
N = 10
e = theanets.Experiment(
theanets.Classifier,
layers=(784, N * N, ('softmax', 10)),
)
e.train(train, valid, min_improvement=0.001)
plot_layers([... |
Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Return the linked list sorted as well.
Example 1:
Input: head = [1,2,3,3,4,4,5]
Output: [1,2,5]
Example 2:
Input: head = [1,1,1,2,3]
Output: [2,3]
# Definition for ... |
from django.test.utils import setup_test_environment
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions a... |
"""A setuptools based setup module."""
from os import path
from setuptools import setup, find_packages
from io import open
here = path.abspath(path.dirname(__file__))
setup(
name='hass-wh-triggers',
version='0.0.7',
description='HASS-WH-Triggers',
long_description='https://github.com/danielperna84/has... |
# The first version was licensed as "Original Source License"(see below).
# Several enhancements and at UW Robot Learning Lab
#
# Original Source License:
#
# Copyright (c) 2019 Georgia Tech Robot Learning Lab
# Licensed under the MIT License.
"""
configs for ploting
"""
from matplotlib import cm
from itertools imp... |
#!/usr/bin/env python
from setuptools import setup
setup(
name='setup_qt',
version='1.0.0',
description='Compile Qt resource files, UI files and translations in setup.py',
long_description=open('README.rst').read(),
author='Michal Krenek (Mikos)',
author_email='m.krenek@gmail.com',
url='ht... |
import os
import azure.cognitiveservices.speech as speechsdk
speech_key, service_region = "e0c8f2481be144a5963b9d6b8d24dfac", "westus2"
from_language = 'zh-CN'
to_language = 'en'
def translate_speech_to_speech():
translation_config = speechsdk.translation.SpeechTranslationConfig(
subscription... |
import numpy as np
def histo(img):
hist = np.zeros([2,256],dtype=np.int)
hist[0] = np.arange(256)
for i in range(256):
hist[1,i] = np.sum(np.where(img==i))
return hist
def calculate_metrics(img):
len = img.shape
sum = img.sum()
num = np.prod(len)
mean = sum/num
sd_ha... |
from django.apps import AppConfig
class MecabNerConfig(AppConfig):
name = 'mecab_ner'
|
import bisect
from math import fabs
def index(a, x):
i = bisect.bisect_left(a, x)
if i != len(a) and a[i] == x:
return i
return -1
while True:
try:
n = int(input())
line = input()
m = int(input())
array = []
for i in line.split():
bisect.insort_right(array, int(i))
sol = No... |
import sqlite3
import os
DB_FILE_NAME = "simple-e-commerce.db"
if os.path.exists(DB_FILE_NAME):
os.remove(DB_FILE_NAME)
connection = sqlite3.connect(DB_FILE_NAME)
cursor = connection.cursor()
cursor.execute("""
CREATE TABLE products
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
ca... |
from discord.errors import ClientException, DiscordException
__all__ = (
'others'
)
class CommandError(DiscordException):
r"""The base exception type for all command related errors.
This inherits from :exc:`discord.DiscordException`.
This exception and exceptions inherited from it are handled
in... |
# Generated by Django 2.0.1 on 2018-02-03 07:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('club', '0002_club_position'),
]
operations = [
migrations.AlterField(
model_name='club',
name='club_description',
... |
"""
All main classes of the library, in general related to internal types and whatnot. Reading-related classes are at the
:mod:`~py2df.reading` module.
"""
from .abc import *
from .subcollections import *
from .dataclass import *
from .mc_types import *
from .collections import *
from .variable import *
|
# lambdas
# list comprehension
# dict comprehension
|
import sys
from io import StringIO
from discord import Embed
from discord.ext.commands import (Cog, Context, command)
from util.colorUtil import bot_color, red_color
class EvalCommand(Cog):
def __init__(self, bot):
self.bot = bot
@command(name='evalpy')
async def evaluate_command(self, ctx: Con... |
import random
import math
import json
import copy
class MockMorphParser:
"""
When created, an object of this class calculates the number
of different lexemes based on the corpus size, generates the
lexemes, and then works as a morphological parser, taking a
Wordform object and adding analyses to i... |
import json
import random
INPUT = 'factbank.json'
OUTPUT = 'factbank.html'
html_output = "<html><head><title>Factbank</title></head><body>"
factbank = json.load(open(INPUT))
for task, facts in factbank.items():
random.shuffle(facts)
html_output += f"<h1>Task {task}</h1><ol>"
for fact in facts:
htm... |
"""
To find the duplicate character from the string, we count the occurrence of each character in the string. If count is greater than 1, it implies that a character has a duplicate entry in the string. In above example, the characters highlighted in green are duplicate characters.
"""
string=input('Enter string her... |
import os
import sys
import h5py
import numpy as np
import scipy.io as sio
import find_caffe as find_caffe
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
sys.path.insert(0, os.path.join(curr_path, '..'))
import data_analysis.get_feature_from_model as feature
import data_analysis.pre_process ... |
import numpy as np
class Subclone:
"""
Initializes a Subclone Population.
:attr label: Either A, B or S
:attr fitness: Current fitness
:attr prop: Current Proportion
"""
def __init__(self, lbl, c, alpha, prop=0.333, parent=None, birthtime=None, color=None):
... |
from __future__ import print_function
import os
import os.path
import sys
import torch
import torch.utils.data as data
import numpy as np
import scipy.spatial as spatial
import random
REAL_DATA = True
TRAINING = False
def load_shape(point_filename, normals_filename, curv_filename, pidx_filename, clean_points_filename,... |
from .r_dependencies import *
from .r_base import r_base
from math import sqrt
class r_svd(r_base):
def calculate_pcaMethods_svd(self,
data_var_I,
data_var_O,):
'''calculate svd using pcaMethods'''
try:
r_statement = ('%s <- svd(%s)' %(
data_var_O,... |
#!/usr/local/bin/python3
"""
Fetch a list of flaky tests from a CircleCI project.
Searches the last 30 builds that have failed on the master branch and reports
the tests that have failed.
Branch name, number of builds, and number of results are all customizable.
"""
import argparse
import collections
import os
import... |
"""Utility functions for search"""
from contextlib import contextmanager
import json
from tempfile import NamedTemporaryFile
def traverse_mapping(mapping, parent_key):
"""
Traverse a mapping, yielding each nested dict
Args:
mapping (dict): The mapping itself, or a nested dict
parent_key (... |
""" Create simulated reads with barcodes from a given id file, with information about
correct barcodes in the read headers for a posteriori verification of demultiplexing.
"""
import argparse
import random
import shutil
def chooseEvent(prop_inserts=1, prop_deletions=1, prop_modifications=18):
total = prop_inserts... |
#! /usr/bin/env python
"""Read data from a GEBCO NetCDF file into a RasterModelGrid."""
try:
import netCDF4 as nc4
except ImportError:
import warnings
warnings.warn("Unable to import netCDF4.", ImportWarning)
from scipy.io import netcdf as nc
from landlab import RasterModelGrid
from landlab.io.netcdf.e... |
import sys
import time
from django.core.management.base import BaseCommand
from data_refinery_common.job_lookup import ProcessorPipeline
from data_refinery_common.logging import get_and_configure_logger
from data_refinery_common.message_queue import send_job
from data_refinery_common.models import (
Dataset,
... |
from lib_imports import *
import tensorflow as tf
from logger import logger
from utils.geometry import rects_intersection
class ObjectDetectionRate(tf.keras.metrics.Metric):
def __init__(self, name='object_detection_rate', num_classes=6, iou_threshold=0.5, **kwargs):
super(ObjectDetectionRate, self).__in... |
from datetime import datetime
from sqlalchemy import ForeignKey, Table, Column
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from freshwater import db, app
from flask_security import Security, SQLAlchemyUserDatastore, UserMixin, RoleMixin
# This Function takes in a ta... |
def DBAPIQueryHelper_test():
pass # removing `assert True`
|
from django.apps import AppConfig
class GaleriasConfig(AppConfig):
name = 'galerias'
|
import math
import time
def time_decorator(funct):
def wrapper(*arg):
result = funct(*arg)
timer = time.perf_counter()
# print(f"Timer: {timer}")
return result, timer
return wrapper
@time_decorator
def factorial_counter(x, y):
fact = math.factorial(x)
fact2 = math.fac... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import random
from math import *
import time
import copy
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR, MultiStepLR
# ... |
import json
import psutil
from datetime import datetime as dt
from django.shortcuts import render
from django.contrib import admin
from django.conf import settings
from django import forms
from django.apps import apps
from .models import Natural
from django.urls import path
from pyecharts.charts import Bar, Gauge
from ... |
import logging
import os
import time
from typing import Any, Dict, Tuple
from trezorlib import transport as trezor_transport
from trezorlib.transport import bridge as trezor_bridge
from tilapia.lib.conf import settings
from tilapia.lib.hardware import exceptions, proxy
from tilapia.lib.hardware.callbacks import helpe... |
import numpy as np
import pandas as pd
from src.biota_models.coral.model.coral_constants import CoralConstants
from src.biota_models.coral.model.coral_model import Coral
from src.core import RESHAPE
from src.core.common.space_time import DataReshape
class Photosynthesis:
"""Photosynthesis."""
def __init__(
... |
import sensor,image,lcd
import KPU as kpu
from fpioa_manager import fm
from machine import UART
from board import board_info
import utime
lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_windowing((224, 224))
sensor.set_vflip(1)
sensor.run(1)
fm.register(board... |
from django.db import models
from api.models.photo import Photo
from api.models.user import User, get_deleted_user
class AlbumPlace(models.Model):
title = models.CharField(max_length=512, db_index=True)
photos = models.ManyToManyField(Photo)
geolocation_level = models.IntegerField(db_index=True, null=Tru... |
import gym
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, \
TYPE_CHECKING, Union
from ray.rllib.models.catalog import ModelCatalog
from ray.rllib.models.jax.jax_modelv2 import JAXModelV2
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.models.torch.torch_action_dist import TorchDis... |
from hummingbird.physics.fixed_wing_dynamics import FixedWingDynamics
# from hummingbird.physics.mav_dynamics import MavDynamics
from hummingbird.physics.sensors.sensors import Sensors
from hummingbird.parameters.aerosonde_parameters import MavParameters
from hummingbird.parameters.sensor_parameters import SensorParame... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 16 19:59:07 2021
@author: Alexander Southan
"""
import numpy as np
import unittest
from src.pyController import pid_control
class TestController(unittest.TestCase):
def test_pid(self):
pass
|
from mock import patch
from binascii import unhexlify
from tests.serial_mock import SerialMock
from .packets import BGAPIPacketBuilder
def uuid_to_bytearray(uuid_str):
"""
Turns a UUID string in the format "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
to a bytearray.
uuid -- the UUID to convert.
Retu... |
#
# Copyright (C) 2020 Satoru SATOH <satoru.satoh@gmail.com>.
# SPDX-License-Identifier: MIT
#
# pylint: disable=missing-function-docstring
#
"""User and group tests.
"""
import os
import pwd
import infraspec.common.user_group as TT
try:
USERNAME = os.getlogin()
except OSError:
USERNAME = pwd.getpwuid(os.get... |
"""
Data loader for everything. Word vectors are loaded later.
1. Words -> Attributes (use AttributesDataLoader)
2. Imsitu + Attributes -> imsitu labels (use ImsituAttributesDataLoader
4. Defintiions dataset -> counts (use DefinitionsDataLoader
"""
import os
import random
import numpy as np
import pandas as pd
fro... |
import time
import aiohttp
from async_utility import asyncio_run
class Product:
all_products: list
highly_rated_products: list
api_products_endpoint = "https://example.com/api/products"
def __init__(self):
self.session = asyncio_run(self.init_session())
asyncio_run(self.get_products()... |
from collections import Counter
from collections import OrderedDict
class LeagueTable:
def __init__(self, players):
self.standings = OrderedDict([(player, Counter()) for player in players])
def record_result(self, player, score):
self.standings[player]['games_played'] += 1
self.... |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... |
# -*- coding: utf-8 -*-
db.define_table('account',
Field('name',type='string', requires=IS_NOT_EMPTY()),
Field('balance',type='float', requires= IS_NOT_EMPTY()))
|
import sys
import os
import os.path
import subprocess
import re
from setuptools import setup
from setuptools.command.install_lib import install_lib
from setuptools.command.install import install
from setuptools.command.build_ext import build_ext
import setuptools.command.bdist_egg
import sys
import distutils.spawn
impo... |
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.template import Context, loader
from ctfweb.models import *
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth.models import User
from django.contrib.auth import logout, views
from ctfweb.support impor... |
import unittest
import jupyter_kernel_test
class XeusEchoKernelTests(jupyter_kernel_test.KernelTests):
kernel_name = "test_echo_kernel"
language_name = "cpp"
code_hello_world = "hello, world"
code_page_something = "?"
code_execute_result = [
{'code': '6*7', 'result': '6*7'},
{'c... |
# -*- coding: utf-8 -*-
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Authors: Luc LEGER / Coopérative ARTEFACTS <artefacts.lle@gmail.com>
from django.views.generic.base import View
import francoralite.apps.francor... |
from setuptools import setup, find_packages
setup(
name='keeptrackd',
version='1.0.0',
description='always keep tracked to your interest',
url='https://github.com/delihiros/keeptrackd',
author='delihiros',
author_email='delihiros@gmail.com',
license='MIT',
classifiers=[
'... |
import numpy as np
import pycuda.autoinit # NOQA:401
import pycuda.gpuarray as gpuarray
from cufinufft import cufinufft
import utils
def _test_type1(dtype, shape=(16, 16, 16), M=4096, tol=1e-3):
complex_dtype = utils._complex_dtype(dtype)
dim = len(shape)
k = utils.gen_nu_pts(M, dim=dim).astype(dtype... |
import os
from flask import Flask, make_response, request
from content_store.api.database import DB
from content_store.api.config import DevelopmentConfig
def create_app(config=None):
"""
application factory
:param config: override config
:return: application
"""
app = Flask(__name__)
#... |
import sqlite3, datetime, os
app_dir = "/run/media/james/MediaB/projects/agency_loan_level/"
db_name = "mortgage.db"
conn = sqlite3.connect(app_dir + db_name)
c = conn.cursor()
raw_scripts = [ \
"raw_fannie_origination.sql", \
"raw_fannie_performance.sql", \
"raw_freddie_origination.sql", \
"raw_freddie_perform... |
# Copyright 2019 Silverbackhq
#
# 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... |
from parsed_args import args
import torch
from tqdm import tqdm
from vae_train.vae_utils import *
from sklearn.metrics import f1_score, precision_score, recall_score, accuracy_score, roc_auc_score
# TODO? A lot of these handlers are very similar; however, I think it's simpler to keep them seperate?
def full_iterator(... |
import diffie_hellman_key_exchange as dh
dh.part1() |
from .create import Create # noqa
from .module import Module # noqa
|
# Copyright 2017 Rice University
#
# 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 writin... |
import csv
import sys
from typing import List
try:
from typing import TypedDict
except ImportError:
from typing_extensions import TypedDict
from arguments_parser import parse_arguments
class InferenceConfiguration(TypedDict):
streams: List[int]
batches: List[int]
INITIAL_CONFIGURATION = InferenceC... |
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from trac.web.auth import BasicAuthentication
#: This is used as the password for synced Trac users.
FAKE_PASSWORD = "!TRAC!"
class TracAuthBackend(ModelBackend):
"""
Authenticates us... |
# Desafio 74 - Aula 16 : Programa que deve gerar 5 numeros aleatórios e adicionalos a uma TUPLA.
# Depois disso mostre a listagem dos numeros gerados e indique qual é o MAIOR e qual é o MENOR.
from random import randint
tupla = ((randint(1,10)),(randint(1,10)),(randint(1,10)),(randint(1,10)),(randint(1,10)))
for n i... |
#!/usr/bin/python
# -*- coding: utf-8; -*-
#
# 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
#
# Unles... |
import os
import warnings
import numpy as np
import cutde.gpu as cluda
from .TDdispFS import TDdispFS
source_dir = os.path.dirname(os.path.realpath(__file__))
def py_disp(obs_pt, tri, slip, nu):
return TDdispFS(obs_pt, tri, slip, nu)
def solve_types(obs_pts, tris, slips):
type_map = {
np.int32: ... |
#-------------gravity.py-------------------------------------------------------#
#
# Purpose: this file intends to provide a quick demonstration of how to use
# blender python to make animations. In particular, we plan to make
# an animation of a ball dropping to the ground and one of a
# s... |
from bs4 import BeautifulSoup as bs
import requests
import pandas as pd
df = {'Language':[],'Tag_Count':[]}
def extract_tagged(url):
#print('Extracting Content')
response=requests.get(url,timeout=5)
content=bs(response.content, "html.parser")
for tag in content.find_all('a',attrs={'class':'post-tag'}):
... |
from datetime import datetime, timedelta
import dateutil.tz
import pytest
from plenum.common.constants import VERSION
from indy_common.constants import START, FORCE
from indy_node.test import waits
from indy_node.test.upgrade.helper import bumpedVersion, \
checkUpgradeScheduled, bumpVersion, sdk_ensure_upgrade_se... |
import pmpmanager.db_devices as model
import logging
from base_calls import job_exec as bass_job_exec
import json
import datetime
import uuid
def Property(func):
return property(**func())
class job_exec(bass_job_exec):
def __init__(self):
self.remotePrefix = None
self.log = logging.getLogge... |
"""This is a stand-alone script installed as **pywgrib2**.
It provides the following functionality:
1. List content of a GRIB2 file (same as **wgrib2** without options).
2. Create inventory files.
3. List content of inventory files.
4. Convert GRIB2 files to netCDF4.
5. Convert GRIB2 files to zarr.... |
#!/usr/local/hoplite/bin/python3
import unittest
import os
import sys
import socket
sys.path.insert(0, os.path.realpath(os.path.join("..", "lib")))
import influxdb2
VALID_JSON = """
{
"links": {
"self": "/api/v2/orgs/1",
"members": "/api/v2/orgs/1/members",
"owners": "/api/v2/orgs/1/owners... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ObsPy client for the IRIS Syngine service.
:copyright:
The ObsPy Development Team (devs@obspy.org)
:license:
GNU Lesser General Public License, Version 3
(https://www.gnu.org/copyleft/lesser.html)
"""
from __future__ import (absolute_import, division, print... |
from pyopenproject.api_connection.exceptions.request_exception import RequestError
from pyopenproject.api_connection.requests.get_request import GetRequest
from pyopenproject.business.exception.business_error import BusinessError
from pyopenproject.business.services.command.find_list_command import FindListCommand
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.