text stringlengths 1 927k |
|---|
import ckan.lib.base as base
import ckan.lib.helpers as helpers
render = base.render
class MyExtController(base.BaseController):
def config_one(self):
'''Render the config template with the first custom title.'''
return render('admin/myext_config.html',
extra_vars={'title'... |
# Python
import logging
# Genie
from genie.metaparser.util.exceptions import SchemaEmptyParserError
log = logging.getLogger(__name__)
def get_lacp_member(device, port_channel, count, member, intf_list, internal=False):
""" This API parse's 'show lacp internal/neighbor' commands and return requested member
... |
# Copyright (c) 2021 PaddlePaddle 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 appli... |
"""
Represents a connection response message
"""
from marshmallow import fields
from ...agent_message import AgentMessage, AgentMessageSchema
from ..message_types import CONNECTION_RESPONSE
from ....models.connection_detail import ConnectionDetail, ConnectionDetailSchema
HANDLER_CLASS = (
"indy_catalyst_agent.me... |
"""MLPerf Inference LoadGen python bindings.
Creates a module that python can import.
All source files are compiled by python's C++ toolchain without depending
on a loadgen lib.
This setup.py can be used stand-alone, without the use of an external
build system. This will polute your source tree with output files
and... |
from __future__ import print_function
import torch
from torch import nn
import torch.utils.data as Data
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import collections
import math
import copy
torch.manual_seed(1)
np.random.seed(1)
class BIN_Interaction_Flat(nn.Sequential):... |
"""
OXASL - Module to generate a suitable mask for ASL data
Copyright (c) 2008-2020 Univerisity of Oxford
"""
import numpy as np
import scipy as sp
import fsl.wrappers as fsl
from fsl.data.image import Image
from oxasl import reg
from oxasl.reporting import LightboxImage
def generate_mask(wsp):
"""
For comp... |
from ..libs import Gtk
from ..window import GtkViewport
from .base import Widget
class SplitContainer(Widget):
def create(self):
# Use Paned widget rather than VPaned and HPaned deprecated widgets
# Note that orientation in toga behave unlike Gtk
if self.interface.VERTICAL:
sel... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-02-03 15:17:08
# @Author : Vophan Lee (vophanlee@gmail.com)
# @Link : https://www.jianshu.com/u/3e6114e983ad
from sklearn.datasets import make_classification
import numpy as np
import math
class Decision_Tree(object):
"""
this is a class to ... |
#!/usr/bin/env python
#from:http://www.wooyun.org/bugs/wooyun-2010-093049
import re,time
def assign(service, arg):
if service == "umail":
return True, arg
def audit(arg):
url = arg + '/webmail/fast/index.php?module=operate&action=login'
postdata = 'mailbox=test@domain.com&link=?'
code, head, ... |
# %% [markdown]
# [](https://colab.research.google.com/github/jun-hyeok/SUP5001-41_Deep-Neural-Networks_2022Spring/blob/main/DNN_HW5/main.ipynb)
# %% [markdown]
# # DNN HW5 : #9
#
# 2022.03.23
# 박준혁
# %%
import numpy as np
import torch
import t... |
# -*- coding: utf-8 -*-
"""
Default Django settings. Override these with settings in the module pointed to
by the DJANGO_SETTINGS_MODULE environment variable.
"""
from __future__ import unicode_literals
# This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module d... |
#!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
from datetime import datetime
import mock
import os
import pytest
import tempfile
import sys
from sacred.run import Run
from sacred.config.config_summary import ConfigSummary
from sacred.utils import (ObserverError, ... |
"""
A simple tool to compare the performance of different impls of
DistributedDataParallel on resnet50, three flavors:
1. DistributedDataParallel, which has a python wrapper and C++ core to do
gradient distribution and reduction. It's current production version.
2. PythonDDP with async gradient reduction.
3. Pyth... |
import unittest
import mock
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
def sigmoid(x):
return numpy.tanh(x * 0.5) * 0.5 + 0.5
def _split(inputs, pos):
return inputs[:pos]... |
import argparse
import random
import torch
import torch.nn as nn
import torch.optim as optim
from model_live import GGNN
from utils.train_live import train
from utils.test_live import test
from utils.validation_live import validation
from utils.data.wy_dataset_live import bAbIDataset
from utils.data.dataloader import... |
from tqdm import tqdm
from concurrent.futures import ProcessPoolExecutor, as_completed
def parallel_process(array, function, n_jobs=16, use_kwargs=False, front_num=0):
"""
A parallel version of the map function with a progress bar.
Args:
array (array-like): An array to iterate over.
... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
import cv2
import os
import numpy as np
import copy
WINDOW_NAME = "Label image"
WINDOW2_NAME = "Class image"
all_img = []
rootdir = './dataset'
drawing = False # true if mouse is pressed
Cnow = -1
ix,iy = -1,-1
i = 0
type_name = ".bmp"
def nothing(x):
pass
def draw_null(event,x,y,flags,param):
pass
def color(... |
from gym.envs.registration import register
import gym
from test_env.envs import *
register(
id='Fourrooms-v1',
entry_point='test_env.envs.fourrooms:Fourrooms',
kwargs={
'map_name': '9x9',
})
register(
id='Fourroomssto-v1',
entry_point='test_env.envs.fourroom_sto:Fourroomssto',
)
regi... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from horch.common import tuplify
from horch.models.block import mb_conv_block, MBConv
from horch.models.detection.nasfpn import ReLUConvBN
from horch.models.modules import upsample_add, Conv2d, Sequential, Pool2d, upsample_concat
from horch.models.dete... |
# Copyright (c) 2020 The Khronos Group 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 or agreed ... |
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import permission_required
from django.http import JsonResponse
from django.shortcuts import get_object_or_404
from django.template import RequestContext
from django.template.loader import render_to_string
from django.utils.decorators im... |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Lockelycoin ... |
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import redirect_to_login
from django.core.exceptions import PermissionDenied
from django.template.response import TemplateResponse
from django.urls import reverse
from ..utils import default_device
class OTPRequiredMixin:
"""
... |
from . import FixtureTest
class BoundariesMinZoomAndNameNe(FixtureTest):
# global:
# # NOTE: Natural Earth 1:50 million used zooms 0,1,2,3,4
# # and only has USA, Canada, Brazil, and Australia
# # all with scalerank of 2 (a documented NE omission).
# # Then 1:10 million N... |
"""
Command line interface (cli) for aiida_abinit.
Register new commands either via the "console_scripts" entry point or plug them
directly into the 'verdi' command by using AiiDA-specific entry points like
"aiida.cmdline.data" (both in the setup.json file).
"""
import sys
import click
from aiida.cmdline.utils import... |
num = int(input('Digite um número: '))
tot = 0
for c in range(1, num + 1):
if num % c == 0:
print('\33[33m', end='')
tot += 1
else:
print('\33[31m', end='')
print('{} '.format(c), end='')
print('\n\033[mO número {} foi divisível {} vezes'.format(num, tot))
if tot == 2:
print('E p... |
# groceries.py
products = [
{"id":1, "name": "Chocolate Sandwich Cookies", "department": "snacks", "aisle": "cookies cakes", "price": 3.50},
{"id":2, "name": "All-Seasons Salt", "department": "pantry", "aisle": "spices seasonings", "price": 4.99},
{"id":3, "name": "Robust Golden Unsweetened Oolong Tea", "d... |
'''Game main module.
Contains the entry point used by the run_game.py script.
Feel free to put all your game code here, or in other modules in this "gamelib"
package.
'''
import pygame
import pygame.display
import pygame.surface
import pygame.event
import pygame.image
import pygame.transform
from gamelib.scene impor... |
# Generated by Django 2.2.12 on 2020-04-07 14:15
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0003_user_accepted_guidelines'),
]
operations = [
migrations.Cre... |
# -*- coding: utf-8 -*-
"""
GESD based Detect outliers.
Generalized ESD Test for Outliers
see 'GESD<https://www.itl.nist.gov/div898/handbook/eda/section3/eda35h3.htm>'
"""
import collections
from typing import List
import numpy as np
import numpy.ma as ma
import structlog
from scipy.stats import t
LOG = structlog.... |
# -*- coding: utf-8 -*-
'''
Managing software RAID with mdadm
==================================
A state module for creating or destroying software RAID devices.
.. code-block:: yaml
/dev/md0:
raid.present:
- opts: level=1 chunk=256 raid-devices=2 /dev/xvdd /dev/xvde
'''
# Import python libs
impor... |
# -*- coding: utf-8 -*-
"""DS_Example_1
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/19yTJF6zhM4FxOeKo726e-irJ-BXNoR3t
"""
# coding=utf-8
# Author: Rafael Menelau Oliveira e Cruz <rafaelmenelau@gmail.com>
#
# License: BSD 3 clause
"""
=============... |
# Copyright 2013-2020 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)
from spack import *
class Eospac(Package):
"""A collection of C routines that can be used to access the Sesame data... |
####Please do not remove lines below####
from lmfit import Parameters
import numpy as np
import sys
import os
sys.path.append(os.path.abspath('.'))
sys.path.append(os.path.abspath('./Functions'))
sys.path.append(os.path.abspath('./Fortran_rountines'))
####Please do not remove lines above####
####Import your modules b... |
# Generated by Django 4.0 on 2022-01-10 15:42
from django.contrib.postgres.operations import CITextExtension
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("core", "0007_ltree"),
]
operations = [CITextExtension()] |
import numpy as np
from prml.linear._regression import Regression
class BayesianRegression(Regression):
"""Bayesian regression model.
w ~ N(w|0, alpha^(-1)I)
y = X @ w
t ~ N(t|X @ w, beta^(-1))
"""
def __init__(self, alpha: float = 1.0, beta: float = 1.0):
"""Initialize bayesian lin... |
import fnmatch
import logging
import os
import subprocess
from kubeflow.testing import util
import pytest
logging.basicConfig(
level=logging.INFO,
format=('%(levelname)s|%(asctime)s'
'|%(pathname)s|%(lineno)d| %(message)s'),
datefmt='%Y-%m-%dT%H:%M:%S',
)
logging.getLogger().setLevel(logging.... |
# 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... |
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from datetime im... |
#definition for music_func goes here
def music_func(music, group, singer):
print("The best kind of music is", music)
print("The best music group is", group)
print("The best lead vocalist is", singer)
def main():
music, group, singer = '', '', ''
while music != 'quit':
try:
music... |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from de... |
# Copyright (c) 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 writing, so... |
"""passbook audit urls"""
urlpatterns = [] |
from dotenv import load_dotenv
import os
import boto3
# Define constants
load_dotenv()
AWS_USERNAME = os.environ['aws_username']
AWS_BUCKET = os.environ['aws_bucket']
AWS_REGION = os.environ['aws_region']
AWS_ACCESS_KEY_ID = os.environ['aws_access_key_id']
AWS_SECRET_ACCESS_KEY = os.environ['aws_secret_access_key']
... |
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.manifold import TSNE
from sklearn.cluster import AgglomerativeClustering, KMeans
from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as plt
import matplotlib
import seaborn as sns
import pandas
import matplotlib.cm as cm
import umap... |
from scraper import scrape
def main():
scrape()
if __name__ == '__main__':
main() |
''' pcap_graph worker '''
import zerorpc
import os
import pprint
import gevent
def gsleep():
''' Convenience method for gevent.sleep '''
print '*** Gevent Sleep ***'
gevent.sleep(0)
class PcapGraph(object):
''' This worker generates a graph from a PCAP (depends on Bro) '''
dependencies = ['pcap_br... |
# NOTE: These are taken from the jinja2-ansible-filters package:
# NOTE: https://pypi.org/project/jinja2-ansible-filters
# NOTE: The installer has a problem in its egg-info preventing a regular pip install.
# NOTE: If we do not need the b64encode filter, we can omit this file and the filter setup.
# (c) 2012, Jeroen H... |
import time
import datetime
import random
import sys
import logging
from pathlib import Path
from typing import Union
from torch import cuda
from torch.utils.data import Dataset, DataLoader
from torch.optim.sgd import SGD
try:
from apex import amp
except ImportError:
amp = None
import flair
from flair.data impo... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.5 on Mon Jul 27 15:21:25 2015
import wx
# begin wxGlade: extracode
# end wxGlade
class MyDialog(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: MyDialog.__init__
kwds["style"] = kwds.get("style", 0) | wx.DEF... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 6
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_1_1
from i... |
word = input("Input a word : ")
print(word[::-1]) |
#########################################################################
#
# Date: Nov. 2002 Author: Daniel Stoffler
#
# Copyright: Daniel Stoffler and TSRI
#
#########################################################################
import sys
from mglutil.regression import testplus
from mglutil.web import HTMLParse... |
class TableLayoutCellPaintEventHandler(MulticastDelegate, ICloneable, ISerializable):
"""
Represents the method that will handle the System.Windows.Forms.TableLayoutPanel.CellPaint event.
TableLayoutCellPaintEventHandler(object: object,method: IntPtr)
"""
def BeginInvoke(self, sender, e, callback, objec... |
'''
Verify basic HTTP/2 functionality.
'''
# @file
#
# Copyright 2020, Verizon Media
# SPDX-License-Identifier: Apache-2.0
#
Test.Summary = '''
Verify basic HTTP/2 functionality.
'''
#
# Test 1: Verify correct behavior of a single HTTP/2 transaction.
#
r = Test.AddTestRun("Verify HTTP/2 processing of a single HTTP tr... |
# Copyright 2013-2018 CERN for the benefit of the ATLAS collaboration.
#
# 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... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 17 09:57:12 2020
@author: Heber
"""
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
#%% valor exacto d ela derivada
up = np.cos(1.0)
h = 0.1
up_aprox = (np.sin(1+h)-np.sin(1))/h
error = up - up_aprox
print ("Valor aproximado: ",up_aprox)... |
grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]
def print_grades(grades):
for grade in grades:
print grade
def grades_sum(grades):
total = 0
for grade in grades:
total += grade
return total
def grades_average(grades):
sum_of_grades = grades_sum(grades)
avera... |
from distutils.core import setup
import setuptools
import sys
import os
version = "0.3.dev"
setup(
name="numpydoc",
packages=["numpydoc"],
package_dir={"numpydoc": ""},
version=version,
description="Sphinx extension to support docstrings in Numpy format",
# classifiers from http://pypi.python.... |
"""Demonstrates partial run when some input data not there.
"""
from remake import Remake, TaskRule
ex8 = Remake()
class CannotRun(TaskRule):
rule_inputs = {'in1': 'data/inputs/input_not_there.txt'}
rule_outputs = {'out': 'data/inputs/ex8_in1.txt'}
def rule_run(self):
input_text = self.inputs['i... |
from functools import partial
import six
from dagster import check
from dagster.core.storage.type_storage import TypeStoragePlugin
from .builtin_enum import BuiltinEnum
from .builtin_config_schemas import BuiltinSchemas
from .config import ConfigType
from .config import List as ConfigList
from .config import Nullab... |
# -*- coding: utf-8 -*-
import pytest
import pandas.util.testing as tm
from pandas.core.indexes.api import Index, CategoricalIndex
from pandas.core.dtypes.dtypes import CategoricalDtype
from .common import Base
from pandas.compat import range, PY3
import numpy as np
from pandas import Categorical, IntervalIndex, c... |
# Copyright (c) 2017-2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
__all__ = ["FrozenDict", "to_hashable"]
class FrozenDict(dict):
"""
A special subclass of `dict` that is immutable and hashable. Instances of this "dict" can be
use... |
from typing import Dict, List
class Playlist:
def __init__(self):
self.__queue: Dict[int, List[Dict[str, str]]] = {}
def insert_one(self, chat_id: int, data: Dict[str, str]):
if chat_id not in self.__queue:
self.__queue[chat_id] = [data]
else:
queue = self.__qu... |
import os
import datetime
import FixedText
class HtmlGenerator(object):
def __init__(self, output_path, smell_list, category_list):
self.smell_list = smell_list
self.out_path = output_path
self.category_list = category_list
def generate(self):
self.generate_index()
self... |
from machine import Pin, PWM
import pycom
import time
class Rotate:
# Servo to fixed position
def __init__(self, pwm):
# Assum 50ms timer already set up and going to reuse
self.pwm = pwm
self.is_active = False
self.at_position = 50
def run(self):
pass
def state... |
# coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
#!/usr/bin/env python3
import telnetlib
import struct
import logging
HOST="localhost"
#while true; do nc -l -p 1111 -e /tmp/vuln; done
old_write=telnetlib.Telnet.write
def write(self, str_: bytes):
try:
print("w: ",str_.decode("utf-8"))
except UnicodeDecodeError:
print("w: ",str_)
old_writ... |
# -*- coding: utf-8 -*-
"""
# Home Assistant Custom Component supporting [enerPI sensors](https://github.com/azogue/enerpi)
running *enerpi* + *enerpiweb* in some local host.
Derived from the general REST sensor (https://home-assistant.io/components/sensor.rest/), it connects via GET requests
to the local working ener... |
# Copyright (c) 2010 Robert Mela
#
# 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, dis-
# ... |
from modules.lib.reporter import Reporter
from modules.lib.report import Report
from modules.lib.alarm_machine import AlarmMachine
class TemperatureReporter(Reporter):
def data_type(self):
return 'temperature'
def report(self):
with open('/sys/class/thermal/thermal_zone0/temp') as file:
... |
from setuptools import setup, find_packages
setup(
name='the-littlest-jupyterhub',
version='0.1',
description='A small JupyterHub distribution',
url='https://github.com/jupyterhub/the-littlest-jupyterhub',
author='Jupyter Development Team',
author_email='jupyter@googlegroups.com',
license='... |
r"""
Ce programme sert à ouvrir, gérer et fermer les positions.
Enregistre les positions dans la base de données et dans un fichier excel,
les affiches dans le terminal puis envoie une notification au groupe telegram
"""
import time,datetime,os,sys,requests
from brokerconnection import realcommands
from prediction im... |
# encoding: utf-8
"""
@author: xingyu liao
@contact: sherlockliao01@gmail.com
"""
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import Parameter
class CosSoftmax(nn.Module):
r"""Implement of large margin cosine distance:
Args:
in_feat: size of each input sample
... |
from calblog import app
if __name__ == '__main__':
app.run(port=34630, debug=True) |
from azureml.data.data_reference import DataReference
from azureml.pipeline.core import PipelineData
from mlapp.integrations.aml.utils.compute import get_or_create_compute_target
from mlapp.integrations.aml.utils.constants import OUTPUT_PATH_ON_COMPUTE, DATA_REFERENCE_NAME
from mlapp.integrations.aml.utils.pipeline im... |
import time
import datetime
import logging
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from os import path
import util as util
def aggregate(config):
"""Aggregates the sensitive microdata at sensitive_microdata_path.
Produces the reportable_agg... |
from __future__ import print_function, unicode_literals
import os, time
from twisted.python import usage
from twisted.scripts import twistd
class MyPlugin(object):
tapname = "xyznode"
def __init__(self, args):
self.args = args
def makeService(self, so):
# delay this import as late as poss... |
import math
from schematics import Model
from schematics.types import ModelType, StringType, PolyModelType, DictType, ListType, BooleanType
from .dynamic_search import BaseDynamicSearch
BACKGROUND_COLORS = [
'black', 'white',
'gray', 'gray.100', 'gray.200', 'gray.300', 'gray.400', 'gray.500', 'gray.600', 'gra... |
#!/usr/bin/env python
__author__ = 'Stephen P. Henrie'
from os import path
from StringIO import StringIO
from ndg.xacml.parsers.etree.factory import ReaderFactory
from ndg.xacml.core import Identifiers, XACML_1_0_PREFIX
from ndg.xacml.core.attribute import Attribute
from ndg.xacml.core.attributevalue import (At... |
from __future__ import absolute_import
from sentry.models import Group, Project, Team, User
from sentry.testutils import TestCase
class SentryManagerTest(TestCase):
def test_valid_only_message(self):
event = Group.objects.from_kwargs(1, message="foo")
self.assertEquals(event.group.last_seen, even... |
"""
Copyright (c) 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... |
from setuptools import setup
setup(
name='gecko',
version='0.1',
description='Gecko, a library implementing multiple GEC systems.',
url='http://github.com/psawa/gecko',
author='thibo rosemplatt',
author_email='thibo.rosemplatt@gmail.com',
license='apache 2.0',
packages=[... |
from selenium import webdriver
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.... |
# -*- coding: utf-8 -*-
from setuptools import find_namespace_packages, setup
with open("README.md", "r", encoding="utf-8") as r:
README = r.read()
TEST_REQUIRES = ["pytest-cov", "pytest-vcr", "python-coveralls"]
setup(
author="Pierre Sassoulas",
author_email="pierre.sassoulas@gmail.com",
long_desc... |
def create_number_class(alphabet): |
# Copyright 2017-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" fil... |
# -*- coding: utf-8 -*-
import warnings
import aesara_theano_fallback
from aesara_theano_fallback import aesara as theano
import aesara_theano_fallback.tensor as tt
from aesara_theano_fallback import sparse as ts
from aesara_theano_fallback import change_flags, ifelse, USE_AESARA
from aesara_theano_fallback.tensor impo... |
#!/usr/bin/python3
__author__ = "Mark H. Meng"
__copyright__ = "Copyright 2021, National University of S'pore and A*STAR"
__credits__ = ["G. Bai", "H. Guo", "S. G. Teo", "J. S. Dong"]
__license__ = "MIT"
import paoding.utility.interval_arithmetic as ia
import paoding.utility.utils as utils
import math
def calculate_... |
import json
import sagemaker
import os
from s3_conx import *
from sagemaker.pytorch import PyTorch
def iterate_to_s3(path):
if os.path.isdir(path):
for _dir in os.listdir(path):
iterate_to_s3(path+_dir)
else:
s3.upload_file_to_s3(path)
return
if __name__ == '__main__':
# In... |
##################################################################
## (c) Copyright 2015- by Jaron T. Krogel ##
##################################################################
#====================================================================#
# sqd_input.py ... |
"""
Fatture in Cloud API v2 - API Reference
Connect your software with Fatture in Cloud, the invoicing platform chosen by more than 400.000 businesses in Italy. The Fatture in Cloud API is based on REST, and makes possible to interact with the user related data prior authorization via OAuth2 protocol. # noq... |
#!/usr/bin/env python
from __future__ import unicode_literals
# Execute with
# $ python yt_dlp/__main__.py (2.6+)
# $ python -m yt_dlp (2.7+)
import sys
if __package__ is None and not hasattr(sys, 'frozen'):
# direct call of __main__.py
import os.path
path = os.path.realpath(os.path.abspath(__fi... |
import operator
def execute(program):
registers = {}
m = 0
for instr in program:
if instr['reg_check'] not in registers:
registers[instr['reg_check']] = 0
if instr['reg'] not in registers:
registers[instr['reg']] = 0
if instr['op_check'](registers[instr['... |
import nidmm
import pytest
from nitsm.codemoduleapi import SemiconductorModuleContext
from nitsm.pinquerycontexts import PinQueryContext
@pytest.fixture
def simulated_nidmm_sessions(standalone_tsm_context):
instrument_names = standalone_tsm_context.get_all_nidmm_instrument_names()
sessions = [
nidmm.S... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
from random import randint
from time import sleep
def sorteia(lista):
print('=-=' * 15)
for c in range(0, 5):
lista.append(randint(1, 10))
print('Sorteando 5 valores da lista: ', end=' ')
for c in lista:
print(f'{c}', end=' ', flush=True)
sleep(0.3)
print()
def somapar(li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.