content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
# -*- coding: utf-8 -*- """ Created on Fri Jan 26 12:11:02 2018 @author: User """ def forever15(n): final = (((n*3) + 45)*2)//6 - n print( final) forever15(1550) def findmin(a, b, c): first = a - b second = b - c third = c - a
nilq/baby-python
python
from typing import Generator, Generic, Optional, TypeVar _T = TypeVar("_T") class Ring(Generic[_T]): def __init__(self, value: _T, next_: "Ring[_T]"): self.value = value self.next = next_ def copy(self) -> "Ring[_T]": result = None run = self first = True whil...
nilq/baby-python
python
# Generated by Django 3.2.3 on 2021-05-31 04:23 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accounts', '0005_alter_studentprofile_student'), ] operations = [ migrations.AddField( model_name='studentprofile', ...
nilq/baby-python
python
class Solution: def maxProduct(self, nums: List[int]) -> int: ans = nums[0] prevMin = nums[0] prevMax = nums[0] for i in range(1, len(nums)): mini = prevMin * nums[i] maxi = prevMax * nums[i] prevMin = min(nums[i], mini, maxi) prevMax = max(nums[i], mini, maxi) ans = max...
nilq/baby-python
python
from __future__ import print_function import os.path import time import sys import six import platform from openpype.api import Logger from openpype.api import get_system_settings from .abstract_provider import AbstractProvider from ..utils import time_function, ResumableError log = Logger().get_logger("SyncServer") ...
nilq/baby-python
python
# coding: utf8 from __future__ import unicode_literals from .stop_words import STOP_WORDS from ..tokenizer_exceptions import BASE_EXCEPTIONS from ..norm_exceptions import BASE_NORMS from ...language import Language from ...attrs import LANG, NORM from ...util import update_exc, add_lookups class CroatianDefaults(La...
nilq/baby-python
python
""" Data related functions and objects. This module contains several parts: - `data_loader` defines a DataLoader objects that behave similar to pandas DataFrame and are used to load data. In addition it provides DataLoader wrappers that implement various transformations on the loaded dataset. - `da...
nilq/baby-python
python
from .ner_labels import NERLabels from .ner_dataset import NERDataset from .label_mapper import LabelMapper from .dataset_tokenizer import DatasetTokenizer __all__=["NERLabels", "NERDataset", "LabelMapper", "DatasetTokenizer"]
nilq/baby-python
python
from django.shortcuts import render, redirect from django.contrib.auth.models import User, auth from django.contrib import messages from django.shortcuts import get_object_or_404 from .models import * from .forms import * from datetime import datetime, timedelta from django.contrib.auth.decorators import login_required...
nilq/baby-python
python
from .accuracy import Accuracy, accuracy __all__ = ['Accuracy', 'accuracy']
nilq/baby-python
python
import sys """ File name: scenario_modifier Date created: 03/03/2019 Feature: # Feature to enable the user to overwrite the scenario file. """ __author__ = "Alexander Kell" __copyright__ = "Copyright 2018, Alexander Kell" __license__ = "MIT" __email__ = "alexander@kell.es" def overwrite_scenario_file(scenario_file):...
nilq/baby-python
python
class User: """Represents a MangaDex User.""" __slots__ = ("id", "username", "roles", "client") def __init__(self, data, client): self.id = data.get("id") _attrs = data.get("attributes") self.username = _attrs.get("username") self.roles = _attrs.get("roles", []) self...
nilq/baby-python
python
# Authors: Stephane Gaiffas <stephane.gaiffas@gmail.com> # Ibrahim Merad <imerad7@gmail.com> # License: BSD 3 clause """ This module implement the ``GMOM`` class for the geometric median-of-means robust estimator. ``StateGMOM`` is a place-holder for the GMOM estimator containing: gradient: numpy.ndarra...
nilq/baby-python
python
#!/usr/bin/python3 # -*- coding:utf-8 -*- from os import listdir from os.path import splitext, join import markdown import yaml import json def read(uri): with open(uri, 'r') as f: return f.read() def text_to_yml_md(tex): tex = tex.strip('-') sep = '---' if sep in tex: return tex.split(sep) else: return ...
nilq/baby-python
python
#!/usr/bin/env python3 # Copyright (c) 2016 Fabian Schuiki # # This script generates GDS layout data for a memory macro. import sys, os, argparse from potstill.macro import Macro from potstill.layout import Layout from potstill.output.gds import make_gds, make_phalanx_input # Parse the command line arguments. parser...
nilq/baby-python
python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from . import ...
nilq/baby-python
python
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
nilq/baby-python
python
from . import base_api_core class Backup(base_api_core.Core): def __init__(self, ip_address, port, username, password, secure=False, cert_verify=False, dsm_version=2, debug=True): super(Backup, self).__init__(ip_address, port, username, password, secure, cert_verify, dsm_version, debug) def backup_re...
nilq/baby-python
python
""" Copyright (C) 2019 NetApp Inc. All rights reserved. A test module for the recline.repl.shell module """ import asyncio import builtins import pytest import recline from recline.repl import shell @pytest.mark.parametrize("user_input, expected_marker, expected_output", [ ("ut command -arg 2", 2, ""), ("...
nilq/baby-python
python
#!/usr/bin/env python #-*- coding:utf-8 -*- ## ## setup.py ## ## Created on: Jan 23, 2018 ## Author: Alexey S. Ignatiev ## E-mail: aignatiev@ciencias.ulisboa.pt ## # #============================================================================== import os import os.path import contextlib import glob try: ...
nilq/baby-python
python
# pylint: disable=missing-module-docstring # -*- coding: utf-8 -*- __short_version__ = '1.6' __release__ = '1.6.0' __description__ = 'Framework for Quart to add swagger generation to routes and restful resources'
nilq/baby-python
python
""" This module contains common code shared by utils/rule_dir_stats.py and utils/rule_dir_diff.py. This code includes functions for walking the output of the utils/rule_dir_json.py script, and filtering functions used in both scripts. """ from __future__ import absolute_import from __future__ import print_function im...
nilq/baby-python
python
class Database(Exception): pass class Serialize(Database): def __init__(self, cls, msg="Serialization Failed"): self.cls = cls self.msg = msg def __str__(self) -> str: return f"'{self.cls}' {self.msg}"
nilq/baby-python
python
from sqlalchemy import Column, Integer, String, Sequence, SmallInteger from sgs_schema.declarative_base import Base from sqlalchemy.orm import relationship from sqlalchemy.sql.schema import ForeignKey from sqlalchemy.sql.sqltypes import Float class Produto(Base): __tablename__ = "PRODUTO" id = Column(Intege...
nilq/baby-python
python
# SPDX-FileCopyrightText: 2019 Scott Shawcroft for Adafruit Industries # # SPDX-License-Identifier: MIT """ `adafruit_il91874` ================================================================================ CircuitPython `displayio` driver for IL91874-based ePaper displays * Author(s): Scott Shawcroft Implementat...
nilq/baby-python
python
# pylint: disable=C0111,R0903 """Print the branch and git status for the currently focused window. Requires: * xcwd * Python module 'pygit2' """ import os import pygit2 import core.module import util.cli class Module(core.module.Module): def __init__(self, config, theme): super().__init__(con...
nilq/baby-python
python
from pathlib import Path import typer from spacy.tokens import DocBin import spacy ASSETS_DIR = Path(__file__).parent.parent / "assets" CORPUS_DIR = Path(__file__).parent.parent / "corpus" def read_categories(path: Path): return path.open().read().strip().split("\n") def read_tsv(file_): for line in file_...
nilq/baby-python
python
# -*- coding: utf-8 -*- from httoop.exceptions import InvalidURI from httoop.messages import Request, Response from httoop.parser import NOT_RECEIVED_YET, StateMachine from httoop.status import ( BAD_REQUEST, HTTP_VERSION_NOT_SUPPORTED, LENGTH_REQUIRED, MOVED_PERMANENTLY, SWITCHING_PROTOCOLS, URI_TOO_LONG, ) from htt...
nilq/baby-python
python
""" Test passing exceptions to logs """ import inspect import pytest from .util import check_finished_spans, logger, tracer @pytest.mark.parametrize('stmt,exception', [ ('1 / 0', ZeroDivisionError('division by zero')), ('y = non_existent_variable', NameError("name 'non_existent_variable' is not defined")),...
nilq/baby-python
python
from fastapi import HTTPException from datetime import datetime from .router import Router import models from secrets import token_hex class SessionsRouter(Router): def __init__(self, config, database): super().__init__('/sessions', config, database) def methods(self): @self.router.get('/a...
nilq/baby-python
python
# Copyright (c) 2020 elParaguayo # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distrib...
nilq/baby-python
python
# Copyright Google Inc. All Rights Reserved. # # Use of this source code is governed by an MIT-style license that can be # found in the LICENSE file at https://angular.io/license """ Public API surface is re-exported here. This API is exported for users building angular from source in downstream projects. The rules fr...
nilq/baby-python
python
# encoding: utf-8 from __future__ import absolute_import, division, print_function, unicode_literals from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand from django.template import Context, loader from haystack import connections, connection_router, con...
nilq/baby-python
python
# Generated by Django 3.2.9 on 2021-12-12 10:34 import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("customers", "0005_auto_20211205_0953"), ] operations = [ migrations.AlterF...
nilq/baby-python
python
#tree # ├── data # │   ├── SRR388226_1.fastq # │   ├── SRR388226_2.fastq # │   ├── SRR388227_1.fastq # │   ├── SRR388227_2.fastq # │   ├── SRR388228_1.fastq # │   ├── SRR388228_2.fastq # │   ├── SRR388229_1.fastq # │   ├── SRR388229_2.fastq # │   └── SRR.file # ├── fastqc_res # ├── RSEM_res # └── STAR_res #write for pa...
nilq/baby-python
python
# -*- coding: utf-8 -*- import urllib.request, urllib.parse, urllib.error print("\xe7\xbb\xb4\xe5\x9f\xba\xe6\x96\xb0\xe9\x97\xbb\xef\xbc\x8c\xe8\x87\xaa\xe7\x94\xb1\xe7\x9a\x84\xe6\x96\xb0\xe9\x97\xbb\xe6\xba\x90") print(urllib.parse.unquote_plus("http%3A%2F%2Fzh.wikinews.org%2Fwiki%2FWikinews%3A%25E9%25A6%2596%25E9...
nilq/baby-python
python
""" Copyright (c) 2017, Jairus Martin. Distributed under the terms of the MIT License. The full license is in the file LICENSE, distributed with this software. Created on Aug 3, 2017 @author: jrm """ from atom.api import Typed from enamlnative.widgets.scroll_view import ProxyScrollView from .bridge import ObjcMet...
nilq/baby-python
python
# --------------------------------------------------------- # Tensorflow Utils Implementation # Licensed under The MIT License [see LICENSE for details] # Written by Cheng-Bin Jin # Email: sbkim0407@gmail.com # --------------------------------------------------------- import os import logging import functools import te...
nilq/baby-python
python
import pathlib from django.utils.safestring import mark_safe CSS_PATH = (pathlib.Path(__file__).resolve().parent / 'static' / 'frontend' / 'built' / 'style' / 'email.min.css') def get(): return mark_safe(CSS_PATH.read_text(encoding='utf-8')) # nosec
nilq/baby-python
python
import os print("if you want use the service Install : ") print(":django") print(":vsftpd") Select_usr = input("Do You Want Install django and vsftpd?:") print("[Y]or[N] if Select_usr == 'Y': os.system("pip3 install django") os.system("sudo apt install vsftpd") print("[*]Services has been Installed") print("Start FTP...
nilq/baby-python
python
""" The proper way to create an uncertain array is by calling :func:`.uarray` """ # Adding numpy arrays to GTC is not an easy exercise. # Our need is to provide convenient containers for uncertain numbers. # We do not try to integrate uncertain numbers in numpy's design. from __future__ import division import warnings...
nilq/baby-python
python
''' The default translation file removes all the attributes with empty values ''' def filterTags(attrs): if not attrs: return tags = {} for k,v in attrs.iteritems(): if v: tags.update({k: v}) return tags
nilq/baby-python
python
import os import unittest def resolve_runfile(path): if os.getenv('RUNFILES_MANIFEST_ONLY') != "1": return os.path.join(os.environ['TEST_SRCDIR'], path) manifest = os.getenv('RUNFILES_MANIFEST_FILE') with open(manifest) as f: for line in f.readlines(): if line.split()[0] == path: return li...
nilq/baby-python
python
import tensorflow as tf import sys sys.path.append('./ext/voxelmorph/') sys.path.append('./ext/neurite-master/') sys.path.append('./ext/pynd-lib/') sys.path.append('./ext/pytools-lib/') from voxelmorph.tf.losses import Grad, NCC, NonSquareNCC loss_object = tf.keras.losses.MeanSquaredError() # used for GAN + def. re...
nilq/baby-python
python
import time import datetime import shutil import os import sys sys.path.insert( 0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) import emdee print(datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')) # In this case we want to LOAD the results of a previous emdee run...
nilq/baby-python
python
############################################################################### # # file: typing.py # # Purpose: refer to module documentation for details # # Note: This file is part of Termsaver application, and should not be used # or executed separately. # #########################################...
nilq/baby-python
python
from .runners import Noun # ?
nilq/baby-python
python
class Value: def __get__(self, instance, instance_type): return self.amount def __set__(self, instance, value): self.amount = value - instance.commission * value class Account: amount = Value() def __init__(self, commission): self.commission = commission """ new_account = Acco...
nilq/baby-python
python
""" 395. Longest Substring with At Least K Repeating Characters This question is listed as a medium question under sliding window category. But sliding window approach is too complex and maybe a hard problem for that case, simple approach is doing a dfs. But it is expensive. The following solution is not optimal bu...
nilq/baby-python
python
from sys import argv from pathlib import Path from datetime import date from time import strftime import json # Logging (console) def print_log(message): """Simple logging function: Adds timestamp before message""" print(strftime("%H:%M:%S") + ": " + message) # Basic structures def set_date(date_=None):...
nilq/baby-python
python
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2012 onwards University of Deusto # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # # This software consists of contributions made by many individuals, # list...
nilq/baby-python
python
""" Copyright (c) 2020 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WI...
nilq/baby-python
python
#!/usr/bin/env python from setuptools import setup, find_packages import os import shutil from subprocess import check_output setup( name="array_neutron_lbaas", description="Array vADC OpenStack Neutron LBaaS Device Driver", long_description=open("README.md").read(), version="1.0.0", url="https://...
nilq/baby-python
python
# from typing import Optional # from discord import Embed # from discord.utils import get # from discord.ext.menus import MenuPages, ListPageSource # from discord.ext.commands import Cog, command # def syntax(command): # cmd_and_aliases = "|".join([str(command), *command.aliases]) # params = [] # for ke...
nilq/baby-python
python
## heap # Time: O(NlogK) class Solution: def findKthLargest(self, nums: List[int], k: int) -> int: return heapq.nlargest(k, nums)[-1] ## sort # Time: O(NlogN) class Solution: def findKthLargest(self, nums: List[int], k: int) -> int: nums.sort() return nums[-k]
nilq/baby-python
python
from typing import Any from .metaf_base import DataDescriptor class Direction(DataDescriptor): def __init__(self, name: str): super().__init__(name) def _handler(self, value): return float(value) class Speed(DataDescriptor): def __init__(self, name: str): super().__init__(name)...
nilq/baby-python
python
import csv import numpy as np from scipy import signal import copy def getCsv(txtFileName='seventeenth.txt'): with open(txtFileName) as csv_file: csv_reader = csv.reader(csv_file, delimiter=' ') return list(csv_reader) def parseCharacter(character): value = 1 if character == '#' else 0 r...
nilq/baby-python
python
from gi.repository import Gtk import asyncio import threading class ThreadLoop(threading.Thread): def __init__(self, loop): threading.Thread.__init__(self) self.loop = loop def run(self): print("starting Thread") self.loop.run_forever() print("Ending Thread") class C...
nilq/baby-python
python
#coding: utf-8 if __name__ == '__main__': st = "data/mult/result" print st t = open("data/resultX.csv","w") t.write("Id,Tags\n") a = 0 for i in range(21): print i f = open(st+str(i)+".csv") h = f.readlines() temp = 0 print len(h) for line in h: ...
nilq/baby-python
python
"""Sweep tests""" import pytest import wandb def test_create_sweep(live_mock_server, test_settings): live_mock_server.set_ctx({"resume": True}) sweep_config = { "name": "My Sweep", "method": "grid", "parameters": {"parameter1": {"values": [1, 2, 3]}}, } sweep_id = wandb.sweep(s...
nilq/baby-python
python
import os import signal from abc import ABCMeta, abstractmethod from multiprocessing import Pool from django.conf import settings import pymei import solr DEFAULT_MIN_GRAM = 2 DEFAULT_MAX_GRAM = 10 class AbstractMEIConverter: __metaclass__ = ABCMeta TYPE = "cantusdata_music_notation" def __init__(self...
nilq/baby-python
python
import sys import atlednolispe_settings # private_password from .base import * DEBUG = False DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': atlednolispe_settings.DATABASE_NAME, 'USER': atlednolispe_settings.USER, 'PASSWORD': atlednolispe_settings.PASSWO...
nilq/baby-python
python
from xml.dom.minidom import Document, parseString from xml.parsers.expat import ExpatError import pytest from sunpy.util import xml def test_xml_to_dict1(): """ should return dict of xml string. """ source_xml = "<outer>\ <inner1>one</inner1>\ <inner2>two</inner2>\ </oute...
nilq/baby-python
python
"""Interface of RLAlgorithm.""" import abc class RLAlgorithm(abc.ABC): """Base class for all the algorithms. Note: If the field sampler_cls exists, it will be by Trainer.setup to initialize a sampler. """ # pylint: disable=too-few-public-methods @abc.abstractmethod def trai...
nilq/baby-python
python
import data import copy, logging import numpy as np def minimize_states_and_actions_to_iterate(): logging.info("Minimizing states and actions to iterate for each engine type...") for engine_subtype in data.engine_subtypes: num_working_engines = data.engines_info[engine_subtype]['NUM_WORKING_ENGINES'] current_sta...
nilq/baby-python
python
import csv, sys if (len(sys.argv) != 6): print("format: python3 join_csv.py OUT-FILE FILE-1 KEY-INDEX-1 FILE-2 KEY-INDEX-2") exit() with open(sys.argv[2], 'rb') as file: reader = csv.reader(file, delimiter=",", quotechar='"') with open(sys.argv[4]) as file2: reader2 = csv.reader(file2, delimiter=",", quot...
nilq/baby-python
python
#!/usr/local/bin/python3 import boto3 from botocore.client import Config from botocore.vendored.requests.exceptions import ReadTimeout import traceback import json import sys from run_cumulus_task import run_cumulus_task import requests, zipfile, io client = boto3.client('stepfunctions', region_name = 'us-east-1') lam...
nilq/baby-python
python
##################################################################### # # # SkillsFuture IBM Cloud Function Example 2 # # This example is used to show how to get data from Discovery # # and return it to Watson Assistan...
nilq/baby-python
python
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
nilq/baby-python
python
import requests import shutil import csv import os def writeToFile(directory, filename, filecontent): if directory: try: os.mkdir(directory) except: pass else: directory = "" with open(os.path.join(directory, filename), 'wb') as f: filecontent.raw.decode_content = True ...
nilq/baby-python
python
NAMES = ["cmd_insensetive"] ANSWER = "You used `cmd_insensetive` command!"
nilq/baby-python
python
# # PySNMP MIB module AC-LAG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AC-LAG-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:09:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
nilq/baby-python
python
import torch import torch.optim as optim device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') print(device) import sys sys.path.append("PATH") from Models.MATCH.MATCH import MATCH from Models.MATCH.functions import (get_tensors, augment, format_output, CE_loss) from Models.metrics import (AUC...
nilq/baby-python
python
# coding=utf-8 import ctypes import json import time import jsonpath import requests import progressbar import requests.packages.urllib3 headers1 = { 'User-Agent': 'Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Firefox/24.0' } headers2 = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.2) AppleWe...
nilq/baby-python
python
# -*- coding: utf-8 -*- ''' Provides tools to help unit test projects using pop. For now, provides mock Hub instances. ''' # Import python libs import inspect import copy from asyncio import iscoroutinefunction from functools import partial # Import third party libs try: from asynctest.mock import create_autospec ...
nilq/baby-python
python
import pwn def gnu_hash(s): h = 0 h = 5381 for c in s: h = h * 33 + ord(c) return h & 0xffffffff class DynELF: def __init__(self, path, leak, base = None): if isinstance(path, pwn.ELF): self.elf = path else: self.elf = pwn.elf.load(path) self...
nilq/baby-python
python
import os # kepaknaga@gmail.com def cuci(): os.system('clear') cuci() while True: print('====================') print('=====GITKU v2.0=====') print(' 0 = git pull') print(' 1 = git add .') print(' 2 = git commit -m') print(' 3 = git push') print(' 4 = git add & commit') print(' 5 = git diff') print(' 6 = gi...
nilq/baby-python
python
from typing import Tuple, List import numpy as np from GPy.core.parameterization.priors import Prior, Gaussian from numpy.linalg import LinAlgError from statsmodels.stats.correlation_tools import cov_nearest from src.autoks.backend.kernel import get_priors from src.autoks.core.active_set import ActiveSet from src.aut...
nilq/baby-python
python
# # PySNMP MIB module H3C-OBJECT-INFO-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-OBJECT-INFO-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:10:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
nilq/baby-python
python
# 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 writing, software # distributed under th...
nilq/baby-python
python
__author__ = 'Devesh Bajpai' ''' https://codeforces.com/problemset/problem/381/A Solution: This is very similar to the DP card game problem. Since the numbers are distinct, it avoids the complex case when both the ends are same and the player would pick the side which exposes the smaller number for next round. That w...
nilq/baby-python
python
"""This script contains the main authentication and hash generation functions""" import subprocess from shadow_auth._internal.classes import ShadowHash from shadow_auth._internal.enums import Algorithm from shadow_auth._internal.validations import ( validate_system_requirements_first ) from shadow_auth._internal....
nilq/baby-python
python
""" Some simple logging functionality, inspired by rllab's logging. Logs to a tab-separated-values file (path/to/output_directory/progress.txt) """ import atexit import json import os import os.path as osp import shutil import sys import time import warnings from collections import defaultdict from pathlib import Pa...
nilq/baby-python
python
# train.py ### command> python train.py --fold 0 --model decision_tree_gini import argparse import os import joblib import pandas as pd from sklearn import metrics import config import dispatcher def run(fold, model): # read the training data with folds df = pd.read_csv(config.TRAINING_FILE) # traini...
nilq/baby-python
python
from base64 import b64encode import jinja2 import json import os import yaml import kubernetes.config import kubernetes.client from simpleflow.utils import json_dumps class KubernetesJob(object): def __init__(self, job_name, domain, response): self.job_name = job_name self.response = response ...
nilq/baby-python
python
# coding: utf-8 from bs4 import BeautifulSoup import requests from urllib.parse import urljoin import json def main(): ''' To crawl the base url of each city, and saved the results as a json file named baseurl. ''' url_json = {} url = "http://www.tianqihoubao.com/aqi/" headers = {'user-agent': 'my-app/0.0.1'} ...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- import unittest from httpglob import httpglob, path_match class PathMatchCase(unittest.TestCase): def test_010_path_match(self): self.assertTrue(path_match('/v1.1.1/image_1.1.1.zip', '/v1.1.1/image_1.1.1.zip')) def test_020_path_match(self): se...
nilq/baby-python
python
from django.utils.translation import ugettext_lazy as _ SERVICE_TYPES = ( ("HKI_MY_DATA", _("HKI_MY_DATA")), ("BERTH", _("BERTH")), ("YOUTH_MEMBERSHIP", _("YOUTH_MEMBERSHIP")), ("GODCHILDREN_OF_CULTURE", _("GODCHILDREN_OF_CULTURE")), )
nilq/baby-python
python
# Betül İNCE - 180401020 with open("veriler.txt", "r+") as data: cases = [] for line in data: cases.append(int(line)) size = len(cases) sum_cases = sum(cases) def first_order_polynomial(): n = len(cases) sum_of_x = 0 sum_of_y = sum(cases) sum_of_xiyi = 0 sum_of_xi_s...
nilq/baby-python
python
#NAME: mappingLoadTest.py #AUTH: Ryan McCartney, EEE Undergraduate, Queen's University Belfast #DESC: Loading Map from CSV file test #COPY: Copyright 2019, All Rights Reserved, Ryan McCartney import cv2 as cv from mapping import Mapping import time #Initialise Mapping map = Mapping(0.1,40,60) print('INFO: Mappin...
nilq/baby-python
python
""" .. module:: CClassifierLogistic :synopsis: Logistic Regression (aka logit, MaxEnt) classifier .. moduleauthor:: Battista Biggio <battista.biggio@unica.it> .. moduleauthor:: Ambra Demontis <ambra.demontis@unica.it> """ from sklearn.linear_model import LogisticRegression from secml.array import CArray from secm...
nilq/baby-python
python
import csv from io import StringIO, BytesIO import pandas as pd from des.models import DynamicEmailConfiguration from django.conf import settings from django.core.mail import EmailMultiAlternatives from django.test import Client from django.urls import reverse from django_rq import job from scripts.integration_test i...
nilq/baby-python
python
import os import sys rszdir = "/home/inopia/webapps/mlfw_media/f/rsz/" #nqdir = thumbsdir + "png/" l = os.listdir(rszdir) l.sort() for imagefile in l: part = imagefile.lstrip("mlfw").partition(".") ext = part[2].lower() if part[0] in ("save", "png"): continue try: iid = int(part[0].pa...
nilq/baby-python
python
import os from d3m import utils D3M_API_VERSION = 'v2020.1.9' VERSION = "1.0.0" TAG_NAME = "{git_commit}".format(git_commit=utils.current_git_commit(os.path.dirname(__file__)), ) REPOSITORY = "https://github.com/brekelma/dsbox_graphs" PACKAGE_NAME_GRAPHS = "dsbox-graphs" D3M_PERFORMER_TEAM = 'ISI' if TAG_NAME: ...
nilq/baby-python
python
#!/usr/bin/python3 import pickle import sys import numpy as np from scipy.stats import ks_2samp if __name__ == "__main__": if len(sys.argv) < 3: print("Usage: %s [max min diff dat] [stdev dat]" % (sys.argv[0])) exit() def plot(dataPerExperiment): smallestDiffMaxMin = None smallestDiffMaxMinOperator = None fo...
nilq/baby-python
python
# Generated by Django 3.0.1 on 2020-06-14 03:19 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('arti...
nilq/baby-python
python
# coding=utf-8 from sii.resource import SII, SIIDeregister from sii.models.invoices_record import CRE_FACTURAS_EMITIDAS from sii.utils import unidecode_str, VAT from expects import * from datetime import datetime from spec.testing_data import DataGenerator, Tax, InvoiceLine, InvoiceTax from mamba import * import os ...
nilq/baby-python
python
from typing import Union import spacy regex = [r"\bsofa\b"] method_regex = ( r"sofa.*?((?P<max>max\w*)|(?P<vqheures>24h\w*)|" r"(?P<admission>admission\w*))(?P<after_value>(.|\n)*)" ) value_regex = r".*?.[\n\W]*?(\d+)[^h\d]" score_normalization_str = "score_normalization.sofa" @spacy.registry.misc(score_...
nilq/baby-python
python
import cloudmesh user = cloudmesh.load() print user.cloudnames()
nilq/baby-python
python
import sqlite3 con = sqlite3.connect(":memory:") con.row_factory = sqlite3.Row cur = con.cursor() cur.execute("select 'John' as name, 42 as age") for row in cur: assert row[0] == row["name"] assert row["name"] == row["nAmE"] assert row[1] == row["age"] assert row[1] == row["AgE"] con.close()
nilq/baby-python
python