text stringlengths 2 999k |
|---|
#
# Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
#
from gevent import monkey
monkey.patch_all()
import os
import sys
import socket
import subprocess
import json
import time
import datetime
import platform
import gevent
import ConfigParser
from nodemgr.event_manager import EventManager
from pysandes... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
def anagram(self):
pass |
from django import forms
from .models import Order
class OrderForm(forms.ModelForm):
class Meta:
model = Order
fields = ('user_full_name', 'email', 'phone_number', 'street_address1', 'street_address2',
'town_or_city', 'postcode', 'country',
'county' )
def ... |
# -*- coding: utf-8 -*-
import numpy as np
import heuristic.utils as utils
import random
from heuristic.Graph import TSP_Graph
from heuristic.Solution import Solution
def random_solution(graph, customers_list):
if not isinstance(graph, TSP_Graph):
utils.raise_value_error(graph, TSP_Graph, type(graph))
... |
# based on implementation: https://github.com/usuyama/pytorch-unet/blob/master/pytorch_unet.py
from ..registry import BACKBONES
import torch
import torch.nn as nn
def double_conv(in_channels, out_channels):
return nn.Sequential(
nn.Conv3d(in_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=... |
# Generated by Django 3.0.5 on 2020-04-24 11:59
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(aut... |
from gui_lib.container import Container
from gui_lib.label import Label
from gui_lib.textline import Textline
from gui_lib.fill import Fill
from gui_lib.optionbox import Optionbox
from verenigingLine import VerenigingLine
from budgetLine import BudgetLine
import datetime
class FactuurData(Container):
def __init__(sel... |
import os
import re
import subprocess
try:
from cStringIO import StringIO
except:
from StringIO import StringIO
from nltk.util import LazyMap, LazyConcatenation
from nltk.internals import find_binary, java
from nltk.tag import TaggerI
from nltk_contrib.coref import CorpusReaderDecorator
class TaggerCorpusRe... |
################################################################################
# Dactyl common code
#
# Imports and utilities shared across multiple pieces of Dactyl
################################################################################
# The ElasticSearch templates need to write *actual* JSON and not YAML... |
import os
PATH_CWD = os.path.dirname(os.path.dirname(__file__))
os.chdir(PATH_CWD)
import season
import flask
app = flask.Flask(__name__, static_url_path='')
ismain = __name__ == '__main__'
app = season.bootstrap(app, ismain) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import itertools
import numpy as np
import os
import shutil
import tensorflow as tf
import cv2
import six
import tqdm
assert six.PY3, "This example requires Python 3!"
import tensorpack.utils.viz as tpviz
from tensorpack.predict import MultiTowerOfflinePre... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Keyword',
fields=[
('id', models.AutoField(verb... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# droxi
# Copyright (c) 2014, Andrew Robbins, All rights reserved.
#
# This library ("it") is free software; it is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; you can redistribute it and/or modify it under the terms of the
# GNU Lesser Gen... |
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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... |
import os
from io import RawIOBase, BufferedReader, BufferedWriter
from typing import Any, Union, MutableSequence
import struct
from logging import getLogger
import docker # type: ignore
from penguin_judge.models import JudgeStatus
from penguin_judge.judge import (
JudgeDriver, JudgeTask, TStartTestCallback, TJu... |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~... |
# pylint: disable=missing-docstring, multiple-statements, useless-object-inheritance
# pylint: disable=too-few-public-methods, no-init, no-self-use,bare-except,broad-except, import-error
from __future__ import print_function
DEFINED = 1
if DEFINED != 1:
if DEFINED in (unknown, DEFINED): # [undefined-variable]
... |
def valid(fn):
return lambda sides: all(sides) and 2 * max(sides) < sum(sides) and fn(
sides)
@valid
def equilateral(sides):
return sides[0] != 0 and len(set(sides)) == 1
@valid
def isosceles(sides):
return len(set(sides)) < 3
@valid
def scalene(sides):
return len(set(sides)) == 3
|
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2018
#
# 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
# r... |
"""
Django settings for core project.
Generated by 'django-admin startproject' using Django 3.2.9.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import os
from ... |
"""Interface for interacting with a marketplace contract"""
from time import time
from thirdweb.common.error import ListingNotFoundException
from thirdweb.constants.currency import ZERO_ADDRESS
from thirdweb.core.classes.contract_events import ContractEvents
from thirdweb.core.classes.contract_platform_fee import Cont... |
# Natural Language Toolkit:
#
# Copyright (C) 2001-2019 NLTK Project
# Author: Piotr Kasprzyk <p.j.kasprzyk@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from nltk.corpus.reader.api import *
from nltk.corpus.reader.xmldocs import XMLCorpusReader
PARA = re.compile(r"<p(?: [^>]*){0,1}... |
# Copyright (c) 2021, NVIDIA CORPORATION & 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid>=1.4',
'pyramid_chameleon', # for compatibility with pyramid 1.5 branch
... |
from django.contrib import admin
from models import Crime
class CrimeAdmin(admin.ModelAdmin):
list_filter = ('date', 'updated_at')
ordering = ('-created_at',)
list_display = ('headline', 'author', 'date', 'created_at', 'is_removed')
search_fields = ('headline',)
admin.site.register(Crime, Cri... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
import pickle
from typing import Any, Union
from datetime import datetime
class DataStorage:
_DataStorageObj = None
def __new__(cls, *args, **kwargs):
if cls._DataStorageObj is None:
cls._DataStorageObj = super().__new__(cls)
return cls._DataStorageObj
def __init__(self):
... |
###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK Utils
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Genera... |
import os
import json
import webapp2
import jinja2
from urllib import urlencode
from google.appengine.api import urlfetch
jinja_env = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
class MainPageHandler(webapp2.RequestH... |
from .app import App
__all__ = [
'__version__',
'App',
]
# Examples of valid version strings
# __version__ = '1.2.3.dev1' # Development release 1
# __version__ = '1.2.3a1' # Alpha Release 1
# __version__ = '1.2.3b1' # Beta Release 1
# __version__ = '1.2.3rc1' # RC Release 1
# __version__ = '1.2.3'... |
"""
Copyright (c) 2016 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
... |
from plotly_study.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Line(_BaseLayoutHierarchyType):
# color
# -----
@property
def color(self):
"""
Sets the line color.
The 'color' property is a color and may be specified a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: test_send_message.py
Author: huxuan
Email: i(at)huxuan.org
Description: Unittest for sending message.
"""
import unittest
from wxpusher import WxPusher
from . import config
class TestSendMessage(unittest.TestCase):
"""Unittest for sending message."""
... |
import os
from sys import platform
import time
import collections
from datetime import datetime
from enum import Enum
import xml.etree.ElementTree as etxml
from PIL import Image
# import pkgutil
# egl = pkgutil.get_loader('eglRenderer')
import numpy as np
import pybullet as p
import pybullet_data
import gym
class Dron... |
import warnings
from amqtt.mqtt.protocol.broker_handler import *
warnings.warn("importing hbmqtt is deprecated. Please import amqtt", DeprecationWarning)
|
import numpy as np
import math
_vbars = " ▁▂▃▄▅▆▇█"
def bar_graph(data):
if len(data) > 64:
data = np.interp(np.linspace(0, len(data), 64),
np.arange(0, len(data)),
np.array(data))
M = max(data)
def _bar(alpha):
if math.isnan(alpha):
... |
import os
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.getenv('SECRET_KEY')
DEBUG = os.getenv('DEBUG', default=False)
def comma_separated_list(value: str):
return [x.strip() for x in value.split(',') if x.strip()]
AL... |
"""Originally adapted from https://github.com/aserdega/convlstmgru, MIT License Andriy Serdega"""
from typing import Any, List, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
class ConvLSTMCell(nn.Module):
"""ConvLSTM Cell"""
def __init__(
self,
... |
# Copyright 2012 Douglas Linder
# 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... |
"""
Support for lowering generators.
"""
from __future__ import print_function, division, absolute_import
from llvmlite.llvmpy.core import Constant, Type, Builder
from . import cgutils, types, config
from .funcdesc import FunctionDescriptor
class GeneratorDescriptor(FunctionDescriptor):
"""
The descriptor f... |
# Generated by Django 4.0.3 on 2022-03-11 00:01
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations ... |
import numpy as np
import scipy.stats as stats
class Classifier:
# Class Variables
_n_class = _p_m_s = None
# Constructor
def __init__(self, col_1, col_2, n_class):
self._init_var(col_1, col_2, n_class)
# Methods
def _init_var(self, col_1, col_2, n_class):
self.... |
import logging
import sys
import os
from functools import lru_cache
def _configLogger(name, filename=None, loglevel=logging.INFO):
# define a Handler which writes INFO messages or higher to the sys.stdout
logger = logging.getLogger(name)
logger.setLevel(loglevel)
console = logging.StreamHandler(sys.st... |
# Programmer: Navraj Chohan <nlake44@gmail.com>
import os
import subprocess
import sys
import threading
import time
import unittest
import urllib2
from flexmock import flexmock
from tornado.gen import Future
from tornado.httpclient import HTTPError
from tornado.options import options
from tornado.testing import Async... |
# Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import os
from .. import api
import speakeasy.winenv.defs.nt.ddk as ddk
import speakeasy.winenv.defs.nt.ntoskrnl as ntos
class Ntdll(api.ApiHandler):
"""
Implements exported native functions from ntdll.dll. If a function is not supported
here, bu... |
# name, image, value, uses, [effect]
software_list = [
["Smokescreen", "PLACEHOLDER.JPG", 50, 1],
["Fork", "PLACEHOLDER.JPG", 150, 2],
["Fortify", "PLACEHOLDER.JPG", 75, 2],
["Disrupt", "PLACEHOLDER.JPG", 100, 1],
["Sleep", "PLACEHOLDER.JPG", 200, 4],
["Glamour", "PLACEHOLDER.JPG", 100, 1],
... |
# This file is part of the Indico plugins.
# Copyright (C) 2002 - 2022 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
from collections import defaultdict
from datetime import timedelta
from sqla... |
# Copyright (c) 2014 Rackspace Hosting
# 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 req... |
from app.service._discord_client import Core
|
##############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, ... |
# Copyright (c) 2020-2022, 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 agre... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 3 08:08:11 2019
@author: barry
"""
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../utils'))
import numpy as np
import argparse
import h5py
import math
import time
import logging
import matplotlib.pyplot as plt
import torch
imp... |
class Solution:
def rotate(self, matrix) -> None:
result = []
for i in range(0,len(matrix)):
store = []
for j in range(len(matrix)-1,-1,-1):
store.append(matrix[j][i])
result.append(store)
for i in range(0,len(result)):
mat... |
from fullrss.database.db import (get_db, close_db)
import feedparser
import requests
import time
import datetime
import re
from fullrss.rss import scraper
class RssParser:
def parse(self, url):
self.url = url
self.feed_dict = feedparser.parse(self.url)
if self.feed_dict.bozo != 0:
... |
import json
from landsatxplore.api import API
from pprint import pprint
# Initialize a new API instance and get an access key
username = "batuhang"
password = "SLCH6i5k9L.."
api = API(username, password)
# Search for Landsat TM scenes
scenes = api.search(
dataset='landsat_8_c1',
latitude=28.85,
longitude=4... |
from typing import AbstractSet, Any, Mapping, Optional
def stringify(self_: Any, use: Optional[Mapping[str, Any]] = None, hide: Optional[AbstractSet[str]] = None) -> str:
name = self_.__class__.__name__
state = self_.__dict__
return f'{name}({_stringify_state(state, use or {}, hide or set())})'
def _str... |
from django.contrib.syndication import feeds
from populous.news.models import Collection
class CollectionFeed(feeds.Feed):
def title(self, obj):
return u"Latest %s Entries" % obj
def link(self, obj):
if not obj:
raise feeds.FeedDoesNotExist
return obj.get_absolute_u... |
# Test problem 8520
# To compute modulo multiplicate inverse
# Cannot use division? "sudo make me a sandwitch" Yo.
def binpow(a, b, m):
a = a % m
res = 1
while b > 0:
if b % 2 > 0:
res = (res * a) % m
a = (a * a) % m
b = b // 2
return res
def getProductArray(nums):
... |
#!/usr/bin/python
################################################################################
# 268f62b2-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... |
'''
'''
# 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");... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=37
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... |
"""
Django settings for agent_api project.
Generated by 'django-admin startproject' using Django 2.1.1.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
... |
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2017, 2018 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA - Reusable Analyses."""
from __future__ import absolute_import, print_function... |
from .cnot_error import *
from .measurement_error import * |
import os,sys
import unittest,requests,ddt
from config import setting
from common.readExcel import ReadExcel
from common.sendRequests import SendRequests
from common.writeExcel import writeExcel
import common.log
log = common.log.logger
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
test_data = ReadExce... |
import json
import asyncio
from typing import Optional, NoReturn
import aioxmpp
import aioxmpp.connector
import aioxmpp.xso
import OpenSSL
from aiofcm.logging import logger
from aiofcm.common import Message, MessageResponse, STATUS_SUCCESS
from aiofcm.exceptions import ConnectionClosed
class FCMMessage(aioxmpp.xso.... |
# Generated by Django 3.1.7 on 2021-03-05 10:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('job_profile', '0003_assessment_answer_student'),
]
operations = [
migrations.AlterField(
model_name='profile',
name=... |
import argparse
from bibliopixel.drivers.serial_driver import *
from bibliopixel.drivers.visualizer import *
from bibliopixel import colors
from bibliopixel import LEDStrip
from bibliopixel import LEDMatrix
#import the module you'd like to use
from animations import YellowTwinkle
from animations import Hexazoom
from B... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, ifitwala and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from frappe.model.document import Document
from ifitwala_ed.controllers.accounts_controller i... |
from django.contrib import admin
from blog.models import BlogPost, MediaItem, PostInteraction, Profile
class blog_postadmin(admin.ModelAdmin):
list_display = ('title', 'event_date', 'loc_name','subtitle','score', 'author')
admin.site.register(BlogPost, blog_postadmin)
class media_item_admin(admin.ModelAdmin):
... |
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
X = tf.placeholder(tf.float32, [None, 28, 28, 1])
W = tf.Variable(tf.zeros([784,10]))
b = tf.Variable(tf.zeros([10]))
X = tf.reshape(X, [-1, 784])
#model
Y = tf.nn.softmax(... |
import argparse
import configparser
import os
import numpy as np
from datetime import datetime, date
from pandas import DataFrame
from coverage import root_dir
import coverage.tools.dataloader as dataloader
from coverage.tools import common_utils
import coverage.tools.model_utils as model_utils
from cover... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2018, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
from nxt.sensor import *
class ColorControl(object):
def __init__(self, brick):
self.brick = brick
self.colorSensor = Color20(brick, PORT_1)
def get_color(self):
return self.colorSensor.get_color()
def get_light_color(self):
return self.colorSensor.get_light_color()
def set_light_color(self, color):
... |
import numpy as np
import math
from numpy.linalg import matrix_rank
def main():
R = np.array([[-2, 0, 2, 0, 0, 0, 0, 0],
[0, 0, 0, 2, 0, -2, 0, 0],
[-2, 2, 0, 0, 2, -2, 0, 0],
[(math.sqrt(14)-2)/2, (math.sqrt(14)+2)/2, 0, 0,
0, 0, (2-math.sq... |
# -*- coding: utf-8 -*-
"""Swap edges in a graph.
"""
# Copyright (C) 2004-2016 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
from __future__ import division
import math
import random
import networkx as n... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# 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... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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... |
import W
def listhit(isdbl):
if isdbl:
print "double-click in list!"
else:
print "click in list."
window = W.Window((200, 400), "Window with List", minsize = (150, 200))
window.list = W.List((-1, 20, 1, -14), [], listhit)
# or (equivalent):
# window.list = W.List((-1, 20, 1, -14), callback =... |
from PersonalDetails.PdModules import create_pd
reg_id = input("Enter registered Id : ")
bgroup = input("Enter your blood group : ")
academ = input("Enter your last or current academic detail : ")
fname = input("Enter your fathers name : ")
mname = input("Enter your mothers name : ")
temp = 'y'
hobbies = []
while tem... |
import datetime
import requests
import pandas as pd
import pickle
import time
import urllib
import os
from io import StringIO
import numpy as np
import warnings
import os
import datetime
import time
from tqdm import tnrange, tqdm_notebook
from requests.exceptions import ConnectionError
from requests.exceptions import R... |
#!/usr/bin/python3
import requests as req
import argparse
import sys
parser = argparse.ArgumentParser(prog="check_mailcow.py", description='Check Mailcow API for container states')
parser.add_argument("-d", "--domain", dest='domain', default="localhost",
metavar="mailcow.local", help="Domain name ... |
# -*- coding: utf-8 -*-
#
# Falcon documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 12 14:14:02 2014.
#
# 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.
#
# Al... |
""" Global and local Scopes
Scopes and Namespaces
When an object is assigned to a variable # a = 10
that variable points to some object
and we say that the variable (name) is bound to that object
That object can be accessed using that name in various parts of our code... |
from twx.botapi import TelegramBot
class Bot(TelegramBot):
def __init__(self, token):
TelegramBot.__init__(self, token)
self.listening = False
self.offset = None
# TODO: parametrize in settings
self.timeout = 1
def listen(self, on_message):
self.li... |
from django.urls import path
from djangogram.users.views import (
user_redirect_view,
user_update_view,
user_detail_view,
)
app_name = "users"
urlpatterns = [
path("~redirect/", view=user_redirect_view, name="redirect"),
path("~update/", view=user_update_view, name="update"),
path("<str:userna... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from ... |
# Plot Image Grid function imported from Discriminative Regularization for Generative Models by Lamb et al:
# https://github.com/vdumoulin/discgen
import six
import matplotlib
matplotlib.use('Agg')
from matplotlib import cm, pyplot
from mpl_toolkits.axes_grid1 import ImageGrid
def plot_image_grid(images, num_rows, n... |
"""
Calculate and visualize the loss surface.
Usage example:
>> python plot_surface.py --x=-1:1:101 --y=-1:1:101 --model resnet56 --cuda
"""
import argparse
import copy
import h5py
import torch
import time
import socket
import os
import sys
import numpy as np
import torchvision
import torch.nn as nn
import... |
# -*- coding: utf-8 -*-
"""MT publishing via XMLRPC.
:Authors:
- Bruce Kroeze
"""
"""
New BSD License
===============
Copyright (c) 2008, Bruce Kroeze http://solidsitesolutions.com
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that th... |
from rest_framework import serializers
from .models import Comment
class CommentSerializer(serializers.ModelSerializer):
class Meta:
model = Comment
fields = '__all__'
|
# https://www.kaggle.com/wolfram77/puzzlef-pagerank-levelwise-adjust-tolerance-functi
import os
from IPython.display import FileLink
src="pagerank-levelwise-adjust-tolerance-function"
inp="/kaggle/input/graphs"
out="{}.txt".format(src)
!printf "" > "$out"
display(FileLink(out))
!echo ""
# Download program
!rm -rf $src... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hackhb_t2_api.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Cisco-IOS-XR-Get-Full-ClearText-Running-Config Console Script.
Copyright (c) 2021 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
... |
from django.urls import path
from . import views
urlpatterns = [
# 127.0.0.1:8000/Mubanspider/get_search
path('get_search',views.get_search),
#127.0.0.1:8000/Mubanspider/search_muban
path('search_muban',views.search_muban),
] |
import run as whython
import os
def main():
welcome()
while True:
try:
text = input("whython > ")
if text.strip() == "": continue
if text.strip() == "exit": print("Goodbye!"); return
result, error = whython.run("<stdin>", text)
if error: prin... |
from itertools import groupby
from types import LambdaType
from typing import Any, Generator, Iterable, List, Tuple
__all__ = ['group_by']
def group_by(iterable: Iterable,
predicate: LambdaType) -> Generator[Tuple[Any, List], None, None]:
"""Group an iterable by a predicate function"""
sorted_it... |
from abc import ABC,abstractmethod
class A(ABC):
def sides(self):
pass
class B (A):
def sides(self):
print(("Triangle have three sides"))
obj1 = B()
obj1.sides() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.