content stringlengths 5 1.05M |
|---|
#!/usr/bin/env python3
import os
import zmq
import time
from pathlib import Path
from datetime import datetime, timezone
from common.params import Params
from cereal.messaging import SubMaster
from selfdrive.swaglog import cloudlog
from selfdrive.hardware import HARDWARE
from common.file_helpers import atomic_write_in_... |
# Copyright (c) 2013 Qumulo, 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 writing, sof... |
from django.urls import path
from .views import signupView, HomeView, BusinessProfilesView, CustomerProfilesView, EditProfileView , CategoryMenu , SearchedView , DetailPageView, DirectionsView, logoutview, Dashboard, AboutPage
from .views import Editsite, VisitsiteView, DomainView, RecomendView, NameSearchView
from Res... |
# Python > Itertools > itertools.product()
# Find the cartesian product of 2 sets.
#
# https://www.hackerrank.com/challenges/itertools-product/problem
#
from itertools import product
A = list(map(int, input().split()))
B = list(map(int, input().split()))
P = list(product(A, B))
print(" ".join(str(x) for x in P))... |
import os
from passor.config import Config, set_env, get_env
def test_get():
config = Config(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'examples', 'config.ini'))
assert config.get('test', 'dummy') == '123', 'should parse and get value from the file'
assert config.get('test', 'dummy', 'dd... |
from datetime import datetime
import random
from mercek import *
username = input("Kullanıcı adınız: ")
password = pw("Şifre: ")
bilgiler(username, password)
def kararmercigi():
login()
rutinal()
clean()
quit()
while True:
if datetime.now().minute == 20 and datetime.now().second == 0:
sle... |
#HUGHXIE
#a2q3.py
max = 0
min = 0
total = 0
count = 0
while True:
num = input("Enter a number: ")
if num.isdigit()==False:
break
try:
x = float(num)
total = total + x
count += 1
except:
print("Invalid input.")
continue
if x > max:
max = x
... |
# MIT License
#
# Copyright (c) 2020 Archis Joglekar
#
# 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, copy, modify, mer... |
import re
def find_chinese(file):
pattern = re.compile(r'[^\u4e00-\u9fa5]')
chinese = re.sub(pattern, '', file)
return chinese
def find_unchinese(file):
pattern = re.compile(r'[\u4e00-\u9fa5]')
unchinese = re.sub(pattern,"",file)
return unchinese |
#!python
# log/urls.py
from django.conf.urls import url
from . import views
# We are adding a URL called /home
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^createcontact/$', views.createcontact, name='createcontact'),
url(r'^update/(?P<pk>\d+)/$', views.update, name='update'),
url(r'^del... |
"""Unit test module for the PyRobot Object.
Will perform an instance test to make sure it creates it. Additionally,
it will test different properties and methods of the object.
"""
import unittest
import pprint
from unittest import TestCase
from datetime import datetime
from datetime import timezone
from datetime im... |
# Copyright (c) 2017-present, Facebook, 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... |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
"""Integration test of core.py.
Copyright: Ian Vermes 2019
"""
from tests.base_testcases import CommandLineTestCase
from main import core
from lxml import etree
import unittest
import os
import logging
import functools
class UserStories_CommandLine(CommandLineTestCas... |
from markdown import markdown
from functools import lru_cache
index = {
"what_is_this": """
되는건가여?
This application is 현대걸 사랑해한 번 날 보러와줄래 ㅎㅎ a starter template for building real-time web apps. It's running on a
Python [aiohttp]("http://aiohttp.readthedocs.io/") server. The above "Server Ticks"
timestamps are sen... |
# Generated by Django 3.1.7 on 2021-03-31 17:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0008_auto_20210328_2038'),
]
operations = [
migrations.CreateModel(
name='Comment',... |
from collections import OrderedDict
from pype.hosts.maya.api import (
lib,
plugin
)
class CreateReview(plugin.Creator):
"""Single baked camera"""
name = "reviewDefault"
label = "Review"
family = "review"
icon = "video-camera"
defaults = ['Main']
keepImages = False
isolate = Fa... |
from . import scraper
__all__ = [scraper]
|
def reverse(n):
s = str(n)
return s[::-1]
def is_palindrome(n):
s = str(n)
rev = reverse(s)
return rev == s
def has_six_digits(n):
s = str(n)
return len(s) == 6
def palindromes():
result = set()
for i in range(100, 1000):
for j in range(i, 1000):
p = i * j
... |
#!/usr/bin/env python3
import socket
import shutil
import psutil
import emails
import os
def check_localhost():
localhost = socket.gethostbyname('localhost')
return localhost == "127.0.0.1"
def check_disk_usage(disk):
disk_usage = shutil.disk_usage(disk)
free = disk_usage.free / disk_usage.total * 10... |
import torch
class TranslationModel():
"""
URL: https://github.com/pytorch/fairseq/blob/master/examples/translation/README.md
"""
def __init__(self, model_name, bpe):
self.model = torch.hub.load('pytorch/fairseq', \
f'transformer.{model_name}', \
tokenize... |
#!/usr/bin/env python3
from pytypecheck import tc, tc_opts
from predicates import oneof, inrange
from unittest import TestCase, main, skip
class NoConstructor:
pass
class NullaryConstructor:
def __init__(self):
pass
class UnannotatedConstructor:
def __init__(self, x):
self.x = x
class IntConstructor:
@tc
d... |
import os
import logging
import numpy as np
import pandas as pd
logger = logging.getLogger(__name__)
from supervised.utils.config import LOG_LEVEL
logger.setLevel(LOG_LEVEL)
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
MY_COLORS = list(mcolors.TABLEAU_COLORS.values())
class LearningCurves:
... |
# Importing all the required libraries and classes.
from art import logo
from art import vs
from game_data import data
import os
import random
# Using random function to generate a random selection from game_data data dictionary
# This is done for 2 selections
first_select = random.choice(data)
# a flag for while l... |
#!/usr/bin/env python3
# *-* coding: utf-8 *-*
import sys
import math
import cmath
def scalProd(c1, c2):
return c1.real*c2.real + c1.imag*c2.imag
def orth(v):
return complex(v.imag, -v.real)/abs(v)
class Points():
def __init__(self, x, y):
self.x = x
self.y = y
self.vx = 0
... |
#!/usr/bin/env python
# coding: utf-8
"""First and second problems in the Advent of Code, day 1.
Turn a number into a list of digits, check if each number matches the one N
steps ahead. Take the sum of the ones that do.
```bash
Usage: rcaptcha.py [OPTIONS] COMMAND [ARGS]...
Calculate a checksum of your input number... |
from builtins import str
from builtins import range
import test_v1
from common.connections import ContrailConnections
from tcutils.util import *
from tcutils.tcpdump_utils import *
from compute_node_test import ComputeNodeFixture
from vnc_api.vnc_api import *
from tcutils.traffic_utils.base_traffic import *
from tcutil... |
import os
import glob
import numpy as np
import json
import functools
import tifffile as tf
import asyncio
import logging
import ipywidgets as widgets
import importlib.util
import sys
import time
from ipywidgets import *
from abc import ABC, abstractmethod
def import_module_set_env(import_dict):
"""
https://... |
class Label:
labels = {}
@classmethod
def get(cls, name):
name = str(name).replace(':', '')
if name in cls.labels:
print('returning cached label {}'.format(name))
return cls.labels[name]
else:
print('creating new label {}'.format(name))
... |
def draw():
rows = int(pow(2, int(random(1, 6))))
u = int(height / (rows + 4))
thickness = int(pow(2, int(random(1, 4))))
uth1 = int(u / thickness)
uth2 = u + uth1
startX = int(-u * .75)
startY = int(height / 2 + rows / 2 * u)
endX = width + u
endY = height / 2 + rows / 2 * u
fo... |
import datetime as dt
from logging import INFO, FileHandler, Formatter, StreamHandler, getLogger
from sys import stdout
from mwr_raw2l1.utils.file_utils import abs_file_path
# define log file name and path
act_time_str = dt.datetime.now(tz=dt.timezone(dt.timedelta(0))).strftime('%Y%m%d%H%M%S')
log_file = str(abs_file... |
# -*-coding: utf-8-*-
from flask import Blueprint
from ..models import Permission
main = Blueprint('main', __name__)
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission)
from . import views, errors |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import galaxy.main.fields
import galaxy.main.mixins
class Migration(migrations.Migration):
dependencies = [
('main', '0032_role_download_count'),
]
operations = [
migrations.CreateMo... |
#!/usr/bin/env python
import argparse
import math
import random
import rospy
from std_msgs.msg import(UInt16,)
import baxter_interface
from baxter_interface import CHECK_VERSION
class CameraPosition(object):
def __init__(self):
self._limb = baxter_interface.limb.Limb("right")
self._angles = sel... |
#!/usr/bin/env python3
import smtplib
import pytest
def test_dnsbl(simta, req_dnsserver):
with pytest.raises(smtplib.SMTPConnectError) as e:
smtplib.SMTP('localhost', simta['port'])
assert e.value.smtp_code == 554
assert b'Access denied for IP 127.0.0.1: i see you' in e.value.smtp_error
def te... |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 the License, or
# (at your option) any later versio... |
__authors__ = ['Khyber Sen', 'Bayan Berri', 'Naotaka Kinoshita', 'Brian Leung']
__date__ = '2017-10-30'
from core import app
if __name__ == '__main__':
app.run()
|
#!/usr/bin/python
from os import listdir, mkdir, chown
from os.path import isdir, join
from pwd import getpwnam
import plistlib
import socket
import select
import struct
import sys
import ConfigParser
sys.path.append('/usr/local/lib/pybsdp')
import dhcp
import bsdp
from interfaces import all_interfaces
#
# Need to m... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""National Agriculture Imagery Program (NAIP) dataset."""
from .geo import RasterDataset
class NAIP(RasterDataset):
"""National Agriculture Imagery Program (NAIP) dataset.
The `National Agriculture Imagery Progra... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
rho = 5.9e-3
tau = 67.29
F0 = 0.1
gamma = 0.01
omega = 80
x = 0.6
t = 0.1
nx = 100
nt = 10000
dx = x / nx
dt = t / nt
x_domain = np.linspace(0, x, nx)
y = np.zeros((3, nx))
fn = lambda i: np.exp(-((x_domain[i] - x/2)/0.01)... |
from watson.search import SearchAdapter
class ArticleAdapter(SearchAdapter):
def get_title(self, obj):
return obj.title
def get_description(self, obj):
return obj.short_description_text
def get_content(self, obj):
return obj.content_text
|
#
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# 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, copy, modify, merge, pu... |
# -*- coding: utf-8 -*-
from typing import Optional, Dict, KeysView, ValuesView
from recc.template.lamda_template import LamdaTemplate
from recc.template.manager.lamda_template_key import LamdaTemplateKey
from recc.template.manager.lamda_template_manager import LamdaTemplateManager
class StorageTemplateManagerMixin:... |
from django.urls import path
from rest_framework_simplejwt.views import TokenRefreshView
from users.api.views import UserLoginView, RegisterView
urlpatterns = [
path('login/', UserLoginView.as_view(), name='token_obtain_pair'),
path('login/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
path... |
from flask import jsonify, url_for, request, make_response
from flask.ext.restful import reqparse, abort
from web_api.models import db
import requests
import base64
import json
#### Helper Functions ####
def abort_if_record_doesnt_exist(id, entity):
if entity is None:
abort(404, message="ID {} doesn't ... |
import json
import aws
def publish_layer(lambda_client, zip_path: str, layer_name: str) -> str:
"""Publishes a new lambda layer or new version of an existing lambda layer
Returns the arn (with version) of the created resource."""
print(f"Publishing lambda layer {layer_name}")
with open(zip_path... |
from typing import Any, Callable, Dict, Iterable, Optional, Tuple, TypeVar, Union
import copy
import inspect
import pydoc
from hydra_slayer.factory import Factory, metafactory_factory
__all__ = ["get_factory", "get_instance", "get_from_params"]
T = TypeVar("T")
DEFAULT_FACTORY_KEY = "_target_"
DEFAULT_VAR_KEY = "_v... |
from django.contrib import admin
from .models import Product
class ProductAdmin(admin.ModelAdmin):
list_display = ['name', 'price']
class Meta:
model = Product
admin.site.register(Product, ProductAdmin)
|
"""
autor: Valentina Garrido
"""
import numpy as np
from withinEps import within_eps
def color_component_int_to_float(rgb_component: int) -> float:
"""
Converts a color component from integer to float
:param rgb_component: a color component given in int range [0, 255]
:return: a color component in ... |
/home/runner/.cache/pip/pool/ce/ff/12/fc3376fa4e8ad15491df208f2d2acb7a1a18923dc8bf23b51e8f2df15e |
import copy
import yaml
class State(object):
"""State of the sneakernet (previous operation, previous host, etc.)."""
def __init__(self, path, previous_direction, previous_date, previous_host):
self.path = path
self.previous_direction = previous_direction
self.previous_date = previ... |
import cv2
import numpy as np
def is_cv2():
# if we are using OpenCV 2, then our cv2.__version__ will start
# with '2.'
return check_opencv_version("2.")
def is_cv3():
# if we are using OpenCV 3.X, then our cv2.__version__ will start
# with '3.'
return check_opencv_version("3.")
def check_ope... |
import os
from django.db import models
import base58
def gen_key():
return base58.b58encode(os.getrandom(7)).decode()
class Gnuj(models.Model):
id = models.CharField(primary_key=True, default=gen_key, max_length=10)
image = models.ImageField(upload_to='static/', blank=True)
tytul = models.TextFiel... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pathlib import Path
class DataLoader:
path = '../data/'
# function for loading data from disk
@classmethod
def load_data(self):
"""
this function is responsible for loading traing data from disk.
and p... |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from utils import plot_decision_regions
from O2 import Perceptron, prepare_data
X, Y = prepare_data()
plt.scatter(X[:50, 0], X[:50, 1],
color='red', marker='o', label='setosa')
plt.scatter(X[50:, 0], X[50:, 1],
... |
# Exercise 5
# https://learnpythonthehardway.org/book/ex5.html
name = 'Zed A. Shaw'
age = 35 # not a lie
height = 74 # inches
weight = 180 # lbs
eyes = 'Blue'
teeth = 'White'
hair = 'Brown'
print "Let's talk about %s." % name
print "He's %d inches tall." % height
print "He's %d pounds heavy." % weight
print "Actually... |
import os
import pathlib
import datetime
from .files import move
from .files import copy_file
from .files import copy_dir
# Todo: make config file for globals
DEFAULT_NAME = pathlib.Path('.spaceback')
SPACEMACS_DOT = pathlib.Path('.spacemacs')
EMACS_CONFIG = pathlib.Path('.emacs.d')
HOME = pathlib.Path(os.getenv("HOM... |
def r_sum(nested_num_list):
tot = 0
for element in nested_num_list:
if type(element) == type([]):
tot += r_sum(element)
else:
tot += element
return tot
|
# -*- coding: utf-8 -*-
"""
This is a process class whose evolve_state method is called
at each timestep.
An instance of Degradation is initialized once per Simulation
with the State as input. However, only the states 'proteins' and
'mRNAs' are modified in this process.
At each timestep, evolve_state reads in the abu... |
from django.db import models
class artists(models.Model):
song = models.CharField(primary_key = True, max_length=200)
artist = models.CharField(max_length=200)
class ratings(models.Model):
id = models.IntegerField(primary_key = True)
username = models.CharField(max_length=200)
song = models.CharFi... |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return render_template("home.html")
@app.route('/registration/')
def registration():
return render_template("registration.html")
@app.route('/adminTransRequest/')
def adminTransRequest():
return rend... |
from django.shortcuts import render, redirect
from .models import Listing
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from .choices import price_choices, listingtype_choices, state_choices
from django.shortcuts import get_object_or_404
# Create your views here.
def index(request):
listin... |
"""
Just a quick hack I wanted to try, that trains a VAE like a DCGAN, but
shares the encoder with the discriminator (discriminator is the encoder
with a small FNC on top).
EDIT:
-- I just skimmed over the paper, but this seems similar to the
ideas from "IntroVAE: Introspective Variational Autoencoders"
https://... |
class Employee:
company = "Camel"
salary = 100
location = "Delhi"
# def changeSalary(self, sal):
# self.__class__.salary = sal
@classmethod
def changeSalary(cls, sal):
cls.salary = sal
e = Employee()
print(e.salary)
e.changeSalary(455)
print(e.salary)
print(Emp... |
from django import forms
from django.forms import ModelForm
from django.utils.translation import gettext as _
from .models import Invoice, CSVInvoice
class InvoiceCreateForm(ModelForm):
def clean(self):
cd = super().clean()
if cd.get('active') and cd.get('category').startswith('P'):
s... |
# Use duecredit (duecredit.org) to provide a citation to relevant work to
# be cited. This does nothing, unless the user has duecredit installed,
# And calls this with duecredit (as in `python -m duecredit script.py`):
from .external.due import due, Doi, BibTeX
due.cite(Doi("10.3389/fninf.2011.00013"),
descr... |
# USB toggle commands for BlazeBot (cog)
import discord
from discord.ext import commands
import config
class usb(commands.Cog):
def __init__(self, client):
self.client = client
# WARNING - use these commands at your own risk!
# These commands only work on the Raspberry Pi.
@commands.command()... |
"""
Ridge filters.
Ridge filters can be used to detect continuous edges, such as vessels,
neurites, wrinkles, rivers, and other tube-like structures. The present
class of ridge filters relies on the eigenvalues of the Hessian matrix of
image intensities to detect tube-like structures where the intensity changes
perpen... |
import unittest
from pyalgs.data_structures.commons.binary_search_tree import BinarySearchTree
class BinarySearchTreeUnitTest(unittest.TestCase):
def test_binarySearchTree(self):
bst = BinarySearchTree.create()
bst.put("one", 1)
bst.put("two", 2)
bst.put("three", 3)
bst.p... |
import tensorflow as tf
import unicodedata
import numpy as np
import matplotlib as mplt
mplt.use('Agg')
import matplotlib.pyplot as plt
import os
import re
# 1.1.1.7
SOS = "GO"
EOS = "EOS"
PAD = "PAD"
# create session
session = tf.Session()
def read_and_prepare_data(number_of_sentences, output=False):
# rando... |
#!/usr/bin/env python3
from __future__ import annotations
class Solution:
def countBinarySubstrings(self, s: str) -> int:
prev, groups = "x", []
for d in s:
if d == prev:
groups[-1] += 1
else:
groups.append(1)
prev = d
... |
import unittest
import consul
from ooi_instrument_agent.lock import LockManager, Locked
prefix = 'unittest/locks'
test_locks = {
'driver_one': 'one',
'driver_two': 'two'
}
# These unit tests require a running Consul instance
class LockTest(unittest.TestCase):
def setUp(self):
self.consul = co... |
import os
from pyapacheatlas.auth import ServicePrincipalAuthentication
from pyapacheatlas.core.client import PurviewClient
from pyapacheatlas.core.typedef import EntityTypeDef
oauth = ServicePrincipalAuthentication(
tenant_id=os.environ.get("TENANT_ID", ""),
client_id=os.environ.get("CLIENT_ID", ""),
cli... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.BenefitInfo import BenefitInfo
class AlipayMpointprodBenefitDetailGetResponse(AlipayResponse):
def __init__(self):
super(AlipayMpointprodBenefitDetailGet... |
import os
from typing import cast
from typing import List
import pynvim
from tree_sitter import Language
from tree_sitter import Parser
from tree_sitter import Tree
from tree_sitter import TreeCursor
from tree_sitter import Node
@pynvim.plugin
class FindPytest:
def __init__(self, nvim: pynvim.Nvim):
self... |
"""
Copyright (c) 2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'andhadhun_final.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
import t
import x
class Ui_Andhadhun(object):
... |
"""Modelling the super class that does every action"""
from flask import jsonify
from app.order.meal import Meal
from app.order.menu import MenuItem
from app.order.order import Order
class OrderController(object):
def __init__(self):
self.sample_meal = Meal(name='rice', price=120)
self.sample_orde... |
from scrapyautodb.item import OrderedItem, Field
|
'''
https://leetcode.com/problems/k-closest-points-to-origin/
'''
class Solution:
def kClosest(self, points: List[List[int]], K: int) -> List[List[int]]:
d={}
for i in points:
curr_d=(i[0]**2 + i[1]**2)
if curr_d in d: d[curr_d].append(i)
else: d[curr_d]=[i]
... |
# -*- coding: utf-8 -*-
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
default_app_config = 'leonardo_module_kkadavy.Config'
try:
from local_settings import APPS
except ImportError:
pass
class Default(object):
if 'leonardo_module_kkadavy' in APPS:
optgro... |
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from ui import *
class UI(QtWidgets.QMainWindow, UI_MainWindow):
def __init__(self):
super(UI, self).__init__()
self.setupUI(self)
self.setWindowIcon(QtGui.QIcon("favicon.ico"))
self.setWindowTitle("OS Coursewor... |
from .local_storage import LocalStorage
from .s3_storage import S3Storage
from .storage import Storage
|
import base64
import logging
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Attachment, Disposition, FileName, FileType, Mail
from utils.standardize import Datapoint, UploadedFileSummary
def create_error_attachments(uploaded_file_summaries: list[UploadedFileSummary]):
attachm... |
from .bTrackmate import *
from .napari_animation import *
from .version import __version__
|
import json
import re
from hashlib import sha256
from .ffmpeg import FFmpegPostProcessor
from ..compat import compat_urllib_parse_urlencode, compat_HTTPError
from ..utils import PostProcessingError, network_exceptions, sanitized_Request
class SponsorBlockPP(FFmpegPostProcessor):
EXTRACTORS = {
'Youtube'... |
#!/usr/bin/env python3
# Copyright (C) 2021 Mandiant, Inc. All Rights Reserved.
"""
render-x64dbg-database.py
Translate a floss result document into an x64dbg database.
Usage:
$ floss suspicious.exe -j > floss-results.json
$ python render-x64dbg-database.py floss-results.json > database.json
# open `database.... |
import torch
import torch.nn as nn
from models.resnet import BasicBlock
import numpy as np
class View(nn.Module):
"""
Reshape data from 4 dimension to 2 dimension
"""
def forward(self, x):
assert x.dim() == 2 or x.dim() == 4, "invalid dimension of input {:d}".format(x.dim())
if x.dim... |
""" The base class for PEWPEW processing. See :doc:`usage`.
"""
from multiprocessing import Process, Queue, TimeoutError, Value
from multiprocessing.queues import Empty, Full
from abc import abstractmethod, ABCMeta
import logging
import copy
__default_exit_flag__ = Value('b', True)
__fmt__ = "%(levelname)s: %(asctim... |
import time
import pytest
import numpy as np
import flare.gp_algebra
from flare.env import AtomicEnvironment
from flare.kernels.utils import str_to_kernel_set
from flare.struc import Structure
from flare.kernels.mc_simple import (
two_plus_three_body_mc,
two_plus_three_body_mc_grad,
two_plus_three_mc_en,
... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow/core/protobuf/worker.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 imp... |
import xlsxwriter
import plot as graphs
import process_txt as txt
TIME_INTERVAL=0.5
logs=txt.Logs
# Create a workbook and add a worksheet.
workbook = xlsxwriter.Workbook('Rocket_data.xlsx')
worksheet = workbook.add_worksheet()
#Make custom formats to use
title = workbook.add_format({'bold': True,'align'... |
# coding=utf-8
# light.py
# Author: Meghan Clark
import os
from contextlib import contextmanager
from copy import copy
from typing import Callable, Tuple
from lifxlan3.base_api import LightAPI
from lifxlan3.colors import ColorPower, Color, Colors
from .device import Device
from lifxlan3.network.msgtypes import LightGe... |
import unittest
from test_models import ModelTest
from test_augmentation import AugmentationTest
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(ModelTest))
suite.addTest(unittest.makeSuite(AugmentationTest))
return suite
|
# coding: utf-8
"""
FAX.PLUS REST API
Visit https://apidoc.fax.plus for more information.
© Alohi SA (Geneva, Switzerland)
https://www.alohi.com
Contact: info@fax.plus
"""
import pprint
import re # noqa: F401
import six
from faxplus.models import *
class AccountData(object):
"""
At... |
from django.conf.urls import url, include
from django.contrib.auth import get_user_model
from drf_extra_fields.fields import Base64ImageField
from itertools import chain
from rest_framework import serializers, viewsets
from core.models import Review, Place, Category, Picture
from friends.models import Friend
from aut... |
import sys
import json
import re
import os
try:
from bs4 import BeautifulSoup as bs
import requests as rq
import grequests as grq
from argparse import ArgumentParser
except:
err = """
You haven't installed the required dependencies.
Run 'python setup.py install' to install the dependencies.
... |
"""
Contact Types Model Access
"""
import logging
from ozpcenter import models
logger = logging.getLogger('ozp-center.' + str(__name__))
def get_all_contacts():
"""
Get all contacts
Return:
[Contact]: List of Contact Objects
"""
return models.Contact.objects.all()
def get_all_contact... |
import paramiko, os, time
from UTILS.colorful import print亮紫, print亮靛
class ChainVar(object):
def __init__(self, chain_func, chained_with):
self.chain_func = chain_func
self.chained_with = chained_with
class DataCentralServer(object): # ADD_TO_CONF_SYSTEM //DO NOT remove this comment//
addr = '... |
# Copyright (c) 2017-2019 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
import httplib2
from googleapiclient import discovery
from oauth2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.