text stringlengths 1 927k |
|---|
# -*- coding: utf-8 -*-
"""
-----------------------------------------------------------------------------
Copyright 2017 David Griffis
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
... |
import os
import argparse
PROJECT_FILE = """
import argparse
def main():
parser = argparse.ArgumentParser(description='CLI for PROJECT_NAME')
parser.add_argument('-v', '--version', action='store_true')
args = parser.parse_args()
print('CLI for PROJECT_NAME')
"""
SETUP_TEMPLATE = """
import io
from... |
import sys
import pandas as pd
from sqlalchemy import create_engine
def load_data(messages_filepath, categories_filepath):
"""Load disaster messages and categories from csv files.
Arguments:
messages_filepath {String} -- disaster message file path
categories_filepath {String} -- disaster c... |
"""
rm - remove files or directories
"""
from os import path
from ..Transformer import TransformerLlvm
from ...constants import EXECFILEEXTENSION
class TransformAr(TransformerLlvm):
""" transform ar commands """
@staticmethod
def can_be_applied_on(cmd):
return (cmd.bashcmd.startswith("rm -f ") a... |
import time
def wait(sec):
time.sleep(sec)
wait(1)
print("")
print("Granting information")
print("")
wait(1)
print("")
print("Running nmap on target 54.32.43.1")
print("")
wait(1)
print("nmap -sS 54.32.43.1")
print("Nmap Copyright 2022")
print("port/tcp 8080 open. http-proxy")
print("Done with scan")
wait(1)
prin... |
# -*- coding: utf-8 -*-
"""Implementations of all hash-routing strategies"""
from __future__ import division
import networkx as nx
from collections import Counter
from icarus.registry import register_strategy
from icarus.util import inheritdoc, multicast_tree, path_links
from icarus.scenarios.algorithms import extrac... |
"""YOLO_v3 Model Defined in Keras."""
from functools import wraps
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import control_flow_ops
import keras
from keras import backend as K
from keras.layers import Conv2D, Add, ZeroPadding2D, UpSampling2D, Concatenate, MaxPooling2D
from keras.layers.adv... |
#
# Generated with LibraryPathItemBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from .moao import MOAOBlueprint
class LibraryPathItemBlueprint(MOA... |
#!/usr/bin/env python
from bloom_filter import *
from math import log
from math import ceil
"""Returns a bloom_filter with optimal storage parameters for initialization file,
filled with the words from the initialization file """
def fill_filter_from_file(filepath, max_error_prob, suppres_prints = False):
with op... |
# -*- coding: UTF-8 -*-
defaults = dict(
BACKEND='django_datawatch.backends.synchronous',
RUN_SIGNALS=True) |
import ds4drv
from ds4drv.eventloop import EventLoop
from threading import Thread
from distutils.version import StrictVersion
# Based on DS4Controller class in __main__.py of ds4drv
class Controller(Thread):
# Reference: https://www.psdevwiki.com/ps4/DualShock_4#Specifications
MAX_VOLTAGE = 3.65
# Refere... |
class Params:
def __init__(self):
self.state_width =4**3
self.state_len = 1 #height of state
self.episode_max_length = 100 # max time for which a apisode last
self.num_actions=64
self.num_frames = 1
self.lr_rate = 0.001 # learning rate
self.rms_rho = 0.9 # for rms prop
self.r... |
from django.contrib import admin
from demands.models import Demand
# Register your models here.
admin.site.register(Demand) |
import torch
from models.fatchord_version import WaveRNN
import hparams as hp
from utils.text.symbols import symbols
from utils.paths import Paths
from models.tacotron import Tacotron
import argparse
from utils.text import text_to_sequence
from utils.display import save_attention, simple_table
if __name__ == "__main__... |
params = {
'type': 'MBPO',
'universe': 'gym',
'domain': 'AntSafe',
'task': 'v2',
'log_dir': '~/ray_mbpo/',
'exp_name': 'defaults',
'kwargs': {
'epoch_length': 10000,
'train_every_n_steps': 3,
'n_train_repeat': 20,
'eval_render_mode': None,
'eval_n_ep... |
"""
WSGI config for djworkplace project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_S... |
"""
ASGI config for Organi project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTIN... |
class Storage:
_ID = 0
def __init__(self, node_id = -1 , round =-1):
self.id = self.__class__._ID
self.__class__._ID += 1
self.round = round
self.node_id = node_id
self.XK = []
self.XC = []
self.SKA = []
self.CA = []
self.HSK = []
... |
averageX, averageY = [float(num) for num in input().split(" ")]
# Cost
CostX = 160 + 40*(averageX + averageX**2)
CostY = 128 + 40*(averageY + averageY**2)
print(round(CostX, 3))
print(round(CostY, 3)) |
# Generated by Django 2.2.10 on 2020-05-05 19:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("klasses", "0015_rename_klass_to_bootcamp_run"),
("cms", "0003_bootcamp_product_run_page"),
]
operations = ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2014, Jens Depuydt <http://www.jensd.be>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: postgresql_lan... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from poetry.poetry import Poetry
from poetry.utils._compat import PY2
from poetry.utils._compat import Path
from poetry.utils.toml_file import TomlFile
fixtures_dir = Path(__file__).parent / "fixture... |
# coding: utf-8
import pprint
import os
import json
import utils
import time
import datetime
from routertree import RouteTree, SPVHashTable
from routergraph import RouterGraph
from tcp import create_server_coro, send_tcp_msg_coro, find_connection
from wsocket import WsocketService
from jsonrpc import AsyncJsonRpc
from ... |
URL_LOGIN = 'https://login.clear.com.br/pit/login/'
URL_TOKEN = 'https://login.clear.com.br/pit/login/api/token'
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36' |
# -*- coding: utf-8 -*-
"""
flask.wrappers
~~~~~~~~~~~~~~
Implements the WSGI wrappers (request and response).
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
from werkzeug.exce... |
# coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... |
# Copyright 2017 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 applicab... |
#!/usr/bin/env python3
# Copyright © 2021 Helmholtz Centre Potsdam GFZ German Research Centre for Geosciences, Potsdam, Germany
#
# 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.ap... |
# creating a function
def my_func():
print("Hello")
my_func()
# pass an argument
def my_function(fname):
print(fname + "Refsnes")
my_function('Emil')
# pass two arguments
def my_function(fname, lname):
print(fname + " " + lname)
my_function('Emil', 'Refsnes')
"""
if you do not know how many arguments that will... |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... |
from reportlab.platypus import Paragraph, Spacer, Table, TableStyle, PageBreak
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib import colors
from reportlab.lib.units import mm
from copy import deepcopy
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from directions.models import N... |
from django.contrib import admin
from .models import Post, Comment
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ['title', 'slug', 'author', 'publish', 'status']
list_filter = ['status', 'created', 'publish', 'updated']
search_fields = ('title', 'body')
prepopulated_fields = ... |
""" Class to count the inversion count using merge sort"""
class InversionCount:
def count(self, A: [int]) -> [int]:
""" Count and return the array containing the count of each element """
index_array = []
rc_arr = []
for ind in range(0, len(A)):
index_array.append(ind... |
import sys
import numpy as np
from itertools import product
import torchvision.transforms as transforms
from sklearn.metrics.pairwise import cosine_similarity
from Utils.transform import *
from Utils.pillowhelper import *
def rowcolumn2coor(row, col, patch_size):
""" Map row column number to pillow image coordina... |
import zipapp
import io
zipapp.create_archive('src', 'dist/j3a-keygen.pyz') |
"""root_africa_28472 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
C... |
from userbot import ALIVE_NAME
from userbot.utils import admin_cmd
name = str(ALIVE_NAME)
INDIANBOT_IS_ALIVE = (
"**Apun Zinda He Sarr ^.^** \n`🇮🇳BOT Status : ` **☣Hot**\n\n"
f"`My peru owner`: {name}\n\n"
"`Indian Bot Version:` **3.8.7**\n`Python:` **3.8.5**\n"
"`Database Status:` **😀ALL OK**\n\n`A... |
#!/usr/bin/env python3
# -*- coding: iso-8859-15 -*-
#
# __filename__: key_manager.py
#
# __description__:
#
# __remark__:
#
# __todos__:
#
# Created by Tobias Wenzel in December 2015
# Copyright (c) 2015 Tobias Wenzel
from typing import List
from base.tables import rcon, sbox
from base.utils import xor_blocks
EXTEND... |
# -*- coding: utf-8 -*-
import os
from configparser import ConfigParser
class Config(object):
def __init__(self, config_dir=None, config_file=None):
self.config_dir = config_dir
self.config_file = config_file
if config_dir is None:
self.config_dir = os.path.join(
... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 28 15:41:27 2018
@author: Thanh Tung Khuat
Another method for serial combination of online learning and agglomerative learning gfmm
Using Agglomerative learning to train a base model, then deploy the trained model for online learning with different training data
... |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.base import ConfigurationError
from datadog_checks.mcache.mcache import InvalidConfigError
from .common import HOST, PORT, SERVICE_CHECK
def test_bad_config(check):
"""
... |
"""
*******************************************************************************
* Ledger Blue
* (c) 2016 Ledger
*
* 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.... |
import collections.abc
import dataclasses
import functools
import itertools
import numbers
import operator
import sys
from typing import *
from crosshair.util import is_iterable
from crosshair.util import is_hashable
from crosshair.util import name_of_type
class MapBase(collections.abc.MutableMapping):
def __eq_... |
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'birthdayCakeCandles' function below.
#
# The function is expected to return an INTEGER.
# The function accepts INTEGER_ARRAY candles as parameter.
#
def birthdayCakeCandles(candles):
# Write your code here
count = 0
... |
#!/usr/bin/env python
import sys, getopt, array
import os
import collections
from collections import defaultdict, OrderedDict, namedtuple
import subprocess
#exec mode values: 0xFFFE:XIP, 0xFFFD:LE 0xFFFB:LAE 0x0:Invalid 0xFFFF:End
def usage():
print
print("Construct Toc binary from a group of SBIs. All entrie... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportE... |
from __future__ import print_function
import os
import datetime
import subprocess
from future.utils import raise_with_traceback
import numpy as np
import time
import progressbar
import shutil
from collections import defaultdict
import sys
import dill
from zipfile import ZipFile
from contextlib import ExitStack
import j... |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... |
from django.db import models
from django.contrib.localflavor.us.models import USStateField
class Place(models.Model):
state = USStateField(blank=True)
state_req = USStateField()
state_default = USStateField(default="CA", blank=True)
name = models.CharField(max_length=20) |
#Faça um algoritmo que o usuário infomre quantas idades serão informadas e exiba a maior.
a=int(input("Digite quantas vezes vc quer informar a idade"))
i=0
m=0
for i in range (a):
n=int(input("Digite uma idade"))
if (n>m):
m=n
print(m) |
import ipaddress
import uuid
import weakref
import enum
from datetime import date, datetime, time, timedelta
from decimal import Decimal
from pathlib import Path
from typing import (
TYPE_CHECKING,
AbstractSet,
Any,
Callable,
ClassVar,
Dict,
List,
Mapping,
Optional,
Sequence,
... |
# Python 3.6 or higher
# Grab the library
from pathlib import Path
# What is the current working directory?
cwd = Path.cwd()
print('\nCurrent working directory:\n' + str(cwd))
# Create full path name by joining path and filename
new_file = Path.joinpath(cwd, 'new_file.txt')
print('\nFull path:\n' + str(new_file))
# ... |
from distutils.core import setup
setup(
name = 'robonect',
packages = ['robonect'],
version = '0.1', # Ideally should be same as your GitHub release tag varsion
description = 'Python Package for interacting with the Robonect JSON API',
author = 'Ben Woodford',
author_email = 'me@benwoodford.co... |
import usb.core
from tonegen import NoteGenerator
from speaker import LeslieSpeaker
import sys
def playNote(gen, keyNum, loudness):
pitches = ['C', 'C#', 'D', 'Eb', 'E', 'F', 'F#', 'G', 'Ab', 'A', 'Bb', 'B' ]
base = 24
octave, pitch = divmod(keyNum - base, len(pitches))
note = "%s%d" % (pitches... |
# Generated by Django 2.1 on 2019-03-06 16:42
from django.db import migrations, models
import resource_inventory.models
class Migration(migrations.Migration):
dependencies = [
('resource_inventory', '0007_auto_20190306_1616'),
]
operations = [
migrations.AddField(
model_name... |
"""Tests of classification methods."""
import unittest
import numpy as np
from sklearn.base import clone
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier as _KNeighborsClassifier
from skfda.datasets import fetch_growth
from skfda.misc.metrics import l2_distance
... |
from fabric.api import *
from fabric import colors
from fabric.contrib.files import exists
from fabric.operations import _prefix_commands, _prefix_env_vars, require
import os
import slack
PROJECT_NAME = "Divante.com PWA Book"
STAGES = {
"test": {
"name": "Test",
"hosts": [os.environ['TEST_HOST']],... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Anscombe'] , ['Lag1Trend'] , ['Seasonal_Hour'] , ['AR'] ); |
import unittest.mock as mock
from tensortrade.oms.orders.criteria import Limit
from tensortrade.oms.instruments import USD, BTC
from tensortrade.oms.orders import TradeSide
def test_init():
criteria = Limit(limit_price=7000.00)
assert criteria.limit_price == 7000.00
@mock.patch('tensortrade.exchanges.Excha... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ToDoItem.completed_by'
db.add_column('todo_todoitem', 'completed_by',
... |
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# 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
__a... |
# Copyright 2017 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... |
# PyAlgoTrade
#
# Copyright 2011-2018 Gabriel Martin Becedillas Ruiz
#
# 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 ap... |
from typing import Dict
from typing import Optional
from typing import TYPE_CHECKING
from typing import Type
import dataclasses
from winter.core import ComponentMethod
from winter.core import annotate
if TYPE_CHECKING:
from .handlers import ExceptionHandler # noqa: F401
@dataclasses.dataclass
class ExceptionA... |
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project au... |
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
import math
import random
import numpy as np
MINE_BIT = 0b01
FLAG_BIT = 0b10
EMPTY_SLOT = 0xFF
FLAG_SLOT = 0xFE
SURROUNDING = [
(1, 0),
(1, 1),
(0, 1),
(-1, 1),
(-1, 0),
(-1, -1),
(0, -1),
(1, -1),
]
class Minesweeper:
def __init__(self, *shape, seed=None):
if len(shape... |
#!/usr/bin/env python
"""Module to setup an RFC2136-capable DNS server"""
import os
import os.path
import shutil
import socket
import subprocess
import sys
import tempfile
import time
from types import TracebackType
from typing import Any, Sequence
from typing import Dict
from typing import Optional
from typing import ... |
from mpp.models import SQLTestCase
from mpp.models import SQLConcurrencyTestCase
class PxfHBaseLookupError(SQLConcurrencyTestCase):
"""
@db_name pxfautomation
@concurrency 1
@gpdiff True
"""
sql_dir = 'sql'
ans_dir = 'expected'
out_dir = 'output' |
# -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.oop import WrongSlotsViolation
from wemake_python_styleguide.visitors.ast.classes import WrongSlotsVisitor
class_body_template = """
class ClassWithSlots(object):
__slots__ = {0}
"""
class_body_typed_template = """
class ClassWithSlo... |
import logging
from typing import Union
import verboselogs
class Logger:
__instance: verboselogs.VerboseLogger = None
@staticmethod
def logger() -> verboselogs.VerboseLogger:
if Logger.__instance is None:
Logger()
assert(Logger.__instance is not None)
return Logger.__i... |
import numpy as np
import tushare as ts
code = '002771'
data_5 = ts.get_k_data(code, ktype='5')
data_15 = ts.get_k_data(code, ktype='15')
data_30 = ts.get_k_data(code, ktype='30')
data_60 = ts.get_k_data(code, ktype='60')
data_d = ts.get_k_data(code, ktype='D')
data_w = ts.get_k_data(code, ktype='W') |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# 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.apac... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from thriftpy2._compat import CYTHON
from ..thrift import TType, TException
def readall(read_fn, sz):
buff = b''
have = 0
while have < sz:
chunk = read_fn(sz - have)
have += len(chunk)
buff += chunk
if len(c... |
#!/usr/bin/env python
# Copyright (c) 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This script takes a Clang git revision as an argument, it then
creates a feature branch, puts this revision into update.py, uplo... |
import scipy.io
import os
from PIL import Image, ImageDraw
class widerFace2kitti():
def __init__(self, annotation_file, widerFace_base_dir, kitti_base_dir, kitti_resize_dims, category_limit, train):
self.annotation_file = annotation_file
self.data = scipy.io.loadmat(self.annotation_file)
se... |
import numpy as np
from scipy.sparse import csr_matrix
from .ldpcalgebra import*
__all__ = ['BinaryProduct', 'InCode', 'BinaryRank','RegularH','CodingMatrix','CodingMatrix_systematic','HtG']
def RegularH(n,d_v,d_c):
""" ------------------------------------------------------------------------------
Builds a... |
import backtrader as bt
from backtrader.indicators import ExponentialMovingAverage as EMA
class Pullbacks(bt.Indicator):
"""
An indicator to detect pullbacks to EMA
Params :
- ema_period : int
EMA period, default is 50
- period : int
Period for pullbacks calcula... |
import click
from achilles.model import AchillesModel
from achilles.utils import get_dataset_dim
@click.option(
"--gpu",
"-g",
metavar="",
default=None,
required=False,
show_default=True,
help="SET CUDA_VISIBLE_DEVICES to train model on specific" " GPU (e.g. 0 or 0,1)",
)
@click.option(
... |
model = dict(
type='ATSS',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=-1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch',
init_cfg=dict(type='Pretrained', che... |
from base import LinkedList
def partition(ll, val):
cur = ll.head
ll.tail = ll.head
while cur:
next_node = cur.next
cur.next = None
if cur.val < val:
cur.next = ll.head
ll.head = cur
else:
ll.tail.next = cur
ll.tail = cur... |
from stable_baselines3.a2c.a2c import A2C
from stable_baselines3.a2c.policies import MlpPolicy, CnnPolicy |
from datetime import datetime
from hashlib import md5
from time import time
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
import jwt
from app import app, db, login
followers = db.Table(
'followers',
db.Column('follower_id', db.Integer, db.ForeignKe... |
# ---------------------------------------------------------------------
# Vendor: D-Link
# OS: DGS3100
# Compatible:
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------... |
"""Management command to change enrollment status"""
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.management.base import CommandError
from django.contrib.auth import get_user_model
from courses.api import defer_enrollment
from courses.management.utils import EnrollmentChangeC... |
''' ChanOP commands '''
from db import *
from shared import *
import re
def process_chanop_halfopdehalfop(self, prefix, command, params):
conn = create_connection("users.db")
channel = params[0].strip()
nick = prefix[1:]
lvlhalfop = 0
lvldehalfop = 0
with conn:
results = check_nickn... |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.6.0
# kernelspec:
# display_name: deep_ml_curriculum
# language: python
# name: deep_m... |
"""
This module contains the WPS inputs and outputs that are reused across multiple WPS processes.
"""
from pywps import LiteralInput, LiteralOutput, ComplexInput, ComplexOutput
from pywps import FORMATS, Format
# ---------------------------------------- #
# ---------------- Inputs ---------------- #
# ------------... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import warnings
from django.forms import (
CharField, DateField, EmailField, FileField, Form, GenericIPAddressField,
HiddenInput, ImageField, IPAddressField, MultipleChoiceField,
MultiValueField, MultiWidget, PasswordInput, Se... |
from __future__ import absolute_import, division, print_function, unicode_literals
import six
import logging
from collections import OrderedDict
import numpy as np
import time
import torch
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.sampler import SubsetRandomSamp... |
# Copyright 2016 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... |
from flask_script import Manager, prompt_pass
from redash import models
manager = Manager(help="Groups management commands.")
@manager.option('name', help="Group's name")
@manager.option('--org', dest='organization', default='default', help="The organization the user belongs to (leave blank for 'default').")
@manager... |
"""
Script to use if you want to convert between the 2 file systems (in one way or another) :
- {vol}/{chap}/{page}.* : easier to browse, harder to read
- {vol}/{chap}-{page}.* : easier to read, harder to browse
- automatically remove old system and pass existant files if already in place
"""
import os # I... |
from django.apps import AppConfig
class DropboxListenerConfig(AppConfig):
name = 'dropbox_listener' |
class Tiger:
def __init__(self, name, gender, age):
self.name = name
self.gender = gender
self.age = age
def __repr__(self):
return f"Name: {self.name}, Age: {self.age}, Gender: {self.gender}"
@staticmethod
def get_needs():
return 45 |
'''define the config file for voc and resnet50os16'''
import os
from .base_cfg import *
# modify dataset config
DATASET_CFG = DATASET_CFG.copy()
DATASET_CFG.update({
'type': 'voc',
'rootdir': os.path.join(os.getcwd(), 'VOCdevkit/VOC2012'),
})
DATASET_CFG['train']['set'] = 'trainaug'
# modify dataloader config... |
from scrapy.utils import project
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
settings = project.get_project_settings()
database_path = settings.attributes["SQLALCHEMY_DATABASE_URI"].value
is_echo = settings.attributes["SQLALCHEM... |
import abc
from shlex import quote as shq
from .utils import BatchException
class Resource:
"""
Abstract class for resources.
"""
_uid: str
@abc.abstractmethod
def _get_path(self, directory) -> str:
pass
@abc.abstractmethod
def _add_output_path(self, path):
pass
... |
#!/usr/bin/env python3
"""
This file defines a set of system_info classes for getting
information about various resources (libraries, library directories,
include directories, etc.) in the system. Usage:
info_dict = get_info(<name>)
where <name> is a string 'atlas','x11','fftw','lapack','blas',
'lapack_src', 'b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.