content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
import re #source: https://en.wiktionary.org/wiki/Category:English_abbreviations ABBREVIATIONS_COMMON = [(re.compile(r'\b%s\.?(,?)\b' % x[0]), r'%s\1 ' % x[1]) for x in [ ("abbr", "abbreviation"), ("abbrev", "abbreviation"), #("abr", "abridged"), ("abstr", "abstract"), ("AI", "artificial intelligence"), #...
nilq/baby-python
python
def insertionSort(arr): for x in range(1, len(arr)): item = arr[x] i = x - 1 while i >= 0 and item < arr[i]: arr[i + 1] = arr[i] i -= 1 arr[i + 1] = item return arr print(insertionSort([1,9,8,4,6,7,3,12,5,18,2,22]))
nilq/baby-python
python
"""Originally Adapted from sphinxcontrib.details.directive """ from docutils import nodes from docutils.parsers.rst import directives from sphinx.util.docutils import SphinxDirective from sphinx.transforms.post_transforms import SphinxPostTransform from sphinx.util.nodes import NodeMatcher def setup_dropdown(app): ...
nilq/baby-python
python
from robocorp_code.protocols import IRcc, IRccRobotMetadata import py.path def test_rcc_template_names(rcc: IRcc): result = rcc.get_template_names() assert result.success assert result.result assert "standard" in result.result def test_rcc_cloud(rcc: IRcc, ci_credentials: str, tmpdir: py.path.local)...
nilq/baby-python
python
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): lookup = {1:[TreeNode(0)]} def allPossibleFBT(self, N): if N%2 == 0: return None if N n...
nilq/baby-python
python
import unittest from preset import ActionTypes, Step, Preset class TestStep(unittest.TestCase): def test_01_constructor_and_properties(self): temp_name = "name" temp_value = "value" temp_executable = lambda x: x temp_action_type = ActionTypes.filter temp_instance = Step(t...
nilq/baby-python
python
import logging import os import pickle from typing import Generator, List, Tuple, Dict from gensim.models import Word2Vec from gensim.test.utils import common_texts from wbtools.db.dbmanager import WBDBManager from wbtools.lib.nlp.common import PaperSections from wbtools.lib.nlp.text_preprocessing import preprocess f...
nilq/baby-python
python
# game.py (c) 2017 D.J.Whale 22/01/2017 # Star-Wars 'Use the Force, Luke' game # Using many moving parts provided by Martin O'Hanlon #----- CONFIGURATION ---------------------------------------------------------- DEATHSTAR_CENTRE_POS = (100,100,10) TARGET_POS = (100,100,10) IN_RANGE = ((100,1...
nilq/baby-python
python
from toontown.coghq.SpecImports import * GlobalEntities = {1000: {'type': 'levelMgr', 'name': 'LevelMgr', 'comment': '', 'parentEntId': 0, 'cogLevel': 0, 'farPlaneDistance': 1500, 'modelFilename': 'phase_11/models/lawbotHQ/LB_Zone7a', 'wantDoors': 1}, 1001: {'t...
nilq/baby-python
python
__author__ = "The One & Only Javi" __version__ = "1.0.0" __start_date__ = "25th July 2020" __end_date__ = "5th August 2020" __maintainer__ = "me" __email__ = "little_kh@hotmail.com" __requirements__ = "SQL-Alchemy, MySQL," \ " Flask-SQLAlchemy, database.py, " \ "models.py, video_op...
nilq/baby-python
python
from .PZT import PZTMountedGrounded
nilq/baby-python
python
from robofab.world import CurrentGlyph from robofab.pens.filterPen import thresholdGlyph d = 10 thresholdGlyph(CurrentGlyph(), d)
nilq/baby-python
python
# Two-sided notes create_table_notes_ab = """ create table if not exists notes_ab ( id text, front text, back text, PRIMARY KEY(id) ) """ # One-sided notes create_table_notes_qa = """ create table if not exists notes_qa ( id text, front text, back text, PRIMARY KEY(id) ) """ # Th...
nilq/baby-python
python
import pysftp server_host = "demo.wftpserver.com" username = "demo" password = "demo" with pysftp.Connection(server_host, username=username, password=password,port=2222)as sftp: print(sftp.pwd) # with sftp.cd('public'): # temporarily chdir to public # sftp.put('/my/local/filename') # upl...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ netvisor.responses.products ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2013-2016 by Fast Monkeys Oy. :license: MIT, see LICENSE for more details. """ from ..schemas import GetProductSchema, ProductListSchema from .base import Response class ProductListResponse(Response): ...
nilq/baby-python
python
# # Copyright 2015 BMC Software, 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 in ...
nilq/baby-python
python
#!/usr/bin/python3 from venus.stock_base import StockEventBase class EventStockFlag(StockEventBase): def flag_quit_stock(self, stock_code): import datetime import pandas as pd from datetime import date from dev_global.env import TIME_FMT result = self.mysql.select_values(st...
nilq/baby-python
python
class Solution: def makesquare(self, matchsticks: List[int]) -> bool: if len(matchsticks) < 4: return False perimeter = sum(matchsticks) if perimeter % 4 != 0: return False A = sorted(matchsticks)[::-1] def dfs(selected: int, edges: List[int]) -> bool: if selected == len(A): ...
nilq/baby-python
python
#!/usr/bin/env python tuple= ["Juan", 5, 20.80, "HOLA"] tuple2= [1,2,3] lista3= [[1,2,3], [1, 3, 6], "HOLA"] print tuple[0] print tuple[1:2] print tuple[2:] print tuple *2 print tuple+tuple2 print lista3
nilq/baby-python
python
# Copyright 2016-2017 Curtis Sand <curtissand@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
nilq/baby-python
python
from plenum.common.constants import ALIAS, SERVICES, VALIDATOR from plenum.test.helper import sendReqsToNodesAndVerifySuffReplies from plenum.test.node_catchup.helper import waitNodeDataEquality, \ checkNodeDataForInequality from plenum.test.pool_transactions.helper import \ updateNodeData from stp_core.common....
nilq/baby-python
python
#!/usr/bin/python """ Commander.py - Python Backend for the WiFi Pineapple Commander module. Version 2 Codename: Electric Boogaloo Thanks to: sebkinne & tesla Foxtrot (C) 2016 <foxtrotnull@gmail.com> """ import os import ConfigParser import sys import socket import time import string import select import errno cla...
nilq/baby-python
python
# Copyright (c) 2016-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. from freeswitch import...
nilq/baby-python
python
from scrapy.selector import Selector from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from scrapy.utils.url import urljoin_rfc from sitegraph.items import SitegraphItem class GraphspiderSpider(CrawlSpider): name = 'graphspider' allowed_domains = ['sastra.edu'] st...
nilq/baby-python
python
from ocean_spark.hooks import OceanSparkHook from unittest.mock import MagicMock def test_get_app(successful_get_app: None, get_connection_mock: None) -> None: hook = OceanSparkHook() app_dict = hook.get_app("test-app-name") assert app_dict is not None assert app_dict["displayName"] == "test app name"...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Sat Feb 26 15:13:29 2022 @author: jasy9 """ from .topsis import TOPSIS
nilq/baby-python
python
# Author: Ackerley Cheng # file encoding: utf-8 def sameList(listA, listB): return (len(listA) == len(listB)) and (set(listA) == set(listB)) def listInListSet(list, listSet): for idx, ls in enumerate(listSet): if sameList(list, ls): return idx return -1 # check if listA is a subset ...
nilq/baby-python
python
from django import forms from consent.models import Privilege class PrivilegeForm(forms.ModelForm): class Meta: model = Privilege class ConsentForm(forms.Form): consents = forms.ModelMultipleChoiceField(Privilege.objects, widget=forms.CheckboxSelectMultiple, required=False)
nilq/baby-python
python
import numpy as np from qm_2019_sss_6.NobleGasModel import NobleGasModel from qm_2019_sss_6.scf import scf from qm_2019_sss_6.mp2 import MP2 atomic_coordinates = np.array([[0.0, 0.0, 0.0], [3.0, 4.0, 5.0]]) # Derived from user input number_of_atoms = len(atomic_coordinates) # Argon parameters - these would change for...
nilq/baby-python
python
#!/usr/bin/env python3 import os import random from collections import namedtuple, defaultdict dir_path = os.path.dirname(os.path.realpath(__file__)) file = open(dir_path + "/input.txt", "r") lines = [l.strip() for l in file.readlines()] """ acc increases or decreases a single global value called the accumulator by...
nilq/baby-python
python
import os import pytz from tweepy import OAuthHandler, API, TweepError from . import Data from abc import ABC, abstractmethod import datetime def check_if_datetime_offset_aware(date): return date.tzinfo is not None and date.tzinfo.utcoffset(date) is not None class SocialMediaDataFetch(ABC): _start_date =...
nilq/baby-python
python
import sys import traceback from django.core.management.base import BaseCommand from django.conf import settings from optparse import make_option from cripts.config.config import CRIPTsConfig from cripts.core.mongo_tools import mongo_find_one from cripts.events.event import Event from prep import prep_database cla...
nilq/baby-python
python
from d20.Manual.Facts import (Fact, registerFact) from d20.Manual.Facts.Fields import StringField @registerFact('hash') class MD5HashFact(Fact): _type_ = 'md5' value = StringField() @registerFact('hash') class SHA1HashFact(Fact): _type_ = 'sha1' value = StringField() ...
nilq/baby-python
python
"""Module contains the pydvdid package definition. """ from setuptools import setup with open('README.rst') as readme_file: README = readme_file.read() setup( name="pydvdid", version="1.1", description="A pure Python implementation of the Windows API IDvdInfo2::GetDiscID method, as used by Windows...
nilq/baby-python
python
import pygame from .math_helpers import * def draw(surface, p1,p2, shading_function, section_length,section_offset): #Adapted Bresenham's line algorithm from #http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm x0,y0 = p1 x1,y1 = p2 dx = abs(x1 - x0) dy = abs(y1 - y0) i...
nilq/baby-python
python
from flask_pyoidc.flask_pyoidc import OIDCAuthentication from tenacity import retry @retry def get_auth(app): auth = OIDCAuthentication( app, issuer=app.config['OIDC_ISSUER'], client_registration_info=app.config['OIDC_CLIENT_CONFIG'], ) return auth
nilq/baby-python
python
"""Functions to calculate signal-to-noise ratio in four different cases""" import numpy as np from legwork import strain, psd, utils, evol import astropy.units as u __all__ = ['snr_circ_stationary', 'snr_ecc_stationary', 'snr_circ_evolving', 'snr_ecc_evolving'] def snr_circ_stationary(m_c, f_orb, dist, t...
nilq/baby-python
python
""" QUESTION: This is an interview question asked by Amazon. There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters. For example, if N is 4, then there are 5 ...
nilq/baby-python
python
#!/usr/bin/env python from setuptools import setup setup(name='dvaclient', version='1.0', description='Deep Video Analytics Client', author='Akshay Bhat', author_email='dvaclient@deepvideoanalytics.com', url='https://www.deepvideoanalytics.com/', packages=['dvaclient'], packa...
nilq/baby-python
python
from chainer.backends import cuda import numpy as np def mask_to_bbox(mask): """Compute the bounding boxes around the masked regions. This function accepts both :obj:`numpy.ndarray` and :obj:`cupy.ndarray` as inputs. Args: mask (array): An array whose shape is :math:`(R, H, W)`. ...
nilq/baby-python
python
from draco.programs import constraints, definitions, generate, hard, helpers def test_has_definitions(): assert len(definitions.program) assert len(definitions.blocks) def test_definitions_has_marktype(): assert "mark_type" in definitions.blocks def test_has_constraints(): assert len(constraints.p...
nilq/baby-python
python
from wpilib import DigitalInput import robotmap gear_mech_switch = None def init(): """ Initialize switch objects. """ global gear_mech_switch gear_mech_switch = DigitalInput(robotmap.switches.gear_switch_channel)
nilq/baby-python
python
class Solution: def multiply(self, T, M): a = (T[0][0] * M[0][0] + T[0][1] * M[1][0] + T[0][2] * M[2][0]) b = (T[0][0] * M[0][1] + T[0][1] * M[1][1] + T[0][2] * M[2][1]) c = (T[0][0] * M[0][2] + T[0][1] * M[1][2] + T[0][2] * M[2][2]) d = (T[1][0] * M[0][0] + T[1][1] * M[1][0] + T[1][...
nilq/baby-python
python
# [START method_one] # [START method_two] def _bar(): return 'Underscores in method names denote helper methods.' # [END method_one] # [END method_two] # [START method_one] def return_one(): return 1 # [END method_one] # [START method_two] def return_two(): return 2 # [END method_two]
nilq/baby-python
python
class Song: """Class to represent a song Attributes: title (str): The title of the song artist (Artist): An artist object representing the songs creator. duration (int): The duration of the song in seconds. May be zero """ def __init__(self, title, artist, duration=0): ...
nilq/baby-python
python
# uncompyle6 version 3.2.0 # Python bytecode 2.4 (62061) # Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] # Embedded file name: pirates.piratesgui.BarSelectionMenu from direct.gui.DirectGui import * from pandac.PandaModules import * from direct.directnotify import...
nilq/baby-python
python
import argparse from paz.pipelines import SSD300FAT, SSD300VOC, SSD512COCO, SSD512YCBVideo from paz.backend.camera import VideoPlayer, Camera import tensorflow as tf gpus = tf.config.experimental.list_physical_devices('GPU') tf.config.experimental.set_memory_growth(gpus[0], True) parser = argparse.ArgumentParser(d...
nilq/baby-python
python
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2013, SRI International # 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 ...
nilq/baby-python
python
import os import urllib.request import zipfile from random import shuffle from math import floor def download_dataset(): print('Beginning dataset download with urllib2') url = "http://cs231n.stanford.edu/tiny-imagenet-200.zip" path = "%s/tiny-imagenet-200.zip" % os.getcwd() urllib.request.urlretrieve(url, path) p...
nilq/baby-python
python
from behaviors.button import ButtonBehavior, ToggleButtonBehavior from behaviors.touch_effecs import EffectBehavior from kivy.uix.image import Image from kivy.uix.anchorlayout import AnchorLayout from kivy.properties import ( ListProperty, ObjectProperty, ) from kivy.graphics import Color, Rectangle from kivy.c...
nilq/baby-python
python
import os from sys import argv tobs = int(argv[1]) for i in range(6): if i != 4: for j in range(10): if j==0: os.system('tail -10000 tobs%d/window%d/hb_list_tobs_%d_task_%d.dat > tobs%d/window%d/window%d.dat'%(tobs,i,tobs,j,tobs,i,i)) else: os.system('tail -10000 tobs%d/window%d/hb_l...
nilq/baby-python
python
from binaryninja import * from binaryninja.binaryview import BinaryView from binaryninja.platform import Platform from .browser import ImagePickerDialog # binja doesn't want to load mods in a plugin's dir # so hopefully we can just hack that in manually # We do this after importing binaryninja, because in my local...
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 u...
nilq/baby-python
python
import argparse import numpy as np import torch import torch.nn as nn from torch.utils.data import DataLoader from dp_autoencoder import Autoencoder import mimic_dataset import dp_optimizer import sampling import analysis # Deterministic output torch.manual_seed(0) np.random.seed(0) class Generator(nn.Module): ...
nilq/baby-python
python
# Generated by Django 3.0.1 on 2020-01-06 22:04 from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('chat', '0008_message_front_key'), ] operations =...
nilq/baby-python
python
# the first import can't be removed import scripted_rest_sys_path from dbx2.dbx_logger import logger import splunk, os, json from json import loads from dbx2.simple_rest import SimpleRest from dbx2.java_home_detector import JavaHomeDetector from dbx2.splunk_client.splunk_service_factory import SplunkServiceFactory imp...
nilq/baby-python
python
class Solution(object): def singleNumber(self, nums): """ :type nums: List[int] :rtype: int """ # a ^ 0 == a # a ^ a == 0 # a ^ b ^ a = a ^ a ^ b = 0 ^ b = b a = 0 for i in nums: a ^= i print(a) return a print(...
nilq/baby-python
python
# This software is open source software available under the BSD-3 license. # # Copyright (c) 2020 Triad National Security, LLC. All rights reserved. # Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights # reserved. # Copyright (c) 2020 UT-Battelle, LLC. All rights reserved. # # Additional copyright...
nilq/baby-python
python
from typing import Tuple, Type, List, Dict, Union from pyfileconf.main import PipelineManager, SpecificClassConfigDict def get_pipeline_dict_path_and_specific_class_config_dicts_from_manager(manager: PipelineManager ) -> Tuple[ ...
nilq/baby-python
python
""" Task-Specific consistency training on downstream task (BreastPathQ) """ import argparse import os import time import random import numpy as np from PIL import Image import cv2 import copy import pingouin as pg import statsmodels.api as sm import pandas as pd from tqdm import tqdm import torch.backends.cudnn as cudn...
nilq/baby-python
python
from __future__ import absolute_import import datetime from .config import get_config_file_paths from .util import * # config file path GOALS_CONFIG_FILE_PATH = get_config_file_paths()['GOALS_CONFIG_FILE_PATH'] GOALS_CONFIG_FOLDER_PATH = get_folder_path_from_file_path( GOALS_CONFIG_FILE_PATH) def strike(text):...
nilq/baby-python
python
from __future__ import absolute_import import argparse import os import sys # sys.path.append(".") import time import torch from tensorboardX import SummaryWriter from metrics.evaluation import evaluate from metrics.vae_metrics import VaeEvaluator from struct_self.dataset import Dataset from struct_self.dataset impo...
nilq/baby-python
python
# coding= UTF-8 ### Command line of python <filename> was getting angry till I added the line above. I think ### it needs to know what types of characters to expect (i.e. latin, korean, etc..) import datetime ### I needed to switch to single quotes instead of double. I’m not sure why... name = raw_input('Yo what y...
nilq/baby-python
python
# -*- coding: utf-8 -*- # type: ignore """Chemical Engineering Design Library (ChEDL). Utilities for process modeling. Copyright (C) 2019 Caleb Bell <Caleb.Andrew.Bell@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Softw...
nilq/baby-python
python
""" QLayouted module. """ # ISC License # # Copyright (c) 2020–2022, Paul Wilhelm, M. Sc. <anfrage@paulwilhelm.de> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice app...
nilq/baby-python
python
#import json def parse(command): #split = json.loads(command) #parsedCommand = split return command def main(): pass if __name__ == "__main__": main()
nilq/baby-python
python
from happy_bittorrent.algorithms.torrent_manager import *
nilq/baby-python
python
import pytest import shutil import zipfile from pathlib import Path from squirrel.settings import AddonInstallerSettings from squirrel.addons import ZipAddon from test_addon_install import test_addon_install_path from test_addon_install import test_addon_backup_path from test_addon_install import settings from fixt...
nilq/baby-python
python
#!/usr/bin/python import csv import hashlib import os import sys idx = 1 IGNORED_DIRECTORIES = {'.git', '.svn'} def walk(version_root, app, version): if type(version) == type(bytes): version = version.decode("utf8") if version in IGNORED_DIRECTORIES: return global idx print('av %d %s...
nilq/baby-python
python
import logging from pathlib import Path import whoosh from whoosh import qparser from whoosh.filedb.filestore import FileStorage from whoosh.index import EmptyIndexError from whoosh.query import Every from django.conf import settings from mayan.apps.common.utils import any_to_bool, parse_range from mayan.apps.lock_m...
nilq/baby-python
python
from __future__ import absolute_import # Copyright (c) 2010-2018 openpyxl from collections import defaultdict class BoundDictionary(defaultdict): """ A default dictionary where elements are tightly coupled. The factory method is responsible for binding the parent object to the child. If a reference...
nilq/baby-python
python
import os import random import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp from utils import loadWord2Vec from math import log from sklearn.feature_extraction.text import TfidfVectorizer from sklearn import metrics from sklearn.linear_model import LogisticRegression from sklearn im...
nilq/baby-python
python
# Clase 4. Curso Píldoras Informáticas. print(5 + 6) print(10 % 3) print(5 ** 3) print(9 / 2) print(9 // 2) Nombre = 5 print(type(Nombre)) Nombre = 5.4 print(type(Nombre)) Nombre = "John" print(type(Nombre)) Mensaje = """ Esto es un mensaje utilizando comilla triple. Sirve para da...
nilq/baby-python
python
# # @lc app=leetcode.cn id=382 lang=python3 # # [382] 链表随机节点 # # https://leetcode-cn.com/problems/linked-list-random-node/description/ # # algorithms # Medium (57.03%) # Likes: 66 # Dislikes: 0 # Total Accepted: 6K # Total Submissions: 10.6K # Testcase Example: '["Solution","getRandom"]\n[[[1,2,3]],[]]' # # 给定一个...
nilq/baby-python
python
from setuptools import setup with open("README.md") as f: readme = f.read() with open("LICENSE") as f: license = f.read() setup( name="PERFORM", version=0.1, author="Christopher R. Wentland", author_email="chriswen@umich.edu", url="https://github.com/cwentland0/pyGEMS_1D", description...
nilq/baby-python
python
class ProxyError(StandardError): def __init__(self, title, message): super(ProxyError, self).__init__() self.title = title self.message = message self.error = "Error" def __str__(self): return "%s => %s:%s" % (self.error, self.title, self.message) class ResourceError(...
nilq/baby-python
python
__author__ = 'wanghao' # import threading import sys import socket from struct import * import time import threading def run_flow(dst_ip, port, size): def run(dst_ip, port, size): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # data = os.urandom(size) data = pack('c', 'a') ...
nilq/baby-python
python
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from matplotlib import cm import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torch import os # Implementing relu() def relu(z): if z > 0: return z else: retur...
nilq/baby-python
python
''' # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail ''' # Write your code here def right(a,b): r=a for...
nilq/baby-python
python
import mykde """ If a font in the browser is not Droid, in Google Chrome right click on the text with the wrong font, select 'Inspect element', find 'Computed style' and 'font-family' in it: font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; And for each font do 'fc=match': $ fc-match Helvetica Liber...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Thu May 25 11:25:36 2017 @author: azkei We Briefly covered operations between two data structures last file. We will cover how arithmetic operators apply between two or more structured here using Flexible Arithmetic Methods such as add(), sub(),div(),mul() """ # 1. Flexible Arith...
nilq/baby-python
python
from django.utils import timezone import pytz class TimeZoneMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): tzname = request.session.get("time_zone") if tzname: timezone.activate(pytz.timezone(tzname)) el...
nilq/baby-python
python
from podcast.views import home_page from django.urls import path from . import views app_name = "podcast" urlpatterns = [ path('', views.home_page, name="home-page"), path('podcast/',views.podcast_list, name="podcast-list"), path('podcast/search/',views.search_podcast, name="podcast-search"), path('po...
nilq/baby-python
python
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2016-2019 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Pytest configuration.""" from __future__ import absolute_import, print_function ...
nilq/baby-python
python
import requests from bs4 import BeautifulSoup from .handler import add_handler @add_handler(r'http(s?)://drops.dagstuhl.de/(\w+)') def download(url): metadata = dict() metadata['importer'] = 'drops' data = requests.get(url) soup = BeautifulSoup(data.text, "lxml") authortags = soup.find_all("meta"...
nilq/baby-python
python
# reference page # https://iric-solver-dev-manual-jp.readthedocs.io/ja/latest/06/03_reference.html import sys import iric import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.colors import LightSource from scipy import signal, interpolate import flow class cgns(): def __in...
nilq/baby-python
python
from django.urls import path from . import views urlpatterns = [ path('',views.index, name='homePage'), path('profile/<username>/', views.profile, name='profile'), path('profile/<username>/update', views.edit_profile, name='update'), path('category/<category>/', views.category, name='category'), pa...
nilq/baby-python
python
""" Leetcode #300 """ from typing import List import bisect class Solution: def lengthOfLIS(self, nums: List[int]) -> int: inc = [float("inf")] * len(nums) size = 0 for num in nums: i = bisect.bisect_left(inc, num) inc[i] = num size = max(i+1, siz...
nilq/baby-python
python
import random from multiprocessing import Pool from gym_puyopuyo.agent import tree_search_actions from gym_puyopuyo.state import State def benchmark(depth, threshold, factor): state = State(16, 8, 5, 3, tsu_rules=False) total_reward = 0 for i in range(1000): if i % 100 == 0: print(i, ...
nilq/baby-python
python
import json import csv import sys from pathlib import Path import datetime import pytest import networkx as nx from sb.aws_trace_analyzer import CSV_FIELDS, extract_trace_breakdown, longest_path, create_span_graph, duration, get_sorted_children, is_async_call, call_stack # noqa: E501 def test_get_sorted_children():...
nilq/baby-python
python
# -*- coding: utf-8 -*- import math import numpy as np import numpy.random as npr import cv2 # from matplotlib.colors import rgb_to_hsv # from matplotlib.colors import hsv_to_rgb from configure import cfg import utils.blob # from caffe.io import resize_image def GenerateBatchSamples(roi, img_shape): sampled_bbo...
nilq/baby-python
python
from django.urls import path from .views import ResultListView, create_result, edit_results urlpatterns = [ path("create/", create_result, name="create-result"), path("edit-results/", edit_results, name="edit-results"), path("view/all", ResultListView.as_view(), name="view-results"), ]
nilq/baby-python
python
""" Class for manipulating user information. """ from datetime import date, timedelta from functools import total_ordering from logging import getLogger from os import stat from os.path import exists from re import compile as re_compile from stat import (S_IMODE, S_ISDIR, S_ISREG) from typing import ( Any, Collecti...
nilq/baby-python
python
import os import setuptools with open("README.md") as f: long_description = f.read() with open( os.path.join(os.path.dirname(__file__), "config", "requirements", "base.txt") ) as f: requirements = [i.strip() for i in f] setuptools.setup( name="rembrain_robot_framework", version="0.1.4", auth...
nilq/baby-python
python
#coding:utf-8 from flask import Flask, redirect, url_for, request from datetime import datetime from flask_bootstrap import Bootstrap from app.config_default import Config as DefaultConfig bootstrap = Bootstrap() def check_start(app, db): from app.includes.start import _exist_config, exist_table, create_path, se...
nilq/baby-python
python
""" Generate_branched_alkane ======================== """ from rdkit import Chem import numpy as np import random def generate_branched_alkane(num_atoms: int, save: bool=False) -> Chem.Mol: """Generates a branched alkane. Parameters ---------- num_atoms : int Number of atoms in molecule to be ...
nilq/baby-python
python
from django.core.exceptions import ValidationError from django.test import TestCase from openwisp_users.models import OrganizationUser, User from .utils import TestOrganizationMixin class TestUsers(TestOrganizationMixin, TestCase): user_model = User def test_create_superuser_email(self): user = User...
nilq/baby-python
python
from tensorflow_functions import cosine_knn import collections import numpy as np import logging from embedding import load_embedding import operator from sklearn.cluster import KMeans from utils import length_normalize, normalize_questions, normalize_vector, calculate_cosine_simil, perf_measure import sklearn.metrics ...
nilq/baby-python
python
from Impromptu import *
nilq/baby-python
python
import pytch from pytch import ( Sprite, Stage, Project, when_green_flag_clicked, when_this_sprite_clicked, ) import random # Click the balloons to pop them and score points class BalloonStage(Stage): Backdrops = [('midnightblue', 'library/images/stage/solid-midnightblue.png')] # TODO: ...
nilq/baby-python
python