code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 by Christian Tremblay, P.Eng <christian.tremblay@servisys.com>
#
# Licensed under GPLv3, see file LICENSE in this source tree.
# References : https://www.deming.org/
# http://www.contesolutions.com/Western_Electric_SQC_Handbook.pdf
# http://www.... | ChristianTremblay/ddcmath | ddcmath/stats/tables.py | Python | gpl-3.0 | 2,334 |
from __future__ import absolute_import
import functools
import logging
import select
import errno
import signal
import ctypes
import sys
import os
import vanilla.exception
log = logging.getLogger(__name__)
# TODO: investigate the equivalent for BSD and OSX
# TODO: should move this and poll into some kind of comp... | cablehead/vanilla | vanilla/process.py | Python | mit | 4,954 |
import collections
from django import forms
from django.forms.fields import MultiValueField, CharField
from django.forms.utils import flatatt
from django.forms.widgets import (
CheckboxInput,
Input,
RadioChoiceInput,
RadioSelect,
RadioFieldRenderer,
TextInput,
MultiWidget,
Widget,
)
from... | qedsoftware/commcare-hq | corehq/apps/style/forms/widgets.py | Python | bsd-3-clause | 10,116 |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# This program is published under a GPLv2 license
"""
Answering machines.
"""
########################
# Answering machines #
########################
from __future__ impor... | 6WIND/scapy | scapy/ansmachine.py | Python | gpl-2.0 | 4,267 |
# -*- coding: utf8 -*-
from __future__ import absolute_import
from tornado.testing import gen_test
from braspag.consts import PAYMENT_METHODS
from .base import BraspagTestCase
from .vcrutils import replay
class AuthorizeCaptureRefundTest(BraspagTestCase):
@gen_test
@replay
def test_authorize_capture_r... | luizalabs/braspag | tests/test_authorize_capture_refund.py | Python | lgpl-3.0 | 3,309 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Javier Martinez Garcia June 2015
from PySide import QtCore
# retrieve the components of the gearbox
MShaft = FreeCAD.ActiveDocument.getObject("Fusion004001")
Gear1 = FreeCAD.ActiveDocument.getObject("Fusion")
Gear2 = FreeCAD.ActiveDocument.getObject("Fusion001")
Gear3 =... | JMG1/5SGearBox | AnimationScript.py | Python | gpl-2.0 | 1,550 |
import unittest
from meshparser.base.parser import BaseParser
class ParserTestCase(unittest.TestCase):
def testCanParse(self):
v = BaseParser()
self.assertFalse(v.canParse('not-a-file'))
def testParse(self):
v = BaseParser()
self.assertRaises(NotImplementedError, v.parse, 'n... | ABI-Software/MeshParser | tests/baseparser/test_parser.py | Python | apache-2.0 | 431 |
# coding:utf8
import json
import bisect
try:
_data = json.loads(open("ip_location.json").read())
except IOError as e:
print("[error] %s" % e)
exit()
for d in _data:
_data[d] = _data[d].split("|")
def ip2int(s):
ss = s.split('.')
int_ip = 0
for i, d in enumerate(ss):
int_ip = int_i... | winxos/python | ip_location_test.py | Python | mit | 642 |
#!/usr/bin/env python
# This code must be source compatible with Python 2.4 through 3.3.
#
# Copyright 2003 Google Inc. All Rights Reserved.
"""Unittest for shellutil module."""
import os
# Use unittest instead of basetest to avoid bootstrap issues / circular deps.
import unittest
from google_apputils import shell... | jeremydw/google-apputils-python | tests/shellutil_unittest.py | Python | apache-2.0 | 1,989 |
# i2c_read.py
# Example of reading I2C data
import serbus
# Create an I2CDev instance for interfacing to /dev/i2c-1:
bus = serbus.I2CDev(1)
bus.open()
# Write a couple bytes to the slave device with address 0x50:
bus.write(0x50, [0x00, 0x01])
bus.close() | graycatlabs/serbus | python/examples/i2c_write.py | Python | mit | 257 |
# coding: utf-8
__all__ = ['PinnerWarning', 'UnpinnedDependency', 'NotStrictSpec', 'UnpinnedVcs', 'NotStrictVcs']
class PinnerWarning(Exception):
template = ''
def __init__(self, requirement):
self.requirement = requirement
super(PinnerWarning, self).__init__(requirement)
@property
... | coagulant/pinner | pinner/exceptions.py | Python | bsd-3-clause | 880 |
# Copyright 2021 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 required by applicable law or ag... | googleapis/python-analytics-admin | samples/properties_user_links_batch_get_test.py | Python | apache-2.0 | 990 |
from __future__ import absolute_import
# coding: utf-8
# Copyright (c) 2010-2015 openpyxl
# stdlib
import datetime
# package imports
from openpyxl.workbook import Workbook
from openpyxl.reader.excel import load_workbook
from openpyxl.workbook.names.named_range import NamedRange
from openpyxl.utils.exceptions import R... | cgimenop/Excel2Testlink | ExcelParser/lib/openpyxl/workbook/tests/test_workbook.py | Python | mit | 5,301 |
#
# Copyright (C) 2001 Andrew T. Csillag <drew_csillag@geocities.com>
#
# You may distribute under the terms of either the GNU General
# Public License or the SkunkWeb License, as specified in the
# README file.
#
import os
import DT
import sys
import time
import marshal
import stat
def phf... | drewcsillag/skunkweb | pylibs/DT/dtrun.py | Python | gpl-2.0 | 911 |
# -*- coding: utf-8 -*-
"""
flask.testsuite.templating
~~~~~~~~~~~~~~~~~~~~~~~~~~
Template functionality
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from flask.testsuite import FlaskTestCase
class TemplatingTestCase(Flask... | zwChan/VATEC | ~/eb-virt/Lib/site-packages/flask/testsuite/templating.py | Python | apache-2.0 | 11,237 |
#!/usr/bin/python
# (c) 2016, Marcin Skarbek <github@skarbek.name>
# (c) 2016, Andreas Olsson <andreas@arrakis.se>
# (c) 2017, Loic Blot <loic.blot@unix-experience.fr>
#
# This module was ported from https://github.com/mskarbek/ansible-nsupdate
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/l... | Tatsh-ansible/ansible | lib/ansible/modules/net_tools/nsupdate.py | Python | gpl-3.0 | 11,187 |
# Author: Emmanuel Odeke <odeke@ualberta.ca>
# Module to help with authentication
import json
import hmac
import hashlib
from django.http import HttpResponse
import django.contrib.auth as djangoAuth
from django.core.context_processors import csrf
from django.shortcuts import render_to_response
from django.views.decor... | odeke-em/restAssured | auth/views.py | Python | mit | 11,428 |
#!/usr/bin/env python
# encoding: utf-8
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
extensions = [Extension('dbn',
['dbn.pyx'],
include_dirs=[np.get_include()],
... | superbock/HAMR2014 | setup.py | Python | bsd-2-clause | 572 |
#!/usr/bin/python
"""Test of line navigation output of Firefox."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
# Work around some new quirk in Gecko that causes this test to fail if
# run via the test harness rather than manually.
sequence.append(KeyComboAction("<Control>r"))
sequence.a... | pvagner/orca | test/keystrokes/firefox/line_nav_bug_549128.py | Python | lgpl-2.1 | 6,814 |
# fMBT, free Model Based Testing tool
# Copyright (c) 2012 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foundation.
#
# This program is distribute... | pablovirolainen/fMBT | utils/fmbt.py | Python | lgpl-2.1 | 4,179 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... | TheWardoctor/Wardoctors-repo | plugin.video.saltsrd.lite/scrapers/scenehdtv_scraper.py | Python | apache-2.0 | 8,009 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from optionaldict import optionaldict
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatSemantic(BaseWeChatAPI):
def search(self,
query,
category,
uid=None,
l... | cloverstd/wechatpy | wechatpy/client/api/semantic.py | Python | mit | 2,084 |
"""Adiabatic tapers from CSV files
"""
import pathlib
from functools import partial
from pathlib import Path
from typing import Tuple
import numpy as np
import pandas as pd
import gdsfactory as gf
from gdsfactory.component import Component
data = pathlib.Path(__file__).parent / "csv_data"
@gf.cell
def taper_from_c... | gdsfactory/gdsfactory | gdsfactory/components/taper_from_csv.py | Python | mit | 1,990 |
# GPLv2 license - V. Reverdy - November 2015
# Executes n times a loop calling a callback on each element of an array
#
# python3 callback.py 8192 1048576
# Import
import sys
import os
import numpy
# Benchmark function
def benchmark(count, size, callback):
array = numpy.arange(0, size, dtype = numpy.int32)
func... | vreverdy/benchmark_callback | callback.py | Python | gpl-2.0 | 691 |
import unittest
import solver
class SolverTest(unittest.TestCase):
def setUp(self):
self.testSolver = solver.Solver()
#Vertical test data
self.testVerticalRowComplete = [[1],[2],[3],[4],[5],[6],[7],[8],[9]]
self.testVerticalRowDuplicate = [[1],[2],[3],[5],[5],[6],[7],[8],[9]]
... | jonbrohauge/pySudokuSolver | test/test_vertical.py | Python | mit | 1,084 |
#!/usr/bin/python
import subprocess
import urwid
import os
import sys
factor_me = 362923067964327863989661926737477737673859044111968554257667
run_me = os.path.join(os.path.dirname(sys.argv[0]), 'subproc2.py')
output_widget = urwid.Text("Factors of %d:\n" % factor_me)
edit_widget = urwid.Edit("Type anything or press... | uccgit/the-game | test/subproc.py | Python | gpl-2.0 | 876 |
"""
Implement an observer pattern for attribute access.
Assumes that each attribute is used (exclusivly) for either scalar
values, lists or maps.
It does not work if you store a scalar in an attribute, and then later
a map or list.
A scalar attribute is an attribute whose values do not have internal
structure. Scal... | ActiveState/code | recipes/Python/306865_Observer_pattern_scalar/recipe-306865.py | Python | mit | 6,770 |
#
# Global Linear Model Parser
# Simon Fraser University
# NLP Lab
#
# Author: Yulan Huang, Ziqi Wang, Anoop Sarkar
# (Please add on your name if you have authored this file)
#
# Dict-like object that stores features
from feature.feature_vector import FeatureVector
import debug.debug
class FeatureGenerator():
""... | sfu-natlang/glm-parser | src/feature/obsolete/feature_generator.py | Python | mit | 28,822 |
import unittest
from mox import MoxTestBase, IsA
import gevent
from gevent.pywsgi import WSGIServer as GeventWSGIServer
from slimta.http.wsgi import WsgiServer, log
class TestWsgiServer(MoxTestBase, unittest.TestCase):
def test_build_server(self):
w = WsgiServer()
server = w.build_server(('0.0.0... | slimta/python-slimta | test/test_slimta_http_wsgi.py | Python | mit | 1,208 |
import numpy as np
import time
import datetime
import os
import threading
from enum import Enum
from .util import startThread
class CookerController:
class States(Enum):
BOOST = 1
OVERSHOOT = 2
CONTROL = 3
STOPPED = 4
CONTROL_EPSILON = 0.5
F_SWITCH = 1 / 15
T_CONT = 2 /... | neXyon/suvicoco | suvicoco/control.py | Python | agpl-3.0 | 17,317 |
#!/usr/bin/env python
# Copyright (c) 2015 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... | SanchayanMaity/gem5 | util/encode_inst_dep_trace.py | Python | bsd-3-clause | 8,604 |
# -*- coding: utf-8 -*-
# (c) 2017 KMEE INFORMATICA LTDA - Daniel Sadamo <daniel.sadamo@kmee.com.br>
# (c) 2017 KMEE INFORMATICA LTDA - Luis Felipe Mileo <mileo@kmee.com.br>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from __future__ import (
division, print_function, unicode_literals, absolut... | kmee/odoo-brazil-hr | l10n_br_hr_arquivos_governo/models/l10n_br_hr_sefip.py | Python | agpl-3.0 | 64,498 |
##############################################################################
# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, ... | dtudares/hello-world | yardstick/yardstick/benchmark/scenarios/compute/memload.py | Python | apache-2.0 | 3,935 |
ACCOUNT_NAME = 'American RV' | 0--key/lib | portfolio/Python/scrapy/americanrv/__init__.py | Python | apache-2.0 | 28 |
from app.user.models import UserProfile
class UserProfileMixin(object):
def get_context_data(self, **kwargs):
kwargs['user_profile'] = UserProfile.objects.get(user=self.request.user)
return super(UserProfileMixin, self).get_context_data(**kwargs)
| netsuileo/sfu-cluster-dashboard | dashboard/app/user/mixins.py | Python | lgpl-3.0 | 269 |
"""Unit tests for pyatv.interface."""
from typing import Dict, Optional
from unittest.mock import ANY, MagicMock
import pytest
from pyatv import convert, exceptions, interface
from pyatv.const import (
DeviceModel,
DeviceState,
FeatureName,
FeatureState,
MediaType,
OperatingSystem,
RepeatS... | postlund/pyatv | tests/test_interface.py | Python | mit | 12,169 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2015 ASMlover. 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 copyrig... | ASMlover/study | python/tornado/hello/hello.py | Python | bsd-2-clause | 1,833 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | bootswithdefer/ansible | v2/ansible/playbook/conditional.py | Python | gpl-3.0 | 3,862 |
#!/usr/bin/env python
## \file change_version_number.py
# \brief Python script for updating the version number of the SU2 suite.
# \author A. Aranake
# \version 6.2.0 "Falcon"
#
# The current SU2 release has been coordinated by the
# SU2 International Developers Society <www.su2devsociety.org>
# with selected cont... | srange/SU2 | SU2_PY/change_version_number.py | Python | lgpl-2.1 | 3,458 |
from .mathutils import *
| jdrusso/last_letter | mathutils/src/mathutils/__init__.py | Python | gpl-3.0 | 25 |
# Licensed to the Apache Software Foundation (ASF) 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 u... | Acehaidrey/incubator-airflow | airflow/providers/salesforce/operators/salesforce_apex_rest.py | Python | apache-2.0 | 2,540 |
from rest_framework.reverse import reverse
from rest_framework.test import APITestCase
from .. import factories, models
class PurchaseTests(APITestCase):
purchase_url = reverse('purchase-list')
def test_purchase_with_access_code(self):
user = factories.UserFactory()
event = factories.EventFa... | ovidner/bitket | tests/test_purchase.py | Python | mit | 731 |
# 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 ... | balajikris/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/wrapped_product.py | Python | mit | 781 |
from pygments.lexer import Lexer, do_insertions
from pygments.lexers.agile import PythonConsoleLexer, PythonLexer, \
PythonTracebackLexer
from pygments.token import Comment, Generic
from sphinx import highlighting
import re
line_re = re.compile('.*?\n')
class IPythonConsoleLexer(Lexer):
"""
For IPython co... | andreasvc/cython | docs/sphinxext/ipython_console_highlighting.py | Python | apache-2.0 | 2,772 |
# PVOutput.org configuration
PVOUTPUT_APIKEY = ''
PVOUTPUT_SYSTEMID = ''
# emoncms.org configuration
EMONCMS_APIKEY = ''
| rickgaiser/pv_logger | config.py | Python | gpl-2.0 | 123 |
from time import time
import xbmcvfs
from resources.lib.api.sc import Sc
from resources.lib.common.lists import List
from resources.lib.common.logger import debug
from resources.lib.common.storage import KodiDb
from resources.lib.constants import SC
from resources.lib.gui.item import SCNFO
from resources.lib.kodiutils... | bbaronSVK/plugin.video.stream-cinema | resources/lib/common/android.py | Python | gpl-3.0 | 6,256 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from module.plugins.Hoster import Hoster
class VeehdCom(Hoster):
__name__ = 'VeehdCom'
__type__ = 'hoster'
__pattern__ = r'http://veehd\.com/video/\d+_\S+'
__config__ = [
('filename_spaces', 'bool', "Allow spaces in filename", 'False'),
... | Rusk85/pyload | module/plugins/hoster/VeehdCom.py | Python | gpl-3.0 | 2,311 |
import cStringIO as StringIO
import os
import zipfile
class ZipStream(file):
def __init__(self, dir_path):
self.dir_path = dir_path
self.pos = 0
self.buff_pos = 0
self.zf = zipfile.ZipFile(self, 'w', zipfile.ZIP_DEFLATED, allowZip64=True)
self.buff = StringIO.StringIO()
... | OliverCole/ZeroNet | plugins/Sidebar/ZipStream.py | Python | gpl-2.0 | 1,619 |
#!/usr/bin/env python
# $Id: tkhello2.py,v 1.1 2000/02/21 09:04:25 wesc Exp $
#
# tkhello2.py -- "Hello World!" 2 in Tkinter:
# - "Hello World!" with just a button (which quits the app)
#
# created by wesc 00/02/20
#
# import Tkinter module
import Tkinter
# create toplevel window
top = Tkinter.Tk()
# create b... | opensvn/test | src/study/python/cpp/ch19/alt/tkhello2.py | Python | gpl-2.0 | 457 |
# Copyright 2017 The Bazel 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 la... | damienmg/bazel | src/test/py/bazel/bazel_windows_test.py | Python | apache-2.0 | 2,343 |
# -*- coding: utf-8 -*-
from django.db import models
class Project(models.Model):
id = models.AutoField(primary_key=True)
project = models.CharField(max_length=255)
user = models.CharField(max_length=255)
password = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now=True)... | globocom/vault | identity/models.py | Python | apache-2.0 | 408 |
from identityprovider.const import LAUNCHPAD_TEAMS_NS
from identityprovider.tests.helpers import OpenIDTestCase
class OpenIDTeamsAutoAuthorizeTestCase(OpenIDTestCase):
def test(self):
# = Interaction of Launchpad OpenID Teams with Auto-Authorize =
# Check that teams work well when requested by an... | miing/mci_migo | identityprovider/tests/openid_server/per_version/test_openid_teams_auto_authorize.py | Python | agpl-3.0 | 1,706 |
import webiopi
webiopi.setDebug()
GPIO = webiopi.GPIO
LED=25
SERVO_TILT=23
SERVO_PAN=24
def setup():
webiopi.debug("Script with macros - Setup")
GPIO.setFunction(LED, GPIO.OUT)
GPIO.setFunction(SERVO_TILT, GPIO.PWM)
GPIO.setFunction(SERVO_PAN, GPIO.PWM)
GPIO.output(LED, GPIO.LOW)
def loop():
... | oroca/raspberrypi_projects | webcontrol/webcontrol.py | Python | mit | 650 |
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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 ... | Ebag333/Pyfa | gui/builtinGraphs/fitDps.py | Python | gpl-3.0 | 3,186 |
"""
ASGI config for todo project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS... | bugsnag/bugsnag-python | tests/fixtures/django4/todo/asgi.py | Python | mit | 385 |
from utils import log, open_folder_in_explorer
import os
import re
import glob
import sys
import codecs
import platform
from PySide import QtGui, QtCore
from PySide.QtGui import QApplication, QHBoxLayout, QVBoxLayout
from PySide.QtNetwork import QHttp
from PySide.QtCore import QUrl, QFile, QIODevice, QCoreApplication... | bright-sparks/Web2Executable | main.py | Python | mit | 47,489 |
# Copyright 2021 The Kubeflow 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 applicabl... | kubeflow/pipelines | components/google-cloud/google_cloud_pipeline_components/experimental/notebooks/__init__.py | Python | apache-2.0 | 924 |
# -*- coding: utf-8 -*-
# Copyright© 2016 ICTSTUDIO <http://www.ictstudio.eu>
# License: AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
'name': 'HR Expense - Cost Center',
'version': '8.0.0.0.2',
'license': 'AGPL-3',
'author': 'ICTSTUDIO',
'category': 'Accounting & Finance',
'depends': ... | ICTSTUDIO/accounting-addons | hr_expense_cost_center/__openerp__.py | Python | agpl-3.0 | 460 |
# Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
import enum
## The type of relation, i.e. what direction does this relation have.
class RelationType(enum.IntEnum):
RequiresTarget = 1 # The relation represents that the owner requires the target.
RequiredByTar... | onitake/Uranium | UM/Settings/SettingRelation.py | Python | agpl-3.0 | 2,291 |
""" 周期任务 """
from app.util.cache_util import GLOBAL_LOCAL_CACHE
from app.util import time_util
def delete_expired_local_cache():
""" 删除过期的本地缓存 """
now_time = time_util.timestamp()
delete_keys = [
key
for key in GLOBAL_LOCAL_CACHE
if GLOBAL_LOCAL_CACHE[key]["expire"] < now_time
... | Jackeriss/Typora-Blog | app/tasks/periodic_task.py | Python | mit | 418 |
from abc import ABC, abstractmethod
import pytest
from attr import dataclass
from faker.proxy import Faker
from virtool.fake.wrapper import FakerWrapper
class AbstractFakeDataGenerator(ABC):
@abstractmethod
def create() -> dict:
...
@abstractmethod
async def insert() -> dict:
...
... | virtool/virtool | tests/fixtures/fake.py | Python | mit | 2,976 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/backup_protectable_items_operations.py | Python | mit | 5,397 |
import os
from setuptools import setup, find_packages
from gitsummary import VERSION
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
requirements = read('requirements.txt').split('\n')
dependency_links = read('dependency_links.txt').split('\n')
setup(
name = "Gitsummary"... | Mediaphormedia/gitsummary | setup.py | Python | mit | 1,015 |
from django import forms
class SearchForm(forms.Form):
q = forms.CharField(label='Search Referrals', max_length=100)
| shubhendusaurabh/referiend | search/forms.py | Python | mit | 122 |
# -*- python -*-
# Copyright (C) 2009-2015 Free Software Foundation, Inc.
# 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 versio... | FabianKnapp/nexmon | buildtools/gcc-arm-none-eabi-5_4-2016q2-osx/arm-none-eabi/lib/armv7e-m/fpu/libstdc++.a-gdb.py | Python | gpl-3.0 | 2,614 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
#import matplotlib
#matplotlib.use('Agg')
import numpy as np
#import re
import calendar
import os #, sys
import datetime as dt
#import pickle
import multiprocessing
import antenna as ant
import residuals as res
import gpsTime as ... | mikemoorester/ESM | nadirSiteModel.py | Python | mit | 42,504 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py | Python | mit | 1,087 |
# -*- coding: utf-8 -*-
# Copyright (C) 2021 Mathew Topper
#
# 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 vers... | DTOcean/dtocean-core | dtocean_core/utils/optimiser/__init__.py | Python | gpl-3.0 | 32,239 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis on Heroku
'''
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.utils... | jondelmil/brainiac | config/settings/production.py | Python | bsd-3-clause | 5,200 |
# Licensed to the Apache Software Foundation (ASF) 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 u... | tqchen/tvm | tests/python/unittest/test_target_codegen_vm_basic.py | Python | apache-2.0 | 3,695 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestMilestoneTracker(unittest.TestCase):
def test_milestone(self):
frappe.db.sql('delete from `tabMilestone Tracker`')
frappe.get_doc(di... | vjFaLk/frappe | frappe/automation/doctype/milestone_tracker/test_milestone_tracker.py | Python | mit | 1,245 |
import unittest
from egat.test_runner_helpers import WorkProvider
class MockWorkNode():
resources = []
i = None
class TestGetNextNode(unittest.TestCase):
def test_empty_work_pool(self):
wp = WorkProvider()
self.assertIsNone(wp.get_next_node())
def test_empty_work(self):
wp = W... | scotlowery/egat | tests/egat/test_work_provider.py | Python | mit | 972 |
"""
Regression tests for Model inheritance behavior.
"""
from __future__ import unicode_literals
import datetime
from operator import attrgetter
from unittest import expectedFailure
from django import forms
from django.test import TestCase
from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
Pa... | adambrenecki/django | tests/model_inheritance_regress/tests.py | Python | bsd-3-clause | 17,413 |
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on 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 Fo... | IfcOpenShell/IfcOpenShell | src/blenderbim/blenderbim/bim/module/drawing/ui.py | Python | lgpl-3.0 | 15,055 |
try:
import dna
except ImportError:
raise SystemExit('Could not find dna.py. Does it exist?')
import unittest
class DNATests(unittest.TestCase):
def test_transcribes_cytidine_unchanged(self):
self.assertEqual('C', dna.DNA('C').to_rna())
def test_transcribes_guanosine_unchanged(self):
... | ritwik/exercism-attempts | python/rna-transcription/rna_transcription_test.py | Python | mit | 782 |
# -*- coding: utf-8 -*-
# Refactored from: https://bitbucket.org/techtonik/python-pager
# Author: anatoly techtonik <techtonik@gmail.com>
# License: Public Domain (use MIT if the former doesn't work for you)
import os
import sys
from collections import namedtuple
terminal_size = namedtuple("terminal_size", "column... | gosella/autopython | autopython/console.py | Python | gpl-3.0 | 6,536 |
#!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... | srickardti/openthread | tests/scripts/thread-cert/Cert_5_2_03_LeaderReject2Hops.py | Python | bsd-3-clause | 12,176 |
# -*- coding: utf-8 -*-
#
# ryu documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 5 15:38:48 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All con... | citrix-openstack/build-ryu | doc/source/conf.py | Python | apache-2.0 | 7,154 |
"""Support for monitoring the state of Vultr Subscriptions."""
from __future__ import annotations
import logging
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF... | lukas-hetzenecker/home-assistant | homeassistant/components/vultr/sensor.py | Python | apache-2.0 | 3,264 |
"""
Formatters for query bundle iterables
"""
import os
import sys
import datetime
colors = filter(None, os.environ.get('LS_COLORS', '').split(':'))
colors = dict(c.split('=') for c in colors)
# colors is now a mapping of 'type': 'color code' or '*.ext' : 'color code'
seq_tpl = '\x1B[%sm'
res = seq_tpl % colors.get(... | Timdawson264/acd_cli | acdcli/cache/format.py | Python | gpl-2.0 | 4,278 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# Easy AVR USB Keyboard Firmware Keymapper
# Copyright (C) 2018-2020 David Howland
#
# 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 versi... | dhowland/EasyAVR | keymapper/easykeymap/gui/programdialog.py | Python | gpl-2.0 | 7,250 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from marshmallow.schema import (
Schema,
SchemaOpts,
MarshalResult,
UnmarshalResult,
)
from marshmallow.decorators import (
pre_dump, post_dump, pre_load, post_load, validates, validates_schema
)
from marshmallow.utils import pprint, mi... | daniloakamine/marshmallow | marshmallow/__init__.py | Python | mit | 679 |
__source__ = 'https://leetcode.com/problems/reverse-bits/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/reverse-bits.py
# Time : O(n)
# Space: O(1)
# Bit Manipulation
#
# Description: Leetcode # 190. Reverse Bits
#
# Reverse bits of a given 32 bits unsigned integer.
#
# For example, given input... | JulyKikuAkita/PythonPrac | cs15211/ReverseBits.py | Python | apache-2.0 | 5,306 |
# Copyright 2019 Omar Castiñeira, Comunitea Servicios Tecnológicos S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class ProductProduct(models.Model):
_inherit = "product.product"
_sql_constraints = [
('barcode_uniq', 'check(1=1)',
"A barcode can... | Comunitea/CMNT_004_15 | project-addons/automatize_edi_it/models/product.py | Python | agpl-3.0 | 458 |
# plotconfig.py ---
#
# Filename: plotconfig.py
# Description:
# Author: Subhasis Ray
# Maintainer:
# Created: Fri Jul 9 00:21:51 2010 (+0530)
# Version:
# Last-Updated: Wed Sep 15 20:23:14 2010 (+0530)
# By: Subhasis Ray
# Update #: 337
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#... | BhallaLab/moose-thalamocortical | pymoose/gui/qt/plotconfig.py | Python | lgpl-2.1 | 11,799 |
import sublime, sublime_plugin
import platform
import subprocess
OUTPUT_VIEW_NAME = 'ri Result'
"""
This is internal command.
Don't execute directly!
"""
class RiRunCommand(sublime_plugin.TextCommand):
def run(self, edit, setting, text):
output_view = self.view
# verify that runing on collect output v... | autopp/Sublime-ri | ri.py | Python | mit | 3,678 |
import argparse
import logging
logging.basicConfig(level=logging.INFO)
import numpy as np
np.random.seed(234421)
from app.data import ZoomLoader
from app.download import download_tiles, prune_tiles
from app.preprocess import preprocess_tiles
from app.train import train_model
from app.generate import generate_tiles
fr... | Detry322/map-creator | app/__main__.py | Python | mit | 2,218 |
"""
Support for IP Cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.generic/
"""
import asyncio
import logging
import aiohttp
import async_timeout
import requests
from requests.auth import HTTPDigestAuth
import voluptuous as vol
from home... | MungoRae/home-assistant | homeassistant/components/camera/generic.py | Python | apache-2.0 | 4,913 |
#!/usr/bin/env python
"""encode/decode base58 in the same way that Bitcoin does"""
import math
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)
def b58encode(v):
""" encode v, which is a string of bytes, to base58.
"""
long_value = 0L
for (i, c) in e... | bankonme/bitcointools | base58.py | Python | mit | 2,442 |
import pytest
import sys
from _pytest.skipping import MarkEvaluator, folded_skips
from _pytest.skipping import pytest_runtest_setup
from _pytest.runner import runtestprotocol
class TestEvaluator:
def test_no_marker(self, testdir):
item = testdir.getitem("def test_func(): pass")
evalskipif = MarkEv... | jeppeter/pytest | testing/test_skipping.py | Python | mit | 16,865 |
# Copyright 2017 IBM Corp.
#
# 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, s... | jianghuaw/nova | nova/tests/functional/test_list_servers_ip_filter.py | Python | apache-2.0 | 5,094 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-26 15:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.contrib.taggit
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
... | aapris/tilajakamo | tilajakamoweb/home/migrations/0009_auto_20160126_1521.py | Python | mit | 1,330 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | sysadminmatmoz/odoo-clearcorp | project_event/__openerp__.py | Python | agpl-3.0 | 1,964 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, Inc.
# Copyright (c) 2013, PAL Robotics SL
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribution... | robotlinker/robotlinker_core | src/rosbridge_suite/rosbridge_library/src/rosbridge_library/internal/subscribers.py | Python | apache-2.0 | 8,477 |
def clean_osi(s):
return s.split(';')[0]
if __name__ == '__main__':
dataset = ['fish and chips', 'potatoes', 'potatoes; ls', ';ls', 'butter;']
for d in dataset:
print 'original: ', d, 'cleaned: ', clean_osi(d), "tainted?", d != clean_osi(d) | jjconti/taint-mode-py | webdemo/cleaners.py | Python | gpl-3.0 | 271 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import with_statement
from collections import defaultdict
from copy import deepcopy
import axiom_rules
import fact_groups
import instantiate
import pddl
import sas_tasks
import simplify
import timers
# TODO: The translator may generate trivial derived v... | dpattiso/igraph | lama/translate/translate_old.py | Python | gpl-2.0 | 31,909 |
# -*- coding: utf-8 -*-
"""Event formatter related functions and classes for testing."""
from tests import test_lib as shared_test_lib
class EventFormatterTestCase(shared_test_lib.BaseTestCase):
"""The unit test case for an event formatter."""
def _TestGetFormatStringAttributeNames(
self, event_formatter,... | joachimmetz/plaso | tests/formatters/test_lib.py | Python | apache-2.0 | 712 |
from __future__ import print_function, division
import numpy as np
from numpy import zeros_like, zeros
def eigenvalues2dos(ksn2e, zomegas, nkpoints=1):
""" Compute the Density of States using the eigenvalues """
dos = zeros(len(zomegas))
for iw,zw in enumerate(zomegas): dos[iw] = (1.0/(zw - ksn2e)).sum().imag... | gkc1000/pyscf | pyscf/nao/scf_dos.py | Python | apache-2.0 | 1,337 |
from base64 import b16encode, b32decode
from bencode import bencode as benc, bdecode
from couchpotato.core.downloaders.base import Downloader, ReleaseDownloadList
from couchpotato.core.helpers.encoding import isInt, ss, sp
from couchpotato.core.helpers.variable import tryInt, tryFloat
from couchpotato.core.logger impor... | lebabouin/CouchPotatoServer-develop | couchpotato/core/downloaders/utorrent/main.py | Python | gpl-3.0 | 12,581 |
# encoding: utf-8
# Unlike what IPython does, we need to have an explicit inputhook because tkinter handles
# input hook in the C Source code
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
... | SlicerRt/SlicerDebuggingTools | PyDevRemoteDebug/ptvsd-4.1.3/ptvsd/_vendored/pydevd/pydev_ipython/inputhooktk.py | Python | bsd-3-clause | 771 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.