content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
# -*- coding: utf-8 -*- """ Created on Tue Aug 7 14:04:20 2018 @author: pgallego """ import numpy as np from keras.callbacks import TensorBoard,ModelCheckpoint from vgg16 import CreateModel from PrepareDate import PrepareData import os input_shape=226 channels=3 X_train,y_train,X_val,y_val,X_test,y_test = Prep...
nilq/baby-python
python
# device provisioning - automate devices configuration files def greeting(name): print("Hello", name) greeting(input("What is your name: \n")) if_name = input("Please provide the interface name: \n") if_name = if_name.lower() print(if_name) # ip_addr = '10.1.10.254' # vrf = 'lab' # ping = 'ping {} vrf {} '....
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """XML to dict parse.""" import json import textwrap from configparser import ConfigParser from pathlib import Path from typing import Iterable import untangle from jira_freeplane.common import LOG from jira_freeplane.mm_settings import MMConfig class Node: """Node...
nilq/baby-python
python
from spidermon.contrib.actions.telegram.notifiers import ( SendTelegramMessageSpiderFinished, ) from spidermon.contrib.scrapy.monitors import ErrorCountMonitor, FinishReasonMonitor from spidermon.core.suites import MonitorSuite class SpiderCloseMonitorSuite(MonitorSuite): monitors = [ ErrorCountMonito...
nilq/baby-python
python
arr = [1, 4, 7, 9, 14, 17, 39, 56] targets = (8, 39) def linear_search(arr, target): """ >>> all(linear_search(arr, x) == arr.index(x) if x in arr else -1 for x in targets) True """ for i, item in enumerate(arr): if item == target: return i return -1 for ta...
nilq/baby-python
python
"""Test subscriptions interact with ISAs: - Create an ISA. - Create a subscription, response should include the pre-existing ISA. - Modify the ISA, response should include the subscription. - Delete the ISA, response should include the subscription. - Delete the subscription. """ import datetime from monit...
nilq/baby-python
python
import argparse import glob import os import pandas as pd import numpy as np import cv2 from math import sqrt import random import wget import zipfile ''' Labels used in [1] T. Kawashima et al., "Action recognition from extremely low-resolution thermal image sequence," 2017 14th IEEE International Conference on ...
nilq/baby-python
python
class Account: """ Class that generates new instances of accounts """ account_list = [] def __init__(self,account_name,password): """ __init__ method that helps us define the properties for our objects Args: account_name: New account name ...
nilq/baby-python
python
""" Problem 16: https://projecteuler.net/problem=16 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^1000? """ def solution(power: int = 1000) -> int: """ Returns the sum of the digits of the number 2^power. >>> solution(1000) 1366 ...
nilq/baby-python
python
from flask import Flask, jsonify, make_response, request app = Flask(__name__) @app.route('/parse/json', methods=['GET', 'POST', 'DELETE', 'PUT']) def add(): if request.headers.get("Content-Type") == 'application/json': # HTTPリクエストのMIMEタイプがapplication/json data = request.get_json() return...
nilq/baby-python
python
import logging from subprocess import ( PIPE, Popen ) SUDO_PATH = '/usr/bin/sudo' SUDO_PRESERVE_ENVIRONMENT_ARG = '-E' SUDO_USER_ARG = '-u' log = logging.getLogger(__name__) def sudo_popen(*args, **kwargs): """ Helper method for building and executing Popen command. This is potentially sensetive...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui_visualise_graph.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog_visualiseGraph(object): def setupUi(self, Dialog_v...
nilq/baby-python
python
#!/usr/bin/env python # Copyright (c) 2005 Freescale Semiconductor, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # o Redistributions of source code must retain the above copyright notic...
nilq/baby-python
python
from voluptuous import * from ..defaults import settings, filtertypes from ..exceptions import ConfigurationError from . import SchemaCheck import logging logger = logging.getLogger(__name__) def filtertype(): return { Required('filtertype'): Any( In(settings.all_filtertypes()), msg...
nilq/baby-python
python
sessions = int(input()) teams = [int(x) for x in input().split()] possible = True for i in range(sessions - 1): if teams[i] < 0: possible = False teams[i+1] -= teams[i]%2 if teams[sessions - 1] % 2 == 1: possible = False print("YES" if possible else "NO")
nilq/baby-python
python
# Copyright (c) 2014, Yuta Okamoto <okapies@gmail.com> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, AWSProperty, Tags from .validators import boolean, integer, mutually_exclusive class Source(AWSProperty): props = { 'Password': (str, False), 'Revision': (...
nilq/baby-python
python
# posting to: http://localhost:3000/api/articles/update/:articleid with title, content # changes title, content # # id1: (darwinbot1 P@ssw0rd!! 57d748bc67d0eaf026dff431) <-- this will change with differing mongo instances import time # for testing, this is not good import requests # if not installed already, run python...
nilq/baby-python
python
import re from src.util import poe_consts from src.util.logging import log from src.util.pob import pob_conf class Gem: __slots__ = 'name', 'level', 'quality', 'id', 'skill_part', 'enabled', 'second_name', 'active_part', 'is_active' def __init__(self, id, name, level, quality, skill_part, enabled=''): ...
nilq/baby-python
python
#! /usr/bin/python #Copyright 2008, Meka Robotics #All rights reserved. #http://mekabot.com #Redistribution and use in source and binary forms, with or without #modification, are permitted. #THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS #"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDI...
nilq/baby-python
python
import unittest from unittest.mock import Mock from data_repo_client import RepositoryApi from dagster_utils.contrib.data_repo.jobs import poll_job, JobFailureException, JobTimeoutException from dagster_utils.contrib.data_repo.typing import JobId class PollJobTestCase(unittest.TestCase): def setUp(self): ...
nilq/baby-python
python
from gobbli.dataset.cmu_movie_summary import MovieSummaryDataset from gobbli.dataset.imdb import IMDBDataset from gobbli.dataset.newsgroups import NewsgroupsDataset from gobbli.dataset.trivial import TrivialDataset __all__ = ["TrivialDataset", "NewsgroupsDataset", "IMDBDataset", "MovieSummaryDataset"]
nilq/baby-python
python
from argparse import ArgumentParser from datetime import datetime time_now = datetime.utcnow().strftime("%Y%m%d%H%M%S") def str2bool(v): if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return False else: raise argparse.Ar...
nilq/baby-python
python
"""changed covid to remove source Revision ID: faaf679b71ce Revises: d57323c5f17d Create Date: 2020-03-23 14:18:04.931393 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'faaf679b71ce' down_revision = 'd57323c5f17d' branch_labels = None depends_on = None def ...
nilq/baby-python
python
from abc import ABC import scrapy import re import json from copyheaders import headers_raw_to_dict from ..items import HistoricNetValueItem from scrapy.spidermiddlewares.httperror import HttpError from twisted.internet.error import DNSLookupError from twisted.internet.error import TimeoutError, TCPTimedOutError '''...
nilq/baby-python
python
from Optimizador.C3D import * t = -1 e = -1 def getEncabezado(): content = "from goto import with_goto\n" content += "from Instrucciones.TablaSimbolos.Tabla import Tabla\n" content += "from Instrucciones.Sql_insert import insertTable\n" content += "from Instrucciones.Sql_drop import DropTable,DropData...
nilq/baby-python
python
from django.contrib import admin from . import models admin.site.register(models.Training) admin.site.register(models.Education) admin.site.register(models.Experience) admin.site.register(models.Skills) admin.site.register(models.cv)
nilq/baby-python
python
from builtins import license from os.path import basename from typing import List from pydantic import BaseModel from iiif_binder import Config, Metadata, Image def generate_manifest( identifier: str, config: Config, metadata: Metadata, images: List[Image] ) -> dict: manifest = { "@context": "http:/...
nilq/baby-python
python
from PyQt5 import QtCore from pyqtgraph import PlotCurveItem, PlotDataItem, ImageItem from .DataItem import ExtendedDataItem from ...logging import get_logger logger = get_logger("PlotMenu") class PlotMenuMixin: def raiseContextMenu(self, ev): """ Raise the context menu, removing extra separators ...
nilq/baby-python
python
# Copyright (c) 2019, Piet Hein Schouten. All rights reserved. # Licensed under the terms of the MIT license. from .card import Card from .file_attachment import FileAttachment from .retrieval_attempt import RetrievalAttempt from .tag import Tag
nilq/baby-python
python
"""Module for the custom Django sampledata command.""" import csv import random from django.core import management from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.gis.geos import Point from allauth.account.models import EmailAddress from tests.users.factories import ...
nilq/baby-python
python
# https://leetcode.com/problems/search-a-2d-matrix/ # # Write an efficient algorithm that searches for a value in an m x n matrix. # This matrix has the following properties: # # Integers in each row are sorted from left to right. # The first integer of each row is greater than the last integer of the previous row. # #...
nilq/baby-python
python
from django.shortcuts import render, redirect from comments.forms import CommentForm from django.http import HttpResponseBadRequest # Create your views here. def create_comment(request): form = CommentForm(request.POST) if form.is_valid(): comment = form.save(commit=False) comment.author = requ...
nilq/baby-python
python
#!/usr/bin/python3 -OO # Copyright 2007-2020 The SABnzbd-Team <team@sabnzbd.org> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any late...
nilq/baby-python
python
from gatekeeper import Endpoint class Hello(Endpoint): path = '/hello' def get(self, request, response): response.body = 'hello world'
nilq/baby-python
python
from app import manager if __name__ == "__main__": manager.run()
nilq/baby-python
python
from __future__ import annotations from src.models.verse_reference import VerseReference class ChapterReference: book_name: str chapter_number: int version: str def __init__(self, book_name: str, chapter_number: int, version: str) -> None: self.book_name = book_name self.chapter_numb...
nilq/baby-python
python
# Copyright 2017 Google LLC. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # #...
nilq/baby-python
python
""" .. --------------------------------------------------------------------- ___ __ __ __ ___ / | \ | \ | \ / the automatic \__ |__/ |__/ |___| \__ annotation and \ | | | | \ analysis ___/...
nilq/baby-python
python
#!/usr/bin/env python3 # Get one postal code from the command line # Example ./get_latlong_cmd A1B2C3 import sys import os import googlemaps import json gmaps = googlemaps.Client(key=os.environ['DIRECTIONS_API_KEY']) code = sys.argv[1] print(code) place_result = gmaps.find_place(input = code, ...
nilq/baby-python
python
import coreapi import coreschema from django_filters.rest_framework import DjangoFilterBackend from drf_haystack.filters import HaystackFilter from drf_haystack.generics import HaystackGenericAPIView from rest_framework import viewsets from rest_framework.mixins import ListModelMixin from rest_framework.permissions imp...
nilq/baby-python
python
from django.urls import path, include from rest_framework import routers from . import viewsets router = routers.SimpleRouter() router.register('namespaces', viewsets.NamespaceViewSet) app_name = 'api' urlpatterns = [ path('', include(router.urls)), ]
nilq/baby-python
python
import logging import numpy as np from Bio import SeqIO logger = logging.getLogger(__name__) import os import re import sys import click import pandas as pd import typing as t sys.path.append("..") from utils.rna_struct_utils import RNAStructUtils df = pd.DataFrame({"id": [1, 2, 3, 4]}) def get_secondary_struct(...
nilq/baby-python
python
def includeme(config): config.add_static_view('static', 'static', cache_max_age=0) config.add_route('home', '/') config.add_route('auth', '/auth') config.add_route('pantry', '/pantry') config.add_route('detail', '/detail/{upc}') config.add_route('manage_item', '/manage_item') config.add_rout...
nilq/baby-python
python
from method import * from friends import * import numpy as np import os import sys # Run FOF algorithm on all blocks of data in 'split_dir' ''' Required parameters in config file: directory, split_dir, m1, m2, t_gap, v_gap, tstart, tsamp, vsamp, fof_testing_mode And from FITS header: TBIN, CHAN_BW, OBSF...
nilq/baby-python
python
class ClientTrader(): def __init__(self) -> None: pass def login(self) -> None: pass if __name__ == '__main__': pass
nilq/baby-python
python
# # Copyright 2021 Budapest Quantum Computing Group # # 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...
nilq/baby-python
python
selenium_wrapper_web_driver_not_found_error = "Web Driver not found" selenium_wrapper_opera_path_error = "Opera need executable path" selenium_wrapper_set_options_error = "only accept dict type" selenium_wrapper_set_argument_error = "only accept str type"
nilq/baby-python
python
""" This module defines the bulk modulus workflow. """ from uuid import uuid4 from atomate.utils.utils import get_logger from atomate.vasp.firetasks.parse_outputs import FitEOSToDb from atomate.vasp.workflows.base.deformations import get_wf_deformations from fireworks import Firework, Workflow from pymatgen.analysis....
nilq/baby-python
python
import abc from torch.nn import Module class CuriosityModule(abc.ABC, Module): def __init__(self): super().__init__() # self.get_single_intrinsic_reward = single_batch(self.get_intrinsic_reward) # self.get_single_training_loss = single_batch(self.get_training_loss) @abc.abstractmeth...
nilq/baby-python
python
from collections import namedtuple GamePlayerScores = namedtuple( 'GamePlayerScores', ['assists', 'creep_score', 'deaths', 'kills', 'ward_score'] ) GamePlayerItem = namedtuple( 'GamePlayerItem', ['id', 'name', 'slot', 'can_use', 'consumable', 'count', 'price'] ) GamePlayerRunes = namedtuple( 'Gam...
nilq/baby-python
python
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- import os, os.path as path from .web_server import web_server from bes.fs.file_util import file_util from bes.fs.file_path import file_path from bes.fs.testing.temp_content import temp_content from bes.archive.temp_archive impo...
nilq/baby-python
python
from aiohttp import web from Bubot.Helpers.Helper import Helper class ReportHandler(web.View): def __init__(self, request): web.View.__init__(self, request) self.obj_type = self.request.match_info.get('objType') self.obj_name = self.request.match_info.get('objName') self.report_nam...
nilq/baby-python
python
# coding: utf-8 """ Looker API 3.0 Reference ### Authorization The Looker API uses Looker **API3** credentials for authorization and access control. Looker admins can create API3 credentials on Looker's **Admin/Users** page. Pass API3 credentials to the **/login** endpoint to obtain a temporary access_token....
nilq/baby-python
python
""" Author: shikechen Function: Calculate AQI(Air Quality Index) Version: 1.0 Date: 2019/3/9 """ def cal_linear(iaqi_lo, iaqi_hi, bp_lo, bp_hi, cp): iaqi = (iaqi_hi - iaqi_lo) * (cp - bp_lo) / (bp_hi - bp_lo) + iaqi_lo return iaqi def cal_pm_iaqi(pm_val): if 0 <= pm_val < 36: iaq...
nilq/baby-python
python
import pytest from .data import TEST_DATA_ROOT TEXTGRID_PATHS = sorted( TEST_DATA_ROOT.glob('wav-textgrid/*.TextGrid') ) @pytest.fixture def textgrid_paths(): return TEXTGRID_PATHS @pytest.fixture(params=TEXTGRID_PATHS) def a_textgrid_path(request): return request.param
nilq/baby-python
python
__all__ = ['testing'] from .testing import pic1 , pic2
nilq/baby-python
python
# Copyright 2021 The Private Cardinality Estimation Framework Authors # # 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 b...
nilq/baby-python
python
from flask import jsonify from meli.morse.app.exceptions import ValidationError from . import api def bad_request(message): response = jsonify({'error': 'bad request', 'message': message}) response.status_code = 400 return response @api.errorhandler(ValidationError) def validation_error(err): return...
nilq/baby-python
python
# Demonstration local server. # In one window: # python server.py -D localhost # In another window: # python coapget.py -h localhost -v # python coapget.py -h localhost -u uptime # python coapget.py -h localhost -u counter # python coapget.py -h localhost -u unknown import sys import coapy.connection import coapy...
nilq/baby-python
python
import requests import sqlite3 import random from html.parser import HTMLParser parser = HTMLParser() connection=sqlite3.connect('previous') cursor=connection.cursor() import sys import json import discord from discord.ext import commands import time TOKEN = 'NDQwOTMzMjE1NTc5MTQ0MjAz.DmWipQ.p110Y5lhaNCZMYiDYI8mNtghNpk...
nilq/baby-python
python
"""Decodes and logs angular data from AMS AS5048A.""" # pylint: disable=import-error, import-outside-toplevel, fixme, missing-function-docstring import argparse import logging import os import time from typing import Any, List from meter import Meter from sensor import Sensor from volume import Volume from writer impo...
nilq/baby-python
python
import shutil import os.path def build(source_path, build_path, install_path, targets): pass
nilq/baby-python
python
from watchmen.common.watchmen_model import WatchmenModel from watchmen.raw_data.rule_schema import RuleType, DSLType class RuleContext(WatchmenModel): type: RuleType = None dsl: DSLType = None orgId: int = None orgName: str = None productId: int = None productName: str = None ruleId: int =...
nilq/baby-python
python
import pytest from typing import List from io import BytesIO from dafni_cli.datasets.dataset_metadata import DataFile, DatasetMetadata @pytest.fixture def get_dataset_list_fixture() -> List[dict]: """Test fixture for simulating the dataset data return from calling the get datasets API Returns: L...
nilq/baby-python
python
import argparse import os import signal from typing import Dict, Optional import numpy as np import torch import torchaudio from loguru import logger from torch import Tensor, nn from torch.optim import Adam, AdamW, Optimizer, RMSprop from torch.types import Number from df.checkpoint import load_model, read_cp, write...
nilq/baby-python
python
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Module that contains Houdini utility functions and classes """ from __future__ import print_function, division, absolute_import import hou import hdefereval def get_houdini_version(as_string=True): """ Returns version of the executed Houdini :param as_...
nilq/baby-python
python
# coding: utf-8 from __future__ import absolute_import from bitmovin_api_sdk.common import BaseApi, BitmovinApiLoggerBase from bitmovin_api_sdk.common.poscheck import poscheck_except from bitmovin_api_sdk.models.bitmovin_response import BitmovinResponse from bitmovin_api_sdk.models.dolby_vision_metadata import DolbyV...
nilq/baby-python
python
# Generated by Django 3.1.13 on 2021-07-30 14:42 import django.core.serializers.json from django.db import migrations, models import django.db.models.deletion import taggit.managers import uuid class Migration(migrations.Migration): initial = True dependencies = [ ("extras", "0005_configcontext_dev...
nilq/baby-python
python
# # Copyright (c) 2021 Seagate Technology LLC and/or its Affiliates # # 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 ap...
nilq/baby-python
python
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
nilq/baby-python
python
import numpy as np import matplotlib.pyplot as plt class comparison: def __init__(self,X_test,y_test): self.X_test = X_test self.y_test = y_test self.predictions_dict = {"True Labels":{"predictions": self.y_test,"threshold": 0.5}} self.labels_dict = {"True Labels":{"labe...
nilq/baby-python
python
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Seymour { public partial class AddFeedDialog : Form { public AddFeedDialog() { Initializ...
nilq/baby-python
python
# The Twitter API v2 recent search endpoint provides developers with API access to public Tweets posted over the last week. The endpoint, receiving a single search query and responding with matching Tweets. import requests, configparser, json # Read the keys from auth.ini and define them config = configparser.ConfigP...
nilq/baby-python
python
import unittest from query import QueryBuilder class TestBingoQL(unittest.TestCase): def setUp(self): self.builder = QueryBuilder() def testQueryByPropName(self): query = self.builder.build_query('"monoisotopic_weight"') self.assertEquals(u"(elems->>'y' = %(property_term_0)s)", query)...
nilq/baby-python
python
import click from ..cli import with_context @click.command('test', short_help='Run a suite of tests to validate the correctness of a book') @with_context def test_command(ctx=None): pass
nilq/baby-python
python
import random class StatesPool: def __init__(self, capacity = 10000000): self.capacity = capacity self.pool = [] self.position = 0 def push(self, state): if len(self.pool) < self.capacity: self.pool.append(None) self.pool[self.position] = state self....
nilq/baby-python
python
#!/usr/bin/python3.6 import os import re import sys import yaml from glob import glob from collections import OrderedDict from typing import Any, List import numpy as np import pandas as pd import lightgbm as lgb from scipy.stats import describe from tqdm import tqdm from sklearn.multiclass import OneVsRestClassif...
nilq/baby-python
python
import abc import asyncio import time from typing import Awaitable, Callable, List, Optional import multidict import yarl from .base import ClosableResponse, EmptyResponse, Header, Request from .circuit_breaker import CircuitBreaker from .deadline import Deadline from .metrics import MetricsProvider from .priority im...
nilq/baby-python
python
description = 'Camini Camera Synchronisation Detector' group = 'lowlevel' pvprefix = 'SQ:ICON:CAMINI:' pvprefix_sumi = 'SQ:ICON:sumi:' pvprefix_ai = 'SQ:ICON:B5ADC:' includes = ['shutters'] display_order = 90 devices = dict( cam_shut = device('nicos.devices.epics.EpicsReadable', epicstimeout = 3.0, ...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ 使用Elman网络(简单局部回归网络) @author: simon """ import sys,time import getopt import numpy import theano import theano.tensor as T import matplotlib.pyplot as plt from collections import OrderedDict import copy import utilities.datagenerator as DG reload(DG) compile_mode = 'FAST_COMPILE' theano.co...
nilq/baby-python
python
#!/usr/bin/env python try: from setuptools import setup, find_packages except: from distutils.core import setup setup(name='sprinter', version='1.4.2', description='a utility library to help environment bootstrapping scripts', long_description=open('README.rst').read(), author='Yusuke ...
nilq/baby-python
python
""" Script for calculating GMM predictive """ import numpy as np from scipy.stats import norm import copy import scipy as sp from sklearn.mixture import GaussianMixture from sklearn.mixture.gaussian_mixture import _compute_precision_cholesky import npl.sk_gaussian_mixture as skgm def lppd(y,pi,mu,sigma,K): #calcul...
nilq/baby-python
python
from decimal import Decimal from django.core import exceptions from django.core.validators import MinValueValidator, MaxValueValidator from django.db import models from django.utils.translation import gettext_lazy as _ from oscar.core.loading import get_model, get_class Benefit = get_model("offer", "Benefit") HiddenPo...
nilq/baby-python
python
""" Reordering generator for C source code. This is an ANTLR generated parse tree listener, adapted to walk a Python parse tree, randomly introduce multi scale reorderings and regenerate the source code with these reorderings. """ import random from antlr4 import ParseTreeWalker from antlr4.tree.Tree import TerminalN...
nilq/baby-python
python
from __future__ import unicode_literals from mpi4py import MPI from .adaptive_calibration import calibration_scale_factor_adaptive from .dip import dip_scale_factor from .bandwidth import h_crit_scale_factor def compute_calibration(calibration_file, test, null, alpha, adaptive=True, lower_la...
nilq/baby-python
python
import json from django import template from django.contrib.gis.db.models import Extent from django.contrib.gis.db.models.functions import Envelope, Transform from django.conf import settings from django.db.models.functions import Coalesce from django.urls import reverse from geotrek.zoning.models import District, Ci...
nilq/baby-python
python
import copy, unittest from bibliopixel.project import project from bibliopixel.animation.sequence import Sequence from bibliopixel.animation import matrix from bibliopixel.layout.matrix import Matrix from bibliopixel.project.data_maker import Maker def classname(c): return '%s.%s' % c.__module__, c.__name__ cla...
nilq/baby-python
python
from pdf2image import convert_from_path import os import gc import cv2 import easyocr import pandas as pd import Levenshtein as lev from datetime import datetime test_template_data = [{'id': 1, 'name': 'JK agency', 'height': 2338, 'width': 1653, 'product_region': ((167, 473), (503, 1650)), ...
nilq/baby-python
python
from .visualize import * from .detection import *
nilq/baby-python
python
""" CSC110 Final Project - Analysis of Public Sentiment over New Cases """ if __name__ == '__main__': import app app.run_app()
nilq/baby-python
python
r""" Special extensions of function fields This module currently implements only constant field extension. Constant field extensions ------------------------- EXAMPLES: Constant field extension of the rational function field over rational numbers:: sage: K.<x> = FunctionField(QQ) sage: N.<a> = QuadraticFie...
nilq/baby-python
python
from rest_framework.generics import ListAPIView from rest_framework.permissions import IsAuthenticated from notifications.models import Notification from notifications.serializers import NotificationSerializer class Notification_ListOwn_ApiView(ListAPIView): permission_classes = [IsAuthenticated] serializer_clas...
nilq/baby-python
python
import os, re, json import torch import argparse import pyhocon import pickle from nltk import tokenize EOS_token = '<EOS>' BOS_token = '<BOS>' parallel_pattern = re.compile(r'^(.+?)(\t)(.+?)$') # swbd_align = { # '<Uninterpretable>': ['%', 'x'], # '<Statement>': ['sd', 'sv', '^2', 'no', 't3', 't1', 'oo', 'c...
nilq/baby-python
python
class Solution: """ @param arr: a integer array @return: return ids sum is minimum. """ def UniqueIDSum(self, arr): # write your code here table = set() for a in arr: while a in table: a += 1 table.add(a) return sum...
nilq/baby-python
python
#!/usr/bin/python import os import re import sys import argparse parser = argparse.ArgumentParser(description='JS Fixups') parser.add_argument('file', help="file to process") args = parser.parse_args() file = open(args.file) text = file.read() pat = 'HEAP32\[(?P<base>.*)+?P<offset>.*)>>?P<shift>.*)\]' pat = 'HEAP32...
nilq/baby-python
python
# Copyright (c) 2019,20-22 NVIDIA CORPORATION & AFFILIATES. # 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 # # Unles...
nilq/baby-python
python
# Andrew Boslett # Rochester Data Science Consortium # Email: andrew_boslett@urmc.rochester.edu # Set options import arcpy import os import csv import sys # Set up environments arcpy.env.overwriteOutput = True box_dir = 'C:/Users/aboslett/Box' pers_dir = 'C:/Users/aboslett/Documents' if not arcpy.Exists(os.path.j...
nilq/baby-python
python
import unittest import xmlrunner import secrets import pagemodels.videopage import tests.pickledlogin import browserconfig # TEST CATEGORIES # 1.) Pause Tests # 2.) Mute Tests # 3.) Volume Tests # 4.) Full screen Tests # 5.) Audio&Subtitles Tests # 6.) Skip_forward/backward Tests # 7.) Time/Duration Tests # 8.) Exit ...
nilq/baby-python
python
from django.contrib import admin from .models import Project class ProjectAdmin(admin.ModelAdmin): fields = ("name", "public_key", "created_at", "updated_at") readonly_fields = ("public_key", "created_at", "updated_at") list_display = ("name",) def has_add_permission(self, request): return F...
nilq/baby-python
python
# Generated by Django 3.2.6 on 2021-08-21 09:14 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('education', '0018_alter_materialblocks_color'), ] operations = [ migrations.AlterModelOptions( name='materialblocks', ...
nilq/baby-python
python