content
stringlengths
5
1.05M
import mysql.connector from mysql.connector import errorcode try: con = mysql.connector.connect(user='niminimda', password='123456', host='127.0.01', database='test') except mysql.connector.Error as err: if err.errno == errorcode.ER_ACCESS_DENIED_ERROR: print("something is wrong with user or password")...
import os, sys import json, requests # TODO: NEED TO UPDATE TO HAVE FILES RIGHT OUT AS THE TEAM ID NUMBER # TODO: NOT THE TEAM NAME. TEAM_ID = { 'fuel' : 4523, 'fusion' : 4524, 'outlaws' : 4525, 'uprising' : 4402, 'excelsior' : 4403, 'shock' : 4404...
from ._Session import Session from ._User import User from ._UserAffiliation import UserAffiliation from ._UserEntityPermission import UserEntityPermission from ._UserRoles import UserRoles
""" Get reaction forces at the support nodes of a form diagram. """ from ghpythonlib.componentbase import executingcomponent as component import rhinoscriptsyntax as rs class SupportNodeResultsComponent(component): def RunScript(self, form, support_node_keys): if form: support_node_keys = sup...
from carts.models import Cart from django.http import HttpRequest from products.models import Product from products.api.serializers import ProductSerializer from rest_framework import serializers class CartSerializer(serializers.ModelSerializer): products = serializers.SerializerMethodField() class Meta: ...
import os import re import json from setuptools import setup with open('Setup.lock') as f: c = json.loads(f.read()) with open(os.path.join(c['name'], '__init__.py')) as f: version = re.findall("^__version__ = '(.*)'", f.read())[0] with open('Pipfile.lock') as f: p = json.loads(f.read()) def _install_req...
""" openconfig_local_routing This module describes configuration and operational state data for routes that are locally generated, i.e., not created by dynamic routing protocols. These include static routes, locally created aggregate routes for reducing the number of constituent routes that must be advertised, summa...
import time import json from pathlib import Path import torch import torch.nn as nn from torch.nn.parallel import DistributedDataParallel from torch.utils.tensorboard import SummaryWriter from radam import RAdam from model import GPT, GPTLMHead, GPTClsHead def timeit(method): def timed(*args, **kw): _arg...
import os import subprocess files = [ "001", "001a", "001b", "002", "002a", "002b", "003", "003a", "003b", "004", "004a", "004b", "005", "005a", "005b", "006", "006a", "006b", "007", "007a", "007b", "008", "008a", "008b", ...
#! /usr/bin/env python import io import os from setuptools import setup mydir = os.path.dirname(__file__) def read_project_version(): # Version-trick to have version-info in a single place. # http://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package ...
import os from unittest.mock import patch from util.job import get_job_id def test_create_job_id(): assert get_job_id() == os.getenv('JOB_ID'), 'job id is created' @patch.dict('os.environ', {'JOB_ID': 'job_123'}) def test_retrieve_job_id(): assert get_job_id() == 'job_123', 'job id is retrieved'
from kelvin.tests.test_cc_utils import * from kelvin.tests.test_ccsd import * from kelvin.tests.test_ft_cc_2rdm import * from kelvin.tests.test_ft_cc_ampl import * from kelvin.tests.test_ft_cc_relden import * from kelvin.tests.test_ft_ccsd import * from kelvin.tests.test_ft_ccsd_rdm import * from kelvin.tests.test_ft_d...
from person import Person from bounding_box import BoundingBox from typing import List from video_frame import VideoFrame from sort import Sort import numpy as np class Tracker: """ Trackes detected person and groups people with close trajectories. Attributes ---------- minDist: ...
__version__ = "0.2.8" from . import utils from . import common from . import manager from .common import Module from .common import Sequential from .common import Linear from .common import Identity from .common import ModuleList from .common import MultiModule from .common import Parameter from .manager import regist...
from src.abstract_load_balancer import AbstractLoadBalancer, LoadBalancerQueue class UtilisationAwareLoadBalancer(AbstractLoadBalancer): def __init__(self, APISERVER, DEPLOYMENT): self.apiServer = APISERVER self.deployment = DEPLOYMENT self.internalQueue = [] def UpdatePodList(self): ...
# 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 ...
"""Utilities for reading configuration from settings.""" from collections import namedtuple from functools import partial from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.text import slugify import six import logging logger = logging.getLogger(__name__) # Dec...
import pytest from karp.domain.models.resource import create_resource from karp.domain.models.entry import EntryRepository, create_entry from karp.infrastructure.sql import sql_entry_repository from karp.infrastructure.unit_of_work import unit_of_work @pytest.fixture def resource_blam(): resource = create_resou...
# coding=utf-8 from __future__ import unicode_literals, print_function import re import datetime from ..models import RawLog, DummyLogger, MacAddress, UserAction CODE_WLAN_JOIN = "WLAN-Gerät angemeldet" CODE_WLAN_LEAVE = "WLAN-Gerät hat sich abgemeldet" CODE_WLAN_REMOVED = "WLAN-Gerät wurde abgemeldet" def parse_...
# Load library import numpy as np # Create matrix matrix = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) # View number of rows and columns matrix.shape # (3, 4) # View number of elements (rows * columns) matrix.size # 12 # View number of dimensions matrix.ndim # 2
from django.core.cache import cache from django.test import TestCase, override_settings from django.urls import reverse from posts.models import User, Post, Group, Follow class TestPostCreation(TestCase): """Test for proper post creation and protection from anons""" def setUp(self): self.text = 'tes...
import unittest from entity_embeddings.util import processor_utils class TestProcessorUtils(unittest.TestCase): def test_get_invalid_target_processor(self): self.assertRaises(ValueError, processor_utils.get_target_processor, 1000)
import torch import numpy as np import os from datasets.base_dataset import BaseDataset from models.base_model import Model from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from tqdm import tqdm from utils.metrics import compute_chamfer_l1 from utils.util import quantize, downsa...
""" factoidbot.py - A plugin for remembering facts. Copyright (C) 2007 Kevin Smith SleekBot 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 opt...
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class FilesConfig(AppConfig): """Application config for files.""" name = "apps.files" verbose_name = _("Files") label = "files"
import numpy as np import cv2 import matplotlib.pyplot as plt import copy import argparse import os def histogram(image): # determine the normalized histogram m, n = image.shape hist = [0.0] * 256 for i in range(m): for j in range(n): #for every intensity add the count h...
from json import JSONDecodeError from typing import Dict import pytest from common.serializers.serialization import node_status_db_serializer from plenum.common.constants import LAST_SENT_PRE_PREPARE from plenum.common.util import getNoInstances from plenum.test.test_node import ensureElectionsDone, getPrimaryReplica...
__author__ = 'etuka' __date__ = '22 March 2019' import os import csv import ntpath import pandas as pd from django.conf import settings from dal.copo_da import Sample, Description from django.core.files.storage import FileSystemStorage from web.apps.web_copo.lookup.copo_enums import Loglvl, Logtype lg = settings.LOGG...
from FeatureModel import pointPillarFeatureNet from ModelBackbone import pointPillarModel from ModelBackbone import model class TrainingPipeline: def __init__(self, trainPillars, trainLabels, testPillars, testLabels): self.trainPillars = trainPillars self.trainLabels = trainLabels self.test...
import markdown from atomicpress.app import app from atomicpress.models import Post, PostStatus, PostType from flask import send_from_directory from sqlalchemy import desc from werkzeug.contrib.atom import AtomFeed from flask import request @app.route("/uploads/<filename>") def uploaded_file(filename): return sen...
#!/usr/bin/python import csv import os.path from collections import namedtuple import sn import os import sys,string import numpy as np import math import vcf import fnmatch #try: # file_map = sys.argv[1];dir_files_phenotype1 = sys.argv[2];dir_files_phenotype2 = sys.argv[3];outfilename = sys.argv[4] #except: # ...
""" This is a utility script for updating the spacy meta.json Sample call python --meta meta.json --augment metrics/dane_augmented_best_dacy_small_trf-0.1.0.json -- """ import json def main(meta_json, meta_augment_json, size, decimals=3): with open(meta_json) as f: meta = json.load(f) with open(meta...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import kaiming_init, normal_init from mmdet.ops import ConvModule from ..builder import build_loss from ..registry import HEADS @HEADS.register_module class GridHead(nn.Module): def __init__(self, ...
#!/usr/bin/env python import os import shutil import subprocess import difflib import filecmp import sys rootdir = "." for subdir, dirs, files in os.walk(rootdir): for file in files: if "RLBin" in (os.path.join(subdir, file)): os.remove(os.path.join(subdir, file)) print(os.path.join(subd...
#!/usr/bin/env python2 # Copyright (c) 2019 Erik Schilling # 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 ...
from .db_api import DbApi from .meta import Db from .schema import * class Impl(DbApi): def __init__(self, db): assert isinstance(db, Db) DbApi.__init__(self) self.__db = db def __del__(self): self.close() def close(self): if self.__db is not None: sel...
# vpe6080 Analog Input Thermistor Module 8 Channel # Demo Program reads 8 channels # Thermistor 10K Ohm 3380 Beta installed in Channel 1 to read room temperature import asyncio from pywlmio import * NodeID = 7 #NodeID location is the Bacplane ID (Jumpers) and Power Supply Slot location async def main(): init() ...
#!/usr/bin/python3 -OO # Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org> # # 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 late...
from setuptools import find_packages, setup setup( name = 'upbit_wrapper', version = '0.0.9', description = 'Python wrapper for upbit', long_description = open('README.md','rt').read(), long_description_content_type='text/markdown', author = 'BS LEE', ...
from fqf_iqn_qrdqn.agent.base_agent import BaseAgent from DMoGDiscrete.DMoGQ import DMoGQ from fqf_iqn_qrdqn.utils import disable_gradients, update_params from torch.optim import Adam import torch from DMoGDiscrete.utils import calculate_dmog_loss, evaluate_mog_at_action class DMoGQAgent(BaseAgent): def __init__(...
# 用random.randint(1,10),随机生成一个有100个元素的列表,然后按照元素出现次数的高低,从高到底排序并输出 import random numbers = [random.randint(1, 10) for i in range(100)] numbers_info = {} def sorted_by_freq(numbers): for number in numbers: # 遍历随机数列表 if number not in numbers_info: # 若该元素没有统计过 numbers_info[number] = numbers.count(nu...
# Copyright 2018, Kay Hayen, mailto:kay.hayen@gmail.com # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...
# 5 Faça um Programa que converta metros para centímetros. distancia = int(input('Digite uma distância em metros: ')) converção = distancia * 100 print(f'De acordo com a distância informada: {distancia} M, Sua conversão em centímetros é: {converção} CM ')
#!/usr/bin/env python3 # -*- coding: utf8 -*- from io import StringIO import os import subprocess import sys import types from .exceptions import (DeliveryTransportError, DeliveryPackingError) from .pickle import pickle, unpickle, ModulePickle class DeliveryBox(object): """Container for data exchange""" #...
# Кириллов Алексей, ИУ7-22 from math import sqrt from tkinter import * root = Tk() draw_pole = Canvas(root, width = 800, height = 600, bg = "white") def dist(x, y, x1, y1, x2, y2): lenth = abs((x-x1) * (y2-y1) - (y-y1) * (x2-x1)) /\ sqrt((x2-x1)**2 + (y2-y1)**2) #print(lenth) return lenth ...
# -------------------------------------- #! /usr/bin/python # File: 7. Reverse Integer.py # Author: Kimberly Gao # My solution: (Run time: 28ms) # Memory Usage: 14.4 MB class Solution: def _init_(self,name): self.name = name def reverse1(self, x: int) -> int: string = str(x) list1 = li...
from abaqusConstants import * from .Section import Section from ..Connector.ConnectorBehaviorOptionArray import ConnectorBehaviorOptionArray class ConnectorSection(Section): """A ConnectorSection object describes the connection type and the behavior of a connector. The ConnectorSection object is derived from ...
#!/usr/bin/env python # encoding: utf-8 #use nc -u 127.0.0.1 8888 to communicate with the server 1-way """A non-blocking, single-threaded TCP server.""" from __future__ import absolute_import, division, print_function, with_statement import errno import os import socket import ssl import stat import sys from tornado...
from django.contrib.gis import admin from leaflet.admin import LeafletGeoAdmin from world.models import Border, School, Facility, Busstop class BorderAdmin(LeafletGeoAdmin): search_fields = ['n03_001','n03_003','n03_004'] list_filter = ('n03_003') admin.site.register(Border, LeafletGeoAdmin) admin.site.reg...
DATA = b'\x00\x00\x01X\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x...
# --- # jupyter: # jupytext: # cell_metadata_filter: all,-execution,-papermill,-trusted # formats: ipynb,py//py:percent # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.7.1 # kernelspec: # display_name: Python 3 # ...
# # inputs outputs # single sin # simple sim # solution so # a a # class Node: def __init__(self, val): self.val = val self.children = [0] * 26 self.is_end = False self.word_count = 1 def get_unique_prefixes(words): root = Node(0) root.word_count += 1 ...
#!/usr/bin/python3 import json import os from ws_sdk import WS, ws_constants, ws_utilities import logging import sys SCANNER_ID = "ws-gl-int" LICENSE_SCHEMA_V = "2.1" DEPENDENCY_SCHEMA_V = "14.0.2" DEPENDENCY = "dependency" DEPENDENCY_ALERTS_BASED = "dependency_alert_based" LICENSE = "license" VUL_DB_URL = "https://w...
# # Copyright (c) 2014, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. # # import datetime import...
# Copyright 2020 Francesco Ceccon # # 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 writ...
from .UserRepository import destroy, get_all, get_one_user from .AuthenticationRepository import get_one, create, forgot_password, reset_password from .WorkoutRepository import get_all, create, get_one, delete, update_one from .ExerciseRepository import get_all, get_one, create, update_one, delete from .SessionReposito...
import pygame, sys from pygame.locals import QUIT pygame.init() display_surface = pygame.display.set_mode((400, 300)) font = pygame.font.Font(pygame.font.get_default_font(), 32) text = font.render('Hello World', True, (0, 0, 0)) textRect = text.get_rect() while True: display_surface.fill((255, 255, 255)) disp...
import sys import matplotlib.pyplot as plt import numpy as np import pandas as pd from joblib import Parallel, delayed import cocpit import cocpit.pic as pic sys.path.append("../") import multiprocessing # noqa def create_ellipse(campaign, desired_size, file): if campaign == "OLYMPEX": image = pic.Ima...
from rest_framework.permissions import BasePermission class SearchPermissions(BasePermission): """ DRF permission class that checks that the user has at least one of the permissions in the view_permissions attribute on the search app. """ is_export = False def has_permission(self, request, v...
#!/usr/bin/env python # # Copyright 2010 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 requir...
import os import json import logging import tba_config from google.appengine.api import taskqueue from google.appengine.ext import ndb from google.appengine.ext import deferred from google.appengine.ext.webapp import template from controllers.base_controller import LoggedInHandler from datafeeds.datafeed_fms_api import...
""" Posix platform main process. """ from ....base import EventBus def run_petronia(bus: EventBus) -> int: print("Petronia for Posix environments started.") return 0
# Copyright (c) OpenMMLab. All rights reserved. from .anchor import * # noqa: F401, F403 from .bbox import * # noqa: F401, F403 from .evaluation import * # noqa: F401, F403 from .patch import * # noqa: F401, F403 from .post_processing import * # noqa: F401, F403 from .visualization import * # noqa: F401, F403
#!/usr/bin/env python #appion from appionlib import apPrepXmipp3D from appionlib import apDisplay class XmippPrepML3DRefinement(apPrepXmipp3D.XmippPrep3DRefinement): def setRefineMethod(self): self.refinemethod = 'xmippml3d' #===================== if __name__ == "__main__": app = XmippPrepML3DRefinement() app.s...
from openbiolink.graph_creation.file_processor.fileProcessor import FileProcessor from openbiolink.graph_creation.metadata_infile import InMetaOntoUberonIsA from openbiolink.graph_creation.types.infileType import InfileType from openbiolink.graph_creation.types.readerType import ReaderType class OntoUberonIsAProcesso...
""" Implements Lydian converter. """ alpha_to_lydian = [ (r"a", "𐤠"), (r"b", "𐤡"), (r"p", "𐤡"), (r"g", "𐤢"), (r"d", "𐤣"), (r"e", "𐤤"), (r"v", "𐤥"), (r"w", "𐤥"), (r"i", "𐤦"), (r"y", "𐤧"), (r"k", "𐤨"), (r"l", "𐤩"), (r"m", "𐤪"), (r"n", "𐤫"), (r"o",...
# Python - 3.6.0 cookie = lambda x: f'Who ate the last cookie? It was {"Zach" if type(x) is str else "Monica" if (type(x) is float) or (type(x) is int) else "the dog"}!'
import doctest from insights.parsers import ls_var_opt_mssql from insights.tests import context_wrap LS_VAR_OPT_MSSQL_WRONG_PERM = """ drwxrwx---. 5 root root 58 Apr 16 07:20 /var/opt/mssql """.strip() LS_VAR_OPT_MSSQL_WRONG_PERM_2 = """ drwxrwx---. 5 mssql root 58 Apr 16 07:20 /var/opt/mssql """.strip() LS_VAR_OPT...
import os import sys from typing import List import click from ruamel.yaml import YAML from great_expectations import DataContext from great_expectations.checkpoint.types.checkpoint_result import CheckpointResult from great_expectations.cli import toolkit from great_expectations.cli.pretty_printing import cli_message...
from unittest import TestCase from countpigs import CountPigs, directcountpigs, expect_val, f, p class TestSimulation(TestCase): def test_direct_count_cls(self): c = CountPigs(5) # (n, q, m, k) = (5, 1, 3, 2) choice = c.choice(1) choices = c.choices(1, 3) choose =...
import torch import torch.nn.functional as F from torch import nn from torchvision import models from torch.hub import load_state_dict_from_url from ast import literal_eval from itertools import chain from .utils import gram_matrix class ContentLoss(nn.Module): def __init__(self, mode): super(ContentLoss, ...
""" The tests in this module compare the RESPY package to the original RESTUD code for the special cases where they overlap. """ from pandas.util.testing import assert_frame_equal import pandas as pd import numpy as np import subprocess import pytest from codes.random_init import generate_random_dict from respy.pyt...
from suplemon.linelight.color_map import color_map class Syntax: def get_comment(self): return ("/*", "*/") def get_color(self, raw_line): color = color_map["white"] line = str(raw_line) if line.startswith("+"): color = color_map["green"] elif line.startswi...
import numpy as np def read_input(): with open("input.txt", "r") as file: return [[int(c) for c in l] for l in file.read().splitlines()] def get_neighbors(grid, y, x, v): neighbors = [p for p in [(y-1,x),(y+1,x),(y,x-1),(y,x+1)] \ if 0 <= p[0] < grid.shape[0] and 0 <= p[1] < grid.shape[1] and ...
import nltk import random import feedparser urls = { 'mlb': 'https://sports.yahoo.com/mlb/rss.xml', 'nfl': 'https://sports.yahoo.com/nfl/rss.xml', } feedmap = {} stopwords = nltk.corpus.stopwords.words('english') def featureExtractor(words): features = {} for word in words: if word not in sto...
class ControlConfiguration(object): def __init__(self, control_horizon, prediction_horizon, min_diff=1e-3, max_diff=0.15, diff_decay=0.8): self.control_horizon = control_horizon self.prediction_horizon = prediction_horizon self.min_diff = min_diff self.max_diff = max_diff s...
from flexitext.utils import listify class Parser: def __init__(self, tokens): self.tokens = tokens self.current = 0 def at_end(self): return self.peek().kind == "EOF" def advance(self): self.current += 1 return self.tokens[self.current - 1] def peek(self): ...
import argparse import polyscope as ps import pickle import os import numpy as np from mmcv import Config, DictAction from mmdet3d.datasets import build_dataloader, build_dataset def parse_args(): parser = argparse.ArgumentParser( description='Visualize Results') parser.add_argument('config', help='t...
from flask.ext.mail import Mail, Message from run import mail def sendUserEmail(to, message): header = 'Allez Viens User Contacted You' sendEmail([to], header, message) def sendValidationEmail(to, url): header = 'Allez Viens Validation' body = "Please click <a href='" + url + "'>this link</a> to validate and edit...
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: data/exercise_route2.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflect...
# Created by MechAviv # Quest ID :: 32707 # [FriendStory] Student From Another World sm.setIntroBoxChat(1530000) sm.setSpeakerType(3) sm.sendNext("Hello? Hello?\r\n\r\nOkay, the magician guy said he teleported the phone to someone who can help. So, um, hi? Can you help me, maybe?") sm.setIntroBoxChat(1530000) sm.set...
# original: https://github.com/yukuku/telebot # modified by: Bak Yeon O @ http://bakyeono.net # description: http://bakyeono.net/post/2015-08-24-using-telegram-bot-api.html # github: https://github.com/bakyeono/using-telegram-bot-api # # 구글 앱 엔진 라이브러리 로드 from google.appengine.api import urlfetch from google.a...
from . import overworld from . import dungeon1 from . import dungeon2 from . import dungeon3 from . import dungeon4 from . import dungeon5 from . import dungeon6 from . import dungeon7 from . import dungeon8 from . import dungeonColor from .requirements import AND, OR, COUNT, FOUND from .location import Loca...
''' This object reads PCL files and prepare the microarray data as training set to DAs. The input training vector can either be a gene's expression value over all sampels, or one microarray sample with all genes' expression value. To feed into DAs, the standard input dataset is a two-dimensional array with each row a...
from setuptools import setup setup( name='budget', version='1.2.2', packages=['budget'], entry_points={ 'console_scripts': [ 'budget=budget.__main__:main' ] })
from Jumpscale import j def main(self): """ to run: kosmos 'j.data.types.test(name="iprange")' """ ipv4 = j.data.types.get("iprange", default="192.168.0.0/28") assert ipv4.default_get() == "192.168.0.0/28" assert ipv4.check("192.168.23.255/28") == True assert ipv4.check("192.168.23.3...
from typing import Optional from pydantic import BaseModel, Field class CodePayload(BaseModel): id: str = Field(..., max_length=8) code: str description: Optional[str] = None
# ------------------------------------------------------------- # BASE: Simple script to score points for the facebook CTF # ------------------------------------------------------------- # # Written by Javier (@javutin) import time import json import hashlib import logging from BaseHTTPServer import HTTPServer, BaseHT...
from collections import defaultdict from django.contrib.sites.models import Site from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse from symposion.proposals.kinds import get_kind_slugs, get_proposal_model from email_log.models import Email from pycon.models import PyConP...
# -*- coding: UTF-8 -*- import fnmatch import logging import re import subprocess import uuid from threading import Thread from .decorators import side_effecting from .utils import create_sha1sum_file class Action: """Абстрактный класс действия. Attributes: name: Строка, уникальное имя действия. ...
"""Update invoice check constraint Revision ID: 49e1c8c65f59 Revises: c45d12536d7e Create Date: 2017-03-31 02:09:55.488859 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '49e1c8c65f59' down_revision = 'c45d12536d7e' branch_labels = None depends_on = None def...
# Copyright (c) 2015 Mirantis 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 to in writ...
from converter import Parser, Converter test_cases = [ # LENGTH "100 kmeter nfeet", "1 nauticalmile meter", "1 microleague millifoot", "13 dlea Mft", "1 ft fur", "100 kilometer dafeet", "1 ft m", "17 kilord Gin" # DATA "10 kbyte Mb", "8 bit byte", "100 GiB Mibit", ...
# # The script providing implementation of structures and functions used in # the Novelty Search method. # from functools import total_ordering # how many nearest neighbors to consider for calculating novelty score? KNN = 15 # the maximal novelty archive size MAXNoveltyArchiveSize = 1000 @total_ordering class Novelt...
from timeit import default_timer as timer # from datahelpers.data_helper_ml_mulmol6_OnTheFly import DataHelperMulMol6 from datahelpers.data_helper_ml_normal import DataHelperMLNormal from datahelpers.data_helper_ml_2chan import DataHelperML2CH from datahelpers.data_helper_ml_mulmol6_OnTheFly import DataHelperMLFly from...
#! /usr/bin/python # transaction_csv_cleanup.py # for Python 3 # Searches specified folder or default download folder for exported # bank transaction file (.csv format) & adjusts format for YNAB import # CHANGELOG # 2017-09-29 # ~ Merged in parameters from https://www.reddit.com/user/FinibusBonorum # ~ ...
# *************************************************** # SERVO test for duty cycle range # # ProtoStax Air Quality Monitor. # using Raspberry Pi A+, Micro Servo SG92R, RGB LED and ProtoStax Enclosure for Raspberry Pi # --> https://www.protostax.com/products/protostax-for-raspberry-pi-a # You can also use # -...
# -*- coding: utf-8 -*- from PyQt4 import QtGui, QtCore, Qt class QRoundProgressBar(QtGui.QWidget): StyleDonut = 1 StylePie = 2 StyleLine = 3 PositionLeft = 180 PositionTop = 90 PositionRight = 0 PositionBottom = -90 UF_VALUE = 1 UF_PERCENT = 2 UF_MAX = 4 def __init__(se...
from .parser import MopacParser
# -*- coding: utf-8 -*- """.. moduleauthor:: Artur Lissin""" from bann.b_container.states.framework.pytorch.lr_scheduler_param import LrSchAlgWr, \ create_lr_sch_json_param_output from bann.b_container.functions.pytorch.init_framework_fun import InitNetArgs from bann.b_container.states.framework.pytorch.optim_param...