content stringlengths 5 1.05M |
|---|
import unittest
from seedpod_ground_risk.pathfinding.a_star import *
from seedpod_ground_risk.pathfinding.heuristic import *
from seedpod_ground_risk.pathfinding.rjps_a_star import *
from tests.pathfinding.test_data import SMALL_TEST_GRID, LARGE_TEST_GRID, SMALL_DEADEND_TEST_GRID
class BaseAStarTestCase(unittest.Tes... |
from __future__ import division
import numpy as np
from matplotlib import pyplot as plt
import seaborn.apionly as sns
from scipy import stats
def fitMVN():
# set plotting style
sns.set_style("darkgrid")
# load PM dataset
pm_daily = np.loadtxt('../data/epa_hourly/alabamatest.csv', delimiter=',')
#... |
#
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
from os import makedirs
from os.path import isdir, join
import logging
import csv
from .base import BaseProvider
class CsvProvider(BaseProvider):
'''
Core provider for records configured in csv files on disk.
... |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
import loggi... |
from crownstone_core.packets.behaviour.BehaviourBase import BehaviourBase
from crownstone_core.packets.behaviour.BehaviourTypes import BehaviourType
from crownstone_core.packets.behaviour.PresenceDescription import BehaviourPresence, BehaviourPresenceType, \
DEFAULT_PRESENCE_DELAY
DEFAULT_PRESENCE = BehaviourPrese... |
import os
import sys
from util import running
from util.logging import *
from util.files import *
import subprocess
FLASH_SCRIPT_PATH = "/META-INF/com/google/android/flash-script.sh"
XPOSED_TRAIL = "_xposed"
START_PARSING = "- Placing files"
STOP_PARSING = "if [ $IS64BIT ]; then"
INSTALL_AND_LINK = "install_and_link"... |
import csv
import os
from utils import *
class SongList():
def __init__(self, fname):
self.songs = {}
self.fname = fname
self.current_key = 0
def save(self):
with open(self.fname, 'wb') as csvfile:
writer = csv.writer(csvfile, delimiter=',', quoting=csv.... |
import sys, os, subprocess, fnmatch, traceback
import datetime, arcpy, json, logging, pythonaddins
from arcpy import env
from arcpy.sa import *
from Delineation import Delineation as Delineation
from BasinParameters import BasinParameters as BasinParameters
from UpdateS3 import Main as UpdateS3
from PullFromS3 import ... |
expected_output = {
"vrf": {
"default": {
"address_family": {
"ipv4": {
"prefix": {
"10.16.2.2/32": {
"epoch": 2,
"nexthop": {
"10.0.0.13": {
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
__author__ = 'bibow'
import json, uuid, os
from datetime import datetime, date
from decimal import Decimal
import logging
logger = logging.getLogger()
logger.setLevel(eval(os.environ["LOGGINGLEVEL"]))
import boto3
from boto3.dynamodb.con... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def string(zahl):
if zahl <= 9:
return str(zahl)
else:
return chr(55+zahl)
def horner(b, Z):
ergebnis = ''
while Z > 0:
rest = Z % b
ergebnis = string(rest) + ergebnis
Z = (Z - rest)/b
return ergebnis
if __name_... |
import taichi as ti
import numpy as np
from material import get_texture_value, scatter
@ti.data_oriented
class Renderer:
def __init__(self, image_width, image_height, scene, camera, spp=16, max_depth=10, p_RR=0.8):
self.image_width = image_width
self.image_height = image_height
self.canva... |
import unittest
# Testing support.
from test.stub_flickrapi import StubFlickrAPI
# Officially exported names.
from flickrsyncr import Config
from flickrsyncr import flickrwrapper
class TestFlickrWrapper(unittest.TestCase):
"""Exercise the methods in flickrwrapper.
"""
def setUp(self):
self.config = Config('albu... |
# -*- coding: utf-8 -*-
{
'name': 'Standard Accounting Report',
'version': '12.0.1.0.0',
'category': 'Accounting',
'author': 'Florent de Labarre',
'summary': 'Standard Accounting Report',
'website': 'https://github.com/fmdl',
'depends': ['account', 'report_xlsx'],
'data': [
'sec... |
class Wrapper:
def __init__(self, snakemake, command, input, output, params=None, threads=None):
self.snakemake = snakemake
self.input = input
self.output = output
self.params = params
self.threads = threads
self.command = command
self.input.assign(s... |
# -*- coding: utf-8 -*-
"""
@author: Yi Zhang.
Department of Aerodynamics
Faculty of Aerospace Engineering
TU Delft, Delft, Netherlands
"""
import sys
if './' not in sys.path: sys.path.append('./')
from root.config.main import *
from root.save import read
from scipy.interpolate import Neare... |
import requests
from bs4 import BeautifulSoup
import numpy as np
import pymysql
import time
from random import randint
from time import sleep
import re
# defining user-agents
headers = {"User-Agent": "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"}
# Database connection
conn = pymysql.... |
import responses
from requests.exceptions import ConnectionError
from transcriptic.config import Connection
from transcriptic.sampledata.project import sample_project_attr
from transcriptic.sampledata.run import sample_run_attr
from transcriptic.util import load_sampledata_json
class MockConnection(Connection):
... |
import os, sys
import time
import re
import argparse
import configparser
import ast
import glob
import pandas as pd
import matplotlib
matplotlib.use("TKAgg")
import matplotlib.pyplot as plt
import seaborn as sns
sys.path.append('../src/')
from python import helper as hp
from python import fixed_parameters as FP
parse... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
from bs4 import BeautifulSoup
class Crawler:
def __init__(self, key_set, count):
self.key_set = key_set
self.count = count
self.images = []
self.header = {'User-Agent':"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like... |
import infiltrate.scheduling
if __name__ == "__main__":
infiltrate.scheduling.recurring_update()
|
import json
import hashlib
from urllib.parse import urlparse
from dojo.models import Endpoint, Finding
__author__ = 'dr3dd589'
class WpscanJSONParser(object):
def __init__(self, file, test):
self.dupes = dict()
self.items = ()
if file is None:
return
data = file.read... |
"""
Helper functions for retrieving vocabulary aliases
"""
import argparse
import re
from typing import Any, Dict, List, Optional, Tuple
import requests
import urllib3 # type: ignore
ESCAPE_CHARS = [",", ":", "#"]
def unescape(s: str) -> str:
"""
Unescape
"""
for char in ESCAPE_CHARS:
s =... |
from __future__ import annotations
import random
from abc import ABC, abstractmethod
from typing import FrozenSet, Type, List
import casino.main
import casino.odds
class Player(ABC):
"""`Player` places bets in a game.
This is an abstract class, with no body for the `Player.place_bets()` method.
However... |
import math
import statistics
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression as sk_linreg
from scipy.stats import f as f_dist
def voyage_finder(in_df, datetime='BaseDateTime', date_format='%Y-%m-%d %H:%M:%S', lead_cols=['lead_date_time', 'lead_LON', 'lead_LAT'],
... |
from rest_framework import serializers
from observations_api import models
class SpeciesSerializer(serializers.ModelSerializer):
"""Serializer for species data"""
class Meta:
model = models.Species
fields = ['id','name','sc_name']
class ObservationSerializer(serializers.ModelSerializer):
... |
#!/usr/bin/env python3
import sys
import argparse
import ngram_tools
def to_int(ngrams):
for ngram, prob in ngrams:
freq = int(prob)
if freq == 0:
freq = 1
yield ngram, freq
def scale_ngrams(ngrams, scale):
for ngram, freq in ngrams:
yield ngram, freq * scale
de... |
#!usr/bin/python
# -*- coding: utf-8 -*-
import argparse
from helpers.execution_timer import measure
from typing import Tuple
""" ANAGRAM CHECK
Problem:
Given two strings, check to see if they are anagrams. An anagram is when the two strings can be written using
the exact same letters (so you can just rearran... |
def usages_helper():
print('Hello Anaconda!')
|
# -*- coding: utf-8 -*- #
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
# Generated by Django 3.0.3 on 2020-03-10 12:45
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0005_auto_20200310_1745'),
('blog', '0005_auto_20200310_1700'),
]
operations = [
]
|
import json
import pandas as pd
import math
tiers = {4:list(range(0, 23)), 3:list(range(23, 30)), 2:list(range(30, 37)), 1:list(range(37, 46))}
def ivs(name, cp_num, highest=None, level=None, hp=None, tier=None):
if level != None:
lvlmax, lvlmin = level+1, level
else:
lvlmin, lvlmax = 1, 41
... |
from django import template
from ..service.get_base_template_cache_time import get_base_template_cache_time_by_part
register = template.Library()
@register.inclusion_tag('base_template/cached_body.html')
def cached_body():
cached_body_time = get_base_template_cache_time_by_part('BODY')
return {"cached_body_t... |
import numpy as np
import csv
import pandas as pd
from scipy.integrate import quad
# # Import the data(leave the head)
# sourcenamelist=csv.reader(open('/Users/dingding/Desktop/Final5.11.csv','r'))
# GRBname=[column[0]for column in sourcenamelist]
# Znamelist=csv.reader(open('/Users/dingding/Desktop/Final5.11.csv','r... |
import unittest
from click.testing import CliRunner
from ...create_cmd import create_cmd
from core.substitution import Substitution
from core.cardanopy_config import CardanoPyConfig
from pathlib import Path
import tempfile
import shutil
import os
class TestSubstitution(unittest.TestCase):
def setUp(self):
... |
import glob
import json
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import seaborn as sns
from visgrid.utils import load_experiment, get_parser
parser = get_parser()
# yapf: disable
parser.add_argument('--pretrain-steps', type=str, default='3k',
choices=['3k','... |
#!/usr/bin/python3
# coding=utf-8
# -------------------------------------------------------------------------------
# This file is part of Phobos, a Blender Add-On to edit robot models.
# Copyright (C) 2020 University of Bremen & DFKI GmbH Robotics Innovation Center
#
# You should have received a copy of the 3-Clause ... |
#!/env/bin/env python3
# -*- coding: utf-8 -*-
import sys
def main():
print("hello world")
if __name__ == "__main__":
args = sys.argv
main() |
import os
os_env_prefix = 'KAKATUA'
cmd_prefix = os.getenv(f'{os_env_prefix}_CMD_PREFIX')
bot_token = os.getenv(f'{os_env_prefix}_BOT_TOKEN')
|
import io
from setuptools import setup
VERSION = '0.2'
with io.open('README.md', encoding='utf-8') as f:
long_description = '\n' + f.read()
setup(
name='file-permissions',
version=VERSION,
description='A tiny wrapper to get information about file permissions',
long_description=long_description,
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# test.py
# Improved version of the aging grep test with blktrace, backups, and config files. Running without a config file will generate one with default values.
import os.path
import subprocess
import shlex
import time
import os
import sys
print("[HZY0] iostat -d /dev/sdb1 ... |
from flask import Flask
from flask_restful import Api
from flask_jwt import JWT
from security import authenticate, identity
from resources.user import UserRegister
from resources.items import Item, ItemList
from resources.store import Store, StoreList
from db import db
# HTTP status codes
# 200 - Success
# 201 - Creat... |
from sympy import symbols, sin, cos
from shenfun import *
# Use sympy to compute manufactured solution
x, y, z = symbols("x,y,z")
ue = (cos(4*x) + sin(2*y) + sin(4*z))*(1-x**2)
fe = ue.diff(x, 2) + ue.diff(y, 2) + ue.diff(z, 2)
C0 = FunctionSpace(32, 'Chebyshev', bc=(0, 0))
F1 = FunctionSpace(32, 'Fourier', dtype='D'... |
import numpy as np
import matplotlib.pyplot as plt
import math
N = 129
n_iter = 64
image = np.zeros([n_iter, N], dtype='int')
print(image.shape)
image[0, math.ceil(N/2)] = 1
for iterate in range(1, n_iter):
for j in range(1, N-1):
if image[iterate-1, j+1]+image[iterate-1, j-1] == 1:
image[ite... |
import pytest
from debutizer.commands.config_file import (
CredentialsYAMLError,
DebutizerYAMLError,
S3UploadTargetConfiguration,
)
def test_s3_configuration_validity():
config = S3UploadTargetConfiguration(
endpoint="my_endpoint",
bucket="my_bucket",
access_key="my_access_key... |
# chat/routing.py
from django.urls import re_path
from . import consumers
websocket_urlpatterns = [
re_path(r'game', consumers.GameConsumer.as_asgi()),
re_path(r'chat', consumers.ChatConsumer.as_asgi())
]
|
""""
Copyright © twilsonco 2020
Description:
This is a discord bot to manage torrent transfers through the Transmission transmissionrpc python library.
Version: 1.2
"""
import discord
import asyncio
import aiohttp
import json
from json import dumps, load
import subprocess
from discord.ext.commands import Bot
from dis... |
# Author: BigRabbit
# 下午3:10
from django.contrib.auth import get_user_model, authenticate
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm
from django.contrib.auth.tokens import default_token_generator
from django.conf import settings
from django.utils.http import urlsafe_base64_decode
from dja... |
# coding=utf-8
import pytest
from pytorch_transformers import AutoTokenizer
from neural_wsd.text.transformers import asciify
from neural_wsd.text.transformers import BasicTextTransformer
from neural_wsd.text.transformers import PaddingTransformer
from neural_wsd.text.transformers import WordPieceListTransformer
def ... |
# Copyright 2013-2022 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 Batctl(MakefilePackage):
"""B.A.T.M.A.N. advanced control and management tool"""
home... |
import json
import time
import random
import numpy as np
from umap.umap_ import UMAP
from typing import Any, List
from sklearn.utils import shuffle
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap
from wsl.locations import wsl_model_dir, known_extensions
from wsl.loaders.img_loaders im... |
from model.contact import Contact
test_data = [
Contact(firstname="Nikolay", middlename="Vassilievich", lastname="Gogol", nickname="writer", title="Title",
company="Writer Union", address="Dikanka, 8 - 13", homephone="+31278963215", mobilephone="8(921)4567893", workphone="84958963214",
... |
from qiskit import *
# from qiskit.visualization import plot_histogram
# import matplotlib
class Simple:
def __init__(self):
self.backend = None
def auth(self):
# self.backend = Aer.get_backend('statevector_simulator')
self.backend = Aer.get_backend('aer_simulator')
def run(self:... |
#!/usr/bin/env python3
import os
import numpy as np
import astropy.io.fits as fits
from stella.catalog.base import _str_to_float
inputfile = os.path.join(os.getenv('ASTRO_DATA'), 'catalog/I/239/hip_main.dat')
types = [
('HIP', np.int32),
('RAdeg', np.float64),
('DEdeg', np.float64),
... |
__author__ = 'raymond301'
import itertools, glob, os
from config import DATA_ARCHIVE_ROOT, logger as logging
from .kgenomes_parser import load_data
import biothings.hub.dataload.uploader as uploader
from hub.dataload.uploader import SnpeffPostUpdateUploader
class KgenomesBaseUploader(uploader.IgnoreDuplicatedSourceUpl... |
from django.views.decorators.csrf import csrf_exempt
from django.template import RequestContext, loader
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.shortcuts import render_to_response, get_object_or_404
from ldap_auth.toolbox import get_user
from django.core.e... |
class Solution:
def reverseBits(self, n):
'''
input: n, an integer
return: an integer
'''
n = format(n, '032b')
n = list(str(n))
n = n[::-1]
n = int(''.join(map(str,n)))
n = str(n)
n = int(n, 2)
return n
|
"""
Support for paramiko remote objects.
"""
from . import run
from .opsys import OS
import connection
from teuthology import misc
import time
import re
import logging
from cStringIO import StringIO
from teuthology import lockstatus as ls
import os
import pwd
import tempfile
import netaddr
import console
log = loggin... |
import os
import logging
import twink
import twink.ovs
import twink.ofp4 as ofp4
import twink.ofp4.parse as ofp4parse
import twink.ofp4.build as b
import twink.ofp4.oxm as oxm
class TestChannel(
twink.PortMonitorChannel,
twink.ovs.OvsChannel,
twink.JackinChannel,
twink.LoggingChannel,
):
accept_versions=[4,... |
# A série de Fibonacci é formada pela seqüência 0,1,1,2,3,5,8,13,21,34,55,... Faça um programa que gere a série até que o valor seja maior que 500
ultimo = 1
penultimo = 1
termo = ultimo + penultimo
while termo < 500:
termo = ultimo + penultimo
penultimo = ultimo
ultimo = termo
print(te... |
from django.shortcuts import render
from rest_framework.generics import ListCreateAPIView,RetrieveUpdateAPIView
from .models import DoctorClinic
from .serializers import DoctorClinicSerializer
# Create your views here.
class DoctorClinicList (ListCreateAPIView):
queryset = DoctorClinic.objects.all()
serializer_cla... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import string
import webbrowser
from datetime import datetime
from flask import Flask, render_template, request, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
DEBUG = True
PORT = 5000
dir_path = os.path.dirname(os.path.realpath(__file__))
app = Fl... |
name = "Manish"
age = 30
print("This is hello world!!!")
print(name)
print(float(age))
age = "31"
print(age)
print("this", "is", "cool", "and", "awesome!")
|
#!/usr/bin/python
import os
from subprocess import call, check_output
VERSION = check_output([ "python", "version.py", "--in", "../apps/Tasks/src/version.h", "-b", "PROGRAM_VERSION_BUILD", "!SEMANTIC"]).strip()
TAG = check_output([ "python", "version.py", "--in", "../apps/Tasks/src/version.h", "!NIGHTLY"]).strip(... |
# -*- coding: utf-8 -*-
list_sample = [666, 555, -111, 999, -222]
print(sorted(list_sample))
print(sorted(list_sample, key=abs)) # ?
print(list_sample)
list_sample2 = ['bbb', 'aaa', 'ccc', 'ZZZ', 'XXX', 'YYY']
print(sorted(list_sample2))
print(sorted(list_sample2, key=str.lower)) # 忽略大小写排序
print(sorted(li... |
import numpy as np
def multi_gen(generators, shuffle=False):
"""
Generator that combines multiple other generators to return samples. Will
either return a value from each generator in succession or randomly
depending on the value of the shuffle parameter.
"""
i = -1
while 1:
... |
import pandas as pd
import os
import re
import pprint
import shutil
# Clean all the obvious typos
corrections ={'BAUGHWJV':'BAUGHMAN',
'BOHNE':'BOEHNE',
'EISEMENGER':'EISENMENGER',
'GEITHER':'GEITHNER',
'KIMBREL':'KIMEREL',
'MATTINGLY': 'MATTLIN... |
from typing import Text, Final
CLI_USAGE_TEXT: Final[Text] = """[quote]Write any thought you have without quitting from the command line[/quote]
[header]USAGE[/header]
codenotes <command> <annotation> <text> <flags>
[header]CORE COMMANDS[/header]
add Create new note or task with the content typed
search Search... |
class KeyNotFoundException(Exception):
def __init__(self, search_key, message='No information could be found for key {key}'):
# Call the base class constructor with the parameters it needs
message = message.format(key=search_key)
super(KeyNotFoundException, self).__init__(message)
#... |
"""Test views train page"""
from django.test import RequestFactory, TestCase
from django.contrib.auth.models import AnonymousUser
import sys
import os
from core.models import AI_Tiles as AITilesTable
from core.models import AI_Characteristics as AICharsTable
from core.models import AI_Objects as AIObjTable
sys.path.a... |
from gerenciador import *
def test_organizar_dados():
assert True == organizar_dados(12,0)
def test_salvar_dados_bd():
assert False == salvar_dados_bd(1,12,12,12,0,0,0)
def test_deletar_dados():
assert True == deletar_dados()
|
from django.core.management import call_command
from django.test import TestCase
class TestImportCommand(TestCase):
def test_load_commands(self):
"""
A very dumb test that just confirms that the import succeeds without
unhandled exceptions raised.
TODO: Don't be so stupid.
... |
from __future__ import annotations
from typing import Dict, Text, Any
from rasa.engine.graph import GraphComponent, ExecutionContext
from rasa.engine.storage.resource import Resource
from rasa.engine.storage.storage import ModelStorage
from rasa.shared.core.training_data.structures import StoryGraph
from rasa.shared.i... |
from setuptools import setup, find_packages
VERSION = '0.1.0'
DESCRIPTION = 'Connect to any FANTM device'
LONG_DESCRIPTION = 'Frontend for connecting to devlprd and processing data from a FANTM DEVLPR'
# Setting up
setup(
name="pydevlpr-fantm",
version=VERSION,
author="Ezra Boley",
a... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-28 08:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('titles', '0015_auto_20171226_1052'),
]
operations = [
migrations.AlterModel... |
"""
tkinter HTML text widgets
"""
import sys
import tk_html_widgets as tk_html
from ..Events import Bindings
from ..Widgets.Widgets import ScrolledText, ViewState, tkEvent
__all__ = [
'HTMLScrolledText', 'HTMLText', 'HTMLLabel'
]
class HTMLScrolledText(ScrolledText):
_bindIDs = set()
__d... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
import os
import environ
from django.conf import global_settings
from django.contrib import messages
from vaas.configuration.loader import YamlConfigLoader
env = environ.Env()
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
curr... |
import time
import warnings
from datetime import datetime
from cybox.common import Hash
from cybox.objects.address_object import Address
from cybox.objects.uri_object import URI
# suppress PyMISP warning about Python 2
warnings.filterwarnings('ignore', 'You\'re using python 2, it is strongly '
... |
# 1567. SMS-спам
# solved
text_input = input()
abc = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')
symbols = ('.', ',', '!')
result = 0
for i in range(len(text_input)):
current_letter = text_input[i:i+1]
if current_le... |
import os
import sys
from pip.req import parse_requirements
from setuptools import setup, find_packages
from ypconfig import __version__
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
from distutils.command.build_py import build_py
major, minor = sys.version_info[:... |
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import enum
import typing
import sphinx_theme_pd
project = "AtCoder"
author = "Hiroshi Tsuyuki <kagemeka1@gmail.com>"
copyright = f"2022, {author}"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.todo",
"sphinx.... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import msgprint
def get_context(context):
context.no_cache = True
# context.sub = frappe.db.sql("""select name, status as date from `tabSupplier` """,a... |
lista=[1, 2, 3, 4, 6, 5]
lista.sort(reverse=True)
print(lista)
lista=['a', 'b', 'c', 'd', 'e']
print(sorted(lista, reverse=True))
liczba=0xf
liczba2=0xa
print(liczba)
print(liczba2)
print(liczba+liczba2)
|
from utils.network.headless import HeadlessBrowser
from utils.network.socket import Socket
from utils.logging.log import Log
from utils.type.dynamic import DynamicObject
from database.session import Session
from database.engine import Engine
from database.models import Domain
from pipeline.elastic import Elastic
from... |
#!/usr/bin/env python
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2016-09-14 15:19:35 +0200 (Wed, 14 Sep 2016)
#
# https://github.com/harisekhon/devops-python-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn
# and ... |
# coding: utf-8
# In[17]:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# In[18]:
driver = webdriver.Firefox()
# In[19]:
driver.get("http://pythonforengineers.com/articles/")
# In[20]:
elem = driver.find_element_by_name("s")
# In[21]:
elem.send_keys("reddit")
# In[22]:
... |
from __future__ import print_function
from vivo2notld.definitions import definitions, list_definitions
from vivo2notld.utility import execute, execute_list
import argparse
import codecs
if __name__ == "__main__":
parser = argparse.ArgumentParser()
all_definitions = []
all_definitions.extend(definitions.k... |
class Solution:
def longestWord(self, words: List[str]) -> str:
word_set = set(words)
ans = ""
for word in word_set:
flag = True
for i in range(1, len(word)):
if word[:i] not in word_set:
flag... |
#!/usr/bin/env python
from nanpy import ArduinoApi
from time import sleep
from nanpy.sockconnection import SocketManager
# import logging
# logging.basicConfig(level=logging.DEBUG)
PIN=2
connection = SocketManager()
a = ArduinoApi(connection=connection)
a.pinMode(PIN, a.OUTPUT)
for i in range(10000):
a.digital... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-12 19:24
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pretixbase', '0014_invoice_additional_text'),
]
ope... |
import sys
try:
from xml.etree import ElementTree
except ImportError:
from elementtree import ElementTree
from .client import *
from .base_asset import BaseAsset
from .cache_decorator import memoized
from .special_class_methods import special_classes
from .none_deref import NoneDeref
from .string_utils import... |
"""
Usage:
project_update.py [ --get_registered_shell_command ]
this module exposes no other useful functions to the commandline
"""
# stdlib
import pathlib
import shutil
from typing import Dict, List, Union
# EXT
from docopt import docopt # type: ignore
# OWN
import project_conf
def format_commandline_hel... |
#!/usr/bin/env python
"""Simple draft client with websockets for Vainglory, but more or less usable for whatever draft you want..."""
import json
import logging
import os.path
import secrets
import threading
import time
from datetime import datetime
import tornado.escape
import tornado.ioloop
import tornado.options
i... |
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re
from options import Options
class New_contact(unittest.TestCase):
def setUp(self):
self.driver = webd... |
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D,MaxPooling2D,UpSampling2D,BatchNormalization,Reshape,Permute,Activation
from tensorflow.keras.optimizers import Adam
from cfg import *
img_w = 256
img_h = 256
lr_init = 0.01
lr_decay = 0.00001
def Se... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('profile/<int:user_id>/', views.profile, name='profile'),
path('profile/devices/', views.devices, name='devices'),
path('profile/new_device/', views.new_device, name='new_device'),
path('pro... |
# Copyright 2019 The FastEstimator 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 appl... |
from __future__ import print_function
from astropy.convolution import Gaussian2DKernel, convolve, convolve_fft
from astropy.io import fits
import numpy as np
#FWHM/2 = Radio equivalente = (a*b)**0.5 -> radio que corresponde a la misma area
# de una elipse con semieje mayor a y semieje menor b.
#FWHM->Desviacion estan... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from onmt.modules.relative_attention import RelPartialLearnableMultiHeadAttn
from onmt.models.transformer_layers import PositionalEncoding, PrePostProcessing
from onmt.models.transformer_layers import EncoderLayer, DecoderLayer
from onmt.models.transfor... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.