text stringlengths 2 999k |
|---|
"""
Copyright (c) 2018-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 ... |
import logging
import os
import sys
import django
from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
""" for local usage -> """
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
path = os.path.expanduser(BASE_DIR)
if path not in sys.path:
sys.path.insert(0, p... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
from os import path as op
from .storage import KVStorage
__all__ = ['UnqliteKV']
__version__ = '0.5.1'
class UnqliteKV(object):
"""docstring for Unqlite"""
def __init__(self, app=None):
if app is not None:
self.init_app(app)
def init_app(... |
from collections.abc import Mapping, Sequence
from contextlib import contextmanager
from dataclasses import dataclass, field, replace
from enum import Enum
from functools import wraps
import inspect
from itertools import chain
import os
from operator import itemgetter
import platform
import re
import shutil
import sys
... |
#!/usr/bin/env python
import gobject
import time
import dbus
import dbus.service
import dbus.mainloop.glib
class TestException(dbus.DBusException):
_dbus_error_name = 'com.example.TestException'
class TestService(dbus.service.Object):
# ---------------------------------------------------------------------... |
from .se_resnet_testing import *
from .spatial_net import *
from . import imagegradients
from .compound_attention_model import *
from .slim import *
from .SuperShallowWideNet import *
from .plain_fully_connected import *
|
def verifica_lista(lista):
par = False
impar = False
for e in lista:
if e % 2 == 0:
par = True
else:
impar = True
if par and impar:
return "misturado"
elif par:
return "par"
elif impar:
return "ímpar"
else:
return "mis... |
"""
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 os
import platform
import shutil
import subprocess
import sys
def get_platform_compilers():
if platform.system() == 'Windows':
return [ 'vs2015', 'vs2017', 'vs2019', 'vs2019-clang' ]
elif platform.system() == 'Linux':
compilers = []
if shutil.which('g++-5'):
compilers.append('gcc5')
if shutil.which... |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... |
#!/usr/bin/env python3
import argparse
import random
import math
MAX_N = 2*10**5
MAX_H = 10**9
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--seed', type=int, default=2019)
parser.add_argument('zero', type=int)
parser.add_argument('small', type=int) # between 1 and 10
parse... |
"""
Tests to verify basic NETCONF functionality
"""
from common import change_contact, get_contact
import event_log
def test_basic_edit(mgr):
"""
Verifies that a single leaf can be edited, and that the appropriate sysrepo
notifications are emitted
"""
event_log.clear()
# Starts with no value
... |
from __future__ import absolute_import, print_function
from .model2d import Config2D, StarDist2D, StarDistData2D
from .model3d import Config3D, StarDist3D, StarDistData3D
from .pretrained import register_model, register_aliases, clear_models_and_aliases
from csbdeep.utils import backend_channels_last
import keras.bac... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
import os
class ProtobufConan(ConanFile):
name = "protobuf"
version = "3.6.1"
url = "https://github.com/bincrafters/conan-protobuf"
homepage = "https://github.com/protocolbuffers/protobuf"
author = "Bincrafte... |
from nose.tools import * # noqa: F403
from tests.base import AdminTestCase
from osf_tests.factories import NodeFactory, UserFactory
from osf.utils.permissions import ADMIN
from admin.nodes.serializers import serialize_simple_user_and_node_permissions, serialize_node
class TestNodeSerializers(AdminTestCase):
def... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/1/27 下午5:34
# @Title : 111. 二叉树的最小深度
# @Link : https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/
QUESTION = """
给定一个二叉树,找出其最小深度。
最小深度是从根节点到最近叶子节点的最短路径上的节点数量。
说明: 叶子节点是指没有子节点的节点。
示例:
给定二叉树 [3,9,20,null,null,15,7],
3
/ \
9 ... |
# Generated by Django 2.2.13 on 2020-11-09 15:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openstack', '0011_drop_invalid_volume_type_quotas'),
]
operations = [
migrations.AddField(
model_name='securitygrouprule',
... |
# Copyright (c) 2012 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.
"""
This module contains classes that help to emulate xcodebuild behavior on top of
other build systems, such as make and ninja.
"""
from __future__ import print_... |
"""
entities.py
--------------
Basic geometric primitives which only store references to
vertex indices rather than vertices themselves.
"""
import numpy as np
from copy import deepcopy
from .arc import discretize_arc, arc_center
from .curve import discretize_bezier, discretize_bspline
from .. import util
from ..uti... |
"""Shared test fixtures."""
import pytest
from multipackage import Repository
pytest_plugins = ['mock_travis', 'mock_pypi', 'mock_slack']
@pytest.fixture(scope="function")
def bare_repo(tmpdir):
"""Return a repository pointed at a bare repo."""
folder = str(tmpdir.mkdir("bare_repo"))
return Repository... |
from tests import splice_tests
def splice_1():
'''For each question, replace the "None" with your answer!'''
hello_string = "Hello World!"
name_string = "My name is Fernando."
# q_1: splice the "Hello" from hello_string
q_1 = "None"
# q_2: splice the "World" from hello_string
q_2 = "None"
# q_3: sp... |
#----------------------------------------------------------------------------#
# Imports
#----------------------------------------------------------------------------#
from flask import Flask,flash,Blueprint,render_template,request,redirect,session,url_for,abort,send_file,safe_join
from flask_bootstrap import Bootstra... |
# Copyright (c) Microsoft 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... |
# 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 -*-
'''
The function cache system allows for data to be stored on the master so it can be easily read by other minions
'''
# Import python libs
from __future__ import absolute_import
import copy
import logging
import time
import traceback
# Import salt libs
import salt.crypt
import salt.payload
im... |
# -*- coding: utf-8 -*-
import unittest
from copy import deepcopy
from openprocurement.api.tests.base import snitch
from openprocurement.tender.belowthreshold.tests.award import (
TenderAwardComplaintResourceTestMixin,
TenderAwardComplaintDocumentResourceTestMixin,
TenderAwardDocumentResourceTestMixin,
... |
#! /usr/bin/env python
import tensorflow as tf
import numpy as np
import os
import time
import datetime
import data_helpers
import dataset
from text_cnn import TextCNN
from tensorflow.contrib import learn
import csv
# Parameters
# ==================================================
# Data Parameters
tf.flags.DEFINE_... |
"""
Django settings for accounts project.
Generated by 'django-admin startproject' using Django 3.2.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathli... |
def hello_world():
return "Hello world from a module"
def some_other_function(x):
# Do stuff here
return x
|
import re
from requests import get
from datetime import datetime
from time import sleep
from bs4 import BeautifulSoup
now = datetime.now()
time = datetime.strftime(now, "\n%d-%B-%Y\t%H:%M:%S:%f\n")
types = {
"dollar": {
"name": "DOLAR",
"path": "/serbest-piyasa/amerikan-dolari",
"tag": "di... |
# Copyright 2014 IBM Corp.
#
# 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 t... |
import json
import requests
import datetime
from meteocalc import heat_index
# Contains ids and states for 125 cities in the US
cities = (
{'id': 4960140, 'state': "ME"}, # "Caribou",
{'id': 4975802, 'state': "ME"}, # "Portland",
{'id': 5089178, 'state': "NH"}, # "Manchester",
{'id': 5234372, 'state... |
from fonks import (lower,talkUS,myCommand,opn_gl, open_yt, open_dc,open_wp,open_tlg,open_cal,open_gedit,open_clden,open_atom,sy_hlo,sy_fine,sy_ty,
open_tw,wh_made,tk_nte,rd_nte,dl_nte,py_musc,py_stp,th_tme,th_dy,pc_kpt,pc_yndn,
pc_otrm,cl_brwsr,gl_mps,wk_pdia,gl_srch,gl_how,yt_srch,cpu_inf,hdd_inf, #burda fonksiyo... |
import json
import os
import pandas as pd
from . import exports
from .reporter import Reporter
class SessionBatch(list):
"""
Export utilities for exporting a collection of multiple BMD sessions.
Example
-------
>>> datasets = [
bmds.ContinuousDataset(
doses=[0, 10, 5... |
from .Annotation import Annotation
from ..Canvas.ViewportBase import ViewportBase
class AnnotationViewport(ViewportBase):
"""The following commands operate on Viewport objects. For more information about the
Viewport object, see Viewport object.
Notes
-----
This object can be accessed by:
... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
class PyInjectiveError(Exception):
pass
class ValueTooLargeError(PyInjectiveError):
pass
class EmptyMsgError(PyInjectiveError):
pass
class NotFoundError(PyInjectiveError):
pass
class UndefinedError(PyInjectiveError):
pass
class DecodeError(PyInjectiveError):
pass
class ConvertError(P... |
# pylint: disable=missing-docstring
from os import path
import pytest
from fava.core.documents import is_document_or_import_file
from fava.core.documents import filepath_in_document_folder
from fava.helpers import FavaAPIException
def test_is_document_or_import_file(example_ledger):
example_ledger.fava_options... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Word',
fields=[
('id', models.AutoField(seriali... |
# Generated by Django 3.2 on 2021-04-19 20:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('archives', '0002_report'),
]
operations = [
migrations.AddField(
model_name='report',
name='slug',
field=m... |
from django.urls import path
from django.views.decorators.cache import cache_page
from .views import CompanyListView, AboutPageView, MapPageView, \
ContactPageView, SuccesPageView, CompanyDetailView, CompanySearchView
urlpatterns = [
path('', cache_page(60)(CompanyListView.as_view()), name='index'),
path... |
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2019, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... |
# Generated by Django 2.2.2 on 2019-06-09 12:41
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('shortener', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='UserDir... |
# -*- coding: utf-8 -*-
"""Beat command-line program.
This module is the 'program-version' of :mod:`celery.beat`.
It does everything necessary to run that module
as an actual application, like installing signal handlers
and so on.
"""
from __future__ import absolute_import, print_function, unicode_literals
import nu... |
#!/usr/bin/python
from __future__ import print_function
import argparse
import subprocess
import os
import xml.etree.ElementTree as ET
import sys
scapval_results_ns = "http://csrc.nist.gov/ns/decima/results/1.0"
oval_unix_ns = "http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"
xccdf_ns = "http://checklists.ni... |
# -*- coding: utf-8 -*-
"""
:math:`\\Delta E_{ab}` - Delta E Colour Difference
=================================================
Defines :math:`\\Delta E_{ab}` colour difference computation objects:
The following methods are available:
- :func:`colour.difference.delta_E_CIE1976`
- :func:`colour.difference.delta_... |
from flask import Flask, request, jsonify
from flask import templating
from . import helper
from . import db
from .config import Config
app = Flask(__name__)
Config = Config()
@app.route("/")
def index():
return templating.render_template("index.html", maxlength=Config.url_length)
@app.route("/r/<token>")
def to... |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... |
from Person import Person
#TODO make name private
class Student(Person):
__doc__ = "Student"
points = 0
marks = 0
semester = 0
totalSemesters = 8
totalMarks = 0
modules = []
moduleEnrollments = {}
facult = ""
resultFromSimluation = True # Result from simualtuion: True -> advance to next year; False -> expe... |
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 us... |
from collections import deque
import time
import heapq
class Sched():
def __init__(self):
self.tasks=deque()
self.sleeping=[]
self.sequence=0
def call_later(self,delay,func):
self.sequence+=1
deadline=time.time()+delay
heapq.heappush(self.sleeping, (deadline... |
"""Functions for:
- logging with MLflow,
- modelling,
- hyperparameter tuning,
- finding best feature combinations,
"""
import warnings
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import GridSearchCV
import mlflow
from modeling.config import EXPERI... |
#
# Copyright (c) 2021, NVIDIA 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
#
# Unless required by appl... |
# Copyright (c) 2021 Edgar B. Sutawika
#
# Rehabilitation project for lower extremity stroke patients.
#
# Project consist of several scripts running concurrently in a multi-threaded fashion
# All programs are run by raspberry pi 4
# mainProg.py: Rehab-bot system execution.
# livePlotter.py: plotting important states... |
# -*- 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... |
from os import path
import cv2
import vidgear
import time
from ndu_gate_camera.utility.ndu_utility import NDUUtility
try:
from vidgear.gears import CamGear
except ImportError:
if NDUUtility.install_package("vidgear") == 0:
from vidgear.gears import CamGear
from ndu_gate_camera.api.video_source import... |
"""Ansible integration test infrastructure."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import contextlib
import json
import os
import shutil
import tempfile
from .. import types as t
from ..encoding import (
to_bytes,
)
from ..target import (
analyze_integrati... |
from setuptools import setup
dependencies = [
"blspy==1.0.5", # Signature library
"chiavdf==1.0.2", # timelord and vdf verification
"chiabip158==1.0", # bip158-style wallet filters
"chiapos==1.0.4", # proof of space
"clvm==0.9.7",
"clvm_rs==0.1.10",
"clvm_tools==0.4.3",
"aiohttp==3.... |
#!/usr/bin/env python
import base_filters
COPY_GOOGLE_DOC_KEY = '1N86WVgziF5adWlku0BA_XwC3ivI1z6MiQ3tvUJ4Bowo'
USE_ASSETS = False
# Use these variables to override the default cache timeouts for this graphic
# DEFAULT_MAX_AGE = 20
# ASSETS_MAX_AGE = 300
JINJA_FILTER_FUNCTIONS = base_filters.FILTERS
|
from dynaconf import Dynaconf
settings = Dynaconf(settings_file="settings.toml", load_dotenv=True)
assert settings.name == "Bruno"
assert "FOO" in settings
assert settings.foo == "NAR"
|
import numpy as np
import torch
import torch.nn.functional as F
import time
import logging
import env as grounding_env
from models import A3C_LSTM_GA
from torch.autograd import Variable
from constants import *
from tensorboardX import SummaryWriter
def test(rank, args, shared_model):
writer = SummaryWriter()
... |
import keras
from keras.datasets import cifar10
from keras.models import model_from_json
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
# normalize data
x_train = x_train.astype('float32')
x_test = x_test.astype('float32')
x_train /= 255
x_test /= 255
num_classes = 10
#encode ground truth va... |
n = int(input())
p1 = 0
p2 = 0
p3 = 0
for numbers in range(n):
number = int(input())
if number % 2 == 0:
p1 += 1
if number % 3 == 0:
p2 += 1
if number % 4 == 0:
p3 += 1
print(f"{p1 / n * 100:.2f}%")
print(f"{p2 / n * 100:.2f}%")
print(f"{p3 / n * 100:.2f}%") |
# Copyright 2020 - 2021 MONAI Consortium
# 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... |
# Copyright 2016 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... |
from flask import Flask
from flask import request
from flask import make_response
import base64
import pickle
app = Flask(__name__)
@app.route('/')
def index():
cookie = {'type': 'pickles', 'user_name': 'user'}
encoded_cookie = base64.b64encode(pickle.dumps(cookie))
green_pickle = request.cookies.get('gr... |
import numpy as np
import plotly.offline as pyo
import plotly.graph_objs as go
np.random.seed(56)
x_values = np.linspace(0,1,100)
y_values = np.random.randn(100)
trace0 = go.Scatter(
x=x_values,
y=y_values+5,
mode="markers",
name="markers"
)
trace1 = go.Scatter(
x=x_values,
y=y_values,
... |
import sys
import os
sys.path.append(os.path.abspath("../"))
from unittest import TestCase
from komand_palo_alto_pan_os.connection.connection import Connection
from komand_palo_alto_pan_os.actions.edit import Edit
import json
import logging
class TestEdit(TestCase):
def test_integration_edit(self):
"""
... |
# Generated by Django 2.1.2 on 2018-11-01 07:20
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
"""private_mkt will be populated from puppet and placed in this directory"""
from lib.settings_base import *
from mkt.settings import *
from settings_base import *
import private_mkt
DOMAIN = 'marketplace-dev.allizom.org'
SERVER_EMAIL = 'zmarketplacedev@addons.mozilla.org'
SITE_URL = 'https://marketplace-dev.allizo... |
from bitarray import bitarray
import os
parentdir = 'data'
directory = 'wordFiles'
def _wordFile(word, flags):
"""Returns the requested word file"""
return open('{0}\{1}\{2}'.format(parentdir, directory, word), flags)
def setDirectory(newdir):
"""Sets the directory used my this module, residing under [parentdir]"... |
#!runpy.sh
"""\
This module contains code for analyzing ViewerStats data as uploaded by the viewer.
$LicenseInfo:firstyear=2021&license=viewerlgpl$
Second Life Viewer Source Code
Copyright (C) 2021, Linden Research, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the ... |
import base64
b64encoded = flow.getVariable("request.header.NHSD-Target-Identifier")
b64decoded = base64.b64decode(b64encoded)
flow.setVariable("targetIdentifierDecoded", b64decoded)
|
"""
ASGI config for todo_project project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_... |
#!/usr/bin/env python3.6
# -*- coding=utf-8 -*-
from functools import reduce
from pecan.lang.ast.bool import *
from pecan.utility import unzip
def to_ref(var_ref):
if type(var_ref) is VarRef:
return var_ref
else:
return VarRef(var_ref)
def extract_var_cond(var_pred):
if type(var_pred) is... |
import pandas as pd
dataset_dir = '/workspace/dataset/'
df = pd.read_pickle(dataset_dir + 'df_word_count.pkl')
print(df.head(50)) |
# Copyright 2021 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 agreed to in writing, ... |
# -*- coding: utf-8 -*-
import os
import codecs
import json
import transfer_config as config
import transfer_helpers as helpers
from transfer_event_emitter import TransferEventEmitter as EventEmitter
class TransferSettings(object):
_reload_event = EventEmitter()
def __init__(self, settingsfile=None, enco... |
functions = {
'Blink': {
'parameters': [
{
'direction': 'in',
'name': 'interfaceRef',
'type': 'nxSessionRef_t'
},
{
'direction': 'in',
'enum': 'BlinkMode',
'name': 'modifier',
... |
import sys
import warnings
from .bloom import BloomFilter # noqa: F401
if sys.version_info.major < 3:
warnings.simplefilter('always', DeprecationWarning)
warnings.warn(DeprecationWarning(
"The `eth-bloom` library is dropping support for Python 2. Upgrade to Python 3."
))
warnings.resetwarni... |
# -*- coding: utf-8 -*-
"""
CredentialsStoreInterface Interface
This class describes a shared interface for accessing user credentials
"""
# Builtins
import abc
# Internals
from conjur.data_object import CredentialsData, ConjurrcData
class CredentialsStoreInterface(metaclass=abc.ABCMeta): # pragma: no cover
"... |
# The MIT License (MIT)
#
# Copyright (c) 2015 Leon Jacobs
#
# 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, modif... |
# Copyright 2011 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.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
"""
ipythonblocks provides a BlockGrid class that displays a colored grid in the
IPython Notebook. The colors can be manipulated, making it useful for
practicing control flow stuctures and quickly seeing the results.
"""
# This file is copyright 2013 by Matt Davis and covered by the license at
# https://github.com/ji... |
import random
import sys
random.seed(0)
n = 1000000
with open('posit_input.txt', 'w') as posit_input:
# 0 + 0
posit_input.write('0000000000000000\n')
posit_input.write('0000000000000000\n')
# 0 + inf
posit_input.write('0000000000000000\n')
posit_input.write('1000000000000000\n')
# inf + 0... |
# بسم الله الرحمن الرحيم
def f():
x = '5'
print(x)
if __name__ == '__main__':
f() |
from django.apps import AppConfig
class UsersConfig(AppConfig):
"""Конфиг приложения users."""
name = __package__
|
import numpy as np
import warnings
from sca.util.hamming_weight import HammingWeight
CONST_PLAIN_TEXT_LENGTH = 256
class NICV:
""""
This class contains methods for performing a NICV (Normalized
Inter-Class Variance) for accelerating side-channel attacks.
"""
@staticmethod
def run(traces: np... |
from .hierarchical import HierarchicalResolver
from .hdlfile import HDLFileResolver
from .hls import HLSResolver
from .template import HDLTemplateResolver
from .black_box import BlackBoxResolver
|
"""A connector for Telegram."""
import asyncio
import logging
import aiohttp
from opsdroid.connector import Connector
from opsdroid.message import Message
_LOGGER = logging.getLogger(__name__)
class ConnectorTelegram(Connector):
"""A connector the the char service Telegram."""
def __init__(self, config, ... |
# this file was generated using test/python/sample/generate.py
# python
import io
import pathlib
# pytest
import pytest
# woosh
import woosh
def tokenize_file_like(source):
return list(woosh.tokenize(io.BytesIO(source)))
def tokenize_bytes(source):
return list(woosh.tokenize(source))
SAMPLE_DIR = pathlib.P... |
#!/usr/bin/env python3
import os
import subprocess
import sys
def y_n(q):
while True:
ri = input('{} (y/n): '.format(q))
if ri.lower() in ['yes', 'y']: return True
elif ri.lower() in ['no', 'n']: return False
def update_deps():
print("Attempting to update dependencies...")
try:
... |
# Copyright (c) 2011-2013 Peng Sun. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYRIGHT file.
# HONE application
# find flows with low congestion window size, and find the shared network links among those flows as the bottleneck links
from hone_lib im... |
"""Utility functions for testing neurodsp functions."""
from functools import wraps
import numpy as np
import matplotlib.pyplot as plt
from neurodsp.utils.data import compute_nsamples
from neurodsp.tests.settings import N_SECONDS, FS
#################################################################################... |
"""
This file offers the methods to automatically retrieve the graph socfb-Vermont70.
The graph is automatically retrieved from the NetworkRepository repository.
References
---------------------
Please cite the following if you use the data:
```bib
@inproceedings{nr,
title = {The Network Data Repository with I... |
# Copyright (c) 2019-2022, Manfred Moitzi
# License: MIT License
from typing import TYPE_CHECKING, Iterable
import logging
from ezdxf.enums import MTextLineAlignment
from ezdxf.lldxf.attributes import (
DXFAttr,
DXFAttributes,
DefSubclass,
VIRTUAL_TAG,
group_code_mapping,
RETURN_DEFAULT,
)
from ... |
import data
import rally_api
from typing import List, Optional
from fastapi import APIRouter, Query
from .models import CoinPrice, CoinPrices
router = APIRouter(prefix="/coins", tags=["coins"])
@router.get("/{coin}/price", response_model=CoinPrice)
async def read_price(coin: str, include_24hr_change: Optional[bool... |
from threading import Thread
import functools
def timeout(timeout):
def deco(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
res = [Exception('function [%s] timeout [%s seconds] exceeded!' % (func.__name__, timeout))]
def newFunc():
try:
... |
"""Support for Vallox ventilation unit sensors."""
from datetime import datetime, timedelta
import logging
from homeassistant.const import (
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_TIMESTAMP,
TEMP_CELSIUS,
)
from homeassistant.core import callback
from homeassistant.helpers.dispa... |
from BaseUserHandler import *
import datetime as dt
class EditExerciseHandler(BaseUserHandler):
def get(self, course, assignment, exercise):
try:
if self.is_administrator() or self.is_instructor_for_course(course) or self.is_assistant_for_course(course):
exercises = self.content... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.