text stringlengths 2 999k |
|---|
# 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 os
from spack import *
class PyPycairo(PythonPackage):
"""Pycairo is a set of Python bindings for the cairo ... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
"""Data manager for the timers."""
from datetime import datetime, timedelta
from typing import Optional, List
import pymongo
from bson import ObjectId
from models import TimerModel, TimerListResult, OID_KEY
from mongodb.factory.results import WriteOutcome
from extutils.checker import arg_type_ensure
from extutils.loc... |
from daily_fantasy_sports_scoring_calculators.core.calculators.scoring import StatisticalCategoryPointsCalculator, \
StatisticalValueCalculator
from daily_fantasy_sports_scoring_calculators.draft_kings.nfl.scoring.calculators.value_to_points.offensive import \
PassingTouchdownsCalculator as PassingTouchdownsPoi... |
# Copyright (c) 2009 Raymond Hettinger
#
# 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,... |
# -*- coding: utf-8 -*-
# @Time : 2021/2/10 下午12:59
# @Author : 司云中
# @File : urls.py
# @Software: Pycharm
from django.conf import settings
from django.urls import path, include
from manager_app.apis.auth_api import ManagerLoginApiView, ManagerRegisterApiView
from manager_app.apis.manage_carousel_api import ManageCar... |
"""Temporary files.
This module provides generic, low- and high-level interfaces for
creating temporary files and directories. All of the interfaces
provided by this module can be used without fear of race conditions
except for 'mktemp'. 'mktemp' is subject to race conditions and
should not be used; it is provided f... |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joel... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2020, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
#!/usr/bin/env python3
import argparse
import configparser
import datetime
import functools
import hashlib
import json
import logging
import os
import pwd
import random
import re
import shlex
import shutil
import subprocess
import sys
import time
import uuid
from typing import Any, Dict, List, Sequence, Set
from urllib... |
# coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------------... |
import urllib.parse
import bs4
from retrying import retry
def test_if_dcos_ui_is_up(cluster):
r = cluster.get('/')
assert r.status_code == 200
assert len(r.text) > 100
assert 'DC/OS' in r.text
# Not sure if it's really needed, seems a bit of an overkill:
soup = bs4.BeautifulSoup(r.text, "ht... |
"""
Django settings for mysite 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/
"""
import os
# ... |
# Copyright (C) 2013-2020 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This progr... |
import sys
import signal
from tempfile import gettempdir
from pathlib import Path
from shutil import rmtree
from multiprocessing import Process
import pytest
from pipen import Proc, Pipen, plugin
class SimpleProc(Proc):
"""A very simple process for testing"""
input = ["input"]
class NormalProc(Proc):
... |
# wordUse - count words in file and print top ten
import sys
def usage():
"""explain usage and exit"""
sys.exit("""wordUse - count words in file and print top ten
usage:
wordUse files""")
class wordCount:
"""Count number of uses of word."""
def __init__(self, word):
self.word = word
self... |
#!/usr/bin/env python3.6
import os
import asyncio
from time import time
import chevron
import uvloop
from aiohttp import web, ClientError, ClientSession
from aiohttp_session import SimpleCookieStorage, get_session
from aiohttp_session import setup as session_setup
from arq import Actor, BaseWorker, RedisSettings, conc... |
from .fem import DofMap, Q1Element
from .function_space import FunctionSpace
from .mesh import Mesh, ReferenceQuadrilateral
from .plot import plot
from .quadrature import Quadrature
from .assemble import assemble_vector, assemble_matrix, apply_bc
|
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright 2007 - 2014, Pascal Volk
# See COPYING for distribution information.
"""This is the vmm main script."""
import sys
if __name__ == "__main__":
# replace the script's cwd (/usr/local/sbin) with our module dir
# (the location of the vmm directory) - if ... |
"""Test initialization of the url factory classes"""
import unittest
from vizier.api.routes.base import UrlFactory
from vizier.api.routes.base import PROPERTIES_BASEURL, PROPERTIES_APIDOCURL
from vizier.api.routes.task import TaskUrlFactory
class TestUrlFactoryInit(unittest.TestCase):
def test_init_url_factory... |
#!/usr/bin/env python
#
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
import string
import random
import time
import pytest
import os
import subprocess
from os import path
# Provide a list of VMs you want to reuse. VMs should have already microk8s installed.
# the test will attempt a refresh to the channel requested for testing
# reuse_vms = ['vm-ldzcjb', 'vm-nfpgea', 'vm-pkgbtw']
reus... |
# Copyright 2009-2017 Ram Rachum.
# This program is distributed under the MIT license.
'''A package for doing a binary search in a sequence.'''
from .roundings import (Rounding, LOW, LOW_IF_BOTH, LOW_OTHERWISE_HIGH, HIGH,
HIGH_IF_BOTH, HIGH_OTHERWISE_LOW, EXACT, CLOSEST,
... |
# -*- coding: utf-8 -*-
"""Packaging logic for beem."""
import codecs
import io
import os
import sys
from setuptools import setup
# Work around mbcs bug in distutils.
# http://bugs.python.org/issue10945
try:
codecs.lookup('mbcs')
except LookupError:
ascii = codecs.lookup('ascii')
codecs.register(lambda n... |
import logging
from email.utils import parseaddr
logger = logging.getLogger('c7n_mailer.utils.email')
def is_email(target):
if target.startswith('slack://'):
logger.debug("Slack payload, not an email.")
return False
if parseaddr(target)[1] and '@' in target and '.' in target:
... |
import torch
import numpy as np
import smplx
from smplx import SMPL as _SMPL
from smplx.body_models import ModelOutput
from smplx.lbs import vertices2joints
import spin.config as config
import spin.constants as constants
class SMPL(_SMPL):
""" Extension of the official SMPL implementation to support more joints "... |
from scapy.all import *
from scapy.all import send
from scapy.layers.inet import *
srcIP = "192.168.0.103"
destIP = "192.168.0.108"
def spoof_tcp(pkt):
IPLayer = IP(dst=destIP, src=pkt[IP].dst)
TCPLayer = TCP(flags="R", seq=pkt[TCP].ack, dport=pkt[TCP].sport, sport=pkt[TCP].dport)
spoofpkt = IPLayer/TCPLa... |
#Attempt to route using the Joswig Algorithm described here: https://arxiv.org/pdf/1904.01082.pdf
#using object oriented programming.
class Vertex:
num_vert = 0
vertices = []
def __init__(self, lab=""):
self.label = lab
self.adj = [] #adjacency list
self.weight = [] ... |
'''
I N S T A L L A T I O N::
Step 1:
Copy "no_flip_pole_vector_tool.py" to your Maya plugins directory.
Windows: C:\Users\UserName\Documents\maya\scripts
Step 2:
Run this in the Maya's Script Editor under the Python tab...
import no_flip_pole_vector_tool as nfpv
nfpv.No_Flip_Pole_Vector().show_ui()
If you have a... |
#!/usr/bin/env python
"""
SINGLETON
Use the Singleton pattern when:
1. there must be exactly one instance of a class, and it must be
accessible to clients from a well-known access point.
2. the sole instance should be extensible by subclassing, and clients
should be able to use an extended instan... |
import socket
from http import HTTPStatus
from urllib.request import Request, urlopen, ProxyHandler, build_opener
from urllib.parse import urlencode, unquote_plus, quote, quote_plus
from urllib.error import HTTPError, URLError
class ClientBase:
def __init__(self, nacos_host: str, api_level: str = 'v1'):
s... |
import logging
from django.contrib.auth.models import User
from unplugged import RelatedPluginField, Schema, fields
from wampyre.realm import realm_manager
from ...plugins import NotifierPlugin
logger = logging.getLogger(__name__)
class MultiNotifierSchema(Schema):
notifiers = fields.List(
RelatedPlugi... |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2021-05-20 16:25
from typing import Union, List, Callable
from elit.common.dataset import TransformableDataset
from elit.utils.io_util import read_cells
STS_B_TRAIN = 'http://ixa2.si.ehu.es/stswiki/images/4/48/Stsbenchmark.tar.gz#sts-train.csv'
STS_B_DEV = 'http://ixa2.... |
from typing import *
import re
class Censorship:
def __init__(self, content: Union[Any, str, None] = None) -> None:
self.content: str = content
def update_content(self, content: Any):
self.content = content
def censor(self):
censored = ["fuck", "shit", "lmao", "lmfao", "porn", "s... |
"""Scraper for the 1st District Court of Appeals
CourtID: ohio
Court Short Name: Ohio
Author: Andrei Chelaru
"""
from juriscraper.opinions.united_states.state import ohio
class Site(ohio.Site):
def __init__(self):
super(Site, self).__init__()
self.court_id = self.__module__
self.court_ind... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tflib.checkpoint import *
from tflib.ops import *
from tflib.utils import *
from tflib.variable import *
|
# -*- coding: utf-8 -*-
from discord.ext import commands
import discord
client = commands.Bot(command_prefix='.')
|
import os
import csv
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, FormRequest
from product_spiders.fuzzywuzzy import process
from product_spiders.items import Product, ProductLoaderWithNameStrip as ProductLoader
HERE = os.path.abspath(os.path.dirn... |
#!/usr/bin/env python
"""
_LoadForMonitoring_
MySQL implementation for loading a job by scheduler status
"""
from WMCore.Database.DBFormatter import DBFormatter
class LoadForMonitoring(DBFormatter):
"""
_LoadForMonitoring_
Load all jobs with a certain scheduler status including
all the joined infor... |
# -*- coding: utf-8 -*-
from scrapy import Spider, Request
from ..items import Article
from ..items import Lien
class MyScraper(Spider):
name = u'myscraper'
def start_requests(self):
urlToVisit = {}
Request(
url='http://www.google.fr/',
callback=self.parse,
... |
# documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 23 19:40:08 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a def... |
"""
Module coarse_graining implements a Gaussian coarse-graining adapted from
Illing et al., Phys. Rev. Lett. 117, 208002 (2016) following Goldhirsch and
Goldenberg, Eur. Phys. J. E 9, 245–251 (2002).
"""
import numpy as np
class GaussianCG:
"""
Gaussian coarse-graining.
"""
def __init__(self, sigma,... |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The dogxcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -uacomment option."""
import re
from test_framework.test_framework import dogxcoinTestFrame... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2021 CERN.
# Copyright (C) 2020-2021 Northwestern University.
# Copyright (C) 2021 TU Wien.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Test metadata ac... |
#coding: utf-8
import subprocess, string, ast
def get(host):
file = open("%s.txt"%host, "r+")
macs = file.read()
macs = ast.literal_eval(macs)
return macs
def set(host):
macs = []
command1 = "ssh user@%s 'ls /sys/class/net'" %host
try:
list_intefaces = subprocess.check_output(command1, shell=True)
list... |
from expression import *
# programming the GPIO by BCM pin numbers
#TRIG = servo['Sensor']['ultrasonic']['trigger']
#ECHO = servo['Sensor']['ultrasonic']['echo']
TRIG = 24
ECHO = 23
GPIO.setup(TRIG,GPIO.OUT) # initialize GPIO Pin as outputs
GPIO.setup(ECHO,GPIO.IN) # initialize GPIO... |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from allauth.socialaccount.models import SocialApp
from tamusers.providers.tampere.provider import TampereProvider
class Command(Bas... |
# Copyright 2020 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# The MIT License (MIT)
#
# Copyright (c) 2015-present, Xiaoyou Chen
#
# 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, c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ivar Vargas Belizario
# Copyright (c) 2020
# E-mail: ivar@usp.br
import tornado.ioloop
import tornado.web
import tornado.httpserver
import uuid
from vx.pgff.Settings import *
class BaseHandler(tornado.web.RequestHandler):
def set_defa... |
import argparse
import os
import re
import sys
from voussoirkit import betterhelp
from voussoirkit import interactive
from voussoirkit import pathclass
from voussoirkit import pipeable
from voussoirkit import spinal
from voussoirkit import stringtools
from voussoirkit import vlogging
import etiquette
# HELPERS #####... |
# -*- coding: utf-8 -*-
# Copyright 2017, Additive Regularization of Topic Models.
from __future__ import print_function
import os
import uuid
import string
import itertools
import tempfile
import shutil
import pytest
from six.moves import range, zip
import artm.wrapper
import artm.wrapper.messages_pb2 as messages... |
from django.db import models
from django.contrib.auth.models import AbstractUser
class CustomUser(AbstractUser):
pass
# add additional fields in here
def __str__(self):
return self.username
|
# while j < n and i < m:
# if i == -1 or t[j] == p[i]:
# j, i = j+1, i+1
# else:
# i = pnext[i]
def matching_KMP(t, p, pnext):
j, i = 0, 0
n, m = len(t), len(p)
while j < n and i < m:
if i == -1 or t[j] == p[i]:
j, i = j+1, i+1
else:
i = pn... |
def postprocess_decoded_seq(answers):
"""
Corrects for some extra spaces that are created by the decode method
of the tokenizer like in numerical strings
example: 1, 000, 000 --> 1,000,000
Args:
answers: list[str]
Returns:
new_answers: list[str]
"""
new_answers = []
for answer in answers:
parts = an... |
import os
# Import global settings to make it easier to extend settings.
from django.conf.global_settings import *
from django.core.exceptions import ImproperlyConfigured
def get_env_variable(var_name):
""" Get the environment variable or return an exception"""
try:
return os.environ[var_name]
exc... |
# -*- coding: utf-8 -*-
__author__ = 'CongRong <tr3jer@gmail.com>'
import difflib
from .utils.compat import bytes_decode, xrange
hashbits = 128
difflib_threshold = 0.95
simhash_threshold = 0.95
def simhash(tokens):
v = [0] * hashbits
for t in [string_hash(x) for x in tokens]:
for i in xrange(hashbits):
bi... |
print('Hello, World.')
# CONSOLE OUTPUT:
# Hello, World.
|
#================================================================
# Ensemble de requêtes SQL sur une base de données SQL
# hébergées sur un serveur local postgresql
#
# Modules pythons nécessaires
# psycopg2 (SQL connection)
# pandas (DataFrame et HTML)
# matplotlib
# jinja2 (styles HTML)
#
# Alexandre Cornier ... |
'''
Copyright 2016, United States Government, as represented by the Administrator of
the National Aeronautics and Space Administration. All rights reserved.
The "pyCMR" platform is licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may ... |
#############################################################################
# Classes related to the CyTrONE storyboard
#############################################################################
class Storyboard:
# Global configuration flags
ENABLE_HTTPS = True
ENABLE_PASSWORD = True
# Separato... |
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
from __future__ i... |
import datetime
import typing
from typing import TYPE_CHECKING
from warnings import warn
import discord
from discord.ext import commands
from discord.utils import snowflake_time
from . import error, http, model
from .dpy_overrides import ComponentMessage
if TYPE_CHECKING: # circular import sucks for typehinting
... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE.txt file in the root directory of this source tree.
import logging
import math
import time
from collections import defaultdict
from funct... |
from setuptools import setup, find_packages
with open("requirements.txt") as f:
required = f.read().splitlines()
setup(
name="icloudpd",
version="1.4.3",
url="https://github.com/ndbroadbent/icloud_photos_downloader",
description=(
"icloudpd is a command-line tool to download photos and vid... |
# -*- coding: utf-8 -*-
import setuptools
import khorosjx.utils.version
with open("README.md", "r") as fh:
long_description = fh.read()
version = khorosjx.utils.version.__version__
setuptools.setup(
name="khorosjx",
version=version,
author="Jeff Shurtliff",
author_email="jeff.shurtliff@rsa.com"... |
import logging
from typing import Dict, List
from overrides import overrides
from allennlp.common.file_utils import cached_path
from allennlp.data.dataset_readers.dataset_reader import DatasetReader
from allennlp.data.instance import Instance
from allennlp.data.fields import Field, TextField, ListField, IndexField
fr... |
"""
This module implements the TextResponse class which adds encoding handling and
discovering (through HTTP headers) to base Response class.
See documentation in docs/topics/request-response.rst
"""
import re
import codecs
from scrapy.xlib.BeautifulSoup import UnicodeDammit
from scrapy.http.response import Response
... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from qlib.backtest.exchange import Exchange
from qlib.backtest.position import BasePosition
from typing import List, Tuple, Union
from ..model.base imp... |
# 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 unittest
import json
import os
from ucuenca.ucuenca import Ucuenca
TEST_RESOURCES = os.path.join(
os.path.dirname(__file__),
"..", "tests_resources"
)
class GetCareersTests(unittest.TestCase):
def setUp(self):
self.ucuenca = Ucuenca()
def test_careers(self):
"""Check 0104926... |
from pathlib import Path
from fhir.resources.valueset import ValueSet as _ValueSet
from oops_fhir.utils import ValueSet
__all__ = ["CommonUCUMCodesForAge"]
_resource = _ValueSet.parse_file(Path(__file__).with_suffix(".json"))
class CommonUCUMCodesForAge(ValueSet):
"""
Common UCUM Codes for Age
Unifi... |
#!/usr/bin/env python
"""Generic parsers (for GRR server and client code)."""
from typing import Iterator
from typing import Text
from typing import Type
from typing import TypeVar
from grr_response_core.lib import factory
from grr_response_core.lib import rdfvalue
from grr_response_core.lib.parsers import abstract
fr... |
from discord.ext import commands
"""
A custom Cooldown type subclassing built in cooldowns from discord.ext commands.
This is a bucket type that allows cooldowns to work based on some text, allowing
things like cooldown on individual `Tags`, or message spam detection.
"""
class MessageTextBucket(commands.BucketType):... |
from typing import List
class Solution:
def findGCD(self, nums: List[int]) -> int:
a, b = min(nums), max(nums)
for i in range(a, 1, -1):
if b % i == 0 and a % i == 0:
return i
return 1
|
__source__ = 'https://leetcode.com/problems/insert-into-a-binary-search-tree/'
# Time: O(h) h: height of the tree
# Space: O(h)
#
# Description: Leetcode # 701. Insert into a Binary Search Tree
#
# Given the root node of a binary search tree (BST) and a value to be inserted into the tree,
# insert the value into the B... |
from flask import Flask, json
import logging
def log_exception(sender, exception, **extra):
sender.logger.debug('Got exception during processing: %s', exception)
def create_app(config_file):
#Instantiating Flask and appling config
app = Flask(__name__)
app.config.from_object(config_file)
from ap... |
#!/usr/bin/env python3
"""This is an example to train a task with TRPO algorithm.
Here it runs CubeCrash-v0 environment with 100 iterations.
"""
import click
import gym
from metarl import wrap_experiment
from metarl.envs import MetaRLEnv, normalize
from metarl.experiment import LocalTFRunner
from metarl.experiment.de... |
"""
mpld3 Utilities
===============
Utility routines for the mpld3 package
"""
import os
import re
import shutil
import warnings
from functools import wraps
from . import urls
# Make sure that DeprecationWarning gets printed
warnings.simplefilter("always", DeprecationWarning)
def html_id_ok(objid, html5=False):
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from operations import FactorizedReduce, StdConv, MixedOp
class Cell(nn.Module):
""" Cell for search
Each edge is mixed and continuous relaxed.
"""
def __init__(self, num_nodes, c_prev_prev, c_prev, c_cur, reduction_prev, reduction_cu... |
#!/usr/bin/python
from Bio import SeqIO
|
import os
import skylink
from skylink import testing
import numpy as np
from astropy.table import Table
import FoFCatalogMatching
import pytest # noqa
# TODO: test the matching with more than two catalogs
# TODO: test N-way matching with `linking_lengths` as a dictionary
# TODO: test if we catch illegal footprints th... |
import argparse
def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument(
'--model_dir', default='./text_training',
help='Output directory for model and training stats.')
parser.add_argument(
'--data_dir', default='./text_data',
help='Directory to download the... |
import pytest
import logging
import time
from tests.common.dualtor.dual_tor_utils import get_crm_nexthop_counter # lgtm[py/unused-import]
from tests.common.helpers.assertions import pytest_assert as py_assert
from tests.common.fixtures.ptfhost_utils import change_mac_addresses, run_garp_service
CRM_POLL_INTERVAL = 1... |
from __future__ import division
from libtbx.clear_paths \
import remove_or_rename_files_and_directories_if_possible
import sys
def run(args):
remaining = remove_or_rename_files_and_directories_if_possible(paths=args)
for path in remaining:
"WARNING: unable to remove or rename:", path
if (__name__ == "__main... |
from django.urls import path
from . import views
urlpatterns = [
path('open-account/',
views.OpenAccountAPIView.as_view(),
name='open_account'),
path('delete-account/<pk>/',
views.DeleteAccountAPIView.as_view(),
name='delete_account'),
path('deposit/<pk>/',
vi... |
# win32.py - utility functions that use win32 API
#
# Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""Utility functions that use win32 API.
Mark Hammond's win32all ... |
#from excel_work import*
from common_functions import *
from pull import *
#from mac_and_arp_work import *
from napalm import get_network_driver
from getpass import getpass
from pprint import pprint
from name_work import *
import openpyxl
from openpyxl import Workbook
from openpyxl.compat import range
fro... |
from __future__ import unicode_literals
import time
from django.conf import settings
from django.test import TestCase
from django.test.client import FakePayload, Client
from django.utils.encoding import force_text
from tastypie.serializers import Serializer
try:
from urllib.parse import urlparse
except ImportErr... |
__all__ = ['MqttCommManager']
from .mqtt_comm_manager import MqttCommManager
|
# Copyright 2020 Dirk Klimpel
#
# 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,... |
#!/usr/bin/python
# Copyright 2017 Google 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 by ... |
import os
from glob import glob
from setuptools import setup, find_packages
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
def recursive_include(module):
module_path = module.replace(".", "/") + "/"
files = glob(f"{module_path}**", recursive=True... |
from __future__ import unicode_literals
class SRPException(Exception):
"""Base srptools exception class."""
|
import plac
import numpy
import torch
from torch import autograd
from torch import nn
import torch.optim
import torch.cuda
from thinc.neural.ops import CupyOps
from thinc.extra.wrappers import PyTorchWrapper
from thinc.v2v import Model
def main(length=1000, nO=32, nI=32):
if CupyOps.xp != None:
print("U... |
from flask import render_template, g, request, url_for, jsonify, redirect
from flask_login import current_user, login_required
import flask_menu as menu
from sqlalchemy import desc, asc
from app import app, lm
from app.user.models import User, UserJoin
from app.contest.models import Contest
from app.submission.models ... |
from aoc.day_02 import IntcodeComputer
def _run_test(program, expected):
computer = IntcodeComputer(program).execute()
assert ",".join(str(x) for x in computer.memory) == expected
def test_input(monkeypatch):
monkeypatch.setattr("builtins.input", lambda: "1")
program = "3,0,99"
expected = "1,0,... |
# coding: utf-8
"""
NiFi Rest Api
The Rest Api provides programmatic access to command and control a NiFi instance in real time. Start and stop processors, monitor queues, query provenance data, and more. Each endpoint below includes a description, ... |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your opti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.