text stringlengths 2 999k |
|---|
"""Implementation of JSONEncoder
"""
# stdlib
import re
try:
# third party
from simplejson._speedups import (
encode_basestring_ascii as c_encode_basestring_ascii,
)
except ImportError:
c_encode_basestring_ascii = None
try:
# third party
from simplejson._speedups import make_encoder as ... |
# coding: utf-8
"""
pollination-server
Pollination Server OpenAPI Definition # noqa: E501
The version of the OpenAPI document: 0.16.0
Contact: info@pollination.cloud
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import... |
# Program IdxPengajarMK
# menerima masukan berupa nama pengajar, misalnya P, dan sebuah TabMatKul, misalnya T,
# dan menghasilkan indeks di mana P ditemukan terakhir kali di T, atau 0 jika P tidak
# ditemukan di T. T mungkin kosong.
# Input: P : string, T: TabMatKul
# Output: i : int
# KAMUS
# Konstanta
NMax = 100
... |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import rospy
from geometry_msgs.msg import PoseStamped
from nav_msgs.msg import MapMetaData
from nav_msgs.msg import OccupancyGrid
from nav_msgs.msg import Odometry
from nav_msgs.msg import Path
import time
import matplotlib.pyplot as plt
import... |
# Copyright 2021 The Cirq Developers
#
# 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 ... |
# -*- coding: utf-8 -*-
# Copyright (C) 2010, Luis Pedro Coelho <luis@luispedro.org>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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 with... |
text = """
//------------------------------------------------------------------------------
// Explict instantiation.
//------------------------------------------------------------------------------
#include "RK/RKUtilities.cc"
#include "Geometry/Dimension.hh"
"""
for order in ["SepticOrder"]:
text += """
namespac... |
# Import
import torch
from src.rc_class.matrix_gen.matrix_generator import Matrix_generator
class Matrix_uni_gen(Matrix_generator):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def _generate_matrix(self, size, dtype=torch.float64):
"""
Generate... |
from matplotlib import pyplot
from matplotlib.axes import Axes
from utils.db_library import get_site_data
from datetime import datetime, timedelta
from pytz import timezone, utc
def convert_iso_to_kst_date(iso_string: str) -> datetime:
naive_datetime = datetime.fromisoformat(iso_string)
return utc.localize(n... |
from rest_framework import routers
from .views import *
router = routers.DefaultRouter()
# router.register(r'company/advertising', AdvertisingCompanyViewset)
# router.register(r'advertising/point', AdvertisingPointViewset)
# router.register(r'company/property', PropertyCompanyViewset)
# router.register(r'community/a... |
#########################################################################
# #
# C R A N F I E L D U N I V E R S I T Y #
# 2 0 1 9 / 2 0 2 0 #
# ... |
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
aa=np.asarray
import os
import string
from .settings import styles_path
class SF(object):
"""
save figure context
"""
def __init__(self,figure_name=None,figures_folder='figs',figure_markers=None,figure_type='svg',style='neuro... |
# coding: utf-8
# Copyright (c) Alexandr Emelin. MIT license.
import logging
logger = logging.getLogger('centrifuge')
logger.setLevel(logging.DEBUG)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Arduino lock-in amplifier
"""
__author__ = "Dennis van Gils"
__authoremail__ = "vangils.dennis@gmail.com"
__url__ = "https://github.com/Dennis-van-Gils/DvG_Arduino_lock-in_amp"
__date__ = "31-08-2021"
__version__ = "2.0.0"
# pylint: disable=invalid-name
import os
impor... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, VHRS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class LastMonthDeduction(Document):
pass
|
# https://www.codechef.com/LRNDSA01/problems/FCTRL
for _ in range(int(input())):
n = int(input())
count = 0
power = 5
while True:
k = n // power
if k == 0:
break
count += k
power *= 5
print(count)
|
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def PolicyOption(vim, *args, **kwargs):
'''The PolicyOption data object represents one or... |
import csv
from datetime import datetime
SCHEDULE = 'schedule.csv'
HEADERS = ("Date", "Week", "Class", "Day", "Learning Outcome", "Chapter",
"Pages", "Quiz", "Assignmt", "Lab", "Outcomes")
OPTIONS_DATE = {1: "Specify a specific date", 2: "Use today's date"}
def getDate():
# Determine current date and t... |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from datetime import date
from datetime import datetime
from freezegun import freeze_time
from mock import patch
from ggrc.app import db
from ggrc.notifications import common
from ggrc.models import Notific... |
import torch
import right_pool
device = torch.device("cuda:0")
a = torch.zeros([10,10,10,10],device=device)
b = torch.zeros([10,10,10,10],device=device)
c = right_pool.backward(a,b)
print(c)
|
from string import ascii_letters
import re
forest_attr = ['var_name', 'coefficient', 'lb_95', 'ub_95']
forest_header = ["Phenotype", "Coefficient", "Lower Bound", "Upper Bound"]
FOREST_DICT = {attr: header for attr, header in zip(forest_attr, forest_header)}
def clean_line(line):
"""
Strip line of new line ... |
# coding=utf-8
# Copyright 2018 Google AI, Google Brain and the HuggingFace Inc. team.
#
# 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... |
# 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... |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... |
#!/usr/bin/env python
from Pytwcla import pytwcla
pytwcla.main() |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
The minionswarm script will start a group of salt minions with different ids
on a single system to test scale capabilities
'''
# pylint: disable=resource-leakage
# Import Python Libs
from __future__ import absolute_import, print_function
import os
import time
import si... |
import os
import re
from setuptools import setup
def version():
regex = r'^(?m){}[\s]*=[\s]*(?P<ver>\d*)$'
with open(os.path.join(os.path.dirname(__file__), 'include.mk')) as f:
ver = f.read()
major = re.search(regex.format('MAJORVERSION'), ver).group('ver')
minor = re.search(regex.format('MI... |
import sys
import pandas as pd
import matplotlib.pyplot as plt
def _plot_latency_data(src_file: str, dst_file: str) -> None:
df = pd.read_csv(src_file, index_col='datetime', parse_dates=True).fillna(0)
df['lte_modem_latency'].plot(label='lte_modem_latency')
df['5G_modem_latency'].plot(label='5G_modem_late... |
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from src.diagrams.icons import _ICONS
class _Cisco(_ICONS):
_type = "cisco"
_icon_dir = "../resources/icons/cisco/png"
class BasetHubPng(_Cisco):
_icon = "100basethub.png"
class a10700Png(_Cisco):
_icon = "10700.png"
class GeF... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
import pandas as pd
data = pd.read_csv('train_label.csv') # CSV file path
image = data.iloc[:, 0].values
label = data.iloc[:, 1:].values
train = tf.data.Dataset.from_tensor_slices((image, label))
def collector(images_file, label)... |
pi = Math.PI
e = Math.E
exp = Math.exp
def expm1 (x): # IE workaround
return Math.exp (x) - 1
def log (x, base):
return Math.log (x) if base is js_undefined else Math.log (x) / Math.log (base)
def log1p (x): # IE workaround
return Math.log (x + 1)
def log2 (x): # IE workaround
return Math.log... |
from flask import Flask
from flask_admin import Admin
from flask_sqlalchemy import SQLAlchemy
def setup():
app = Flask(__name__)
app.config['SECRET_KEY'] = '1'
app.config['CSRF_ENABLED'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'
app.config['SQLALCHEMY_ECHO'] = True
db = SQL... |
import pyaf.Bench.TS_datasets as tsds
import pyaf.tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 5, transform = "Anscombe", sigma = 0.0, exog_count = 0, ar_order = 12); |
#!/usr/bin/env python2
# Copyright (c) 2014-2018 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 BIP66 changeover logic
#
from test_framework import BitcoinTestFramework
from bitcoinrpc.au... |
class Latitude:
def __init__(self, latitude):
self.latitude = latitude
def __call__(self):
return self.latitude
class Longitude:
def __init__(self, longitude):
self.longitude = longitude
def __call__(self):
return self.longitude
class Point:
def __init__(self, coo... |
#!/bin/env python
import os
import sys
from XenServer import XenServer
from GELF import GELF
import traceback
try:
xs_session = XenServer().make_session()
pool = xs_session.xenapi.pool.get_all()[0]
pool_record = xs_session.xenapi.pool.get_record(pool)
master_uuid = xs_session.xenapi.host.get_uuid(poo... |
# -*- coding: utf-8 -*-
import tkFileDialog
import os
zoomm = 0.8
zoomp = 1.0/0.8
#Печать картинки в постскрипт
class Print_PS:
def __init__(self, par):
self.par = par
self.print_postScript()
def print_postScript(self):
self.par.kill()
self.par.standart_unbind()
... |
from app.db import db
class Article(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(256), unique=True, nullable=False)
score = db.Column(db.Integer)
total_votes = db.Column(db.Integer)
def __repr__(self: 'Article') -> str:
return '<Article title=%s tota... |
# coding:utf-8
from flask import Flask, request, send_from_directory, flash, redirect, url_for, abort, jsonify, render_template, g
import os
from werkzeug.utils import secure_filename
from flask import helpers
import color_transfer
import db
from logger import get_log
os.environ['LD_LIBRARY_PATH'] = '/'.join(__file__... |
# Copyright (c) 2016 Jason Lowe-Power
# 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 list of conditions and the fol... |
import numpy as np
# X - single array/vector
# y - single array/vector
# theta - single array/vector
# alpha - scalar
# iterations - scarlar
def gradientDescent(X, y, theta, alpha, numIterations):
'''
# This function returns a tuple (theta, Cost array)
'''
m = len(y)
ar... |
"""Does general configuration parsing; used by other classes for their configuration."""
from __future__ import print_function
import os
import warnings
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import SafeConfigParser as ConfigParser
from neat.six_util import iterkeys
... |
#LET'S FALL IN LOVE WITH IMAGES!!!!
import cv2
import numpy as np
from matplotlib import pyplot as plt
import os
img = cv2.imread('lena.jpg', cv2.IMREAD_GRAYSCALE)
lap = cv2.Laplacian(img, cv2.CV_64F, ksize=3)
sobelX = cv2.Sobel(img, cv2.CV_64F, 1, 0)
sobelY = cv2.Sobel(img, cv2.CV_64F, 0, 1)
lap = np.uint8(np.abs... |
# from flask import render_template
# from . import main
# @main.app_errorhandler(404)
# def four_Ow_four(error):
# '''
# Function to render the 404 error page
# '''
# return render_template('fourOwfour.html'),404 |
from random import choice
from typing import Union
from datetime import datetime
from discord import User, Member, Embed
from discord.ext import commands
from bot.main import NewCommand
class Hug(commands.Cog):
def __init__(self, client):
self.client = client
def randomise(self, users:list):
... |
# -*-coding: utf-8 -*-
# Author:
"""题目描述
编写”长整数相乘”程序,实现两个任意长度的长整数(正数)相乘,输出结果.
输入描述:
第一行输入数字A的字符串,字符范围(0~9),第二行输入数字B的字符串,字符范围(0~9)。
输出描述:
输出A、B俩数相乘的结果,结果为字符串。"""
import operator
a = int(input().strip())
b = int(input().strip())
print(str(a*b)) |
# Copyright (c) 2021, White Hat Global and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class ManufacturingProcess(Document):
pass
|
import io
import uuid
import pytest
import requests
from pyOlog import SimpleOlogClient
# body = ["t", "te", "tes", "test", "test1", "test-2"]
string = str(uuid.uuid4())
body = [string[:i] for i, x in enumerate(string)]
multiples_of_4 = []
for i in range(25):
s = str(uuid.uuid4())[:4]
if i > 0:
s = f... |
# Copyright 2013-2020 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)
from spack import *
import socket
import os
from os import environ as env
from os.path import join as pjoin
def cmake_... |
# 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... |
"""Trains a neural network for hand mapping."""
import argparse
import datetime as dt
import json
import os
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import torch
import hannds_data as hd
from network_zoo import Network88, Network8... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 15 17:06:04 2017
@author: michael
"""
class SeaPosition(object):
"""
Cartesian position (x,y) within the sea.
"""
def __init__(self, x, y, sea):
"""
Initialize position with given coordinates
"""
self... |
# Generated by Django 3.2.6 on 2021-08-11 20:48
from django.conf import settings
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
... |
# -*- coding: utf-8 -*-
#
# django-bootstrap-ui documentation build configuration file, created by
# sphinx-quickstart on Mon May 4 23:12:00 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... |
BAMBOU_MOCK_URL = "https://localhost:8443"
BAMBOU_REAL_URL = "https://localhost:8080"
ROOT_SPEC_TEST = {"attributes": [{"name": "name", "type": "string"}],
"children": [{"rest_name": "enterprise",
"relationship": "root"}],
"model": {"entity_name": ... |
# Generated by Django 2.2.20 on 2021-11-15 08:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_auto_20210606_1546'),
]
operations = [
migrations.AlterField(
model_name='category',
name='description... |
from .station import MonitoringStation
from .utils import sorted_by_key
from floodsystem.datafetcher import fetch_measure_levels
import numpy as np
import datetime
from floodsystem.analysis import polyfit
def stations_level_over_threshold(stations, tol):
"""This function returns a list of stations where water
... |
# Write your solution for 1.1 here!
sum = 0
for i in range (101):
print(i)
sum = sum + i
print(sum)
|
# -*- coding: utf-8 -*-
import unittest
from w3lib.encoding import resolve_encoding
from scrapy.http import (Request, Response, TextResponse, HtmlResponse,
XmlResponse, Headers)
from scrapy.selector import Selector
from scrapy.utils.python import to_unicode
from scrapy.exceptions import NotSu... |
import numpy as np
import pandas as pd
import pyarrow
from multiprocessing import Pool
from collections import Counter
from itertools import repeat
import scipy.stats as st
def __get_ptws(ids, pathways_db, go_terms_db):
'''Get list of patways/terms based on gene IDs'''
pathways = list(pathways_db[pathways_db['... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
#!/usr/bin/python2
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
import struct
import subprocess
import sys
import tempfile
import test_format
BUNDLE_SIZE = 32
def Creat... |
from __future__ import absolute_import
import gc
import types
from rpython.rlib import jit
from rpython.rlib.objectmodel import we_are_translated, enforceargs, specialize
from rpython.rlib.objectmodel import CDefinedIntSymbolic, not_rpython
from rpython.rtyper.extregistry import ExtRegistryEntry
from rpython.rtyper.l... |
from heapq import heappush, heappop
def solution(jobs):
jobs.sort(key=lambda x: x[0], reverse=True)
nums = len(jobs)
workingTime = 0
heap = []
time = 0
while jobs:
while jobs and jobs[-1][0] <= time:
start, duration = jobs.pop()
heappush(heap, (duration, start))... |
# package for command line tools
# see: setup.py:entry_points
# implement cli access here to separate the core- and lib-packages from
# the commandline argument parsing.
|
# flake8: noqa
import numpy as np
import deepchem as dc
from deepchem.feat.base_classes import MolecularFeaturizer
from deepchem.feat.mol_graphs import ConvMol, WeaveMol
from deepchem.data import DiskDataset
import logging
from typing import Optional, List, Tuple, Union, Iterable
from deepchem.utils.typing import RDKi... |
# Copyright 2016 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... |
for x in range(10):
print(x)
print("Other words")
|
import pandas as pd
from scipy.ndimage.filters import gaussian_filter1d
import numpy as np
%matplotlib inline
from matplotlib import pyplot as plt
from matplotlib.pyplot import figure
def getSpecific(city):
df = pd.read_csv('weatherdataman___prepared-temp.csv')
var = 'tempAvg10'
df = df[df['City']==city]
... |
# -*- coding: utf-8 -*- #
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
# -*- coding: utf-8 -*-
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
import json
import os
from numpy import inf, NaN, newaxis, argmin, delete, asarray, isnan, sum, nanmean
from scipy.spatial.distance import cdist
from regional import one, many
def load(file):
"""
Load neuronal regions from a file or string.
"""
if os.path.isfile(file):
with open(file, 'r') as f... |
# 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)
from spack.package import *
class Utf8cpp(Package):
"""A simple, portable and lightweight generic library for handli... |
"""
# Definition for a Node.
class Node:
def __init__(self, x, next=None, random=None):
self.val = int(x)
self.next = next
self.random = random
"""
class Solution(object):
def copyRandomList(self, head):
"""
:type head: Node
:rtype: Node
"""
def c... |
from django.contrib import admin
from todo.models import Task, TaskList, Comment
class TaskAdmin(admin.ModelAdmin):
list_display = ('title', 'task_list', 'completed', 'priority', 'due_date')
list_filter = ('task_list',)
ordering = ('priority',)
search_fields = ('name',)
class CommentAdmin(admin.Mode... |
from django.apps import AppConfig
class AphorConfig(AppConfig):
name = 'aphor'
|
from collections import Counter
def get_highest_number(numbers_dict):
"""
Find the most frequent numbers.
:param numbers_dict:
:return:
"""
number = max(numbers_dict, key=lambda x: numbers_dict[x])
return number
def get_most_frequent(numbers):
"""
Get most frequent numbers.
... |
# qubit number=2
# total number=10
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=1
p... |
# Copyright 2020, The TensorFlow Authors.
#
# 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 t... |
#a typical 3D pixel shuffle layer for pytorch
class PixelUpsampler3D(nn.Module):
def __init__(self,
upscaleFactor,
# conv=default_conv3d,
# n_feats=32,
# kernel_size=3,
# bias=True
):
super(PixelUpsampler3D... |
from .api import *
from .reduction import Reduce
from .cudadrv.devicearray import (device_array, device_array_like, pinned,
pinned_array, pinned_array_like, to_device, auto_device)
from .cudadrv import devicearray
from .cudadrv.devices import require_context, gpus
from .cudadrv.devices import get_co... |
from molsysmt._private.exceptions import *
from molsysmt.item.string_aminoacids1.is_string_aminoacids1 import is_string_aminoacids1 as is_form
from molsysmt.item.string_aminoacids1.extract import extract
from molsysmt.item.string_aminoacids1.add import add
from molsysmt.item.string_aminoacids1.append_structures import... |
from pathlib import Path
from collections import defaultdict
from abc import abstractmethod
import jsonpickle
import logging
from tqdm import tqdm
from typing import Tuple, List, Optional, Dict, Text, Union, Any, Iterator, Set
import numpy as np
from rasa.core.featurizers.single_state_featurizer import SingleStateFea... |
# Generated by Django 2.1.5 on 2019-02-04 15:37
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),... |
# Copyright (c) 2016 Adafruit Industries
# Author: Tony DiCola
#
# 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, m... |
from Hackdavis.ab_recipes import Recipes
# name, type, ingredients, url
class Simplyrecipes(Recipes):
def find_name(self):
try:
name = self.soup.find(class_='entry-title').text
return name
except:
return "Not available"
def find_ingredients(self):
t... |
"""CSS matcher."""
from datetime import datetime
from . import util
import re
from . import css_types as ct
import unicodedata
import bs4 # type: ignore[import]
from typing import Iterator, Iterable, List, Any, Optional, Tuple, Union, Dict, Callable, Sequence, cast
# Empty tag pattern (whitespace okay)
RE_NOT_EMPTY =... |
from rest_framework.generics import (
ListAPIView,
RetrieveAPIView,
ListCreateAPIView,
UpdateAPIView,
DestroyAPIView
)
from energytransfers.models import (
Substation,
Transformator,
Counter,
History
)
from energytransfers.serializers import (
# CRUD SERIALIZERS
SubstationS... |
# -*- coding: utf-8 -*-
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBoo... |
"""Load markdown features"""
import argparse
import os
import sys
import mistune
from nbconvert.filters.markdown_mistune import MarkdownWithMath
from langdetect import detect
from nltk.corpus import stopwords
from reproducemegit.jupyter_reproducibility import config
from reproducemegit.jupyter_reproducibility import... |
"""
Functions to facilitate using PyTides.
"""
import sys, os
# Temporary fix to import local submodule version of pytides:
CLAW = os.environ['CLAW'] # path to Clawpack files
pathstr = os.path.join(CLAW, 'tidal-examples/pytides')
assert os.path.isdir(pathstr), '*** clawpack/tidal-examples/pytides ***'
print('pytides... |
import base64
import grpc
import subprocess
import sys
import argparse
import time
from script import create_server
from service import searchWord
import unittest
from service_spec.DSSMService_pb2_grpc import DSSMStub
from service_spec.DSSMService_pb2 import DSSMRequest, DSSMResponse
class TestSuiteGrpc(unittest.Test... |
""" Experiments with persistence models """
import logging
import mysql.connector
import sys
from texttable import Texttable
from sklearn.metrics import mean_absolute_error
import solardata.config
import solardata.sites as sites
logger = logging.getLogger(__name__)
def current_value():
""" Computes MAE using ... |
import re
from netrc import netrc
from os import chmod, path
from stat import S_IRUSR, S_IWUSR
from textwrap import dedent
from typing import Optional, Tuple
from requests.compat import urlparse
def get_credentials(base_url: str) -> Tuple[Optional[str], Optional[str]]:
hostname = urlparse(base_url).hostname
... |
#!/usr/bin/env python
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-array/blob/master/LICENSE
import distutils.version
import numpy
if distutils.version.LooseVersion(numpy.__version__) < distutils.version.LooseVersion("1.13.1"):
raise ImportError("Numpy 1.13.1 or later required")
from awkwar... |
#Name: Quy Nguyen
# Consulted Breadth First Search from the following Source:
# https://github.com/prathameshtajane/spider-web-crawler/blob/master/crawler.py
import socket
import ssl
from bs4 import BeautifulSoup, SoupStrainer
def bfs():
visited = []
queue = [{'url': "https://www.rit.edu/", 'depth': 0}]
urls = ... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... |
# Returns true if there is a subset
# of arr[] with sum divisible by m
def modularSum(arr, n, m):
if n > m:
return True
# This array will keep track of all
# the possible sum (after modulo m)
# which can be made using subsets of arr[]
# initialising boolean array with all false
DP = [Fa... |
# Copyright (c) 2020, Fabio Muratore, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from mock import Mock, patch
import podium_api
from podium_api.account import make_account_get
from podium_api.types.account import get_account_from_json
from podium_api.types.token import PodiumToken
try:
from urllib.parse import urlencod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.