text stringlengths 2 999k |
|---|
# Copyright 2016 Eotvos Lorand University, Budapest, Hungary
#
# 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 appli... |
#
# Test suite for the textwrap module.
#
# Original tests written by Greg Ward <gward@python.net>.
# Converted to PyUnit by Peter Hansen <peter@engcorp.com>.
# Currently maintained by Greg Ward.
#
# $Id$
#
import unittest
from test import support
from typing import Any, List, Sequence
from textwrap import TextWrapp... |
class Pessoa():
olhos = 2 #Criando atributo de class
def __init__(self, *filhos, nome = None, idade=35):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá {id(self)}'
if __name__ == '__main__':
joaozinho = Pessoa(nome='J... |
# SPDX-FileCopyrightText: Tony DiCola 2017 for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_is31fl3731.charlie_wing`
====================================================
CircuitPython driver for the IS31FL3731 charlieplex IC.
* Author(s): Tony DiCola, Melissa LeBlanc-Williams
Implementation N... |
import simplejson #as json # no jython: import json
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestCont... |
import struct
from types import StringType
class _BUILDER:
'''Virtual base helper class for structured file scanning'''
def _get_struct_fmt(self,info):
fmt = '<'
for f, _, _ in info:
fmt += f
return fmt
def _scan_from_file(self,f,info):
fmt = self._get_struct_fmt(info)
size = struct.calcsize(fmt)
T =... |
import numpy as np
from ..utils.constants import *
from ..utils.vector3 import vec3
from abc import abstractmethod
class Collider:
def __init__(self,assigned_primitive, center):
self.assigned_primitive = assigned_primitive
self.center = center
@abstractmethod
def intersect(... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyGpustat(PythonPackage):
"""An utility to monitor NVIDIA GPU status and usage."""
homepage = "https://git... |
"""
SSVEP MAMEM1 dataset.
"""
import glob
import logging
import os
import numpy as np
from mne import create_info
from mne.channels import make_standard_montage
from mne.datasets.utils import _get_path
from mne.io import RawArray
from .base import BaseDataset
try:
import wfdb
except ImportError:
raise Impo... |
from zoom import __version__
from zoom.mvc import View
from zoom.page import page
from zoom.tools import load_content
from zoom.browse import browse
import zoom.fields as f
from zoom.validators import required
import widgets
my_form = f.Fields(
f.Section('Personal', [
f.TextField('Name', required, size=... |
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... |
from cs231n.layers import *
from cs231n.fast_layers import *
def affine_relu_forward(x, w, b):
"""
Convenience layer that perorms an affine transform followed by a ReLU
Inputs:
- x: Input to the affine layer
- w, b: Weights for the affine layer
Returns a tuple of:
- out: Output from the ReLU
- cache... |
"""Common stuff for AVM Fritz!Box tests."""
from homeassistant.components import ssdp
from homeassistant.components.fritz.const import DOMAIN
from homeassistant.components.ssdp import ATTR_UPNP_FRIENDLY_NAME, ATTR_UPNP_UDN
from homeassistant.const import (
CONF_DEVICES,
CONF_HOST,
CONF_PASSWORD,
CONF_PO... |
"""recur_cnn.py
Recurrent CNN models.
"""
import torch
import torch.nn as nn
class RecurCNN(nn.Module):
def __init__(self, num_outputs, width, depth, in_channels):
super().__init__()
self.num_outputs = num_outputs
self.width = width
self.iters = depth - 3
self.first_layers ... |
# Time: O(nlogn)
# Space: O(n)
class BIT(object): # 0-indexed
def __init__(self, n):
self.__bit = [0]*(n+1)
def add(self, i, val):
i += 1
while i < len(self.__bit):
self.__bit[i] += val
i += (i & -i)
def query(self, i):
i += 1
ret = 0
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the getchaintips RPC.
- introduce a network split
- work on chains of different lengths
- join th... |
# Generated by Django 2.0.1 on 2018-01-23 22:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('country', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='R... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
#from builtins import *
import sys
import subprocess
import socket
import os
import errno
import re
import paramiko
__author__ = "Jakobus Schuerz <jakobus.schuerz@gmail.com>"
__version__ = "0.04.0"
# Useful for very coarse ... |
from inspect import getattr_static
from pydantic import BaseModel, validator
from pydantic.main import Extra
from typing import ClassVar, Dict, List, Optional, Any, Set, Type
from specklepy.transports.memory import MemoryTransport
from specklepy.logging.exceptions import SpeckleException
from specklepy.objects.units im... |
import joblib
import os
import streamlit as st
# EDA Pkgs
# ML Pkgs
# Viz Pkgs
# loading in the model to predict on the data
classifier = joblib.load('Thermal_Coefficent_Model.pkl')
def predict(C, Cr, Mn, Si, V, Mo, Temperature):
N = classifier.predict([[float(C)/100, float(Cr)/100, float(Mn)/100, float(S... |
"""Provides the UltraSync DataUpdateCoordinator."""
from datetime import timedelta
import logging
from async_timeout import timeout
import ultrasync
from homeassistant.const import CONF_HOST, CONF_PIN, CONF_SCAN_INTERVAL, CONF_USERNAME
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassist... |
from dataclasses import dataclass, field, replace
from functools import reduce
from typing import Generic, Text, Union
from .matchers import Matcher, Out, Tok
@dataclass(frozen=True)
class Node(Generic[Tok, Out]):
"""
Root class for a node. It has no real usage by itself but that's useful to
define opera... |
# Copyright 2017 The Forseti Security 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 ap... |
import json
dialog_train = list()
with open('dialog_dataset/dialogues_train.txt', 'r', encoding='utf-8') as f:
for line in f:
tmp_sentences = line.split('__eou__')[:-1]
sentence_number = len(tmp_sentences)
for i in range(len(tmp_sentences)-1):
tmp_pair = dict()
tmp_... |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from .mininode import *
from .blockstore import BlockStore, TxStore
from .util import p2p_port
'''
This is a tool for comparing two or more clintoncas... |
class MessageId:
"""The CAN MessageId of an PDU.
The MessageId consists of three parts:
* Priority
* Parameter Group Number
* Source Address
"""
def __init__(self, **kwargs): #priority=0, parameter_group_number=0, source_address=0):
"""
:param priority:
3... |
from ixnetwork_restpy.base import Base
from ixnetwork_restpy.files import Files
class ISCSIDataIn(Base):
__slots__ = ()
_SDM_NAME = 'iSCSI_Data_In'
_SDM_ATT_MAP = {
'HeaderOpcode': 'iSCSI_Data_In.header.Opcode-1',
'HeaderFlags': 'iSCSI_Data_In.header.Flags-2',
'HeaderTotalAHSLength... |
from models.kitti.frustum.box_estimation.pointnet import BoxEstimationPointNet
from models.kitti.frustum.box_estimation.pointnetpp import BoxEstimationPointNet2
|
#!/usr/bin/env python
import os
import string
import sys
from argparse import ArgumentParser
try:
import pip
except ImportError:
pip = None # type: ignore
CONFIGURE_URL = "https://docs.galaxyproject.org/en/master/admin/"
DESCRIPTION = "Initialize a directory with a minimal Galaxy config."
HELP_CONFIG_DIR ... |
import tensorflow as tf
import os
import numpy as np
from matplotlib import pyplot as plt
from tensorflow.keras.layers import Conv2D, BatchNormalization, Activation, MaxPool2D, Dropout, Flatten, Dense
from tensorflow.keras import Model
np.set_printoptions(threshold=np.inf)
cifar10 = tf.keras.datasets.cifar10
(x_train... |
"""
Q739
daily temperatures
medium
Given a list of daily temperatures T, return a list such that,
for each day in the input, tells you how many days you would
have to wait until a warmer temperature. If there is no future
day for which this is possible, put 0 instead.
For example, given the list of temperatures T = [... |
########################################################
# Copyright (c) 2015-2017 by European Commission. #
# All Rights Reserved. #
########################################################
extends("BaseKPI.py")
"""
Production costs (euro)
------------------------
Indexed by
* ... |
#! /usr/bin/env python3
# -*- coding:utf-8 -*-
###############################################################
# kenwaldek MIT-license
#
# Title: subprocces test Version:
# Date: Language: python3
# Description:
#
############################################... |
from datetime import datetime
from django.db import models
from django.urls import reverse
from django_comments_tree.moderation import moderator, TreeCommentModerator
class PublicManager(models.Manager):
"""Returns published articles that are not in the future."""
def published(self):
return self.g... |
import smtplib
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
# Constantes
COMA_SPACE = ", "
MAIL_FROM = "pruebasc121@gmail.com" # Direccion de correo de uso
MAIL_TO = "nacxit.developer@gmail.com" # Direccion correo destino
MAIL_SENDER = "smtp.gmail.com:587"
PASSWORD = "password... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
__version__ = "0.21.2"
|
#!/usr/bin/env python
if __name__=="__main__":
sum = 0
for i in xrange(1,1000):
if i % 3 == 0 or i % 5 == 0:
sum += i
print sum |
import catboost
import filecmp
import json
import numpy as np
import os
import pytest
import re
import yatest.common
from catboost_pytest_lib import (
append_params_to_cmdline,
apply_catboost,
compare_evals_with_precision,
compare_fit_evals_with_precision,
compare_metrics_with_diff,
data_file,
... |
#
# Tests the Units class bindings
#
import unittest
class UnitsTestCase(unittest.TestCase):
def test_create_destroy(self):
from libcellml import Units
x = Units()
del x
y = Units("mine")
self.assertEqual("mine", y.name())
del y
def test_inheritance(self):
... |
"""
Provides helping function for handling reputation.
"""
import logging
from enum import Enum
from typing import Optional
import arrow
from dbas.database import DBDiscussionSession
from dbas.database.discussion_model import User, ReputationHistory, ReputationReason, sql_timestamp_pretty_print
from dbas.lib import n... |
import pydicom
import numpy as np
from random import randrange
from skimage.measure import label, find_contours
import SimpleITK as sitk
class ROIContourSequence :
"""a class to represente ROIContourSequence in RTSTRUCT file
"""
def __init__(self, mask_array:np.ndarray, mask_img:sitk.Image, number_of_r... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
import dhl_delivery.quote
import dhl_delivery.pickup
import dhl_delivery.shipment
dhl_site_id = ''
dhl_site_password = ''
dhl_account_no = ''
dhl_response_flag = False
dhl_xml_flag = False
dhl_delivery_label_path = ''
dhl_delivery.dhl_site_id = dhl_site_id
dhl_delivery.dhl_site_password = dhl_site_password
dhl_deliv... |
from blobmodel import Model, BlobFactory, Blob, show_model
import numpy as np
# create custom class that inherits from BlobFactory
# here you can define your custom parameter distributions
class CustomBlobFactory(BlobFactory):
def __init__(self) -> None:
pass
def sample_blobs(
self, Ly: float,... |
import random
from tombola import Tombola
class BingoCage(Tombola): # <1>
def __init__(self, items):
self._balls = list(items) # <2>
def load(self, items):
self._balls.extend(items)
def pick(self):
try:
position = random.randrange(len(self._balls)) # <3>
... |
import os, json, cv2
from scipy.spatial.transform import Rotation
import scipy.ndimage
import numpy as np
def load_params_from_json(json_path):
with open(json_path, 'r') as f:
return json.load(f)
def load_scene(file_path):
with open(os.path.join(file_path, 'scene_gt.json')) as fid:
sce... |
"""Backwards compat aliases for rules_proto_grpc Node.js rules."""
load("//js:defs.bzl", "js_grpc_node_compile", "js_grpc_node_library", "js_proto_compile", "js_proto_library")
def nodejs_proto_compile(**kwargs):
print("Rule nodejs_proto_compile from @rules_proto_grpc//nodejs:defs.bzl has been deprecated, please ... |
# Copyright (c) 2017 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import math
import os
import numpy as np
import numpy.testing as npt
import scipy.io.wavfile as wave
import tensorflow as tf
from six.moves import range
from .speech_utils ... |
'''
El set se usa para usar valores únicos.
'''
# Demonstrate how to use set comprehensions
def main():
# define a list of temperature data points
ctemps = [5, 10, 12, 14, 10, 23, 41, 30, 12, 24, 12, 18, 29]
# build a set of unique Fahrenheit temperatures
ftemps1 = [(t * 9/5) + 32 for t in ctemp... |
"""
This module manages the creation of the output image FITS file.
:Authors: Warren Hack
:License: :doc:`LICENSE`
"""
from astropy.io import fits
from stsci.tools import fileutil, logutil
from . import wcs_functions
from . import version
from . import updatehdr
from fitsblender import blendheaders
yes = True
no ... |
# encoding: utf-8
import os
from types import FunctionType
import logging
import json
import re
import datetime
import csv, chardet, StringIO
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.shortcuts impor... |
from astropy.io import fits as pyfits
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from mpl_toolkits.axes_grid1.axes_grid import AxesGrid
#from pywcsgrid2.axes_wcs import GridHelperWcs, AxesWcs
import pywcsgrid2
# read in the first image
xray_name="pspc_skyview.fits"
f_xray = pyfits.open(xray_name)
head... |
#!/usr/bin/env python
"""
Copyright 2019, The Regents of the University of California.
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 copyrig... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from openpyxl import utils
import pandas as pd
import os
"""
# Purpose
Convert source variable contained in str variable to destination variable.
"""
def util_replace(text, source, destination):
# if text has source
if text.find(source) > 0:
... |
"""meiduo_mall URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... |
"""Support for Melissa Climate A/C."""
import logging
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
STATE_AUTO, STATE_COOL, STATE_DRY, STATE_FAN_ONLY, STATE_HEAT,
SUPPORT_FAN_MODE, SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPE... |
from flipflop.d import D_FlipFlop
from latch.d import D_Latch
class Register:
DEBUGMODE = False
def __init__(self, clock, inputs, size, name="Register"):
self.inputs = inputs
self.name = name
self.size = size
self.clock = clock
self.outputs = None
self.build()
... |
_base_ = [
'../_base_/models/mask_rcnn_r50_fpn.py',
'../_base_/datasets/coco_instance.py',
'../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py'
]
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
backbone=dict(frozen_stages=-1, norm_cfg=norm_cfg, norm_eval=False),
nec... |
#!/usr/bin/env python
"""API E2E tests for an ApiCallRouterWithChecks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from absl import app
from grr_api_client import errors as grr_api_errors
from grr_response_core import config
from grr_response_core.... |
import os
import collections
import functools
import multiprocessing
import numpy as np
import tensorflow as tf
from collections import deque
def is_image(tensor):
"""
Check if a tensor has the shape of
a valid image for tensorboard logging.
Valid image: RGB, RGBD, GrayScale
:param tensor: (np.n... |
from django.contrib import admin
from .models import Inbox, Setting, Dislike, Like, UserPhoto, Match, Profile
admin.site.register(UserPhoto)
admin.site.register(Profile)
admin.site.register(Setting)
admin.site.register(Like)
admin.site.register(Dislike)
admin.site.register(Inbox)
admin.site.register(Match)
# Register... |
from bs4 import BeautifulSoup
import requests
import geocoder
import time
import datetime
import pyowm
#переменные
DOLLAR_RUB = 'https://www.google.com/search?sxsrf=ALeKk01NWm6viYijAo3HXYOEQUyDEDtFEw%3A1584716087546&source=hp&ei=N9l0XtDXHs716QTcuaXoAg&q=%D0%B4%D0%BE%D0%BB%D0%BB%D0%B0%D1%80+%D0%BA+%D1%80%D1%83%D0... |
# Copyright 2017-present Adtran, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
# Copyright 2017 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 os
import time
import argparse
import math
from numpy import finfo
import torch
from distributed import apply_gradient_allreduce
import torch.distributed as dist
from torch.utils.data.distributed import DistributedSampler
from torch.utils.data import DataLoader
from model import Tacotron2
from data_... |
"""
Subclasses of grok.Adapter and grok.MultiAdapter must implement exactly one
interface:
>>> grok.testing.grok(__name__)
Traceback (most recent call last):
...
GrokError: <class 'grokcore.component.tests.adapter.implementsnonemulti.Home'> must
implement at least one interface (use grok.implements to spec... |
"""flutterapi URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
... |
from queue import Queue
from datetime import datetime, timedelta
import django,os,time,asyncio,smtplib,requests
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CowinNotifier.settings')
django.setup()
from notifier.models import Pin,Order,Email
schedule = Queue(maxsize = 3000)
in_queue=set()
class mail:
def __in... |
# Generated by Django 2.0.1 on 2018-01-22 07:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tangerine', '0026_remove_config_site_url'),
]
operations = [
migrations.AddField(
model_name='p... |
# 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... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: model_repository.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from googl... |
# -*- coding: utf-8 -*-
'''
This module contains all of the routines needed to set up a master server, this
involves preparing the three listeners and the workers needed by the master.
'''
from __future__ import absolute_import
# Import python libs
import fnmatch
import logging
import os
import re
import time
import s... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
import struct
from typing import Optional
from bxutils.logging.log_level import LogLevel
from bxcommon.messages.abstract_block_message import AbstractBlockMessage
from bxcommon.utils import crypto
from bxgateway.btc_constants import BTC_HDR_COMMON_OFF, BTC_BLOCK_HDR_SIZE, BTC_SHA_HASH_LEN
from bxgateway.messages.btc... |
"""Intervals are a generalization of several file formats:
GFF
====
All GFF formats (GFF2, GFF3 and GTF) are tabular files with 9 fields per line,
separated by tabs. They all share the same structure for the first 7 fields,
while differing in the definition of the eighth field and in the content and
format of the nin... |
"""
This app is to manage the access
""" |
from dreamcoder.utilities import *
from dreamcoder.program import *
from dreamcoder.task import Task
class FrontierEntry(object):
def __init__(
self,
program,
_=None,
logPrior=None,
logLikelihood=None,
logPosterior=None):
self.logPost... |
import functools
import unittest
import warnings
import numpy as np
from scipy import stats, special
from numpy.testing import assert_allclose
from properscoring import energy_score
class TestESSimple(unittest.TestCase):
def test_one_observation_trivial(self):
obs = np.array([[1, 2]])
fc = np.ar... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
from __future__ import absolute_import
from .utils.parameters import *
from .utils.utils import contains_Vietchar, no_accent_vietnamese, tokenize
from nltk import ngrams
import re
import numpy as np
def levenshtein_ratio_and_distance(s, t, ratio_calc = True):
""" levenshtein_ratio_and_distance:
Calculates levensh... |
import torch
import sparseconvnet as scn
# Use the GPU if there is one, otherwise CPU
use_gpu = torch.cuda.is_available()
model = scn.Sequential().add(
scn.SparseVggNet(2, 1,
[['C', 8], ['C', 8], ['MP', 3, 2],
['C', 16], ['C', 16], ['MP', 3, 2],
['C', 24], ['C', 24], ['MP', 3, 2]])
).add(... |
# -*- coding: utf-8 -*-
#
# simplekit documentation build configuration file, created by
# sphinx-quickstart on Thu Nov 19 22:49:03 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... |
import streamlit as st
import cv2
import numpy as np
import matplotlib.pyplot as plt
def detect_objects(input_image):
col1, col2 = st.columns(2)
col1.subheader("Sample Image")
st.text("")
plt.figure(figsize = (15,15))
plt.imshow(input_image)
col1.pyplot(use_column_width=True)
# Read weigh... |
#!/usr/bin/python3
"""
This is a module test from BaseModel class and your methods.
"""
from models.engine.file_storage import FileStorage
import unittest
from models.engine.file_storage import BaseModel
class TestFileStorage(unittest.TestCase):
def setUp(self):
self.storage = FileStorage()
def ... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import Group
class UserProfileManager(BaseUserManager):
def create_user(self, username, email=None, passwo... |
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
dp = [[0 for i in range(n)] for i in range(m)]
# only 1 unique way to go to cells on the right and down
for i in range(m):
dp[i][0] = 1
for j in range(n):
dp[0][j] = 1
# for rest of the cell... |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2009,2010,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... |
import setuptools
with open("requirements.txt") as f:
required = f.read().splitlines()
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="pymapf", # Replace with your own username
version="0.1.3",
author="Erwin Lejeune",
author_email="e... |
"""
generate markdown version of syllabus
"""
import os,collections,re
import time
import get_syllabus
lecturebase='../lectures'
if not os.path.exists(lecturebase):
os.mkdir(lecturebase)
syll=get_syllabus.get_syllabus()
syll_columns=['Date', 'Topic', 'Reading']
header=[i.strip() for i in syll[0]]
syll_colnums=... |
'''
Author: Mudra Hegde
Email: mhegde@broadinstitute.org
Gets guide context given the guide sequence, PAM length, Transcript ID and taxon
'''
from urllib import request
import pandas as pd
import csv
def revcom(s):
basecomp = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'}
letters = list(s[::-1])
letters = [bas... |
import random
import tkinter as tk
from tkinter import ttk
import matplotlib
import matplotlib.animation as animation
import numpy as np
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from scipy import signal
from scipy.fftpack import fft, fftshift
import config
f... |
#!./exec-in-virtualenv.sh
# -*- coding: UTF-8 -*-
# File: rebuild-html.py
# Date: 一 6月 09 17:34:27 2014 +0000
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
from pdfprocess import do_addhtml
from ukdbconn import get_mongo
db = get_mongo('paper')
itr = db.find({'_id': 67L})
for paper in itr:
try:
data = paper['p... |
#!/usr/bin/env python
import rospy
import sys
from sensor_msgs.msg import Joy
import time
# ROS Node converts Joystick inputs from the joy node
# Gets joystick messages to the Joy topic
# then converts the joystick inputs into Twist commands
# axes 1: left stick vertical controls linear speed
# axes 0: left stick hori... |
import pyperclip
import string
import random
from user import User
class Credential:
'''
Class to create account credentials, generate passwords and save credentials and passwords
'''
# Class Variables
credentials_list =[]
def __init__(self,account,userName,password):
'''
Method to define the properties ... |
# Generated by Django 2.0.7 on 2019-09-19 10:56
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Books',
fields=[
('id', models.AutoField(au... |
"""Support for TCP socket based sensors."""
from collections.abc import Mapping
import json
import logging
import select
import socket
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PAYLOAD,
CONF_PORT,
... |
# -*- coding: utf-8 -*-
import swagger_client
import v2_swagger_client
from library.base import _assert_status_code
from v2_swagger_client.rest import ApiException
import base
def is_member_exist_in_project(members, member_user_name, expected_member_role_id = None):
result = False
for member in members:
... |
import time
from typing import Dict, List, Tuple
import torch
from torch import Tensor
from torch.nn import Module
from torch.nn.functional import nll_loss
from torch.optim import Adam, Optimizer
from torch_geometric.data import Data
def train_step(model: Module,
data: Data,
optimizer: ... |
import pyglet
import game
import func
func.start()
# Event handlers
@game.game_window.event
def on_draw():
game.game_window.clear()
func.draw_board()
game.info_batch.draw()
@game.game_window.event
def on_mouse_press(x, y, button, modifiers):
# Restart button
if game.restart_x_start < x < game.restart_x_end:
... |
def cleanLtdStr(inStr):
"""Parse ltd string into list of more easily workable parts
Removes any comments and casts most common parameters
"""
#print("dirty: %s" % inStr)
clean = []
a = inStr.split(":")
b = a[0].split()
c = a[1].split()
if b[0].lower() == 'branch':
clean.appe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.