text
string
size
int64
token_count
int64
from loggingpy import Logger from loggingpy import BundlingHttpSink import time import random import logging import sys from examples import uris # you must provide these uri strings (just any uri that accepts requests.post(...) requests) if __name__ == "__main__": # Sumologic token url (just a basic string) ...
2,140
594
#!/usr/bin/python import os import sys try: os.mkdir("src/jvm/io/fsq/twofishes/indexer/data/computed/") except: pass alternateNames = open("src/jvm/io/fsq/twofishes/indexer/data/downloaded/alternateNames.txt") if len(sys.argv) == 2: print "building buildings for %s" % sys.argv[1] input = open("src/jvm/io/fsq...
1,177
483
from enum import Enum class Process(Enum): FAILED = 0 SUCCEEDED = 1
78
33
## write files originally copied from stack abuse at ## https://stackabuse.com/writing-files-using-python/ ## read files originally copied from stack abuse at ## https://stackabuse.com/reading-files-with-python/ def writeOutput(line): appendFilehandle = open('clean_history.log','a') appendFilehandle.write(l...
903
275
import math from hls4ml.converters.keras_to_hls import parse_default_keras_layer from hls4ml.converters.keras_to_hls import keras_handler from hls4ml.converters.keras_to_hls import parse_data_format from hls4ml.converters.keras_to_hls import compute_padding_1d from hls4ml.converters.keras_to_hls import compute_padding_...
3,833
1,264
import os import sys import pytest import pickle import numpy as np import xarray as xr from .pytest_utils import fp, md5sum, call_with_legacy_params, assert_objects_equal from SEIRcity.simulate.multiple_pool import multiple_pool from SEIRcity.simulate.multiple_serial import multiple_serial from SEIRcity.param import a...
2,528
823
#!/usr/bin/python # # Copyright 2018-2020 Polyaxon, 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 ...
3,668
1,190
from dataclasses import dataclass, field from typing import List, Optional from hostingde.model import Model from hostingde.model.record import Record from hostingde.model.zone_config import ZoneConfig @dataclass class CreateZoneRequest(Model): zone_config: ZoneConfig nameserver_set_id: Optional[str] use...
416
118
import json import cfenv import requests import logging from structlog import wrap_logger logger = wrap_logger(logging.getLogger(__name__)) class RabbitMQ: def __init__(self, cf_service_name): self.cf_service_name = cf_service_name self.services = self._get_services_from_cf() def log_metri...
1,898
582
import pytest from datetime import date from django.conf import settings from todovoodoo.core.tests.factories import TodoListFactory pytestmark = pytest.mark.django_db def test_mark_complete(user: settings.AUTH_USER_MODEL): today = date.today() todo_list = TodoListFactory.create(owner=user) todo = todo_...
412
133
import torch import torch.nn as nn import torch.nn.functional as function def conv3x3(in_features: int, out_features: int, stride: int = 1) -> nn.Conv2d: '''3x3 conv with padding''' return nn.Conv2d(in_channels=in_features, out_channels=out_features, kernel_size=3, stride=stride, padding=1) class BasicBlock(nn...
4,026
1,535
# Day 10 - Part 1 print "Day 10 - Part 1" with open("./day10-input.txt") as f: content = f.read().splitlines() try: numbers = [int(number_as_string) for number_as_string in content] except TypeError as e: print "Something was not a number" raise e # Append device numbers.append(max(numbers) + 3) numbers.sort(...
621
224
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorx as tx import numpy as np import pytest import tensorflow as tf def test_sparse_dense_mul(): x = tf.random.uniform([2, 4]) s = tx.to_sparse(x) v = tf.random.uniform([4, 3]) # matmul mul0 = tf.matmul(x, v) mul1 = tf.sparse.spar...
521
225
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2013, Johan Wiren <johan.wiren.se@gmail.com> # # This file is part of Ansible # # Ansible 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 3 of th...
13,443
4,089
from typing import Optional, Union from anndata import AnnData import matplotlib.pyplot as plt from matplotlib import cm import matplotlib as mpl import numpy as np def deconvolution_plot( adata: AnnData, library_id: str = None, use_label: str = "louvain", cluster: [int, str] = None, celltype: str...
4,491
1,619
from tqdm import tqdm import os import argparse import tensorflow as tf import yaml import shutil global_max = 0 cumodel = None def safemkdir(dirn): if not os.path.isdir(dirn): os.mkdir(dirn) def preprocess(in_fname,char_phn_tok): words = list() phn = list() print("Opening file...") with open(in_fname,...
5,536
2,070
import json from nbformat.notebooknode import NotebookNode from nbconvert.exporters.exporter import ResourcesDict from typing import Tuple from nbgrader.preprocessors import OverwriteCells as NbgraderOverwriteCells from ..utils.extra_cells import is_extra_cell class OverwriteCells(NbgraderOverwriteCells): def ...
1,299
349
from setuptools import setup, find_packages setup( name = "Greengraph", description = "A package to compute proportion og green land between two locations", version = "0.1.0", author = "James Scott", author_email = "jas15@ic.ac.uk", packages = find_packages(exclude = ['*test']), scripts =...
400
129
from qtvscodestyle.qtpy.QtCore import Qt from qtvscodestyle.qtpy.QtWidgets import QDockWidget, QMainWindow, QTextEdit class DockUI: def _setup_ui(self, main_win: QMainWindow) -> None: # Attribute left_dock = QDockWidget("Left dock") right_dock = QDockWidget("Right dock") top_dock =...
1,462
478
from typing import Tuple from sequence_transfer.sequence_transfer import SequenceTransfer from sequence_transfer.sequence import Sequence def to_lower(text: str) -> Tuple[str, SequenceTransfer]: sequence = Sequence(0, len(text)) transfer = SequenceTransfer( sequence, sequence, [(sequen...
375
105
import typing from typing import Any, Callable, List, Tuple, Union import numpy as np import os, sys from PIL import Image from .abc_interpreter import Interpreter from ..data_processor.readers import preprocess_image, read_image, restore_image, preprocess_inputs from ..data_processor.visualizer import visualize_heat...
7,563
2,146
from easyaws.ec2_vm import Ec2Tool from easyaws.s3_bucket import S3Bucket def get_metadata_creds(): creds = Ec2Tool.get_credentials() print('metadata credentials:', creds) return creds def get_metadata_role_arn(): role_arn = Ec2Tool.get_role() print('role arn: ', role_arn) return role_arn def...
740
290
import sys from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker import argparse from app.db import User def parseargs(): parser = argparse.ArgumentParser() parser.add_argument('-d', '--database', type=str, required=True, help="Database.") parser.add_argument('-e', '...
972
289
import aioredis import pytest from aio_pubsub.backends.redis import RedisPubSub @pytest.fixture async def create_pub_sub_conn(): pub = await aioredis.create_redis("redis://localhost:6379/0?encoding=utf-8") sub = await aioredis.create_redis("redis://localhost:6379/0?encoding=utf-8") yield pub, sub pub...
2,025
703
'''Contains classes and methods dedicated to scraping web finance data''' from json.decoder import JSONDecodeError import demjson import requests class BaseStockDataPump(): '''Base class for intake of stock data''' def __init__(self, url, stock_name, output_queue = None, chunk_size: int = 5): self....
1,223
347
""" Production Settings """ import os import dj_database_url #import django_heroku from .dev import * ############ # DATABASE # ############ DATABASES = { 'default': dj_database_url.config( default=os.getenv('DATABASE_URL') ) } ############ # SECURITY # ############ DEBUG = bool(os.getenv('DJANGO_...
596
226
from algorithms.genetic.genes import PoissonGene, NormalGene, UniformGene, UniformIntGene import numpy as np import pytest @pytest.mark.parametrize("value", np.linspace(0, 20, 10)) @pytest.mark.parametrize("min_value", np.linspace(0, 10, 10)) @pytest.mark.parametrize("delta", np.linspace(0, 10, 10)) def test_sample_p...
2,513
1,018
from fastapi import HTTPException, status import os from uuid import uuid4 from firebase import db from firebase_admin import firestore import numpy as np # 全ての登録情報を取得 async def get_all_members(): docs = db.collection("members").stream() data = [] for doc in docs: post = {"id": doc.id, **doc.to_di...
5,561
2,169
# Copyright 2019 AIST # # 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, softwar...
3,173
1,084
class Html: """HTML utilities""" @staticmethod def ahrefs(url): """Get <a> hrefs related to domain""" from lib.pt_html import get_page_ahrefs for href in get_page_ahrefs(url): print(href) def sel(self, url, selector, fmt=None): """Shows some part of source ...
1,429
423
from model import YOLOv1 import torch import torch.nn as nn class YOLOv1Loss(nn.Module): def __init__(self, S=7, B=2, C=20): """ __init__ initialize YOLOv1 Loss. Args: S (int, optional): split_size. Defaults to 7. B (int, optional): number of boxes. Defaults to 2. ...
2,959
1,073
# encoding: utf-8 from __future__ import division, print_function, unicode_literals ########################################################################################################### # # # Filter with dialog Plugin # # Read the docs: # https://github.com/schriftgestalt/GlyphsSDK/tree/master/Python%20Templates...
5,332
2,060
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) # noinspection PyUnresolvedReferences,PyCompatibility from builtins import * import cProfile import pprint import yaml import bag from bag.layout import RoutingGrid, TemplateDB from abs...
4,142
1,659
from rlrunner.termination.base_termination_condition import BaseTerminationCondition from collections import deque class DynamicTC(BaseTerminationCondition): """ This is a more complex and dynamic termination condition It will see if there has been sufficient progress in the last X episodes and if not it will ass...
1,832
624
# WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4 import winsdk _ns_module = winsdk._import_ns_module("Windows.UI") Color = _ns_module.Color WindowId = _ns_module.WindowId ColorHelper = _ns_module.ColorHelper Colors = _ns_module.Colors UIContentRoot = _ns_module.UIContentRoot UIC...
350
124
from CommonServerPython import * COMMAND_NAME = 'netstat' def get_netstat_file_name(command_files): if command_files and isinstance(command_files, dict): netstat_files = command_files.get(COMMAND_NAME, []) if netstat_files: if isinstance(netstat_files, list): # we want...
2,082
657
import pandas as pd import glob from tqdm import tqdm, trange from nltk.tokenize import sent_tokenize, word_tokenize import numpy as np import json import os import requests from flask import Flask, request, Response from flask_cors import CORS from requests import Request, Session import json import transformer...
5,241
1,870
while True: try: n = int(input()) except EOFError: break lim = int(n // 2) for i in range(1, n+1, 2): print(' ' * lim, end='') lim -= 1 print('*' * i) print((int(n // 2) * ' ') + '*') print((int(n // 2) - 1) * ' ' + '***') print()
291
122
"""Manages mapped Windows drives.""" import win32net class MappedDrives(object): def __init__(self): """MappedDrives() -> o.""" def add(self, **kwargs): """o.add(**kwargs) -> None Adds a mapping between drive (local) and share (remote). The required keyword argume...
1,608
496
from gaphor.diagram.copypaste import copy, copy_named_element from gaphor.UML import State, Transition @copy.register def copy_state(element: State): yield element.id, copy_named_element(element) if element.entry: yield from copy(element.entry) if element.exit: yield from copy(element.exit...
563
167
#https://www.codewars.com/kata/6159dda246a119001a7de465/train/python def translate(s, voc): s = s.split(' ') output = [] for speech in s: for vocabulary in voc: real_speech = speech_decoder(speech, vocabulary) if real_speech: output.append(rea...
1,026
356
import os import numpy as np import torch from torch.utils.data import Dataset class ChargedData(Dataset): def __init__(self, data_path, mode, params): self.mode = mode self.data_path = data_path if self.mode == 'train': path = os.path.join(data_path, 'train_feats') ...
3,878
1,414
import numpy as np import pandas as pd class BookKeeper: def __init__(self): pass
95
30
# -*- coding: utf-8 -*- from __future__ import print_function import numpy as np import pickle, re, os import acq4.Manager import collections import acq4.util.functions as functions import acq4.util.advancedTypes as advancedTypes import acq4.util.debug as debug from acq4.util import Qt import six from six.moves import ...
30,891
8,432
from typing import Iterable, Optional, Union from saleae.analyzers import HighLevelAnalyzer, AnalyzerFrame, StringSetting, NumberSetting, ChoicesSetting si_registers = { 0x00: "Device Type (R)", 0x01: "Device Version (R)", 0x02: "Device Status (R)", 0x03: "Interrupt Status 1 (R)", 0x04: "Interrupt Status 2 (R)", ...
7,381
3,151
#!/usr/bin/python2.7 # Copyright (c) 2013 The CoreOS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import BaseHTTPServer import os import select import signal import subprocess import threading import time import unittest script_pat...
3,719
1,116
from irekua_database.models import SamplingEventDevice from django.views.generic.detail import SingleObjectMixin from django.utils.translation import gettext as _ from irekua_database.models import Item from irekua_filters.items import items from irekua_permissions.items import ( items as item_permissions) from se...
1,800
530
import os import json from collections import defaultdict corpus_folder="/data/tanggp/all_text_data_text_pipe/eval_golden" tags_dic=defaultdict(int) co=0 node=defaultdict(int) tags_text=[] for root, _, files in os.walk(corpus_folder): for file in files: raw_corpus_file_path = os.path.join(root, file) ...
1,883
717
# -*- coding: utf-8 -*- # # Copyright (c) 2016, ParaTools, Inc. # 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, # t...
8,643
2,739
# Copyright Ryan-Rhys Griffiths 2021 # Author: Ryan-Rhys Griffiths """ Comparison of GP-interpolated X-ray and true structure functions where the GP interpolated structure functions are computed following the introduction of gaps into lightcurves. """ import numpy as np from matplotlib import pyplot as plt from simul...
4,205
1,491
import unittest from labsys.app import create_app class TestConfig(unittest.TestCase): def test_production_config(self): app = create_app('production') self.assertFalse(app.testing) self.assertFalse(app.config['DEBUG']) self.assertFalse(app.config['BOOTSTRAP_SERVE_LOCAL']) def...
809
248
''' code by Tae Hwan Jung(Jeff Jung) @graykode ''' import numpy as np import torch import torch.nn as nn import torch.optim as optim import sys dtype = torch.FloatTensor char_arr = [c for c in 'abcdefghijklmnopqrstuvwxyz'] word_dict = {n: i for i, n in enumerate(char_arr)} number_dict = {i: w for i, w in enumerate(...
3,223
1,242
# Credits to Userge for Remove and Rename import io import os import os.path import shutil import time from os.path import dirname, exists, isdir, isfile, join from shutil import rmtree from userbot import CMD_HELP from userbot.events import register from userbot.utils import humanbytes MAX_MESSAGE_SIZE_LIMIT = 4095...
5,366
1,848
""" Tests for the qprof.input_data module. """ import numpy as np import pytest from qprof.models import get_normalizer, get_model from qprof.input_data import BinInputData NETCDF4_AVAILABLE = False try: import netCDF4 NETCDF4_AVAILABLE = True except ImportError: pass def test_bin_input_data(test_data)...
1,946
669
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-05 00:43 from __future__ import unicode_literals import django.contrib.gis.db.models.fields from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migra...
1,556
462
### tensorflow==2.3.0 ### https://ai.googleblog.com/2020/08/on-device-real-time-body-pose-tracking.html ### https://google.github.io/mediapipe/solutions/pose ### https://www.tensorflow.org/api_docs/python/tf/keras/Model ### https://www.tensorflow.org/lite/guide/ops_compatibility ### https://www.tensorflow.org/api_do...
39,419
16,513
#! /usr/bin/env python3 # external imports import click # local imports from .scripts import create, publish, ask @click.group() def cli(): """ A collection of functions for managing nautilus clouds. """ pass # add the various sub commands to the manager cli.add_command(create) cli.add_command(pu...
348
106
from app import app from flask_wtf import FlaskForm from wtforms import StringField, SelectField, BooleanField, SubmitField from wtforms.validators import DataRequired class SearchForm(FlaskForm): title = StringField('Book Title') author = StringField('Author Name') subject = StringField(app.config['SUBJEC...
402
111
# Copyright 2012 VMware, 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 agree...
57,075
15,425
# Exercício Python 49: Refaça o DESAFIO 9, mostrando a tabuada de um número que o usuário escolher, só que agora utilizando um laço for. n = int(input("Quer saber a tabuada de qual número? ")) for c in range(1, 11): print(f"{n} x {c:2} = {n * c:2}") c += 1
265
113
"""AML data passing helpers.""" from binascii import hexlify from uuid import UUID from eth_utils import is_checksum_address def pack_kyc_dataframe(whitelisted_address: str, customer_id: UUID, min_eth_10k: int, max_eth_10k: int) -> bytes: """Pack KYC information to the smart contract. See KYCPayloadDeserial...
3,933
1,463
#!/usr/bin/env python import sys import numpy as np from mlfutil import * port_encoder = None def init(): global port_encoder port_encoder = PortEncoder() port_encoder.init() def build_feat(): infile = sys.argv[1] outfile = sys.argv[2] fo = open(outfile, 'w') data = None with open(...
1,227
445
""" Permission Module """ from rest_framework import permissions from .models import Harvester __author__ = "Jan Frömberg" __copyright__ = "Copyright 2018, GeRDI Project" __credits__ = ["Jan Frömberg"] __license__ = "Apache 2.0" __maintainer__ = "Jan Frömberg" __email__ = "jan.froemberg@tu-dresden.de" class IsOwner...
764
233
#! /usr/bin/python from myhdl import Signal, SignalType, always_comb, always_seq, intbv from common.timebase import sec from common.util import rename_interface from wb import WbSlave class Port(object): def __init__(self, value): self.STB = Signal(False) self.WE = Signal(False) self.DAT_I = Signa...
4,175
1,395
import albumentations as A from albumentations.pytorch import ToTensorV2 import cv2 def make_augmenters(conf): p = conf.aug_prob crop_size = round(conf.image_size*conf.crop_size) aug_list = [ A.ShiftScaleRotate( shift_limit=0.0625, scale_limit=0.2, rotate_limit=25, interpola...
1,435
579
import inspect from PyQt4.QtGui import * class ComboBox(QComboBox): def __init__(self, parent=None): super(ComboBox, self).__init__(parent) self.data = [] def add_classes_from_module(self, module): for name, obj in inspect.getmembers(module): if inspect.isclass(obj): ...
671
210
VERSION='0.9dev0' from setuptools import setup, Extension with open("README.md", "r") as doc: long_description = doc.read() doc.close() yammpy = Extension('yammpy', sources=['yammpy/yammpy.c'], include_dirs=['yammpy/include']) setup( name="yammpy", version=VERSION, author="Ajith Ramachandran", ...
946
324
import graphsim as gs from munkres import Munkres import networkx as nx import numpy as np __all__ = ['Mesos'] class Mesos(object): """ Extract mesostructure for two mobility graphs. """ def __init__(self, G1, G2, nattr='weight', eattr='weight', lamb = 0.5): G1, G2 = sorted([G1, G2], key=lambda x...
2,183
937
import os import argparse from data_loader import pip_data from train import train_test_interface from predict import predict def main(): parser = argparse.ArgumentParser() # parameters defined for in pip_data parser.add_argument("--mode", help="pip_data, train, test or predict", default="predict", type=s...
3,194
1,014
# -*- coding: utf-8 -*- from amplify.agent.common.context import context from amplify.agent.collectors.abstract import AbstractMetaCollector from amplify.agent.objects.plus.api import TYPE_MAP __author__ = "Grant Hulegaard" __copyright__ = "Copyright (C) Nginx, Inc. All rights reserved." __license__ = "" __maintainer...
2,226
661
# -*- coding: utf-8 -*- import unittest from brambox.boxes.annotations.annotation import Annotation from brambox.boxes.annotations import VaticAnnotation, VaticParser vatic_string = """-1 0 0 0 0 0 0 0 0 ? -1 0 0 0 0 0 0 0 0 ? -1 0 0 0 0 0 0 0 0 person -1 0 0 0 0 1 0 0 0 person""" class TestVaticAnnotation(unittest....
3,679
1,359
#!/usr/bin/python # -*- encoding: utf-8 import unittest, os, re, json from xml.etree import ElementTree as et from palaso.sldr.langtags_full import LangTags, LangTag from itertools import product langtagjson = os.path.join(os.path.dirname(__file__), '..', 'pub', 'langtags.json') exceptions = set(["aii-Cyrl"]) class...
2,307
684
from pathlib import Path from PyQt5.QtWidgets import QDialog, QLineEdit, QCheckBox, QPushButton, QApplication from PyQt5.QtWidgets import QLabel, QMessageBox, QHBoxLayout, QFormLayout from PyQt5.QtGui import QIcon from PyQt5.Qt import Qt from trafficmonitor.helper_functions import create_path, ping class ...
5,178
1,533
""" A class library to model fly behavior. """ from random import * WORLD_SIZE = 200 class Fly(object): '''Doc string''' def __init__(self, location): #A list for holding the collection of yeast spores in the fly gut self.stomach = [] self.location = location self.fitness = 0 ...
1,350
446
# -*- coding: utf-8 -*- # Copyright (c) 2011 Plivo Team. See LICENSE for details. from plivo.core.freeswitch.inboundsocket import InboundEventSocket from plivo.core.errors import ConnectError from plivo.utils.logger import StdoutLogger import gevent def stop(inbound_event_listener, log): log.info("stopping now !"...
956
323
__all__ = [ 'vp9_settings', 'resolutions', 'probe_dimensions', 'encode_webm' ] from os import devnull from fractions import Fraction import subprocess from typing import Dict import ffmpeg from . import common vp9_settings = { 'c:v': 'libvpx-vp9', 'b:v': 0, 'g': 119, 'crf': 20, 'pix_fmt': 'yuv4...
2,868
1,070
# PIS import tkinter import tkinter.ttk import tkinter.messagebox import sqlite3 CLASS Database: FUNCTION __init__(self): dbConnection <- sqlite3.connect("dbFile.db") dbCursor <- dbConnection.cursor() ENDFUNCTION FUNCTION __del__(self): dbCursor.close() dbConnection.clo...
20,743
6,988
# Copyright 2014 Google Inc. All Rights Reserved. """Command for creating instances.""" import collections from googlecloudsdk.calliope import exceptions from googlecloudsdk.compute.lib import addresses_utils from googlecloudsdk.compute.lib import base_classes from googlecloudsdk.compute.lib import constants from goog...
18,074
5,249
# # PySNMP MIB module TPT-HEALTH-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPT-HEALTH-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:18:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
10,909
4,925
# Copyright (c) 2017 David Preece - davep@polymath.tech, All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDIN...
6,215
1,846
"""Non public API of the comandante. Description: ----------- This package contains definitions that shouldn't be used by outside users and that are considered as a subject of change in the future. """
204
51
# -*- coding: utf-8 -*- from __future__ import unicode_literals from unittest import TestCase import pytest import os from cielo_webservice.models import ( Comercial, Cartao, Pedido, Pagamento, Autenticacao, Autorizacao, Token, Transacao, Avs, Captura, Cancelamento, Erro, xml_to_object ) BASE_DIR = os.path.d...
30,094
10,979
# # commit.py # Parses a project's control file and wraps git operations, calling the context # script to build automatic commit messages as needed. import os import sys import re import datetime import time import logging import context # this import is only valid for Linux import commands # Import smtplib for the...
10,114
2,931
import time import datetime from masonite.view import View from masonite.auth import Auth from masonite.request import Request from masonite.testsuite.TestSuite import generate_wsgi from masonite.auth import MustVerifyEmail from masonite.app import App from masonite.auth import Sign from masonite.helpers.routes import...
5,219
1,636
import abc from datetime import datetime import logging import os from typing import Optional, Union from common.licenses.licenses import is_valid_license_info from common.storage import util logger = logging.getLogger(__name__) # Filter out tags that exactly match these terms. All terms should be # lowercase. TAG_B...
9,947
2,793
# -*- coding: utf-8 -*- """ Created on Wed Jan 2 10:52:02 2019 @author: janej """ #a = [['apple','orange','banana','grape'],(1,2,3)] #for x in a: # for y in x: # if y == 'orange': # break # print(y) #else: # print('No fruits') #a = [1,2,3] #for x in a: # if x==2: # break # ...
661
333
import asyncio import xmltodict from scrapli_netconf.driver import AsyncNetconfDriver from scrapli.logging import enable_basic_logging from jinja2 import Environment, FileSystemLoader # Enable logging. Create a log file in the current directory. enable_basic_logging(file=True, level="debug") GALVESTON = { "host"...
1,864
650
# -*- coding: UTF-8 -*- import aiounittest from unittest.mock import Mock, patch from pydigitalstrom.devices.base import DSDevice from tests.common import get_testclient class TestDevice(aiounittest.AsyncTestCase): def test_attributes(self): device = DSDevice(client=get_testclient(), device_id=5, device_...
2,019
633
# Copyright 2017 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
5,245
1,544
import win32event import win32serviceutil class Svc(win32serviceutil.ServiceFramework): _svc_name_ = 'Outlier' _svc_display_name_ = 'Outlier' _svc_description_ = 'HTTP转SOCKS5代理 / GeoIP分流' def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self....
546
212
import string from itertools import combinations with open('input.txt') as f: ids = [line.strip() for line in f] twos = 0 threes = 0 for idx in ids: idx_list = [a for a in idx] twos_found = False threes_found = False for x in string.ascii_lowercase: if idx_list.count(x) == 2 and not twos_...
779
289
# This Python file uses the following encoding: utf-8 from gui.uis.windows.main_window.functions_main_window import * import sys import os from qt_core import * from gui.core.json_settings import Settings from gui.uis.windows.main_window import * from gui.widgets import * os.environ["QT_FONT_DPI"] = "96" class Main...
2,719
859
#!/usr/bin/env python3 """checkCardReaders.py: Use a local MySQL database to keep track of card readers and produce a 'changes' JSon document.""" __author__ = "Hans Liss" __copyright__ = "Copyright 2020, Hans Liss" __license__ = "BSD 2-Clause License" __version__ = "1.1" __maintainer__ = "Hans Liss" __email__ = "Hans...
6,158
1,875
# ad-soyad : Ramazan AYDIN --- numara : 180401040 print("\n") """ Bu python kodunda ; parametre olarak verilen dosyadaki (veriler.txt) verilerin sırasıyla 1,2,3,4,5,6. dereceden polinoma yakınlaştırarak bu polinomlardan hangisinin en az hata ile sonucu bulduğunu hesaplayacağiz. Tespit ettiğiniz poli...
8,460
3,992
"""McCole package.""" __version__ = "0.1.0" __author__ = "Greg Wilson"
72
32
""" model files downloader Usage: >>> from downloader import download >>> from logging import getLogger >>> model_files_dir = '.' >>> hailo_storage = 'https://hailo-modelzoo-pub.s3.eu-west-2.amazonaws.com/' >>> model_path = 'Classification/mobilenet_v1/pretrained/mobilenet_v1_1_0_224.ckpt.zip' ...
1,757
598
# -*- coding: utf-8 -*- """ pytests for resource handlers with a single hub height """ import numpy as np import os import pytest from rex.renewable_resource import WindResource from rex import TESTDATADIR def test_single_hh(): """Test that resource with data at a single hub height will always return the dat...
3,059
1,109
# import torch # from privpack import compute_released_data_metrics, binary_bivariate_mutual_information_statistic # from privpack import hamming_distance # from privpack import binary_bivariate_mutual_information_zx, binary_bivariate_mutual_information_zy, binary_bivariate_distortion_zy # # def test_compute_released_d...
1,050
378
import boto3 def _get_client(): return boto3.client('cloudwatch') def _metric_suffix(s): return s.rsplit('.', 1)[1] def _coerce_metric(k, v): if (k.startswith('cpu.')): # We don't expose CPU metrics through Cloudwatch, as this is already collected # by the regular metrics. return ...
2,482
832
#!/usr/bin/env python from boomslang import Line, Plot from ImageComparisonTestCase import ImageComparisonTestCase import unittest class GridTest(ImageComparisonTestCase, unittest.TestCase): def __init__(self, testCaseName): super(GridTest,self).__init__(testCaseName) self.imageName = "grid.png" ...
812
275