content stringlengths 5 1.05M |
|---|
#!/usr/bin/env python3
import sys
for _ in range(int(input().strip())):
arr = [list(input()) for _ in range(int(input().strip()))]
new_arr = []
for ar in arr:
temp = ([ord(a) for a in ar])
new_arr.append(sorted(temp))
for i in range(0, len(new_arr) - 1):
if new_arr[i + 1][0] <... |
# View more python tutorials on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
"""
Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly.... |
"""
Copyright 2018, Oath Inc.
Licensed under the terms of the Apache 2.0 license. See LICENSE file in project root for terms.
The Panoptes Context is one of the most important abstractions throughout the system. It is a thread-safe interface to
configuration and utilities throughout the system.
A Panoptes Context hol... |
addresses = [3, 225, 1, 225, 6, 6, 1100, 1, 238, 225, 104, 0, 1101, 32, 43, 225, 101, 68, 192, 224, 1001, 224, -160, 224, 4, 224, 102, 8, 223, 223, 1001, 224, 2, 224, 1, 223, 224, 223, 1001, 118, 77, 224, 1001, 224, -87, 224, 4, 224, 102, 8, 223, 223, 1001, 224, 6, 224, 1, 223, 224, 223, 1102, 5, 19, 225, 1102, 74, 50,... |
from __future__ import print_function
from matplotlib.testing.decorators import image_comparison, cleanup
import matplotlib.pyplot as plt
import numpy as np
import io
@image_comparison(baseline_images=['log_scales'], remove_text=True)
def test_log_scales():
ax = plt.subplot(122, yscale='log', xscale='symlog')
... |
"""
run A* path planning to provide a clairvoyant oracle for training data from the set of enviroment scenarios
determined by target_dist d as Manhattan distance from the base platform to the target position
"""
from absl import app, flags, logging
from pickle import Pickler
from scenario import plan_path
from truss_... |
import tensorflow as tf
import numpy as np
from ..utils import WeightNormalization, shape_list, logdet as logdet_f
def fused_add_tanh_sigmoid_multiply(input_a, input_b, n_channels):
n_channels_int = n_channels[0]
in_act = input_a + input_b
t_act = tf.tanh(in_act[:, :, :n_channels_int])
s_act = tf.sigm... |
import re
from collections import Counter
from random import choices as rcs
"""
i copied from line 6 to 10
"""
def words(text):
return re.findall(r'\w+', text.lower())
WORDS = Counter(words(open('big.txt').read()))
answer = []
probability = []
def calculateProbability(probability):
counter = 0
while cou... |
# coding=utf-8
import sys
class Process(object):
"""
Procces class
"""
def __init__(self,id):
self.id=id
def processItem(self,entry):
"""
The method that will contains the process applied to items.
:param entry: item data
:return:
"""
pass
... |
# - this file contains a Numpy implementation of the Revised Simplex Method (RSM)
# (see function "rsm_numpy")
# - for algorithmic details see:
# Hillier, Frederick S. (2014): Introduction to Operations Research.
# - RSM is used to solve Linear Programs (LP)
# - in vectorized notation, an LP optimization problem ca... |
from BaseState import States
|
# -*- coding=UTF-8 -*-
"""generate typing from module help.
Usage: "$PYTHON" ./scripts/full_help.py $MODULE | "$PYTHON" ./scripts/typing_from_help.py -
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import cast_unknown as cast
import re
_CLASS_MRO_START = "Method resolution... |
import regex
def ignore_some_dir(dir_name):
double_underscored = regex.findall(r'^__[0-9a-zA-Z]+__', dir_name, overlapped=True)
if len(double_underscored) != 0:
return False
perioded = regex.findall(r'^\.[\s\S]+?', dir_name)
if len(perioded) != 0:
return False
return True
def ext... |
from django.core.exceptions import ValidationError
from django.test import TestCase
from corehq.apps.data_interfaces.forms import (
is_valid_case_property_name,
validate_case_property_name,
)
class TestFormValidation(TestCase):
INVALID_PROPERTY_NAMES = [
' parent/abc ',
' host/abc ',
... |
import os
import lmfit
def save(obj, fname, overwrite='ask', **kwargs):
""" Saves a `dump`-able object to a file.
This is designed to reduce boilerplate at the command line when saving objects like
`ModelResult`, `Model`, and `Parameters`
"""
assert hasattr(obj, 'dump') and callable(obj.dump), "O... |
mainshop = [{"name":"Pencil","price":20,"description":"Write/Draw something"},
{"name":"Watch","price":500,"description":"Check the time"},
{"name":"iPhone","price":1000,"description":"Call people and use apps"},
{"name":"iPad","price":2000,"description":"Use apps"},
{"name":"Laptop","price":3000,"description":"Do work... |
def floyd_war(matrixSize, adjMatrix):
D_old = adjMatrix[:]
D_new = [[0 for x in range(matrixSize)] for y in range(matrixSize)]
print(f"Via node 0: ")
for row in range(matrixSize):
for column in range(matrixSize):
print(D_old[row][column], end=" ")
print()
print()
fo... |
import argparse
def get_args():
parser = argparse.ArgumentParser(description='RL')
parser.add_argument(
'--algo', default='ah-ch')
parser.add_argument(
'--lr', type=float, default=7e-4, help='learning rate (default: 7e-4)')
parser.add_argument(
'--bc-lr', type=float, default=1e-... |
# Copyright (C) 2006 Frederic Back (fredericback@gmail.com)
#
# 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 later version.
#
# This p... |
import unittest
from puzzlesolver.utils import halver
class TestUtilities(unittest.TestCase):
def test_can_divide_by_two(self):
my_halver = halver()
self.assertEqual(next(my_halver), 0.5)
|
from fastapi_utils.api_model import APIModel
from pydantic import validator
from app.services.validator import is_eml_or_msg_file
class Payload(APIModel):
file: str
class FilePayload(APIModel):
file: bytes
@validator("file")
def eml_file_must_be_eml(cls, v: bytes):
if not is_eml_or_msg_fil... |
"""0_migrate
Revision ID: 434bc58109ac
Revises:
Create Date: 2019-11-01 18:51:24.754787
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '434bc58109ac'
down_revision = None
branch_labels = None
d... |
#
# Copyright (C) 2015-2016 Hewlett Packard Enterprise Development LP
#
# 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 a... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-07 19:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('labour', '0031_surveyrecord'),
]
operations = [
migrations.AddField(
model_name='survey',
n... |
# ===============================================================================
# Copyright 2016 ross
#
# 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/LICE... |
from .netdash_modules import NetDashModule
def create_netdash_modules(modules):
return [NetDashModule(module_name) for module_name in modules]
|
"""Test of cryptography."""
from pymicropel.helper.crypto import Crypto
def test_encrypt_decrypt_test():
"""Test encoding and decoding."""
original_str = "Sww=BRDqXPgX5ytH"
exp_str_pass1 = "Ffz7WCI{MAjR hyB"
exp_str_pass999999 = 'Mgf"\\BUnF@vG+ieW'
cryptography = Crypto()
cryptography.crypt... |
import logging
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login as auth_login, logout as auth_logout, update_session_auth_hash
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import update_last_login
from django.contrib... |
import KratosMultiphysics
import KratosMultiphysics.FluidDynamicsApplication as KratosFluid
## Distance import utility class definition
class DistanceImportUtility:
def __init__(self, model_part, settings):
self.settings = settings
self.model_part = model_part
def ImportDistance(self):
... |
import asyncio
from asyncevents import on_event, emit, get_current_emitter, ExceptionHandling
@on_event("error")
async def oh_no(_, event: str):
print(f"Goodbye after {event!r}!")
raise ValueError("D:")
async def handle_error(_, exc: Exception, event: str):
print(f"Exception {type(exc).__name__!r} from ... |
import re
import mock
from django.test import TestCase
from django_universal_view_decorator import ViewDecoratorBase
def test_log(*args, **kwargs):
pass
class TestAutomaticValueOfNumRequiredArgs(TestCase):
""" If you don't override the `ViewDecoratorBase.num_required_args` class attribute then its value i... |
def binary_search(array, searched_value):
start = 0
end = len(array) - 1
while(start <= end):
mid = (start + end) // 2
guess = array[mid]
if(searched_value == guess):
return mid
elif(searched_value < guess):
end = mid - 1
elif(searched_value >... |
# -*- coding: utf-8 -*-
__author__ = 'Sal Aguinaga'
__license__ = "GPL"
__version__ = "0.1.0"
__email__ = "saguinag@nd.edu"
import pprint as pp
import pandas as pd
import numpy as np
import scipy
from nltk.cluster import KMeansClusterer, GAAClusterer, euclidean_distance
import nltk.corpus
import nltk.stem
import r... |
from conans import ConanFile
from conan_build_helper.cmake import *
from conan_build_helper.headeronly import *
from conan_build_helper.require_scm import *
class ConanCommonRecipes(ConanFile):
name = "conan_build_helper"
version = "0.0.1"
url = "https://gitlab.com/USERNAME/conan_build_helper"
license ... |
import argparse
from defaults import EPIC_JPOSE, EPIC_MMEN
def get_JPoSE_parser(info_str):
parser = get_base_parser(info_str, EPIC_JPOSE)
parser.add_argument('--action-weight', type=float, help='Weight of the action losses. [{}]'.format(EPIC_JPOSE.action_weight))
parser.add_argument('--comb-func', type=str... |
import os
from mock import Mock, patch
import pytest
from bson.objectid import ObjectId
from torrents.downloader import Downloader
#path of torrent file
def path_to_fixture(name):
module_dir = os.path.dirname(os.path.realpath(__file__))
return os.path.join(module_dir, 'fixtures', name)
@pytest.fixture
def dl... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(name='kivymd',
version='0.1.2',
description='Set of widgets for Kivy inspired by Google\'s Material '
'Design',
author='Andrés Rodríguez',
author_email='andres.rodriguez@lithersoft.com',
url='https://github.com/... |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, publ... |
from utilities import *
from shapes import *
GU = GeometryUtility()
class RotatingCaliper():
def __init__(self, points):
self._points = points
self._N = len(points)
self._antipodals = None
self._calipers()
def _next(self, i):
return (i+1) % self._N
def _calipers(se... |
from __future__ import print_function
import logging
import os
from aeromancer import project
from aeromancer import project_filter
from aeromancer.cli.run import ProjectShellCommandBase
class Grep(ProjectShellCommandBase):
"""Search the contents of files
Accepts most of the arguments of git-grep, unless ... |
import math
import numpy as np
import torch
from torch import nn
from .backbone import conv3x3
from .transformer import Transformer
class ConvHeader(nn.Module):
def __init__(self, cfg):
super(ConvHeader, self).__init__()
self.cfg = cfg
self.use_bn = cfg.use_bn
self.use_transformer... |
"""A feature extractor for provider information."""
from __future__ import absolute_import
import logging
import pandas as pd
from sutter.lib import postgres
from sutter.lib.feature_extractor import FeatureExtractor
from sutter.lib.helper import format_column_title
log = logging.getLogger('feature_extraction')
c... |
# coding=utf-8
import asyncio
async def compute(x, y):
print("Compute %s + %s ..." % (x, y))
await asyncio.sleep(1.0) # 协程compute不会继续往下面执行,直到协程sleep返回结果
return x + y
async def print_sum(x, y):
result = await compute(x, y) # 协程print_sum不会继续往下执行,直到协程compute返回结果
print("%s + %s = %s" %... |
from datetime import datetime
class Monitor:
def __init__(self, max_patience=5, delta=1e-6, log_file=None):
self.counter = 0
self.best_value = 0
self.max_patience = max_patience
self.patience = max_patience
self.delta = delta
self.log_file = log_file
print("... |
# Copyright 2019 Quantapix Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
from datetime import timezone, timedelta
import dotenv
import pytest as pytest
from box import Box
from core import firestore_client
from google.cloud.firestore_v1 import Client, DocumentReference, DocumentSnapshot
from mockito import mock
PARIS_TZ = timezone(timedelta(hours=2))
@pytest.fixture(autouse=True)
def se... |
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
import numpy as np
import pandas as pd
import pickle
import glob
from sklearn.model_selection import train_test_split
from skmultilearn.model_selection import iterative_train_test_split
from sklearn.metrics import classification_report
from sklearn.metrics import roc_auc_score
from sklearn.metrics import roc_curve
fr... |
"""
A permission has to be defined first (using grok.Permission for example)
before it can be used in @grok.require().
>>> from grokcore.xmlrpc import testing
# PY2 - remove '+IGNORE_EXCEPTION_DETAIL' when dropping Python 2 support:
>>> testing.grok(__name__) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (m... |
import re
import string
import numpy as np
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
from nltk.tokenize import TweetTokenizer
def process_tweet(tweet):
"""Process tweet function.
Input:
tweet: a string containing a tweet
Output:
tweets_clean: a list of words co... |
from uuid import uuid4
from django.db import models
from taggit.managers import TaggableManager
class Thing(models.Model):
id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
name = models.CharField(max_length=100)
description = models.TextField()
category = models.ForeignKey(
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 14 18:21:04 2021
@author: ariandovald
"""
import matplotlib.pyplot as plt
import numpy as np
from tabulate import tabulate
import random as random
n_total = 0
p_win = 0.01
p_lose = 1 - p_win
t = 0
p = []
n_space = []
n = 1
# s = 0
# while n-1 <= 2... |
import setuptools
with open("README.md", "r") as fh:
long_description=fh.read()
setuptools.setup(
name="gmsfile",
version="0.1.4",
author="Gourab Kanti Das",
author_email="gourabkanti.das@visva-bharati.ac.in",
description="A converter from XYZ to GAMESS file",
long_... |
#
# This software is licensed under the Apache 2 license, quoted below.
#
# Copyright 2019 Astraea, 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/LI... |
#!/usr/bin/env python
"""
These classes implement various focus lock modes. They determine
all the behaviors of the focus lock.
Hazen 05/15
"""
import math
import numpy
import scipy.optimize
import tifffile
import time
from PyQt5 import QtCore
import storm_control.sc_library.halExceptions as halExcept... |
from typing import List, Union
from aiocache import cached
from bson import ObjectId
from motor.core import AgnosticCollection
from pymongo.results import DeleteResult
from config.clients import redis_cache_only_kwargs, key_builder_only_kwargs, cache, pickle_serializer, logger
from config import SCHEMA_TTL
from utils... |
# -----------------------------------------------------------------------------
# The MIT License (MIT)
# Copyright (c) 2020 Robbie Coenmans
#
# 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 ... |
import argparse
from pathlib import Path, PurePath
from typing import Dict
import numpy as np
import src.data
import src.file_util
import src.image_util
import src.model
def _batch_update(
dataset: src.data.Dataset,
batch_index: int,
d_f: src.data.ModelFile,
d_c: src.data.ModelFile,
g_c: src.dat... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyMsgpackNumpy(PythonPackage):
"""This package provides encoding and decoding routines
... |
import time
import threading
import abc
__author__ = "Yves Auad"
class EELSController(abc.ABC):
def __init__(self):
self.lock = threading.Lock()
self.wobbler_thread = threading.Thread()
self.last_wobbler_value = 0
self.last_wobbler_which = 'OFF'
@abc.abstractmethod
def se... |
from django.conf import settings
from django.db.models.signals import post_save
from guardian.shortcuts import assign_perm
from timezone_field import TimeZoneField
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.core.mail import send_mai... |
#!/usr/bin/env python3
import binascii
import json
import socket
import numpy as np
import matplotlib.pyplot as plt
s = socket.create_connection(('localhost', 8332))
r = s.makefile()
cookie = binascii.b2a_base64(open('/home/roman/.bitcoin/.cookie', 'rb').read())
cookie = cookie.decode('ascii').strip()
def request(me... |
import torch
import torch.nn as nn
import torch.nn.functional as func
from dtcwt_gainlayer.layers.shrink import SparsifyWaveCoeffs_std, mag, SoftShrink
class PassThrough(nn.Module):
def forward(self, x):
return x
class WaveNonLinearity(nn.Module):
""" Performs a wavelet-based nonlinearity.
Args... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Projet : Editeur, Compilateur et Micro-Ordinateur pour
un langage assembleur.
Nom du fichier : 04-04-ROM.py
Identification : 04-04-ROM
Titre : Mémoire ROM
Auteurs : Francis Emond, Malek Khattech,
... |
from unittest import TestCase
from spectrum_plot import create_fft_plot
class Test(TestCase):
def create_fft_plot(self):
"""
only checking that it compiles
:return:
"""
try:
plot = create_fft_plot()
plot.update_raw_data([1, 2, 3, 4, 5], s... |
import random
class BasicReplayMemory:
def __init__(self, size=2000):
self.size = size
self.memory = []
self.index = 0
def save(self, frame):
if len(self.memory) < self.size:
self.memory.append(frame)
else:
self.memory[self.index % self.size] = ... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
x = 6
def example():
global x
print(x)
x+=5
print(x)
example()
def example2():
globx = x
print(globx)
globx += 5
print(globx)
return globx
x = example2()
print(x)
|
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
import time
import random
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.firefox.options import Options
import os
import requests
import re
import sys
username = input('Введите ваш логин: '... |
# Generated by Django 2.2 on 2019-06-26 16:20
import curriculum.models.utils
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.Cr... |
# -*- coding: utf-8 -*-
###############################################################################
#
# RunCommand
# Executes a SQL command for a Postgres database.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not us... |
import os
import sys
import logging
from logging.handlers import RotatingFileHandler
def get_logger():
logs_folder_path = os.getenv('LOGS_FOLDER_PATH')
app_name = os.getenv('APP_NAME')
if not os.path.isdir(logs_folder_path):
os.mkdir(logs_folder_path)
log_file_path = logs_folder_path + '/' +... |
import os
import unittest
from collections import namedtuple
import pbn
DIR = os.path.dirname(__file__)
class PBNTest(unittest.TestCase):
def test_parse_pbn_string(self):
"""
This tests various pbn methods and reads from
storage
"""
with open(os.path.join(DIR, 'test.pbn'))... |
#
# ----------------------------------------------------------------------------------------------------
# DESCRIPTION
# ----------------------------------------------------------------------------------------------------
'''
ASGI config for kit_django project.
It exposes the ASGI callable as a module-level variable n... |
""" Problem Set 5 - Problem 3 - CiphertextMessage
For this problem, the graders will use our implementation of the Message and PlaintextMessage classes, so don't worry if you did not get the previous parts correct.
Given an encrypted message, if you know the shift used to encode the message, decoding it is trivial.
... |
from math import log10
from utility_functions import PSNR, str2bool, ssim
import torch
from torch.nn.parallel import DistributedDataParallel as DDP
import torch.distributed as dist
import torch.multiprocessing as mp
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
... |
#!/usr/bin/env python3
#Written for python3.9
from random import randint
import sys, time
def backspace(count=1,out=sys.stdout):
out.write('\b' * count)
out.flush()
def bogoprint(msg, delay=0.2):
'''Prints a string with a nice random effect:
Arguments:
msg - the string to be printed (ASCII-... |
def test(first,second,third):
print(first,second,third)
test(1,2,3)
first = [1,2,3,4,5,6]
second = {
"num":1,
"save":False,
"content":[1,2,3,4,5],
}
third =tuple([3,4,5,6,7])
test(first,second,1)
def test(first,second,third):
print(first,second,third)
test(1,2,3)
first = [1,2,3,4,5,6]
second... |
try:
import torch
# assert sklearn.__version__ == "0.22"
except:
print("(!) Code in `autogoal.contrib.torch` requires `pytorch==0.1.4`.")
print("(!) You can install it with `pip install autogoal[torch]`.")
raise
from ._bert import BertEmbedding, BertTokenizeEmbedding
|
import numpy as np
from abc import ABC, abstractmethod
def compute_iou(preds,gts):
"""
Compute a matrix of intersection over union values for two lists of bounding boxes using broadcasting
:param preds: matrix of predicted bounding boxes [NP x 4]
:param gts: number of ground truth bounding boxes... |
import scrapy
import json
import os
from pathlib import Path
from bills.models import CommitteeDocument
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
FILE_PATH = os.path.join(BASE_DIR, 'commitee_report_detail_urls.json')
class CommitteeReportSpider(scrapy.Spider):
name = 'committeereport'
def ... |
#! /usr/bin/python2
from __future__ import print_function
import os
import sys
import glob
from optparse import OptionParser
conf_latest_cve_result = False
if conf_latest_cve_result:
try:
import urllib2 as urllib
except:
import urllib.request as urllib
import json
req_timeout = 2.0
def _data_url(url... |
#coding=utf-8
#熟食店P113 2017.4.17
sandwichOrders = ['fruitSandwich','baconicSandwich','beefSandwich','pastrmiSandwich']
finishedSandwiches = []
print("Now we have")
print(sandwichOrders)
print("\nOpps!The pastramiSandwich is sold out!")
for sandwichOrder in sandwichOrders:
if sandwichOrder == 'pastrmiSandwich':
sandw... |
#!/usr/bin/env python
from tincanradar import dbuvm2dbm, uvm2dbm
from argparse import ArgumentParser
def main():
p = ArgumentParser()
p.add_argument("-u", "--uvm", help="uV/m", type=float)
p.add_argument("-db", "--dBuvm", help="dBuV/m", type=float)
p.add_argument("-d", "--dist_m", help="distance (one... |
########################################
# this file does not use pybgs library
########################################
########################################
########################################
# This sript will take video.MP4 exract
# a given area and calculate the pixel difference
# between each frame after... |
#!/usr/bin/env python
import io
import json
import os
moment_locale_directory = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"node_modules",
"moment",
"src",
"locale",
)
long_date_format_parts = (
r"LT : '",
r'LT : "',
r"LTS : '",
r'LTS : "',
r"L : '",
r'L : "'... |
import pandas as pd
rows = []
df = pd.read_csv('sample_csv.csv')
for _, row in df.iterrows():
rows.extend([row] * row['Score'])
new_df = pd.DataFrame(rows, columns=df.columns)
new_df.to_csv('bad_csv.csv') |
from model.contact import Contact
from model.group import Group
from generator import contact as f
from generator import group as t
def test_add_contact_to_group(app, orm):
old_contacts = None
added_contact = None
added_group = None
if len(orm.get_group_list()) == 0:
app.group.creat... |
from datetime import datetime
from decimal import Decimal
from typing import Generator, List, Dict
import pytz
from privex.helpers import empty, sleep
from privex.jsonrpc.objects import MoneroTransfer
from privex.coin_handlers.base.objects import Deposit, Coin
from privex.jsonrpc import MoneroRPC
from privex.coin_ha... |
import ADT
from LaTeX import LaTeX
import sys
import io
import os
filename = sys.argv[1]
infile = io.open(filename, "r", encoding="utf-8")
firstname, extension = os.path.splitext(filename)
txt = infile.read()
#
# Hack below is disgusting. It overwrites the html macro \youtube for LaTeX pdf
#
txt = txt.replace("\\c... |
# Generated by Django 2.2.dev20190116205049 on 2019-01-16 20:54
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('decks', '0007_auto_20190116_2054'),
migrations.... |
import re
from ..util import sozgebolu
class bigram(object):
def __init__(self, text):
soilemder = self.soilemgebolu(text)
self.newlemm = []
self.lastlemm = []
for soilem in soilemder:
soz_tag = sozgebolu(soilem)
soz = soz_tag[0]
ta... |
from django.urls import path
from .views import *
urlpatterns = [
path(r'', SandboxIndexView.as_view(), name='sandbox'),
path(r'<path:file_path>', SandboxView.as_view(), name='sandbox'),
]
|
from .register import INFER, PREPROCESS, POSTPROCESS, METRICS
|
"""empty message
Revision ID: af9c317d2c92
Revises: 245d12695c69
Create Date: 2020-03-12 08:49:36.009020
"""
# revision identifiers, used by Alembic.
revision = 'af9c317d2c92'
down_revision = '245d12695c69'
from alembic import op
import sqlalchemy as sa
from sqlalchemy import orm
from app import db
from enum import... |
import sys
from PyQt5.QtWidgets import (QApplication, QDoubleSpinBox, QLabel, QGridLayout,
QWidget, QToolBar, QStackedWidget, QVBoxLayout,
QRadioButton, QSpacerItem)
from PyQt5.QtCore import Qt
import main
#import ab as main
app = QApplication(sys.argv)
cla... |
import typing
from lemon.exception import GeneralException
from lemon.request import Request
from lemon.response import Response
class Context:
"""The Context object store the current request and response .
Your can get all information by use ctx in your handler function .
"""
def __init__(self) -> ... |
numbers = list()
n = last = 0
for c in range (0, 5):
num = int(input(f'{n + 1}º number: '))
if n == 0 or num > last:
last = num
numbers.append(num)
print('The number was inserted at the final of the list.')
else:
position = 0
while position < len(numbers):
... |
# -*- coding: iso-8859-15 -*-
# -*- Mode: Python; py-ident-offset: 4 -*-
# vim:ts=4:sw=4:et
'''
rpm definitions
Mario Morgado (BSD) https://github.com/mjvm/pyrpm
'''
__revision__ = '$Rev$'[6:-2]
RPM_LEAD_MAGIC_NUMBER = '\xed\xab\xee\xdb'
RPM_HEADER_MAGIC_NUMBER = '\x8e\xad\xe8'
RPMTAG_MIN_NUMBER = 1000
RPMTAG_MAX_NU... |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Shell commands for the log service
:author: Thomas Calmant
:copyright: Copyright 2016, Thomas Calmant
:license: Apache License 2.0
:version: 0.6.4
..
Copyright 2016 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
yo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.