text stringlengths 2 999k |
|---|
import unittest
from rekcurd_dashboard.models import DataServerModel, DataServerModeEnum
from rekcurd_dashboard.data_servers import CephHandler
from . import patch_predictor
class CephHandlerTest(unittest.TestCase):
"""Tests for CephHandlerTest.
"""
def setUp(self):
self.data_server_model = Dat... |
def qsort(inlist):
if inlist == []:
return []
else:
pivot = inlist[0]
lesser = qsort([x for x in inlist[1:] if x < pivot])
greater = qsort([x for x in inlist[1:] if x >= pivot])
return lesser + [pivot] + greater
|
class StudentInfo:
formType="Student Detalis"
def printData(self):
print(f"Name is {self.name}.")
print(f"Roll Number is {self.number}.")
nameOfApplication=StudentInfo()
nameOfApplication.name="Aman"
nameOfApplication.number="1030"
nameOfApplication.printData() |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Interfaces to deal with the various types of fieldmap sources
.. testsetup::
>>> tmpdir = getfixture('tmpdir')
>>> tmp = tmpdir.chdir() # changing to a temp... |
# pyOCD debugger
# Copyright (c) 2016-2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... |
import numpy as np
from tpot import TPOTRegressor
from tpot.config import regressor_config_dict_light
from agent import SillyWalker, Action
if __name__ == '__main__':
walker = SillyWalker()
for _ in range(10):
while not walker.done:
walker.step()
walker.reset()
def scoring(y... |
#!/usr/bin/env python
'''
Unlexicalize POS-tagged sentences to train a POS ngram model.
'''
import sys
from util import tokenize_words, pos_tag
PROGRESS = 1000000
if __name__ == "__main__":
for i, line in enumerate(sys.stdin):
words = tokenize_words(line)
pos = list(map(pos_tag, wo... |
import logging
import multiprocessing
import bagua_core as B
import bagua.torch_api.globals
from bagua.service import AutotuneService
from . import env
from .env import (
get_world_size,
get_rank,
get_local_rank,
get_local_size,
get_master_addr,
get_default_bucket_size,
get_bagua_service_por... |
# 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
from datadog_api_client.v1.api_clien... |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... |
import torch
import torch.nn as nn
class double_conv(nn.Module):
'''(conv => BN => ReLU) * 2'''
def __init__(self, in_ch, out_ch):
super(double_conv, self).__init__()
self.conv= nn.Sequential(
nn.Conv2d(in_channels=in_ch, out_channels=out_ch, kernel_size=3, padding=1),
... |
#!/usr/bin/env python3
import hashlib
import importlib.util
import json
import os
import pathlib
from types import ModuleType
import pytest
import requests
PROJECT_EULER_DIR_PATH = pathlib.Path.cwd().joinpath("project_euler")
PROJECT_EULER_ANSWERS_PATH = pathlib.Path.cwd().joinpath(
"scripts", "proje... |
import jwt
from django.conf import settings
import string
import random
from datetime import datetime, timedelta
from .models import CustomUser
from django.db.models import Q
import re
class JWTToken:
@staticmethod
def get_random(length):
return ''.join(random.choices(string.ascii_uppercase + stri... |
#!/usr/bin/env python
import os
import sys
# Magic python path, based on http://djangosnippets.org/snippets/281/
from os.path import abspath, dirname, join
parentdir = dirname(dirname(abspath(__file__)))
# Insert our dependencies:
sys.path.insert(0, join(parentdir, 'lib', 'python2.7', 'site-packages'))
# Insert our p... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 13 14:28:07 2019
Reads a TDD data file from LFAA PHASE 0 experiment
@author: f.divruno
"""
import os, os.path
import numpy as np
import matplotlib.pyplot as plt
from math import *
import matplotlib
import rfiLib as RFI
from scipy import signal
#from rfiLib import * # R... |
"""
Collection of RTCM helper methods which can be used
outside the RTCMMessage or RTCMReader classes
Created on 14 Feb 2022
:author: semuadmin
:copyright: SEMU Consulting © 2022
:license: BSD 3-Clause
"""
# pylint: disable=invalid-name
import logging
from datetime import datetime, timedelta
from pyrtc... |
from collections import deque
from IngameUsers.models import Deck as DeckModel
from .BattleCard import BattleCard
class Deck:
def __init__(self, deck_model: DeckModel):
"""
Creates BattleDeck instance.
@param deck_model: Deck database model.
"""
self.cards_queue = deque(... |
from .peopleCredentialSchemaModel import PeopleCredential as PeopleCredentialSchemaModel
from .peopleSchemaModel import PeopleSchemaModel
from .positionSchemaModel import PositionSchemaModel
from .peoplePosRoleSchemaModel import PeoplePosRoleSchemaModel
from .roleSchemaModel import (
RoleSchemaModel,
Role
)
f... |
import os
import io
from pathlib import Path
from setuptools import setup, find_packages
# Package meta-data.
__name__ = 'nima'
__description__ = 'Neural Image assesment using Keras'
__url__ = 'https://github.com/me/myproject'
__email__ = 'amaindola@expediagroup.com'
__author__ = 'Amit Maindola'
__requires_python__ =... |
from main import models
from ebooklib import epub
pieces = models.Piece.objects.all()
for index,piece in enumerate(pieces):
book = epub.EpubBook()
# set metadata
book.set_title(piece.name)
book.set_language('he')
book.add_author(piece.creator.name)
# create chapter
spn = []
for chapt... |
# -*- coding: utf-8 -*-
"""
https://gist.github.com/endolith/334196bac1cac45a4893#
Automatically detect rotation and line spacing of an image of text using
Radon transform
If image is rotated by the inverse of the output, the lines will be
horizontal (though they may be upside-down depending on the original image)
It ... |
# -*- coding: utf-8 -*-
import os
import zipfile
from django import forms
from django.conf import settings
from django.core.cache import cache
from django.core.urlresolvers import reverse
from mock import Mock, patch
from nose.tools import eq_
import amo.tests
from mkt.files.helpers import FileViewer, DiffHelper
fro... |
# Array manipulation - Fast addition
'''
1. Construct an array (1-indexed) of size n with initial value = 0.
2. A method array.add(start, end, x) to add x to each element
of array from start index to end index (both inclusive).
3. A method array.max() to return the max value in the array.
Test.txt:
T... |
# 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 .google import GoogleMiner
from .bing import BingMiner
from .freesound import FreeSoundMiner
from .flickr import FlickrMiner
__all__ = ['GoogleMiner', 'BingMiner', 'FreeSoundMiner', 'FlickrMiner']
|
#! python3
import yaml
import os
import engine
from rhythmic import Logger # to exclude this dependency search through for Logger() and .writeDown()
from flask import Flask, request, render_template
import json
def get_boxops_configuration():
try:
with open("config.yaml", "r") as configuration_file:
... |
# coding=utf-8
# @File : junior.py
# @Author: PuJi
# @Date : 2018/5/14 0014
import os, time, requests, json, logging
from uuid import uuid1
from flask import request, g, jsonify
from ulordapi.manage import app, User
from ulordapi.errcode import return_result
from ulordapi.user import Junior
log = logging.getLog... |
from ..strategy.exchange.base import BaseExchangeStrategy
class StrategyHelper:
@staticmethod
def formatted_identifier(strategy: BaseExchangeStrategy):
"""格式化策略标识,用于存储"""
identifier = strategy.identifier
return strategy.name.lower() + identifier.replace(': ', ':').replace(' ', '')
|
import os
import platform
if os.name == "posix":
if platform.system() == "Darwin":
DEFAULT_SOCKET_DIRS = ("/tmp",)
else:
DEFAULT_SOCKET_DIRS = ("/var/run", "/var/lib")
else:
DEFAULT_SOCKET_DIRS = ()
def list_path(root_dir):
"""List directory if exists.
:param root_dir: str
:... |
try:
import idle
except SystemExit:
raise
except:
import traceback
traceback.print_exc()
raw_input("Hit return to exit...")
|
from recrypt_electrum.plugins import hook
from .trezor import TrezorPlugin
from ..hw_wallet import CmdLineHandler
class Plugin(TrezorPlugin):
handler = CmdLineHandler()
@hook
def init_keystore(self, keystore):
if not isinstance(keystore, self.keystore_class):
return
keystore.ha... |
"""
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 use this ... |
import json
import argparse
import difflib
def load_jsonl_file(file_path):
with open(file_path) as file_obj:
lines = [json.loads(line) for line in file_obj.readlines()]
return lines
def prettify(lines):
pretty_lines = [json.dumps(line, sort_keys=True, indent=4) for line in lines]
pretty_lines ... |
from flask import Flask
from config_local import Config
from flask_login import LoginManager
app = Flask(__name__)
app.config.from_object(Config)
login = LoginManager(app)
login.login_view='login'
from app import controllers, models, view_models
app.cli.add_command(controllers.acl.generate_pw_hash)
|
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Training'
db.create_table(u'training_training', (
(u'id', self.gf('django.db.mod... |
from perceiver_pytorch import PerceiverIO, MultiPerceiver
from perceiver_pytorch.modalities import InputModality, modality_encoding
from perceiver_pytorch.utils import encode_position
from perceiver_pytorch.encoders import ImageEncoder
from perceiver_pytorch.decoders import ImageDecoder
import torch
from math import pr... |
#coding UTF-8
from PIL import Image
from PIL.ExifTags import TAGS
import pprint
def get_exif_of_image(file):
"""Get EXIF of an image if exists.
指定した画像のEXIFデータを取り出す関数
@return exif_table Exif データを格納した辞書
"""
im = Image.open(file)
# Exif データを取得
# 存在しなければそのまま終了 空の辞書を返す
try:
exif ... |
# -*- coding: utf-8 -*-
from functionsex import *
__all__=['DB_SCHEME', 'DB_SETTINGS']
DB_SETTINGS={
'store_flushOnChange':False,
'ns_checkIndexOnConnect':False,
'dataMerge_ex':True,
'dataMerge_deep':False,
'linkedChilds_default_do':False,
'linkedChilds_inheritNSFlags':True,
'ns_default_allowLoc... |
from __future__ import absolute_import, division, unicode_literals
from kodiswift import xbmc, Plugin, ListItem, xbmcgui
from resources.lib.mubi import Mubi
import xbmcplugin
PLUGIN_NAME = 'MUBI'
PLUGIN_ID = 'plugin.video.mubi'
DRM = 'widevine'
PROTOCOL = 'mpd'
LICENSE_URL = 'https://lic.drmtoday.com/license-proxy-wi... |
import numpy as np
import pickle
import torch as t
from torch import nn
from torch.utils.data import Dataset, DataLoader, random_split
from torch.optim import Adam
#from torch.optim.lr_scheduler import MultiplicativeLR
import matplotlib.pyplot as plt
from itertools import chain
#from scipy.stats import pearsonr
#import... |
"""
Django settings for keep project.
Generated by 'django-admin startproject' using Django 3.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib im... |
# figure-2.9-secord_stepresp.py - step responses for second order systems
# RMM, 21 Jun 2021
#
# Responses to a unit step change in the reference signal for different
# values of the design parameters \omega_c and \zeta_c. The left column
# shows responses for fixed \zeta_c = 0.707 and \omega_c = 1, 2, and 5. The
# rig... |
import torch
from pytorch_util import weights_init
from torch import nn as nn
from torch.autograd import Variable
from torch.nn import functional as F
from relnet.agent.fnapprox.gnn_regressor import GNNRegressor
from relnet.common.modules.custom_mod import JaggedArgmaxModule
from relnet.utils.config_utils import get_d... |
from broker.base import Request
class BrokerClient(Request):
def depth(self, symbol, limit=100):
"""
Market Data endpoints
"""
params = {
'symbol': symbol,
'limit': limit,
}
return self._quote_get('depth', params=params)
def trades(self... |
import boto3
from random import choice # <--- Adding the method for getting a random entry in a list
urlDomain = 'http://filearchive.t79.it.s3-website-eu-west-1.amazonaws.com/'
regionName = 'eu-west-1'
databaseTable = 'filearchivenames'
def lambda_handler(event, context):
dynamoDBClient = boto3.client('dynamodb... |
import smart_imports
smart_imports.all()
urlpatterns = old_views.resource_patterns(views.BillResource)
|
from __future__ import print_function
import socket
import sys
import os.path
if sys.argv[1] == 'patched':
print('gevent' in repr(socket.socket))
else:
assert sys.argv[1] == 'stdlib'
print('gevent' not in repr(socket.socket))
print(os.path.abspath(__file__))
if sys.version_info[:2] == (2, 7):
# Prior ... |
# @copyright@
# Copyright (c) 2006 - 2018 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the University of California
# All rights reserved. Rocks(r) v5.4 www.rocksclusters.org
# ... |
import argparse
import sys
import multiprocessing
from external_sorting.generator import generate_file
from external_sorting.sort import SortRunner, log
from external_sorting.constants import BUF_SIZE, SORT_MEMORY
def main(args):
try:
if "gen" in args.mode:
log.info(f"Generating dummy file {a... |
def Multiply2Strings(s1, s2):
return str(int(s1) * int(s2))
def Multiply2StringsAlgorithm(str1, str2):
if((str1[0] == '-' or str2[0] == '-') and (str1[0] != '-' or str2[0] != '-')):
print("-", end = '')
if(str1[0] == '-' and str2[0] != '-'):
str1 = str1[1:]
elif(str1[0] != '-' and str2[0] == '-'):
str2 ... |
"""
Django settings for bar project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
import os
import dj_database_url
from django.utils.crypto import get_random_st... |
import logging
import logging.config
import structlog
from job_scheduler.config import config
logger = structlog.getLogger(__name__)
pre_chain = [
structlog.stdlib.add_logger_name,
structlog.stdlib.add_log_level,
structlog.processors.TimeStamper(fmt="iso"),
]
if not config.dev_mode:
pre_chain.append... |
"""Tests for reloading generated pyi."""
from pytype import file_utils
from pytype.pytd import pytd_utils
from pytype.tests import test_base
class ReingestTest(test_base.TargetPython3BasicTest):
"""Tests for reloading the pyi we generate."""
def test_type_parameter_bound(self):
foo = self.Infer("""
fr... |
# Copyright 2015 Sean Vig
#
# 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, sof... |
import risk.drafting_weights
def test_drafting_weights():
assert type(risk.drafting_weights.TERRITORIES) == dict
|
import sys
sys.path.append("../")
import os
import time
import json, pickle
import numpy as np
from datetime import datetime
from itertools import product
from keras.callbacks import ModelCheckpoint
from keras.models import load_model
from util94 import plot_loss_figure, load_X, load_Y,load_X_hierarchical, n_hot_decode... |
#!/usr/bin/env python
#
# Copyright 2014, Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
import utils
import initial_sharding
from vtdb import keyrange_constants
# this test is the same as initial_sharding_bytes.py, but it uses v... |
"""
WSGI config for hierarchicaldata project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJA... |
#The MIT License (MIT)
#Copyright (c) 2012 Robin Duda, (chilimannen)
#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,... |
import pygame
import os
import sys
import time
from rpi_vision.agent.capture import PiCameraStream
import numpy as np
os.environ['SDL_FBDEV'] = "/dev/fb1"
os.environ['SDL_VIDEODRIVER'] = "fbcon"
capture_manager = PiCameraStream(resolution=(320, 320), rotation=180, preview=False)
pygame.init()
screen = pygame.display.... |
#GDP Access List forLebanon
GDPtable = [{'Country': 'Lebanon',
'GDP_Access': 51457.0,
'VisaRequirement': 'Freedom of Movement',
'VisaTemplate': 'free'},
{'Country': 'Afghanistan',
'GDP_Access': 8355.6,
'VisaRequirement': 'Visa is required',
'VisaTemplate': 'no'},
{'Country': 'Albania',
'GDP_Access': 52... |
#You are only allowed to perform 2 operations, multiply a number by 2, or subtract a number by 1.
# Given a number x and a number y, find the minimum number of operations needed to go from x to y.
#Here's an example and some starter code.
def min_operations(x, y):
# Fill this in.
print(min_operations(6, 20))
# ((... |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... |
from random import randint
# For simpler reading x is red, o is green
class game(object):
# Print msgs and errors if cout is True, players is a list of two players
def __init__(self, players, cout=True):
# (0,0) is top left corner
self.slots = [['-' for i in range(6)] for i in range(7)]
... |
# Time: ctor: O(1)
# addText: O(l)
# deleteText: O(k)
# cursorLeft: O(k)
# cursorRight: O(k)
# Space: O(n)
# design, stack
class TextEditor(object):
def __init__(self):
self.__LAST_COUNT = 10
self.__left = []
self.__right = []
def addText(self... |
import json
import base64
import traceback
import urllib.parse
from lambdas import admin, user, templates
def route(method, path, data):
if path == '/admin':
if method == 'GET':
return admin.render()
elif method == 'POST':
return admin.update(data)
return user.render(... |
# -*- coding: utf-8 -*-
"""
@contact: lishulong.never@gmail.com
@time: 2019/3/22 下午10:54
"""
result = {}
def calculate(name):
t = 0
number = []
while True:
x = yield
print(name, x)
if not x:
break
t += x
number.append(x)
return t, number
def mid(... |
# Copyright (C) 2020 Intel Corporation
#
# 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 wri... |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
import aerospike_rest
setup(
name = aerospike_rest.NAME,
version = aerospike_rest.get_version(),
description = "Python interface to Aerospik... |
#!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020-2021 EntySec
#
# 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... |
"""
WSGI config for backendapi project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SE... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-01 07:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Task',... |
# -*- coding: utf-8 -*-
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-plugins for support or download.
# See https://a... |
# Copyright (c) 2012 Citrix Systems, Inc.
# Copyright 2010 OpenStack Foundation
#
# 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... |
"""Contains the Oracle Character class"""
import json
from botc import Character, Townsfolk
from ._utils import SectsAndViolets, SnVRole
with open('botc/gamemodes/sectsandviolets/character_text.json') as json_file:
character_text = json.load(json_file)[SnVRole.oracle.value.lower()]
class Oracle(Townsfolk, Sects... |
###Testar se Existe determinado Contéudo no Texto###
def validador (arqtexto,x):
#Find - Procura Contéudo da Varíavel X no Arqtexto e Retorna sua Posição
resultado = arqtexto.find(x)
#Resultado Igual a -1 se Contéudo não for Encontrado no Texto
if resultado==-1:
resultado = False
#Se Diferen... |
from book_book import books_directory, user_interface
def run_example():
user_interface.add_new_book()
print("Data dodania: ", books_directory.available_books[-1].added_at_datetime)
user_interface.add_new_book()
print("Data dodania: ", books_directory.available_books[-1].added_at_datetime)
if __name... |
# Copyright (c) 2016 Intel Corporation.
#
# 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 la... |
import time
import os
from echo import delay_callback
from glue.config import viewer_tool
from glue_jupyter.bqplot.common.tools import Tool
from glue.viewers.common.tool import CheckableTool
from glue_jupyter.bqplot.common.tools import BqplotPanZoomMode
__all__ = []
ICON_DIR = os.path.join(os.path.dirname(__file__)... |
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import TSV
cluster = ClickHouseCluster(__file__)
instance = cluster.add_instance('instance')
@pytest.fixture(scope="module", autouse=True)
def start_cluster():
try:
cluster.start()
instance.query("CREATE DATABASE... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "waypoint_loader"
PROJECT_SPACE_DIR = ... |
import torch
import torch.nn.functional as F
from torch.distributions import Categorical
import numpy as np
import os
class Agent:
def __init__(self, p_net, v_net, optim_p, optim_v, device):
super(Agent, self).__init__()
self.p_net = p_net
self.v_net = v_net
self.optim_... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 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 the Software without restriction,
# including without... |
def narcissistic(num):
sum = 0
iterableNum = str(num)
for i in iterableNum:
sum += int(i) ** len(iterableNum)
return True if sum == num else False
# One-liner:
def narcissistic2(num):
return num == sum(int(i) ** len(str(num)) for i in str(num)) |
""" Architecture description for web assembly """
from .. import ir
from ..arch.arch import VirtualMachineArchitecture
from ..arch.stack import FramePointerLocation
from ..arch.registers import Register, RegisterClass
from ..arch.arch_info import ArchInfo, TypeInfo
# Define 'registers' that are actually wasm local v... |
import abc
import pickle
import typing as t
from typing import TYPE_CHECKING
from simple_di import inject
from simple_di import Provide
from ..types import LazyType
from ..configuration.containers import DeploymentContainer
SingleType = t.TypeVar("SingleType")
BatchType = t.TypeVar("BatchType")
IndexType = t.Union[... |
"""
WSGI config for the project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS... |
# coding=utf-8
import atexit
import datetime
import io
import json
import sys
import time
import ConsoleUtils
from RingBuffer import RingBuffer
from Notify import send_notification
class ConsoleOutput(object):
def __init__(self):
self._status = ''
atexit.register(self._exit)
def _exit(self):... |
from uwuizer.main import owoize |
import FWCore.ParameterSet.Config as cms
hltBTagPFPuppiDeepFlavour0p275Eta2p4TripleEta2p4 = cms.EDFilter("HLTPFJetTag",
JetTags = cms.InputTag("hltPfDeepFlavourJetTagsModEta2p4","probb"),
Jets = cms.InputTag("hltPFPuppiJetForBtagEta2p4"),
MaxTag = cms.double(999999.0),
MinJets = cms.int32(3),
MinTa... |
# Copyright 2013: Mirantis 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 b... |
"""
Django settings for test_app_30388 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/
"""
impor... |
"""
Requires:
Nothing
Provides:
Instance
"""
import pyblish.api
from pprint import pformat
class CollectFPS(pyblish.api.InstancePlugin):
"""
Adds fps from context to instance because of ExtractReview
"""
label = "Collect fps"
order = pyblish.api.CollectorOrder + 0.49
hosts = ["w... |
import sys
with open(sys.argv[1], 'r') as test_cases:
for test in test_cases:
mins,secs = divmod(float(test)*3600,60)
degr,mins = divmod(mins,60)
print ("%d.%02d'%02d\"" % (degr,mins,secs))
|
#!/usr/bin/env python3
"""
Update single sources of truth (name, version) in all listed files according to
their respective rules.
"""
import re
import sys
from pathlib import Path
from typing import Optional # noqa: F401
from pudb import set_trace as bp # noqa: F401
from {{cookiecutter.repo_name}} import VERSION... |
import scrapy
from os.path import dirname, realpath
fileDir = realpath(__file__)
rootDir = dirname(dirname(dirname(fileDir)))
class JobsSpider(scrapy.Spider):
name = "jobs"
def start_requests(self):
urls = [
'https://stackoverflow.com/jobs/166865/google-software-engineer-site-reliability-new-google',
'http... |
start_Id = 2800000
stop_Id = 2931570
min_post_count = 5
|
"""
Layered Plot with Dual-Axis
---------------------------
This example shows how to combine two plots and keep their axes.
"""
import altair as alt
from vega_datasets import data
source = data.seattle_weather()
base = alt.Chart(source).encode(
alt.X('date:O',
axis=alt.Axis(format='%b'),
timeUni... |
from spyll.hunspell.algo import compounder as cpd
def test_decompose():
compounder = cpd.Compounder(min_length=3, max_words=2)
assert compounder('cats') == []
assert compounder('catastrophe') == [
[cpd.Part('cat', cpd.Pos.BEGIN), cpd.Part('astrophe', cpd.Pos.END)],
[cpd.Part('cata', cpd.P... |
# Copyright 2021 The Oppia 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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.