content stringlengths 5 1.05M |
|---|
from typing import List
import pyblish.api
import openpype.hosts.blender.api.action
class ValidateNoColonsInName(pyblish.api.InstancePlugin):
"""There cannot be colons in names
Object or bone names cannot include colons. Other software do not
handle colons correctly.
"""
order = openpype.api.V... |
import glob
import os
import pandas as pd
import argparse
import numpy as np
import cv2
import time
import json
from fire import Fire
from tqdm import tqdm
import random
from track_and_detect_new import Track_And_Detect
def data_process(json_file_path ='/export/home/zby/SiamFC-PyTorch/data/posetrack/annotations/val'... |
from pyomo.environ import *
def create_pf_constraints_future(M, surrogate_grid, opf_method):
assert opf_method in ['exact', 'lossless'], 'Unknown opf_method %s' % opf_method
# Ohm's Law
M.ohm_law_future_constraints = ConstraintList()
for sc_ind in range(M.n_scenarios):
for t_ind_true in M.tim... |
from enum import Enum, unique
class MultiscaleData:
"""Maintains the multiscale data for relative area and complexity"""
def set_vals_at_scale(self, scale, relative_area, complexity):
"""Assign relative area & complexity values at the given scale."""
self._scales.add(scale)
self._a... |
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import os
import glob
from sklearn.manifold import TSNE
from ..datasets.datasets_nature import NucleiDatasetWrapper, OmicDatasetWrapper
from .utils import sample_encodings
def plot_encodings(model, dataset, tsne=False, dim=3,... |
from core.advbase import *
from slot.a import *
from module.x_alt import Fs_alt
def module():
return Su_Fang
class Su_Fang(Adv):
a3 = ('s',0.35)
conf = {}
conf['slots.a'] = Twinfold_Bonds()+The_Fires_of_Hate()
conf['acl'] = """
`dragon.act("c3 s end")
`s3, not self.s3_buff
... |
__author__ = "Haim Adrian"
from matplotlib import pyplot as plt
import numpy as np
import cv2
from numbers import Number
# Gradient Descent
def myGradDescent(sensitivity=10 ** (-7)):
# Function Definition
x = np.arange(0, 100, 0.001)
fx = (np.sin(x) + 0.25 * np.abs(x - 30)) * (x - 50) ** 2
... |
from django.db import models
from django.urls import reverse
class Collection(models.Model):
description = models.TextField()
name = models.CharField(max_length=200)
photo_url = models.TextField()
def __str__(self):
return self.name
class Photo(models.Model):
collection = models.Foreign... |
from enum import Enum
from dataclasses import dataclass
class TokenType(Enum):
NUM = 0
VAR = 1
PLUS = 2
MINUS = 3
MULTIPLY = 4
DIVIDE = 5
POWER = 6
LEFT_PARENTHESES = 7
RIGHT_PARENTHESES = 8
@dataclass
class Token:
type: TokenType
value: any = None
def __repr__(self):... |
import torch
from torch.cuda.amp import autocast
import torch.distributed as dist
from functools import reduce
import basics.base_utils as _
from mlpug.trainers.training import *
from mlpug.trainers.training import TrainingManager as TrainingManagerBase
from mlpug.mlpug_exceptions import TrainerInvalidException, B... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
FileNum = int(sys.argv[1])
i = 1
File = 1
while (i<=FileNum):
try:
fr = open("Mining/"+str(i),"r")
line = fr.readline()
count = 1
content = line
while (len(line)>0):
line = fr.readline()
content = content + line
count += 1
if... |
decimals = range(0, 100)
my_range = decimals[3:40:3]
print(my_range == range(3, 40, 3))
print(range(0, 5, 2) == range(0, 6, 2))
print(list(range(0, 5, 2)))
print(list(range(0, 6, 2)))
r = range(0, 100)
print(r)
for i in r[::-2]:
print(i)
print()
for i in range(99, 0, -2):
print(i)
print()
print(range(0, 100)[... |
import tensorflow as tf
import tensorflow.contrib as tf_contrib
import numpy as np
from utils import pytorch_xavier_weight_factor, pytorch_kaiming_weight_factor
factor, mode, uniform = pytorch_kaiming_weight_factor(a=0.0, uniform=False)
weight_init = tf_contrib.layers.variance_scaling_initializer(factor=factor, mode=m... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
# Import Kratos core and apps
from KratosMultiphysics import *
from KratosMultiphysics.ShapeOptimizationApplication import *
# Additional imports
from KratosMultiphysics.KratosUnittest import TestCase
from gid_output_process import GiDOutputProcess
import mapper_factory as mapper_factory
import math
# ===============... |
is_running_migration = False
|
# Generated by Django 3.2.1 on 2021-05-20 20:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0013_user_sub'),
]
operations = [
migrations.AddField(
model_name='user',
name='deactivated',
f... |
# -*- coding: utf-8 -*-
import imagesource
import hashlib
import cv2
import tempfile
import os.path
import shutil
from nose.tools import eq_
files_template = 'tests/data/frames/%03d.jpg'
video = 'tests/data/MOV02522.MPG'
def test_files():
hashes_rgb = {}
hashes_bgr = {}
for i in range(10):
filena... |
#!/usr/bin/env python
# Author: David Stelter, Andrew Jewett
# License: MIT License (See LICENSE.md)
# Copyright (c) 2017
# All rights reserved.
import os, sys, getopt
import datetime
__version__ = '0.3.0'
#################### UNITS ####################
# Only used with --units flag
econv = 1.0 # Additional Factor... |
import numpy
import numpy as np
from Autonomous.Sensors.LIDAR import LIDAR_Interface,Utils
from threading import *
class Obstacle_Detection(Thread):
def __init__(self, lidar: LIDAR_Interface.LIDAR_Interface, min_distance: int=0, max_distance: int=5000):
self._lidar = lidar
if not self._lidar.run... |
from tests.modules.FlaskModule.API.BaseAPITest import BaseAPITest
from datetime import datetime
from websocket import create_connection
import ssl
class DeviceQueryStatusTest(BaseAPITest):
login_endpoint = '/api/device/login'
test_endpoint = '/api/device/status'
devices = []
def setUp(self):
... |
""" Contains the classes that manages Las PointRecords
Las PointRecords are represented using Numpy's structured arrays,
The PointRecord classes provide a few extra things to manage these arrays
in the context of Las point data
"""
import logging
from typing import NoReturn
import numpy as np
from . import dims
from ... |
from wingedsheep.carcassonne.objects.connection import Connection
from wingedsheep.carcassonne.objects.farmer_connection import FarmerConnection
from wingedsheep.carcassonne.objects.farmer_side import FarmerSide
from wingedsheep.carcassonne.objects.side import Side
class SideModificationUtil:
@classmethod
def... |
from __future__ import unicode_literals
from datetime import datetime, date, timedelta
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import Group
from django.cont... |
import pandas as pd
import jieba
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
def process(txt):
txt = txt.replace("\r", "").replace("\n", "")
return " ".... |
# _*_ code:utf-8 _*_
#!/usr/local/bin/python
txt = input('请输入字符串:')
# method 1
print(txt == txt[::-1])
# method 2
for i in range(int(len(txt)/2)):
if txt[i] != txt[-1-i]:
print(False)
print(True)
# method 3
txt1 = ""
for i in txt:
txt1 = i + txt1
print(txt1 == txt) |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/test_macro')
def test_macro():
return render_template('test_macro.html')
@app.route('/macro')
def macro():
return render_template('macro.html')
@app.route('/')
def index():
return 'hello'
if __name__ == "__main__":
app.... |
import pandas as pd
import numpy as np
import processSeq
import sys
import tensorflow as tf
import keras
keras.backend.image_data_format()
from keras import backend as K
from keras import regularizers
from keras.regularizers import l1, l2, l1_l2
from keras.optimizers import Adam
from keras_self_attention import SeqSe... |
# -*- coding: utf-8 -*-
import cv2
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
# Define a class to receive the characteristics of each line detection
class Lane():
def __init__(self):
# 当前的图像
self.current_warped_binary = None
# 当前图片的尺寸
self.c... |
#Crie um programa que leia nome e duas notas de vários alunos e guarde tudo em uma lista composta. No final, mostre um boletim contendo a média de cada um e permita que o usuário possa mostrar as notas de cada aluno individualmente.
aluno=[]
while True:
nome=str(input('Digite o nome do aluno: '))
nota1=float(in... |
import time
import unittest
from operator import attrgetter
from typing import Dict, List, Tuple
from locust import User
from locust.dispatch import UsersDispatcher
from locust.runners import WorkerNode
from locust.test.util import clear_all_functools_lru_cache
_TOLERANCE = 0.025
class TestRampUpUsersFromZero(unitt... |
import reg
class TypeRegistry(object):
def __init__(self):
self.types = []
self.schema_name = {}
def register_type(self, name, schema):
if name not in self.types:
self.types.append(name)
self.schema_name[schema] = name
def get_typeinfo(self, name, request):
... |
"""Views for Rider APp"""
from rest_framework.generics import ListAPIView, RetrieveAPIView, UpdateAPIView
from .serializers import ListDeliverySerializer, UpdateDeliveryStatusSerializer, RetrieveDeliverySerializer
from .models import Delivery
class ListDeliveryAPIView(ListAPIView):
"""View for listing Delivery"""
... |
from .types import Current, Voltage, PowerFactor, ActivePower, ReactivePower
from . import tools
from .core import MeterBase
class NevaMT3(MeterBase):
"""Base class for three-phase meters (Neva MT 3xx)."""
# def __init__(self, interface: str, address: str = "", password: str = "",
# initial_... |
"""
Classic task, a kind of walnut for you
Given four lists A, B, C, D of integer values,
compute how many tuples (i, j, k, l) there are
such that A[i] + B[j] + C[k] + D[l] is zero.
We guarantee, that all A, B, C, D have same length of N where 0 ≤ N ≤ 1000.
"""
from collections import Counter
from itertools import pr... |
from __future__ import absolute_import, division, print_function
from crys3d.hklview.frames import *
from crys3d.hklview import view_2d
import wx
import os
class twin_settings_window (settings_window) :
def add_value_widgets (self, sizer) :
sizer.SetRows(4)
sizer.Add(wx.StaticText(self.panel, -1, "Value 1:"... |
import os
import re
import numpy as np
def line2float(line):
data=list()
newstr=str()
data.append(newstr)
index=0
for i in line:
if((i<='9'and i>='0') or i =='.'):
data[index]+=i
elif(i ==','):
index+=1
newstr=str()
data.append(newstr)... |
"""Manage outbound ON command to a device."""
from ...topics import ON_FAST
from .. import direct_ack_handler
from .direct_command import DirectCommandHandlerBase
class OnFastCommand(DirectCommandHandlerBase):
"""Manage an outbound ON command to a device."""
def __init__(self, address, group):
"""In... |
# Vocabulary of known English words.
#
# The vocabulary is mostly based on ntlk brown corpus, but we add some words
# and exclude some words. These will likely need to be tweaked semi-frequently
# to add support for unrecognized sense descriptions.
#
# Copyright (c) 2020-2021 Tatu Ylonen. See file LICENSE and https:/... |
#!/usr/bin/env python
# coding:utf-8
import random
import os
from datetime import datetime
from PIL import Image, ImageFilter, ImageDraw, ImageFont
# 随机字母
def rndChar():
return chr(random.randint(65, 90))
# 随机颜色
def rndColor():
return (random.randint(64, 255), random.randint(64, 255), random.randint(64, 255)... |
#################################################################################
# Copyright (c) 2018-2021, Texas Instruments Incorporated - http://www.ti.com
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... |
# -*- encoding: utf-8 -*-
import os
import datetime
def parse_email_text(lines):
reading_cc_email_addresses = False
reading_to_email_addresses = False
timestamp = None
sender_email_address = ''
to_email_addresses = ''
cc_email_addresses = ''
for line in lines:
line = line.strip()
if 'Date: ' in... |
from typing import List
from collections import deque
maze = [
[1,1,1,1],
[1,0,0,1],
[1,1,0,1],
[1,0,1,1],
]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
direction_char: [str] = ['D', 'R', 'U', 'L'] # 往小走是 up,往大走是 down
def solve(board: List[List[int]]):
row = len(board)
col = len(board[0])
if ... |
import typing
import torch
class ToTensor(object):
def __init__(self,
keys: typing.Iterable = None,
dtypes: typing.Iterable[tuple] = None):
self.keys = keys
self.dtypes = dtypes
def __call__(self, **data) -> dict:
_keys = self._resolve_keys(data)
... |
import requests
url = "https://s3.amazonaws.com/download.onnx/models/opset_9/inception_v1.tar.gz"
response = requests.get(url)
with open('output', 'wb') as file:
file.write(response.content)
|
CENTRALIZED = False
EXAMPLE_PAIR = "ZRX-WETH"
USE_ETHEREUM_WALLET = True
FEE_TYPE = "FlatFee"
FEE_TOKEN = "ETH"
DEFAULT_FEES = [0, 0.00001]
|
# CELL 0
# Import necessary libraries
import matplotlib.pyplot as plt
from sklearn.datasets import load_wine
from sklearn.naive_bayes import GaussianNB
from sklearn import metrics
# CELL 1
# Load the wine dataset and split the data
dataset = load_wine()
from sklearn.model_selection import train_test_split
X_train,... |
# CamJam EduKit 3 - Robotics
# Worksheet 3 - Motor Test Code
import RPi.GPIO as GPIO # Import the GPIO Library
import time # Import the Time library
# Set the GPIO modes
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# Set the GPIO Pin mode
GPIO.setup(7, GPIO.OUT)
GPIO.setup(8, GPIO.OUT)
GPIO.setup(9, GPIO.OUT)
GP... |
print('Olá, Mundo!')
nome = str(input('Qual é o seu nome? '))
idade = int(input('Qual é a sua idade? '))
print(f'Bem vindo {nome}, fico feliz em saber que tem {idade} anos.')
|
import random
from pygame import Vector2
from blasteroids.server.game_objects import Asteroid
class AsteroidFactory:
def __init__(self, config, id_generator):
self.id_generator = id_generator
self.min_speed = config.asteroid.min_speed
self.max_speed = config.asteroid.max_speed
self... |
from sstcam_sandbox.d190730_pedestal import all_files
import argparse
from subprocess import call
from os.path import exists
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--dry', dest='dry', action="store_true")
args = parser.parse_args()
dry = args.dry
for ped_file in all_f... |
import FWCore.ParameterSet.Config as cms
hcaldigisAnalyzer = cms.EDAnalyzer("HcalDigisValidation",
outputFile = cms.untracked.string(''),
digiTag = cms.InputTag("hcalDigis"),
QIE10digiTag= cms.InputTag("hcalDigis"),
QIE11digiTag= cms.InputTag("hcalDigis"),
mode = cms.untracked.string('multi'),
... |
import os
from openbiolink.graph_creation import graphCreationConfig as glob
from openbiolink.graph_creation.metadata_edge.edgeRegularMetadata import EdgeRegularMetadata
from openbiolink.graph_creation.metadata_infile import InMetaEdgeStringInhibition
from openbiolink.graph_creation.metadata_infile.mapping.inMetaMapSt... |
from __future__ import print_function
import random
import numpy as np
import torch
import torch.utils.data as data
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from PIL import Image
_CIFAR_DATASET_DIR = './datasets/CIFAR'
_CIFAR_MEAN_PIXEL = [0.5071, 0.4867, 0.440... |
"""Test pbtranscript.collapsing.Branch."""
import unittest
import os.path as op
import cPickle
import filecmp
import numpy as np
from pbcore.io.GffIO import Gff3Record
from pbtranscript.Utils import rmpath, mkdir
from pbtranscript.io import ContigSetReaderWrapper, iter_gmap_sam, GroupWriter, CollapseGffWriter
from pbtr... |
"""
Utility to download the CIFAR-10 dataset
Author: Ioannis Kourouklides, www.kourouklides.com
License:
https://github.com/kourouklides/artificial_neural_networks/blob/master/LICENSE
"""
# %%
# IMPORTS
from __future__ import absolute_import
from __future__ import division
from __futur... |
from celery import Celery
from contentcuration.utils.celery.tasks import CeleryTask
class CeleryApp(Celery):
task_cls = CeleryTask
result_cls = 'contentcuration.utils.celery.tasks:CeleryAsyncResult'
_result_cls = None
def on_init(self):
"""
Use init call back to set our own result cl... |
"""
Use this file to write your solution for the Summer Code Jam 2020 Qualifier.
Important notes for submission:
- Do not change the names of the two classes included below. The test suite we
will use to test your submission relies on existence these two classes.
- You can leave the `ArticleField` class as-is if y... |
from __future__ import print_function
from .LEDLightSource import * |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from goodtables import validate
# Validate
def test_check_maximum_length_constraint(log):
source = [
['row', 'word'],
[2, '... |
import py
from rpython.jit.metainterp.test import test_fficall
from rpython.jit.backend.x86.test.test_basic import Jit386Mixin
class TestFfiCall(Jit386Mixin, test_fficall.FfiCallTests):
# for the individual tests see
# ====> ../../../metainterp/test/test_fficall.py
pass
|
a = int(input())
b = int(input())
c = int(input())
if a >= b and a >= c:
print(a)
if b < c:
print(b)
print(c)
else:
print(c)
print(b)
elif b > a and b > c:
print(b)
if a < c:
print(a)
print(c)
else:
print(c)
print(a)
elif c > a and ... |
"""Align target text to reference translation.
"""
import argparse
WINDOW_SIZE = 30
MAX_THRESHOLD = 0.9
MIN_THRESHOLD = 0.4
VOCAB = 'glove.840B.300d'
PROGRESS = False
DEVICE = 'cpu'
def get_parser():
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.ArgumentDefaultsH... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
from setuptools import setup, find_packages
with open('README.md') as f:
long_description = f.read()
setup(
name='efficiency',
version='0.4',
packages=find_packages(exclude=['tests*']),
license='MIT',
description='A package for efficient programming',
long_description=long_description,
... |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division
def hash_index(v, group):
"""
Hash values to store hierarchical index
:param v: index value
:param group: variables from which index was derived
:return: str
v = [1, 2]
group = ['q1', 'q2]
ret... |
XXXXXXXXX XXXXX
XXXX
XXXXXXXXX XXX XXXXXXXXXX XXXXXXXX X XXXXXXXXX XXXXXXXX XXX XXXXXX XXXXXXXXX
XXX XXXXXXXXXX XXX XXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX
XXXXXX
XXXXXX
XXXXX XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXX XXXXXXXX XXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXX... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-07-05 02:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0157_auto_20180701_1026'),
]
operations = [
migrations.AlterFiel... |
from collections import OrderedDict
import numpy as np
from robosuite_extra.env_base import SawyerEnv
from robosuite.models.arenas import TableArena
from robosuite.models.objects import BoxObject
from robosuite.utils.mjcf_utils import array_to_string
from robosuite_extra.utils import transform_utils as T
from robosuite... |
from setuptools import setup, find_packages
import versioneer
setup(
name='atmcorr',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='Atmospheric Correction using 6S',
author='Jonas Solvsteen',
author_email='josl@dhigroup.com',
packages=find_packages(),
... |
cur_dir = 1
pos_x = 0
pos_y = 0
def mv(dir, val):
global pos_x, pos_y
if dir == 0:
pos_y -= val
elif dir == 1:
pos_x += val
elif dir == 2:
pos_y += val
elif dir == 3:
pos_x -= val
while True:
try:
ln = input()
dir = ln[0]
val = int(ln[1:... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import pytest
from chalice import ConflictError, UnprocessableEntityError, ChaliceViewError
from fire_manager.application.firefighter.add_firefighter.firefighter_request_error_serializers import \
NewFirefighterErrorSerializers
from fire_manager.domain.firefighter.add_firefighter.add_firefighter_usecase import \
... |
# input
print("What's your name?")
name = input("> ")
print("Hello there " + name)
print("Give me a number")
userNumber = int(input("> "))
print(userNumber * 3) |
from systems.commands.index import Command
class Stop(Command('db.stop')):
def exec(self):
self.log_result = False
self.manager.stop_service(self, 'zimagi-postgres', self.remove)
self.success('Successfully stopped PostgreSQL database service')
|
# -*- coding:utf-8 -*-
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ annotation and
\ | | | | \ ... |
from __future__ import print_function
import numpy as np
import os
from sensor_msgs.msg import LaserScan
from navrep.tools.data_extraction import archive_to_lidar_dataset
from navrep.tools.rings import generate_rings
from navrep.models.vae2d import ConvVAE, reset_graph
DEBUG_PLOTTING = True
# Parameters for training... |
from cuser.middleware import CuserMiddleware
from django.db import models
from django.urls import reverse_lazy
from asset.utils import ASSET_TYPE_CHOICES, SHELL
from team.models import Profile
class Asset(models.Model):
name = models.CharField(unique=True, max_length=100)
serial_number = models.CharField(nul... |
#!/usr/bin/env python
import sys,os,re
consec = re.compile('([0-9,-]+) && ([0-9,-]+)')
consecv = re.compile('\(([0-9,-]+)\).+\(([0-9,-]+)\)')
from time import sleep
while 1:
handle = open(sys.argv[1],'r')
data = []
handle.seek(0)
for i in handle.readlines():
line = i.strip().split("\t")
... |
# Settings for testing with included docker-compose and pytest
from .settings import * # noqa
# Subscribe from remote selenium container to docker-compose nginx container
NGINX_PUSH_STREAM_PUB_HOST = "localhost"
NGINX_PUSH_STREAM_PUB_PORT = "9080"
# Subscribe from local TravisCI machine to docker-compose nginx cont... |
import asyncio
from pypykatz import logging
async def dcsync(url, username = None):
from aiosmb.commons.connection.url import SMBConnectionURL
from aiosmb.commons.interfaces.machine import SMBMachine
smburl = SMBConnectionURL(url)
connection = smburl.get_connection()
users = []
if username is not None:
users... |
# Copyright (c) 2018 China Telecom Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
from typing import Tuple
from TLOA.core.constants import MAX_SHIP_HEALTH
from kivy.event import EventDispatcher
from kivy.properties import BoundedNumericProperty
from kivy.uix.widget import Widget
class Entity(EventDispatcher):
id: str = ''
shape: Widget = None
def step(self, dt, game):
pass
... |
# Copyright 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 ... |
#!/usr/bin/env python
from frovedis.exrpc.server import FrovedisServer
from frovedis.mllib.tree import DecisionTreeClassifier
from frovedis.mllib.tree import DecisionTreeRegressor
import sys
import numpy as np
import pandas as pd
#Objective: Run without error
# initializing the Frovedis server
argvs = sys.argv
argc ... |
class Solution:
# @param {integer[]} nums
# @param {integer} k
# @return {integer[]}
def maxSlidingWindow(self, nums, k):
result = []
for i in range(len(nums) - k + 1):
if i >= i + k:
continue
result.append(max(nums[i:i + k]))
return result |
from aoc import AOC
aoc = AOC(year=2018, day=19)
data = aoc.load()
def addr(A, B, C, reg):
reg[C] = reg[A] + reg[B]
def addi(A, B, C, reg):
reg[C] = reg[A] + B
def mulr(A, B, C, reg):
reg[C] = reg[A] * reg[B]
def muli(A, B, C, reg):
reg[C] = reg[A] * B
def banr(A, B, C, reg):
reg[C] = re... |
import numpy as np
from numpy.testing import assert_array_equal
from util import runparams
import swe.simulation as sn
class TestSimulation(object):
@classmethod
def setup_class(cls):
""" this is run once for each class before any tests """
pass
@classmethod
def teardown_class(cls):
... |
import sys
from django.shortcuts import render
from sfdo_template_helpers.oauth2.salesforce.views import SalesforcePermissionsError
from config.settings.base import IP_RESTRICTED_MESSAGE
GENERIC_ERROR_MSG = "An internal error occurred while processing your request."
def custom_permission_denied_view(request, excep... |
#!/usr/bin/env python
""" hostlists plugin to get hosts from a range """
# Copyright (c) 2010-2013 Yahoo! 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://w... |
#!/usr/local/bin/python
'''
Read a bed file (at least 3 columns) and compute the number of chromosomes and positions covered
BEGIN COPYRIGHT NOTICE
countBedPositions code -- (c) 2017 Dimitrios Kleftogiannis -- ICR -- www.icr.ac.uk
Copyright 2017 Dimitrios Kleftogiannis Licensed under the
Educ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os
testdir = os.path.dirname(__file__)
srcdir = "../clarity"
sys.path.insert(0, os.path.abspath(os.path.join(testdir, srcdir)))
import unittest
import clarity as log
from colored import fore, style
from typing import Dict
from unittest.mock import patch
class... |
# Generated by Django 2.2.24 on 2022-01-08 14:10
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import phone_field.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... |
# Time: O(logn), where logn is the length of result strings
# Space: O(1)
# Given two integers representing the numerator and denominator of a fraction,
# return the fraction in string format.
#
# If the fractional part is repeating, enclose the repeating part in parentheses.
#
# For example,
#
# Given numerator =... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2018-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import glob
# Setting different extension allow to use this script with different
# RAW file formats
RAW_EXT = '.NEF'
JPG_EXT = '.JPG'
here = os.getcwd()
# With glob we can use wildcards for pattern matching
all_NEF = glob.glob(os.path.join(here, "*" + RAW_EXT... |
# coding=utf-8
import requests
import re, json
import math
def getStartingIndex(input_str):
m = re.finditer("http://", str(input_str))
ret = set()
for i in m:
# print(i.start())
ret.add(i.start())
return ret
def getSingleUrl(input_str, startIndex):
i = startIndex
while(input_... |
from morse_tools import Morse_Tools
morse_try1 = Morse_Tools()
result1 = morse_try1.morse_encrypt("Python Is Fun")
print(result1)
result1_decrypted = morse_try1.morse_decrypt(result1)
print(result1_decrypted)
morse_try1.play_morse(result1)
#morse_try1.show_morse_library()
|
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2021 Pincer
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.