content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
# -*- coding: utf-8 -*-
import re, kim, dinle, islem, muhabbet
def __init__(giris):
pattern_kim = re.match('(.+) ((kim(dir)?)|nedir)(\?)?$', giris, re.IGNORECASE)
pattern_dinle = re.match('(.+) dinle$', giris, re.IGNORECASE)
pattern_islem = re.match('^([\d\(\)\-]+(\+|\-|\*|\/)[\d\(\)\+\-\*\/\.]+)(=)?(\?)?... | nilq/baby-python | python |
from pirates.minigame import CannonDefenseGlobals
from pirates.pirate.CannonCamera import CannonCamera
from pirates.util.PythonUtilPOD import ParamObj
class CannonDefenseCamera(CannonCamera):
class ParamSet(CannonCamera.ParamSet):
Params = {
'minH': -60.0,
'maxH': 60.0,
... | nilq/baby-python | python |
class Tweet:
def __repr__(self):
return self.id
def __init__(self, _id, text, created_at, hashtags, retweet_count, favorite_count, username, user_location):
self.id = _id
self.text = text
self.created_at = created_at
self.hashtags = hashtags
self.retweet_count = ... | nilq/baby-python | python |
class DimensionError(Exception):
def __init__(self, message="Dimension mismatch"):
super(DimensionError, self).__init__(message)
| nilq/baby-python | python |
import numpy as np
from task.Schema import Schema
# import pdb
class StimSampler():
'''
a sampler of sequences
'''
def __init__(
self,
n_param,
n_branch,
pad_len=0,
max_pad_len=None,
def_path=None,
def_prob=None,
... | nilq/baby-python | python |
from mwcleric.auth_credentials import AuthCredentials
class AuthCredentials(AuthCredentials):
"""Wrapper class just to make imports nicer to work with"""
pass
| nilq/baby-python | python |
import tkinter as tk
import view_calc as vc
import model_calc as mc
class CalcController:
def __init__(self):
self.root = tk.Tk()
self.calc = vc.ViewCalc(self.root, self)
self.moc = mc.ModelCalc()
def start(self):
self.root.mainloop()
def operacao(self, op, n1, n2):
... | nilq/baby-python | python |
# 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... | nilq/baby-python | python |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: robot_behavior.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 reflection as... | nilq/baby-python | python |
import six
import itertools
import numpy as np
from chainer import serializers
import nutszebra_log2
# import nutszebra_slack
import nutszebra_utility
import nutszebra_log_model
import nutszebra_sampling
import nutszebra_download_cifar100
import nutszebra_preprocess_picture
import nutszebra_basic_print
import nutszebra... | nilq/baby-python | python |
import torch
import wandb
import numpy as np
from mlearn import base
from tqdm import tqdm, trange
from collections import defaultdict
from mlearn.utils.metrics import Metrics
from mlearn.utils.early_stopping import EarlyStopping
from mlearn.utils.evaluate import eval_torch_model, eval_sklearn_model
from sklearn.model_... | nilq/baby-python | python |
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko
# 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 mus... | nilq/baby-python | python |
import bpy
from bpy.props import *
from .. events import propertyChanged
from .. base_types import AnimationNodeSocket, PythonListSocket
class ColorSocket(bpy.types.NodeSocket, AnimationNodeSocket):
bl_idname = "an_ColorSocket"
bl_label = "Color Socket"
dataType = "Color"
drawColor = (0.8, 0.8, 0.2, 1)... | nilq/baby-python | python |
import pytest
from src.xmlToData.regexExtractors.parametersExtractor import ParametersExtractor
@pytest.mark.parametrize("xml_string", ["+ get_age(): int",
"# add_weight( ): int",
"- set_height( ): int"])
def test_extract_empty_pa... | nilq/baby-python | python |
#
# 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 us... | nilq/baby-python | python |
# coding: utf-8
"""
nlpapiv2
The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text. # noqa: E501
OpenAPI spec version: v1
Generated by: https://git... | nilq/baby-python | python |
import torch
from nff.utils.scatter import compute_grad
from nff.utils import batch_to
from torch.nn import ModuleDict
from ase import Atoms
from ase import units
import numpy as np
from torchmd.topology import generate_nbr_list, get_offsets, generate_angle_list
def check_system(object):
import torchmd
if o... | nilq/baby-python | python |
#!/usr/bin/env python3.8
from passlocker import User, user_details
def create_new_user(fisrtname, lastname ,password):
'''
Function to create a new user with a username and password
'''
new_user = User(fisrtname, lastname ,password)
return new_user
def save_user(user):
'''
Function to save... | nilq/baby-python | python |
import mdk
import requests
class MockRequest(object):
def __init__(self):
self.data = None
self.get = self.repeater
self.post = self.repeater
self.put = self.repeater
self.delete = self.repeater
self.status = 200
def repeater(self, url, params=None, headers=No... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class PropertyAuthInfo(object):
def __init__(self):
self._area = None
self._city = None
self._community = None
self._data_id = None
self._latitude ... | nilq/baby-python | python |
def queryUser(feature_names):
print "Please enter changes to features in the format:\n(feature 1 number) (+ for increase, - for decrease)\n(feature 2 number) (+/-)\n...\n(enter -1 -1 to stop)"
for i in range(len(feature_names)):
print str(i+1)+": "+feature_names[i]
print "-------------------------------------"
in... | nilq/baby-python | python |
from ..profiles import models
def user_display(user):
try:
profile = user.profile
except models.Profile.DoesNotExist:
return user.email
return profile.name
| nilq/baby-python | python |
"""
Contains the CNOT gate
"""
from .quantum_gate import QuantumGate
import numpy as np
class CNOT(QuantumGate):
""" Implements the CNOT gate
Parameters
------------
target : 0 or 1, optional
Specifies the target qubit, default is 0.
"""
def __init__(... | nilq/baby-python | python |
import sys
from daqhats import hat_list, HatIDs, mcc152
# get hat list of MCC daqhat boards
board_list = hat_list(filter_by_id = HatIDs.ANY)
if not board_list:
print("No boards found")
sys.exit()
# Read and display every channel
for entry in board_list:
if entry.id == HatIDs.MCC_152:
print("Board... | nilq/baby-python | python |
"""Calculates the new ROM checksum and writes it back to the binary
"""
from binaryninja import BackgroundTaskThread, BinaryReader, show_message_box
import struct
class GenesisChecksum(BackgroundTaskThread):
def __init__(self, bv):
BackgroundTaskThread.__init__(self, "", True)
self.progress = 'ge... | nilq/baby-python | python |
# Direct CAD entry for Mitutoyo calipers via USB HID emulation.
# Assuming a Serpente board, with `req`, `clock`, `data` and `ready` connected to
# D0, D1, D2 and D3, respectively.
import time
import board
import digitalio
import mitutoyo
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.key... | nilq/baby-python | python |
# calculate the z-score for each individual by two type isoform's junction reads
# 20170522 filter the min reads counts: 25% sample's reads counts >= 1
# added postfix
# 20170626 change the filter method
# 20170705 change the filter method to left in out
# individual sum count must > 5
# rema... | nilq/baby-python | python |
'''Defines blueprints and routes for the app'''
from flask import Blueprint
from flask_restful import Api, Resource
from .views.users import Signup
BLUE = Blueprint('api', __name__, url_prefix="/api/v1")
API = Api(BLUE)
API.add_resource(Signup, '/auth/signup')
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
def main():
import sys
input = sys.stdin.readline
n, s, d = map(int, input().split())
for i in range(n):
xi, yi = map(int, input().split())
if xi < s and yi > d:
print("Yes")
exit()
print("No")
if __name__ == "__main__":
ma... | nilq/baby-python | python |
import komand
from .schema import ListAlertsInput, ListAlertsOutput
# Custom imports below
class ListAlerts(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name='list_alerts',
description='List Carbon BlackLi alerts with given parameters',
... | nilq/baby-python | python |
#!/usr/bin/python
# coding=utf-8
################################################################################
from mock import Mock
from mock import patch
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from urllib2 import HTTPError
from diamond.collector import ... | nilq/baby-python | python |
# coding: utf-8
import click
from datetime import datetime
import re
import shortuuid
from werkzeug.security import generate_password_hash
from app import db
from app import get_db_cursor
from grid_id import GridId
from institution import Institution
from package import Package
from permission import Permission
from p... | nilq/baby-python | python |
import difflib
from bs4 import BeautifulSoup
from selenium import webdriver
from time import sleep
import itertools
import requests
import re
import sqlite3
import jellyfish
conn = sqlite3.connect('bazadanych.db')
c = conn.cursor()
def forbet_teams():
driver = webdriver.Firefox()
driver.get... | nilq/baby-python | python |
filas = int(input("Ingrese el número de filas de la matriz: "))
columnas = int(input("Ingrese el número de columnas de la matriz: "))
matriz = []
for m in range(filas):
matriz.append([])
for n in range(columnas):
matriz[m].append(int(input(f"Ingrese el valor de la columna {n} de la fil... | nilq/baby-python | python |
import glob
import os
from setuptools import setup, find_packages
here = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(here, "README.md")) as f:
long_description = f.read()
setup(
name="spire-pipeline",
version="1.2.0",
description="Run software pipelines using doit",
lon... | nilq/baby-python | python |
from sensors.range_finder import UltrasonicRangeFinder
from multiprocessing import Queue, Value
import threading
import logging
import unittest
from util.definitions import GPIO_ULTRASONIC_ECHO, GPIO_ULTRASONIC_TRIGGER
# In order to execute this test, an ultrasonic range finder has to be connected to th... | nilq/baby-python | python |
from django.shortcuts import render
from moviesapp.models import Movies
from moviesapp.forms import MoviesForm
def index(request):
return render(request, 'moviesapp/index.html')
def moviesList(request):
moviesList=Movies.objects.all()
movies_dict={'movies':moviesList}
return render(request, 'moviesapp... | nilq/baby-python | python |
from django.apps import AppConfig
class DelayConfig(AppConfig):
name = "channels.delay"
label = "channels.delay"
verbose_name = "Channels Delay"
| nilq/baby-python | python |
from .twitter import TwitterReviews
from .imdb import IMDBReviews
from .ny_times import NYTimesReviews
__all__ = ['TwitterReviews', 'IMDBReviews', 'NYTimesReviews']
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
This tokenizer has been copied from the ``tokenize.py`` standard library
tokenizer. The reason was simple: The standard library tokenizer fails
if the indentation is not right. The fast parser of jedi however requires
"wrong" indentation.
Basically this is a stripped down version of the sta... | nilq/baby-python | python |
import thredo
def func(x, y):
return x + y
def main():
t = thredo.spawn(func, 2, 3)
print("Result:", t.join())
thredo.run(main)
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 -Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | nilq/baby-python | python |
"""
The ``planning`` package contains the planning steps for initial and rolling
wave planning. It creates a ``PlanningCreator`` and calls the methods to set
the Gurobi variables and constraints. It runs the planner afterwards and saves
the plans.
The implementations of the ``PlanningCreator`` (initial and rolling wav... | nilq/baby-python | python |
'''
/vg/station-specific fixes.
'''
from .base import Matcher,MapFix,RenameProperty,DeclareDependencies,ChangeType
from byond.basetypes import BYONDString, BYONDValue, Atom, PropertyFlags
from byond.directions import *
DeclareDependencies('vgstation',['ss13'])
ATMOSBASE = '/obj/machinery/atmospherics'
@MapFix('vgsta... | nilq/baby-python | python |
import pytest
from bearboto3.iam import (
InstanceProfileExistsWaiter,
UserExistsWaiter,
RoleExistsWaiter,
PolicyExistsWaiter,
)
from beartype import beartype
from beartype.roar import (
BeartypeCallHintPepParamException,
BeartypeCallHintPepReturnException,
BeartypeDecorHintPep484585Exceptio... | nilq/baby-python | python |
__author__ = 'hunter'
| nilq/baby-python | python |
#
# PySNMP MIB module Nortel-Magellan-Passport-HdlcTransparentMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-HdlcTransparentMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:17:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by use... | nilq/baby-python | python |
from bs4 import BeautifulSoup, Tag
import os
from abc import ABC, abstractmethod
from typing import List, Dict, NoReturn
class Csskrt(ABC):
def __init__(self, filename: str, tag_styles: Dict):
f = open(filename) # should be able to handle dirs (for later) todo
f_data = f.read()
self.file... | nilq/baby-python | python |
import tensorflow as tf
import tensorflow_hub as hub
import numpy as np
from nboost.plugins.models.rerank.base import RerankModelPlugin
from nboost import defaults
from typing import List, Tuple
class USERerankModelPlugin(RerankModelPlugin):
def __init__(self, **kwargs):
super().__init__(**kwargs)
... | nilq/baby-python | python |
from yolov3.config.defaults import get_default_config
| nilq/baby-python | python |
#!/usr/bin/env python
"""ztc.vm.memory tests"""
import unittest
from ztc.vm.memory import Memory
class Test(unittest.TestCase):
def test_get_active(self):
m = Memory()
assert isinstance(m.active, long)
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testName']
unittest.ma... | nilq/baby-python | python |
import cv2
import argparse
from datetime import datetime
import sys
def do_capture(args):
print("Capturing", args.url)
capture=cv2.VideoCapture(args.url)
i = 0
while True:
if args.nframes is not None and i >= args.nframes:
print("Done")
break
i += 1
fram... | nilq/baby-python | python |
#!/usr/local/bin/python
#==========================================================================
# Ingest a given scripps dataset into the corresponding databases.
# To be invoked by the overall scripps_ingest.py using subprocess,
# destination data directory and temporary working directory are defined in
# proper... | nilq/baby-python | python |
################################################################################
#
# qooxdoo - the new era of web development
#
# http://qooxdoo.org
#
# Copyright:
# 2006-2009 1&1 Internet AG, Germany, http://www.1und1.de
#
# License:
# MIT: https://opensource.org/licenses/MIT
# See the LICENSE file in the... | nilq/baby-python | python |
#!/usr/bin/env python3
import sys
import functools
def parse_tile(s):
lines = s.split('\n')
tile_id = int(lines[0].strip(':').split()[1])
return tile_id, list(map(list, lines[1:]))
def read_tiles():
blocks = sys.stdin.read().strip().split("\n\n")
return {tile_id: tile for tile_id, tile in map(... | nilq/baby-python | python |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import config
import time
module = 'separable_adapter' # specific module type for universal model: series_adapter, parallel_adapter, separable_adapter
trainMode = 'universal'
from sync_batchnorm import SynchronizedBatchNorm3d
'''
Inp... | nilq/baby-python | python |
"""
@author: Arpit Somani
"""
#Import the required modules
import numpy
#Creating the platform, where we play the game.
board= numpy.array([['_','_','_'],['_','_','_'],['_','_','_']])
#We have 2 symbols , as its a 2 player game
p1s= 'X'
p2s= 'O'
#Checking for empty place in rows
def check_row... | nilq/baby-python | python |
# segmented sieve
from __future__ import annotations
import math
def sieve(n: int) -> tuple:
"""
>>> sieve(2 **3)
(2, 3, 5, 7)
>>> sieve(3 ** 3)
(2, 3, 5, 7, 11, 13, 17, 19, 23)
>>> sieve(4)
(2, 3)
"""
in_prime = []
start = 2
end = int(math.sqrt(n))
temp = [True] * ... | nilq/baby-python | python |
# Generated by Django 3.0.5 on 2020-04-23 10:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payment', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='payment',
name='payment_type',
... | nilq/baby-python | python |
import torch
import torch.nn as nn
import torch.functional as F
import torch.optim as optim
from random import randint
import argparse
from datetime import datetime
import os
import numpy as np
from time import time
from collections import defaultdict
from gnn_cnn_model.deepwalks import *
from gnn_cnn_model.model impo... | nilq/baby-python | python |
#!/usr/bin/env python
"""
Compute the DSigma profiles for different lenses
"""
import os
import pickle
from astropy.table import Table
from jianbing import scatter
from jianbing import wlensing
TOPN_DIR = '/tigress/sh19/work/topn'
# Lensing data using medium photo-z quality cut
s16a_lensing = os.path.join(TOPN_DIR... | nilq/baby-python | python |
"""
File name: __init__.py
Author: Lukas Müller
Python Version: 3.6
"""
from .lfsr import LFSR
from .fsr_function import FSRFunction
from .nlfsr import NLFSR
from .tools import logical_and, logical_xor
name = "pyfsr"
version = "1.0"
| nilq/baby-python | python |
from unittest import TestCase
from hamcrest import assert_that, is_
from util.string_util import replace_not_alphanumeric, normalize, remove_multi_spaces, create_filename, replace_numeric, \
contains_numeric
class TestStringUtils(TestCase):
def test_remove_multi_spaces(self):
assert_that(remove_mul... | nilq/baby-python | python |
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from django.urls import include
from django.views.generic import TemplateView
import django_cas_ng.views
urlpatterns = [
path("admin/", admin.site.urls),
path(
"ope... | nilq/baby-python | python |
from flask import Flask, g, render_template, flash, redirect, url_for, abort, send_file, request, jsonify
from flask_bcrypt import check_password_hash
from flask_login import LoginManager, login_user, logout_user, login_required, current_user
from flask_admin import Admin, AdminIndexView, BaseView, expose
from flask_a... | nilq/baby-python | python |
'''
Recursion
We're going to take a break from our tour of data structures in order to look at the concept of recursion. Recursion is going to be a useful tool for solving some of the problems we'll be tackling later on, and this is a good place to introduce it and get some practice using it with the data structures we... | nilq/baby-python | python |
"""Tests for the fixes of CNRM-CM6-1."""
import os
import iris
import numpy as np
import pytest
from netCDF4 import Dataset
from esmvalcore.cmor._fixes.cmip6.cnrm_cm6_1 import Cl, Clcalipso, Cli, Clw
from esmvalcore.cmor.fix import Fix
from esmvalcore.cmor.table import get_var_info
@pytest.fixture
def cl_file(tmp_p... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding utf-8 -*-
#
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Author: Markus Ritschel
# eMail: kontakt@markusritschel.de
# Date: 03/04/2019
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#
from __future__ import division, print_function, absolute_import
from mpi_icelab_routines.arduino import read_ardui... | nilq/baby-python | python |
from .code_actions import actions_manager
from .code_actions import CodeActionOrCommand
from .core.logging import debug
from .core.protocol import Diagnostic
from .core.protocol import Request
from .core.registry import LspTextCommand
from .core.registry import windows
from .core.sessions import SessionBufferProtocol
f... | nilq/baby-python | python |
from django import forms
#from pagedown.widgets import PagedownWidget
from apps.saas.models import Offer
class OfferForm(forms.ModelForm):
#content= forms.CharField(widget=PagedownWidget(show_preview=False))
#publish= forms.DateField(widget=forms.SelectDateWidget)
class Meta:
model = Offer
fields= [
"tipo_... | nilq/baby-python | python |
from pathlib import Path, PurePath
import re
import json
import copy
import logging
from sc2_tournament_analysis.defaults import standard_player_match
from sc2_tournament_analysis.handle_replay import handle_replay
def recursive_parse(
*,
sub_dir=None,
data_function,
player_match=None,
identifier_... | nilq/baby-python | python |
# Interpretable cnn for big five personality traits using audio data #
# Parameters initalization #
NUM_FRAMES = 208 # No of Frames for summary spectrogram.
NUM_BANDS = 64 # No of frequency bands for mel-spectrogram.
# Model hyperparameters.
INIT_STDDEV = 0.01 # Standard deviation used to initialize weights.
LEARNI... | nilq/baby-python | python |
fichier = open("/run/media/Thytu/TOSHIBA EXT/PoC/Smartshark/DS/test_ds_DDOS.csv", "r")
pos = 13 #pos to flatten
def flat_line(line, target):
index = 0
pos = 0
for l in line:
print(l, end="")
pos += 1
if (l == ','):
index += 1
if index == target:
brea... | nilq/baby-python | python |
class Attachment:
def __init__(
self,
id,
filename,
size,
url,
proxy_url,
**kwargs
):
self.id = id
self.filename = filename
self.size = size
self.url = url
self.proxy_url = proxy_url
if 'height' in kwargs.... | nilq/baby-python | python |
from pathlib import Path
from tempfile import NamedTemporaryFile
import numpy as np
import pandas as pd
import pytest
from etna.datasets import generate_ar_df
@pytest.fixture
def base_pipeline_yaml_path():
tmp = NamedTemporaryFile("w")
tmp.write(
"""
_target_: etna.pipeline.Pipeline
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: message.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 imp... | nilq/baby-python | python |
##########################################################################
# MediPy - Copyright (C) Universite de Strasbourg
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for de... | nilq/baby-python | python |
# # # # # # # # # # # # #
# #
# #
# #
# Pi Radio #
# By #
# Jackson #
# Hoggard #
# (c)2018 #
# #
# #
# #
# # # # # # # # # # # # #
import os, argparse, random
from colorama import Fore, Back, Style
from multiprocessing import Process
parser = argparse.ArgumentParser(pr... | nilq/baby-python | python |
import struct, base64
import numpy as np
mdmr_dtypes = { 0: 's', 1: 'I', 2: 'q', 3: 'f', 4: 'd'}
# output of test_encode
b64data = """TURNUjAwMDECAAAABAAAAKUAAAAAAAAABAAAADcAAAAAAAAAAAAAAAAAAAB47j1cctzBv2t9kdCWc8G/fSJPkq6ZwL/PSe8bX3u+v6TC2EKQg7q/6iEa3UHstL8YQznRrkKqv4NuL2mM1oG/GEM50a5Cqj96Nqs+V1vBPxR5knTN5M8/yol2FVJ+... | nilq/baby-python | python |
from app import app
from config import MONGO_URI, client
from flask import session, request, jsonify
import pymongo
import requests
import json
from datetime import datetime
# 連進MongoDB
db = client['aiboxdb']
@app.route('/api/android/getRemind', methods=['GET'])
def android_get_remind():
'''取得沒有user_nickname(未登入)... | nilq/baby-python | python |
from pathlib import Path
from typing import Tuple, Callable, Union
ReadPaths = Union[Tuple[Path], Tuple[Path, Path]]
def _make_paired_paths(
dir_path: Path,
paired: bool,
mkstr: Callable[[int], str]
) -> ReadPaths:
path1 = dir_path/mkstr(1)
return (path1, dir_path/mkstr(2)) if paired ... | nilq/baby-python | python |
import json
from lib import action
class VaultWriteAction(action.VaultBaseAction):
def run(self, path, values):
return self.vault.write(path, **json.loads(values))
| nilq/baby-python | python |
import numpy as np
import operator
def TI_Forward_Neighborhood(D, p, Eps):
""" ."""
seeds = []
forwardThreshold = p.dist + Eps
# You have to declare the list to traverse.
# First is the index with element "p"
# Items are selected from start to item "p"
# And finally it turns around
in... | nilq/baby-python | python |
import time
import os
from coala_utils.decorators import enforce_signature
from coalib.output.printers.LogPrinter import LogPrinterMixin
from coalib.misc.CachingUtilities import (
pickle_load, pickle_dump, delete_files)
class FileCache:
"""
This object is a file cache that helps in collecting only the ch... | nilq/baby-python | python |
from flask import Flask
from flask import render_template, url_for, request
import datetime
from person import Person
from my_lib import get_week
from parser_price import Parser_price
from head_hunter_vacancies import HeadHunter_vacancies
from bd_apartment import Appartment_BD
from sqlalchemy import create_engine
fro... | nilq/baby-python | python |
#from __future__ import absolute_import
from celery import shared_task
#from celery.contrib import rdb #DEBUG
@shared_task
def myflqTaskRequest(analysisID):
from django.conf import settings
from myflq.models import Analysis,AnalysisResults
from django.core.files import File
import subprocess,time,tempf... | nilq/baby-python | python |
import json
from importlib import resources
import requests
import explorer
from explorer import configs
from explorer.enums.fields_enum import FieldsEnum as fields
from explorer.utils.parsing import ResponseParser as parser
class BlockchainExplorer:
def __new__(cls, api_key: str, net: str, prefix: str):
... | nilq/baby-python | python |
import feedparser
import justext
import requests
import sys
from database import Database
from bs4 import BeautifulSoup
import re
import mistune
from unidecode import unidecode
def get_text_from_reuters(link):
response = requests.get(link)
resText = response.content.decode("UTF-8", 'ignore')
soup = Beautif... | nilq/baby-python | python |
from typing import Dict, Type
from .setting import Setting
class SettingRegistry:
def __init__(self):
self._registry: Dict[Type, Type[Setting]] = {}
def register_setting(self, type_hint: Type, setting_cls: Type[Setting]):
self._registry[type_hint] = setting_cls
def get_setting_class_for... | nilq/baby-python | python |
import boto3
from botocore.exceptions import ClientError
from .config import s3, bucket_name
import logging
log = logging.getLogger("my-logger")
def generate_presigned_url(s3_client, client_method, method_parameters, expires_in):
"""
Generating a presigned Amazon S3 URL that can be used to perform an action... | nilq/baby-python | python |
#!/usr/bin/env pytest-3
# -*- coding: utf-8 -*-
#
# This file is part of the minifold project.
# https://github.com/nokia/minifold
__author__ = "Marc-Olivier Buob"
__maintainer__ = "Marc-Olivier Buob"
__email__ = "marc-olivier.buob@nokia-bell-labs.com"
__copyright__ = "Copyright (C) 2018, Nokia"
__license__ ... | nilq/baby-python | python |
import numpy as np
import matplotlib.pyplot as plt
#Für jeden Wert in der Liste neuen e-Wert errechnen
def e_function(my_list):
return [np.exp(val) for val in my_list]
#Funktion plotten
def plot_func(x, y, farbe, windowName):
plt.figure(windowName)
plt.plot(x, y, color=farbe)
plt.title("My Image")
... | nilq/baby-python | python |
from recon.core.module import BaseModule
import re
class Module(BaseModule):
meta = {
'name': 'Shodan Hostname Enumerator',
'author': 'Tim Tomes (@LaNMaSteR53)',
'description': 'Harvests hosts from the Shodan API by using the \'hostname\' search operator. Updates the \'hosts\' table with t... | nilq/baby-python | python |
from .imports import *
def bn_drop_lin(inp, n_out, bn=True, p=0., actn=None):
out = inp
if bn:
out = BatchNormalization()(out)
if p>0:
out = Dropout(p)(out)
use_bias = False if bn else True
out = Dense(n_out, activation=actn, use_bias=use_bias)(out)
return out
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
highestNumber = -1
highestNumberPosition = -1
for i in range(100):
number = int(input())
if number > highestNumber:
highestNumber = number
highestNumberPosition = i + 1
print(highestNumber)
print(highestNumberPosition) | nilq/baby-python | python |
import requests, re
def fbvid(url):
req=requests.get(url)
if req.status_code == 200:
try:
return {"status":True,"url":re.search('hd_src:"(.+?)"', req.text)[1]}
except TypeError:
return {"status":False,"msg":"private_video"}
else:
return {"status":False,"msg":... | nilq/baby-python | python |
import pandas as pd
import numpy as np
import datetime
import numba
import time
import os
def cummul(array):
temp = 1
ret = []
for element in array:
temp *= element
ret.append(temp)
return np.array(ret)
def listdirs(folder):
return [
d for d in (os.path.join(folder, d1) fo... | nilq/baby-python | python |
text = input("entrez une chaine de caracteres : ")
isPalindromic = text[0] == text[len(text) - 1]
i, j = 0, len(text)- 1
while i < j and isPalindromic:
isPalindromic = text[i] == text[j]
i, j = i + 1, j - 1
print(isPalindromic)
| nilq/baby-python | python |
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.clock import Clock
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.properties import ListProperty
from kivy.uix.behaviors import ButtonBehavior
import urllib.requ... | nilq/baby-python | python |
#!/bin/python3
import json
import os
import sys
import io
import time
from specimen import specimen
from growlab_v1_http_client import growlab_v1_http_client
from readingsbuilder import readingsbuilder
from pathbuilder import pathbuilder
if __name__ == "__main__":
print("Starting growlab")
config = {}
t... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.