text stringlengths 2 999k |
|---|
from unittest import TestCase, main as unittest_main
import torch
import torch.nn as nn
import torch.nn.utils.prune as prune
import pruning.magnitude_pruning as mp
class TestPruning(TestCase):
""" Tests for the pruning logic.
Call with 'python -m test.test_pruning' from project root '~'.
Call with 'pyth... |
# -*- coding: utf8 - *-
from unihan_db import bootstrap, importer
from unihan_db.tables import Base, Unhn
def test_reflect_db(tmpdb_file, unihan_options, metadata):
assert not bootstrap.is_bootstrapped(metadata)
def test_import_object(session, engine):
Base.metadata.create_all(engine)
session.add(Unhn(... |
# 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... |
from flask import Flask, jsonify, render_template, make_response, send_from_directory
import os
import config
import data
app = Flask(__name__)
root = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'static')
@app.route('/data.json', methods=['GET'])
def json_data():
return jsonify(members=[m['name'] for m... |
# -*- coding: utf-8 -*-
# cython: language_level=3
# Copyright (c) 2020 Nekokatt
#
# 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... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F #233
import torch.optim as optim
from torchvision import datasets,models,transforms
from PIL import Image
import argparse
from deeprobust.image.attack.fgsm import FGSM
from deeprobust.image.netmodels.CNN import Net
from deeprobust.im... |
from .dist_utils import allreduce_grads
from .misc import add_prefix
__all__ = ['add_prefix', 'allreduce_grads']
|
# substrates Tab
import os, math
from pathlib import Path
from shutil import copyfile
from ipywidgets import Layout, Label, Text, Checkbox, Button, BoundedIntText, HBox, VBox, Box, \
FloatText, Dropdown, interactive
import matplotlib.pyplot as plt
from matplotlib.colors import BoundaryNorm
from matplotlib.ticker ... |
import numpy as np
import tensorflow as tf
from tensorflow.contrib.seq2seq import Helper
# Adapted from tf.contrib.seq2seq.GreedyEmbeddingHelper
class TacoTestHelper(Helper):
def __init__(self, batch_size, output_dim, r):
with tf.name_scope('TacoTestHelper'):
self._batch_size = batch_size
self._outp... |
import discord
from discord.ext import commands
from utils.checks import is_staff
from utils.utils import send_dm_message
class Blah(commands.Cog):
"""
Custom Cog to make announcements.
"""
def __init__(self, bot):
self.bot = bot
speak_blacklist = [
647348710602178560, # #minecr... |
"""
The ``bifacial`` module contains functions for modeling back surface
plane-of-array irradiance under various conditions.
"""
import pandas as pd
import numpy as np
def pvfactors_timeseries(
solar_azimuth, solar_zenith, surface_azimuth, surface_tilt,
axis_azimuth,
timestamps, dni, dhi, gcr... |
from pmfp.utils.endpoint import EndPoint
from ..core import schema
class New(EndPoint):
"""创建一个json schema 模板."""
argparse_noflag = "name"
schema = {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": ["name", "to", "version"],
"properties":... |
from math import ceil
from datetime import date
# rework week calculation rather based on just monday - saturday?
def days_in_month(date_in):
days_in_month = 10
try:
days_in_month = (date(date_in.year, date_in.month + 1, 1) -
date(date_in.year, date_in.month, 1)).days
exc... |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
... |
import os
from Jumpscale import j
from .RDBClient import RDBClient
#
JSBASE = j.baseclasses.object
class RDBFactory(j.baseclasses.object):
__jslocation__ = "j.clients.rdb"
def _init(self):
self._children = j.baseclasses.dict()
def client_get(self, bcdbname=None, addr="localhost", port=6379, se... |
from heuristics import CompositeHeuristic, PathLengthHeuristic, RandomHeuristic, RandomProbingHeuristic, RegionHeuristic
from policies import HeuristicPolicy
pol = HeuristicPolicy(
CompositeHeuristic(
[
PathLengthHeuristic(20),
RandomProbingHeuristic(
RegionHeuristic... |
"""
Auxiliary utilities (download, check if package exists, etc.)
"""
import os
import yaml
# shutil.which: new in version 3.3
try:
from shutil import which
except ImportError:
from shutilwhich import which
from subprocess import Popen, PIPE, call
import requests
def list_installed_packages(categories=Non... |
"""
sentry.filters.base
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
__all__ = ('Widget', 'TextWidget', 'ChoiceWidget')
from django.utils.safestring import mark_safe
from django.... |
"""
Classes and subroutines dealing with network connections and related topics.
"""
from __future__ import with_statement
from functools import wraps
import getpass
import os
import re
import time
import socket
import sys
from StringIO import StringIO
from fabric.auth import get_password, set_password
from fabric.... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: second/protos/box_coder.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import refl... |
__version__ = '1.2.0'
__description__ = 'Limits bandwidth of devices on the same network' |
import simplenote
import json
from datetime import datetime
from dotenv import load_dotenv
import os
load_dotenv() # loads .env
# OR, the same with increased verbosity
# load_dotenv(verbose=True)
# settings
USER = os.getenv("USER")
PASSWORD = os.getenv("PASSWORD")
sn = simplenote.Simplenote(USER, PASSWORD)
def g... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == '__main__':
with open('c:/Users/acer/lab_7/text.txt', 'r') as f:
text = f.read()
# Заменить символы конца предложения.
text = text.replace("!", ".")
text = text.replace("?", ".")
# Удалить все многоточия.
while ".." in text... |
import os
from contextlib import contextmanager
from io import BytesIO
from pathlib import Path
from random import sample
from unittest.mock import Mock, patch
import pkg_resources
from rpdk.core.project import Project
CONTENTS_UTF8 = "💣"
NAMES = [
"Apple",
"Apricot",
"Avocado",
"Banana",
"Boys... |
import logging
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.urls import reverse
from zentral.utils.osx_package import get_standalone_package_builders
from .utils import delete_app, build_and_upload_app
logger = logging.getLogger("zentral.contrib.simplemdm.models")
c... |
# -*- coding: utf-8 -*-
"""Creating sets, variables, constraints and parts of the objective function
for Bus objects.
SPDX-FileCopyrightText: Uwe Krien <krien@uni-bremen.de>
SPDX-FileCopyrightText: Simon Hilpert
SPDX-FileCopyrightText: Cord Kaldemeyer
SPDX-FileCopyrightText: Patrik Schönfeldt
SPDX-FileCopyrightText: ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""remove sdf with 0 bonds"""
import sys
inp = sys.argv[1]
from sdfiterator import sdf_iter
iter = sdf_iter(inp)
cntr = 0
for i in iter:
cntr += 1
print cntr
|
from __future__ import print_function
import argparse
def if_use_feat(caption_model):
# Decide if load attention feature according to caption model
if caption_model in ['show_tell', 'all_img', 'fc', 'newfc']:
use_att, use_fc = False, True
elif caption_model == 'language_model':
use_att, us... |
import io
import utils as u
from heapq import heappush, heappop
from copy import deepcopy
data = """\
#############
#...........#
###B#C#B#D###
#A#D#C#A#
#########
"""
STEP_COSTS = {
"A": 1,
"B": 10,
"C": 100,
"D": 1000
}
hallway = (".",) * 11
rooms = (
("A", (".", "A"), 2),
("B", (".", "A"), 4... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import spack.variant
from spack.directives import conflicts, depends_on, variant
from spack.multimethod import when
from s... |
def decode(packet):
"""
https://github.com/telldus/telldus/blob/master/telldus-core/service/ProtocolMandolyn.cpp
>>> decode(dict(data=0x134039c3))["data"]["temp"]
7.8
"""
data = packet["data"]
value = int(data)
value >>= 1
temp = ((value & 0x7FFF) - 6400) / 128
temp = round(temp... |
'''
file created by Kaifeng Chen, 10/11/2017
ui function for main window
'''
from PyQt5 import QtCore, QtGui, QtWidgets
from gui import Ui_Arbitrade
class mainwindow_meat(QMainWindow):
def __init__(self, session):
'''
initialize mainwindow UI
'''
super(mainwindow_meat, self).__init_... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test sky projections defined in WCS Paper II"""
import os
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_almost_equal
from astropy.modeling import projections
from astropy.modeling.parameters import InputParameter... |
#
# Copyright 2020 XEBIALABS
#
# 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, modify, merge, publish, distribute, subli... |
""" Asked by: Microsoft [Medium].
Describe and give an example of each of the following types of polymorphism:
Ad-hoc polymorphism
Parametric polymorphism
Subtype polymorphism
"""
|
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
print("Hej världen!")
|
import re
import string
import threading
import time
import types
MAGIC_NUMBER = 100000
def is_bfid(bfid):
"""
Check if input string is a bfid
:type bfid: :obj:`str`
:arg bfid: bfid to check
:rtype: :obj:`bool` - True/False
"""
if type(bfid) == types.StringType:
#Older files t... |
#!@PYTHON@
####!/usr/bin/env python
#------------------------------
"""
Class :py:class:`HSpectrum` works with spectral histogram for arbitrary shaped numpy array
==========================================================================================
Usage::
# Import
# ==============
from pyimgalgos.HSp... |
import rejig.pybytecode
def testme(x):
if x < 0:
y = 0
else:
if x == 0:
y = 1
else:
if x == 1:
y = 2
else:
y = 3
return "there"
print(rejig.pybytecode.ast(testme))
# import numpy
# import awkward.type
# import r... |
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from app.api.api import api_router
from app.core.config import settings
from app.core.events import create_start_app_handler
def get_application() -> FastAPI:
application = FastAPI(**settings.fastapi_kwargs)
application.add_eve... |
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import luigi
from servicecatalog_puppet.workflow.portfolio.accessors import (
get_portfolio_by_portfolio_name_task,
)
from servicecatalog_puppet.workflow.portfolio.portfolio_management import (
po... |
'''PNASNet in PyTorch.
Paper: Progressive Neural Architecture Search
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class SepConv(nn.Module):
'''Separable Convolution.'''
def __init__(self, in_planes, out_planes, kernel_size, stride):
super(SepConv, self).__init__()
se... |
class Passenger:
def __init__(self, name, location):
self.name = name
self.location = location
class Bus:
def __init__(self, name, trips):
self.name = name
self.des = des
self.list = []
self.totalTicket = 0
def addPassenger(self, *others):
for i in... |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.core.signals.event import _signals
contribution_created = _signals.signal('contribution-crea... |
import sc2
from sc2 import Race, Difficulty
from sc2.player import Bot, Computer
from zerg.hydralisk_push import Hydralisk
from terran.proxy_rax import ProxyRaxBot
sc2.run_game(
sc2.maps.get("AcidPlantLE"),
[
Bot(Race.Terran, ProxyRaxBot(), name="Proxy Rax"),
Computer(Race.Random, Difficulty.Ea... |
#!/usr/bin/env python3
'''
Usage: xdiff.py <golden.xd>
Compare grid in test1.xd (and all others) to grid in <golden.xd> and report results in tabular form.
$TEAMDIR must be set.
'''
import os
import sys
import stat
import sqlite3
import time
from pathlib import Path
from xdplayer import Crosswo... |
"""Module for compilation configuration."""
class CompilationConfiguration:
"""Class that allows the compilation process to be customized."""
dump_artifacts_on_unexpected_failures: bool
enable_topological_optimizations: bool
check_every_input_in_inputset: bool
treat_warnings_as_errors: bool
e... |
from .PySide2Wrapper import widget, window, app |
"""
In this problem, we need a structure to store which character occurs how many
times. It is best to use a dict object; but here we will use only lists. We will
keep counts in a list of two element lists. For example:
[["a",3],["b",5],["z",3]]
"""
def add_char(store,char):
"""add a character to the count store"... |
# Generated by Django 3.1.7 on 2021-08-29 08:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("catflap", "0011_remove_unused_event_kinds"),
]
operations = [
migrations.AddField(
model_name="event",
name="duratio... |
from django import template
register = template.Library()
@register.filter
def can_view(obj, user):
return obj.can_view(user)
@register.filter
def can_change(obj, user):
return obj.can_change(user)
@register.filter
def can_execute(obj, user):
return obj.can_execute(user)
@register.filter
def can_delete... |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import awkward as ak
np = ak.nplike.NumpyMetadata.instance()
def singletons(array, highlevel=True, behavior=None):
raise NotImplementedError
# """
# Args:
# array: Da... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... |
import sys
import os
sys.path.append('../')
import unittest
import requests
from youtube_api import YoutubeDataApi
import youtube_api.youtube_api_utils as utils
class TestVideo(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.key = os.environ.get('YT_KEY')
cls.yt = YoutubeDataApi(cls... |
# Generated by Django 2.1.3 on 2018-11-18 22:12
import django.contrib.postgres.fields
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SentEmail',
... |
"""143. Reorder List"""
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def reorderList(self, head):
"""
:type head: ListNode
:rtype: None Do not return any... |
# -*- coding: utf-8 -*-
'''
@Author : Xu
@Software: PyCharm
@File : Sensitive_word_controller.py
@Time : 2019-06-06 16:22
@Desc : 短文本相似度接口
'''
import json
import datetime
import logging
from django.http import JsonResponse
from Chatbot_Model.Question_Pairs_Matching.infer_predict import ... |
# 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.
{
'variables': {
'chromium_code': 1,
},
'targets': [],
'conditions': [
# Our shared library hack only works with ninja; xcode cannot generate... |
from os import environ
from facebook import GraphAPI
import json
graph = GraphAPI(environ.get("FACEBOOK_TOKEN"))
user = graph.get_object("me")
friends = graph.get_connections(user["id"], "friends")
print(json.dumps(friends, indent=2))
|
import setuptools
with open("README.md") as fp:
long_description = fp.read()
setuptools.setup(
name="lab04",
version="0.0.1",
description="An empty CDK Python app",
long_description=long_description,
long_description_content_type="text/markdown",
author="author",
package_dir={"": ... |
# -*- coding: utf-8 -*-
"""
company.py
:copyright: (c) 2014 by Shopkeeper team, see AUTHORS.
:license: BSD, see LICENSE for more details.
"""
import datetime
from trytond.pool import PoolMeta, Pool
from trytond.model import fields
from trytond.transaction import Transaction
from validate_email import vali... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'restaurant_api.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise... |
# -*- coding: utf-8 -*-
"""
Secret Sharing
~~~~~
:copyright: (c) 2014 by Halfmoon Labs
:license: MIT, see LICENSE for more details.
"""
import random
import unittest
from test import test_support
from utilitybelt import base64_chars
from secretsharing import secret_int_to_points, points_to_secret_int,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""MAS PYNQ Machine Learning Project - main scripts
Confidentiality
---------------
All information in this document is strictly confidential.
Copyright (C) 2021 FFHS - All Rights Reserved
"""
##############################################################################... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... |
"""
Kinesis Binding Module with logging handler and stream object
"""
__author__ = 'Omri Eival'
from logging import StreamHandler
from io import BufferedIOBase, BytesIO
from boto3 import client
from aws_logging_handlers.validation import is_non_empty_string, is_positive_int, empty_str_err, \
bad_integer_err, Valid... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-30 09:23
from __future__ import unicode_literals
from django.db import migrations, models
from django.contrib.sites.models import Site
import django.db.models.deletion
def get_first_site_id():
try:
return Site.objects.all()[0].pk
except ... |
import os
import glob
import csv
import json
import xml.etree.ElementTree as ET
class XMLConversion:
def __init__(self, xml_dir, out_dir=None):
self.xml_dir = xml_dir
self.out_dir = out_dir
def voc_xml_to_csv(self):
"""This function takes xml dir as input and
converts all voc ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from setuptools import find_packages
from setuptools import setup
setup(
name='identify',
description='File identification library for Python',
url='https://github.com/chriskuehl/identify',
version=... |
#!/usr/bin/python
#orginal file http://www.raspberrypi.org/forums/viewtopic.php?f=44&t=76688
#Autor: Davespice
#modify nettemp.pl auto bus check
import struct, array, time, io, fcntl
import os.path
import sys
I2C_SLAVE=0x0703
CMD_READ_TEMP_HOLD = "\xE3"
CMD_READ_HUM_HOLD = "\xE5"
CMD_READ_TEMP_NOHOLD = "\xF3"
CMD_R... |
"""Exceptions for the Gecaching API."""
class GeocachingApiError(Exception):
"""Generic GeocachingApi exception."""
class GeocachingApiConnectionError(GeocachingApiError):
"""GeocachingApi connection exception."""
class GeocachingApiConnectionTimeoutError(GeocachingApiConnectionError):
"""GeocachingApi... |
tabby_cat = "\tI'm tabbed in."
persian_cat = "I'm split\non a line"
backslash_cat = "I'm \\ a \\ cat."
far_cat ="""
I'll do a list :
\t* Cat food
\t* Fishies
\t* Catnip\n\t* Grass
"""
print(tabby_cat)
print(persian_cat)
print(backslash_cat)
print(far_cat) |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
#
# Git
#
import subprocess
from utils import execute_call
def git_get_current_branch():
return subprocess.check_output('git symbolic-ref --short HEAD'.split(' ')).strip()
def git_add(path):
execute_call('git add %s' % path)
def git_commit_and_push(branch, version):
message = '[android] [auto] Update... |
from django.contrib import admin
from .models import URLDictionary
admin.site.register(URLDictionary)
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads_v1/proto/enums/manager_link_status.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from .config import CfgNode as CN
# -----------------------------------------------------------------------------
# Convention about Training / Test specific parameters
# -----------------------------------------------------------------------------... |
"""Tests for planemo commands relating to external Galaxy instances
"""
import os
import yaml
from planemo import cli
from planemo.engine import engine_context
from planemo.runnable import for_path
from .test_utils import (
CliTestCase,
PROJECT_TEMPLATES_DIR,
TEST_DATA_DIR,
)
class ExternalGalaxyCommand... |
"""Module contains all project wide constants."""
import logging
import os
from pathlib import Path
import dotenv
# ---------------- PATH CONSTANTS -------------------
# Source folder path
constants_path = Path(__file__)
SRC_PATH = constants_path.parent
PROJECT_PATH = SRC_PATH.parent
dotenv.load_dotenv()
# Log rela... |
"""Copyright (c) 2010-2012 David Rio Vierra
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WA... |
from .encoder import *
from .guides import *
from .models import *
from .multi_layer_encoder import *
from .prepostprocessing import *
|
import time
import traceback
from contextlib import contextmanager
import click
from click import style
from werkzeug.local import LocalProxy
from werkzeug.local import LocalStack
_reporter_stack = LocalStack()
_build_buffer_stack = LocalStack()
def describe_build_func(func):
self = getattr(func, "__self__", N... |
# --------------------------------------------------------------------------------------
# Copyright 2016, Benedikt J. Daurer, Filipe R.N.C. Maia, Max F. Hantke, Carl Nettelblad
# Hummingbird is distributed under the terms of the Simplified BSD License.
# ----------------------------------------------------------------... |
# -*- coding: utf-8 -*-
"""
Built-in version of the initial contexts for RDFa Core, and RDFa + HTML
@summary: Management of vocabularies, terms, and their mapping to URI-s.
@requires: U{RDFLib package<http://rdflib.net>}
@organization: U{World Wide Web Consortium<http://www.w3.org>}
@author: U{Ivan Herman<a href="http... |
def bipartiteBfs(src, adj, color):
q = []
q.append(src)
color[src] = 1
while q:
node = q[0]
q.pop(0)
for it in adj[node]:
if(color[it] == -1):
color[it] = 1 - color[node]
q.append(it)
elif(color[it] =... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 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, ... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
@login_required
def index(request):
data = {
}
return render(request, 'queue/queue.html', data)
|
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2019 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Request wrapper."""
from __future__ import absolute_import, print_function
from ... |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import absolute_import, unicode_literals
from marshmallow import ValidationError
from mar... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# {fact rule=xpath-injection@v1.0 defects=1}
from flask import request, app
@app.route('/user')
def find_users_noncompliant():
from flask import request
import xml.etree.ElementTree as ET
tree = E... |
# Copyright 2018 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... |
import sf
|
from django.apps import AppConfig
class JobportalConfig(AppConfig):
name = 'JobPortal'
|
from flask import Flask
from app.contrib.middle_ware.request import after_request
from contrib.mongotalk import mongodb
def create_app(package_name, package_path, settings_override=None):
app = Flask(package_name, instance_relative_config=True, static_folder='static', static_url_path='')
# Load config from f... |
from legacy.crawler import crawler
import os
url = "https://securityledger.com"
output_dir = os.path.join('.', 'data', 'securityledger.com')
headers = {
'Accept':'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding':'*',
'Accept-Language':'zh-CN,zh;q=0.8',
'Cookie': '__cfd... |
import pytest
import numpy as np
from epymetheus import Universe
from epymetheus.datasets import make_randomwalk
params_n_bars = [10, 1000]
params_n_assets = [1, 100]
# --------------------------------------------------------------------------------
@pytest.mark.parametrize("n_bars", params_n_bars)
@pytest.mark.... |
"""
REST API Documentation for the NRS TFRS Credit Trading Application
The Transportation Fuels Reporting System is being designed to streamline
compliance reporting for transportation fuel suppliers in accordance with
the Renewable & Low Carbon Fuel Requirements Regulation.
OpenAPI spec version: ... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
# Copyright (C) 2011 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.