text stringlengths 1 927k |
|---|
from django.urls import path, include
import apps.students.views
urlpatterns = [
path('', apps.students.views.StudentInstanceMarksListView.as_view()),
path('<int:mark_id>', apps.students.views.StudentInstanceMarksInstanceView.as_view()),
] |
#coding:utf8
import warnings
class DefaultConfig(object):
env = 'default' # visdom 环境
model = 'ResNet34' # 使用的模型,名字必须与models/__init__.py中的名字一致
train_data_root = './data/train/' # 训练集存放路径
test_data_root = './data/test1' # 测试集存放路径
load_model_path = None # 加载预训练的模型的路径,为None代表不加载
batch_size = ... |
# Copyright 2019 The Matrix.org Foundation CIC
#
# 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 agre... |
# Copyright (c) 2011-2012 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
#
# Un... |
from __future__ import print_function
import copy
import itertools
import math
import random
import numpy as np
from numba.compiler import compile_isolated, Flags
from numba import jit, types, utils
import numba.unittest_support as unittest
from numba import testing
from .support import TestCase, MemoryLeakMixin
fr... |
import tensorflow as tf
from tensorflow.keras import datasets, layers, models
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.models import model_from_json
from tensorflow.keras.layers import Input, Add, Dense, Activation, ZeroPadding2D, BatchNormalization, Flatten, Conv2D, AveragePooling2D... |
import numpy as np
def print_nested_structure(j, level=0):
'''print_nested_structure
Prints a list of all keys in a dictionary. The order and indentation shows any nested strucutre.
Args:
j (dict):
level (int): Defaults to 0
'''
for k, v in j.items():
print(' '*level, k... |
#program to calculate the area of a circle
r=1.1
print("The radius of the circle is",r)
ar=float((22/7)*r*r)
print("The area of the circle with radius is ",ar) |
import os
from kivy.animation import Animation
from kivy.lang import Builder
from kivy.properties import NumericProperty
from kivy.utils import get_color_from_hex
from kivy.core.window import Window
from kivymd.material_resources import STANDARD_INCREMENT
from kivymd.color_definitions import colors
from kivymd.uix.scre... |
from collections import namedtuple
import pytest
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.test import TestCase, override_settings
from django.urls import include, path, resolve, reverse
from rest_framework import permissions, serializers, viewsets
from rest_fram... |
import argparse
import logging
import sys
from typing import List
import pandas as pd
from analysis.src.python.data_analysis.model.column_name import IssuesColumns, SubmissionColumns
from analysis.src.python.data_analysis.utils.df_utils import merge_dfs
from analysis.src.python.data_analysis.utils.statistics_utils im... |
from .negate import negate
from ramda.private.asserts import assert_equal
def negate_test():
assert_equal(negate(5), -5) |
print("Welcome to the Voter Registration App\n")
name = str(input("Please enter your name: ")).title()
age = int(input("Please enter your age: "))
if age < 18:
print("\nYou are not old enough to register to vote.")
else:
print(f"\nCongratulations {name}! You are old enough to register to vote.\n")
paries... |
import boto3
from time import time
import sys
# sys.stdout = open('log.txt', 'w')
import pandas as pd
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support ... |
# Exception -- Base class for most error types
# AttributeError -- obj.foo, if obj has no member named foo
# EOFError -- end of file reached for console or file
# IOError -- failure of I/O operation
# IndexError -- index to sequence is out of bounds
# KeyError -- nonexistent key requested for a set of dictionary
# Keyb... |
#!/usr/bin/env python3
#############################################################################
# Filename : StopWatch.py
# Description : Control 4_Digit_7_Segment_Display with 74HC595
# Author : www.freenove.com
# modification: 2019/12/27
###################################################################... |
# -*- coding: utf-8 -*-
# Copyright 2016 Resonai Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
# file: loader.py
#===============================================================================
# Copyright 2019 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
#
# h... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .core import PowerSystem as PowerSystem |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
from numpy import ma
from cotede.qctests import Tukey53H
from data import DummyData
def test():
profile = DummyData()
profile.data['PRES'] = ma.masked_array([1.0, 100, 200, 300, 500, 5000])
profile.data['TEMP'] = ma.masked_array(... |
from os.path import dirname
from unittest.case import TestCase
from peewee import _transaction
from andreas.db.database import db
from andreas.models.keypair import KeyPair
from andreas.models.server import Server
from andreas.models.user import User
class AndreasTestCase(TestCase):
"""
Basic class for all ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.core.files.storage import default_storage as storage
from ..utils.compatibility import PILExifTags, PILImage
def get_exif(im):
try:
exif_raw = im._getexif() or {}
except: # noqa
return {}
ret = {}
for tag, va... |
#!/usr/bin/env python
NAME = 'NAXSI (NBS Systems)'
def is_waf(self):
# Sometimes naxsi waf returns 'x-data-origin: naxsi/waf'
if self.matchheader(('X-Data-Origin', r'^naxsi(.*)?')):
return True
# Found samples returning 'server: naxsi/2.0'
if self.matchheader(('server', r'naxsi(.*)?')):
... |
from unittest import skipIf, skipUnless
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import RequestFactory
from django.urls import reverse, NoReverseMatch
from oscarapi import urls
from oscarapi.tests.utils import APITest
from oscarapi.permissions import APIAdminPe... |
import os
import numpy as np
import pandas as pd
import shap
from sklearn.model_selection import train_test_split
from .utils.plot import (
plot_results_1x2,
plot_results_2x2,
plot_shap_values,
plot_survival,
plot_sensitivity_specificity_vs_threshold
)
from .utils.preprocess import preprocess
from... |
from unittest import TestCase
from isc_dhcp_leases.iscdhcpleases import IscDhcpLeases, Lease, Lease6
from freezegun import freeze_time
from datetime import datetime
__author__ = 'Martijn Braam <martijn@brixit.nl>'
class TestIscDhcpLeases(TestCase):
@freeze_time("2015-07-6 8:15:0")
def test_get(self):
... |
from __future__ import annotations
from abc import abstractmethod
from typing import Protocol, TypeVar
from .components import Arithmetic, MemoryInfo
Number = TypeVar("Number", int, float)
Numeric = TypeVar("Numeric", int, float, bool)
class TensorLike(Arithmetic, MemoryInfo, Protocol):
"""
TensorLike is a... |
# Copyright 2012 Canonical Ltd.
# This file is part of lazr.restfulclient.
#
# lazr.restfulclient 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, version 3 of the
# License.
#
# lazr.restfulclient is d... |
# Copyright (C) 2018 Henrique Pereira Coutada Miranda
# All rights reserved.
#
# This file is part of phononwebsite
#
from __future__ import print_function
import unittest
import os
from phononweb.phonondb import PhononDB2015
class TestPhononDB2015(unittest.TestCase):
def test_phonondb_2015(self):
pdb = Ph... |
#
# Copyright 2021 Budapest Quantum Computing Group
#
# 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 moesif_aws_lambda.middleware import *
import os
import requests
import json
moesif_options = {
'LOG_BODY': True,
'DEBUG': True,
}
@MoesifLogger(moesif_options)
def lambda_handler(event, context):
# Outgoing API call to third parties like Github / Stripe or to your own dependencies
start_capture_... |
# Generated by Django 3.1.3 on 2020-11-09 21:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0021_auto_20201106_2240'),
]
operations = [
migrations.AlterField(
model_name='event',
name='accommodation... |
import pytest
import connaisseur.validators.interface as vi
def test_init():
assert vi.ValidatorInterface("")
@pytest.mark.asyncio
async def test_validate():
with pytest.raises(NotImplementedError):
assert await vi.ValidatorInterface("").validate(None)
def test_healthy():
with pytest.raises(No... |
def main():
Im a runtime error!
print("Hello World!\n")
if __name__ == "__main__":
main() |
# Copyright 2018 The TensorFlow Probability 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
import tensorflow as tf
import numpy as np
import itertools
import numbers
from . import networks
from . import pnetlin
from . util import switch_case_cond, switch_case_where, for_each, as_tuple
### Configuring E-LPIPS.
class Config:
def __init__(self):
self.metric = 'vgg_ensemble'
self.enable_dropout = T... |
from .console import ConsolePublisher
__all__ = ["ConsolePublisher"] |
#!/usr/bin/env python
"""
manualBackup.py : manually make a backup
Motivation: incremental save creates too many files with trivial changes.
Where manual backup is preferred, this script makes it easier to create and save a backup
copy of the current scene
"""
import maya.cmds as cmds
saveDir = cmds.fileDialog2(ff=... |
# Generated by Django 4.0.3 on 2022-03-24 00:08
import hashid_field.field
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("api", "0018_remove_lift_competition"),
]
operations = [
migrations.AlterField(
model_name="lift",
... |
"""
A non-empty array A consisting of N integers is given. Array A represents numbers on a tape.
Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1].
The difference between the two parts is the value of: |(A[0] + A[1] + ... + A[P −... |
from os import path, mkdir
if not path.exists('logs'):
mkdir('logs')
from aiogram import executor
from source.telegram_api import dp
executor.start_polling(dp) |
import os
import zipfile
from os.path import basename
from time import sleep
from log_settings import logger
from flask import Response, Flask, send_from_directory
__author__ = ["Thirumal"]
__email__ = "m.thirumal@hotmail.com"
app = Flask(__name__)
def read_log():
"""creates logger information"""
with open(... |
"""Takes care of the configurations.
"""
import os
from typing import Dict, Type
# required configurations
PROJECT_ID: str = os.environ.get("SIMCORE_PROJECT_ID", default="undefined")
NODE_UUID: str = os.environ.get("SIMCORE_NODE_UUID", default="undefined")
USER_ID: str = os.environ.get("SIMCORE_USER_ID", default="unde... |
from .lsun import LSUN, LSUNClass
from .folder import ImageFolder, DatasetFolder
from .coco import CocoCaptions, CocoDetection
from .cifar import CIFAR10, CIFAR100
from .stl10 import STL10
from .mnist import MNIST, EMNIST, FashionMNIST, KMNIST, QMNIST
from .svhn import SVHN
from .phototour import PhotoTour
from .fakeda... |
"""
sphinx.jinja2glue
~~~~~~~~~~~~~~~~~
Glue code for the jinja2 templating engine.
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from os import path
from pprint import pformat
from typing import Any, Callable, Iterator, Tuple # NOQA... |
# Import and register the clients but we do not want them in the namespace, we import them as _
from sunpy.net import base_client as _
from sunpy.net import cdaweb as _
from sunpy.net import dataretriever as _
from sunpy.net import hek as _
from sunpy.net import helio as _
from sunpy.net import jsoc as _
from sunpy.net... |
"""Webroot plugin."""
import argparse
import collections
import errno
import json
import logging
import six
import zope.component
import zope.interface
from acme import challenges # pylint: disable=unused-import
# pylint: disable=unused-import, no-name-in-module
from acme.magic_typing import Dict, Set, DefaultDict, ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('events', '0006_auto_20150414_1838'),
]
operations = [
migrations.AlterField(
model_name='event',... |
#!/usr/bin/env python
from netmiko import ConnectHandler
from getpass import getpass
password=getpass()
pynet1={
'device_type':'cisco_ios',
'ip':'50.76.53.27',
'username':'pyclass',
'password':password,
}
pynet2={
'device_type':'cisco_ios',
'ip':'50.76.53.27',
'username':'pyclass',
'password':password,
'port': 8022,... |
"""
=========================
Getting started with DIPY
=========================
In diffusion MRI (dMRI) usually we use three types of files, a Nifti file with the
diffusion weighted data, and two text files one with b-values and
one with the b-vectors.
In DIPY_ we provide tools to load and process these files and w... |
"""Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
import six as _six
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
from tensorflow.python.eager import context as _context
from tensorflow.python.eager import core as _c... |
from utilities.utils import build_windowed_data
from utilities.utils import load_h5_df_train_test_dataset, get_data, cast_sleep_stages
from sleep_stage_config import *
from sklearn.model_selection import train_test_split
import torch
from torch.utils.data import Dataset, DataLoader
import pandas as pd
import numpy as ... |
# Generated by Django 2.1.7 on 2019-03-12 12:46
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0010_auto_20190312_1329'),
]
operations = [
migrations.AlterField(
model_name='tutorial',
na... |
from discord import Client, TextChannel, Member
from pymysql import Connection
from src.controller.routes.holdem.endGame import holdemEndGame
from src.controller.routes.holdem.next.nextPlayer import holdemNextPlayer
from src.utils.casino.Casino import Casino
from src.utils.casino.table.holdem.HoldemTable import Holdem... |
#!/usr/bin/env python3
import time
def main():
limit = 1000
(numerator, denominator) = (1, 2) # sqrt(2) = 1 + numerator/denumerator
counter = 0
for iteration in range(2, limit + 1):
(numerator, denominator) = (denominator, 2*denominator + numerator)
if len(str(numerator + denominator... |
import torch
import torch.nn as nn
import spconv
from spconv.modules import SparseModule
from collections import OrderedDict
class ResidualBlock(SparseModule):
def __init__(self, in_channels, out_channels, norm_fn, indice_key=None):
super().__init__()
if in_channels == out_channels:
s... |
from telegram import ReplyKeyboardMarkup
from database import get_categories_list
# Разметки клавиатур для выбора
# категории, пола и верные/неверные данные соотвественно
categories = ReplyKeyboardMarkup(
[[c] for c in get_categories_list()],
one_time_keyboard=True
)
genders = ReplyKeyboardMarkup(
[["Мужс... |
"""gomokuproject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class... |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... |
"""TasksManager URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-... |
from kay.utils import url_for
from kay_sitemap import Sitemap
from przepisy import VISIBILITY
from przepisy.models import Category, Recipe
class StaticSitemap(Sitemap):
changefreq = 'weekly'
def items(self):
items = [url_for('index/index', _external=True)]
for cat in Category.all().fetch(20):
i... |
import socket
import errno
import json
CLOSED=-1
class sock:
def __init__(self, s):
self.s=s
def recv(self):
text=b''
try:
while True:
data=self.s.recv(4096)
if not data:
return CLOSED
else:
... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Chromium presubmit script for src/extensions/common/permissions.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more det... |
#!/usr/bin/env python
"""Processing input and plotting."""
from __future__ import division, print_function
import numpy as np
import segmentator.config as cfg
import matplotlib
matplotlib.use(cfg.matplotlib_backend)
print("Matplotlib backend: {}".format(matplotlib.rcParams['backend']))
import matplotlib.pyplot as plt
... |
import functools
import pytest
import tornado.web
from tornado_swagger._builders import (
SWAGGER_DOC_SEPARATOR,
_build_doc_from_func_doc,
_extract_parameters_names,
_format_handler_path,
_try_extract_args,
_try_extract_doc,
build_swagger_docs,
doc_builders,
generate_doc_from_endpo... |
from pytube import YouTube
from tkinter import *
main = Tk()
class Funcionalidades():
def baixar(self):
yt = YouTube(self.entry.get())
self.alert['text'] = (yt.title + ' - Baixado')
yt.streams.first().download()
class Aplicacao(Funcionalidades):
def __init__(self):
self.main... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... |
from floodsystem.stationdata import build_station_list
from floodsystem.geo import stations_within_radius
def run():
"""Requirements for Task 1C"""
# Build list of stations
stations = build_station_list()
#Setting the value for centre coordinate and radius r
centre = (52.2053, 0.1218)
r = 10... |
# Copyright 2018 The Bazel 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 la... |
from fastapi.testclient import TestClient
from users import app
client = TestClient(app.app)
jwtoken = "TheToken"
def test_get_all_users_OK():
"""List all users (default)"""
response = client.get(
"/users/all/",
)
assert response.status_code == 200
assert len(response.json()["users"]) ==... |
#!/home/moringa/Gallery-app/virtual/bin/python3.6
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line() |
#!/usr/bin/env python2
#
# Extract rules for Unicode case conversion, specifically the behavior
# required by Ecmascript E5 in Sections 15.5.4.16 to 15.5.4.19. The
# bitstream encoded rules are used for the slow path at run time, so
# compactness is favored over speed.
#
# There is no support for context or local... |
import json
class _PayloadAlert:
def __init__(self, title=None, body=None):
super().__init__()
self.title = title
self.body = body
def to_dict(self, alert_body=None):
if alert_body is None:
alert_body = self.body
d = {}
if self.title:
... |
#!/usr/bin/env python2
'''
Fast static linker for emscripten outputs. Specifically this links asm.js modules.
See https://github.com/kripken/emscripten/wiki/Linking
'''
import sys
from tools import shared
from tools.asm_module import AsmModule
def run():
try:
me, main, side, out = sys.argv[:4]
except:
p... |
"""
Tests for CategoricalIndex.__repr__ and related methods.
"""
import pandas._config.config as cf
from pandas import CategoricalIndex
class TestCategoricalIndexRepr:
def test_string_categorical_index_repr(self):
# short
idx = CategoricalIndex(["a", "bb", "ccc"])
expected = """Categorica... |
#
# Basic tests for a collection of osbuild modules.
#
import json
import os
import pathlib
import sys
import tempfile
import unittest
import osbuild
import osbuild.meta
from osbuild.monitor import NullMonitor
from osbuild.objectstore import ObjectStore
from osbuild.pipeline import Manifest, detect_host_runner
from .... |
import discord
import os
import json
import sqlite3
import aiohttp
from discord.ext import commands
COGS = [path.split(os.sep)[-1][:-3] for path in glob("./cogs/*.py")]
def load_config():
"""
This Is to load the configs for the bot so people can customize it
"""
with open("creds.json", "r") as cf:
... |
from __future__ import annotations
from typing import TYPE_CHECKING
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
if TYPE_CHECKING:
from selenium.webdriver import Chrome
from selenium.webdriver.remote.webelement import WebElement
... |
import unittest
from ctypes import *
import _ctypes_test
lib = CDLL(_ctypes_test.__file__)
def three_way_cmp(x, y):
"""Return -1 if x < y, 0 if x == y and 1 if x > y"""
return (x > y) - (x < y)
class LibTest(unittest.TestCase):
def test_sqrt(self):
lib.my_sqrt.argtypes = c_double,
lib.m... |
# importing the Kratos Library
import KratosMultiphysics as KM
import KratosMultiphysics.ShallowWaterApplication as SW
## Import base class file
from KratosMultiphysics.ShallowWaterApplication.shallow_water_base_solver import ShallowWaterBaseSolver
def CreateSolver(model, custom_settings):
return StabilizedShallo... |
import sklearn.preprocessing
import collections
import codecs
import os
import pickle
import random
import re
import time
import token
from neuroner import utils
from neuroner import utils_nlp
class Dataset(object):
"""A class for handling data sets."""
def __init__(self, name='', verbose=False, debug=Fals... |
import os
import torch
from collections import OrderedDict
import glob
class Saver(object):
def __init__(self, args):
self.args = args
self.directory = os.path.join('run', args.train_dataset, args.checkname)
self.runs = sorted(glob.glob(os.path.join(self.directory, 'experiment_*')))
... |
#!/usr/bin/env python3
# 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... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 11 10:35:30 2021
:copyright:
Jared Peacock (jpeacock@usgs.gov)
:license: MIT
"""
# =============================================================================
# Imports
# =============================================================================
import unittes... |
# -*- coding: utf-8 -*-
# Copyright 2018 Google LLC. 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 require... |
DEEPREACH_DIR = '/'.join(__file__.split('/')[:-2])
environment = f'{DEEPREACH_DIR}/environment.yml'
not_installed = f'{DEEPREACH_DIR}/change_env_file/packages_not_found.txt'
not_in_osx = f'{DEEPREACH_DIR}/change_env_file/not_in_osx.txt'
desired_env = f'{DEEPREACH_DIR}/new_environment.yml'
def remove_build(s: str) -> ... |
from typing import List
from pathlib import Path
import sys
# ours
from jekyll_relative_url_check.html import HTMLRelativeURLHook
from jekyll_relative_url_check.markdown import MarkdownRelativeURLHook
def html_pre_commit(files: List[str]):
ret = HTMLRelativeURLHook().check_files(map(Path, files))
if not ret:... |
from pytest_bdd import scenarios, when, then, given, parsers
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
# Constants
ADDREMOVEELEMENTSPAGE = 'https://the-internet.herokuapp.com/add_remove_elements/'
TITLE = (By.CSS_SELECTOR, "div h3")
ADD_ELEMENT_BUTTON = (By.CSS_SELEC... |
def test_projection_slice_1(monty_proj, mongo_proj):
docs = [
{"a": [{"b": 1}, {"b": 3}, {"b": 0}, {"b": 8}]}
]
spec = {"a.b": {"$gt": 2}}
proj = {"a.b": {"$slice": 2}}
monty_c = monty_proj(docs, spec, proj)
mongo_c = mongo_proj(docs, spec, proj)
assert mongo_c.count() == 1
ass... |
#!/usr/bin/env python
#
# hyperv_wmi_generator.py: generates most of the WMI type mapping code
#
# Copyright (C) 2011 Matthias Bolte <matthias.bolte@googlemail.com>
#
# 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 t... |
# -*- coding: utf-8 -*-
'''
:codeauthor: Nicole Thomas <nicole@saltstack.com>
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing Libs
from tests.support.unit import skipIf
# Create the cloud instance name to be used throughout the tests
from te... |
"""
WSGI config for DjChannelsDemo 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.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANG... |
import torch
from models.model import EmbedderEncoderDecoder
from modules.decoders.joint import JointDecoder
from modules.decoders.ner import IobesNERDecoder, SpanNERDecoder
from modules.decoders.re import REDecoder
from modules.embedders.embedder import Embedder, StackedEmbedder
from modules.encoders.encoders import ... |
class User:
'''
Class that generates new Usernames and passwords
'''
pass
users_list=[]
def __init__(self,name,password):
'''
A function to create username and password
'''
self.name = name
self.password= password
def save_user(self):
'''
... |
"""
Parser for parsing a regular expression.
Take a string representing a regular expression and return the root node of its
parse tree.
usage::
root_node = parse_regex('(hello|world)')
Remarks:
- The regex parser processes multiline, it ignores all whitespace and supports
multiple named groups with the same n... |
from __future__ import annotations
import os
from typing import Callable, Optional, Sequence, Tuple, Union
from qtpy.QtCore import (
QEasingCurve,
QObject,
QPoint,
QPropertyAnimation,
QRect,
QSize,
Qt,
QThread,
QTimer,
Signal,
)
from qtpy.QtWidgets import (
QApplication,
... |
# -*- coding: utf-8 -*-
from model.contact import Contact
import random
def test_delete_some_contact(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(first_name="test_name1", midle_name="test_midle_name1", last_name="test_last_name1", nikname="test_nikname1"))
old_cont... |
def pascals_triangle(n):
'''
Pascal's triangle:
for x in pascals_triangle(5):
print('{0:^16}'.format(x))
[1]
[1, 1]
[1, 2, 1]
[1, 3, 3, 1]
[1, 4, 6, 4, 1]
'''
x=[[1]]
for i in range(n-1):
x.append([sum(i) for i in zip([0]+x[... |
import struct
import json, base64
from binascii import hexlify, unhexlify
import sys
from Crypto.Util.asn1 import DerSequence
from Crypto.PublicKey import RSA
from .avbtool3 import *
import os
import stat
# !/usr/bin/python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2019, ZITiS, Do not distribute without permission ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.