content stringlengths 5 1.05M |
|---|
import os
import N64RET.Processor.MIPSR.Disassembler.DisasmImpl as DisasmImpl
from N64RET.Loader.N64.N64RomImpl import N64Rom
from N64RET.Generator.N64SplitConfigImpl import N64SplitConfig
from N64RET.Generator.LdScriptImpl import LdScript
def main():
romClass = N64Rom("rom.z64")
print(romClass.getRomFilename... |
"""pages_to_page
Revision ID: 543ce7d10ffa
Revises: 47727c8dffb0
Create Date: 2013-09-01 11:53:45.484926
"""
# revision identifiers, used by Alembic.
revision = '543ce7d10ffa'
down_revision = '47727c8dffb0'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'page',
... |
from django.contrib.auth import get_user_model
from django.conf import settings
from django.apps import apps as django_apps
from django.core.exceptions import ValidationError
from rest_framework import serializers
CustomUser = get_user_model()
Company = django_apps.get_model(settings.COMPANY_MODEL, require_ready=True... |
# NOTICE
#
# This software was produced for the U. S. Government under Basic Contract No. ... |
"""This is IOS XR Classic driver implementation."""
from functools import partial
import re
import logging
from condoor.drivers.generic import Driver as Generic
from condoor import TIMEOUT, EOF, ConnectionAuthenticationError, ConnectionError
from condoor.fsm import FSM
from condoor.actions import a_reload_na, a_send, ... |
from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import * # noqa
@contextmanager
def tree_project() -> Iterator[Path]:
with TemporaryDirectory() as name_dir:
dir = Path(name_dir)
(dir / "environment.yml").write_text("name: dummy\n"... |
class ConfigLoadException(Exception):
def __init__(self, section, msg):
if len(section) == 1:
section = [section[0], '(root)']
self.config_file = section[0]
self.section = section[1:]
self.message = msg
def __str__(self):
return "ConfigLoadException: Proble... |
"""
PyTest configuration file for all tests
"""
import os
import json
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from flowapp import app as _app
from flowapp import db as _db
import flowapp.models
TESTDB = 'test_project.db'
TESTDB_PATH = "/tmp/{}".format(TESTDB)
TEST_DA... |
# -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
# (c) Copyright IBM Corp. 2010, 2021. All Rights Reserved.
"""Function implementation"""
import logging
from resilient_lib import validate_fields, ResultPayload, clean_html
from resilient_circuits import ResilientComponent, function, handler... |
''' Question 16:
Use a list comprehension to square each odd number in a list. The list is input by a sequence of comma-separated numbers.
Suppose the following input is supplied to the program:
1,2,3,4,5,6,7,8,9
Then, the output should be:
1,9,25,49,81 '''
input_ = input().split(",")
new_list = [str(int(num)**2) for ... |
import arrow
import pytest
from givenergy_modbus.client import Timeslot, commands
from givenergy_modbus.model.register import HoldingRegister
from givenergy_modbus.pdu import WriteHoldingRegisterRequest
async def test_configure_charge_target():
"""Ensure we can set and disable a charge target."""
assert comm... |
from array import array
from typing import Any, Dict, Optional, Tuple
from fontTools.misc.fixedTools import MAX_F2DOT14, floatToFixedToFloat
from fontTools.misc.loggingTools import LogMixin
from fontTools.pens.pointPen import AbstractPointPen
from fontTools.misc.roundTools import otRound
from fontTools.pens.basePen imp... |
from Base.BaseType import *
from Assembler.InstructionTable import *
def plog(*args):
pass
#plog = plog
offsetlist = {}
disasmtbl = {}
class Disassembler:
class DisasmData:
Stream = None
StreamSize = None
DisasmTable = None
Bloc... |
from django.db import models
import uuid
class Category(models.Model):
id = models.UUIDField(primary_key=True, unique=True, editable=False, default=uuid.uuid4)
title = models.CharField(max_length=50)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
... |
from django.conf import settings
from posthog.redis import get_client
def reload_plugins_on_workers():
get_client().publish(settings.PLUGINS_RELOAD_PUBSUB_CHANNEL, "reload!")
|
# Configuration Import
import os
if os.getenv('PROJECT_ENV', 'dev') == 'dev':
from .config import DevelopmentConfig as Config
else:
from .config import ProductionConfig as Config
|
# -*-coding:Utf-8 -*
# Copyright (c) 2012 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# l... |
import responses
import json
from .helpers import mock_file, ClientTestCase
class TestClientQRCode(ClientTestCase):
def setUp(self):
super(TestClientQRCode, self).setUp()
self.base_url = '{}/codes'.format(self.base_url)
@responses.activate
def test_order_create(self):
init = moc... |
import actionlib
import cv2
import cv2.cv as cv
import datetime
import easygui
import numpy as np
import rospy
import smach
import threading
from actionlib import GoalStatus
from cv_bridge import CvBridge, CvBridgeError
from geometry_msgs.msg import Pose, Point, Quaternion, Twist
from sensor_msgs.msg import Image, Ca... |
import asyncio
import datetime
from contextlib import suppress
from typing import List, Optional
from aiogram import types
from aiogram.utils import exceptions
from aiogram.utils.exceptions import BadRequest, Unauthorized
from aiogram.utils.markdown import hlink, quote_html
from babel.dates import format_timedelta
fro... |
import os
from random import random
import torch
import torch.utils.data
from PIL import Image
import sys
from xml.etree import ElementTree
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
from fcos_core.structures.bounding_box import BoxList
def co... |
from typing import Callable, Dict, List, Text, Union, Optional, Mapping
from pydantic import BaseModel # pylint:disable=no-name-in-module
from petl import Record as EtlRecord
from common.utils import isnotempty
_TableInfoResultType = Dict[str, Union[
Optional[str],
List[str],
List[Optional[str]],
Li... |
"""Data Vault table."""
import logging
from abc import ABC, abstractmethod
from datetime import datetime
from functools import cached_property
from typing import Dict, List
from . import HASH_DELIMITER, METADATA_FIELDS, FieldRole, FixedPrefixLoggerAdapter
from .field import Field
from .template_sql.sql_formulas impor... |
import typing
from typing import Any, Callable, List, Optional, Sequence
import jax
import jax.nn as jnn
import jax.random as jrandom
from ..custom_types import Array
from ..module import Module, static_field
from .linear import Linear
def _identity(x):
return x
if getattr(typing, "GENERATING_DOCUMENTATION", ... |
'''
Nieve modeling of motion data, tenth second resolution
'''
import numpy as np
import tensorflow as tf
from tensorflow import keras
import time
OutsSeq = np.load('data/OutsSeq_tenth.npy')
InsSeq = np.load('data/InsSeq_tenth.npy')
#for i in range(1000):
# print(InsSeq[i, :, :])
# last value in the series
batch_s... |
# -*- coding: utf-8 -*-
"""
generator.py is a simple script that creates a sqlite database of Android
device models and its corresponding user-friendly names, e.g.:
SM-N910W8, Samsung Galaxy Note4.
This is part of AndroidDeviceNames library:
https://github.com/tslamic/AndroidDeviceNames
:copyright: (c) 2017 by Tadej... |
import asyncio
import logging
from typing import TYPE_CHECKING, List, Optional, Tuple
from rap.client.endpoint.base import BalanceEnum, BaseEndpoint, TransportGroup
from rap.common.asyncio_helper import done_future
from rap.common.coordinator.consul import ConsulClient
logger: logging.Logger = logging.getLogger(__nam... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 10 14:13:30 2018
Version: 1.0
DESCRIPTION:
it takes an MCNP input and downgrades from FENDL3.1 to FENDL2.1 libraries
NOTES:
- All comments in material section are removed
- Zaids that are not in FENDL2.1 library are commented out
EXECUTION:
to... |
import argparse
import kenshi
ITEM_MISSING = '--'
ITEM_ADDED = '++'
ITEM_CHANGED = '<>'
def recursive_diff(dict_a, dict_b, path=None):
for key_a in dict_a:
value_a = dict_a[key_a]
value_path = "[%s (%s)]" % (value_a["name"], value_a["type"]) if \
not path else path + "->%s... |
#!/usr/bin/env
"""
CTD2NCheader.py
When run independantly, this program will allow the creation of a header text file for
all ctd casts in a directory. It relys mostly on the ship logs and not on the meta information
within the ctd files.
Using Anaconda packaged Python
"""
import os, datetime
#user defined
... |
#
# Copyright (c) 2020 Lucas Lehnert <lucas_lehnert@brown.edu>
#
# This source code is licensed under an MIT license found in the LICENSE file in the root directory of this project.
#
from abc import abstractmethod
import numpy as np
import rlutils as rl
from sklearn.cluster import AgglomerativeClustering
from .utils... |
# coding:utf-8
"""
pybilibili.network
----------------------
所有爬虫函数
:copyright: (c) 2016 Shi Shushun
:license: BSD
"""
from bs4 import BeautifulSoup
from colorama import Fore, Style
import dicts
import json
import urllib
import requests
import time
import re
import os
import m... |
"""Add docstring."""
import pandas as pd
from electricitylci.model_config import model_specs
def map_heat_inputs_to_fuel_names(generation_df):
"""Add docstring."""
fuel_info_tech_flows = model_specs.fuel_name[model_specs.fuel_name["ElementaryFlowInput"]==0]
fuel_info_tech_flows = fuel_info_tech_flows.ren... |
#!/usr/bin/env python
#
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0
#
# or in th... |
for i in range(0, 3):
n = int(input("请输入非负整数n:"))
if(n >= 0):
break
else:
continue
if(n == 0):
total = 1
if(n > 0):
total = 1
for i in range(n, 0, -1):
total *= i
print("for循环: {0}! = {1}".format(n, total))
# while循环
n1 = n
if(n == 0):
total = 1
if(n > 0):
total =... |
import json
settings_file = open('settings.json')
settings = json.load(settings_file)
settings_file.close() |
# See https://docs.djangoproject.com/en/1.7/ref/applications/
# Do not import any models here.
from django.apps import AppConfig
class JASSAppConfig(AppConfig):
name = 'project.jass'
verbose_name = "JASS"
|
from .impl import run_nn_cluster
from .io import load_nn_model
|
gettext = lambda s: s
INTERNAL_IPS = ('127.0.0.1',)
TIME_ZONE = 'Europe/Vienna'
LANGUAGE_CODE = 'en-us'
LANGUAGES = (
('de', gettext('German')),
('en', gettext('English')),
)
ROOT_URLCONF = 'lfluxproject.urls'
# from http://morethanseven.net/2009/02/11/django-settings-tip-setting-relative-paths.html
import os... |
import json
from collections import OrderedDict
# config save
def dump_config(config_name: str, config: OrderedDict):
with open(config_name, 'w') as f:
json.dump(config, f, ensure_ascii=False, indent=4) |
""" machine: memory, parallelism, etc.
"""
from . import template_keys
def fillvalue_dictionary(comment, memory, machine_options):
""" get the template fill values for job directives
"""
fill_dct = {
template_keys.COMMENT: comment,
template_keys.MEMORY: memory,
template_keys.MACHIN... |
'''
Created on Oct 2, 2015
@author: nyga
'''
import email
import json
import pickle
from collections import defaultdict
from hashlib import md5
import mimetypes
import os
import traceback
import urllib.request, urllib.parse, urllib.error
import dnutils
from datetime import datetime
from pyrap.utils import parse_dat... |
import os.path
import logging
import warnings
import contextlib
from dictknife import loading
from dictknife.cliutils import traceback_shortly
from magicalimport import import_symbol
logger = logging.getLogger(__name__)
def tojsonschema(*, src, dst, name):
# todo: id
d = loading.loadfile(src)
root = d["d... |
#
# PySNMP MIB module CISCO-FRAME-RELAY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FRAME-RELAY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:36:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
from typing import Optional, Union
from uuid import UUID
UUIDType = Union[UUID, str]
def get_uuid(value: UUIDType) -> UUID:
if isinstance(value, UUID):
return value
return UUID(value)
def map_optional_uuid(value: Optional[UUIDType]) -> Optional[UUID]:
return get_uuid(value) if value else None
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import ot
def wasserstein_point1_fast(data1, data2, i, j, a, b, xs, xt):
"""
Computes the 1-pt Wasserstein distance for a single point in the spatain domain
"""
N = data1.shape[0]
xs[:] = (data1[i,j,:]).reshape((N,1))
... |
# coding: utf8
'''
大家知道,Microsoft的Excel的列编号是字符编号:
a, b, c, ... z, aa, ab, ac ... az, ba...zz, aaa, aab, aac..等,
而其对应的数字编号是1, 2, 3...26, 27, 28, 29 ....
请实现转换算法,输入字符编号,输出数字编号。
Created on 2016年9月7日
@author: hust
'''
#
#
#
def ProcessStr(mystr):
def StrtoNum(ones):
if ones < ... |
""" Each encoder should have following attributes and methods and be inherited from `_base.EncoderMixin`
Attributes:
_out_channels (list of int): specify number of channels for each encoder feature tensor
_depth (int): specify number of stages in decoder (in other words number of downsampling operations)
... |
"""
Author(s):
Miguel Alex Cantu (miguel.can2@gmail.com)
Date: 07/20/2020
Description:
This action will return a dictionary of all the applications in our tenant
"""
from azure_utility_tool.graph_endpoints import LIST_APPLICATIONS
from azure_utility_tool.test_cases import TestCases
from azure_utility_tool.utils... |
import json
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as mplpatches
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from sklearn.linear_model import LinearRegression
import argparse
#Plot speed, memory, and runtime
#Input file is must be formatted:
#graph algorithm read... |
from lenstronomy.PointSource.point_source_cached import PointSourceCached
from lenstronomy.PointSource.Types.unlensed import Unlensed
import numpy.testing as npt
import pytest
class TestPointSourceCached(object):
def setup(self):
self.ps_cached = PointSourceCached(Unlensed(), save_cache=True)
sel... |
# Copyright 2020 Chen Bainian
# Licensed under the Apache License, Version 2.0
__version__ = '0.2.2'
|
#
#
# 0=================================0
# | Kernel Point Convolutions |
# 0=================================0
#
#
# ----------------------------------------------------------------------------------------------------------------------
#
# Callable script to start a training on ModelNet40 dat... |
from json.decoder import JSONDecodeError
from aiohttp import web
async def handler(request: web.Request) -> web.Response:
headers = dict(request.headers) or None
query = dict(request.query) or None
body = await request.text() or None
post = dict(await request.post()) or None
try:
json =... |
'''
Copyright (c) 2021, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
'''
import torch
# from transformers import Trainer, TrainingArguments
from transformers_custom import T5F... |
import neuron
import numpy
class ScalarField:
"""
A scalar field.
"""
def __init__(self, xlo, xhi, ylo, yhi, zlo, zhi, dx, dtype=None):
"""
Parameters
----------
xlo : double
Minimum x value.
xhi : double
Maximum x value.
ylo ... |
# flake8: noqa
# Set version ----
from importlib_metadata import version as _v
__version__ = _v("pins")
del _v
# Imports ----
from .cache import cache_prune, cache_info
from .constructors import (
board_deparse,
board_folder,
board_temp,
board_local,
board_github,
board_urls,
board_rsco... |
from unittest import TestCase
class ExamplesSmokeTestCase(TestCase):
"""
These are just basic tests that run each example
to make sure no errors are triggered.
"""
def test_basic_example(self):
from examples import basic_example # NOQA
def test_convert_units(self):
from examp... |
# Generated by Django 3.1.5 on 2021-01-17 20:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('customers', '0002_cart'),
]
operations = [
migrations.RenameField(
model_name='cart',
old_name='cusID',
new_name... |
def get_tree_max_id(value, list_id=[]):
"""
得到最大Tree max id
"""
if not value:
return 0 # the first node id
if isinstance(value, list):
for content in value: # content -> dict
try:
children = content['children']
except KeyError:
... |
"""
This module implements the HtmlResponse class which adds encoding
discovering through HTML encoding declarations to the TextResponse class.
See documentation in docs/topics/request-response.rst
"""
from ants.http.response.text import TextResponse
class HtmlResponse(TextResponse):
pass
|
'''
Author: Badri Adhikari, University of Missouri-St. Louis, 1-26-2020
File: Contains the metrics to evaluate predicted real-valued distances, binned-distances and contact maps
'''
import numpy as np
import tensorflow as tf
epsilon = tf.keras.backend.epsilon()
from dataio import *
from plots import *
from generator ... |
# Tasks
# 1. Review all necessary materials for getting started
# 2. Create your project (including setting up your GitHub repository for source control)
# 3. Create all of the classes for the project based off of the UML
# 4. Starting with the smallest class, write the methods for your classes.
# 5. Work through ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 6 14:10:12 2018
@author: alex
"""
import parser, pickle, difflib, nltk, json, queue, re
from webcrawlAll import crawlerWrapper, setDriver
from PCATParser import *
import Site_Crawler_Parser_All
from knowledge_management.WebResourceManager import *
from knowledge_manageme... |
#electricity meter
import tkinter as tk
from tkcalendar import Calendar
import datetime
window = tk.Tk()
window.title('Electricity Calculator')
window.geometry('350x370')
window.resizable(0,0)
units = []
frame = tk.Frame(window)
frame.pack(side = "right", fill='y')
scroll_bar = tk.Scrollbar(frame, orien... |
from bokeh.layouts import layout
from bokeh.models import CustomJS, ColumnDataSource, Slider
from bokeh.plotting import Figure, output_file
from sdq.util import interact_plot_grid
output_file("js_on_change.html")
x = [x*0.005 for x in range(0, 200)]
y = x
source = ColumnDataSource(data=dict(x=x, y=y))
plot = Figur... |
def bumps(road: str) -> str:
bumps = sum(c == "n" for c in road)
return "Woohoo!" if bumps <= 15 else "Car Dead" |
import tkinter as tk
import subprocess
import sys
import os
from ..settings import *
class Popup:
def __init__(self, msg, *args, **kwargs):
self.msg = msg
self.win = tk.Toplevel()
self.config()
self.create_widgets()
def config(self):
self.win.resizable(False, False)
... |
import os
from genome_collector import GenomeCollection
PHAGE_TAXID = "697289"
def test_get_bowtie_index(tmpdir):
collection = GenomeCollection(data_dir=str(tmpdir))
path = collection.get_taxid_bowtie_index_path(PHAGE_TAXID, version="2")
assert os.path.exists(path + '.1.bt2') |
##!/usr/bin/python
import numpy as np
import pylab as pl
#with open("traj.dat") as f:
# data = f.read()
#
# data = data.split('\n')
#
# x = [row.split(' ')[0] for row in data]
# y = [row.split(' ')[1] for row in data]
#
# fig = plt.figure()
#
# ax1 = fig.add_subplot(111)
#
# ax1.set_title("Plot t... |
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import defaultdict
# Complete the sherlockAndAagrams function below.
def get_substrings(string):
l = len(string)
dict = defaultdict(int)
for i in range(l):
for j in range(i+1,l+1):
# Get normalised... |
input = """
a(a).
b(1).
b(2).
cap(1).
all(X,Y) v nall(X,Y) :- a(X), b(Y).
:- #count{Y:all(a,Y)} > C, cap(C).
%:- #count{Y:all(a,Y)} < C, cap(C).
"""
output = """
{a(a), all(a,1), b(1), b(2), cap(1), nall(a,2)}
{a(a), all(a,2), b(1), b(2), cap(1), nall(a,1)}
{a(a), b(1), b(2), cap(1), nall(a,1), nall(a,2)}
"""
|
#!/usr/bin/env python
import rospy
import cv2 as cv
import numpy as np
import pandas as pd
import seaborn as sb
from matplotlib import pyplot as plt
from random import random, seed
from random import random
from std_msgs.msg import String
import time
pub_gas = rospy.Publisher('/gas_data', String, queue_size=10)
rospy... |
# This file contains the functions for the data access and cycle count models for the Layers executed on the SIMD Array
import logging
import math
import numpy as np
from data_objects import HardwareObject, SAResult_Inflayer, SIMDResult_Inflayer
from layer_object import LayerObject
#Current Quantization Assumption: f... |
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. #
# All rights reserved. #
# This file is part of the Masci-tools package. ... |
import collections
import statistics
import sklearn.metrics as sm
import numpy as np
from abc import ABC, abstractmethod
from .prediction_filters import TopKPredictionFilter, ThresholdPredictionFilter
from functools import reduce
def _targets_to_mat(targets, n_class):
if len(targets.shape) == 1:
target_ma... |
import os
import math
import numpy as np
import pandas as pd
import time
import scipy.special
import scipy.stats as st
from multiprocessing import Pool
from bokeh.layouts import row, column
from bokeh.models import CustomJS, Slider, Band, Spinner
from bokeh.plotting import figure, curdoc, ColumnDataSource
from boke... |
# the program reads from measles.txt
# project 02 a
# KAKEMBO ISMAIL ABDUL WADUDU 2020/BSE/115/PS
# MASIKA PEACE KEITH 2020/BSE/033/PS
# AKAMPURIRA GODSON 2020/BSE/005/PS
# NIYONSHUTI NOBERT 2020/BSE/056/PS
try:
fileHandle = open('measles.txt')
print(fileHandle)
lowest = None
highest = None
for... |
'''
pandas box plots
While pandas can plot multiple columns of data in a single figure, making plots that share the same x and y axes, there are cases where two columns cannot be plotted together because their units do not match. The .plot() method can generate subplots for each column being plotted. Here, each plot w... |
from torch import nn
import torch.nn.functional as F
from .conv import Conv1d, Conv2d
from .linear import FC
class MLP(nn.ModuleList):
def __init__(self,
in_channels,
mlp_channels,
dropout_prob=0.0,
bn=True,
bn_momentum=0.1):
... |
import pydeck
import pandas as pd
import numpy as np
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs
# Specify the name of your library, see index.js in the js/ directory
pydeck.settings.custom_libraries = [
{
"libraryName": "LODTextLayerLibrary",
"resourceUri": "https://... |
# @l2g 237 python3
# [237] Delete Node in a Linked List
# Difficulty: Easy
# https://leetcode.com/problems/delete-node-in-a-linked-list
#
# Write a function to delete a node in a singly-linked list.
# You will not be given access to the head of the list,
# instead you will be given access to the node to be deleted dire... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import logging
import binascii
from twisted.trial import unittest
from twisted.internet import defer, task
from lbrynet.dht import constants
from lbrynet.dht.node import Node
from .mock_transport import resolve, listenUDP, MOCK_DHT_SEED_DNS, mock_node_generator
log = logging.getLogger(__name__)
class TestKademliaB... |
from datasets.__local__ import implemented_datasets
from datasets.mnist import MNIST_DataLoader
from datasets.cifar10 import CIFAR_10_DataLoader
from datasets.bedroom import Bedroom_DataLoader
from datasets.toy import ToySeq_DataLoader
from datasets.normal import Normal_DataLoader
from datasets.adult import Adult_DataL... |
import re
RE_EMAIL_VALIDATOR = re.compile(r'^[A-Za.z0-9_-]+@([a-z0-9._-]+\.)+[a-z]+$')
def email_is_valid(email):
return RE_EMAIL_VALIDATOR.match(email)
assert email_is_valid('ivan@kss45.kpk.ru')
assert not email_is_valid('ivan@kss45')
assert not email_is_valid('ivan@kss45.') |
from json import dumps
import pandas as pd
# global variables
filepath = '../profanity_word_phrase_filter/full_text.txt'
transcriptions = {'images': []}
flagged_list = []
def readFile(filepath):
"""
:param filepath: inputs the text file of interest.
:returns: a string of words
This function opens th... |
from transformers import ViTModel
|
import pytesseract
from PIL import Image
def getText(path):
text = pytesseract.image_to_string(
Image.open(path),
config="-c tessedit_char_whitelist=0123456789abcdefghijklmnopqrstuvwxyz"
)
return text
if __name__ == "__main__":
path = "1627320525.png"
print('Resolving Captcha')
... |
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import logging
import ntpath
import os
import posixpath
from typing import Dict, List, Optional
from uuid import UUID
from onefuzztypes.enums import Compare, ContainerPermission, ContainerType, TaskFeature
from onefuzztyp... |
'''
Created on Sep 29, 2018
@author: Rajdeep Roy Chowdhury
Licensed Under MIT
'''
import tkinter
from tkinter import messagebox
from core import services
class Register:
def __init__(self,master):
# Styling constants declaration starts here
BG="light coral"
FONT=('Comic Sans MS',13)
... |
# Generated by Django 2.2.6 on 2019-10-04 18:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0005_auto_20191004_2349'),
]
operations = [
migrations.RenameField(
model_name='contenttext',
old_name='titl... |
print("main has started")
import pca9865
|
"""
DeepSEA architecture (Zhou & Troyanskaya, 2015).
"""
import numpy as np
import torch
import torch.nn as nn
class DeepSEA(nn.Module):
def __init__(self, sequence_length, n_genomic_features):
"""
Parameters
----------
sequence_length : int
n_genomic_features : int
... |
# -*- coding: utf-8 -*-
import re
import operator
def logical_equivalence(*c):
nonzero_c1 = (c[0] != 0)
nonzero_c2 = (c[1] != 0)
return ((nonzero_c1 & nonzero_c2) | (~nonzero_c1 & ~nonzero_c2))
# implication
def logical_implication(*c):
nonzero_c1 = (c[0] != 0)
nonzero_c2 = (c[1] != 0)
ret... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
from __future__ import absolute_import
from sentry.api.bases.organization import (
OrganizationEndpoint, OrganizationIntegrationsPermission
)
from sentry.api.paginator import OffsetPaginator
from sentry.api.serializers import serialize
from sentry.models import OrganizationIntegration
class OrganizationIntegrati... |
from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import ValidationError
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.urls import reverse
from taggit.managers import TaggableManager
from dcim.choices import *
f... |
from setuptools import find_packages
from setuptools import setup
name = "pyMHT-simulator"
author = "Erik Liland"
author_email = "erik.liland@gmail.com"
description = "A framework for testing pyMHT"
license = "BSD"
keywords = 'simulation'
url = 'http://autosea.github.io/sf/2016/04/15/radar_ais/'
install_requires = ['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 u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.