code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
"""
Enables interactivity for CLI operations
"""
import sys
def query_yes_no(question, default="yes"):
"""Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
It must be... | edx-solutions/edx-platform | common/djangoapps/util/prompt.py | Python | agpl-3.0 | 1,137 |
from flask_wtf import Form
from wtforms import TextField, DecimalField, TextAreaField, DateField, validators, PasswordField, BooleanField
class CommentForm(Form):
text = TextField('Title', [validators.Required()])
text2 = TextAreaField('Body')
longitude = DecimalField('Longitude')
latitude = DecimalFie... | homoludens/EventMap | hello/forms.py | Python | agpl-3.0 | 1,156 |
# -*- coding: utf-8 -*-
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# snippy - software development and maintenance notes manager.
# Copyright 2017-2020 Heikki J. Laaksonen <laaksonen.heikki.j@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | heilaaks/snippy | tests/lib/solution.py | Python | agpl-3.0 | 25,184 |
# -*- coding: utf-8 -*-
from odoo.exceptions import ValidationError
from odoo import models, api, _
class ProductProduct(models.Model):
_inherit = 'product.product'
_rec_name = 'config_name'
"""
Copy the function from product_configurator to show price using price list.
To Fix :
- Extra ... | microcom/odoo-product-configurator | product_configurator_use_default_pricelist/models/product.py | Python | agpl-3.0 | 2,350 |
"""
View logic for handling course messages.
"""
from __future__ import absolute_import
from datetime import datetime
from babel.dates import format_date, format_timedelta
from django.contrib import auth
from django.template.loader import render_to_string
from django.utils.http import urlquote_plus
from django.utils... | jolyonb/edx-platform | openedx/features/course_experience/views/course_home_messages.py | Python | agpl-3.0 | 9,580 |
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
class TaxingContext(object):
def __init__(self, customer_tax_group=None, customer_tax_number=N... | akx/shoop | shoop/core/taxing/_context.py | Python | agpl-3.0 | 720 |
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from django.utils import translation
from shoop.simple_cms.models import Page
from sh... | taedori81/shoop | shoop_tests/simple_cms/test_languages.py | Python | agpl-3.0 | 904 |
from copy import copy
import json
from cnxepub.utils import squash_xml_to_text
from cnxml.parse import parse_metadata as parse_cnxml_metadata
from cnxtransforms import cnxml_abstract_to_html
from lxml import etree
__all__ = (
'convert_to_model_compat_metadata',
'scan_for_id_mapping',
'scan_for_uuid_mappi... | Connexions/nebuchadnezzar | nebu/models/utils.py | Python | agpl-3.0 | 5,088 |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('',
url('^json/get/$', 'django_notify.views.get_notifications', name='json_get', kwargs={}),
url('^json/mark-read/$', 'django_notify.views.mark_read', name='json_mark_read_base', kwargs={}),
url('^json/... | GbalsaC/bitnamiP | django-wiki/django_notify/urls.py | Python | agpl-3.0 | 864 |
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class SlotVerificationRequest(models.Model):
_name = 'stock.slot.verification.request'
_inherit = 'mail.thr... | Vauxoo/stock-logistics-warehouse | stock_inventory_verification_request/models/stock_slot_verification_request.py | Python | agpl-3.0 | 5,256 |
class Widget(object):
def __init__(self, options, *args, **kwargs):
super(Widget, self).__init__(*args, **kwargs)
self.options = options
def get_display_name(self):
raise NotImplementedError
def render(self, request):
raise NotImplementedError
def render_option_form(s... | sigurdga/samklang-menu | samklang_menu/widgets.py | Python | agpl-3.0 | 420 |
# Copyright (c) 2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the impl... | jortel/gofer | test/unit/messaging/adapter/test_url.py | Python | lgpl-2.1 | 4,053 |
class Class(object):
pass
def func():
return 3.14
CONSTANT = 42
| retoo/pystructure | tests/python/typeinference/import_star_definitions.py | Python | lgpl-2.1 | 74 |
#! /usr/bin/env python
"""
# FEATURE_GET_TLV_PROPERTIES.py: Unitary test for
# FEATURE_GET_TLV_PROPERTIES
# Copyright (C) 2012,2016 Ludovic Rousseau
"""
# 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 Fre... | sixtyfive/pcsc-ctapi-wrapper | PCSC/UnitaryTests/FEATURE_GET_TLV_PROPERTIES.py | Python | lgpl-2.1 | 1,604 |
__version__="v2.5 beta10"
welcome_block="""
# Multi-Echo ICA, Version %s
#
# Kundu, P., Brenowitz, N.D., Voon, V., Worbe, Y., Vertes, P.E., Inati, S.J., Saad, Z.S.,
# Bandettini, P.A. & Bullmore, E.T. Integrated strategy for improving functional
# connectivity mapping using multiecho fMRI. PNAS (2013).
#
# Kundu, P.,... | ME-ICA/me-ica | meica.libs/select_model.py | Python | lgpl-2.1 | 12,834 |
"""Configuration and injectable fixtures for Pytest.
Supposed to replace the too-complex current UnitTest-based testing
framework.
DI and functions over complex inheritance hierarchies FTW!
"""
import os
import warnings
pytest_plugins = ["abilian.testing.fixtures"]
if os.environ.get("FAIL_ON_WARNINGS"):
# Don't... | abilian/abilian-core | conftest.py | Python | lgpl-2.1 | 426 |
#
# -*- coding: utf-8 -*-
# Authors: Daniel P. Berrange <berrange@redhat.com>
#
# Copyright (C) 2015 Red Hat, 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 2 of the Licen... | agx/libvirt-sandbox-debian | libvirt-sandbox/image/template.py | Python | lgpl-2.1 | 4,199 |
import os
import sys
def start():
# enable profling by adding to local conf.yaml "with_internal_profiling: True"
# required: "pip install GreenletProfiler"
# Provides function stats in formats 'pstat', 'callgrind', 'ystat'
# stats are saved at "/var/lib/tendrl/profiling/$NS.publisher_id/last_run_func_stat.$sta... | rishubhjain/commons | tendrl/commons/profiler.py | Python | lgpl-2.1 | 1,214 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
# Copyright (C) 2018 Ben McGinnes <ben@gnupg.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 S... | gpg/gpgme | lang/python/examples/howto/add-userid.py | Python | lgpl-2.1 | 2,100 |
#!/usr/bin/env python
"""Sinusoidal grating calculated in realtime."""
############################
# Import various modules #
############################
import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()
from VisionEgg.Core import *
from VisionEgg.FlowControl import Presentation
fr... | visionegg/visionegg | demo/grating.py | Python | lgpl-2.1 | 1,456 |
# Copyright (c) 2012. Los Alamos National Security, LLC.
# This material was produced under U.S. Government contract DE-AC52-06NA25396
# for Los Alamos National Laboratory (LANL), which is operated by Los Alamos
# National Security, LLC for the U.S. Department of Energy. The U.S. Government
# has rights to use, rep... | sim-x/simx | simx/core/OutputStream.py | Python | lgpl-2.1 | 1,732 |
#
# Authors: Robert Abram <robert.abram@entpack.com>
#
# Copyright (C) 2015-2017 EntPack
# see file 'LICENSE' for use and warranty information
#
# 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, e... | EntPack/SilentDune-Client | silentdune_client/sdc_firewall.py | Python | lgpl-3.0 | 12,943 |
import pytest
import time
from v8py import JavaScriptTerminated, current_context, new
def test_glob(context):
context.eval('foo = "bar"')
assert context.glob.foo == 'bar'
def test_getattr(context):
context.foo = 'bar'
assert context.foo == 'bar'
assert context.glob.foo == 'bar'
assert context... | tbodt/v8py | tests/test_context.py | Python | lgpl-3.0 | 3,108 |
################################################################################
"""
DESCRIPTION: Helpers for telecommand wrapper functions.
PACKAGE: spell.lang.helpers.tchelper
PROJECT: SPELL
Copyright (C) 2008, 2015 SES ENGINEERING, Luxembourg S.a.r.l.
This file is part of SPELL.
This library is free sof... | Spacecraft-Code/SPELL | src/spell/spell/lang/helpers/tchelper.py | Python | lgpl-3.0 | 37,359 |
import sys
sys.path.insert(0, "..")
import logging
import time
try:
from IPython import embed
except ImportError:
import code
def embed():
vars = globals()
vars.update(locals())
shell = code.InteractiveConsole(vars)
shell.interact()
from opcua import Client
from opcua imp... | iirob/python-opcua | examples/client-example.py | Python | lgpl-3.0 | 3,005 |
import abc
import math
import numpy
from scipy.io import loadmat
from Configs import Configs
from Paths import Paths
from datasets.LupusFilter import VisitsFilter, \
NullFIlter, TemporalSpanFilter
from infos.Info import Info, NullInfo
from infos.InfoElement import SimpleDescription, PrintableInfoElement
from info... | GiulioGx/RNNs | sources/datasets/LupusDataset.py | Python | lgpl-3.0 | 25,918 |
import codecs
import os
import re
import json
from . import WIKI_DIR
from collections import defaultdict
def _get_filename(slug):
return os.path.join(WIKI_DIR, '%s.md' % (slug,))
class Index(object):
def __init__(self):
self.texts, self.words = {}, set()
self.finvindex = defaultdict(set)
... | apruden/genwiki | genwiki/model.py | Python | lgpl-3.0 | 5,404 |
# -*- coding: utf-8 -*-
"""This module defines some special functions
(originally defined in SpecialFunctions.h)."""
# Copyright (C) 2008-2014 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as... | akshmakov/Dolfin-Fijee-Fork | site-packages/dolfin/functions/specialfunctions.py | Python | lgpl-3.0 | 6,001 |
{
'name': "Reminders and Agenda for Phonecalls",
'version': '1.0.0',
'author': 'IT-Projects LLC, Ivan Yelizariev',
'category': 'Reminders and Agenda',
'website': 'https://yelizariev.github.io',
'price': 6.00,
'currency': 'EUR',
'depends': ['reminder_base', 'crm'],
'data': [
'... | raycarnes/addons-yelizariev | reminder_phonecall/__openerp__.py | Python | lgpl-3.0 | 370 |
from django.core.management.base import NoArgsCommand, CommandError
import sys
from xadrpy.core.workers.daemon import DaemonHandler
class Command(NoArgsCommand):
def handle(self, **options):
daemon_handler = DaemonHandler("daemon.pid", "daemon.sock")
try:
daemon_handler.stop()
... | palankai/xadrpy | src/xadrpy/core/workers/management/commands/worker_stop.py | Python | lgpl-3.0 | 441 |
# !/usr/bin/python
# -*- coding: utf-8 -*-
#
# Created on Oct 16, 2015
# @author: Bo Zhao
# @email: bo_zhao@hks.harvard.edu
# @website: http://yenching.org
# @organization: Harvard Kennedy School
import urllib2
import json
import sys
from settings import BAIDU_AK
from log import *
reload(sys)
sys.s... | jakobzhao/ashcrawler | core/geo.py | Python | lgpl-3.0 | 5,940 |
# -*- coding: utf-8 -*-
import os
import KBEngine
from KBEDebug import *
def onBaseAppReady(isBootstrap):
"""
KBEngine method.
baseapp已经准备好了
@param isBootstrap: 是否为第一个启动的baseapp
@type isBootstrap: BOOL
"""
INFO_MSG('onBaseAppReady: isBootstrap=%s, appID=%s, bootstrapGroupIndex=%s, bootstrapGlobalIndex=%s' % \
... | dreamsxin/kbengine | assets/scripts/base/kbemain.py | Python | lgpl-3.0 | 2,796 |
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core import debug
settingsData = {
'sound': {
'enabled': True,
'driver': 'genericDriver',
'theme': 'default',
'volume': 1.0,
'genericPlayFileCommand': 'play -q -v fenrirVolum... | chrys87/fenrir | src/fenrirscreenreader/core/settingsData.py | Python | lgpl-3.0 | 3,330 |
# -*- coding: utf-8 -*-
# Copyright(C) 2019 Budget Insight
#
# This file is part of a weboob module.
#
# This weboob module 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 3 of the ... | laurentb/weboob | modules/bouygues/module.py | Python | lgpl-3.0 | 2,730 |
import pytest
from eos_data_distribution import DirTools
from gi.repository import GLib
ITER_COUNT = 10
class TestClass:
@pytest.mark.timeout(timeout=3, method='thread')
def test_0(self, tmpdir):
loop = GLib.MainLoop()
self.__called = 0
def cb_changed(M, p, m, f, o, evt, d=None, e=... | endlessm/endless-ndn | eos_data_distribution/DirTools/test_class.py | Python | lgpl-3.0 | 742 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2022 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | psi4/psi4 | psi4/driver/p4util/inpsight.py | Python | lgpl-3.0 | 23,279 |
import re
import Queue
class AbsAnalyst(object):
"""docstring for AbsAnalyst"""
LOGTIME_REGEXP = re.compile("(?P<log_time>\w{4}-\w{2}-\w{2} \w{2}:\w{2}:\w{2})")
def __init__(self):
raise NotImplemented
def isMatch(self, line):
raise NotImplemented
def doStatistic(self):
raise NotImplemented
def doAnal... | DrZhang/LogAnalyst | Analysts/AbsAnalyst.py | Python | lgpl-3.0 | 353 |
from pycp2k.inputsection import InputSection
class _each126(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Meta... | SINGROUP/pycp2k | pycp2k/classes/_each126.py | Python | lgpl-3.0 | 1,114 |
import sys
if __name__ == "__main__":
print("Genoa python script")
sys.exit(0)
| sfu-ireceptor/gateway | resources/agave_apps/genoa/genoa.py | Python | lgpl-3.0 | 88 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pythymio
import random
from gardenworld import *
init('info2_1')
with pythymio.thymio(["acc"],[]) as Thym:
state = dict([])
state["time"] = 0
state["delay"] = 10
def dispatch(evtid, evt_name, evt_args):
# https://www.thymio.org/en:thymioapi pr... | pierreboudes/pyThymio | garden_real.py | Python | lgpl-3.0 | 1,328 |
from __future__ import print_function
import sys
import os
# from setuptools import Distribution
from pkg_resources import get_distribution, working_set, VersionConflict
def samefile(path, other):
"""
Workaround for missing ``os.path.samefile`` in Windows Python 2.7.
"""
return os.path.normcase(os.p... | userzimmermann/zetup.py | setup.py | Python | lgpl-3.0 | 2,147 |
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
from bliss.controllers.tango_attr_as_counter import TangoAttrCounter
class tango_fe(TangoAttrCounter):
def __init__(self, name, confi... | tiagocoutinho/bliss | bliss/controllers/tango_fe.py | Python | lgpl-3.0 | 379 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017
#
# Author(s):
#
# Lars Ørum Rasmussen <ras@dmi.dk>
# Janne Kotro <janne.kotro@fmi.fi>
#
# 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... | pytroll/pytroll-file-utils | trollmoves/heartbeat_monitor.py | Python | lgpl-3.0 | 3,623 |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... | pyfa-org/eos | eos/source/manager.py | Python | lgpl-3.0 | 4,535 |
from django.db import models
from _datetime import date
class Restaurant(models.Model):
name = models.CharField(max_length=200)
transportation = models.BooleanField(default=False)
weatherSensetion = models.BooleanField(default=False)
status = models.BooleanField(default=True)
totalDay = models.Inte... | itucsProject2/Proje1 | restaurant/models.py | Python | unlicense | 639 |
#! /usr/bin/python
from base64 import b64encode, b64decode
from Crypto import Random
from Crypto.Cipher import AES, PKCS1_OAEP
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from Crypto.Random import random
from Crypto.Signature import PKCS1_v1_5
privateKeyStr = """-----BEGIN RSA PRIVATE KEY-----
MII... | NatalieWolfe/scratch-space | crypt.py | Python | unlicense | 7,350 |
# -*- coding: cp1252 -*-
from compiler import *
####################################################################################################################
# Each scene prop record contains the following fields:
# 1) Scene prop id: used for referencing scene props in other files. The prefix spr_ is automati... | Ikaguia/LWBR-WarForge | module_scene_props.py | Python | unlicense | 133,561 |
#!/usr/local/bin/python3.4
# -*- coding: utf-8 -*-
import threading
import time
import sys
import trace
from inspect import isgeneratorfunction
import format
class KillableThread(threading.Thread):
"""A subclass of threading.Thread, with a kill() method provided by courtsey of Connelly Barnes."""
def __init_... | suut/psychic-happiness | async_core.py | Python | unlicense | 2,381 |
from __future__ import unicode_literals
import re
from .mtv import MTVServicesInfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse,
)
from ..utils import (
ExtractorError,
float_or_none,
unified_strdate,
)
class ComedyCentralIE(MTVServicesInfoExtractor):
_VALID_URL = r'''(?x)... | rzhxeo/youtube-dl | youtube_dl/extractor/comedycentral.py | Python | unlicense | 10,050 |
from whiffle import wikidotapi
from util import hook
@hook.command
def author(inp):
".author <Author Name> -- Will return details regarding the author"
if firstrefresh == 0:#make sure the cache actually exists
return "Cache has not yet updated, please wait a minute and search again."
api = wikidotapi.connection()... | pixeltasim/IRCBot-Pixeltasim | plugins/author.py | Python | unlicense | 2,861 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# =================================================================
# =================================================================
# NOTE: notify message MUST follow these rules:
#
# - Messages must be wrappered with _() for translation
#
# - Replacement va... | windskyer/k_nova | paxes_nova/compute/notify_messages.py | Python | apache-2.0 | 4,325 |
# Copyright 2017 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 required by applicable law or agreed to in wri... | google/tangent | tests/test_optimization.py | Python | apache-2.0 | 2,734 |
# Copyright (C) 2020 OpenIO SAS
#
# 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... | open-io/oio-swift | oioswift/common/middleware/proxy_logging.py | Python | apache-2.0 | 3,938 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Midokura Japan K.K.
# Copyright (C) 2013 Midokura PTE LTD
# 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 th... | midonet/python-neutron-plugin-midonet | midonet/neutron/tests/unit/test_midonet_plugin.py | Python | apache-2.0 | 4,032 |
import logging
from flask import abort
from flask import Blueprint
from flask import current_app
from flask import flash
from flask import redirect
from flask import session
from flask import url_for
from testrail_reporting.auth.models import AuthUser
from testrail_reporting.auth.oauth import get_google
log = loggin... | romansalin/testrail-reporting | testrail_reporting/auth/views.py | Python | apache-2.0 | 1,344 |
import dask
from .scheduler import ray_dask_get, ray_dask_get_sync
from .callbacks import (
RayDaskCallback,
local_ray_callbacks,
unpack_ray_callbacks,
)
from .optimizations import dataframe_optimize
dask_persist = dask.persist
def ray_dask_persist(*args, **kwargs):
kwargs["ray_persist"] = True
r... | pcmoritz/ray-1 | python/ray/util/dask/__init__.py | Python | apache-2.0 | 1,309 |
import os
import requests
import socket
import subprocess
import unittest
import json
import ray
from ray.rllib import _register_all
from ray.tune.trial import Trial, Resources
from ray.tune.web_server import TuneClient
from ray.tune.trial_runner import TrialRunner
def get_valid_port():
port = 4321
while Tru... | pcmoritz/ray-1 | python/ray/tune/tests/test_tune_server.py | Python | apache-2.0 | 5,470 |
# Copyright 2018 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... | kevin-coder/tensorflow-fork | tensorflow/python/autograph/operators/control_flow.py | Python | apache-2.0 | 14,926 |
import platform
class OSCollector(object):
def __init__(self, docker_client=None):
self.docker_client = docker_client
def key_name(self):
return "osInfo"
def _zip_fields_values(self, keys, values):
data = {}
for key, value in zip(keys, values):
if len(value) >... | dx9/python-agent | cattle/plugins/host_info/os_c.py | Python | apache-2.0 | 1,411 |
import datetime
import sys
from django.utils.timezone import utc, now
from django.core.management.base import BaseCommand
from feeds.models import Feed, Meta
from feeds.exceptions import FeedException
class Command(BaseCommand):
help = 'Fetches the items from all stored feeds.'
def handle(self, *args, **opt... | jochenklar/reader2 | feeds/management/commands/fetch.py | Python | apache-2.0 | 1,002 |
import os
import threading
from cachetools import LRUCache
from customUtilities.logger import logger
class Cache():
def __init__(self,cachefilename,CACHE_SIZE,logger=logger('detoursCache.log')):
self.lock = threading.RLock()
self.cachefilename = cachefilename
self.entry = LRUCache(maxsize=... | akshah/netra | Cache/detoursCache.py | Python | apache-2.0 | 2,309 |
#!/usr/bin/env python
"""
This script constructs an Marathon application definition for the stress tester container.
Be sure to deploy the latest stress tester docker image to the registry before running this.
"""
import argparse
import json
import os
import sys
BASE_PATH = os.path.dirname(os.path.realpath(__file__))... | tendrilinc/marathon-autoscaler | scripts/test_autoscaler.py | Python | apache-2.0 | 2,665 |
# Copyright (c) 2015 Alex Meade
# Copyright (c) 2015 Rushil Chugh
# Copyright (c) 2015 Navneet Singh
# Copyright (c) 2015 Yogesh Kshirsagar
# 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
... | tmenjo/cinder-2015.1.1 | cinder/volume/drivers/netapp/eseries/library.py | Python | apache-2.0 | 45,592 |
from pathlib import Path
from jobman.jobman import JobMan
from mc.clients.job_record_client import JobRecordClient
from mc.clients.flow_record_client import FlowRecordClient
from mc.flows.flow_engine import FlowEngine
from mc.db.db import Db
from mc.runners.flow_runner import FlowRunner
from mc.runners.jobman_job_run... | aspuru-guzik-group/mission_control | mc/houston/utils.py | Python | apache-2.0 | 6,799 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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... | Huawei/OpenStackClient_Auto-Scaling | asclient/common/utils.py | Python | apache-2.0 | 1,745 |
# Copyright 2021 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 agreed to in writing, s... | firebase/firebase-cpp-sdk | scripts/gha/github.py | Python | apache-2.0 | 12,287 |
"""
Records for SMART Reference EMR
Ben Adida & Josh Mandel
"""
from base import *
from django.utils import simplejson
from django.conf import settings
from smart.common.rdf_tools.rdf_ontology import ontology
from smart.common.rdf_tools.util import rdf, foaf, vcard, sp, serialize_rdf, parse_rdf, bound_graph, URIRef, ... | smart-classic/smart_server | smart/models/records.py | Python | apache-2.0 | 5,560 |
from django.db import models
class Snippet(models.Model):
"""A text snippet. Not meant for use by anyone other than a designer"""
name = models.CharField(max_length=255)
snippet = models.TextField(blank=True)
class Meta:
pass
def __unicode__(self):
return self.snippet... | callowayproject/django-snippets | snippets/models.py | Python | apache-2.0 | 321 |
import os
import sys
from utils.SinfonierConstants import Environment as EnvConst
SINFONIER_API_NAME = os.environ[EnvConst.SINFONIER_ENV_KEY]
if SINFONIER_API_NAME == EnvConst.DEVELOP_ENVIRONMENT:
from environmentConfig.Develop import *
elif SINFONIER_API_NAME == EnvConst.PROD_ENVIRONMENT:
from environmentCon... | telefonicaid/fiware-sinfonier | sinfonier-backend-api/config/config.py | Python | apache-2.0 | 525 |
#!/usr/bin/env python
print("""# ******* WARNING - AUTO GENERATED CODE - DO NOT EDIT *******
module VimSdk
module VmomiSupport
""")
import ServerObjects
import PbmObjects
import SmsObjects
print(""" end
end
""")
| cloudfoundry-incubator/bosh-vsphere-cpi-release | scripts/pyvmomi_to_ruby/gen_server_objects.py | Python | apache-2.0 | 219 |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
"""
Publish and subscribe to MQTT messages.
Additional information at http://mqtt.org and
http://ibmstreams.github.io/streamsx.messaging
"""
from future.builtins import *
from streamsx.topology.topology import *
from streamsx.topology ... | wmarshall484/streamsx.topology | com.ibm.streamsx.topology/opt/python/packages/streamsx/topology/mqtt.py | Python | apache-2.0 | 7,558 |
# This file contains the WSGI configuration required to serve up your
# web application at http://khasm08.pythonanywhere.com/
# It works by setting the variable 'application' to a WSGI handler of some
# description.
#
# +++++++++++ GENERAL DEBUGGING TIPS +++++++++++
# getting imports and sys.path right can be fiddly!
... | khasm08/PythonSandbox | wsgi.py | Python | apache-2.0 | 4,161 |
import requests
import pytest
import subprocess
# ============================================================================
class TestAuto(object):
PREFIX = 'http://localhost:8089'
USER = 'testauto'
LIST_ID = ''
AUTO_ID = ''
NUM_BROWSERS = 2
@classmethod
def setup_class(cls):
c... | webrecorder/webrecorder | webrecorder/auto_tests/runauto.py | Python | apache-2.0 | 4,145 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012-2013 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache Lic... | sacharya/nova | nova/compute/api.py | Python | apache-2.0 | 164,307 |
# 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... | GabrielBrascher/cloudstack | test/integration/component/test_multiple_nic_support.py | Python | apache-2.0 | 24,109 |
# Copyright (c) 2017 Linaro Limited.
#
# SPDX-License-Identifier: Apache-2.0
'''Runner for debugging with JLink.'''
from os import path
import os
from .core import ZephyrBinaryRunner, get_env_or_bail
DEFAULT_JLINK_GDB_PORT = 2331
class JLinkBinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for the J-Link ... | fbsder/zephyr | scripts/support/runner/jlink.py | Python | apache-2.0 | 3,770 |
#!/usr/bin/env python
#
# Copyright 2015 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 required by applic... | GoogleCloudPlatformTraining/cp100-appengine-memcache-python | guestbook.py | Python | apache-2.0 | 1,998 |
# -*- coding: utf-8 -*-
"""Tests for mac notes plugin."""
from __future__ import unicode_literals
import unittest
from plaso.lib import definitions
from plaso.parsers.sqlite_plugins import mac_notes
from tests.parsers.sqlite_plugins import test_lib
class MacNotesTest(test_lib.SQLitePluginTestCase):
"""Tests for ... | rgayon/plaso | tests/parsers/sqlite_plugins/mac_notes.py | Python | apache-2.0 | 1,683 |
# Copyright 2012 OpenStack Foundation
#
# 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... | reeshupatel/demo | keystone/identity/core.py | Python | apache-2.0 | 42,880 |
import osgtest.library.core as core
import osgtest.library.files as files
import osgtest.library.osgunittest as osgunittest
class TestLcMaps(osgunittest.OSGTestCase):
required_rpms = ['lcmaps', 'lcmaps-db-templates', 'vo-client', 'vo-client-lcmaps-voms']
def test_01_configure(self):
core.config['lcma... | efajardo/osg-test | osgtest/tests/test_140_lcmaps.py | Python | apache-2.0 | 1,373 |
import cv2
import numpy as np
template = np.zeros((500,500,3),np.uint8)
template[:,:,0] = 255
template[:,:,1] = 255
template[:,:,2] = 255
x = [50,250,250,50,50]
y = [50,50,250,250,50]
cnt = np.asarray(zip(x,y))
cv2.drawContours(template,[cnt],0,0,1)
x = [100,200,200,100,100]
y = [300,300,150,150,300]
cnt = np.asar... | zooniverse/aggregation | docs/source/images/rectangle_overlap.py | Python | apache-2.0 | 713 |
from vt_manager_kvm.models import *
from vt_manager_kvm.communication.utils.XmlUtils import *
import xmlrpclib
am = xmlrpclib.Server('https://expedient:expedient@192.168.254.193:8445/xmlrpc/agent')
xml = xmlFileToString('communication/utils/queryDelete.xml')
am.send(xml)
| ict-felix/stack | vt_manager_kvm/src/python/vt_manager_kvm/tests/testdelete.py | Python | apache-2.0 | 278 |
# Copyright 2015-2015 ARM Limited
#
# 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 w... | derkling/trappy | tests/test_sched.py | Python | apache-2.0 | 5,299 |
def pytest_addoption(parser):
parser.addoption('--jenkins-docker', action='store',
default='jenkins/jenkins',
help='The Jenkins Docker container to launch')
| OddBloke/jenkins-job-linter | integration_tests/conftest.py | Python | apache-2.0 | 203 |
from ftw import ruleset, testrunner, http, errors
import pytest
import re
import random
import threading
def test_logcontains(ruleset, test):
runner = testrunner.TestRunner()
for stage in test.stages:
runner.run_stage(stage)
# Should return a test error because its searching before response
def test_s... | fastly/ftw | test/integration/test_htmlcontains.py | Python | apache-2.0 | 1,658 |
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab
import math
import scipy.special as sps
mean = 0
variance = 1
sigma = math.sqrt(variance)
def drawSampleNormal(sampleSize):
samples = np.random.normal(mean, sigma, sampleSize)
count, bins, ignored = plt.hist(samples, 80, normed... | PredictionIO/open-academy | KairatAshim/pio_assignment2/problem2/problem2.py | Python | apache-2.0 | 1,046 |
from django.contrib import admin
from widgy.admin import WidgyAdmin
from widgy.contrib.page_builder.models import Callout
admin.site.register(Callout, WidgyAdmin)
| j00bar/django-widgy | widgy/contrib/page_builder/admin.py | Python | apache-2.0 | 165 |
# The Admin4 Project
# (c) 2013-2014 Andreas Pflug
#
# Licensed under the Apache License,
# see LICENSE.TXT for conditions of usage
# http://initd.org/psycopg/docs/
import psycopg2
import select
import logger
import adm
import re
import threading
from wh import xlt, modPath
from Crypto.PublicKey._slowmath import rsa... | andreas-p/admin4 | modPg/_pgsql.py | Python | apache-2.0 | 17,772 |
# Copyright 2018 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... | xodus7/tensorflow | tensorflow/contrib/lite/python/lite_test.py | Python | apache-2.0 | 45,063 |
from sqlite3 import connect
class DB:
def __init__(self,path="people.db"):
self.conn = connect(path)
self.c = self.conn.cursor()
def getList(self):
self.c.execute('SELECT * FROM people')
return self.c.fetchall()
def close(self):
self.conn.close()
class Date:
def __init__(self, y, m, d):
self.y = i... | ScaDS/ORC-Schlange | Tutorial/02 DATE, ORCID and WorkSummary Class(Filter 1)/__main__.py | Python | apache-2.0 | 1,679 |
import os
import time
import const
import pickle
'''
Simulator class that manage the needed loop to make a
Qlearn agent to train as long as the epsilon decay
is bigger than the tolerance
'''
class Simulator(object):
# Set up environment variables
const.MAX_FLIPS = 4
const.NUM_LOOK = 3
def __init__(se... | armandosrz/UdacityNanoMachine | capstone_project/Conniption/src/simulator.py | Python | apache-2.0 | 4,855 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protocol.builtin import DataCodec
# hex: 0x021... | hazelcast/hazelcast-python-client | hazelcast/protocol/codec/multi_map_lock_codec.py | Python | apache-2.0 | 1,157 |
# Copyright (c) 2014 Mirantis 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 required by applicable law or agreed to in writing, ... | Mirantis/pumphouse | tests/unit/test_tasks_base.py | Python | apache-2.0 | 4,450 |
import serial
from threading import Thread
from menu import Menu
from time import sleep
import settings as s
import pygame
from pygame import *
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=.025)
current_mark = None
def worker():
global current_mark
while True:
read_serial = ser.readline().strip... | DrewMcCarthy/dartboard | scenemanager.py | Python | apache-2.0 | 1,324 |
# 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
# distributed under t... | reeshupatel/demo | keystone/tests/test_revoke.py | Python | apache-2.0 | 17,990 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | yongshengwang/builthue | apps/hbase/src/hbase/management/commands/hbase_setup.py | Python | apache-2.0 | 3,274 |
response.title = settings.title
response.subtitle = settings.subtitle
response.meta.author = '%(author)s <%(author_email)s>' % settings
response.meta.keywords = settings.keywords
response.meta.description = settings.description
response.menu = [
(T('Index'),URL('default','index')==URL(),URL('default','index'),[]),
... | sloe/analyseapp | models/menu.py | Python | apache-2.0 | 523 |
from .fixtures import * # noqa, pylint: disable=wildcard-import
| efiop/dvc | dvc/testing/conftest.py | Python | apache-2.0 | 65 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Appcelerator Titanium Mobile
# Copyright (c) 2011 by Appcelerator, Inc. All Rights Reserved.
# Licensed under the terms of the Apache Public License
# Please see the LICENSE included with this distribution for details.
#
# General builder script for staging, packaging, ... | arnaudsj/titanium_mobile | support/android/builder.py | Python | apache-2.0 | 74,676 |
# 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 agreed to in writing, ... | GoogleCloudPlatform/buildpacks | builders/testdata/python/functions/with_env_var/main.py | Python | apache-2.0 | 705 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.