content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
#!/usr/bin/env python """ Unit test for the grasping_handler_server.py. NOTE: This should be run via 'rosrun grasping test_grasping_handler_server.py' and NOT with 'python test_grasping_status_server.py'. WARNING: These test requires a connection to Robot DE NIRO Author: John Lingi Date: 05/18 """ import rospy impo...
nilq/baby-python
python
# coding: utf-8 from proxy_spider.items import Proxy from proxy_spider.spiders import _BaseSpider from service.proxy.functions import exceed_check_period, valid_format class CheckerSpider(_BaseSpider): """ Check proxy's availability and anonymity. """ name = 'checker' # allowed_domains = ['*'] ...
nilq/baby-python
python
import argparse from datetime import datetime import os import torch import torch.nn as nn import torch.utils.data from model import Model from dataset import Dataset from tqdm import tqdm from sklearn.metrics import confusion_matrix parser = argparse.ArgumentParser(description='Train a CNN to classify image patche...
nilq/baby-python
python
from django.db import models from django.conf import settings from django.contrib.auth import get_user_model from django.db import models from django.db.models.signals import post_save from django.contrib.auth.models import User from products.models import Product from cart.models import ShippingDetails # Create your ...
nilq/baby-python
python
# coding: utf-8 # # This code is part of dqmc. # # Copyright (c) 2022, Dylan Jones # # This code is licensed under the MIT License. The copyright notice in the # LICENSE file in the root directory and this permission notice shall # be included in all copies or substantial portions of the Software. import logging # =...
nilq/baby-python
python
import time from multiprocessing.dummy import freeze_support from pprint import pprint from flowless import TaskState, RouterState, ChoiceState, FlowRoot, save_graph, QueueState from flowless.deploy import deploy_pipline from flowless.states.router import ParallelRouter from flowless.demo_states import ModelClass, T...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding:utf-8 -*- """ send.py will send a single messages to the queue. """ # Pika is a pure-Python implementation of the AMQP 0-9-1 protocol import pika # guest user can only connect via localhost #credentials = pika.PlainCredentials('guest', 'guest') credentials = pika.PlainCredentials('...
nilq/baby-python
python
from re import compile as re_compile, error as re_error, escape from sys import stdout from ..constant.colors import * __all__ = [ 'black', 'dark_blue', 'dark_green', 'dark_aqua', 'dark_red', 'dark_purple', 'gold', 'gray', 'dark_gray', 'blue', 'green', 'aqua', 'red', 'light_purple', 'yellow', 'white', ...
nilq/baby-python
python
# import packages import bs4 import requests from bs4 import BeautifulSoup # get soup object def get_soup(text): return BeautifulSoup(text, "lxml", from_encoding='utf-8') # extract company def extract_company(div): try: return (div.find('div', attrs={'class', 'job-result-card__contents'}).find('h4...
nilq/baby-python
python
#!/usr/bin/env python """packt.py: Grab the daily free book claim from Packt Press. This will run under Python 2.7 and 3.4 with minimum dependencies. The goals was the most simplistic code that will function. The script can be run from cron. Replace the two lines with username/email and password with you...
nilq/baby-python
python
# coding=utf-8 from __future__ import unicode_literals from frappe import _ def get_data(): return [ # Modules { "module_name": "Case Management", "color": "grey", "icon": "octicon octicon-organization", "type": "module", "label": _("Case Management") }, { "module_name": "CPBNs", "color"...
nilq/baby-python
python
#!/usr/bin/env python import argparse import gzip from contextlib import ExitStack import pysam from statistics import mean, median argparser = argparse.ArgumentParser(description = 'Aggregate depth information (output as JSON) from individual depth files (generated using SAMtools mpileup).') argparser.add_argument(...
nilq/baby-python
python
#!/usr/bin/python # -*- coding: utf-8 -*- # Filename: result_to_latex.py import os, argparse, json, math import logging TEMPLATE = r"""\begin{table*}[tb] \centering \caption{Chaos Engineering Experiment Results on HedWig}\label{tab:resultsOfHedwig} \setcounter{rowcount}{-1} \begin{tabular}{@{\makebox[3em][r]{\stepcou...
nilq/baby-python
python
from socket import * class ChatServer: def __init__(self, host, port): #startvars self.PORT = port self.HOST = host self.RECV_BUFFER = 4096 self.CONNECTION_LIST = [] #connection self.server_socket = socket(AF_INET, SOCK_STREAM) self.server_so...
nilq/baby-python
python
from collections import defaultdict from itertools import chain from typing import Collection, Dict, Set, AnyStr, Iterable, TextIO import pandas as pd from pandas import Series, DataFrame import jinja2 as j2 from burdock.core.variable import DaikonVariable, consts_from_df, vars_from_df from burdock.expander import E...
nilq/baby-python
python
r""" Gcd domains """ #***************************************************************************** # Copyright (C) 2008 Teresa Gomez-Diaz (CNRS) <Teresa.Gomez-Diaz@univ-mlv.fr> # # Distributed under the terms of the GNU General Public License (GPL) # http://www.gnu.org/licenses/ #*******************...
nilq/baby-python
python
import copy import glob import os import numpy as np import torch.utils.data as data import torchvision as tv from PIL import Image from torch import distributed from .utils import Subset, group_images # Converting the id to the train_id. Many objects have a train id at # 255 (unknown / ignored). # See there for mo...
nilq/baby-python
python
import datetime import json import yaml import random import string def get_random_name(length=20): store = string.ascii_letters + string.digits return random.choice(string.ascii_letters) + ''.join([random.choice(store) for i in range(length - 1)]) def read_credentials(filename): with open(filename) as ...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Python for AHDA. Part 1, Example 4. """ # Simple list words = ['Mary', 'had', 'a', 'little', 'lamb'] # words = ('Mary', 'had', 'a', 'little', 'lamb') print(words) print(words[1]) words[3] = 'big' print(words)
nilq/baby-python
python
from ..utils import SyncClient, __version__ from .bucket import SyncStorageBucketAPI from .file_api import SyncBucketProxy __all__ = [ "SyncStorageClient", ] class SyncStorageClient(SyncStorageBucketAPI): """Manage storage buckets and files.""" def __init__(self, url: str, headers: dict[str, str]) -> No...
nilq/baby-python
python
import tensorflow as tf import numpy as np import time import os os.environ["CUDA_VISIBLE_DEVICES"] = "4" from tensorflow.python.eager import tape class FakeData(object): def __init__(self, length): super(FakeData, self).__init__() self.length = length self.X_train = np.random.random((224...
nilq/baby-python
python
import json import logging from django.utils.translation import ugettext_lazy as _ from requests import RequestException from connected_accounts.conf import settings from connected_accounts.provider_pool import providers from .base import OAuth2Provider, ProviderAccount logger = logging.getLogger('connected_account...
nilq/baby-python
python
import argparse import difflib import re import sys from ssort._exceptions import UnknownEncodingError from ssort._files import find_python_files from ssort._ssort import ssort from ssort._utils import ( detect_encoding, detect_newline, escape_path, normalize_newlines, ) def main(): parser = argp...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: thunderstorm.proto from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _sym...
nilq/baby-python
python
import json import os def dump_json(o: object, filename: str) -> None: with open(filename, 'w', encoding='utf8') as f: json.dump(o, f, ensure_ascii=False) def load_json(filename: str): with open(filename, 'r', encoding='utf8') as f: return json.load(f) def setup_django_pycharm(): os.en...
nilq/baby-python
python
from django.test import TestCase from . import * class AbstractFormModelTestCase(TestCase): def setUp(self): pass def create_form(self): return AbstractFormModel.objects.create() def test_form_creation(self): print("Testing if running") f = self.create_form() l =...
nilq/baby-python
python
""" REST API Documentation for TheOrgBook TheOrgBook is a repository for Verifiable Claims made about Organizations related to a known foundational Verifiable Claim. See https://github.com/bcgov/VON OpenAPI spec version: v1 Licensed under the Apache License, Version 2.0 (the "License"); ...
nilq/baby-python
python
import pygments import pygments.lexers from pygments.token import Token import PIL, PIL.Image, PIL.ImageFont, PIL.ImageDraw from PIL.ImageColor import getrgb import sys, os import subprocess, re font = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'font.pil') class StyleDict(dict): ''' Store color info...
nilq/baby-python
python
class NextcloudRequestException(Exception): def __init__(self, request=None, message=None): self.request = request message = message or f"Error {request.status_code}: {request.get_error_message()}" super().__init__(message) class NextcloudDoesNotExist(NextcloudRequest...
nilq/baby-python
python
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\vet\vet_clinic_zone_director.py # Compiled at: 2017-11-06 20:04:35 # Size of source mod 2**32: 27524...
nilq/baby-python
python
#coding:utf-8 ################################################### # File Name: export.py # Author: Meng Zhao # mail: @ # Created Time: 2019年11月11日 星期一 16时03分43秒 #============================================================= import os import sys import json import shutil import tensorflow as tf import modeling from ...
nilq/baby-python
python
import os from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.plugins.plugin import Plugin from rsqueakvm.primitives import index1_0 from rsqueakvm.util.system import IS_WINDOWS class UnixOSProcessPlugin(Plugin): def is_enabled(self): return Plugin.is_enabled(self) and not IS_WINDOWS plugin...
nilq/baby-python
python
from sklearn.ensemble import GradientBoostingRegressor from deathbase.supervised.regression.base import BaseRegressor class GradientBoosting(BaseRegressor): def __init__(self, *args, **kwargs): regressor = GradientBoostingRegressor(verbose=1) super().__init__(regressor, *args, **kwargs)
nilq/baby-python
python
# Copyright 2019 Microsoft Corporation # Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 from c7n_azure.provider import resources from c7n_azure.resources.arm import ArmResourceManager @resources.register('postgresql-server') class PostgresqlServer(ArmResourceManager): """PostgreSQL ...
nilq/baby-python
python
from math import * import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt from gcparser import get_parsed_struct def Hill_Function_R(Kd,N,C): # Hill function for modeling repressors hill=1/(1+(N/Kd)**C) # print hill return hill def Hill_Function_A(Kd,N,C): # Hill fun...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Copyright (c) 2018, Tridots Tech Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals # import frappe # from _future_ import unicode_literals import frappe import frappe.utils import json from frappe import _ def g...
nilq/baby-python
python
""" Exceptions for conditions app """ class TreatmentTooRecentError(Exception): pass class TreatmentAltConflict(Exception): pass
nilq/baby-python
python
from __future__ import annotations import logging import os import pickle from collections import Counter from functools import partial from itertools import groupby from operator import itemgetter from typing import Any, Dict, Iterator, List, Optional, Tuple import click import h5py import numba import numpy as np f...
nilq/baby-python
python
import sys sys.path.append('../') from Normalizer.Normalizer import Normalizer import unittest import numpy as np from sklearn.preprocessing import MinMaxScaler, StandardScaler class TestNormalizer(unittest.TestCase): normalizer = Normalizer() test_data = [ 61.19499969, 57.31000137, 56.09249878, 61.72000122...
nilq/baby-python
python
from typing import List from local_packages.binary_tree import TreeNode # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def levelOrderBottom(self, root: Tr...
nilq/baby-python
python
import os from openpyxl import Workbook from openpyxl.styles import PatternFill from PIL import Image from tqdm import tqdm wb = Workbook() sheet = wb.active def rgb_to_hex(rgb): return '%02x%02x%02x' % rgb for file in os.listdir(): if file.endswith(".jpg") or file.endswith(".jpeg") or file.endswith...
nilq/baby-python
python
import os import numpy as np import importlib SilhouetteDetector = importlib.import_module('SilhouetteDetector') np.random.seed(0) if __name__ == "__main__": import argparse parser = argparse.ArgumentParser(description='Generate artificial videos with one subject') parser.add_argument('--dataset', type...
nilq/baby-python
python
# -*- coding: utf-8 -*- from numpy import * from datetime import datetime, timedelta from dateutil.relativedelta import * import os import re import codecs import pandas as pd import scipy.io.netcdf as spnc from ecmwfapi import ECMWFDataServer import time_tools as tt import geo_tools as gt import downlo...
nilq/baby-python
python
from robot.api.parsing import ( Token, ModelTransformer, SectionHeader, EmptyLine ) from robot.parsing.model.statements import Statement import click class MergeAndOrderSections(ModelTransformer): """ Merge duplicated sections and order them. Default order is: Comments > Settings > Variab...
nilq/baby-python
python
from distutils.core import setup from Cython.Build import cythonize setup(ext_modules=cythonize('harmony.pyx'))
nilq/baby-python
python
from logbook import Logger, StreamHandler, TimedRotatingFileHandler from logbook.more import ColorizedStderrHandler import logbook import socket import uuid import sys import fire import os def logger(name='LOGBOOK', log_path='', file_log=False): logbook.set_datetime_format('local') ColorizedStderrHandler(bubble=Tr...
nilq/baby-python
python
import test_reader as FR if __name__ == "__main__": extra = FR.Pair() extra.first = '1' extra.second = '2' buf = extra.to_fbs() extra1 = FR.Pair(buf) acc = FR.Account() acc.langs.append(FR.test_fbs.Language.Language.CHT) acc.langs.append(FR.test_fbs.Language.Language.CHS) ac...
nilq/baby-python
python
# -*- coding: utf-8 -*- # # Copyright 2019 Google LLC. 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 requir...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2019, Nigel Small # # 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 requi...
nilq/baby-python
python
import logging import random import string import sys import textwrap import time import typing from contextlib import contextmanager from datetime import datetime, timedelta from functools import lru_cache, wraps import flask from util.config_utils import iris_prefix def cls_by_name(fully_qualified_classname): ...
nilq/baby-python
python
import sys from itertools import islice, izip def parse(lines): return [int(line.split(" ")[-1]) for line in lines] def generator(startValue, factor, multiple): prevValue = startValue while True: prevValue = ( factor * prevValue ) % 2147483647 if prevValue % multiple == 0: yiel...
nilq/baby-python
python
import sys import random import helptext from time import sleep from threading import Timer from mbientlab.metawear import MetaWear, libmetawear, parse_value from mbientlab.metawear.cbindings import * from mbientlab.warble import * from resizable import * if sys.version_info[0] < 3: import Tkinter as Tk impor...
nilq/baby-python
python
real_value = float(input("enter real value(이론값): ")) #참값 test_value = float(input("enter test value: ")) #실험값 err = abs(real_value - test_value) / real_value print(f"err = {err}")
nilq/baby-python
python
# Copyright 2010 Gregory L. Rosenblatt # 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 wr...
nilq/baby-python
python
# 11.4. Dictionary methods """ Dictionaries have a number of useful built-in methods. The following table provides a summary and more details can be found in the Python Documentation. Method Parameters Description keys none Returns a view of the keys in the dictionary values none Returns a view of the values ...
nilq/baby-python
python
from abc import ABC, abstractmethod import pandas as pd class Interpolator(ABC): @abstractmethod def get_approximate_value(self, x: float, table: pd.DataFrame) -> float: raise NotImplementedError
nilq/baby-python
python
""" Logging module. """ import logging class Logger: """ Logger helper. """ loggers = {} level = logging.WARNING def __init__(self, logger): self.__level = Logger.level self.__logger = logging.getLogger(logger) # set formatter #formatter = logging.Formatter('[...
nilq/baby-python
python
"""Test prsw.api.looking_glass.""" import pytest from datetime import datetime from typing import Iterable from unittest.mock import patch from .. import UnitTest from prsw.api import API_URL, Output from prsw.stat.looking_glass import LookingGlass class TestLookingGlass(UnitTest): RESPONSE = { "messag...
nilq/baby-python
python
from django.urls import path, include # from django.conf.urls import include, url # from .views import TestViewSet from .views import * from rest_framework import routers router = routers.DefaultRouter() router.register('task_list', TestViewSet, basename="task_list") router.register('Machine', MachineViewSet, basenam...
nilq/baby-python
python
from utils.KTS.cpd_auto import *
nilq/baby-python
python
class City: ''' This class will hold a city in terms of its x and y coordinates @author Sebastian Castro ''' def __init__(self, x, y): # Holds the x and y components self.x = x self.y = y self.point = (x, y) def __str__(self): return f'Ci...
nilq/baby-python
python
import os # Directory Config ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) DB_DIR = os.path.join(ROOT_DIR, 'db') # Regexes COURSE_NAME_PATTERN = r'[FD]0*(\d+\w*)\.?' DAYS_PATTERN = f"^{'(M|T|W|Th|F|S|U)?'*7}$" # Scraped table headers (for scrape_term.py) HEADERS = ( 'course', 'CRN', 'desc', '...
nilq/baby-python
python
#!/usr/bin/env python3 # coding:utf-8 import unittest import zencad #from PyQt5.QtWidgets import * #from PyQt5.QtCore import * #from PyQt5.QtGui import * #from zencad.gui.settingswdg import SettingsWidget #qapp = QApplication([]) class WidgetsTest(unittest.TestCase): def test_segment_probe(self): pass...
nilq/baby-python
python
import numpy as np import tensorflow as tf # N, size of matrix. R, rank of data N = 100 R = 5 # generate data W_true = np.random.randn(N,R) C_true = np.random.randn(R,N) Y_true = np.dot(W_true, C_true) Y_tf = tf.constant(Y_true.astype(np.float32)) W = tf.Variable(np.random.randn(N,R).astype(np.float32)) C = tf.Varia...
nilq/baby-python
python
import os script_dir = os.path.dirname(os.path.abspath(__file__)) input = [] with open(os.path.join(script_dir, "input.txt"), "r") as file: questionaire = {} for line in file: if (line.strip('\n') != ""): if "People" in questionaire: questionaire["People"] += 1 else: questionaire["...
nilq/baby-python
python
from distutils.core import setup try: import pypandoc long_description = pypandoc.convert('README.md', 'rst') except(IOError, ImportError): long_description = open('README.md').read() setup( name='pymp4parse', version='0.3.0', packages=[''], url='https://github.com/use-sparingly/pymp4parse...
nilq/baby-python
python
import scrapy class ScrapeTableSpider(scrapy.Spider): name = 'jcs' def start_requests(self): urls = [ 'https://en.wikipedia.org/wiki/List_of_schools_in_Singapore', ] for url in urls: yield scrapy.Request(url=url, callback=self.parse) def parse(self, respon...
nilq/baby-python
python
# -*- coding: utf-8 -*- # # Copyright (C) 2018 CERN. # Copyright (c) 2017 Thomas P. Robitaille. # # Asclepias Broker is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Asclepias Broker.""" from __future__ import absolute_import, print...
nilq/baby-python
python
# # Copyright (C) 2020 CESNET. # # oarepo-fsm is free software; you can redistribute it and/or modify it under # the terms of the MIT License; see LICENSE file for more details. """OArepo FSM library for record state transitions.""" from flask import url_for from invenio_records_rest.links import default_links_factor...
nilq/baby-python
python
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bldcontrol', '0006_brlayer_local_source_dir'), ] operations = [ migrations.AlterField( model_name='brlayer', ...
nilq/baby-python
python
""" You are given a m x n 2D grid initialized with these three possible values. -1 - A wall or an obstacle. 0 - A gate. INF - Infinity means an empty room. We use the value 231 - 1 = 2147483647 to represent INF as you may assume that the distance to a gate is less than 2147483647. Fill each empty room with the distanc...
nilq/baby-python
python
import difflib import bs4 as bs try: from PIL import Image except ImportError: import Image import pytesseract def parse_hocr(search_terms=None, hocr_file=None, regex=None): """Parse the hocr file and find a reasonable bounding box for each of the strings in search_terms. Return a dictionary with va...
nilq/baby-python
python
############################################################################# ## ## Copyright (C) 2019 The Qt Company Ltd. ## Contact: http://www.qt.io/licensing/ ## ## This file is part of the Qt for Python examples of the Qt Toolkit. ## ## $QT_BEGIN_LICENSE:BSD$ ## You may use this file under the terms of the BSD lic...
nilq/baby-python
python
from pbge.plots import Plot import game import gears import pbge import random from game import teams # *************************** # *** MECHA_ENCOUNTER *** # *************************** # # Elements: # LOCALE: The scene where the encounter will take place # FACTION: The faction you'll be fighting; may b...
nilq/baby-python
python
from distutils.core import setup setup( name = 'wthen', packages = ['wthen'], # this must be the same as the name above version = '0.1.2', description = 'A simple rule engine with YAML format', author = 'Alex Yu', author_email = 'mltest2000@aliyun.com', url = 'https://github.com/sevenbigcat/wthen', # use ...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 26 22:03:23 2018 @author: sameermac """ #Computing Tanimoto Distance and uniquenesses of 50 molecules from QM9 Database #from __future__ import print_function from rdkit import Chem from rdkit.Chem.Fingerprints import FingerprintMols from rdkit im...
nilq/baby-python
python
"""Data preprocessing script for Danish Foundation Models """ from typing import Union from functools import partial from datasets.arrow_dataset import Dataset from transformers import AutoTokenizer, BatchEncoding from transformers.tokenization_utils_base import PreTrainedTokenizerBase from transformers.tokenization_u...
nilq/baby-python
python
import glob import torch import tensorflow as tf from pathlib import Path from tqdm import tqdm from itertools import cycle, islice, chain from einops import rearrange, repeat import torch.nn.functional as F class PairTextSpectrogramTFRecords(object): def __init__( self, local_or_gcs_path, ...
nilq/baby-python
python
# How to work with lists students = [ "Monika", "Fritz", "Luise", "Andi" ] print(students) # Add item to list students.append("Ronald") print(students) # Get the length of the list print(len(students)) # Get a specific student print(students[2])
nilq/baby-python
python
import numpy as np from metagraph import translator from metagraph.plugins import has_grblas, has_scipy from ..numpy.types import NumpyVector, NumpyNodeMap from ..python.types import PythonNodeSet if has_grblas: import grblas from .types import ( GrblasEdgeMap, GrblasEdgeSet, GrblasGra...
nilq/baby-python
python
from deeplodocus.utils.version import get_version name = "deeplodocus" VERSION = (0, 1, 0, 'alpha', 1) #__version__ = get_version(VERSION) __version__ = "0.3.0"
nilq/baby-python
python
import time import logging.config from scapy.all import get_if_hwaddr, sendp, sniff, UDP, BOOTP, IP, DHCP, Ether logging.getLogger("scapy.runtime").setLevel(logging.ERROR) logger = logging.getLogger(name="elchicodepython.honeycheck") def apply_controls(control_modules, **kwargs): for control_object in control_...
nilq/baby-python
python
import re banner = """ _____ __ __ _____ _____ | __ \\\ \ / / /\ | __ \ | __ \ [Author : Imad Hsissou] | |__) |\ \_/ / / \ | |__) || |__) | [Author email : imad.hsissou@gmail.com] | ___/ \ / / /\ \ | _ / | ___/ [https://github.com/imadhsissou] | | | | / ____ \ | | \ \ | | ...
nilq/baby-python
python
"""This module tests the parsing logic in card module.""" import unittest from poker.model import card class CardTests(unittest.TestCase): """Test the card class.""" def test_from_string(self): """Test from_string constructs cards correctly.""" test_cases = [ { ...
nilq/baby-python
python
import IMLearn.learners.regressors.linear_regression from IMLearn.learners.regressors import PolynomialFitting from IMLearn.utils import split_train_test import numpy as np import pandas as pd import plotly.express as px import plotly.io as pio import matplotlib.pyplot as plt pio.templates.default = "simple_white" plt...
nilq/baby-python
python
""" batch_size, input_height, input_width, in_channels, out_channels, kernel_height, kernel_width, ClassVector=None, bias=None, dilation=1, stride=1, padding=0 """ gated_pixelcnn_shape = [ (1, 256, 256, 3, 256, 3, None, None, 1, 1, 0) ]
nilq/baby-python
python
""" This program print the matrix in spiral form. This problem has been solved through recursive way. Matrix must satisfy below conditions i) matrix should be only one or two dimensional ii) number of column of all rows should be equal """ def check_matrix(matrix: list[list]) -> bool: # must...
nilq/baby-python
python
from datetime import datetime import os import random import sys import traceback import types import gin import numpy as np import tensorflow as tf from stackrl import agents from stackrl import envs from stackrl import metrics from stackrl import nets @gin.configurable(module='stackrl') class Training(object): "...
nilq/baby-python
python
import os import re import nltk import numpy as np from sklearn import feature_extraction from tqdm import tqdm import codecs #from embeddings import get_similarity_vector from sklearn.feature_extraction.text import TfidfVectorizer from scipy.spatial import distance _wnl = nltk.WordNetLemmatizer() import pickle from ut...
nilq/baby-python
python
from django import forms from .models import Artist, Festival class ArtistAddForm(forms.ModelForm): class Meta: model = Artist fields = ('stage_name', 'first_name', 'description', 'born', 'contry_origin', 'd...
nilq/baby-python
python
import sqlalchemy as sa from aiopg.sa import Engine from sqlalchemy import Table from app.database.common import resultproxy_to_dict from app.database.models.category import Category from app.database.models.entity import Entity async def get_all_categories( engine: Engine, ): table: Table = Category.__...
nilq/baby-python
python
#!/usr/bin/env python import numpy as np import theano import theano.tensor as T from scipy.sparse import lil_matrix from stochastic_bb import svrg_bb, sgd_bb """ An example showing how to use svrg_bb and sgd_bb The problem here is the regularized logistic regression """ __license__ = 'MIT' __author__ = 'Co...
nilq/baby-python
python
class MinimapCatalog(): single_map = {'Grass': (1, 0), 'House': (2, 0), 'Shop': (3, 0), 'Switch': (4, 0), 'Fort': (5, 0), 'Ruins': (6, 0), 'Forest': (8, 0), 'Thicket': (9, 0), ...
nilq/baby-python
python
""" 24hourvideo ----------- A copy of `24 Hour Psycho`_ by Douglas Gordon written in Python. .. _24 Hour Psycho: https://en.wikipedia.org/wiki/24_Hour_Psycho """ from setuptools import setup import ast import re _version_re = re.compile(r'__version__\s+=\s+(.*)') with open('twentyfourhourvideo/__init__.py', 'r...
nilq/baby-python
python
from conans.model import Generator from conans.paths import BUILD_INFO class DepsCppTXT(object): def __init__(self, deps_cpp_info): self.include_paths = "\n".join(p.replace("\\", "/") for p in deps_cpp_info.include_paths) self.lib_paths = "\n".join(p.replace(...
nilq/baby-python
python
from fabric.contrib.files import exists from fabric.operations import put, get from fabric.colors import green, red from fabric.api import env, local, sudo, run, cd, prefix, task, settings # Server hosts STAGING_USER = 'ubuntu' PRODUCTION_USER = 'ubuntu' STAGING_SERVER = '%s@54.68.3.255' % STAGING_USER PRODUCTION_SER...
nilq/baby-python
python
""" Implements the Temoral Difference Learning algorithm. This solver contains TD-Lambda methods based on Prof.David Silver Lecture slides. Note that TD-Lambda can be used as other solver by setting the n-step return and \gamma value accordingly (c) copyright Kiran Vaddi 02-2020 """ import numpy as np import pdb from ...
nilq/baby-python
python
""" This script shows the for code block """ NAME = input("Please enter your name: ") AGE = int(input("How old are you, {0}? ".format(NAME))) print(AGE) # if AGE >= 18: # print("You are old enough to vote") # print("Please put an X in the box") # else: # print("Please come back in {0} years".format(18 - AG...
nilq/baby-python
python
from django.contrib import admin from .models import Blog, BlogType # Register your models here. class BlogAdmin(admin.ModelAdmin): list_display = ('title', 'author', 'blog_type', 'created_time') @admin.register(BlogType) class BlogTypeAdmin(admin.ModelAdmin): list_display = ('id', 'type_name') admin.site.re...
nilq/baby-python
python
from django.conf.urls import url from .views import ( CheckoutView, CheckoutUpdateView, OrderDeleteView, CheckoutOrderView, OrdersView, AcceptedOrdersView, RejectedOrdersView, BuyOrdersView, BuyThankView, ) urlpatterns = [ url(r'^order/(?P<id>\d+)/$', CheckoutView.as_view()...
nilq/baby-python
python