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 |
|---|---|---|---|---|---|
import kronos
@kronos.register('0 0 * * *')
def praise():
print("Kronos makes it really easy to define and schedule "
"tasks with cron!")
@kronos.register('0 0 * * *', args={"--arg1": None, "-b": "some-arg2", "--some-list": ["site1", "site2", "site3"]})
def praise_with_args():
print("Kronos makes it r... | jeanbaptistelab/django-kronos | kronos/tests/project/cron.py | Python | mit | 626 |
"""
Copyright (C) 2020 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
... | MediaKraken/MediaKraken_Deployment | source/common/common_network_youtube_search.py | Python | gpl-3.0 | 1,346 |
"""
Link extraction for auto scraping
"""
from scrapy.utils.misc import load_object
from .base import BaseLinkExtractor, ALLOWED_SCHEMES
from .html import HtmlLinkExtractor
from .xml import XmlLinkExtractor, RssLinkExtractor, SitemapLinkExtractor, AtomLinkExtractor
from .regex import RegexLinkExtractor
from .ecsv impo... | aazen/DayOne | slybot/slybot/linkextractor/__init__.py | Python | bsd-3-clause | 1,213 |
import os
import re
import collections
import json
import stat
import copy
from fnmatch import fnmatch
from pathlib import Path, PurePosixPath
from .projman_glob import *
from cudatext import *
import cudatext_cmd
from cudax_lib import get_translation
_ = get_translation(__file__) # i18n
IS_WIN = os.name == 'nt'
... | Alexey-T/CudaText | app/py/cuda_project_man/__init__.py | Python | mpl-2.0 | 46,819 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010 Romain Bignon
#
# 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 3 of the License.
#
# This program is distributed in the hope that it will b... | jocelynj/weboob | weboob/backends/dlfp/__init__.py | Python | gpl-3.0 | 811 |
from vusion.persist import ModelManager
class TemplateManager(ModelManager):
def __init__(self, db, collection_name, **kwargs):
super(TemplateManager, self).__init__(db, collection_name, **kwargs) | texttochange/vusion-backend | vusion/persist/template/template_manager.py | Python | bsd-3-clause | 215 |
import os
import json
import yaml
import base64
import requests
class TWAPI:
def __init__(self, config_file='../config.yml'):
#print os.getcwd()
self.config_file = config_file
self.key = ''
self.secret = ''
self.bearer = ''
self.load_conf()
#self.show_c... | gr33ndata/19898 | nineteen898/twapi.py | Python | mit | 3,510 |
"""
Copyright 2010 Jason Chu, Dusty Phillips, and Phil Schalm
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 agre... | pnomolos/greatbigcrane | greatbigcrane/buildout_manage/recipetools.py | Python | apache-2.0 | 2,626 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Management script."""
import os
from glob import glob
from subprocess import call
from flask_migrate import Migrate, MigrateCommand
from flask_script import Command, Manager, Option, Server, Shell
from flask_script.commands import Clean, ShowUrls
from fansubs_cms.app i... | dyzajash/fansubs_cms | manage.py | Python | bsd-3-clause | 2,659 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
#
# Copyright (c) 2008-2011 University of Dundee.
#
# 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, either version 3 of the
# License... | jballanc/openmicroscopy | components/tools/OmeroWeb/omeroweb/webclient/forms.py | Python | gpl-2.0 | 111,021 |
from ietf.submit.parsers.base import FileParser
class XMLParser(FileParser):
ext = 'xml'
mimetype = 'application/xml'
# If some error is found after this method invocation
# no other file parsing is recommended
def critical_parse(self):
super(XMLParser, self).critical_parse()
retu... | wpjesus/codematch | ietf/submit/parsers/xml_parser.py | Python | bsd-3-clause | 345 |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
#
# Copyright (c) 2007 Mike (mosburger) Desjardins <desjardinsmike@gmail.com>
# Please do not email the above person for support. The
# email address is only there for license/copyright purposes.
#
# This is an implementation of the google plugin for a calendar a... | gilir/awn-extras-debian | applets/maintained/calendar/icscal.py | Python | gpl-3.0 | 3,344 |
# 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, ... | google/aqt | utils/common.py | Python | apache-2.0 | 1,045 |
#-*- coding: utf8 -*
#
# Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008
#
# This file is part of XYZCommander.
# XYZCommander is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | syhpoon/xyzcmd | libxyz/parser/block.py | Python | gpl-3.0 | 11,515 |
# CC150 8.1
# Design the data structure for a generic deck of cards.
class suit():
def __init__(self, v):
self.value = v
| cyandterry/Python-Study | Ninja/Concept_Implement/OOD.py | Python | mit | 134 |
# -*- coding: utf-8 -*-
#
# test_dumping.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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, o... | kristoforcarlson/nest-simulator-fork | topology/pynest/tests/test_dumping.py | Python | gpl-2.0 | 3,483 |
###############################################################################
##
## Copyright (C) 2013-2014 Tavendo GmbH
##
## 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
##
#... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/AutobahnPython/autobahn/wamp/uri.py | Python | bsd-3-clause | 5,528 |
import angr
import logging
l = logging.getLogger(name=__name__)
def convert_prot(prot):
"""
Convert from a windows memory protection constant to an angr bitmask
"""
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366786(v=vs.85).aspx
if prot & 0x10:
return 4
if prot & 0x20... | iamahuman/angr | angr/procedures/win32/VirtualAlloc.py | Python | bsd-2-clause | 3,923 |
"""Support for the (unofficial) Tado API."""
from datetime import timedelta
import logging
import urllib
from PyTado.interface import Tado
import voluptuous as vol
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.discover... | postlund/home-assistant | homeassistant/components/tado/__init__.py | Python | apache-2.0 | 6,029 |
from django.http.response import HttpResponseRedirect
from backend.logic.themes.themes import get_page
from backend.views import view
from django.shortcuts import render
__author__ = 'sdvoynikov'
@view(path=r'^$')
def index(_):
return HttpResponseRedirect('/home/')
@view(path=r'^home/$')
def index(request):
... | y-a-r-g/idea-color-themes | backend/views/home.py | Python | mit | 502 |
# -*- encoding: utf-8 -*-
#
# Copyright 2014-2015 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 ... | openstack/ceilometer | ceilometer/cmd/polling.py | Python | apache-2.0 | 3,469 |
import numpy as np
import pandas as pd
from sklearn import cross_validation
from sklearn.cross_validation import KFold
from sklearn.ensemble import RandomForestClassifier
from sklearn.grid_search import GridSearchCV, RandomizedSearchCV
from sklearn.metrics import confusion_matrix, accuracy_score
from sklearn.preproces... | ChristopherGS/sensor_readings | ML_Sandbox/algorithm_tests.py | Python | bsd-3-clause | 6,621 |
from __future__ import absolute_import
from __future__ import print_function
import argparse
import os
import sys
import ruamel
from aetros import api
from aetros.utils import read_home_config
class InitCommand:
def __init__(self, logger):
self.logger = logger
self.client = None
self.re... | aetros/aetros-cli | aetros/commands/InitCommand.py | Python | mit | 3,478 |
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
LIGHT_BLUE = (168, 201, 251)
DARK_BLUE = (111, 105, 214)
RIGHT = 'right'
LEFT = 'left'
STAND = 'stand'
SIZE = 16
MOVE_DISTANCE = 4
STANDARD_SCROLL = 10
STANDARD_BACKWARD_SCROLL = -5 | nylo-andry/run-jump-damn | constants.py | Python | mit | 227 |
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Scientific Package. This package holds all simulators, and
# analysers necessary to run brain-simulations. You can use it stand alone or
# in conjunction with TheVirtualBrain-Framework Package. See content of the
# documentation-folder for more details. See also http://ww... | stuart-knock/tvb-library | tvb/tests/library/datatypes/spectral_test.py | Python | gpl-2.0 | 6,667 |
import numpy as np
from scipy.signal import fftconvolve
from .Filter import Filter
from . import Tools
class Filter_Rect_LinSpaced(Filter) :
"""
This class define a function of time expanded using linearly spaced rectangular basis functions.
A filter f(t) is defined in the form f(t) = sum_j b_j*rect_j(... | awakenting/gif_fitting | fitgif/Filter_Rect_LinSpaced.py | Python | gpl-3.0 | 6,768 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Nico Epp and Ralf Funk
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pickle
import requests
import time
from htt... | nico-ralf-ii-fpuna/paper | waf/test_2_waf_speed/destination.py | Python | mpl-2.0 | 6,276 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import re
from django import template
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse, NoReverseMatch
register = template.Library()
def create_process_link(match):
s = match.group(0).spl... | wbg-optronix-lab/emergence-lab | project_management/templatetags/dashboard_tags.py | Python | mit | 1,405 |
# 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 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... | ChameleonCloud/horizon | openstack_dashboard/dashboards/project/floating_ips/workflows.py | Python | apache-2.0 | 7,094 |
"""
input: a loaded image;
output: [[x,y],[width,height]] of the detected mouth area
"""
import cv
def findmouth(img):
# INITIALIZE: loading the classifiers
haarFace = cv.Load('haarcascade_frontalface_default.xml')
haarMouth = cv.Load('haarcascade_mouth.xml')
# running the classifiers
storage = cv.CreateM... | divija96/Emotion-Detection | code/mouthdetection.py | Python | gpl-3.0 | 1,760 |
#!/usr/bin/env python
# Copyright 2011 Google Inc. All Rights Reserved.
"""This is the GRR client for thread pools."""
import pickle
import threading
import time
import logging
from grr.client import client
# pylint: disable=unused-import
# Make sure we load the client plugins
from grr.client import client_plugi... | ojengwa/grr | client/poolclient.py | Python | apache-2.0 | 4,657 |
import numpy as np
import pylab as py
# A new data type
fulldata = np.dtype([('Name',np.str_,20),('Period',np.float32),('H',np.float32),('Sigma_m',np.float32),('V',np.float32),('I',np.float32)])
N,P,H,Sm,V,I = np.loadtxt('data.txt',unpack=True,usecols=[0,1,2,3,4,5],dtype=fulldata)
mw = H - 0.41*(V-I)
py.scatter(P... | wilmarcardonac/hypermcmc | data/figure1GEpaper.py | Python | gpl-2.0 | 453 |
from rest_framework.views import APIView
from rest_framework.response import Response
class DrfJsonEchoViewClass(APIView):
def post(self, request, *args, **kwargs):
# brute-force compatibility with drf 2.x and 3.x
try:
data = request.data
except AttributeError:
data... | cralston0/gzip-encoding | django/drf_views.py | Python | bsd-3-clause | 565 |
# -*- coding: utf-8 -*-
#= DESCRIZIONE =================================================================
# 2 7 -2 serpidi
# Questo script non permette ad un player di andare verso una direzione se non
# ha un permesso speciale di Chadyne oppure non uccide il mob di guardia
#= IMPORT ================================... | Onirik79/aaritmud | data/proto_rooms/serpidi/serpidi_room_8653_01.py | Python | gpl-2.0 | 1,462 |
# -*- coding: utf-8 -*-
DESCRIPTION = (
'A flask extension that provides one application programming interface ' +
'to read and write data in different excel file formats' +
''
)
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. Fo... | chfw/Flask-Excel | docs/source/conf.py | Python | bsd-3-clause | 3,383 |
__author__ = 'tom1231'
from PyQt4.QtGui import *
from BAL.Interface.DeviceFrame import DeviceFrame, EX_DEV, SMOOTHER
from lxml.etree import SubElement
class VelocitySmoother(DeviceFrame):
def __init__(self,frame, data):
DeviceFrame.__init__(self, EX_DEV, frame, data)
self._diffDriverTopic = 'diff/... | robotican/ric | ric_board/scripts/RiCConfigurator/BAL/Devices/velocitySmoother.py | Python | bsd-3-clause | 8,523 |
#!/usr/bin/env python
#
# Copyright 2016 timercrack
#
# 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... | timercrack/pydatacoll | pydatacoll/utils/logger.py | Python | apache-2.0 | 1,464 |
from threading import Timer
class RepeatedTimer(object):
def __init__(self, interval, function, *args, **kwargs):
# type: (int, callable, tuple[Any], dict[str, Any]) -> None
super(RepeatedTimer, self).__init__()
self.name = None
self.daemon = False
self.interval = interval
... | FlorianSauer/PyDrop | PyDrop/RepeatedTimer.py | Python | mit | 1,207 |
import os
import pathlib
from unittest import mock
import pytest
from mopidy.internal import xdg
@pytest.fixture
def environ():
patcher = mock.patch.dict(os.environ, clear=True)
yield patcher.start()
patcher.stop()
def test_cache_dir_default(environ):
assert xdg.get_dirs()["XDG_CACHE_DIR"] == (
... | jcass77/mopidy | tests/internal/test_xdg.py | Python | apache-2.0 | 1,750 |
"""publication_manager URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home... | vivitc/publication-manager | publication_manager/urls.py | Python | apache-2.0 | 775 |
from django.conf import settings
from django.utils.hashcompat import sha_constructor
if not hasattr(settings, 'PHASED_SECRET_DELIMITER'):
settings.PHASED_SECRET_DELIMITER = sha_constructor(getattr(settings, 'SECRET_KEY', '')).hexdigest()
# quoting the sekrit delimiter to make sure Debug Toolbar doesn't render it
... | OmarIthawi/django-phased | phased/models.py | Python | bsd-3-clause | 397 |
#!/usr/bin/python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it w... | bbradbury/yum-utils | debuginfo-install.py | Python | gpl-2.0 | 7,411 |
# -*- coding: utf-8 -*-
# System modules
import logging
import os
# External modules
# Internal modules
from . import utils
from . import interfaces
from . import numericalschemes
from . import numericalmodel
from . import equations
from . import test_data
from . import test_flow
def runtest(module, verbose=False):... | nobodyinperson/python3-numericalmodel | tests/__init__.py | Python | gpl-3.0 | 771 |
#! /usr/bin/env python3
"""
Show and Tell
"""
import showandtell
from bottle import run
# Create the Database
showandtell.db.Base.metadata.create_all()
run(host='localhost', port=8080, debug=True)
| ColoradoSchoolOfMines/show-and-tell | app.py | Python | gpl-3.0 | 202 |
'''
Berkelium extension demo
========================
Check http://github.com/kivy/kivy-berkelium for more information.
You must have berkelium-1.2 extension installed before running the demo
'''
from kivy.uix.scatter import Scatter
from kivy.uix.floatlayout import FloatLayout
from kivy.app import App
from kivy.ext ... | kivy/kivy-berkelium | demo/main.py | Python | bsd-3-clause | 841 |
# Compiled by Charles Harris, dated October 3, 2002
# updated to 2002 values by BasSw, 2006
# Updated to 2006 values by Vincent Davis June 2010
# Updated to 2014 values by Joseph Booker, 2015
"""
Fundamental Physical Constants
------------------------------
These constants are taken from CODATA Recommended Values of ... | gertingold/scipy | scipy/constants/codata.py | Python | bsd-3-clause | 115,314 |
import re
import socket
import errno
import select
import logging
import queue as q
import event_util as eu
import time
import numerics as nu
class Network(object):
'''
Handles messages to the socket
Consists of a few basic functions aside from sending/receiving.
Sending NICK, USER, message parsing, ... | optimumtact/simplepybot | network.py | Python | mit | 13,092 |
"""
weasyprint.tests.test_draw.test_tables
--------------------------------------
Test how tables are drawn.
"""
import pytest
from weasyprint.html import HTML_HANDLERS
from ..testing_utils import assert_no_logs
from . import assert_pixels, parse_pixels
PIX_BY_CHAR_OVERRIDES = {
# rgba(255, 0, 0, 0... | Kozea/WeasyPrint | tests/draw/test_table.py | Python | bsd-3-clause | 40,615 |
# Copyright 2014 VMware, 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 a... | subramani95/neutron | neutron/plugins/vmware/nsxlib/switch.py | Python | apache-2.0 | 16,354 |
# -*- coding: utf-8 -*-
# Comments and reviews for records.
# This file is part of Invenio.
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by... | jirikuncar/invenio | invenio/legacy/webcomment/webinterface.py | Python | gpl-2.0 | 47,121 |
"""PostProcessor for serving reveal.js HTML slideshows."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import os
import webbrowser
from tornado import web, ioloop, httpserver
from tornado.httpclient import AsyncHTTPClient... | bdh1011/wau | venv/lib/python2.7/site-packages/nbconvert/postprocessors/serve.py | Python | mit | 3,653 |
import json
from collections import namedtuple
import fauxfactory
import pytest
from riggerlib import recursive_update
from widgetastic.utils import partial_match
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.fixtures.provider import setup_or_skip
from cfme.infrastructure.provider.rhevm import... | RedHatQE/cfme_tests | cfme/fixtures/v2v_fixtures.py | Python | gpl-2.0 | 22,048 |
# This file is part of Fail2Ban.
#
# Fail2Ban 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.
#
# Fail2Ban is distributed in the hope t... | carlgao/lenga | images/lenny64-peon/usr/share/fail2ban/client/jailreader.py | Python | mit | 5,180 |
#!python3
from help_in_test import tests
import import_from_parent_dir
#The following line needs to be changed
import largest_prime_factor as cur_module
list_funcs = [x for x in dir(cur_module)
if x.startswith('_') is False]
for i in list_funcs:
f = getattr(cur_module, i)
#The following tests n... | anshbansal/general | Python3/functions/tests/test_largest_prime_factor.py | Python | mit | 490 |
<<<<<<< HEAD
<<<<<<< HEAD
from __future__ import unicode_literals
import unittest
if __name__ == "__main__":
unittest.main()
=======
from __future__ import unicode_literals
import unittest
if __name__ == "__main__":
unittest.main()
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
=======
from __future__ imp... | ArcherSys/ArcherSys | Lib/test/test_future4.py | Python | mit | 455 |
#
# This file contains functions and constants to talk
# to and from a Novation Launchpad via MIDI.
#
# Created by paul for mididings.
from mididings import *
# MEASURES - constants useful for the Pad
side = list(range(0, 8))
longside = list(range(0, 9))
step = 16 # vertical gap on pad
FirstCtrl = 104 # ctrl o... | m4773rcl0ud/launchpaddings | launchpad_utils.py | Python | gpl-3.0 | 4,442 |
# ==============================================================================
# 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/restriction/restriction/resource.py | Python | lgpl-3.0 | 4,071 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of CKAN DataStore Restful Extension.
# CKAN DataStore Restful Extension is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License as published by... | conwetlab/ckanext-datastore_restful | ckanext/datastore_restful/plugin.py | Python | agpl-3.0 | 3,308 |
from django.conf.urls import include, url
from django.apps import apps as djangoapps
def load_namespaced_urls(urlpatterns, *app_labels):
"""
:param patterns urlpatterns: The django url patterns object
add any urls.py for apps with tiles. namespaced to the app name.
"""
for app_label in app_labels:... | dgreisen-cfpb/pantheon | devdash/tiles/urls.py | Python | cc0-1.0 | 482 |
import pytest
from pytest import approx
import time
from fakeredis import FakeStrictRedis
from celery_once.backends.redis import parse_url, Redis
from celery_once.tasks import AlreadyQueued
from redis.lock import Lock as RedisLock
def test_parse_redis_details_tcp_default_args():
details = parse_url('redis://loca... | cameronmaske/celery-once | tests/unit/backends/test_redis.py | Python | bsd-2-clause | 3,364 |
from i3pystatus import SettingsBase, IntervalModule, formatp
from i3pystatus.core.util import user_open, internet, require
class Backend(SettingsBase):
settings = ()
class Weather(IntervalModule):
'''
This is a generic weather-checker which must use a configured weather
backend. For list of all avai... | eBrnd/i3pystatus | i3pystatus/weather/__init__.py | Python | mit | 6,014 |
# Copyright 2019 The Dreamer 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... | google-research/dreamer | dreamer/tools/summary.py | Python | apache-2.0 | 8,108 |
# -*- coding: utf-8 -*-
__license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
from PyQt5.Qt import QListWidgetItem, Qt
from calibre.gui2.convert.txt_input_ui import Ui_Form
from calibre.gui2.convert import Widget
from calibre.ebooks.conversion.plugin... | jelly/calibre | src/calibre/gui2/convert/txt_input.py | Python | gpl-3.0 | 2,232 |
# -*- coding: utf-8 -*-
# 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 Apach... | apache/incubator-allura | Allura/allura/controllers/root.py | Python | apache-2.0 | 3,789 |
import ipaddress
class IpValidation():
"""
set of static functions, used to validate ips
"""
class InvalidIpException(Exception):
"""
is raise if a ip is not valid
"""
def __init__(self, ip_string):
"""
:param ip_string: the ip which caused this ... | jdepoix/goto_cloud | goto_cloud/migration_plan_parsing/network_mapping.py | Python | mit | 16,295 |
# -*- coding: UTF-8 -*-
'''
Debug
==========
O objetivo desta classe é criar uma interface única para mostrar informacões de debug.
Caso seja necessário restringir o nível de informacões no log, você pode modificar o valor
da variável *loglevel* para qualquer uma das constantes LOG_ALL, LOG_NOTE, LOG_WARN ou
LOG_ERR... | drpexe/sigmawebplus | src/service/debug.py | Python | mit | 1,902 |
#!/usr/bin/python
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | donspaulding/adspygoogle | examples/adspygoogle/dfp/v201306/get_forecast_by_id.py | Python | apache-2.0 | 1,936 |
#!/usr/bin/env python
# ---------------------------------------------------------------------------
# Licensing Information: You are free to use or extend these projects for
# education or reserach purposes provided that (1) you retain this notice
# and (2) you provide clear attribution to UC Berkeley, including a lin... | MPC-Berkeley/barc | workspace/src/data_service/scripts/upload.py | Python | mit | 4,719 |
import os
import typing
from ..constants import DATA_HOME_DEFAULT_DIRNAME, DATA_HOME_ENV_VAR_NAME, DATA_HOME_SUB_DIRNAME
DataDirname = typing.NewType("DataDirname", str)
def data_dirname() -> DataDirname:
base_data_dir_name = os.getenv(DATA_HOME_ENV_VAR_NAME, os.path.expanduser(DATA_HOME_DEFAULT_DIRNAME))
... | larose/utt | utt/components/data_dirname.py | Python | gpl-3.0 | 396 |
# Copyright 2012-2013, Damian Johnson and The Tor Project
# See LICENSE for licensing information
import binascii
import stem.response
import stem.socket
import stem.util.str_tools
import stem.util.tor_tools
class AuthChallengeResponse(stem.response.ControlMessage):
"""
AUTHCHALLENGE query response.
:var str... | ouzel/stem | stem/response/authchallenge.py | Python | lgpl-3.0 | 1,910 |
import xml.dom.minidom as dom
from kml import kml
import json
import sys
import traceback
def kml_to_geojson(kml_file, output_name):
kml_one = dom.parse(kml_file) # parse KML file using minidom
if not output_name.endswith(".geojson"):
output_name += ".geojson"
with open( output_name, 'w') as o... | JamesMilnerUK/Loxo | conversiontools/kml2geojson.py | Python | mit | 1,060 |
#!/usr/bin/env python3
"""
A program to count Sundays in a century
"""
sun=0
mon=1
tue=2
wed=3
thu=4
fri=5
sat=6
def check_leap_year(year):
if year%100==0:
year/=100
if year%4==0:
return True
else:
return False
class Year(object):
def __init__(self, year, first_day):
... | Bolt64/my_code | euler/counting_sundays.py | Python | mit | 2,247 |
#Faça um programa que receba dois números inteiros e gere os números inteiros que estão no intervalo compreendido por eles.
a=int(input('valor incial'))
print (a)
b=int(input('valor final'))
print (b)
while a<b:
print(a)
a=a+1
| erikaklein/algoritmo---programas-em-Python | GerarNumeroNoIntervalo.py | Python | mit | 251 |
# Copyright 2012 Dorival de Moraes Pedroso. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from __future__ import print_function # for Python 3
import sys
from numpy import linspace, zeros, sin, pi
from pylab import axis, ... | cpmech/tlfem | tlfem/test/t_patchrecov.py | Python | bsd-3-clause | 3,807 |
#!/usr/bin/python
r"""
PYTHONRC
========
Initialization script for the interactive Python interpreter. Its main purpose
is to enhance the overall user experience when working in such an environment
by adding some niceties to the standard console.
It also works with IPython and BPython, although its utility in that kin... | 0xf4/pythonrc | pythonrc.py | Python | mit | 19,310 |
from wheelcms_axle.content import Content, FileContent, ImageContent
from wheelcms_axle.spoke import Spoke, action, FileSpoke
from wheelcms_axle.content import type_registry
from django.db import models
class Type1(Content):
t1field = models.TextField(null=True, blank=True)
class Type1Type(Spoke):
model = T... | wheelcms/wheelcms_axle | wheelcms_axle/tests/models.py | Python | bsd-2-clause | 2,181 |
#
# 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
# distr... | openstack/python-openstackclient | openstackclient/volume/v2/volume_backup.py | Python | apache-2.0 | 19,343 |
import MySQLdb
from MySQLdb.connections import *
class DirectMySQLdbConnection(Connection):
### DCR: from MySQLdb connections.py Connection.__init__
def __init__(self, *args, **kwargs):
### DCR: fixed up relative imports
from MySQLdb.constants import CLIENT, FIELD_TYPE
from MySQLdb.conv... | hj3938/panda3d | direct/src/directutil/DirectMySQLdbConnection.py | Python | bsd-3-clause | 4,471 |
'''
1) Реализовать метод Гаусса с выбором по столбцу - Done
2) построить с его помощью оценщик числа обусловленности матрицы системы в строчной норме;
3) протестировать качество данного оценщика и получаемой с его помощью
оценкой относительной погрешности решения через вектор невязки.
стр.36 (снизу) - оценщик срочно... | maxmalysh/congenial-octo-adventure | mod1/task3.py | Python | unlicense | 5,323 |
# ===========================================================================
# eXe
# Copyright 2004-2005, University of Auckland
# Copyright 2004-2008 eXe Project, http://eXeLearning.org/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... | luisgg/iteexe | exe/export/singlepage.py | Python | gpl-2.0 | 6,261 |
#!usr/bin/env python
'''Eyelog.py is a module that contains of all classes needed to
create an logfile for the analysis of behavioral experiments
that yield eyemovement data.
In theory an experiment consists of a series of trials.
In a trial are a number of events that can occur. Events
are the occurence of samples of ... | UiL-OTS-labs/iSpector | log/eyelog.py | Python | gpl-2.0 | 24,902 |
from openpnm.phases import mixtures
import openpnm.models as mods
class H2O(mixtures.GenericSpecies):
r"""
Creates Phase object with preset models and values for H2O ions
Parameters
----------
network : OpenPNM Network object
The network to which this phase object will be attached.
p... | TomTranter/OpenPNM | openpnm/phases/mixtures/species/liquids/H2O.py | Python | mit | 1,203 |
# -*- coding: utf-8 -*-
#
# OppiaMobile-Server documentation build configuration file, created by
# sphinx-quickstart on Tue Jun 25 16:03:07 2013.
#
# 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 fi... | DigitalCampus/django-nurhi-oppia | docs/conf.py | Python | gpl-3.0 | 8,476 |
from HTMLComponent import HTMLComponent
from GUIComponent import GUIComponent
from config import KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS, ConfigElement, ConfigText, ConfigPassword
from Components.ActionMap import NumberActionMap... | popazerty/bnigma2 | lib/python/Components/ConfigList.py | Python | gpl-2.0 | 7,993 |
#
# Copyright (c) 2017 SUSE Linux GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRAN... | tomschr/sdsc | src/sdsc/__init__.py | Python | lgpl-2.1 | 1,375 |
# Copyright 2013 OpenStack Foundation
# 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 requ... | Juniper/tempest | tempest/api/identity/admin/v3/test_roles.py | Python | apache-2.0 | 19,049 |
MAX_DEPTH = 2
#class StatementGenerator(BaseGenerator):
# def generate(self, depth): raise NotImplementedError
######################################################################
# Expressions
class ExpressionGenerator(object):
def generate(self, depth): raise NotImplementedError
class BinaryExpression(E... | slozier/ironpython2 | Tests/test_fuzz_parser.py | Python | apache-2.0 | 13,629 |
#
# The Multiverse Platform is made available under the MIT License.
#
# Copyright (c) 2012 The Multiverse Foundation
#
# 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 restrict... | longde123/MultiversePlatform | server/config/common/instance.py | Python | mit | 1,301 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# The MIT License
#
# Copyright (c) 2016 Grigory Chernyshev
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation file... | grundic/yagocd | tests/test_pipeline_entity.py | Python | isc | 11,256 |
"""
Django settings for quixotic_webapp project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
i... | zcarwile/quixotic_webapp | quixotic_webapp/settings.py | Python | gpl-3.0 | 3,517 |
"""Overall happening configuration."""
| happeninghq/happening | src/happening/__init__.py | Python | mit | 39 |
# pyresample, Resampling of remote sensing image data in python
#
# Copyright (C) 2010-2015
#
# Authors:
# Esben S. Nielsen
# Thomas Lavergne
#
# This program 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 F... | jhamman/pyresample | pyresample/geometry.py | Python | lgpl-3.0 | 31,169 |
#!/usr/bin/env python
import argparse
import datetime
import os
import os.path as osp
os.environ['MPLBACKEND'] = 'Agg' # NOQA
import chainer
import fcn
from train_fcn32s import get_data
from train_fcn32s import get_trainer
here = osp.dirname(osp.abspath(__file__))
def main():
parser = argparse.ArgumentPars... | wkentaro/fcn | examples/voc/train_fcn16s.py | Python | mit | 2,034 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# 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
#... | MostlyOpen/odoo_addons_jcafb | myo_annotation_cst/models/annotation_seq.py | Python | agpl-3.0 | 1,352 |
import pytest
from robot_server.service.legacy.models import networking
def test_validate_configuration_deduce_security_psk():
n = networking.WifiConfiguration(ssid="a", psk="abc")
expected = networking.NetworkingSecurityType.wpa_psk
assert n.securityType == expected
def test_validate_configuration_dedu... | Opentrons/labware | robot-server/tests/service/legacy/models/test_networking.py | Python | apache-2.0 | 2,327 |
"""Provide the device conditions for NEW_NAME."""
from typing import Dict, List
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_CONDITION,
CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_ENTITY_ID,
CONF_TYPE,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import HomeA... | tboyce021/home-assistant | script/scaffold/templates/device_condition/integration/device_condition.py | Python | apache-2.0 | 2,573 |
from __future__ import unicode_literals
import datetime
from django.core import signing
from django.test import SimpleTestCase
from django.test.utils import freeze_time
from django.utils import six
from django.utils.encoding import force_str
class TestSigner(SimpleTestCase):
def test_signature(self):
"... | WillGuan105/django | tests/signing/tests.py | Python | bsd-3-clause | 5,473 |
from .downloader import Downloader
async def setup(bot):
cog = Downloader(bot)
bot.add_cog(cog)
cog.create_init_task()
| palmtree5/Red-DiscordBot | redbot/cogs/downloader/__init__.py | Python | gpl-3.0 | 133 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Alex
# @Date: 2015-11-16 19:21:37
# @Last Modified by: Alex
# @Last Modified time: 2015-12-21 22:10:00
from django.conf.urls import url
from .views import (PurchOrderListView,
PurchOrderRecentListView,
PurchOrderOpenLis... | alexharmenta/Inventationery | Inventationery/apps/PurchOrder/urls.py | Python | bsd-3-clause | 1,457 |
# -*- coding: utf-8 -*-
#
# exercise 5: more variables and printing
#
# string formating
name = 'Zed A. Shaw'
ages = 35 # not a lie
height = 74 # inched
weight = 180 # lbs
eyes = 'Blue'
teeth = 'White'
hair = 'Brown'
print "Let's talk about %s." % name
print "He's %d inched tall." % height
print "He's %d pounds hea... | zstang/learning-python-the-hard-way | ex5.py | Python | mit | 635 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.