content stringlengths 5 1.05M |
|---|
from __future__ import division
from physicsTable import *
from physicsTable.models import PointSimulation
from get_flood_length import Flooder
from view_trial_parsing import view_trial_parsing
import glob, os, sys
MAX_WALLS_DEL = 5
MIN_WALLS_DEL = 1
def get_noncontained_walls(tr, enforce_goal_switch=False,
... |
import logging
logger = logging.getLogger(__name__)
from nymms.schemas import Result, types
from nymms.daemon import NymmsDaemon
from nymms.resources import Monitor
from nymms.utils import commands
from nymms.config.yaml_config import load_config, EmptyConfig
import arrow
TIMEOUT_OUTPUT = "Command timed out after ... |
# Modified: 2021-08-30
# Description: Implements a controller for /player
#
from fastapi import APIRouter, Path, HTTPException, status, Query
from models import player_model, game_model
from .responses import CustomJSONResponse as JSONResponse
from . import ID_REGEX, PLAYER_ID_DESC, SKIP_DESC, LIMIT_DESC
router = A... |
import json
AJAX_URL = '/ajax_callback'
AJAX_FUNC_URL = '/ajax_func_callback'
js_manager = None
js_ajax = None
live_methods = {}
class RE:
def __init__(self, re):
self.re = re
def re(pattern):
return RE(pattern)
def js_procedure(func_id, ajax_args=''):
return '''
Ext.Ajax.request(
{... |
# Autogenerated file.
from .client import TvocClient # type: ignore
|
#!/usr/local/bin/python
import cgi
import cgitb; cgitb.enable()
import os, sys
try: import msvcrt # are we on Windows?
except ImportError: pass # nope, no problem
else: # yep, need to set I/O to binary mode
for fd in (0, 1): msvcrt.setmode(fd, os.O_BINARY)
UPLOAD_DIR = "/t... |
from datetime import date
from django.http import HttpResponse
from django.test import TestCase
from django.test.client import RequestFactory
from django.utils.decorators import decorator_from_middleware_with_args
from mock import Mock, patch
from regulations import url_caches
class UrlCachesTests(TestCase):
@p... |
# Copyright The IETF Trust 2007-2019, All Rights Reserved
from django import forms
from ietf.doc.models import Document
from ietf.meeting.models import Session
from ietf.meeting.utils import add_event_info_to_session_qs
# ---------------------------------------------
# Globals
# ------------------------------------... |
# -*- coding: utf-8 -*-
"""
mslib.conftest
~~~~~~~~~~~~~~
common definitions for py.test
This file is part of mss.
:copyright: Copyright 2016-2017 Reimar Bauer
:copyright: Copyright 2016-2021 by the mss team, see AUTHORS.
:license: APACHE-2.0, see LICENSE for details.
Licensed under... |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name = "Utility_Functions",
author="Allison Wu",
author_email="allison.wu@thermofisher.com",
description="Utility functions",
notes = "Add in stats_functions",
version = "0.3.... |
import json
import os.path
from urllib import request, error
import olerror, olresult
# importorator
__all__ = ['ExamToolsLookup']
class ExamToolsLookup:
def lookup(self, call):
"""
Uses exam.tools to look up information on a US callsign
:param call: the callsign to look up
:ret... |
import sys
import logging
from vogue.build.application_tag import build_application_tag
from vogue.exceptions import MissingApplicationTag
LOG = logging.getLogger(__name__)
def load_aplication_tags(adapter, json_list):
"""Will go through all application tags in json_list and add/update them to trending-db.
... |
import unittest
from functools import partial
import numpy as np
from sklearn.datasets import make_blobs
from sklearn.metrics import pairwise_distances
from MulticoreTSNE import MulticoreTSNE
make_blobs = partial(make_blobs, random_state=0)
MulticoreTSNE = partial(MulticoreTSNE, random_state=3)
def pdist(X):
... |
import pandas as pd
import numpy as np
import unittest
import decipy.executors as exe
import decipy.normalizers as norm
import decipy.weigtings as wgt
matrix = np.array([
[4, 3, 2, 4],
[5, 4, 3, 7],
[6, 5, 5, 3],
])
alts = ['A1', 'A2', 'A3']
crits = ['C1', 'C2', 'C3', 'C4']
beneficial = [True, True, True, ... |
#!/usr/bin/python
import glob
import argparse
import os
import sys
from psnr_analyzer import PsnrAnalyzer
from report_manager import ReportData, ReportManager
from transcoder import Transcoder
from configuration import prepare_config
def prepare_output_dir(output_dir):
if os.path.exists(output_dir):
... |
from .craigslist import (
CraigslistCommunity, CraigslistEvents, CraigslistForSale, CraigslistGigs,
CraigslistHousing, CraigslistJobs, CraigslistResumes, CraigslistServices)
__all__ = [
'CraigslistCommunity', 'CraigslistEvents', 'CraigslistForSale', 'CraigslistGigs',
'CraigslistHousing', 'CraigslistJob... |
RESULTS_KEY = "results"
class ResultField(object):
PROCESSING_REQUEST_ID = "execution.processing_request.id"
|
from rest_framework import viewsets
from rest_framework import permissions
from .models import Referral
from .serializers import ReferralSerializer
from django_filters import rest_framework as filters
from healthmap.medicalofficer.permissions import IsMOOrReadOnly
# Filter Class for Referral
class ReferFilter(filters... |
# Copyright (c) 2018 LG Electronics, Inc.
#
# This program 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 version.
#
# This program is distribu... |
# -*- coding: utf-8 -*-
# main.py
class PyList(list):
def __init__(self, content=[], size=20):
self.items = [None] * size
self.numItems = 0
self.size = size
for e in content:
self.append(e)
def __contains__(self, item):
for i in range(self.numItems):
... |
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from Eir.utility import dist, Person, randEvent
from ..Hub.HubSIRVD import HubSIRVD
class StrongInfSIRVD(HubSIRVD):
def __init__(self, S0: int, I0: int, R0:int, V0: int, pss: float, gamma: float, eta:float, mu:float, rstart: float, side:... |
import json
from django.http import Http404
from django.shortcuts import render, redirect
# Create your views here.
from AthleticTeam.settings import MEDIA_ROOT
from SinglePagesApp.forms import EditContactUsForm, EditAboutUsForm, EditHistoryForm, EditTicketsForm, EditFacilitiesForm, EditSponsorshipsForm
def history(r... |
#!/usr/bin/env python
'''
Module for in silico digestion of WT and Variant proteins and writing to fasta files.
'''
import re
from pyteomics import fasta
from PoolSeqProGen import dna_seq
__author__ = "Rigbe G. Weldatsadik"
__copyright__ = "Copyright (c) 2020 Rigbe G. Weldatsadik"
__license__ = "Apache 2.0"
__vers... |
from pydantic import BaseModel
from typing import List
class ContainerSettings(BaseModel):
name: str
network_architecture: str
dataset_path: str
gpus: List[int]
tensorboard_port: int
api_port: int
author: str
|
#
# @lc app=leetcode id=724 lang=python3
#
# [724] Find Pivot Index
#
# https://leetcode.com/problems/find-pivot-index/description/
#
# algorithms
# Easy (40.58%)
# Total Accepted: 64.4K
# Total Submissions: 157.4K
# Testcase Example: '[1,7,3,6,5,6]'
#
# Given an array of integers nums, write a method ... |
s = '😀'
print('U+{:X}'.format(ord(s))) |
__version__ = '1.1.0dev'
|
#
# Class that parses the CONFIG files
#
# Author: Jakub Wlodek
#
import os
import re
import installSynApps.DataModel.install_config as IC
import installSynApps.DataModel.install_module as IM
class ConfigParser:
"""
Class responsible for parsing the INSTALL_CONFIG file into an InstallConfguration object
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import json
import subprocess
from time import sleep
import unittest
import codecs
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from lockfile import LockFile
from appium import webdriver
import difflib
import sys
import psutil
from selenium.common.excepti... |
import base64
def bitfield(n):
'''
Obtains the binary array from the number
'''
return [1 if digit=='1' else 0 for digit in bin(n)[2:]]
def shifting(bitlist):
'''
Obtain the number from the binary array
'''
out = 0
for bit in bitlist:
out = (out << 1) | bit
return out
... |
import textfsm
import colorama
template_file = 'week4_exercise1.template'
template = open(template_file)
with open('week4_exercise1.txt') as f:
raw_text_data = f.read()
# The argumentn 'template' is a file handle and 'raw_text_data' is a string.
re_table = textfsm.TextFSM(template)
data = re_table.ParseText(raw_... |
from setuptools import setup
setup(
name='scrapy-html-storage',
version='0.3.0',
description='Scrapy downloader middleware that stores response HTML files to disk.',
long_description=open('README.rst').read(),
url='https://github.com/povilasb/scrapy-html-storage',
author='Povilas Balciunas',
... |
# 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 use ... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
"""
================================================================================================
DO NOT UNCOMMENT SCRIPT AND EXECUTE!
DO NOT UNCOMMENT SCRIPT AND EXECUTE!
DO NOT UNCOMMENT SCRIPT AND EXECUTE!
DO NOT UNCOMMENT SCRIPT AND EXECUTE!
DO NOT UNCOMMENT SCRIPT AND EXECUTE!
Script which collects data from ex... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Test the region map endpoint."""
from unittest.mock import patch
from django.test import TestCase
from django.test.utils import override_settings
TEST_HTML = "./koku/masu/test/data/test_region_page.html"
class MockResponse:
"""A fake req... |
import random
import time
#malejące
ilości = []
malejące=[[]]
for i in range(0,10):
k=int(input())
ilości.append(k)
print(ilości)
for i in range(len(ilości)):
for j in range(ilości[i]):
n=j
malejące[-1].append(n)
malejące[-1].sort(reverse=True)
malejące.append([])
male... |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium 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 json
import os
import sys
import unittest
from file_system import FileNotFoundError
from in_memory_object_store import InMe... |
# coding: utf-8
import collections
import itertools
import logging
from typing import Dict, Iterator, List, Tuple
import cached_property
import pulp
from haoda import ir, util
_logger = logging.getLogger().getChild(__name__)
class SuperSourceNode(ir.Module):
"""A node representing the super source in the dataflo... |
from decouple import config
from {{ project_name }}.settings import constants
from {{ project_name }}.settings.base import * # noqa
# MySql
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': config('DATABASE_NAME', default='{{ project_name }}_dev'),
# 'USER':... |
"""
Copyright 2015, Institute for Systems Biology
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 w... |
"""
DICOM data elements with the Code String (CS) value-representation (VRs)
represented as *Enum* instances.
"""
from dicom_parser.utils.code_strings.modality import Modality
from dicom_parser.utils.code_strings.patient_position import PatientPosition
from dicom_parser.utils.code_strings.scanning_sequence import Scann... |
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
from userprofile.models import Status
class PaymentPackage(models.Model):
STATUS_CHOICES = (
('REG', 'Regular'),
('MBR', 'IEEE Member'),
('SFT', 'Full-time Student'),
('SMB',... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#SImple image segmentation using K-Means clustering algo
#color clustering
#Image segmentation from video using OpenCV and K-means clustering
import numpy as np
import cv2
import matplotlib.pyplot as plt
import collections
import pdb
from PIL import Image
from skimage im... |
#!/usr/bin/env python
# encoding: utf-8
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from v1.recipe import views
class RecipeSerializerTests(TestCase):
fixtures = [
'test/users.json',
'course_data.json',
'cuisine_data.json',
'ing_data.json',
... |
import django_filters
from models import *
class AgentFilterSet(django_filters.FilterSet):
name = django_filters.CharFilter(lookup_type='contains')
address = django_filters.CharFilter(lookup_type='contains')
#communities__community__name = django_filters.CharFilter(label='Community Name', lookup_type='con... |
import math
angulo = float(input('digite um angulo '))
seno = math.sin(math.radians(angulo))
print('o angulo {} tem o seno de {}',format(angulo,seno))
'''exercisio não concluido;
motivo : por algum motivo o compuatdor fala que o seno deve ser uma str''' |
# Numbers between 1000 and 3000 that all digits is even number
answer = []
for numbers in range(1000,3001):
numbers = str(numbers)
i = 0
candidate = 0
while i <= 3:
each_one = int(numbers[i])
if each_one % 2 == 0:
candidate += 1
i += 1
... |
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + os.path.sep + '../../../')
import numpy as np
from pydeformetrica.src.launch.estimate_deterministic_atlas import estimate_deterministic_atlas
from pydeformetrica.src.launch.estimate_geodesic_regression import estimate_geodesic_regressio... |
import json
from unittest.mock import patch, MagicMock
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.test import Client, TestCase
from django.contrib.auth.models import Permission
from common.config import SysConfig
from sql.engines.models import ResultSet
from... |
import logging
import webbrowser
from kivy.lang import Builder
from kivy.app import App
from kivy.clock import Clock
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.popup import Popup
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.s... |
#!/usr/bin/python
"""
Utility to filter large collections of assorted media files, especially focused
on retaining information on previously black-/whitelisted files to avoid
having to re-filter duplicates.
"""
import argparse
import hashlib
import os
import os.path
import shutil
import threading
import sys
import mp... |
# Several variants of linear regression
import numpy as np
from scipy.stats import norm, multivariate_normal
from scipy.optimize import linprog, minimize
from numpy.linalg import inv
class LinearRegressionData:
"""
Simple class for simulating data to test linear regression methods
"""
def __init__(sel... |
import mysql.connector as connector
credentials = {
"username": "root",
"password": ""
}
# Establish a connection with the DBMS
conn = connector.connect(user=credentials["username"],
passwd=credentials["password"],
host="localhost")
cursor = conn.cursor(buffer... |
import sys
for _ in [0]*int(input()):
a,b,c=map(int,input().split())
a=abs(a)
if b>0: z=a*a-2*abs(b)
else: z=a*a+2*abs(b)
print(abs(z))
|
# Copyright (c) 2014 ITOCHU Techno-Solutions 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... |
#!/usr/bin/env python
import argparse
import glob
import os.path
import pathlib
import re
import subprocess
import sys
import sysconfig
EXCLUDED_HEADERS = {
"bytes_methods.h",
"cellobject.h",
"classobject.h",
"code.h",
"compile.h",
"datetime.h",
"dtoa.h",
"frameobject.h",
"funcobje... |
import cv2
import numpy as np
import argparse
def align_images(img, ref, max_matches, good_match_percent):
# Convert images to grayscale
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
ref_gray = cv2.cvtColor(ref, cv2.COLOR_BGR2GRAY)
# Detect ORB features and compute descriptors.
orb = cv2.ORB_c... |
# BEGIN_COPYRIGHT
#
# Copyright 2009-2015 CRS4.
#
# 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 ... |
"""ShutIt module. See http://shutit.tk
"""
from shutit_module import ShutItModule
class docker_jira(ShutItModule):
def build(self, shutit):
shutit.install('apache2 postgresql wget openjdk-7-jre')
shutit.send('mkdir -p /opt/atlassian')
shutit.send('cd /opt/atlassian')
f = 'atlassian-jira-6.4.1-x64.bin'
sh... |
import wx
import wx.grid
from .widgets import TabPage
class AslAnalysis(TabPage):
"""
Tab page containing data analysis options
"""
def __init__(self, parent, idx, n):
TabPage.__init__(self, parent, "Analysis", idx, n)
self.distcorr_choices = ["Fieldmap", "Calibration image"]
... |
# coding=utf8
import requests
import numpy as np
from config import modelo
print(modelo)
ACCIONES = ['EXITO'] ##, 'ECOPETROL', 'BCOLOMBIA', 'CORFICOLCF', 'PFBCOLOM','GRUPOSURA', 'PFAVAL', 'NUTRESA', 'PFGRUPSURA',
##'ISA', 'CEMARGOS', 'GRUPOARGOS', 'PFGRUPOARG', 'PFDAVVNDA', 'ICOLCAP', 'EEB', 'CLH', 'CE... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-06-07 16:35:27
# @Author : Yunyu2019 (yunyu2010@yeah.net)
# @Link : ${link}
# @descp : The document description
# use Pillow
import os
import argparse
from PIL import Image
def isImage(filename):
allows=('.jpg','.jpeg','.png')
... |
from ithz.fetchrss import refreshRSS
def do(id):
if id=="rss":
refreshRSS()
|
import tensorflow as tf
import numpy as np
from PIL import Image
import os
os.sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import lattice_filter_op_loader
module = lattice_filter_op_loader.module
theta_alpha = 8.0
theta_beta = 0.125
im = Image.open('Images/input.bmp')
rgb = np.arra... |
import json
import time
import requests as r
class DataRecord:
"""to record the data about xingtong"""
def __init__(self, url, filename):
self.url = url
self.filename = filename
self.record = {}
def get_follower(self):
response = r.get(self.url)
if response.status_... |
# -*- coding: utf-8 -*-
# This file as well as the whole tspreprocess package are licenced under the MIT licence (see the LICENCE.txt)
# Maximilian Christ (maximilianchrist.com), 2017
from __future__ import absolute_import, division
import numpy as np
import pandas as pd
from pandas.testing import assert_frame_equal
f... |
import random
from PathsModule import AggregateOutputPath
import os
import uuid
from getImage import getImage
from GenerateAdjecentShapesPoints import GenerateAdjecentShapesPoints
from blocksWorld import drawSolid
from CreateNewObject import CreateNewObject
from SaveData import Save
if __name__ == "__main__":
# Th... |
import unittest
class Test0006(unittest.TestCase):
def test_problem(self):
n = 100
sum_of_squares = n * (n + 1) * (2 * n + 1) / 6
square_of_sum = (n * (n + 1) / 2) * (n * (n + 1) / 2)
diff = square_of_sum - sum_of_squares
self.assertEqual(diff, 25164150) |
import asyncio
import threading
from .connection import MixerConnection
from .utils import get_channel_id
from chatrooms import lock
class MixerThread(threading.Thread):
def __init__(self, **kwargs):
super().__init__()
self.channel_id = get_channel_id(kwargs.pop("channel_name"))
self.mixer... |
#
# Copyright 2019 XEBIALABS
#
# 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, publish, distribute, subli... |
#!/bin/env python
#----------------------------------------------------------------------------
# Name: utils.py
# Purpose: utils module for Synthetico
#
# Author: Marco Visibelli
# Contact: https://github.com/marcovisibelli
#
# Created: 02/04/2017
# Copyright: (c) 2018 by Marco Visibe... |
import datetime
from os import path
import numpy as np
from PINSoftware.Debugger import Debugger
from PINSoftware.Profiler import Profiler
def remove_outliers(data):
u = np.mean(data)
s = np.std(data)
return [e for e in data if (u - 2 * s <= e <= u + 2 * s)]
class DataAnalyser():
"""
This clas... |
import unittest
import os
from openmdao.utils.code_utils import get_nested_calls
from openmdao.core.group import Group
class TestCodeUtils(unittest.TestCase):
def test_get_nested_calls(self):
devnull = open(os.devnull, "w")
graph = get_nested_calls(Group, '_final_setup', stream=devnull)
... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("RECO4")
process.load('Configuration/StandardSequences/Services_cff')
process.load('FWCore/MessageService/MessageLogger_cfi')
process.load("Configuration.StandardSequences.GeometryDB_cff")
process.load('Configuration.StandardSequences.MagneticField_AutoFr... |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 12 15:18:23 2020
@author: hoang
"""
import pandas as pd
data_NEC = pd.read_csv("./nec_data.csv")
def pulse(data):
"""
We read in salae data, then convert command field it into ascii
NEC IR relies on the space between pulses to encode the bit
... |
FOO, BAR, BAZ = range(4, 7)
|
from typing import List
from math import pi
import cellengine as ce
from cellengine.utils.generate_id import generate_id
from cellengine.payloads.gate_utils import format_common_gate
def format_quadrant_gate(
experiment_id: str,
x_channel: str,
y_channel: str,
name: str,
x: float,
y: float,
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-10-09 09:09
from __future__ import unicode_literals
from django.db import migrations, models
import django_countries.fields
class Migration(migrations.Migration):
dependencies = [
('student', '0001_initial'),
]
operations = [
... |
from django.urls import path
from .views import CreateCommentView, Comments, AllCommentsView
urlpatterns = [
path('comment/', AllCommentsView.as_view()),
path('comment/<pk>/', Comments.as_view()),
path('create/comment/', CreateCommentView.as_view()),
]
|
from __future__ import absolute_import
import sys
from unittest import TestCase as BaseTestCase
from uitools import trampoline
from uitools.qt import QtCore, QtGui, Qt
from uitools.trampoline import bounce, sleep, qpath
from mayatools.test import requires_maya
try:
from maya import cmds, mel
except ImportError:... |
import demistomock as demisto
from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import]
def _get_incident():
return demisto.incidents()[0]
def iot_resolve_alert():
incident = _get_incident()
_id = ""
for label in incident['labels']:
if label['type'] == 'id':
_id ... |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
"""
Code generation: This module is responsible for converting an SDFG into SVE code.
"""
import dace
from dace.sdfg.scope import ScopeSubgraphView
from dace.codegen.prettycode import CodeIOStream
from dace.codegen.targets.target import Ta... |
import pickle
import numpy as np
from sklearn.ensemble import IsolationForest
from sklearn.preprocessing import MinMaxScaler
from sklearn import metrics
from exercise_code.transforms import Transforms
import pandas as pd
def preprocess_y(data):
mat_train_y = np.matrix(y_raw)
prepro_y_test = MinMaxScaler()
... |
from manim import *
class SquareToCircle(Scene):
def construct(self):
circle = Circle()
square = Square()
square.flip(RIGHT)
square.rotate(-3 * TAU / 8)
circle.set_fill(PINK, opacity=0.5)
self.play(ShowCreation(square))
self.play(Transform(square, c... |
from extractFeatures import ExtractFeatures
import nltk.classify.util
from nltk.tokenize import word_tokenize
from nltk.classify import NaiveBayesClassifier
class SentiNaiveBayesClassifier:
def __init__(self):
self.classifier = None
'''
Train a naivebayes classifer with the training data.
'''
def train(self... |
import numpy as np
from scipy.optimize import minimize
from datetime import datetime # For calibration timer
class Calibrate(object):
"""
Class for calibrating a specified rBergomi model to a Surface object.
After running the passed rBergomi instance must hold calibrated results.
Need to think about ex... |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, DateTime
import sqlalchemy.sql.functions as func
Base = declarative_base()
class Article(Base):
"""
Data about a gazette that was scraped from the web
"""
__tablename__ = 'article'
id = Colum... |
# -*- coding: utf-8 -*-
from uuid import uuid4
from pyramid.security import Allow
from schematics.exceptions import ValidationError
from schematics.transforms import blacklist, whitelist
from schematics.types import StringType, BaseType, MD5Type
from schematics.types.compound import ModelType, DictType
from schematics... |
#!/usr/bin/env python
# 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... |
# Copyright 2021 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
from absl import app
from iree.tf.support import tf_test_utils
import tensorflow as tf
# Empty lists... |
from __future__ import unicode_literals
import os
import logging
from dvc.utils.compat import urlparse
from dvc.istextfile import istextfile
from dvc.exceptions import DvcException
from dvc.remote.local import RemoteLOCAL
from dvc.output.base import OutputBase, OutputAlreadyTrackedError
logger = logging.getLogger(_... |
from __future__ import print_function
import pyyed
g = pyyed.Graph()
g.add_node('foo', font_family="Zapfino")
g.add_node('foo2', shape="roundrectangle", font_style="bolditalic",
underlined_text="true")
g.add_edge('foo1', 'foo2')
g.add_node('abc', font_size="72", height="100")
g.add_node('bar', label="Mul... |
import pandas as pd
import numpy as np
# Saiyam Lakhanpal
# Github- https://github.com/Saiyamlakhanpal
class topsis:
def __init__(self, input_file, weight_str, impact_str, out_file):
self.input_file = input_file
self.weight_str = weight_str
self.impact_str = impact_str
self.out_f... |
import pytest
from rest_framework.test import APIClient
@pytest.fixture(autouse=True)
def enable_db_access(db):
pass
@pytest.fixture
def api_client():
return APIClient
|
# -*- coding: utf-8 -*-
"""
.. created on Wed Feb 14 19:40:02 2018
.. author: PE LLC peswin@mindspring.com
.. copyright: 2018, Howard Dunn. Apache 2.0 v2 licensed.
"""
def have():
try:
import clr
print('Have clr as {}'.format(clr))
except Exception as ex:
print('Don"t have clr: Not in ... |
#
# Copyright (C) 2019 Databricks, 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 i... |
import json
from crispy_forms.layout import Field, Layout, Submit
from django import forms
from crispy_forms import layout
from cradmin_legacy import renderable
from cradmin_legacy.viewhelpers import crudbase
class AbstractEditableRenderer(renderable.AbstractRenderable, forms.Form):
"""
"""
template_na... |
import logging
from string import Template
from datetime import date, timedelta
from dateutil.relativedelta import relativedelta
from babel.numbers import format_number
from eco_counter_bot.counters import counters as all_counters
from eco_counter_bot.models import CounterData, DataPoint, DateRange, Interval, Yesterd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.