src stringlengths 721 1.04M |
|---|
"""Offer reusable conditions."""
import asyncio
from datetime import datetime, timedelta
import functools as ft
import logging
import sys
from typing import Callable, Container, Optional, Union, cast
from homeassistant.components import zone as zone_cmp
from homeassistant.components.device_automation import (
asyn... |
#!/usr/bin/env python3
# Copyright 2019 Google LLC
#
# 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... |
#!/usr/bin/env python
"""
A very simple server in python
used to control gpio pins on the beaglebone black.
The server listens for POST requests on port
6410. It has no security at all, which means
that it accepts post-data from everyone.
Send a GET request::
curl http://localhost
Send a POST request::
curl -... |
from collections import defaultdict
from ray.autoscaler._private.cli_logger import cli_logger
import colorful as cf
class LazyDefaultDict(defaultdict):
"""
LazyDefaultDict(default_factory[, ...]) --> dict with default factory
The default factory is call with the key argument to produce
a new value w... |
r'''
Fold control using dihedral angle with quadrilateral facets
-----------------------------------------------------------
This example shows the folding process controlled by a dihedral
angle between two facets. In addition to the previous
example, this one introduces quadrilateral facets that
are symmetrically c... |
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import time
import rospy
import tf
import wiringpi2
from geometry_msgs.msg import PoseStamped
from geometry_msgs.msg import PoseWithCovarianceStamped
from actionlib_msgs.msg import GoalID
from actionlib_msgs.msg import GoalStatusArray
from geometry_msgs.msg im... |
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... |
"""SteadyPg - hardened classic PyGreSQL connections.
Implements steady connections to a PostgreSQL database
using the classic (not DB-API 2 compliant) PyGreSQL API.
The connections are transparently reopened when they are
closed or the database connection has been lost or when
they are used more often than an optiona... |
import sys, os, time
commandList = ["help", "shutdown", "ls", "dir", "mkdir", "cd", "time"]
def bootLoader():
print("Welcome to SquirrelOS!")
print("Made By Dem_Squirrel and FreakzDK \n")
print("Type help to see the commands")
commandLine()
def commandLine():
cmd = input("> ")
if cmd == comman... |
from ..cg.shapes import Polygon
import itertools as it
from sys import version_info
import collections
QUEEN = 1
ROOK = 2
if version_info[0] == 2:
zip = it.izip
range = xrange
__author__ = "Jay Laura jlaura@asu.edu"
def _get_verts(pgon):
if isinstance(pgon, Polygon):
return pgon.vertices
else:... |
# -*- coding: utf-8 -*-
###############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2009-TODAY Tech-Receptives(<http://www.techreceptives.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the... |
# Carneades Argument Evaluation Structure
#
# Copyright (C) 2014 Ewan Klein
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
# Based on: https://hackage.haskell.org/package/CarneadesDSL
#
# For license information, see LICENSE
"""
==========
Overview
==========
Propositions
============
First, let's create some proposition... |
from django.contrib import admin
from models import mdl_codigos
from apps.elementos_comunes.models import mdl_lenguaje,mdl_sistema_operativo
from actions import export_as_csv
## crea el listado de opciones en el administrado !!!
class codigosAdmin(admin.ModelAdmin):
list_display = ('titulo','lenguaje','archivo','i... |
from roxyfileman.utils import Upload, json_response, safepath, ok, err
from django.views.decorators.csrf import csrf_exempt
from roxyfileman.settings import default_settings
from django.http import HttpResponse, FileResponse
from django.shortcuts import render
from django.conf import settings
from PIL import Image
impo... |
#!/bin/python
import praw
import re
import os
import sqlite3
import time
from config_bot import *
import datetime
header = "Type|Artist(s)/Event|Venue|Price|Time\n---|---|---|---|---|---|---|\n"
footer1 = "------------------------\n[Link to next week's draft post]("
footer2 = "). If you know of something awesome hap... |
# to be imported to access modbus registers as analogue io
# 03.04.2014 neeme
# 04.04.2014 it works, without periodical executuoin and without acces by svc reg
# 06.04.2014 seguential register read for optimized reading, done
# 14.04.2014 mb[mbi] (multiple modbus connections) support. NOT READY!
# 16.04.2014 fixed mt... |
# coding: utf-8
from urllib2 import urlopen
import urllib2
import bs4 as BeautifulSoup
class ZTPage:
def __init__(self, url):
self.url = url
self.update()
def update(self):
self.update_content()
self.parse_type()
self.parse_infos()
self.parse_links()
def ... |
"""Stuff to make working with the NearlyFreeSpeech.NET API easier.
>>> import nfsnapi
>>> # Replace USERNAME, API_KEY, and so on with actual values.
>>> nfsnapi.run_request("USERNAME", "API_KEY",
... "/account/ACCOUNT_NUMBER/balance")
'10.56'
>>> nfsnapi.run_request("USERNAME", "API_KEY",
... "/dns/DOMAI... |
from Crypto.Cipher import AES
import base64
import random
k="../distrib/"
def randomword(length):
return ''.join(random.choice("QWERTYUIOPASDFGHJKLZXCVBNM1234567890__________") for i in range(length))
def randomword1():
return ''.join(random.choice("QWERTYUIOPLKJHGFDSAZXCVBNM") for i in range(4))
def filename(... |
"""Test both structuring and unstructuring."""
from typing import Optional, Union
import attr
import pytest
from attr import fields, make_class
from hypothesis import HealthCheck, assume, given, settings
from hypothesis.strategies import sampled_from
from cattr import Converter, UnstructureStrategy
from . import nes... |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... |
# 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 may ... |
import curses
import functools
import json
import os
import random
import re
import selectors
import signal
import socket
import subprocess
import sys
import termios
import time
from contextlib import contextmanager
__version__ = 'cplay-ng 4.0.0'
AUDIO_EXTENSIONS = [
'mp3', 'ogg', 'oga', 'opus', 'flac', 'm4a', 'm... |
#!/usr/bin/python
from ctypes import *
import sys
import timeit
sys.path.append('..')
import rabinpoly as lib
fn = sys.argv[1]
libc = CDLL("libc.so.6")
fopen = libc.fopen
fread = libc.fread
feof = libc.feof
fread.argtypes = [c_void_p, c_size_t, c_size_t, c_void_p]
window_size = 32
min_block_size = 2**14
avg_block... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
import mock
from dashboard.pinpoint.models.quest import run_test
_SWARMING_TASK_EXTRA_ARGS = [
'test_suite', '--story-filter', 'test'... |
# 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 program is distributed in the hope that it will be useful,
# bu... |
## Create a methylation interaction
from phievo import __silent__,__verbose__
if __verbose__:
print("Execute Methyl (Interaction Template)")
from phievo.Networks import mutation
from phievo.Networks import deriv2
from phievo.Networks import classes_eds2
import copy
## Define the function that assigns new paramet... |
from docutils import utils
from docutils.writers import html4css1
from warmice import config
class HTMLWriter(html4css1.Writer):
def __init__(self):
html4css1.Writer.__init__(self)
self.translator_class = HTMLTranslator
def translate(self):
html4css1.Writer.translate(self)
se... |
import decimal
from io import StringIO
from collections import OrderedDict
from test.test_json import PyTest, CTest
class TestDecode:
def test_decimal(self):
rval = self.loads('1.1', parse_float=decimal.Decimal)
self.assertTrue(isinstance(rval, decimal.Decimal))
self.assertEqual(rval, deci... |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
# -*- coding:utf-8 -*- #
#! /usr/bin/env python
import time
#sys.path.insert(0, 'tweibo.zip')
from tweibo import *
# 换成你的 APPKEY
APP_KEY = "100628862"
APP_SECRET = "021e18ea097817f15a819a45c0e5c592"
CALLBACK_URL = "http://127.0.0.1:8000"
# 请先按照 https://github.com/upbit/tweibo-pysdk/wiki/OAuth2Handler 的鉴权说明填写 ACCESS_... |
# -*- coding: UTF-8 -*-
import sys
import logging
import unicodedata
from collections import defaultdict
import HTMLParser
logger = logging.getLogger(__name__)
C_PUNCTUATION = frozenset(("Pc", "Pd", "Ps", "Pe", "Po", "Lm"))
C_QUOTE = frozenset(("Pi", "Pf"))
C_MARK = frozenset(("Mn", "Mc", "Me"))
C_SYMBOL = frozens... |
#!/usr/bin/env python3
"""
> parse_gff3.py <
Python script intends to be a helper function that can be called by other
scripts to handle gff annotations.
Script requires a _file object_ (not filename).
The output is in the form of:
dict[seqid] = {five_prime_UTR: {ID001: (start_coord1, end_coord1), ...}
... |
from tkinter import *
from src.element.Card import Card
from src.element.ResourceType import ResourceType
from src.game.GameState import GameState
from src.mvc.EventType import EventType
from src.mvc.GameBoard import GameBoard
from src.mvc.GameRules import GameRules
from src.player.AI import AI
import time
class Displ... |
# -*- coding: utf-8 -*-
# This is a part of gayeogi @ http://github.com/KenjiTakahashi/gayeogi/
# Karol "Kenji Takahashi" Wozniak © 2010 - 2012
#
# 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, ... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
#!/usr/bin/env python3
import argparse
import logging
import os
import sys
import numpy as np
import tensorflow as tf
from config import load_config_from_json_file
import model_loader
import rnn_model
def construct_parameter_map(config):
def drt_tag(i):
return "" if i == 0 else "_drt_{0}".format(i)
... |
class Solution(object):
def findRepeatedDnaSequences(self, s):
"""
:type s: str
:rtype: List[str]
"""
more_than_once, once = set(), set()
for i in range(len(s) - 9):
t = s[i:i+10]
if t not in more_than_once:
if t in once:
... |
# Copyright (c) 2014, Stanford University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the ... |
# coding: utf-8
import os
import random
import json
import datetime
import time
import logging
from hashlib import sha256, sha1
from sqlalchemy import Column, Integer, String, \
Sequence, DateTime, Table, ForeignKey, Boolean, Text
from sqlalchemy.orm import relationship, backref
import yweb.utils.ydatetime
from ... |
#python XPCS_XSVS_SAXS_Multi_2017_V4.py
from chxanalys.chx_packages import *
from chxanalys.chx_xpcs_xsvs_jupyter import run_xpcs_xsvs_single
def XPCS_XSVS_SAXS_Multi( start_time, stop_time, run_pargs, suf_ids = None,
uid_average= 'Au50_7p5PEGX1_vs_slow_120116',
... |
"""
Basic nfs support for Linux host. It can support the remote
nfs mount and the local nfs set up and mount.
"""
import re
import aexpect
import logging
from avocado.utils import path
from avocado.utils import process
from avocado.utils import distro
from avocado.utils.astring import to_text
from avocado.core import ... |
"""
Copyright 2014 Google Inc. 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 law or agreed to in... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... |
# Copyright 2016 Google Inc. 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 law or a... |
from django.core.management.base import BaseCommand, CommandError
from clips_app.models import Case
import django
import csv
def parse_num(value):
if value.isdigit():
return int(value)
else:
return None;
def parse_date(value):
pieces = value.split("/")
try:
return (pieces[2]+... |
import logging
import multiprocessing
import re
import os
import tempfile
import yaml
import sys
from collections import OrderedDict
import click
import urllib
# Adapted from: https://github.com/pnnl/atlas/blob/master/atlas/conf.py
logging.basicConfig(level=logging.INFO, datefmt="%Y-%m-%d %H:%M", format="[%(asctime)s... |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ..view.Ui_DamageForm import *
from ..model.DatabaseHelper import *
from ..model.core_classes import CoDamage
from ..utils.PluginUtils import *
from ..utils.LayerUtils import *
from DamageDialog import *
class DamageForm(QWidget, Ui_DamageForm, DatabaseHelper):... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... |
import re
gentoo_unstable = ("alpha", "beta", "pre", "rc")
gentoo_types = ("alpha", "beta", "pre", "rc", "p")
def is_version_type_stable(version_type):
return version_type not in gentoo_unstable
def is_version_stable(version):
return is_version_type_stable(get_version_type(version))
def get_version_type(... |
"""
Copyright 2020 Google LLC
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
import discord
from discord.ext import commands
from random import randint
import aiohttp
import random
class Image:
"""Image related commands."""
def __init__(self, bot):
self.bot = bot
#Reserved for further ... stuff
"""Commands section"""
@commands.command(no_pm=True)
async de... |
#!/usr/bin/env python
import time
import argparse
import json
from uvscada.nuc import pulser
from uvscada.nuc import alsa_util
def cap(jf):
def jput(j):
jf.write(json.dumps(j, sort_keys=True) + '\n')
print 'Configuring ALSA'
asrc = alsa_util.ALSASrc()
print 'looping'
# 400 w/o, 7300... |
"""
Interface to Constrained Optimization By Linear Approximation
Functions
---------
.. autosummary::
:toctree: generated/
fmin_cobyla
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.lib.six import callable
from scipy.optimize import _cobyla
from .optimize... |
#
# Copyright 2010 Nick Foster
#
# This file is part of gr-air-modes
#
# gr-air-modes 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 3, or (at your option)
# any later version.
#
# gr-air-mo... |
from threading import Lock
import cv2
import numpy as np
'''Max Values supported by OpenCV'''
RGBMAX = [255,255,255]
RGBMIN = [0,0,0]
class RgbFilter:
def __init__(self):
self.lock = Lock()
self.MAX = RGBMAX
self.MIN = RGBMIN
self.uLimit = self.MAX
self.dLimit = self... |
# (c) 2007 The Board of Trustees of the University of Illinois.
import sys
import os
from os import path
import re
from itertools import imap, repeat, chain
import globals
import process
import parboilfile as pbf
from futures import Future
from error import ErrorType
class Benchmark(object):
"""A benchmark.
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
The obfs3 module implements the obfs3 protocol.
"""
from dust.extensions.lite.lite_socket2 import makeSession, \
makeEphemeralSession, createEphemeralKeypair
from dust.core.dust_packet import IV_SIZE, KEY_SIZE
from obfsproxy.crypto.aes import AESCoder
from obfsproxy.... |
# Parsec Cloud (https://parsec.cloud) Copyright (c) AGPLv3 2016-2021 Scille SAS
# Monitor POC, shamelessly taken from curio
import os
import signal
import socket
import traceback
import threading
import telnetlib
import argparse
import logging
import trio
from trio.abc import Instrument
from trio.lowlevel import cur... |
__version__ = '0.4.1'
__author__ = 'Jimmy Liu'
"""
for trading data
"""
from tushare.stock.trading import (get_hist_data, get_tick_data,
get_today_all, get_realtime_quotes,
get_h_data, get_today_ticks,
get... |
class Solution(object):
def minWindow(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
begin, end = 0, 0
min_begin, min_end = 0, 0
min_size = float('inf')
need_find = {}
found = {}
for c in t:
need_find[c] ... |
import sys
import string
import unittest
class Dimacs(object):
def __init__(self, clauses):
self.clauses = clauses
self.num_clauses = len(self.clauses)
self.num_vars = max([0] + [max([0] + [abs(l) for l in c]) for c in self.clauses])
class DimacsParser(object):
def __init__(self, filename=None, fi... |
import pytest
import psycopg2
import dbtool
@pytest.fixture(scope='session')
def django_db_setup(django_db_setup, django_db_blocker):
from django.conf import settings
wow = settings.DATABASES['wow']
with django_db_blocker.unblock():
db = dbtool.DbContext(
host=wow['HOST'],
... |
# Copyright 2018 Microsoft 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Compares pre-calculated theorerical scattering curves to
experimental x-ray and neutron scattering curves.
"""
# Copyright 2014 University College London
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... |
# Copyright 2016 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 applica... |
# Copyright (c) 2008, Humanized, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditio... |
from compat import python_2_unicode_compatible
import sys
from django.db import models
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.files.uploadedfile import InMemoryUploadedFile
from PIL import Image
from compat import BytesIO
config = {
'sh... |
import pytest
from pytest_cagoule.select import get_line_number_filter, get_spec_filter, get_query
@pytest.mark.parametrize(
("start", "end", "expected_query", "expected_params"),
(
(None, None, "", ()),
(None, "foo", "", ()), # if start is None, end is ignored
(3, None, "AND numbits_... |
from __future__ import division, absolute_import, print_function
__all__ = ['logspace', 'linspace']
from . import numeric as _nx
from .numeric import array, result_type
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None):
"""
Return evenly spaced numbers over a specified interval.
... |
#!/usr/bin/env python3
"""Python solution for CtCI 6th Edition Problem 1.8
Write an algorithm such that if an element in an MxN matrix is 0, its entire
row and column are set to O.
No element is 0
>>> zero_matrix([['q', 'w', 'e'], ['a', 's', 'd'], ['z', 'x', 'c']])
[['q', 'w', 'e'], ['a', 's', 'd'], ['z', 'x', 'c']]
... |
# -*- coding: utf-8 -*-
"""Tools for working with epoched data"""
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de>
# Denis Engemann <denis.engemann@gmail.com>
# ... |
###############################################################################
# parser.py: Module for PATTERN MATCH, mataclass wrapping any parser based
# on nfa_parser base class.
# Copyright (C) 2011 Brno University of Technology, ANT @ FIT
# Author(s): Vlastimil Kosar <ikosar@fit.vutbr.cz>
#########... |
import keyword
import re
def py_types_encode_decode(t):
if t not in _py_types:
raise NotImplementedError("Missing type Mapping")
_pattern1 = re.compile("(.)([A-Z][a-z]+)")
_pattern2 = re.compile("([a-z0-9])([A-Z])")
def py_param_name(type_name):
type_name = _pattern1.sub(r"\1_\2", type_name)
t... |
"""
Django settings for pagila project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... |
from unittest import TestCase
import filters as f
from filters.test import BaseFilterTestCase
from iota import Iota, AsyncIota
from iota.adapter import MockAdapter, async_return
from iota.commands.core import GetNodeAPIConfigurationCommand
from test import patch, MagicMock, async_test
class GetNodeAPIConfigurationR... |
# Copyright (c) 2012-2016, Marco Elver <me AT marcoelver.com>
#
# 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 applica... |
###############################################################################
##
## dml.py
##
## Python library providing common functionalities for building Data
## Mechanics platform components.
##
## Web: datamechanics.org
## Version: 0.0.16.0
##
##
import sys # To parse command line arguments.
i... |
#!/usr/bin/env python
# This file is part of ObjectPath released under MIT license.
# Copyright (C) 2010-2014 Adrian Kalbarczyk
# Code from http://effbot.org/zone/simple-top-down-parsing.htm was used in this file.
# Licence of the code is public domain.
# Relicenced to AGPL v3 by Adrian Kalbarczyk and:
# - specialize... |
#-------------------------------------------------------------------------------
# Name: American Chopper CSI Image (Tested with XBOX Only)
# Purpose: Import Texture
#
# Author: Eric Van Hoven
#
# Created: 07/07/2018
# Copyright: (c) Eric Van Hoven 2018
# Licence: <MIT License>
#-----... |
import ee
# Based on scripts by Ian Hausman, which in turn is based on script by Matt Hancher
# https://groups.google.com/d/msg/google-earth-engine-developers/i63DS-Dg8Sg/_hgCBEYeBwAJ
def cloud_score(image):
def rescale(image, exp, thresholds):
return image.expression(exp, {'i': image}) \
.sub... |
AR = '/usr/bin/ar'
ARFLAGS = 'rcs'
CCFLAGS = ['-g', '-O3']
CCFLAGS_MACBUNDLE = ['-fPIC']
CCFLAGS_NODE = ['-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64']
CC_VERSION = ('4', '2', '2')
COMPILER_CXX = 'g++'
CPP = '/usr/bin/cpp'
CPPFLAGS_NODE = ['-D_GNU_SOURCE']
CPPPATH_NODE = '/usr/local/include/node'
CPPPATH_ST = '-I%s'
... |
import os
from subprocess import call
# UIs
rootDir = '..'
targetDir = r'app/src/assetjet/view'
outDir = os.path.join(rootDir, targetDir)
fileList = []
for root, subFolders, files in os.walk(rootDir):
for file_ in files:
if file_.endswith(".ui"):
outFile = os.path.join(outDir, file_.replace(... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Red Hat, Inc.
# This file is part of python-fedora
#
# python-fedora is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, ... |
import re
from datetime import datetime
from typing import Any, List, Union, Optional
import attr
import numpy as np
import pandas as pd
null_regexes = [
re.compile(r'^\s*$'),
re.compile(r'^null$', re.RegexFlag.IGNORECASE)
]
date_formats = [
# Standard statcast format
(re.compile(r'^\d{4}-\d{1,2}-\d{... |
import os
import sys
import hashlib
# os.makedirs(dir) to make a dir
# hashfile source
# http://www.pythoncentral.io/finding-duplicate-files-with-python/
def hashfile(path, blocksize = 65536):
infile = open(path, 'rb')
hasher = hashlib.md5()
buf = infile.read(blocksize)
while len(buf) > 0:
has... |
import logging
from unuk.core import exceptions
logger = logging.getLogger('eventweb')
class WSGIResource(object):
def __init__(self, server):
self.server = server
self.handler = server.handler
def __call__(self, environ, start_response):
handler = self.handler.get_ha... |
from uuid import uuid4
import web
def AuthorizationProcessor(session, user_field="user_id", require_login=None):
"""
Authorization processor useful for authorizing URL paths.
Example:
session = web.session.Session(app, session_store,
initializer={"user_id":... |
#
# Copyright (C) 2000 Stephen Davies
# Copyright (C) 2000 Stefan Seefeld
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
from Synopsis.Processor import Parameter
from Synopsis import ASG
from Synopsis.Formatters.HTML.Part import Part
from S... |
import Tkinter
import tkFileDialog
import tkMessageBox
from Tkinter import *
import os
import sys
from math import factorial
class Unbuffered(object):
"""Attempts to create an unbuffered STDOUT"""
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.fl... |
"""
A widget for pid modules.
"""
from .base_module_widget import ModuleWidget
from qtpy import QtCore, QtWidgets
class PidWidget(ModuleWidget):
"""
Widget for a single PID.
"""
def init_gui(self):
self.init_main_layout(orientation="vertical")
#self.main_layout = QtWidgets.QVBoxLayou... |
# -*- coding: utf-8 -*-
import numpy as np
import cv2
# im = cv2.imread('test.jpg')#
# im = cv2.imread('poker5hearts.jpg')#
# im = cv2.imread('../data/black-white-rect.png')#contour.jpg #
im = cv2.imread('../data/chessboard.jpeg')
imgray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
cv2.imshow("imgray", imgray)
#需要注意的是cv2... |
#!/usr/bin/env python
#
# Copyright (C) 2015 Martin Owens
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This pro... |
# python 2
from __future__ import absolute_import, print_function, unicode_literals
from builtins import bytes, str
# builtins
import logging
import cssutils
from os import path
# custom
from blowdrycss import log
from blowdrycss.filehandler import FileFinder, CSSFile, GenericFile
from blowdrycss.classparser import Cla... |
from .base import BaseTestCase
from common.models import Product
class ProductTestCase(BaseTestCase):
def setUp(self):
"""
create a test product test cases
"""
super(ProductTestCase, self).setUp()
# creating dummy product
self.product = Product()
self.produ... |
# 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 ... |
#!/usr/bin/env Python
"""
Definition List Extension for Python-Markdown
=============================================
Added parsing of Definition Lists to Python-Markdown.
A simple example:
Apple
: Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.
: An american computer com... |
def kelimeEkleme() :
dosya = open("sozluk.dat","a")
m = raw_input("Turkce kelimeyi giriniz: ")
h = raw_input("Ingilizce karsiligini girin: ")
satir = m + "\t"+ ":" + "\t" + h + "\n"
dosya.write(satir)
dosya.close()
def ingGuncelle() :
dosya = open("sozluk.dat","r")
istek = raw_input("Guncelleme yapacagin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.