content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
## Problem: Finding Numbers in a Haystack
# use regex library
import re
# open file for reading
# save the file into the same directory
textfile_handle = open("regex_sum_42.txt")
# list of all numbers found so far
num_all_list = list()
# read through and parse a file with text and numbers
# loop over every line of ... | nilq/baby-python | python |
from numpy import asarray
from datetime import datetime, timedelta
from PyQt5.QtCore import Qt
from PyQt5.QtChart import QChart, QLineSeries, QBarCategoryAxis, QValueAxis
from PyQt5.QtGui import QPainter
from core import AppCore
from widget.GeometryRestoreWidget import GeometryRestoreWidget
from gen.ui_AnalysisWidget ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: task.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import... | nilq/baby-python | python |
import os
DB_HOST = os.environ["REDIS_HOST"]
DB_PORT = int(os.environ["REDIS_PORT"])
DB_NAME = int(os.environ["REDIS_ID"])
DB_QUEUE = os.environ["INPUT_QUEUE"]
BATCH_SIZE = 16
SERVER_SLEEP = 0.25
| nilq/baby-python | python |
#!/usr/bin/env python
import roslib
import rospy
import math
import time
import numpy as np
import os
from std_msgs.msg import Int32MultiArray
from std_msgs.msg import Int32
from rospy_tutorials.msg import Floats
from gpiozero import PWMOutputDevice
#initialize all variables
#current positon
Xc=0
Yc=0
#fi... | nilq/baby-python | python |
from datetime import datetime
from django import forms
from .models import Location
class StrikeFilterForm(forms.Form):
daterange = forms.CharField(label='Date', max_length=23)
country__name = forms.ChoiceField(label='Country', choices=())
province = forms.CharField(label='Province', max_length=100, requi... | nilq/baby-python | python |
"""Model generation"""
from abc import ABC
from collections import namedtuple
from copy import copy
import functools
import itertools
import numpy as np
from scipy.special import expit # pylint: disable = no-name-in-module
import sympy
from sympy.utilities.lambdify import lambdify
from synmod import constants
from ... | nilq/baby-python | python |
# -*- coding: UTF-8 -*-
# Copyright 2011-2018 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""Desktop UI for this plugin.
Documentation is in :doc:`/specs/users` and :doc:`/dev/users`
"""
from __future__ import unicode_literals
from textwrap import wrap
from django.conf import settings
from django.d... | nilq/baby-python | python |
"""
Checks the bam header:
* to make sure all rgs have the same sample
* enforce PL to be ILLUMINA
Writes out a new header with the aliquot submitter id as the SM
and/or PL as ILLUMINA as needed.
@author: Kyle Hernandez
"""
import os
import time
import sys
import pysam
import argparse
import logging
PLATFORM = "ILL... | nilq/baby-python | python |
from AndroidFTPBackup.utils import FileHelper, ConfigHelper
configHelper: ConfigHelper = None
fileHelper: FileHelper = None
| nilq/baby-python | python |
# python3
import sys, threading
from collections import deque
def compute_height_brute_force(n, parents):
# Replace this code with a faster implementation
max_height = 0
for vertex in range(n):
height = 0
current = vertex
while current != -1:
height += 1
curr... | nilq/baby-python | python |
import time
import pickle # To work with cookies
import json
from selenium.webdriver.support.wait import WebDriverWait
class Login():
def __init__(self, driver, profile, password):
self.profile = profile
self.driver = driver
self.password = password
def run(self):
self.driver... | nilq/baby-python | python |
a = (2 ** 2)
b = (2 ** 2)
c = 2
print("a ** b ** c =", a ** b ** c)
| nilq/baby-python | python |
# Code adapted from Fei Xia
import glob
import os
import cv2
import meshcut
import numpy as np
from tqdm import tqdm
from PIL import Image
def load_obj_np(filename_obj, normalization=False, texture_size=4, load_texture=False,
texture_wrapping='REPEAT', use_bilinear=True):
"""Load Wavefront .ob... | nilq/baby-python | python |
import os.path
import ranger.api
import ranger.core.fm
import ranger.ext.signals
from subprocess import Popen, PIPE
hook_init_prev = ranger.api.hook_init
def hook_init(fm):
def zoxide_add(signal):
path = signal.new.path
process = Popen(["zoxide", "add", path])
process.wait()
fm.signal... | nilq/baby-python | python |
from __future__ import division
# These functions have their own module in order to be compiled with the right
# __future__ flag (and be tested alongside the 2.x legacy division operator).
def truediv_usecase(x, y):
return x / y
def itruediv_usecase(x, y):
x /= y
return x
| nilq/baby-python | python |
# 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... | nilq/baby-python | python |
"""
Manage sound and music
"""
from engine.const import CONST
snd_manager = None
class SndManager():
def __init__(self):
self.sounds = {}
self.permanent_sound = []
self.playlist = []
self.music_index = 0
self.music = None
self.sounds_playing = []
def set_play... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base
import cw
class Summary(base.CWBinaryBase):
"""見出しデータ(Summary.wsm)。
type:見出しデータには"-1"の値を付与する。
"""
def __init__(self, parent, f, yadodata=False, nameonly=False, materialdir="Material", image_export=True,
wpt120=Fa... | nilq/baby-python | python |
from django.urls import path
from moim.views import *
urlpatterns = [
path('', MoimView.as_view()),
path('<int:moim_id>/', MoimDetailView.as_view()),
path('<int:moim_id>/apply/', MoimApplyView.as_view())
]
| nilq/baby-python | python |
#
# PySNMP MIB module PPP-SEC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PPP-SEC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:41:52 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | nilq/baby-python | python |
import random
import math
Menor = int(input("Insira o menor limite : "))
Maior = int(input("Insira o maior limite : "))
## Retorna um número entre os x e y (Os 2 inclusos)
Rand = random.randint(Menor,Maior)
# Número mínimo de adivinhação = log 2 (limite superior - limite inferior + 1)
print("\n\t\tVocê tem apena... | nilq/baby-python | python |
class News:
def __init__(self,title,description,urlToImage,content,url):
self.title=title
self.description=description
self.urlToImage=urlToImage
self.content=content
self.url=url
class Sources:
def __init__(self, id, name, description, url, category):
self.id =... | nilq/baby-python | python |
"""Some utilities for caching pages."""
import zlib
from beaker.util import func_namespace
from mako.runtime import capture
def cache_content(request, key, do_work):
"""Argh!
Okay, so. Use this when you want to cache the BODY of a page but not
the CHROME (i.e., wrapper or base or whatever).
``requ... | nilq/baby-python | python |
import os
import pickle
import numpy as np
import soundfile as sf
from scipy import signal
from scipy.signal import get_window
import librosa
from librosa.filters import mel
from numpy.random import RandomState
from pathlib import Path
import ipdb
from tqdm import tqdm
def butter_highpass(cutoff, fs, order=5):
nyq... | nilq/baby-python | python |
import tkinter as tk
from tkinter import messagebox as mbox
from tkinter import filedialog
from Phase0 import phase0
from Phase0_1 import phase0_1
from Phase1 import phase1
from Phase2 import phase2
from Phase3 import phase3
from form_viewer import form_viewer
#Tk class generating
root = tk.Tk()
# screen size
ro... | nilq/baby-python | python |
import numpy as np
import os
import tensorflow as tf
from sandbox.rocky.tf.optimizers.conjugate_gradient_optimizer import FiniteDifferenceHvp, ConjugateGradientOptimizer
from hgail.algos.gail import GAIL
import auto_validator
import hyperparams
import utils
# setup
args = hyperparams.parse_args()
exp_dir = utils.s... | nilq/baby-python | python |
# Copyright (c) 2019, CMCC Technologies Co., Ltd.
# Copyright (c) 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... | nilq/baby-python | python |
# Computes the transition temperature Tc from the temperature dependence of the leading
# Bethe-Salpeter eigenvalue.
#
# Usage: python compute_tc.py T=*
#
# Author: Urs R. Haehner (haehneru@itp.phys.ethz.ch)
import numpy as np
from scipy import optimize
from matplotlib import pyplot as plt
import h5py
import os
import... | nilq/baby-python | python |
import numpy as np
import openslide
import sys
import os
from PIL import Image
from color_norm.color_normalize import reinhard_normalizer
def white_ratio(pat):
white_count = 0.0
total_count = 0.001
for x in range(0, pat.shape[0]-200, 100):
for y in range(0, pat.shape[1]-200, 100):
p = p... | nilq/baby-python | python |
import win32ui
import pyautogui
from win10toast import ToastNotifier
path = pyautogui.prompt('Please enter the path below:')
path = path+"/?"
pyautogui.keyDown("win")
pyautogui.press("r")
pyautogui.keyUp("win")
pyautogui.typewrite("cmd")
pyautogui.press("enter")
pyautogui.press("enter")
pyautogui.typ... | nilq/baby-python | python |
# Copyright 2021 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... | nilq/baby-python | python |
from lib.base import PowerDNSClient
class SuggestZone(PowerDNSClient):
def _run(self, *args, **kwargs):
return self.api.suggest_zone(*args, **kwargs)
| nilq/baby-python | python |
"""
The :mod:`websockets.server` module defines a simple WebSocket server API.
"""
import asyncio
import collections.abc
import email.message
import logging
from .compatibility import asyncio_ensure_future
from .exceptions import InvalidHandshake, InvalidOrigin
from .handshake import build_response, check_request
fr... | nilq/baby-python | python |
import os
from pylearn2.utils import serial
from theano import tensor as T
from theano import function
from pylearn2ext.chbmit import CHBMIT
from tests.plot_eeg import plot_eeg_predict_seizure_period
def predict_plot(model_path, dataset):
"""
Script to perform seizure detection and plot the results.
Pa... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import os
import random
import time
class IdWorker(object):
def __init__(self, worker_id, host_id):
self.worker_id = worker_id
self.host_id = host_id
self.logger = logging.getLogger("idworker")
# stats
self.ids... | nilq/baby-python | python |
""" CPG locomotion controller. """
import itertools
import os
from argparse import ArgumentParser
from pathlib import Path
import farms_pylog as pylog
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import yaml
from farms_container import Container
from farms_network.networkx_model import Net... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import socket
import threading
import datetime
#from threading import Lock
from Utils import DebugLock as Lock
from Utils import Utils
try:
from Event import Event
from NaptSocket import NaptSocket, NaptSocketStatus
from NaptConnectionEve... | nilq/baby-python | python |
import cv2
cap = cv2.VideoCapture(0)
fgbg =cv2.createBackgroundSubtractorMOG2()
while (1):
ret, frame = cap.read()
fgmask = fgbg.apply(frame)
edges = cv2.Canny(fgmask,100,200)
cv2.imshow('Original', frame)
cv2.imshow('MOG2', fgmask)
cv2.imshow('Output', edges)
k = cv2.waitKey(30) & 0xff
if k == 27:
break
... | nilq/baby-python | python |
import argparse
import logging
import string
import jsonlines
from Levenshtein import distance
from tqdm.auto import tqdm
from src.models.bart_seq2seq_kilt import BartSeq2Seq
from src.models.bert_binary_kilt import BertBinary
from src.utils import batch_it, chunk_it
def normalize(sent):
return (
sent.lo... | nilq/baby-python | python |
from ._base import *
from ..tinygrail.bigc import BigC
from ..tinygrail.model import TBid
@click.command()
@click.argument("player_name", type=TG_PLAYER)
@click.argument("character_ids", type=int, nargs=-1)
def force_view(player_name, character_ids):
for cid in character_ids:
big_c = BigC(player_name, cid... | nilq/baby-python | python |
from algosdk.v2client.indexer import IndexerClient
from algosdk.v2client.algod import AlgodClient
from tinyman.v1.client import TinymanMainnetClient
from tinyman.v1.pools import get_pool_info_from_account_info
import datetime
import statistics
class AlgoTools:
def __init__(self, address = None):
### Setup ... | nilq/baby-python | python |
#!/usr/bin/env python
import unittest
class test_sample_hook(unittest.TestCase):
def test_nothing(self):
#do nothing
return
| nilq/baby-python | python |
# coding: utf-8
import responses
import os
import json
import io
import watson_developer_cloud
from watson_developer_cloud.discovery_v1 import TrainingDataSet, TrainingQuery, TrainingExample
try:
from urllib.parse import urlparse, urljoin
except ImportError:
from urlparse import urlparse, urljoin
base_discove... | nilq/baby-python | python |
import glob
import datetime
import string
import pandas as pd
current_year = datetime.datetime.today().year
def age_binner(age):
if age < 5:
return "04 and under"
elif 5 <= age <= 9:
return "05 to 09 years"
elif 10 <= age <= 14:
return "10 to 14 years"
elif 15 <= age <= 19:
... | nilq/baby-python | python |
class MethodsManager:
"""My Methods Manager
"""
def __init__(self):
self.heap = {}
def insert(self, elems):
"""Insert for main
Args:
elems (list): Tokens form user input
"""
if elems[1][0].isupper():
name = elems[1]
# I have ... | nilq/baby-python | python |
from dataclasses import asdict
from dataclasses import dataclass
from dataclasses import field
from typing import List
from unittest import mock
from unittest.case import TestCase
from lxml.etree import Element
from lxml.etree import QName
from tests.fixtures.books import BookForm
from tests.fixtures.books import Boo... | nilq/baby-python | python |
# Morando Nicolò
import pandas as pd
file_path = 'filepath.csv'
data = pd.read_csv(file_path)
data.describe()
| nilq/baby-python | python |
# 0611.py
"""
ref: https://gist.github.com/jsheedy/3913ab49d344fac4d02bcc887ba4277d
ref: http://felix.abecassis.me/2011/09/opencv-morphological-skeleton/
"""
import cv2
import numpy as np
#1
src = cv2.imread('./data/T.jpg', cv2.IMREAD_GRAYSCALE)
##src = cv2.imread('alphabet.bmp', cv2.IMREAD_GRAYSCALE)
#... | nilq/baby-python | python |
import dicom
import argparse
import pylab
import os
import tqdm
parser = argparse.ArgumentParser(description="由dicom格式文件生成png图片")
parser.add_argument("origin", help="文件源路径(文件或文件夹)")
parser.add_argument("--output", "-o", help="输出路径", default="./")
argv = parser.parse_args()
def get_path_filelist(path):
files = ... | nilq/baby-python | python |
import platform
from selenium.webdriver import Chrome, DesiredCapabilities
from selenium.webdriver.chrome.options import Options
from tests.util.web.platform.browser.generic import ManagedBrowser
class ChromeManagedBrowser(
ManagedBrowser
):
"""
ChromeManagedBrowser provides a Chrome edition of ManagedT... | nilq/baby-python | python |
from __future__ import absolute_import
# import models into model package
from .v1_persistent_volume import V1PersistentVolume
from .v1_tcp_socket_action import V1TCPSocketAction
from .v1_resource_quota_status import V1ResourceQuotaStatus
from .v1_container_state_terminated import V1ContainerStateTerminated
from .v1_r... | nilq/baby-python | python |
from .logger import get_logger
| nilq/baby-python | python |
from django.test import TestCase
from django.core.management import call_command
from databuilder.tests import utils
from databuilder import models
# noinspection SpellCheckingInspection
sample_name = 'Bob Bobski'
class TestTask1(TestCase):
def setUp(self):
self.model_name = models.SampleTest.__name__.l... | nilq/baby-python | python |
import argparse
import os
import xml.etree.ElementTree as ET
import sys
import configparser
import os
from os import path
import codecs
import re
parser = argparse.ArgumentParser()
parser.add_argument("-raw_path", default='../raw_data/xml/schaeftlarn')
parser.add_argument("-save_path", default='../raw_data/stories/la'... | nilq/baby-python | python |
#name: CurateChemStructures
#description: curating a molecules set for structural data homogenization
#top-menu: Chem | Curate...
#language: python
#sample: chem/chem_standards.csv
#tags: demo, chem, rdkit
#input: dataframe data [Input data table]
#input: column smiles {type:categorical; semType: Molecule} [Molecules,... | nilq/baby-python | python |
import json
import falcon
class HealthCheck:
def on_get(self, req, resp):
resp.body = json.dumps({'status': 'happy and health!'})
resp.status = falcon.HTTP_200
| nilq/baby-python | python |
import attr
from operator import itemgetter, methodcaller, attrgetter
from django.conf import settings
import spacy
from .service import Service
from .states import states
from .loaders import table_loader
from .language_model import nlp
from ..forms import QuestionForm
@attr.s
class NlpMiddleware:
get_respon... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
This module contains all functions for response of optical elements.
Created on Wed May 22 12:15:23 2019
@author: Swarnav Banik
sbanik1@umd.edu
"""
import numpy as np
import numpy.fft as fourier
import scipy as scp
from PIL import Image
# %% Common Functions ####################... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
"""
Created on Fri May 4 13:43:46 2018
@author: xingshuli
"""
import os
from keras.optimizers import SGD
from keras.preprocessing.image import ImageDataGenerator
from keras import backend as K
#from NIN_16 import NIN16
#fro... | nilq/baby-python | python |
from flask_login import current_user
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField, FileField
from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError
from flask_wtf.file import FileField, FileAllowed, FileRequired
from app.models ... | nilq/baby-python | python |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
fromFT = ee.FeatureCollection("users/wqs/Pipestem/Pipestem_HUC10")
# This function computes the feature's geometry area and adds it as a property.
def addArea(feature):
return feature.set({'areaHa': feature.... | nilq/baby-python | python |
import keras
# initializer = keras.initializers.glorot_uniform(seed=0)
initializer = keras.initializers.glorot_normal()
"""
Creates Residual Network with 50 layers
"""
def create_model(input_shape=(64, 64, 3), classes=1):
# Define the input as a tensor with shape input_shape
X_input = keras.lay... | nilq/baby-python | python |
from typing import Union, List, Any
from ..core.client import ClientBase
from ..core.connect import AsyncTCPConnection
Key = Union[int, float, str]
class MasterClient(ClientBase):
def get_shard(self, key):
return self._execute("get_shard", key)
def get_map(self):
return self._execute("get_ma... | nilq/baby-python | python |
from fastapi import APIRouter, HTTPException
import pandas as pd
import plotly.express as px
import numpy as np
import plotly.graph_objects as go
router = APIRouter()
@router.get('/vizprices')
async def visual():
# load in airbnb dataset
DATA_PATH = 'https://raw.githubusercontent.com/Air-BnB-2-BW/data-science... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from unittest import TestCase
from tests.utils import assert_equal_dict
from polyaxon_schemas.ml.hooks import StepLoggingTensorHookConfig
from polyaxon_schemas.ml.processing.pipelines import TFRecordSequencePipelineConfig
from p... | nilq/baby-python | python |
from cereal import car
from common.realtime import DT_CTRL
from common.numpy_fast import clip
from common.params import Params
from selfdrive.car import apply_std_steer_torque_limits
from selfdrive.car.hyundai.hyundaican import create_lkas11, create_clu11, create_lfahda_mfc, \
... | nilq/baby-python | python |
#!/usr/bin/env python3
# Copyright (c) 2019 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
from itertools import product
from shared import PLATFORMS, TRUE_FALSE, VS_VERSION, make_win_artifact_name
if __name__ == "__main__":
for platform, uwp in product(PLATFORMS, TRUE_FALSE):
print(make_w... | nilq/baby-python | python |
import tkinter as tk
class DashboardGUI:
def __init__(self, master, interpreter):
self.master = master
self.interpreter = interpreter
h = 316
w = 480
self.top_bar_canvas = tk.Canvas(master,bg="black",height=h,width=w/20)
self.top_bar_canvas.grid(row=0,column=0,rowspan=2)
self.time_text = self.top_bar_... | nilq/baby-python | python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time, random
import numpy as np
import tensorflow as tf
from tensorflow.python.layers import core as layers_core
import argparse
from tensorflow.python.client import device_lib
import os
from u... | nilq/baby-python | python |
import numpy as np
from ..Tools.Downloading._ReadDataIndex import _ReadDataIndex
from .. import Globals
def ReadIndex(subcomp,L,prod):
'''
Reads the index file for a given data product.
Inputs
======
subcomp : string
Name of sub component of instrument
L : int
Level of data to download
prod : str
Data p... | nilq/baby-python | python |
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2007-2020 NV Access Limited, Peter Vágner
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
import time
import nvwave
import threading
import queue
from ctypes import cdll
fro... | nilq/baby-python | python |
import mock
import pytest
from django import forms
from django.db import models
from filer.models import Image
from barbeque.filer import FilerFileField, AdminFileFormField
from barbeque.tests.factories.filer import ImageFactory
class FileModel(models.Model):
file1 = FilerFileField(null=True)
file2 =... | nilq/baby-python | python |
import shutil
from pathlib import Path
import dask.dataframe as dd
import numpy as np
import pandas as pd
from bokeh.io import export_png
from bokeh.io import output_file
from bokeh.models import Column
from bokeh.models import Div
from bokeh.plotting import figure
from bokeh.plotting import save
from sid.colors impor... | nilq/baby-python | python |
import sys, logging, time, resource, gc, os
import multiprocessing
from multiprocessing import Pool
from util import print_datetime
import numpy as np
import gurobipy as grb
import torch
def estimate_weights_no_neighbors(YT, M, XT, prior_x_parameter_set, sigma_yx_inverse, X_constraint, dropout_mode, replicate):
"... | nilq/baby-python | python |
# visualizer.py
# Contains functions for image visualization
import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
import random
import skimage.io as io
import torch
from operator import itemgetter
from PIL import Image
from torchvision import datasets, models, transforms
from metrics import getPercent... | nilq/baby-python | python |
import os
import pandas as pd
# Configuration and constant definitions for the API
# Search
TEMPLATES_INDEX_FILENAME = 'templates.pkl'
SEARCH_INDEX_FILENAME = 'index_clean.pkl'#os.path.join('images', 'index_4.df')
SEARCH_READER_FN = pd.read_pickle
SEARCH_COLUMNS = ['fusion_text_glove', 'title_glove', 'ocr_glove', 'i... | nilq/baby-python | python |
from setuptools import setup, find_packages
setup(
name='acl-iitbbs',
version='0.1',
description='Fetch attendance and result from ERP and Pretty Print it on Terminal.',
author='Aman Pratap Singh',
author_email='amanprtpsingh@gmail.com',
url='https://github.com/apsknight/acl',
py_modules=['... | nilq/baby-python | python |
'''helper functions to deal wit datetime strings'''
from __future__ import unicode_literals, print_function
import re
from datetime import datetime
# REGEX!
DATE_RE = r'(\d{4}-\d{2}-\d{2})|(\d{4}-\d{3})'
SEC_RE = r'(:(?P<second>\d{2})(\.\d+)?)'
RAWTIME_RE = r'(?P<hour>\d{1,2})(:(?P<minute>\d{2})%s?)?' % (SEC_RE)
AMP... | nilq/baby-python | python |
class SofaException(Exception):
def __init__(self, message):
super(SofaException, self).__init__(message)
class ConfigurationException(SofaException):
def __init__(self, message):
super(ConfigurationException, self).__init__(message)
| nilq/baby-python | python |
#!/usr/bin/env python
#
# Copyright (c) 2013-2018 Nest Labs, 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/licen... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- Coding: UTF-8 -*-
# @Time : 12/8/18 7:02 PM
# @Author : Terry LAI
# @Email : terry.lai@hotmail.com
# @File : keyboard.py
from pymouse import PyMouse
from pykeyboard import PyKeyboard
from socket import socket, AF_INET, SOCK_STREAM
port = 20000
# -*- coding: utf-8 -*-
client_addr... | nilq/baby-python | python |
from mock import MagicMock, patch
import unittest
from cassandras3.cli.restore import do_restore
from cassandras3.util.nodetool import NodeTool
class TestRestoreClient(unittest.TestCase):
@patch('cassandras3.cli.restore.ClientCache')
@patch('cassandras3.cli.restore.NodeTool')
def test_restore(self, nodet... | nilq/baby-python | python |
import csv
import datetime
import json
import logging
import os
import time
import click
import structlog
from dsaps import helpers
from dsaps.models import Client, Collection
logger = structlog.get_logger()
def validate_path(ctx, param, value):
"""Validates the formatting of the submitted path"""
if value... | nilq/baby-python | python |
from datetime import date, datetime, timedelta
#Yesterday as the request date for the client
def get_request_date():
dt = datetime.today() - timedelta(days=1)
return dt.strftime('%Y-%m-%d') | nilq/baby-python | python |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function
from astropy.extern.six import BytesIO
from astropy.table import Table
from ..query import BaseQuery
from ..utils import commons
from ..utils import async_to_sync
from . import conf
__all__ = ['Heasarc', 'HeasarcClass... | nilq/baby-python | python |
"""
'FRAUDAR: Bounding Graph Fraud in the Face of camouflage'
Spot fraudsters in the presence of camouflage or hijacked accounts. An algorithm that is camouflage-resistant,
provides upper bounds on the effectiveness of fraudsters, and the algorithm is effective in real-world data.
Article: https://bhooi.github.io/p... | nilq/baby-python | python |
"""
dear Nessus dev, if you want to see where there is issues with your REST API, please modify `lying_type` and
`lying_exist` to become NOP
"""
import functools
from typing import TypeVar, Mapping, Union, Callable, Any, Optional
T = TypeVar('T')
U = TypeVar('U')
V = TypeVar('V')
JsonType = Union[int, str, bool]
c... | nilq/baby-python | python |
from .models import redshiftdata_backends
from ..core.models import base_decorator
mock_redshiftdata = base_decorator(redshiftdata_backends)
| nilq/baby-python | python |
import time
import unittest
from cryptography.shell_game import ShellGame
class ShellGameTests(unittest.TestCase):
def setUp(self):
self.start_time = time.time()
def tearDown(self):
t = self.start_time - time.time()
print("%s: %.3f" % (self.id(), t))
def test_1(self):
ti... | nilq/baby-python | python |
"""
Functions for interacting with timestamps and datetime objects
"""
import datetime
from typing import Optional
def to_utc_ms(dt: datetime.datetime) -> Optional[int]:
"""
Convert a datetime object to UTC epoch milliseconds
Returns
-------
timstamp_ms : int
Timestamp
"""
if dt i... | nilq/baby-python | python |
import datetime
import uuid
from typing import cast
from unittest import mock
from unittest.mock import ANY, patch
import pytest
import pytz
from constance.test import override_config
from django.core import mail
from django.urls.base import reverse
from django.utils import timezone
from rest_framework import status
... | nilq/baby-python | python |
name = 'libseq'
from libseq.libseq import *
| nilq/baby-python | python |
import eel
if __name__ == '__main__':
eel.init('web')
eel.start('index.html', mode="chrome", size=(1296, 775))
| nilq/baby-python | python |
import os
def create_termuxconfig():
ATTR = ["API_ID", "API_HASH", "SESSION", "DB_URI", "LOG_CHAT", "TOKEN"]
file = open("termuxconfig.py", "w+")
file.write("class Termuxconfig:\n\ttemp = 'value'\n")
for x in ATTR:
myvar = vars() # string to variable
if x == "DB_URI":
value = createdb()
else:
data = ... | nilq/baby-python | python |
# GUI frame for the sineTransformations_function.py
try:
# for Python2
from Tkinter import * ## notice capitalized T in Tkinter
import tkFileDialog, tkMessageBox
except ImportError:
# for Python3
from tkinter import * ## notice lowercase 't' in tkinter here
from tkinter import filedialog as... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 1 18:44:04 2018
@author: JavaWizards
"""
import numpy as np
file = "/Users/nuno_chicoria/Downloads/b_should_be_easy.in"
handle = open(file)
R, C, F, N, B, T = handle.readline().split()
rides = []
index = []
for i in range(int(N)):
index.a... | nilq/baby-python | python |
""""
Animation code source:
https://gist.github.com/DanielTakeshi/fec9a5cd957eb05b04b6d06a16cc88ae
"""
import argparse
import time
import imageio
from PIL import Image
import numpy as np
import torch as T
import gym
import rl.environments
def evaluate(agent, env, EE, max_el, exp_name, gif=False):
print('[ Ev... | nilq/baby-python | python |
import numpy as np
from .Classifier import Classifier
class NearestNeighbourClassifier(Classifier):
def __init__(self) -> None:
self.x = np.array([])
self.y = np.array([])
def fit(self, x: np.ndarray, y: np.ndarray) -> None:
""" Fit the training data to the classifier.
Args:
... | nilq/baby-python | python |
from sys import platform
import sys
try:
import caffe
except ImportError:
print("This sample can only be run if Python Caffe if available on your system")
print("Currently OpenPose does not compile Python Caffe. This may be supported in the future")
sys.exit(-1)
import os
os.environ["GLOG_minloglev... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.