src stringlengths 721 1.04M |
|---|
# -*- coding:utf-8 -*-
# 118. Pascal's Triangle QuestionEditorial Solution My Submissions
# Difficulty: Easy
# Contributors: Admin
# Given numRows, generate the first numRows of Pascal's triangle.
#
# For example, given numRows = 5,
# Return
#
# [
# [1],
# [1,1],
# [1,2,1],
# [1,3,3,1],
# [1,4,6,4,1]... |
# coding:utf-8
import numpy as np
from utils.bbox.nms import nms
from .text_connect_cfg import Config as TextLineCfg
from .text_proposal_connector import TextProposalConnector
from .text_proposal_connector_oriented import TextProposalConnector as TextProposalConnectorOriented
class TextDetector:
def __init__(sel... |
import os
import random
import string
from configparser import ConfigParser
from hashlib import sha256
import cherrypy
from cherrypy import Tool
from cherrypy._cpcompat import ntob
from cherrypy._cpreqbody import Part
from cherrypy.lib import httputil
defaults = """
[pipa]
host = localhost
port = 5351
key = server.k... |
import socket
import re
import sys
import random
from unittest2 import TestCase, TestSuite, main, TestLoader, skipIf
from bein import *
from bein.util import touch
M = MiniLIMS("testing_lims")
def hostname_contains(pattern):
hostname = socket.gethostbyaddr(socket.gethostname())[0]
if re.search(pattern, host... |
#! /usr/bin/python3
import SnnBase
import Stdp
import DopamineStdp
import random
class TogglePulsar:
def __init__(self, magnitude, frequency):
self.magnitude = magnitude
self.frequency = frequency # not used after construction at present
self.delay = 1.0 / frequency
self.remainin... |
import logging
from . import FileChecker
l = logging.getLogger(__name__)
class CheckPackageMetadata(FileChecker):
def check(self):
if self.sub_path("package-metadata.json").is_file():
self.fail("'package-metadata.json' is supposed to be automatically generated "
"by Pa... |
"""Support for Sensibo wifi-enabled home thermostats."""
import asyncio
import logging
import aiohttp
import async_timeout
import voluptuous as vol
import pysensibo
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate.const import (
HVAC_MODE_HEAT_COOL... |
from random import randint
def random_movie():
return movies_list[randint(0, movies_list_length - 1)]
def random_series():
return seasons_list[randint(0, seasons_list_length - 1)]
def random_user():
user_data = user_list[randint(0, user_list_length - 1)]
return {'email': user_data[0], 'name': user_da... |
#Copyright 2008 Govind Salinas <blix@sophiasuchtig.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 program is d... |
"""The tests for hls streams."""
from __future__ import annotations
import asyncio
from collections import deque
from datetime import timedelta
from io import BytesIO
import logging
import os
import threading
from unittest.mock import patch
import async_timeout
import av
import pytest
from homeassistant.components.s... |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -*- coding: utf-8 -*-
"""Logging.
This module implements application global logging as a singleton, using the
standard library module :py:mod:`logging`.
"""
__author__ = 'Patrick Michl'
__email__ = 'frootlab@gmail.com'
__license__ = 'GPLv3'
__docformat__ = 'google'
import contextlib
import importlib
import logging... |
# xVector Engine Server
# Copyright (c) 2011 James Buchwald
# 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 pr... |
# Generated by Django 2.1.2 on 2018-10-26 17:19
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('core', '0013_user_terms_accepted'),
]
operations = [
migrations.AddField(
model_name='organization'... |
#!/usr/bin/env python
import csv
import os
import sys
csv.field_size_limit(sys.maxsize) # make sure we can write very large csv fields
import argparse
import operator
import colored_traceback.always
import collections
# if you move this script, you'll need to change this method of getting the imports
partis_dir = os.... |
'''tests for data_analyser.py'''
from datetime import date
import unittest
from lib.data_analyzer import MonthData
from lib.data_analyzer import DataContainer
from lib.entries import Entries, Entry
class TestDataAnalyzer(unittest.TestCase):
def test_month_data__simple(self):
month_data = MonthData('na... |
# -*- coding: UTF-8 -*-
# COPYRIGHT (c) 2016 Cristóbal Ganter
#
# GNU AFFERO GENERAL PUBLIC LICENSE
# Version 3, 19 November 2007
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, eit... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
#!/usr/bin/env python
# encoding: utf-8
"""
fuzz.py
Copyright (c) 2011 Adam Cohen
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 u... |
# -*- coding: utf-8 -*-
# (c) 2020 Andreas Motl <andreas@getkotori.org>
from test.util import InfluxWrapper, GrafanaWrapper
PROCESS_DELAY_MQTT = 0.2
class BasicSettings:
# InfluxDB settings.
influx_database = 'basic_node42'
influx_measurement_sensors = 'sensors'
influx_measurement_events = 'events'... |
# coding=utf-8
import json
import logging
import logging.config
import os
import random
import re
import time
import tweepy
from tweepy.streaming import StreamListener
from .. import find_corrections, format_reply
from ..state import State
from ..util import reverse_inits, OrderedSet
from .util import user_url, statu... |
import numpy as np
from collections import Counter
from numpy import array, zeros, argmin, inf
from numpy.linalg import norm
import sys,argparse
DATA_PATH='/others/abilng/Database/MSR2-abil/test/data_out/'
GroundTruthFile="/others/abilng/Database/MSR2-abil/Videos/groundtruth.txt";
PrintProgress=True
def dtw(x, y, di... |
"""
Django settings for mysite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... |
"""
Python2 implementation of NORX.
------
:author: Philipp Jovanovic <philipp@jovanovic.io>, 2014-2015.
:license: CC0, see LICENSE for more details.
"""
from struct import pack, unpack
class NORX(object):
def __init__(self, w=64, r=4, d=1, t=256):
assert w in [32, 64]
assert r >= 1... |
#!/usr/bin/env python
"""
Find details about a directory or plain file in a ZFS dataset using zdb utility
"""
import sys, os, traceback
import re
from optparse import OptionParser
# ======================================================================
class Error(Exception):
"""Base class for exceptions in this... |
from .base_test import *
import time
@on_platforms(browsers)
class SeTest(BaseTest):
def assertTextByTag(self, tag, text):
max_attempts = 60
while (max_attempts > 0):
try:
name = self.driver.find_element_by_tag_name(tag)
assert text in name.text
... |
from app.API_Rest.GeneradorPlanCarreras.Constantes import *
MENOR_IGUAL = 0
MAYOR_IGUAL = 1
def obtener_variables_candidatas(parametros):
variables_candidatas = {}
with open(parametros.nombre_archivo_pulp, 'r') as arch:
for linea in arch:
linea = linea.rstrip('\n')
ecuacion = l... |
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Sun OS Solaris platform implementation."""
import errno
import os
import socket
import subprocess
import sys
from collections import namedtuple
from .... |
""" Promus core
This package contains the object that executes commands on your
behave as well as other utility functions.
"""
import re
import os
import sys
import socket
from promus.command import exec_cmd, date
from promus.core.ssh import (
make_key,
get_keys,
get_public_key,
read_config,
writ... |
"""ShutIt module. See http://shutit.tk
"""
#http://www.linuxfromscratch.org/blfs/view/svn/postlfs/mitkrb.html configs and context and configureation
from shutit_module import ShutItModule
class postgresql(ShutItModule):
def build(self, shutit):
shutit.send('mkdir -p /tmp/build/postgresql')
shutit.send('cd /tmp... |
""" The data is available from Geonet, the official source of New
Zealand earthquake hazard data:
http://wfs.geonet.org.nz/geonet/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=geonet:quake_search_v1&outputFormat=csv
Geonet Data policy
==================
All data and images are made available free of char... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-03-22 07:57
from __future__ import unicode_literals
from django.db import migrations, models
FLOWCELL_STATUS_INITIAL = 'initial'
FLOWCELL_STATUS_SEQ_RUNNING = 'seq_running'
FLOWCELL_STATUS_SEQ_COMPLETE = 'seq_complete'
FLOWCELL_STATUS_SEQ_RELEASED = 'seq_r... |
from datetime import datetime
from datetime import timedelta
import csv,glob
import numpy
from matplotlib import pyplot as plt
# Setup param
CSV_DIR = "C:\Users\mayku\Documents\LAB_res_lar\L_0.5_dis"
CSV_OUTPUT = "table_summarize.csv"
CSV_CONCLUS = "conclus_all.csv"
CSV_FILE_SIZE = "file_size_analyze.csv"
start_seq = ... |
# :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import pickle
import base64
try:
from shlex import quote
except ImportError:
from pipes import quote
from .base import Processor
from .. import pickle_support
class QubeProcessor(Processor):
'''Foregr... |
""" Utilities for view configuration """
import fnmatch
import re
import functools
import inspect
import six
from pyramid.httpexceptions import HTTPFound
from .params import is_request
def match(pattern, path, flags):
"""
Check if a pattern matches a path
Parameters
----------
pattern : str
... |
# -*- coding: utf-8 -*-
"""
Unstructured rfc2047 header to unicode.
A stupid (and not accurate) answer to https://bugs.python.org/issue1079.
"""
from __future__ import unicode_literals
import re
from email.header import decode_header, make_header
from email.utils import parseaddr
from django.utils.encoding import... |
''' Copyright (c) 2013 Potential Ventures Ltd
Copyright (c) 2013 SolarFlare Communications 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 c... |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... |
#!/usr/bin/env python
import subprocess
import argparse
import utils
import numpy
import os
import rospkg
import rospy
import tf2_ros
import math
import time
import xml.etree.ElementTree as ET
def main():
# Parse arguments # TODO: Too much arguments? Rethink this script
parser = argparse.ArgumentParser(desc... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Block using iptables through Flask
import subprocess # Run iptables
from IPy import IP # Valide IP
import re # Make sure to validate
from flask import Flask # Run Flask
from flask import request # For url arguments
app = Flask(__name__)
# wget "127.0.0.1:9000/block?ip=8.8.... |
from __future__ import absolute_import
from __future__ import print_function
import sys
import glob
from copy import copy, deepcopy
import numpy as np
# import matplotlib.pyplot as plt
import pandas as pd
pd.set_option('display.width', 1000)
pd.set_option('display.max_rows', 1000)
from signals import *
def find_... |
# PyDia DOT Import
# Copyright (c) 2009 Hans Breuer <hans@breuer.org>
# 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 v... |
import sys
if __name__ == '__main__':
import pathadjuster
from polybori.PyPolyBoRi import Ring, VariableBlock, Polynomial
from polybori.PyPolyBoRi import VariableFactory, MonomialFactory
from itertools import chain, islice
#class BlockEndException(object):
#pass
#def __init__(self, arg):
# self.arg = arg
#... |
import datetime
import logging
import os
import time
import re
import webbrowser
from dateutil import parser
from selenium import webdriver
from selenium.common.exceptions import WebDriverException, NoSuchElementException
from selenium.webdriver.support.select import Select
from helpers import roundTime, difference_... |
__author__ = 'Robert Cope'
from unittest import TestCase
from PyHT6022.LibUsbScope import Oscilloscope
from PyHT6022.HantekFirmware import stock_firmware, mod_firmware_01
# TODO: Add more unit tests, add unit tests for changing number of active channels.
class BasicTests(TestCase):
def test_find_device(self):... |
# -*- coding: utf-8 -*-
# MIT license
#
# Copyright (C) 2018 by XESS Corp.
#
# 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... |
"""
This script extracts terrain elevation from NASA - SRTM
https://www2.jpl.nasa.gov/srtm/
"""
import os
import gdal
import numpy as np
import pandas as pd
import requests
from geopandas import GeoDataFrame as Gdf
from osgeo import ogr
from osgeo import osr
from shapely.geometry import Polygon
import cea.config
... |
class KataTennis(object):
def __init__(self, player1Name, player2Name):
self.firstPlayer = Player(player1Name)
self.secondPlayer = Player(player2Name)
def isGameFinished(self):
return self.pointsOnWinningRange() and abs(self.firstPlayer.getPoints() - self.secondPlayer.getPoints... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sklearn.cross_validation import train_test_split
from sklearn import linear_model
from sklearn import mixture
from sklearn import metrics
import logging
import sys, traceback, os
import uuid
import psutil
import getpass
import usefulLibraryFiles # Libreria pr... |
from django.contrib import admin
from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import login_required
from django.views.generic import RedirectView
from linda_app.forms import AutocompleteModelSearchForm
from haystack.views import SearchView, search_view_factory
from linda_app.... |
#!/usr/bin/python
# Extract drugs and experimental compounds.
# Songpeng Zu
# 2014-12-30
import os
import xml.sax
class DrugBankHandler(xml.sax.ContentHandler):
def __int__(self):
self.CurrentData = ""
self.DrugBankID = ""
self.smallmolecule = ""
self.drugbank = ""
self.pa... |
"""
Django settings for tripping_sansa_harness 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(BA... |
# Copyright 2012-2016 The Meson development team
# 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 agree... |
# -*- coding: utf-8 -*-
__author__ = 'Maxim.Rumyantsev'
#from selenium.webdriver.firefox.webdriver import WebDriver
from selenium import webdriver
from fixture.session_f import SessionHelper
from fixture.group_f import GroupHelper
from fixture.contact_f import ContactHelper
class Application:
# проверка в... |
"""
Live trainer script for Udacity SDC sim
- Control car with Keras model
- Override with manual control
- Train model during manual control
- Record data from simulator
Usage guide
- accelerate/decelerate with "up/down" arrow keys
- navigation with "left/right" arrow keys
- change steering angle to "0" with "c" key
... |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2018, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... |
#!/usr/bin/python
#======================================================================
#
# Project : hpp_IOStressTest
# File : IOST_WMain_USB.py
# Date : Oct 20, 2016
# Author : HuuHoang Nguyen
# Contact : hhnguyen@apm.com
# : hoangnh.hpp@gmail.com
# License : MIT License
# Copyright : 2016
# ... |
# Copyright (c) 2008-2009 Mikeal Rogers <mikeal.rogers@gmail.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 req... |
# Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 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 requ... |
import logging
from flask import render_template, request, url_for
from flask_wtf.csrf import CSRFError
from requests.exceptions import ConnectionError
from structlog import wrap_logger
from werkzeug.utils import redirect
from frontstage import app
from frontstage.common.session import Session
from frontstage.excepti... |
#
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# This program is distributed in th... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from six import stri... |
"""
"""
import phoebe
from phoebe import u
import numpy as np
import matplotlib.pyplot as plt
def test_binary(plot=False):
b = phoebe.Bundle.default_binary()
# Two spherical suns
b.set_value_all('teff', value=5772.)
b.set_value('sma', component='binary', value=100.)
b.set_value('period', compone... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from functools import wraps
from pants_test.pants_run_integration_test import PantsRunIn... |
import os
from fluidity_tools import stat_parser
from sympy import *
from numpy import array,max,abs
meshtemplate='''
Point(1) = {0.0,0.0,0,0.1};
Extrude {1,0,0} {
Point{1}; Layers{<layers>};
}
Extrude {0,1,0} {
Line{1}; Layers{<layers>};
}
Extrude {0,0,1} {
Surface{5}; Layers{<layers>};
}
Physical Surface(28) =... |
"""
from https://gist.github.com/bwhite/3726239
Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/doc... |
import json
async def test_swagger_page(test_cli):
response = await test_cli.get(
'/api/v1/',
)
assert response.status == 200
assert "text/html" == response.headers["Content-Type"]
async def test_swagger_json(test_cli):
response = await test_cli.get('/api/v1/swagger.json')
a... |
from def_build_mech_dict import *
import os
import shutil
def rename_sp(sp_list):
sp_list_new = []
for s in sp_list:
sp_list_new.append(s.replace("(","-").replace(")","-").replace(",","-"))
return sp_list_new
def skeletal(detailed_folder, sk_folder, species_kept, notes=None):
if not os.path.exists(sk_folder... |
# Authors:
# Petr Kubat <xkubat11@stud.fit.vutbr.cz>
"""
Tests for the parser
"""
import unittest
import sys
import xml.etree.ElementTree as ET
# Add path to parent dicertory to PYTHONPATH
sys.path.append('../')
import default
import pskcparser
class TestParser(unittest.TestCase):
def setUp(self):
a... |
# -*- encoding: utf-8 -*-
"""
Regression model.
:copyright: (c) 2016 H2O.ai
:license: Apache License Version 2.0 (see LICENSE for details)
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import imp
from h2o.model.confusion_matrix import ConfusionMatrix
from h2o.utils.backward... |
# -*- coding: utf-8 -*-
import sys
import io
import os
import os.path
from stat import S_IXUSR, S_IXGRP, S_IXOTH
from subprocess import check_output, CalledProcessError
from setuptools import setup, find_packages
from setuptools.command.develop import develop
from setuptools.command.install import install
with io.ope... |
from .libindy import do_call, create_cb
from typing import Optional
from ctypes import *
import logging
"""
These functions wrap the Ursa algorithm as documented in this paper:
https://github.com/hyperledger/ursa/blob/master/libursa/docs/AnonCred.pdf
And is documented in this HIPE:
https://github.com/hyperledger/i... |
from itertools import groupby
import pymongo
from arctic.chunkstore.chunkstore import SYMBOL, SEGMENT, START
def segment_id_repair(library, symbol=None):
"""
Ensure that symbol(s) have contiguous segment ids
Parameters
----------
library: arctic library
symbol: None, str, list of str
... |
# -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2015 Jérémy Bobbio <lunar@debian.org>
#
# diffoscope 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 Foundati... |
#init
import pyb, gc
# 1.0 open, 0.0 closed
w_status = 1
#0 early, 1 late, 2 night, 3 manual
w_mode = 3
w_times = [[(19,0),(8,0)],[(19,0),(10,0)],[(7,0),(14,30)]]
#hardware
i2c = pyb.I2C(2, pyb.I2C.MASTER)
i2c.mem_write(4, 90, 0x5e)
touch = i2c.mem_read(1, 90, 0)[0]
s_up = pyb.Servo(1)
s_down = pyb.Servo(2)
lcd = p... |
from ..exceptions import UnknownLookupType
from ..util import load_object_from_string
from .handlers import output
from .handlers import kms
from .handlers import xref
from .handlers import file as file_handler
LOOKUP_HANDLERS = {}
DEFAULT_LOOKUP = output.TYPE_NAME
def register_lookup_handler(lookup_type, handler_o... |
"""
Solve Helmholtz equation on the unit disc
Using polar coordinates and numerical method from:
"Efficient spectral-Galerkin methods III: Polar and cylindrical geometries",
J Shen, SIAM J. Sci Comput. 18, 6, 1583-1604
Using shenfun to map coordinates instead of
directly applying r = (t+1)/2, as in the SIAM paper.
... |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... |
#!/usr/bin/env python
###############################################################################
# NutaqDiags device server.
#
# Copyright (C) 2013 Max IV Laboratory, Lund Sweden
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Publi... |
# Copyright (c) 2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... |
# Copyright 2015 Mirantis, 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... |
# Copyright 2014 Cisco Systems, 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 requir... |
#!/usr/bin/env python
import argparse
import greg.config
def main():
parser = argparse.ArgumentParser(description='Integrate your build server and source control')
parser.add_argument('--config', default='config.yaml', help='Path to config file')
parser.add_argument('--fix-hooks', action='store_const', con... |
# coding=utf-8
# Copyright 2021 The Uncertainty Baselines 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 ap... |
from matchzoo.engine.base_model import BaseModel
from matchzoo.auto.tuner.callbacks.callback import Callback
class LoadEmbeddingMatrix(Callback):
"""
Load a pre-trained embedding after the model is built.
Used with tuner to load a pre-trained embedding matrix for each newly built
model instance.
... |
from math import sqrt
from functools import lru_cache
from typing import Sequence, Tuple, TYPE_CHECKING
from .color_triplet import ColorTriplet
if TYPE_CHECKING:
from rich.table import Table
class Palette:
"""A palette of available colors."""
def __init__(self, colors: Sequence[Tuple[int, int, int]]):
... |
from typing import Dict, Sequence, Union
from gi.repository import Gtk
VIEW_ACCELERATORS: Dict[str, Union[str, Sequence[str]]] = {
'app.quit': '<Primary>Q',
'view.find': '<Primary>F',
'view.find-next': ('<Primary>G', 'F3'),
'view.find-previous': ('<Primary><Shift>G', '<Shift>F3'),
'view.find-repl... |
# -*- 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... |
#!/usr/bin/env python3
import argparse
import os
import re
import shutil
import subprocess
import sys
class Cue2Flac(object):
CUE2FLAC_DESCRIPTION = "cue2flac - Split a FLAC image into tracks according to a .cue file."
def __init__(self):
self.parser = argparse.ArgumentParser(description=Cue2Flac.CU... |
# No shebang line, this module is meant to be imported
#
# Copyright 2015 Ambient Entertainment GmbH & Co. KG
#
# 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/lice... |
"""
This file contains tasks that are designed to perform background operations on the
running state of a course.
"""
import json
from collections import OrderedDict
from datetime import datetime
from django.conf import settings
from eventtracking import tracker
from itertools import chain
from time import time
import... |
"""
Support for IP Webcam, an Android app that acts as a full-featured webcam.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/android_ip_webcam/
"""
import asyncio
import logging
from datetime import timedelta
import voluptuous as vol
from homeassista... |
class PacketAdditionalInfoTestCase(TestCase):
# Atributos internos de la clase
timestamp = timezone.now()
timestamp_insertion = timezone.now()
def setUp(self):
ip_source = Ips.objects.create(Ip="127.0.0.2", Hostname="localhost", Tag="localhost")
ip_dest = Ips.objects.create(Ip="127.0.0... |
import discord
from discord.ext import commands
import requests
from .utils.dataIO import dataIO
from collections import defaultdict
import os
import json
class Game:
"""Trouver les infos d'un jeu sur ScreenScraper."""
def __init__(self, bot):
self.bot = bot
settings = dataIO.load_json("data/... |
__author__ = 'Konstantin Dmitriev'
__version__ = '1.0-alpha1'
import sys
from renderchan.file import RenderChanFile
from renderchan.project import RenderChanProjectManager
from renderchan.module import RenderChanModuleManager, RenderChanModule
from renderchan.utils import mkdirs
from renderchan.utils import float_trun... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
import csv
import codecs
import cStringIO
from django.http import StreamingHttpResponse
from django.views.generic import View
"""
流式响应StreamingHttpResponse可以快速,节省内存地产生一个大型文件
"""
class Echo(object):
"""An object that implements jus... |
# Copyright 2017 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... |
#!/usr/bin/env python2
'''
genPOI.py
Scans regionsets for TileEntities and Entities, filters them, and writes out
POI/marker info.
A markerSet is list of POIs to display on a tileset. It has a display name,
and a group name.
markersDB.js holds a list of POIs in each group
markers.js holds a list of which markerSet... |
import re
import json
import fileinput
# F --> AO a [0,0;1,0] (* C --> /T,C T [0,0;1,0] *)
# A --> AL H [0,0;1,0] (* D,-case --> /N,D,-case N [0,0;1,0] *)
# I --> m [0,2;0,0][0,1] (* PastPart,-aux;-case --> +v,PastPart,-aux;-case;-v [0,2;0,0][0,1] *)
# I --> p [0,1;0,0][0,2] (* PastPart,-aux;-ca... |
import os
import shutil
import tarfile
class GZipController:
def __init__(self, target_dir, gzip_file_path, main_dirname):
self.target_dir = target_dir
self.gzip_file_path = gzip_file_path
self.main_dirname = main_dirname
def create_dir(self):
tf = tarfile.open(self.gzip_file... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.