content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
import math from .EmbFunctions import * from .EmbMatrix import EmbMatrix class Transcoder: def __init__(self, settings=None): if settings is None: settings = {} self.max_stitch = settings.get("max_stitch", float('inf')) self.max_jump = settings.get("max_jump", float...
nilq/baby-python
python
import numpy as np from .points import get_fractions, interpolate_along_axis def prepare(start: np.ndarray, stop: np.ndarray): # handling a possible flip diff = np.linalg.norm(start[[0, -1]] - stop[[0, -1]], axis=1).sum() rev_diff = np.linalg.norm(start[[-1, 0]] - stop[[0, -1]], axis=1).sum() if rev_d...
nilq/baby-python
python
# Copyright 2008-2018 Univa Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
nilq/baby-python
python
""" Test of reading and plotting the CUSP coastline. Data source: shoreline.noaa.gov/data/datasheets/cusp.html Spatial Reference: Geographic coordinate system (decimal degrees); Horizontal Datum – North American Datum of 1983 (NAD83) Tidal Datum: Where applicable, CUSP will reference a mean-high water shoreline base...
nilq/baby-python
python
#!/usr/bin/env python #author: wowdd1 #mail: developergf@gmail.com #data: 2015.01.03 from spider import * sys.path.append("..") from utils import Utils class TorontoSpider(Spider): def __init__(self): Spider.__init__(self) self.school = "toronto" self.subject = "computer-science" de...
nilq/baby-python
python
from django.apps import apps from guardian.shortcuts import get_objects_for_user from api.addons.views import AddonSettingsMixin from api.actions.views import get_actions_queryset from api.actions.serializers import ActionSerializer from api.base import permissions as base_permissions from api.base.exceptions import ...
nilq/baby-python
python
import numpy as np import os import sys import math import time import random import datetime import pickle from keras.utils.generic_utils import Progbar from PIL import Image os.environ['TF_CPP_MIN_LOG_LEVEL']='2' import tensorflow as tf import keras from keras import backend as K from keras.datasets import cifar1...
nilq/baby-python
python
from __future__ import annotations import random from typing import List import numpy as np import paddle from paddle import nn from paddle.fluid.framework import Parameter def freeze_module(module: nn.Layer): """Freeze all parameters in the moudle""" parameters: List[Parameter] = module.parameters() fo...
nilq/baby-python
python
''' wrapper for evaluating Model(ABC particle) ''' import env import sys from abcee import model_ABCparticle #restart = int(sys.argv[1]) #if restart == 0: # ABC run name abcrun = sys.argv[1] print 'Run ', abcrun # iterations number Niter = int(sys.argv[2]) print 'N_iterations = ', Niter # plus some hardcoded k...
nilq/baby-python
python
import os import sqlite3 as sqlite from openpyxl import Workbook from openpyxl.styles import Font import datetime import tkinter.filedialog import tkinter.messagebox import gc font = Font(color="00FF3300") runningFile = "" # 写入Excel头 def sqlite_to_workbook_with_head(i, cur, table, select_sql, workbook, errorPut): ...
nilq/baby-python
python
# Copyright 2020 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
def min_max_scaler(value, min_value, max_value): ''' takes value, calculated max value (pulled from dictionary of maxes) and min value; and scales using min-max scaler method. ''' try: return (value - min_value)/(max_value - min_value) except ZeroDivisionError: return 0
nilq/baby-python
python
from django.apps import AppConfig class SitemapConfig(AppConfig): """ This is the basic configuration for the sitemap app """ name = "sitemap"
nilq/baby-python
python
from turtle import Turtle import random COLORS = ["red", "orange", "yellow", "green", "blue", "purple"] STARTING_MOVE_DISTANCE = 5 MOVE_INCREMENT = 10 class CarManager: def __init__(self): self.cars_list = [] self.speed = STARTING_MOVE_DISTANCE def create_car(self): random_choice = ...
nilq/baby-python
python
from ..core import BlockParser def _parse_epsilon(line, lines): """Parse Energy [eV] Re_eps_xx Im_eps_xx Re_eps_zz Im_eps_zz""" split_line = line.split() energy = float(split_line[0]) re_eps_xx = float(split_line[1]) im_eps_xx = float(split_line[2]) re_eps_zz = float(split_line[3...
nilq/baby-python
python
# Copyright 2018, OpenCensus 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 by applicable law or agreed to in w...
nilq/baby-python
python
# Copyright 2020 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
nilq/baby-python
python
ADAMSLegacyDict = {'PLACENAME': 38653, 'GISACRES': 0, 'CONAME': 38657, 'SUFFIX': 0, 'STREETTYPE': 22335, 'TAXPARCELID': 38657, 'PARCELID': 38657, 'ZIPCODE': 29356, 'PARCELSRC': 38657, 'PARCELFIPS': 38657, 'LOADDATE': 38657, 'PREFIX': 5999, 'AUXCLASS': 5245, 'NETPRPTA': 0, 'SCHOOLDISTNO': 38653, 'UNITID': 697, 'LNDVALUE...
nilq/baby-python
python
import torch import numpy as np def find_distance(X_n, X_o): """ :param X_n: tensor [[x_0, y_0, t_0], ..., [x_j, y_j, t_j]], containing all manipulatable nodes for a given leg :param X_o: tensor [[x_s, y_s, t_s], ..., [x_e, y_e, t_e]] points of sim contact :return d_s: distance vector to first object,...
nilq/baby-python
python
from pal.writer.access_mechanism.access_mechanism \ import AccessMechanismWriter from pal.logger import logger class RustLibpalAccessMechanismWriter(AccessMechanismWriter): def declare_access_mechanism_dependencies(self, outfile, register, access_mechanism): pass...
nilq/baby-python
python
import sys import os import subprocess from shutil import copyfile, rmtree def find_and_split_inputs(input_env_data, output_dir, number_of_inputs): ## Generate the environment file (by splitting inputs) ## Find the input file name input_env_lines = input_env_data.split('\n') input_vars = [line.split('...
nilq/baby-python
python
import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "2" import dgl import torch import numpy as np import dgl.function as fn import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import Dataset, DataLoader import obspy import ...
nilq/baby-python
python
import random with open('num.txt', 'w') as arq: for i in range(1000000): arq.write(str(random.randint(0, 10)) + '\n')
nilq/baby-python
python
from flask_sqlalchemy import SQLAlchemy from database.connection_profile import ConnectionProfile from __init__ import app import configuration database_engine = SQLAlchemy(app) def connect_if_required(): """ Checks if the server should connect to a database and optionally does so. This function automa...
nilq/baby-python
python
from .idol import Idol from .skills import Skill, LeadSkill from .enums import enum, attributes from .errors import CategoryNotFound class Card: """ Represents a Card and its data Attributes ---------- card_id : int The card's card id album_id : int The card's album id ty...
nilq/baby-python
python
def foo(x): def bar(z): return z + x return bar f = foo(9) g = foo(10) print(f(2)) print(g(2))
nilq/baby-python
python
#!/usr/bin/env python ''' FILE: compile.py Author: Chris Piech with additions from Nick Troccoli ---------------- Template compiler that compiles all .html template files in the TEMPLATE_DIR directory below (excluding .ptl files, which are partial templates), and outputs with the same filenames to the OUTPUT_DIR direc...
nilq/baby-python
python
import matplotlib.pyplot as plt import numpy as np import math values = [1,5,8,9,7,13,6,1,8] fig = plt.figure(facecolor="skyblue") ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], xlabel='keys', ylabel='values') x = np.arange(0, math.pi * 2.5, 0.05) y = np.sin(x) * 5 + 5 ax.grid() ax.plot(values, color='red', marker='o')...
nilq/baby-python
python
import numpy as np from collections import OrderedDict import os import glob import cv2 import pandas as pd import torch.utils.data as data import torchvision.transforms as transforms rng = np.random.RandomState(2020) def np_load_frame(filename, resize_height, resize_width): """ Load image path and convert i...
nilq/baby-python
python
# Copyright (c) 2021, PublicSpaces and contributors # For license information, please see license.txt import frappe from frappe.model.document import Document import spoelkeuken.utils class ScanTool(Document): def before_save(self): print("On before save ScanTool") # self.score_open = spoelkeuken.utils.calc_...
nilq/baby-python
python
# Edgar Barrera / Github: https://github.com/EdgarCastillo101/EdgarCastillo101 # Copyright (c) 2021 Edgar Barrera # This program is an example for sequential search def sequentialSearch(target, List): '''This function returns the position of the target if found else returns -1''' position = 0 global itera...
nilq/baby-python
python
import ctypes from math import sqrt from operator import itemgetter def _norm_tau(x, R): return sqrt(productRS_c(x, x, R.values())) def _rank_tau(r, s): L = tuple(range(0, len(r))) S = [None]*len(r) for i, item in enumerate(S): S[i] = (L[i], r[i], s[i]) S = sorted(S, key=itemgetter(1, 2)...
nilq/baby-python
python
#!/usr/bin/env python """ Woob main Python wrapper This file is a wrapper around Woob, which is spawned by Kresus backend and prints fetched data as a JSON export on stdout, so that it could be imported easily in Kresus' NodeJS backend. ..note:: Useful environment variables are - ``WOOB_DIR`` to specify the path...
nilq/baby-python
python
import json import sys import os from flask import request, Response skyenv = os.environ.get('SKYENV', '/home/skyenv/') sys.path.append(skyenv) from skyScanner.searchingEngine import app from skyScanner.parsers.ProxyParser import ProxyParser from skyScanner.parsers.UserAgentParser import UserAgentParser from skyScan...
nilq/baby-python
python
def add_native_methods(clazz): def getVMTemporaryDirectory____(): raise NotImplementedError() clazz.getVMTemporaryDirectory____ = staticmethod(getVMTemporaryDirectory____)
nilq/baby-python
python
# Copyright 2021, The TensorFlow 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 by applicable law or agreed t...
nilq/baby-python
python
import sys n, k, s = map(int, sys.stdin.readline().split()) def main(): m = 10 ** 9 a = [None] * n for i in range(k): a[i] = s for i in range(k, n): if s < m: a[i] = m else: a[i] = 1 return a if __name__ == '__main__': ans = mai...
nilq/baby-python
python
# Copyright 2002-2011 Nick Mathewson. See LICENSE for licensing information. """mixminion.TLSConnection Generic functions for wrapping bidirectional asynchronous TLS connections. """ #XXXX implement renegotiate import sys import time import mixminion._minionlib as _ml from mixminion.Common import LOG, stringCont...
nilq/baby-python
python
# ======================================================================================== # The code below has been adapted and tailored for this project. # The original version can be found at: https://github.com/ChrisRimondi/VulntoES # =================================================================================...
nilq/baby-python
python
from prime.bot.command import Command from prime.bot.decorators import arg, reply_with_exception from prime.bot.exceptions import InvalidEntity from prime.bot.constants import ADMIN_GROUP usermod = Command.create( 'usermod', description='Adds/Removes user(s) to/from group.' ) @usermod.register @arg('-g', '--g...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.15.2) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x06\x52\ \x3c\ \x3f\x78\x6d\x6c\x20\x76\x65\x72\x73\x69\x6f\x6e\x3d\x22\x31\x2e\ \x30\x22\x20\x...
nilq/baby-python
python
''' Created on 18 Jan 2013 @author: Kieran Finn ''' import time beginning=time.time() import urllib2 import sys import json from functions import * import time import pickle from math import pi from scipy.integrate import quad import numpy as np from collections import defaultdict import os in_fnam...
nilq/baby-python
python
from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import ListView from django.shortcuts import redirect from django.urls import reverse_lazy from django.views.generic.detail import DetailView from django.views.generic.edit impor...
nilq/baby-python
python
#!/usr/bin/env python #--------Include modules--------------- from copy import copy import rospy from visualization_msgs.msg import Marker from geometry_msgs.msg import Point from nav_msgs.msg import OccupancyGrid from geometry_msgs.msg import PointStamped import tf from numpy import array,vstack,delete from function...
nilq/baby-python
python
# -*- coding: utf-8 -*- # --------------------------------------------------------------------- # Siklu.EH.get_inventory # --------------------------------------------------------------------- # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------...
nilq/baby-python
python
import pygame from .animatable import Animatable from .shared_objects import SharedObjects from . import constants as c class TextField(Animatable): def __init__(self, x, y, width, text_color=c.LOBBY_TEXT_COLOR, active_color=c.LOBBY_ACTIVE_COLOR, inactive_color=c.LOBBY_INACTIVE_COLOR, placeholder=None): ...
nilq/baby-python
python
# built-in from contextlib import suppress from pathlib import Path, PurePath from typing import List, Optional, Set # external import attr # app from ._cached_property import cached_property def _dir_list(filelist: List[str]) -> Set[str]: # paths starting with '/' or containing '.' are not supported dir_li...
nilq/baby-python
python
def main(*args, **kwargs): import os import django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conf.settings") django.setup() from .fixtures import make_objects factor = (args[0] if len(args) > 0 else kwargs.get('factor')) or 5 make_objects(factor)
nilq/baby-python
python
import os from PySide2.QtCore import QDir from qt_material.resources import ResourseGenerator # ---------------------------------------------------------------------- def generate_icons() -> None: """""" source = os.path.join(os.path.dirname(__file__), 'source') resources = ResourseGenerator(primary=os.g...
nilq/baby-python
python
# Generated by Django 2.0.7 on 2018-08-08 03:28 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('portal', '0005_project_personnel'), ] operations = [ migrations.RemoveField( model_name='project', name='personnel', ...
nilq/baby-python
python
import asyncio import pytest from procrastinate import app from procrastinate import worker as worker_module @pytest.mark.asyncio async def test_wait_for_activity(aiopg_connector): """ Testing that a new event interrupts the wait """ pg_app = app.App(connector=aiopg_connector) worker = worker_mo...
nilq/baby-python
python
""" import from core """ from holland.core.backup.base import BackupError, BackupRunner, BackupPlugin
nilq/baby-python
python
def flatten_generator(list_to_flatten): """Child method to flatten multi-dimension lists into a single list Args: list_to_flatten (list): List of lists to flatten Returns: list() """ for elem in list_to_flatten: if isinstance(elem,(list, tuple)): for x in flatt...
nilq/baby-python
python
#!bin/env python import subprocess import os.path import unittest, re class TestSafety(unittest.TestCase): @classmethod def setUpClass(self): # clean up, just in case subprocess.call('rm -rf remote local 2>> /dev/null', shell=True) # Create "local" and "remote" repositories ...
nilq/baby-python
python
from django.contrib import admin from .models import Game, GameShort, SimilarGameConnection, SimilarGameConnectionWeighted admin.site.register(Game) admin.site.register(GameShort) admin.site.register(SimilarGameConnection) admin.site.register(SimilarGameConnectionWeighted)
nilq/baby-python
python
''' MIT License Name cs225sp20_env Python Package URL https://github.com/Xiwei-Wang/cs225sp20_env Version 1.0 Creation Date 26 April 2020 Copyright(c) 2020 Instructors, TAs and Some Students of UIUC CS 225 SP20 ZJUI Course Instructorts: Prof. Dr. Klaus-Dieter Schewe TAs: Tingou Liang, Run Zhang, Enyi Jiang, Xiang Li...
nilq/baby-python
python
from mcpy import primative, serializer PacketSerializer = serializer.PacketSerializer class LoginDisconnectPacket(): def __init__(self, reason): self.reason = reason class LoginDisconnectPacketSerializer(PacketSerializer): def __init__(self): self.id = 0 self.fields = [["reason", prim...
nilq/baby-python
python
"""Global API configuration.""" from os import environ from urlparse import urlparse # This module is both imported from and executed. In the former case only # relative imports are supported, in the latter only absolute. try: from schemas import facility_schema, request_schema, resource_schema, \ service...
nilq/baby-python
python
import csv import numpy as np import time from collections import OrderedDict from .containers import Question, Word, WordTrial, QuestionTrial def load_20questions_question_array(fname, time_window_lower_bound=None, time_window_length=None, ...
nilq/baby-python
python
import codecs import io import os import re import time import zipfile import numpy as np import requests import tensorflow as tf from keras_preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences os.environ['CUDA_VISIBLE_DEVICES'] = '1' BATCH_SIZE = 128 MAX_LENGTH = 40 ...
nilq/baby-python
python
''' Provides XOX class which is a subclass of gym.Env. Start using it via ``` x = XOX() state, reward, done = x.step(2) ``` Locations are: |0|1|2| |3|4|5| |6|7|8| Opponent step is taken by uniform random, let's assume it took action 0, board becomes: |o| |x| | | | | | | | | The state is the flattened version of the...
nilq/baby-python
python
#!/usr/bin/env python class Solution: def subsets(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ if len(nums) == 0: return [] elif len(nums) == 1: return [[], nums] elif len(nums) == 2: return [[], [nums...
nilq/baby-python
python
import os basedir = os.path.abspath(os.path.dirname(__file__)) # from instance.config import RANDOM_QUOTES_URL class Config (): SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess' SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', '').replace( 'postgres://', 'postgresql://') or...
nilq/baby-python
python
# -*- coding: utf-8 -*- __all__ = [ 'UserGroupService', 'PermissionService', 'UserGroupMemberService', 'UserGroupPermissionService', 'VerificationService', 'SuperAdminService', ] from . import user_group as UserGroupService from . import permission as PermissionService from . import user_group_member as U...
nilq/baby-python
python
def make_rxnorm_wordlists(): import pandas as pd import os import os.path dataloc = '../../../data/' filz = os.listdir(dataloc) normfilz = [xx for xx in filz if xx.startswith('RxNorm_full')] normfilz.sort() most_current = normfilz[-1] rxfile = os.path.join(dataloc,most_current,'r...
nilq/baby-python
python
__all__ = ["data", "functions"]
nilq/baby-python
python
import copy delta = [[-1, 0 ], # go up [ 0, -1], # go left [ 1, 0 ], # go down [ 0, 1 ]] # go right delta_name = ['^', '<', 'v', '>'] def adjacent_cells(grid,row,col): yMax = len(grid)-1 xMax = len(grid[0])-1 ret = [] if row-1 >= 0 and grid[row-1][col] != 1: ...
nilq/baby-python
python
#!/usr/bin/env python3 import argparse from typing import Optional, List, Tuple, Dict import json import sys import requests def get_library(*, cookies): # apparently returns all at once and pagination isn't necessary?? return requests.get( 'https://www.blinkist.com/api/books/library', cookies=...
nilq/baby-python
python
import json import asyncio import sqlite3 import discord from discord.ext import commands from discord.ext.commands.errors import * import time DB = 'AudreyAnnouncement.db' # spin off of permissions that makes announcements at time given in RoBot.py class AudreyAnnouncement(commands.Cog): def __init__(self, c...
nilq/baby-python
python
def return_if_error( errors=( KeyError, TypeError, ), default_value=None, ): def decorator(func): def new_func(*args, **kwargs): try: return func(*args, **kwargs) except errors as e: return default_value ...
nilq/baby-python
python
from enum import Enum __NAMESPACE__ = "foo" class GlobalAddressTypeValues(Enum): MA = "MA" PH = "PH" class GlobalNameTypeValues(Enum): LG = "LG" DB = "DB" class GlobalSimpleStatusType(Enum): VALUE_0 = "0" VALUE_1 = "1" class GlobalYesNoType(Enum): Y = "Y" N = "N"
nilq/baby-python
python
class LocationPoint(Location,IDisposable): """ Provides location functionality for all elements that have a single insertion point. """ def Dispose(self): """ Dispose(self: APIObject,A_0: bool) """ pass def ReleaseManagedResources(self,*args): """ ReleaseManagedResources(self: APIObject) """ pass de...
nilq/baby-python
python
from django.conf.urls import patterns from jobs.models import Slug urlpatterns = patterns('jobs.views', (r'^$', 'list_jobs'), (r'^delete/$', 'delete_jobs'), (r'^(%s)/$' % Slug.regex, 'show_results'), (r'^(%s)/delete/$' % Slug.regex, 'delete_job'), (r'^(%s)/rename/$' % Slug.regex, 'rename_job'), ...
nilq/baby-python
python
import core.job import core.implant import uuid class SLUIJob(core.job.Job): def create(self): if self.session_id == -1: self.error("0", "This job is not yet compatible with ONESHOT stagers.", "ONESHOT job error", "") return False if (int(self.session.build) < 9600 or int(se...
nilq/baby-python
python
from collections import Counter def answer(q,inf): s = Counter(q.split(' ')); r = [-1,-1] for i,j in enumerate(inf): check = sum(s.get(w,0) for w in j.split(' ')) if check != 0 and check > r[1]: r = [i,check] return None if r == [-1,-1] else inf[r[0]]
nilq/baby-python
python
from PySide6.QtCore import * from PySide6.QtGui import * from PySide6.QtWidgets import * from ..core.widget import set_contents_margins class QXVBoxLayout(QVBoxLayout): def __init__(self, widgets=None, contents_margins=0, spacing=0): super().__init__() set_contents_margins(self, contents_margins)...
nilq/baby-python
python
# input_text = 'R5, L5, R5, R3' input_text = open('input1.txt').read() dir_x, dir_y = (0, 1) # North dest_x, dest_y = (0, 0) for step in input_text.split(', '): side = step[0] distance = int(step[1:]) if side == 'R': dir_x, dir_y = dir_y, -dir_x else: dir_x, dir_y = -dir_y, dir_x d...
nilq/baby-python
python
""" Import from other sources to database. """
nilq/baby-python
python
import itertools from datetime import datetime import requests import rdflib import os import pandas as pd from SPARQLWrapper import SPARQLWrapper, TURTLE, JSON, POST # ----------------------------------------------------------------------------- def addTestData(target, loadConfig): """This function reads the test d...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Copyright (c) 2011 Plivo Team. See LICENSE for details import base64 import re import uuid import os import os.path from datetime import datetime import urllib import urllib2 import urlparse import traceback import redis import redis.exceptions import flask from flask import request from wer...
nilq/baby-python
python
from rest_framework.response import Response from resumes.serializers import BasicSerializer, ProfileSerializer, ResumeSerializer, VolunteerSerializer, WorkSerializer from resumes.models import Basic, Profile, Resume, Volunteer, Work from django.shortcuts import render from rest_framework.decorators import action from ...
nilq/baby-python
python
# "x" - Create. Creates the specified file, returns an error if the file exists f = open("text1.txt", "x") f.write("\nThis is new file") f.close()
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ The iterative comb sort algorithm. The comb sort algorithm was: * designed by Włodzimierz Dobosiewicz and Artur Borowy in 1980; * rediscovered and named by Stephen Lacey and Richard Box in 1991. Notes ----- The comb sort is a generalisation of the bubble ...
nilq/baby-python
python
from tkinter import * from tkinter.ttk import * from time import strftime root=Tk() root.title('clock') def time(): string=strftime('%H:%M:%S') label.config(text=string) label.after(1000,time) label= Label(root, font=('ds-digital',80), background="black",foreground='yellow') #install ds-digital font just...
nilq/baby-python
python
import re from typing import Optional, Pattern ESCAPE_STRING_RE = re.compile(r"(['\\])") ESCAPE_COL_RE = re.compile(r"([`\\])") NEGATE_RE = re.compile(r"^(-?)(.*)$") SAFE_COL_RE = re.compile(r"^-?([a-zA-Z_][a-zA-Z0-9_\.]*)$") # Alias escaping is different than column names when we introduce table aliases. # Using the...
nilq/baby-python
python
from sys import argv script, first, second, third = argv print("The script is called:", script) print("your first variable is:", first) print("Your second variable is:", second) print("Your third variable is:", third)
nilq/baby-python
python
# Copyright 2017 AT&T Intellectual Property. All other 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 required...
nilq/baby-python
python
#!/usr/bin/env python3 # # example_filtering.py: demonstrates how to use `topf` with automated # peak filtering. import topf import matplotlib.pyplot as plt import numpy as np import seaborn as sns if __name__ == '__main__': data = np.genfromtxt('example.txt') # This will automatically instruct the transfo...
nilq/baby-python
python
# # This script will allow you to authenticate using OpenID Connect with KeyCloak # To get more background information on how to use this script, go to # https://augment1security.com/authentication/how-to-authenticate-with-openid-connect-angular2-spa-zap-part-1/ # import json import time import datetime import random...
nilq/baby-python
python
import pytest from tournament_game import get_winner, Character @pytest.mark.parametrize("name", ["текст", "42", "", 12, -345, 52.08, None, True]) def test_get_winner_solo(name): character_sample = Character(name) character_list = [character_sample] assert str(name) == get_winner(character_list) ...
nilq/baby-python
python
import numpy as np from UncertainSCI.ttr import predict_correct_discrete, stieltjes_discrete, \ aPC, hankel_deter, mod_cheb, lanczos_stable from UncertainSCI.utils.compute_moment import compute_moment_discrete from UncertainSCI.families import JacobiPolynomials import time from tqdm import tqdm """ We use six ...
nilq/baby-python
python
"""The Test file for CLI Formatters.""" import re from sqlfluff.rules.base import RuleGhost from sqlfluff.parser import RawSegment from sqlfluff.parser.markers import FilePositionMarker from sqlfluff.errors import SQLLintError from sqlfluff.cli.formatters import format_filename, format_violation, format_path_violatio...
nilq/baby-python
python
from twitter import Twitter, OAuth class TwitterAPI: ACCESS_TOKEN = "223212203-5n4o9eTcRmKaxoPxtAelhufNzkdOTCSjn1dpku6U" ACCESS_SECRET = "kmqNtVCtlyxJ7tS9U0C4HjfjAtE3Djqb3CDrIhFHEoJQt" CONSUMER_KEY = "h5csBXeGpJmLma9IgnoV3JWfn" CONSUMER_SECRET = "2OVIV2H7kG1TLaNI7FFZ0Gn6odOda8UuojyVkh8emgRnlxB1wW" ...
nilq/baby-python
python
""" The customized image URL processing engine. Author: Qing Wang """ import re LC_LIST = ["a", "b", "c", "d", "e", "f", "g"] CAP_LIST = ["A", "B", "C", "D", "E", "F", "G"] NUM_LIST = ["0", "1", "2", "3", "4", "5", "6"] class URLProcessor(object): """ Class for URLProcessor. """ def __init__(self...
nilq/baby-python
python
from collections import OrderedDict, defaultdict from comet_ml import Experiment import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import os from utils import * from parse import get_parser import pickle from sklearn.manifold import TSNE from math import sin, cos, sqrt, atan2, radians class M...
nilq/baby-python
python
import rasiberryPiGPIOBaseController.RasiberryPiGPIO as RasiberryPiGPIO import rasiberryPiGPIOBaseController.Pin as Pin PI = RasiberryPiGPIO.RasiberryPiGPIO("3B+", "BCM")
nilq/baby-python
python
############################################################################## # # Copyright (c) 2014-2017, 2degrees Limited. # All Rights Reserved. # # This file is part of hubspot-contacts # <https://github.com/2degrees/hubspot-contacts>, which is subject to the # provisions of the BSD at # <http://dev.2degreesnetwor...
nilq/baby-python
python
# Solution 1 for e, n in enumerate(name): print(e, n) print(n, surname[e]) print("-----")
nilq/baby-python
python
import util import converter class lexical: def __init__(self, code, keys, keywords): self.code = code self.list = self.code.split('\n') self.keys = keys self.keywords = keywords self.inter() def list_str(self): self.code = '' ...
nilq/baby-python
python
from .models import * from decorator import * from .views import * from django.shortcuts import render from django.http import HttpResponse @service def get_goods_info(param): # 获取商品信息 interface_id = "2000" goods_id = param.get('goods_id', None) try: goods = getGoodsByID(goods_id) except RF...
nilq/baby-python
python