text stringlengths 1 927k |
|---|
# encoding: utf-8
from django.db import models
from django.utils.translation import ugettext_lazy as _
from core.utils import NONUNIQUE_SLUG_FIELD_PARAMS, is_within_period
class AlternativeSignupForm(models.Model):
"""
Most workers are registered using the default form. However, some workers are "special",
... |
"""
Various accuracy metrics:
* :func:`accuracy`
* :func:`multi_label_accuracy`
"""
from typing import Optional, Sequence, Union
import numpy as np
import torch
from catalyst.metrics.functional import process_multilabel_components
from catalyst.utils.torch import get_activation_fn
def accuracy(
outputs... |
#!/usr/bin/env python3
import tensorflow as tf
from layers.spectral_normalization import SpectralNormalization
class SpadeBN(tf.keras.layers.Layer):
"""SPADE BatchNormalization
Sources:
https://towardsdatascience.com/implementing-spade-using-fastai-6ad86b94030a
"""
def __init__(self, widt... |
# from typing_extensions import Required
from django.shortcuts import redirect, render
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from .decorators import allowed_users, unauthenticated_user
from .models impor... |
"""
plugins -- plug-in mechanism
Some function, such as floating point arithmetic, could have several
choices of modules. The 'plugins' module provides the mechanism to
choose one among these choices. One can *plug-in* one module or
another for the function.
Usage:
The choice among plug-in modules is made through nz... |
"""
Filters the RD-triangle coordinates from WKT to a min/max-x/y grid.
Call from commandline with the name of the file that is to be converted
as argument. This file should have a polygonID in the 2nd column (index 1)
and the actual WKT in the 6th column (index 5).
Returns a .csv file containing the polygon Id's and ... |
# !/usr/bin/env python3
# -*- encoding: utf-8 -*-
if __name__ == "__main__":
# Ввод
s = []
for i in range(0, 10):
a = int(input())
s.append(a)
# Нахождение позиции наибольшего и наименьшего
a = s[0]
b = s[0]
for i in range(1, 10):
if (s[i] > a):
posmax ... |
import _plotly_utils.basevalidators
class ReversescaleValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="reversescale", parent_name="scattergeo.marker", **kwargs
):
super(ReversescaleValidator, self).__init__(
plotly_name=plotly_name,
... |
import unittest
from collections import OrderedDict
from cricket_db.parsers.match import MatchParser
MATCH_ID = 947147
class TestMatchParser(unittest.TestCase):
def setUp(self):
self.match_id = MATCH_ID
self.match_parser = MatchParser(self.match_id)
self.fixtures = [
OrderedDi... |
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: sched
import heapq
from collections import namedtuple
__all__ = [
'scheduler']
Event = namedtuple('Event', 'time, priority, action, arg... |
# coding: utf-8
"""
Trend Micro Deep Security API
Copyright 2018 - 2020 Trend Micro Incorporated.<br/>Get protected, stay secured, and keep informed with Trend Micro Deep Security's new RESTful API. Access system data and manage security configurations to automate your security workflows and integrate Deep Se... |
"""
LeetCode Problem: 8. String to Integer (atoi)
Link: https://leetcode.com/problems/string-to-integer-atoi/
Language: Python
Written by: Mostofa Adib Shakib
Time complexity: O(n)
Space Complexity: O(1)
"""
class Solution:
def myAtoi(self, string: str) -> int:
# This gets rid of any white spaces
... |
# -*- coding: utf-8 -*-
"""
PyTorch: 새 autograd Function 정의하기
----------------------------------------
:math:`y=\sin(x)` 을 예측할 수 있도록, :math:`-\pi` 부터 :math:`pi` 까지
유클리드 거리(Euclidean distance)를 최소화하도록 3차 다항식을 학습합니다.
다항식을 :math:`y=a+bx+cx^2+dx^3` 라고 쓰는 대신 :math:`y=a+b P_3(c+dx)` 로 다항식을 적겠습니다.
여기서 :math:`P_3(x)=\frac{1}{... |
#!/usr/bin/python
#
##################################################
######## Please Don't Remove Author Name #########
############### Thanks ###########################
##################################################
#
#
__author__='''
Suraj Singh
surajsinghbisht054@gmail.com
http://bitforestinfo.bl... |
import unittest
from pfm.util.util import create_ordered_2d_array_from_dict
from pfm.util.util import convert_dictionary_to_2d_array
from pfm.util.util import sort_body_order
from pfm.util.util import add_headers
import sys
py_version = sys.version_info[0]
HEADERS = ['name', 'local_port', 'login_user']
JSON_DATA = {... |
import json
from pathlib import Path
from collections import defaultdict, Counter
from sklearn.metrics import precision_recall_fscore_support
PRECISION_FALLBACK = RECALL_FALLBACK = 1
# dataset -> setting -> emotion -> measure -> score
results = {}
for dataset_path in Path("workdata/indicator-experiment/predictions"... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
import rospy
import cv2
from cv_bridge import CvBridge, CvBridgeError
from sensor_msgs.msg import Range, BatteryState, CameraInfo, Temperature, NavSatFix, Image
from geometry_msgs.msg import PoseWithCovarianceStamped, PointStamped
from std_msgs.msg import Float64, Header
from mavros_msgs.msg import State
import numpy a... |
import contextlib
import json
import logging
import os
from typing import Any, Dict, Optional
from unittest import mock
import pytest
import torch
import torch.nn.functional as F
from torch import nn, Tensor
from torch.optim import Optimizer
from torch.utils.data import DataLoader
from torchmetrics import Accuracy
fr... |
"""
Django settings for sports_betting_33417 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/
"""
... |
"""
NAME
Custom Colormaps for Matplotlib
PURPOSE
This program shows how to implement make_cmap which is a function that
generates a colorbar
PROGRAMMER(S)
Chris Slocum
Gauthier Rousseau
REVISION HISTORY
20130411 -- Initial version created
20140313 -- Small changes made and code posted online... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import hashlib
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.... |
from setuptools import setup
from Cython.Build import cythonize
setup(name = 'libmesh',
ext_modules = cythonize("*.pyx")) |
from tabulate import tabulate
y = [46, 43, 41, 30, 35, 19, 37, 14, 2, 41, 45, 22, 5, 17]
x = [10, 13, 15, 25, 20, 35, 18, 40, 51, 15, 11, 32, 48, 37]
sum_x = sum(x)
sum_y = sum(y)
avg_x = sum(x) / len(x)
avg_y = sum(y) / len(y)
xy = [a * b for a,b in zip(x,y)]
sum_xy = sum(xy)
avg_xy = sum(xy) / len(xy)
x_squared = ... |
import logging
import time
import requests.auth
import requests_ntlm
import requests_oauthlib
from .errors import UnauthorizedError, TransportError
from .util import create_element, add_xml_child, xml_to_str, ns_translation, _may_retry_on_error, _back_off_if_needed, \
DummyResponse, CONNECTION_ERRORS
log = loggi... |
import iland
import time
import json
CLIENT_ID = ''
CLIENT_SECRET = ''
USERNAME = ''
PASSWORD = ''
COMPANY_ID = ''
api = iland.Api(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, username=USERNAME, password=PASSWORD)
def main():
export_edge_firewalls()
def export_edge_firewalls():
# Get all the edges for... |
#!/usr/bin/env python3
import sys
import os
import re
def error_search(log_file):
error = input("What is the error? ")
returned_errors = []
with open(log_file, mode='r',encoding='UTF-8') as file:
for log in file.readlines():
error_patterns = ["error"]
for i in range(len(error.split(' '))):
... |
"""
Play the classic Snake game.
Classes:
Game
Functions:
reset()
move(direction) -> boolean
run()
"""
import pygame
from random import randint
class Game:
def __init__(self, graphics=True, starting_size=3):
"""
This class is everything you need to run the game.
If y... |
import torch
from torch import nn
from typing import List
from .base import ResnetBase
class Segmenter(ResnetBase):
"""A ResNet34 U-Net model, as described in
https://github.com/fastai/fastai/blob/master/courses/dl2/carvana-unet-lrg.ipynb
Attributes:
imagenet_base: boolean, default: False
... |
''' 15 Escreva um programa que pergunte a quantidade de Km percorridos por um carro alugado e a quantidade de dias pelos quais ele foi alugado.
Calcule o preço a pagar, sabendo que o carro custa R$60 por dia e R$0,15 por Km rodado.'''
quantidade_de_km = float(input("Digite a quantidade de km percorridos: "))
quantid... |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
"""Create a new user in the s... |
"""
Data structure for 1-dimensional cross-sectional and time series data
"""
from __future__ import annotations
from io import StringIO
from shutil import get_terminal_size
from textwrap import dedent
from typing import (
IO,
TYPE_CHECKING,
Any,
Callable,
Hashable,
Iterable,
List,
Opti... |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU', 'C3pro'])
Monomer('SmacM', ['BaxA'])
Monomer('BaxM', ['BidM', '... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/lair/brackaset/shared_lair_brackaset.iff"
result.attribute_template... |
import numpy as np
import networkx as nx
from copy import deepcopy
from texttable import Texttable
from collections import deque
from nncf.quantization.layers import SymmetricQuantizer
from nncf.nncf_network import NNCFNetwork, NNCFGraph
from nncf.dynamic_graph.transform_graph import is_nncf_module
from nncf.quantizat... |
print('Digite a idadde e o tempo de serviço, para podeer saber se pode ou não se aposentar')
idade = int(input("Idade: "))
tempo_servico = int(input('Tempo de serviço: '))
if idade >= 65 or tempo_servico >= 30 or idade >= 60 and tempo_servico >= 25:
print("Pode se aposentar")
else:
print('Não pode se aposentar'... |
from bertmap.onto.onto_text import OntoText
from bertmap.onto.onto_index import OntoInvertedIndex
from bertmap.onto.onto_box import OntoBox
from bertmap.onto.onto_eval import OntoEvaluator |
if __name__ == '__main__':
import os
from torchvision.transforms import Compose, Normalize, Resize, ToTensor
from torch.utils.data import DataLoader
from models import Discriminator, Generator, weights_init
import torch
import torch.nn as nn
import matplotlib.pyplot as plt
from time impo... |
"""
FIXME, shall we allow diagonal route for electrical connections?
"""
if __name__ == "__main__":
import gdsfactory as gf
c = gf.Component("pads_route_from_steps")
pt = c << gf.components.pad_array(orientation=270, columns=3)
pb = c << gf.components.pad_array(orientation=90, columns=3)
pt.move(... |
from conans import ConanFile, CMake, tools
import functools
import os
required_conan_version = ">=1.33.0"
class LibdwarfConan(ConanFile):
name = "libdwarf"
description = "A library and a set of command-line tools for reading and writing DWARF2"
topics = ("libdwarf", "dwarf2", "debugging", "dwarf")
ur... |
# Flow visualization code
# used from https://github.com/tomrunia/OpticalFlow_Visualization
# MIT License
#
# Copyright (c) 2018 Tom Runia
#
# 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 w... |
# Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
#
# 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
#... |
#!/usr/bin/python3
"""Student module.
Contains a Student class and some methods.
"""
class Student():
"""Defines a Student."""
def __init__(self, first_name, last_name, age):
"""Sets the necessary attributes for the Student object.
Args:
first_name (str): first name of the stude... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
import time
import warnings
from typing import Iterable, Iterator, Sequence, Sized, Tuple, Type
import numpy as np
HASH_TYPE: T... |
#!/usr/bin/env python
import sys
from my_configuration import *
from my_instruction import *
from webpage import Html5
def main():
css_class = "support"
page = Html5(css_class, "HowTo use Bash")
page.add(
htmltags.p[
"TODO: Describe how to use Bash command-line completion, editing, a... |
import curses
from itertools import islice, izip
from .pad_display_manager import PadDisplayManager
from .rate import get_rate_string
SESSIONS_HEADER = "| Idx | Type | Details | RX Rate | TX Rate | Activity Time "
SESSIONS_BORDER = "+-----+------+-------------... |
import logging
import os
import yaml
__version__ = "2.0.5"
logging.getLogger().setLevel(logging.INFO)
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "global_config.yaml")) as f:
global_config = yaml.load(f, Loader=yaml.FullLoader)
# can override assets_path and dataset_path from environmen... |
import io
import base64
import requests
from nbt import nbt
from .errors import *
from .errors import _get_response_exception
def decode_item_bytes(item_bytes: bytes) -> nbt.NBTFile:
return nbt.NBTFile(fileobj=io.BytesIO(base64.b64decode(item_bytes)))
def request_endpoint(endpoint: str, args: dict[str, str] | N... |
"""LISY System 1/80 platform.""" |
#Visualization Module |
# This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script.
"""Public API for tf.keras.mixed_precision namespace.
"""
from __future__ import print_function as _print_function
import sys as _sys
from . import experimental
del _print_function
from... |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... |
import os
import unittest
import mock
from dem.dependency.url import UrlInstaller
from dem.project.cache import PackageCache
class TestUrlInstaller(unittest.TestCase):
@mock.patch('wget.download')
def test_will_get_packages_and_download(self, mock_wget):
cache = mock.MagicMock(spec = PackageCache)
... |
import io
from os.path import exists, join
import time
from socket import gethostname
from OpenSSL import crypto, SSL
import pytest
import torch
import syft as sy
from syft.generic.frameworks.hook import hook_args
from syft.frameworks.torch.fl import utils
from syft.workers.websocket_client import WebsocketClientWorke... |
from flask import request
from resources import BaseResource, ResourceMixinBase
from db import session_scope
from db.devices import Devices as DevicesDB
from lib import devices as devicesLib
class DeviceResourceMixin(ResourceMixinBase):
def __init__(self):
super().__init__()
def get_status(self, ... |
# Generated by Django 3.2.12 on 2022-03-23 23:48
import django.core.validators
from django.db import migrations, models
import django_ckeditor_5.fields
class Migration(migrations.Migration):
dependencies = [
('articles', '0008_auto_20220320_1346'),
]
operations = [
migrations.AlterField... |
import time
import torch
from hpc_rll.origin.rnn import get_lstm
from hpc_rll.torch_utils.network.rnn import LSTM
from testbase import mean_relative_error, times
assert torch.cuda.is_available()
use_cuda = True
seq_len = 64
batch_size = 3
input_size = 1792
hidden_size = 384
num_layers = 3
norm_type = 'LN'
dropout = 0... |
# Copyright (c) 2015 Alex Waite
# 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... |
from xsdata.codegen.handlers import AttributeEffectiveChoiceHandler
from xsdata.codegen.models import Restrictions
from xsdata.utils.testing import AttrFactory
from xsdata.utils.testing import ClassFactory
from xsdata.utils.testing import FactoryTestCase
class AttributeEffectiveChoiceHandlerTests(FactoryTestCase):
... |
from __future__ import unicode_literals
from geopy.point import Point
from geopy.location import Location
from geopy import geocoders
__name__ = 'geopy'
__author__ = 'Brian Beck'
__version_info__ = (1, 0, 0)
__version__ = '.'.join(map(str, __version_info__))
__date__ = '2014/07/22 4:47:00 PM'
__credits__ = ['Brian Be... |
""" Local shapes module, containing the logic for creating shapes"""
import numpy as np
import basic_shapes as bs
def createColorTriangleIndexation(start_index, a, b, c, color):
# Defining locations and colors for each vertex of the shape
vertices = [
# positions colors ... |
from social_core.backends.facebook import FacebookOAuth2, FacebookAppOAuth2 |
import os
import time
import fnmatch
import warnings
import py_compile
from django.core.management.base import NoArgsCommand
from django.conf import settings
from django_extensions.management.utils import get_project_root
from optparse import make_option
from os.path import join as _j
class Command(NoArgsCommand):
... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.home),
] |
"""Test:
- Vector opening
- Vector creation
- Attributes validity
- Vector deletion
"""
# pylint: disable=redefined-outer-name
from __future__ import division, print_function
import itertools
import os
import uuid
import tempfile
import operator
from pprint import pprint
import numpy as np
import pytest
from osgeo i... |
# Copyright 1999-2018 Alibaba Group Holding 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 a... |
# Copyright 2015 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 applicable law o... |
from django.views.generic import CreateView, UpdateView, DetailView, ListView
from ..models_ex.models_two_scoops_of_django import Flavor
from django import forms
# reference : https://blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=pjok1122&logNo=221609547295
# sub reference : https://m.blog.naver.com/pjok11... |
#!/usr/bin/env python3
import os
import shutil
from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, apply_patches
def main():
root, repo = setup_upstream_repo("https://github.com/fmtlib/fmt", "8.1.1")
wpiutil = os.path.join(root, "wpiutil")
# Delete old in... |
#!/usr/bin/env python2.7
#
# Copyright 2008 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 l... |
"""Fuzzing template for TensorFlow ops."""
def tf_ops_fuzz_target_lib(name):
native.cc_library(
name = name + "_fuzz_lib",
srcs = [name + "_fuzz.cc"],
deps = [
"//tensorflow/core/kernels/fuzzing:fuzz_session",
"//tensorflow/cc:cc_ops",
],
tags = ["no_windows"],
... |
# coding: utf-8
__author__ = 'klem4'
VERSION = (0, 1, 2)
__version__ = '.'.join(map(str, VERSION))
from django.conf import settings
if settings.DEBUG:
print "DEBUG: %s" % __version__ |
# -*- coding: utf-8 -*-
"""
**************
Adjacency List
**************
Read and write NetworkX graphs as adjacency lists.
Adjacency list format is useful for graphs without data associated
with nodes or edges and for nodes that can be meaningfully represented
as strings.
Format
------
The adjacency list format cons... |
from ninja.errors import ConfigError
class SecuritySchema(dict):
def __init__(self, type: str, **kwargs):
super().__init__(type=type, **kwargs)
class AuthBase:
def __init__(self):
if not hasattr(self, "openapi_type"):
raise ConfigError("If you extend AuthBase you need to define o... |
import numpy as np
import tvm
from tvm.contrib import graph_runtime
import topi
import topi.testing
import nnvm.symbol as sym
import nnvm.compiler
from nnvm.testing.config import ctx_list
def test_conv2d():
x = sym.Variable("x")
y = sym.conv2d(x, channels=10, kernel_size=(3,3),
name="y", p... |
import websocket
import threading
from time import sleep
def on_message(ws, message):
print(message)
def on_close(ws):
print("closed")
if __name__ == "__main__":
websocket.enableTrace(True)
ws = websocket.WebSocketApp("ws://localhost:9001", on_message = on_message, on_close = on_close)
wst = thre... |
from .blueprint import exposable_blueprint |
import sys
from PyQt5 import QtWidgets
from PyQt5.QtCore import (Qt, QRectF)
from PyQt5.QtGui import (QCursor, QPainterPath, QRegion)
from Best_Practices_gui import Ui_Form
class Form(QtWidgets.QWidget, Ui_Form):
def __init__(self):
super().__init__()
self.setupUi(self)
self.btn_minimize_... |
import os
import time
import json
import redis
import requests
import signal
import random
from multiprocessing import Process, Pool
from bos_filter import RedisDB, BosFilter
from bili_mongo import BosMongo
rdb = RedisDB()
mbd = BosMongo()
bf = BosFilter()
r = redis.Redis(host="127.0.0.1")
redis_key = "bili_relation_... |
import FWCore.ParameterSet.Config as cms
from QCDAnalysis.Skimming.diMuonEventContent_cfi import *
diMuonOutputModule = cms.OutputModule("PoolOutputModule",
diMuonEventSelection,
diMuonEventContent,
dataset = cms.untracked.PSet(
filterName = cms.untracked.string('diMuons'),
dataTier = cms.u... |
import os
import re
import subprocess
class FfmpegWrapper:
length_frames_regex = r"frame *\= *(?P<frames>[\d\.]+).*"
def __init__(self, ffmpeg_path):
self.ffmpeg_path = ffmpeg_path
@staticmethod
def _read_lines(process):
while True:
process.stderr.flush()
line... |
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
setup(name="minitree",
version="0.4.1",
description="List files in columns",
url="https://github.com/xyproto/minitree",
author="Alexander F. Rødseth",
author_email="xyproto@archlinux.org",
license="MIT",
... |
import rootfs_boot
import os
from devices import board
class IPTablesDump(rootfs_boot.RootFSBootTest):
'''Dumps all IPTables rules with stats'''
def runTest(self):
pp = board.get_pp_dev()
with open(os.path.join(self.config.output_dir, 'iptables.log'), 'w') as ipt_log:
for tbl in [... |
import time
class UtilityLogger:
@classmethod
def log_this(cls, err_log):
fo = open("./utilities/logs/{}.log".format(time.strftime("%Y%m%d", time.localtime())), "a")
fo.write(err_log)
fo.close() |
# Copyright (c) 2019, NVIDIA 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 i... |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
# ulogme_serve.py for https://github.com/Naereen/uLogMe/
# MIT Licensed, https://lbesson.mit-license.org/
#
from __future__ import print_function # Python 2 compatibility
from __future__ import absolute_import # Python 2 compatibility
import sys
import os
import subproc... |
# NLP written by GAMS Convert at 04/21/18 13:52:27
#
# Equation counts
# Total E G L N X C B
# 34 2 10 22 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... |
import core
from common import *
wX, sr = loadWav("x.wav")
wY, sr = loadWav("y.wav")
out = None
for iChannel in range(wX.shape[1]):
print("Ch", iChannel)
x = wX.T[iChannel]
y = wY.T[iChannel]
processor = core.Processor(sr, [(0.208, 0.509), (14.579, 15.031)], method = "simple")
o = processor(x, y... |
from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.test import TestCase
from lists.views import home_page
class HomePageTest(TestCase):
def test_root_url_resolves_to_home_page_view(self):
found = resolve('/')
... |
# -*- coding: utf-8 -*-
##
# Copyright (C) 2007 Ingeniweb
# 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 2 of the License, or
# (at your option) any later version.
# This progr... |
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# (c) 2005 Clark C. Evans
# This module is part of the Python Paste Project and is released under
# the MIT License: http://www.opensource.org/licenses... |
# Copyright Jamie Allsop 2016-2017
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#-------------------------------------------------------------------------------
# FilterMethod
#-----------... |
# *****************************************************************************
#
# Copyright (c) 2020, the pyEX authors.
#
# This file is part of the pyEX library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
from collections import namedtuple
VersionI... |
__author__ = 'xubinggui' |
import warnings
import sys
import os
import itertools
import textwrap
import pytest
import weakref
import numpy as np
from numpy.testing import (
assert_equal, assert_array_equal, assert_almost_equal,
assert_array_almost_equal, assert_array_less, build_err_msg, raises,
assert_raises, assert_warns, assert_n... |
# Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import re
import json
import reframe.utility as util
import reframe.utility.jsonext as jsonext
from reframe.core.backends imp... |
async = await = 2
async : keyword.control.flow.python, source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
await : keyword.control.flow.python, source.python
: source.python
= : keyword.o... |
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from guardian.models import UserObjectPermission as BaseUserObjectPermission
from guardian.managers import UserObjectPermissionManager as BaseUserObjectPermissionManager
from guardian.exceptions import ObjectNo... |
import random
import warnings
import pytest
import tcod
def pytest_addoption(parser):
parser.addoption("--no-window", action="store_true",
help="Skip tests which need a rendering context.")
@pytest.fixture(scope="session", params=['SDL', 'SDL2'])
def session_console(request):
if(request.config.getop... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Palo Alto Networks, 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
#
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.