content stringlengths 5 1.05M |
|---|
"""
Manual Captcha Harvester
Made by @CrepChef
"""
from utils import Logger
from flask import Flask, request, jsonify, render_template, redirect
import logging
import threading
from datetime import datetime
from time import sleep
import webbrowser
import json
tokens = []
logger = Logger()
de... |
"""
======================================
Thresholding an Image with RangeSlider
======================================
Using the RangeSlider widget to control the thresholding of an image.
The RangeSlider widget can be used similarly to the `.widgets.Slider`
widget. The major difference is that RangeSlider's ``val`... |
# apis_v1/documentation_source/position_list_for_voter_doc.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
def position_list_for_voter_doc_template_values(url_root):
"""
Show documentation about positionListForVoter
"""
required_query_parameter_list = [
{
'name': ... |
# Copyright 2014 OpenCore 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
#!/usr/bin/env python3
import argparse
import operator
import threading
import numpy as np
from time import sleep
import cv2
import depthai as dai
import socket
from common.config import NN_IMG_SIZE
from common.cscore_stream import CsCoreStream
from pipelines import goal_edge_depth_detection, object_edge_detection
i... |
import logging
from nuts.connectionhandling.connection import Connection
from nuts.inventorymanagement.inventory import Inventory
from nuts.testcreation.network_test_bundle import TestBundle
from nuts.inventorymanagement.network_test_definition_loader import TestDefinitionLoader
from nuts.testhandling.network_test_ord... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-23 07:11
from __future__ import unicode_literals
import aether.python.validators
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('kernel', '0020_... |
class cat:
""" Cat class
"""
def __init__(self, name, color, age):
self.name = name
self.color = color
self.age = age
@staticmethod
def purr():
print("purrrrrr")
class dog:
""" Dog Class
"""
def __init__(self, name, color, age):
self.name = na... |
import uuid
import os
from django.test import TestCase
from corehq.apps.receiverwrapper.util import submit_form_locally
from corehq.form_processor.tests.utils import use_sql_backend
from corehq.util.test_utils import TestFileMixin
class XMLElementTest(TestCase, TestFileMixin):
file_path = ('data',)
root = os... |
# -*- coding: utf-8 -*-
from dgp.core.controllers.controller_interfaces import VirtualBaseController
from .project import ProjectTab, AirborneProjectController
from .flight import FlightTab, FlightController
from .dataset import DataSetTab, DataSetController
__all__ = ['ProjectTab', 'FlightTab', 'DataSetTab', 'tab_fa... |
# Copyright 2019 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... |
import os
import csv
from dotenv import load_dotenv
import psycopg2
import json
from psycopg2.extras import execute_values
load_dotenv() # loads contents of the .env file into the script's environment
DB_NAME = os.getenv('DB_NAME')
DB_USER = os.getenv('DB_USER')
DB_PASSWORD = os.getenv('DB_PASSWORD')
DB_HOST = os.g... |
src_field_name = 'src'
tgt_field_name = 'tgt'
fname_field_name = 'fname'
|
import cmath
from unittest import TestCase
from ua_model.MapFromWtoT import MapFromWtoT
class TestMapFromWtoT(TestCase):
def test_validation(self):
self.assertIsInstance(MapFromWtoT(t_0=1.0, t_in=2.0), MapFromWtoT) # OK
self.assertRaises(ValueError, MapFromWtoT, t_0=-0.1, t_in=1.0) # a negati... |
from bs4 import BeautifulSoup
import requests
import os.path
import re
import pandas as pd
import numpy as np
import csv
import json
from datetime import datetime
from tqdm import tqdm
from collections import defaultdict
from collections import Counter
from IPython.core.display import HTML
import time
import nltk
impor... |
import os
import shutil
import tempfile
import numpy as np
import copy
import pytest
import unittest
import tables
import asdf
from astropy.tests.helper import remote_data
from astropy import constants as const
from astropy.table import Table
from astropy.io import fits
from beast.physicsmodel.stars.isochrone import... |
import sys, os
sys.path.append(os.path.abspath('../day 1'))
from baseclass import Solution
# imports required for solution:
class Solution_Repo(Solution):
def __init__(self):
Solution.__init__(self)
self.REPO_OWNER = "Akumatic"
self.REPO_URL = "https://github.com/Akumatic/Advent-of-Code"
... |
import time
import string
import secrets
import requests
from rich import print
from rich.markup import escape
from rich.console import Console
from paramiko import SSHClient, AutoAddPolicy
from paramiko.ssh_exception import NoValidConnectionsError
console = Console()
def generatePassword(length) -> str:
return "... |
# Time: O(r * c)
# Space: O(1)
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
class Solution(object):
def matrixScore(self, A):
"""
:type A: List[List[int]]
:rtype: int
"""
R, C = len(A), len(A[0])
result = 0
for c in x... |
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
SERVO_FREQUENCY = 50
class Servo:
def __init__(self,servoPin):
self._servoPin = servoPin
GPIO.setmode(GPIO.BCM)
GPIO.setup(servoPin, GPIO.OUT)
self.pwm = GPIO.PWM(servoPin, SERVO_FREQUENCY) # GPIO 17 for PWM with 50Hz
... |
import utilities as utils
import torch
import numpy as np
import scipy.optimize as opt
from collections import defaultdict
import math
import gurobipy as gb
#from mosek import iparam
from cvxopt import matrix, solvers
solvers.options['show_progress'] = False
#solvers.options['mosek'] = {iparam.log: 0,
# ... |
from floodsystem.stationdata import build_station_list, update_water_levels
from floodsystem.flood import stations_highest_rel_level
def run():
"""Requirements for Task 2C"""
stations = build_station_list()
update_water_levels(stations)
N = 10
flooded_stations=stations_highest_rel_level(stations,... |
from rest_framework import serializers
from .models import Mechanic, ShopInventory, PairMechanic
class ShopInventorySerializer(serializers.ModelSerializer):
class Meta:
model = ShopInventory
fields = ('part_name', 'part_price', 'car_make', 'car_model')
class PairMechanicSerializer(serializers.Mo... |
import urllib.request
import urllib.parse
import json
import requests
from sqlitedict import SqliteDict
import util
import os
db_path = 'leetcode.db'
user_agent = r'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36'
def withUrl(u):
return "https://leetco... |
from js9 import j
app = j.tools.prefab._getBaseAppClass()
class PrefabSynapsebot(app):
NAME = "synapse-bot"
def _init(self):
self.bot_repo = "https://github.com/arahmanhamdy/Matrix-NEB.git"
self.server_path = "{{CODEDIR}}/matrixbot"
def build(self, reset=False):
if self.doneChec... |
from mongoengine import connect
from models import ImmutableProductData, Materials, PieceOfClothing
connect('cf-id-example', host='mongodb://localhost', alias='default')
def init_db():
test_piece_of_clothing = PieceOfClothing(
immutable_product_data=ImmutableProductData(sku="BBBBB", brand="ChangedClothi... |
from .client import RSSFeed |
from tkinter import *
from infrastructure import DemoWindow, demo_path
import tkinter.messagebox as messagebox
SCROLLAREA_HEIGHT=1024
SCROLLAREA_WIDTH=1280
ROW_NUM=10
COLUMN_NUM=16
ROW_PAD=30
COLUMN_PAD=30
BOX_HEIGHT=(SCROLLAREA_HEIGHT/COLUMN_NUM) - COLUMN_PAD
BOX_WIDTH =(SCROLLAREA_WIDTH/ROW_NUM) - ROW_PAD
CURRE... |
from parser import parse_indentation
def main(rawdata):
parse_indentation(rawdata)
|
from ..constants import DatabaseType, EntityIdStr
def create_ner_type_anatomy(
id: str,
name: str,
synonym: str
) -> dict:
return {
EntityIdStr.ANATOMY.value: id,
'id_type': DatabaseType.MESH.value,
'name': name,
'synonym': synonym
}
def create_ner_type_chemical(i... |
#
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# 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 agr... |
import click
from kfk.commands.main import kfk
from kfk.commons import print_missing_options_for_command, create_temp_file
from kfk.kubectl_command_builder import Kubectl
from kfk.config import *
from kfk.constants import SpecialTexts
@click.option('-n', '--namespace', help='Namespace to use', required=True)
@click.... |
# tests/test_provider_davidji99_herokux.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:18:42 UTC)
def test_provider_import():
import terrascript.provider.davidji99.herokux
def test_resource_import():
from terrascript.resource.davidji99.herokux import herokux_app_container_release
fro... |
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import numpy as np
# DATA IRIS
iris = datasets.load_iris()
X = iris.data[:, [2, 3]]
y = iris.target
print('Class labels:', np.unique(y))
X_train, X_test, y_train, y_test = train_test_spli... |
# AUTOGENERATED: DO NOT EDIT
# Last update date: 2022-02-05 01:36:27.062469
from ctypes import *
from utils import *
MAXWELL_CHANNEL_GPFIFO_A: int = 0xB06F
NVB06F_NUMBER_OF_SUBCHANNELS: int = 0x8
NVB06F_SET_OBJECT: int = 0x0
NVB06F_SET_OBJECT_ENGINE_SW: int = 0x1F
NVB06F_ILLEGAL: int = 0x4
NVB06F_NOP: int = 0x8
NVB0... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Extractor for regional and provincial GeoDataframes, given into the required format
for the generation of Geopandas maps.
@author: riccardomaldini
"""
import geopandas as gpd
import pandas as pd
# Constants
RAW_REG_ITALY = gpd.read_file('https://raw.githubusercontent... |
# Amazon Bot
# Objective: Use browser automation to order an item from Amazon and have it delivered.
# WORK IN PROGRESS - NOT FINISHED YET
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
import time
import config
url = ('http://amazon.c... |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... |
# -*- encoding: utf-8 -*-
"""Extension to the standard argparse module.
"""
import argparse
class ArgparseFormatter(argparse.ArgumentDefaultsHelpFormatter,
argparse.RawDescriptionHelpFormatter):
"""Mix both formatter."""
def update_options(options, other):
for k, v in vars(other).it... |
# -*- coding: iso-8859-1 -*-
from __future__ import print_function, division
import sys
if( sys.version_info[0] == 2 ):
range = xrange
import math
import qm3.maths.rand
import qm3.maths.matrix
import copy
def stats( v ):
if( type( v ) == float ):
m = v
s = 0.0
elif( len( v ) == 1 ):
... |
"""Tests for layers.deepr"""
import pytest
import tensorflow as tf
import numpy as np
import deepr as dpr
def test_layers_sum():
"""Test for Sum"""
layer = dpr.layers.Sum()
result = layer((tf.constant(1), tf.constant(2)))
with tf.Session() as sess:
assert sess.run(result) == 3
def test_lay... |
from django.db import models
# Create your models here.
class Log(models.Model):
_from = models.CharField(max_length=255, null=False, blank=False)
to = models.CharField(max_length=255, null=False, blank=False)
# q = models.IntegerField(null=False, blank=False)
ans = models.CharField(max_length=255, ... |
# apps/posts/models.py
# Django modules
from django.db import models
from django.contrib.auth import get_user_model
from django.urls import reverse
# Define User
User = get_user_model()
# Author model
class Author(models.Model):
# Author has OneToOne relationship with the User model
# An author is belong to a us... |
import sublime_plugin
import re
from sublime_lib import show_selection_panel
TRANSFORMS = {
"hyphen": lambda words: '-'.join(words),
"underscore": lambda words: '_'.join(words),
"shouty": lambda words: '_'.join([word.upper() for word in words]),
"pascal": lambda words: ''.join([word.capitalize() for... |
import math
def get_factor_list(n):
"""
Use trial division to identify the factors of n.
1 is always a factor of any integer so is added at the start.
We only need to check up to n/2, and then add n after the loop.
"""
factors = [1]
for t in range(2, (math.ceil((n / 2) + 1))):
i... |
import typing
import torch
class LogitData(typing.TypedDict, total=False):
mask: torch.Tensor
quaternion: torch.Tensor
scales: torch.Tensor
z: torch.Tensor
xy: torch.Tensor
class CategoricalData(typing.TypedDict, total=False):
mask: torch.Tensor
quaternion: torch.Tensor
scales: torch.... |
# Load module function in Python is changed
# to look for a libmacro.so in LD_LIBRARY_PATH
import sst
import sst.macro
smallLatency = "1ps"
def getParam(params, paramName, paramNS=None):
if not paramName in params:
import sys
if paramNs:
sys.stderr.write("Missing parameter '%s' in namespace '%s'\n" % ... |
import os
import time
import random
from libs import engineLib as engine
class Event(object):##these are events, where the majority of the Engines power comes from, events can print, add/remove items to the room and player, and teleport the player to a new location without informing them. Each command can only ... |
from .shopify_checker_view import is_shopify_shop_view |
"""Recipe for deploying demoapp"""
from fabric.api import execute
from fabric.decorators import task
from orchalib import get_current_release_dir, get_app_basedir
from orchalib import tasks
@task
def print_app_version():
"""Print the currently deployed version info for the app."""
execute(tasks.print_app_ve... |
from django.contrib import admin
from core.models import *
|
import file_io
import os
def sample(avid_dir_list):
avi_dir_list = file_io.get_dir_list(avid_dir_list)
print(avi_dir_list)
for avi_dir in avi_dir_list:
avi_file_list = file_io.get_listfile(avi_dir, ".avi")
avi_file_list.sort()
for avi in avi_file_list:
image_dir = avi.r... |
#! /usr/bin/env python3
from collections import Counter
from pathlib import Path
import numpy as np
from solutions.util.parse import readFileLines
# * INFO
AOC_YEAR = 2021
AOC_DAY = 4
AOC_PROBLEM = 1
# * UTIL
scriptpath = Path(__file__).parent.resolve()
def parseLine(line: str):
line = line.replace(' '... |
import datetime
import secrets
from functools import wraps
import rethinkdb
from flask import request
from werkzeug.exceptions import NotFound, Unauthorized
TIME_ZONE_UTC = rethinkdb.make_timezone("+00:00")
ACCESS_TOKEN_LENGTH = 32
ACCESS_TOKEN_EXPIRATION = datetime.timedelta(hours=1)
REFRESH_TOKEN_LENGTH = 64
clas... |
print("Example script!")
|
import datetime
from django.core.management.base import BaseCommand
from record_form.models import PersonInfo
class Command(BaseCommand):
help = """
Saves personal information not updated in last 24 hours
Use this command in a cron job
to save older records
you can test if the subcommand works by doing:... |
TIMEOPT_CONFIG_FILE = "cfg_softConstraints_talos_kinConstraints.yaml"
from common_talos import *
SCRIPT_PATH = "demos"
ENV_NAME = "multicontact/plateforme_not_flat"
DURATION_INIT = 4. # Time to init the motion
DURATION_SS =1.8
DURATION_DS = 0.3
DURATION_TS = 0.4
DURATION_CONNECT_GOAL = 2.
w_am = 0.5
EFF_T_PREDEF =... |
from __future__ import print_function
import numpy as np
from sklearn.decomposition import NMF
from vectorize import X,F
model = NMF(6)
W = model.fit_transform(X)
H = model.components_
#print(W) # doc->topic
#print(H) # topic->word
for topic in H:
print()
for w,t in sorted(zip(topic,F),reverse=True):
if w<0.00... |
# dicom operations
import os
import os.path as op
import logging
from collections import OrderedDict
import tarfile
from heudiconv.external.pydicom import dcm
from .utils import SeqInfo, load_json, set_readonly
lgr = logging.getLogger(__name__)
def group_dicoms_into_seqinfos(files, file_filter, dcmfilter, grouping)... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/main_window.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
M... |
from pyflink.table import EnvironmentSettings, BatchTableEnvironment
from customer_denorm import CustomerDenorm
# create a flink table env in batch mode
# ------------------------------------------------------------
env_settings = EnvironmentSettings \
.new_instance() \
.in_batch_mode()... |
from typing import Counter, Dict, List, Set
from aocd import lines
CaveSystem = Dict[str, Set[str]]
def parse(input: List[str] = lines):
system: CaveSystem = {}
for line in input:
[x, y] = line.split("-")
system[x] = system[x].union([y]) if x in system else set([y])
system[y] = syst... |
#!/usr/local/bin/python3.6
"""
Create CSVs from healthcare.gov data extracted from files or from the website directly.
The data is filtered by plan_ids for a given state and by provider address to include
only in-state (or neighboring state) addresses.
The CSVs are output into data/healthcare_gov/[issuer_id].csv
Thi... |
# coding: utf-8
# Created on: 15.01.2018
# Author: Roman Miroshnychenko aka Roman V.M. (roman1972@gmail.com)
import scrapy
class VideosSpider(scrapy.Spider):
"""Parse videos from vidsplay.com"""
name = 'videos'
start_url = 'https://www.vidsplay.com'
def start_requests(self):
"""Entry point f... |
#!/usr/bin/env python3
"""
Tests for the inner product Tensorflow operation.
.. moduleauthor:: David Stutz
"""
import unittest
import numpy as np
import tensorflow as tf
import _inner_product_grad
inner_product_module = tf.load_op_library('libinner_product.so')
class InnerProductOpTest(unittest.TestCase):
def te... |
import hashlib
import hmac
from urllib.parse import urlencode, quote_plus
import os
import requests
import json
from base.api import BaseApi
from config.settings import *
CURRENCY_PAIR_BTC_JPY = 'btc_jpy'
END_POINT = 'https://api.zaif.jp/api/1'
END_POINT_LATEST_TRADE = 'https://api.zaif.jp/tapi'
NONCE_FILE = 'zaif_n... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
# python_lists.py
# Julie M. Anderson
# samples of lists in python
# Lists are heterogenous in python
aList = [1, 2.0, "aString", False]
print "A heterogenous list: ", aList
# Operations on lists
sampleList = [1, 2, 3, 4]
print "My sample list: ", sampleList
# indexing using []
print "sampleList[1]: " , sampleL... |
from django.contrib import admin
from friendship.models import Friendship
# Register your models here.
# Register your models here.
class FriendshipAdmin(admin.ModelAdmin):
list_display = ['req_from', 'req_to', 'is_accepted', 'created_at', 'updated_at']
admin.site.register(Friendship, FriendshipAdmin) |
import concurrent.futures
import functools
import threading
class Controller:
def __init__(self):
self.ok = False
def start(self):
self.ok = True
def stop(self):
self.ok = False
|
# This Python file uses the following encoding: utf-8
""" Subject line.
Main text.
"""
from unittest import TestCase
from classes.Index import index_for
from classes.Variable import Variable
__author__ = 'Chao Li'
class TestIndexFor(TestCase):
def setUp(self):
self.A = Variable(1, "A", ['a1', 'a2', 'a... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0002_auto_20150601_1042'),
]
operations = [
migrations.RemoveField(
model_name='category',
... |
$NetBSD: patch-breezy_tests_test__server.py,v 1.1 2019/10/27 13:05:46 rhialto Exp $
Stub out call to shutdown() since it mysteriously fails with
an OSError exception with EINVAL.
See https://bugs.launchpad.net/brz/+bug/1849971
--- breezy/tests/test_server.py.orig 2019-06-16 22:18:58.000000000 +0000
+++ breezy/tests/... |
import logging
import argparse
import random
import requests
from resources.banner import banner
from resources.headers import user_agents
from assets.colors import green,red,white,reset
logging.basicConfig(format=f"%(asctime)s {white}%(message)s{reset}"
,datefmt=f"{white}%I{green}:{white}%M{green}:{white}%S%p",level=... |
from __future__ import print_function
import json
import sys
import traceback
import os
from ircutils import bot
import commands
import custom_commands
class berry(bot.SimpleBot):
def __init__(self, config):
nick = config['nick'].encode('ascii', 'replace')
bot.SimpleBot.__init__(self, nick)
... |
from pineapple_core.core.node import node
@node(module="String", name="ToInt", autotrigger=True)
def string_to_int_node(a: str) -> int:
return int(a)
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-12-21 04:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AlterField(
... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021 Scipp contributors (https://github.com/scipp)
import ess.wfm as wfm
import scipp as sc
import scippneutron as scn
import pytest
def test_basic_stitching():
frames = sc.Dataset()
shift = -5.0
frames['time_min'] = sc.array(dims=['frame'], values=[... |
#!/usr/bin/env python
import sys
class Rule:
def __init__(self,exp):
self.pred = None
self.exp = exp
if len(self.exp) == 0:
self.exp.append('')
class NTerm:
def __init__(self):
self.rules = []
self.first = None
self.follow = None
nterm = {}
nt_list = []
used = set()
def First(k)... |
from datetime import datetime
from typing import Optional
import pytz
from sqlalchemy.orm import Session
from app import services
from app.exceptions.instance_not_found import (
CarNotFoundException,
CustomerNotFoundException,
ReservationNotFoundException,
)
from app.exceptions.reservation import StartDat... |
# Copyright (c) 2019, CMCC Technologies Co., Ltd.
# Copyright 2019 ZTE 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 requ... |
import numpy as np
from PIL import Image
import h5py
import random as rng
import matplotlib.pyplot as plt
from PIL import ExifTags
import scipy.misc
class Patcher():
def __init__(self, _img_arr, _lbl_arr, _dim, _stride=(4,4), _patches=None, _labels=None):
self.img_arr = _img_arr
if _lb... |
from pprint import pprint
import time
from multiln.rpccaller import RpcCaller
def btc_init_bitcoind_global(chains):
to_return = {}
for chain_name in chains:
port_chain = '185%s5' % (chains[chain_name]['port_decimal'])
to_return[chain_name] = RpcCaller(
'%s:%s' % (chains[chain_name... |
'''
Deduplication of near duplicates
================================
Remove nears duplicates of projects from the data. Numeric
fields (such as funding) are aggregated together.
'''
import logging
import luigi
import datetime
from nesta.packages.misc_utils.batches import split_batches, put_s3_batch
from nesta.core.... |
import unittest
import tempfile
import os
from habitipy.api import parse_apidoc, ApiEndpoint
test_data = """
@api {post} /api/v3/user/webhook Create a new webhook - BETA
@apiParam (Body) {UUID} [id="Randomly Generated UUID"] The webhook's id
@apiParam (Body) {String} url The webhook's URL
@apiParam (Body) {String} [la... |
import math
import logging
import glob
import numpy as np
from sparse_ct.reconstructor_2d import (
SartReconstructor,
SartBM3DReconstructor,
DgrReconstructor,
N2SelfReconstructor)
from . imp... |
import numpy as np
from tqdm import tqdm
import sys
import os
import re
from mpl_toolkits.mplot3d import axes3d
lib_path = os.getcwd()
sys.path.append(f'{lib_path}')
class MyAxes3D(axes3d.Axes3D):
def __init__(self, baseObject, sides_to_draw):
self.__class__ = type(baseObject.__class__.__name__,
... |
from stock.models import StockInfo, CapitalStockAmountHistory, TradeRecord, IndexRecord
from django.db.models import Max
# from stock.controllers import send_email
def get_covariance(x, y):
avg_x = sum(x) / len(x)
avg_y = sum(y) / len(y)
sum_all = 0.0
for i in range(len(x)):
sum_all += (x[i] ... |
import re
import hashlib
import datetime
import dateparser
import humanize
class Task:
def __init__(self):
self.text = None
self.meta = {
'id': '',
'created': datetime.datetime.now(),
'updated': datetime.datetime.now()
}
def fillFromStoredLine(self,... |
#!/usr/bin/env python
# coding: utf-8
# # <center>Lab 1</center>
# ## <center> Optical Digit Recognition </center>
# 
# ### Description:
# The scope of this exercise is the implementation of __an optical digit recognition system__. Our dataset comes from __US Postal Service__, ... |
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 2 16:40:26 2020
@author: Leonardo
University of Oxford - Department of Computer Science - AE03
"""
# NEXT FEATURES!
# Retry system. If something fails or is not doing correctly. Stop and retry.
# Verification of existing processes to be closed before star... |
from django.contrib import admin
from .models import Product
# Register your models here.
class MyProduct(Product):
class Meta:
proxy = True
class MyProductAdmin(admin.ModelAdmin):
def get_queryset(self, request):
return self.model.objects.filter(product_selected = True)
def unselec... |
import sys
import os
import operator
from tree3 import *
from pymongo import MongoClient
from werkzeug import secure_filename
from datetime import datetime
import thread,time
import os
client = MongoClient('mongodb://localhost:27017/')
db = client.ir
path=os.getcwd()+"/JVcode/Scripts/ForClassification"
#path=os.getcwd(... |
#!usr/bin/python
# regexlib.py
#
# Copyright 2009 ahmed youssef <xmonader@gmail.com>
#
# 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... |
# Order of People Heights
# https://www.interviewbit.com/problems/order-of-people-heights/
#
# You are given the following :
#
# A positive number N
# Heights : A list of heights of N persons standing in a queue
# Infronts : A list of numbers corresponding to each person (P) that gives the number of
# persons who are t... |
#!/user/bin/python2
# -*- coding: utf-8 -*-
import random
import math
from ml_base import ml_base
from evaluator import evaluator
class logistic_regressor(ml_base):
def __init__(self, dataset, test_rate, train_round=300,
normalization=None, batch_size=32, learning_rate=0.005):
ml_base.__i... |
import time
import unittest
from robot import COAST
from robot.robot import Robot
from tests.mock_robotd import MockRobotDFactoryMixin
class MotorBoardTest(MockRobotDFactoryMixin, unittest.TestCase):
def setUp(self):
mock = self.create_mock_robotd()
mock.new_powerboard()
time.sleep(0.2)
... |
from .lut_tools import (
create_dolby_vision_config,
read_cal_file,
read_cube_file,
unity_lut_1d,
unity_lut_3d,
write_dolby_vision_config,
)
from .webos_client import PyLGTVCmdException, PyLGTVPairException, WebOsClient
__all__ = [
"create_dolby_vision_config",
"read_cal_file",
"rea... |
from bs4 import BeautifulSoup
import requests
import os
def visit_page(url):
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36'
}
r = requests.get(url, headers = headers)
r.encoding = 'utf-8'
sou... |
# Copyright 2021 The Android Open Source Project
#
# 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 a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.