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 |
|---|---|---|---|---|---|
from __future__ import absolute_import
from __future__ import print_function
def print_host(name, id, state, msg=None, indent = " "):
"""msg, if present, is printed (with a two-space indent) after the normal
line."""
print("%-24s %-25s %s" % (name, id, state))
if msg:
print(indent + ("\n" + i... | unixnut/cloud-support | shepherd/formatting.py | Python | gpl-2.0 | 350 |
import pytest
from kolibri.plugins import DEFAULT_PLUGINS
from kolibri.plugins.utils import enable_plugin
@pytest.mark.parametrize("plugin", DEFAULT_PLUGINS)
def test_can_enable_all_default_plugins(plugin):
assert enable_plugin(plugin)
| learningequality/kolibri | kolibri/plugins/utils/test/test_default_plugins.py | Python | mit | 243 |
# pysloc/pysloc/__init__.py
""" Library for the pySloc line counter. """
import hashlib
import re
from stat import S_ISDIR, S_ISREG # GETS DROPPED IF USING SCANDIR
import os
# try:
# from os import scandir
# except ImportError:
# from scandir import scandir
from bs4 import BeautifulSoup, Comment
__all__ = [... | jddixon/pysloc | src/pysloc/__init__.py | Python | mit | 71,178 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import mimetypes
from flexget import plugin
from flexget.event import event
log = logging.getLogger('nzb_size')
# a bit hacky, add nzb as a known mimetype... | jawilson/Flexget | flexget/plugins/metainfo/nzb_size.py | Python | mit | 2,284 |
from os import environ
from os.path import dirname, abspath, join
from django.urls import reverse_lazy
SITE_DIR = dirname(abspath(__file__))
# Security
SECRET_KEY = environ.get('SECRET_KEY', '')
DEBUG = True
ALLOWED_HOSTS = [] + environ.get('ALLOWED_HOSTS', '').split(',')
# Application definition
INSTALLED_AP... | AccentDesign/wagtailstreamforms | example/settings.py | Python | mit | 3,558 |
#! /usr/bin/env python
# -*- coding: latin-1 -*-
from collections import deque, defaultdict
import itertools
import time
import invariants
import pddl
import timers
class BalanceChecker(object):
def __init__(self, task, reachable_action_params):
self.predicates_to_add_actions = defaultdict(set)
... | rock-planning/planning-lama | lama/translate/invariant_finder.py | Python | gpl-3.0 | 5,900 |
__author__ = 'wei'
from push.igetui.template.igt_base_template import *
class IGtMessage:
def __init__(self):
self.isOffline = False
self.offlineExpireTime = 0
self.data = BaseTemplate()
class IGtSingleMessage(IGtMessage) :
def __init__(self):
IGtMessage.__init__(self)
class I... | KasenJ/CommunityPython | code/push/igetui/igt_message.py | Python | gpl-2.0 | 614 |
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module containing the sync stages."""
import contextlib
import datetime
import logging
import os
import sys
from xml.etree import ElementTree
from... | bpsinc-native/src_third_party_chromite | cbuildbot/stages/sync_stages.py | Python | bsd-3-clause | 41,804 |
#!/usr/bin/env python
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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, eithe... | Branlala/docker-sickbeardfr | sickbeard/autoProcessTV/hellaToSickBeard.py | Python | mit | 979 |
"""The test for the min/max sensor platform."""
import unittest
from homeassistant.bootstrap import setup_component
from homeassistant.const import (
STATE_UNKNOWN, ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS, TEMP_FAHRENHEIT)
from tests.common import get_test_home_assistant
class TestMinMaxSensor(unittest.TestCase):... | srcLurker/home-assistant | tests/components/sensor/test_min_max.py | Python | mit | 5,377 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import functools
import mock
from django.template.loader import render_to_string
from exam import fixture
from sentry.interfaces.base import InterfaceValidationError
from sentry.interfaces.stacktrace import (
Frame, Stacktrace, get_context, slim_fra... | JamesMura/sentry | tests/sentry/interfaces/test_stacktrace.py | Python | bsd-3-clause | 23,486 |
#base1
import base64
print base64.b64encode('binary\x00string')
print base64.b64decode('YmluYXJ5AHN0cmluZw==')
print base64.urlsafe_b64encode('i\xb7\xfb\xef\xff')
print base64.urlsafe_b64decode('abcd--__')
'abcd' -> 'YWJjZA=='
print base64.b64decode('YWJjZA==')
print safe_b64decode('YWJjZA') | zengboming/python | base1.py | Python | apache-2.0 | 297 |
#!/usr/bin/python
# Copyright 2008 Jurko Gospodnetic, Vladimir Prus
# Copyright 2011 Steven Watanabe
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
# Added to guard against a bug causing targets to be used before they
# th... | davehorton/drachtio-server | deps/boost_1_77_0/tools/build/test/core_parallel_multifile_actions_2.py | Python | mit | 1,621 |
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | williamFalcon/pytorch-lightning | tests/trainer/optimization/test_optimizers.py | Python | apache-2.0 | 24,264 |
'''
Hugefiles urlresolver plugin
Copyright (C) 2013 Vinnydude
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is ... | wndias/bc.repository | script.module.urlresolver/lib/urlresolver/plugins/hugefiles.py | Python | gpl-2.0 | 2,636 |
""" Overrides for Docker-based devstack. """
from openedx.stanford.lms.envs.devstack import * # pylint: disable=wildcard-import, unused-wildcard-import
# Docker does not support the syslog socket at /dev/log. Rely on the console.
LOGGING['handlers']['local'] = LOGGING['handlers']['tracking'] = {
'class': 'loggin... | Stanford-Online/edx-platform | lms/envs/devstack_docker.py | Python | agpl-3.0 | 2,707 |
# sqlalchemy/ext/baked.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Baked query extension.
Provides a creational pattern for the :class:`.que... | hsum/sqlalchemy | lib/sqlalchemy/ext/baked.py | Python | mit | 16,735 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | hryamzik/ansible | lib/ansible/modules/network/iosxr/iosxr_banner.py | Python | gpl-3.0 | 8,287 |
from battlenet.community import Community
class Character(Community):
ENDPOINT = '/wow/character/%s/%s'
def __init__(self, *args, **kwargs):
super(Character, self).__init__(*args, **kwargs)
self.name = kwargs.get('name', None)
self.realm = kwargs.get('realm', None)
if kwarg... | elryndir/GuildPortal | battlenet/community/wow/characters.py | Python | mit | 1,473 |
from pydsp import *
PyDSP().configure_traits(view=view1)
| antiface/PyDSP-1 | pydsp/__main__.py | Python | bsd-2-clause | 59 |
"""
Model objects used to represent data from the JPER account system
"""
from flask.ext.login import UserMixin
from werkzeug import generate_password_hash, check_password_hash
from octopus.core import app
from service import dao
from octopus.lib import dataobj
class Account(dataobj.DataObj, dao.AccountDAO, UserMixi... | JiscPER/jper-sword-out | service/models/account.py | Python | apache-2.0 | 3,096 |
#! /usr/bin/env python
# libraries
import os, sys, subprocess, time, threading
from PIL import Image
# own modules and packages
from packages import rmconfig, rmmedia, rmutil, rmnetwork
from packages.rmnetwork import udpserver, tcpfilesocket, udpbroadcaster, messages, GroupManager
from constants import *
config = {}... | xserty/piDS | Raspberry/rasp-mediaplayer.py | Python | apache-2.0 | 4,051 |
import matplotlib.mlab as mlab
import numpy as np
from .recursive import KWS, alias
from .plotclasses import (XYPlot, xyplot)
@xyplot.decorate()
def xcorr(plot, *args, **kwargs):
""" PlotFactory Wrapper of function xcorr
contrarly to matplolib.xcorr, xcorr return a new xyplot-like instance
ready to plot ... | SylvainGuieu/smartplotlib | correlations.py | Python | gpl-2.0 | 3,932 |
import os
import pygame
import sys
import wx
from wiggler.core.events import StageEvents
from wiggler.engine.stage import Stage
tilemap = dict()
class StagePane(wx.Control):
def __init__(self, parent, id, resources, events, **options):
wx.Control.__init__(*(self, parent, id), **options)
self.pa... | ProgrammaBol/wiggler | wiggler/ui/stagepane.py | Python | gpl-3.0 | 3,150 |
from uaperrors import StepError
import sys
from abstract_step import *
import glob
import misc
import process_pool
import yaml
import os
from logging import getLogger
logger = getLogger('uap_logger')
class StringtieMerge(AbstractStep):
'''
# stringtie --merge <gtf.list> > outputpat/outputname
StringTi... | kmpf/uap | include/steps/stringtieMerge.py | Python | gpl-3.0 | 6,723 |
'''BADA Coefficient file loader
This module provides access to the performance data contained in the various
BADA data files.
The current implementation is based on the official documentation described in
report: EEC Technical/Scientific Report No. 14/04/24-44. This report can be obtained here:
https:/... | ethertricity/bluesky | bluesky/traffic/performance/legacy/coeff_bada.py | Python | gpl-3.0 | 9,017 |
# coding:utf-8
import url_manager, html_downloader, html_parser, html_outputer
import traceback
import iMessage
class Crawl(object):
def __init__(self):
self.urls = url_manager.UrlManager()
self.downloader = html_downloader.HtmlDownloader()
self.parser = html_parser.HtmlParser()
sel... | newbee-7/News_Crawl | crawl.py | Python | mit | 1,994 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | SHH_WT_models/SHH_WT_models_final_output_0.1_-0.1_11000/mtx1_models/SHH_WT_models9585.py | Python | gpl-3.0 | 17,572 |
import time
import os
import sys
import threading
import importlib
#import mttkinter as tkinter
from tkinter import ttk
import tkinter.font
KRCC_MODULE_DECLARATION = 'DECLARE_' + 'KRCC' + '_MODULE'
krcc_modules = []
for dirpath, _, filenames in os.walk(os.getcwd()):
for filename in filenames:
if not filename.en... | jsartisohn/krpc_scripts | main.py | Python | agpl-3.0 | 5,741 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2011 Tim G L Lyons
#
# 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; eith... | sam-m888/gramps | gramps/gen/filters/rules/place/_hascitation.py | Python | gpl-2.0 | 1,909 |
# -*- coding: utf-8 -*-
from django.db import models
from apps.registro.models.Anexo import Anexo
from apps.seguridad.models.Usuario import Usuario
from apps.seguridad.audit import audit
@audit
class AnexoCertificacionCarga(models.Model):
anexo = models.ForeignKey(Anexo, related_name='certificacion_carga')
an... | MERegistro/meregistro | meregistro/apps/registro/models/AnexoCertificacionCarga.py | Python | bsd-3-clause | 571 |
vals = IN[0]
elementlist = []
for val in vals:
elementlist.append(hex(val))
OUT = elementlist | andydandy74/ClockworkForDynamo | nodes/0.9.x/python/Math.DecimalToHex.py | Python | mit | 94 |
"""Test the TcEx Batch Module."""
# third-party
import pytest
# pylint: disable=no-self-use
class TestUtils:
"""Test the TcEx Batch Module."""
@pytest.mark.parametrize(
'variable,value',
[
('#App:0002:b1!Binary', b'bytes 1'),
('#App:0002:b2!Binary', b'bytes 2'),
... | kstilwell/tcex | tests/playbooks/test_playbook_binary_types.py | Python | apache-2.0 | 8,370 |
import unittest
import os
import logging
from osm2gtfs.tests.creators.creators_tests import CreatorsTestsAbstract
# Define logging level
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
class TestCreatorsNiManagua(CreatorsTestsAbstract):
def _get_selector(self):
return "ni_managua"
def... | nlehuby/osm2gtfs | osm2gtfs/tests/creators/tests_ni_managua.py | Python | gpl-3.0 | 1,515 |
import sys, os
import pyentropy
# BEFORE importing disutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
if os.path.exists('MANIFEST'): os.remove('MANIFEST')
from distutils.core import setup
from distutils.extension import Extension
from distutils.command.build_ext... | robince/pyentropy | setup.py | Python | gpl-2.0 | 2,767 |
from django.core.cache import cache
from airmozilla.starred.models import StarredEvent
def stars(request):
context = {}
if request.user.is_active:
context['star_ids'] = _get_star_ids(request.user)
return context
def _get_star_ids(user):
cache_key = 'star_ids%s' % user.id
as_string = cac... | chirilo/airmozilla | airmozilla/starred/context_processors.py | Python | bsd-3-clause | 659 |
#!/usr/bin/env python
# This file is part of ntdsxtract.
#
# ntdsxtract 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.
#
# ntdsxtract ... | csababarta/ntdsxtract | dsfileinformation.py | Python | gpl-3.0 | 3,281 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# BEGIN LICENSE
# Copyright (C) 2019, Wolf Vollprecht <w.vollprecht@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 3, as published
# by the Free So... | wolfv/uberwriter | uberwriter/inline_preview.py | Python | gpl-3.0 | 12,369 |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... | mjeanson/jenkins-job-builder | jenkins_jobs/modules/general.py | Python | apache-2.0 | 7,787 |
# -*- coding: utf-8 -*-
# Copyright 2008 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''This module reads an XML file defining zim pages.
For now the only XML tags which are supported are 'section' and 'page'. The
'section' tag serves as a container for multiple pages. The 'page' tag serves
as a container for the ... | fabricehong/zim-desktop | zim/stores/xml.py | Python | gpl-2.0 | 3,065 |
from rsf.proj import *
import dix
mig2cip = None
def velcon(data, # data name
nv, # continuation steps
v0, # initial velocity
dv, # velocity step
nx, # lateral dimension
nh, # number of offsets
padt, ... | zxtstarry/src | book/Recipes/velcon.py | Python | gpl-2.0 | 4,733 |
from pyblish import api
from pyblish_bumpybox import inventory
reload(inventory)
class ExtractConstructionHistory(api.InstancePlugin):
""" Option to extract the with/without construction history. """
order = inventory.get_order(__file__, "ExtractConstructionHistory")
families = ["mayaAscii", "mayaBinary"... | Bumpybox/pyblish-bumpybox | pyblish_bumpybox/plugins/maya/lookdev/extract_construction_history.py | Python | lgpl-3.0 | 525 |
# -*- coding: utf-8 -*-
import time
from odoo import api, models, _
from odoo.tools import float_is_zero
from datetime import datetime
from dateutil.relativedelta import relativedelta
class ReportAgedPartnerBalance(models.AbstractModel):
_name = 'report.account.report_agedpartnerbalance'
def _get_partner_m... | ayepezv/GAD_ERP | addons/account/report/account_aged_partner_balance.py | Python | gpl-3.0 | 10,087 |
import datetime
import os
from django.conf import settings
from django.db import models
from django.db.models import Count
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
from easy_thumbnails.files import get_thumbnailer
from radpress.compat import User
from ra... | ifearcompilererrors/fle_redesign | fle_redesign/apps/radpress/models.py | Python | mit | 5,522 |
import re
def test_pattern(word):
pattern = r"\b{}\b".format(re.sub(r"([\.\^\$\*\+\?\{\}\[\]\|\(\)])", r'\\\1', r""+word+""))
print pattern
def test_pattern2(word):
pattern = r"{}".format(r"{}".format(word).replace(r'\\', r'\\\\'))
print pattern
test_pattern(r"i have a * in this string. This ... | RohitMetaCube/test_code | test_patterns.py | Python | gpl-3.0 | 525 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py | Python | mit | 321,990 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2016 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... | jitka/weblate | weblate/trans/templatetags/permissions.py | Python | gpl-3.0 | 3,755 |
# -*- coding: utf-8 -*-
from os import sys, path
import schedule
from time import sleep
from bottle.ext.mongo import MongoPlugin
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from mining.utils import conf, log_it
from mining.tasks import process
log_it("START", "bin-scheduler")
onrun = {}
regi... | chrisdamba/mining | mining/bin/scheduler.py | Python | mit | 4,168 |
#!usr/bin/env python
import re
from parameter.common_parameters import common_parameters
import utils.setting_utils as utils
utils.now_time("mirbase_pre script starting...")
p = utils.Bunch(common_parameters)
def main():
utils.now_time("Input_file: " + p.mirbase_pre_input)
utils.now_time("Output_f... | Naoto-Imamachi/MIRAGE | scripts/module/preparation/mirbase_pre.py | Python | mit | 1,190 |
from gi.repository import Gtk
from gaphas.view import GtkView
def scroll_tool(view: GtkView, speed: int = 5) -> Gtk.EventControllerScroll:
"""Scroll tool recognized 2 finger scroll gestures."""
ctrl = (
Gtk.EventControllerScroll.new(
view,
Gtk.EventControllerScrollFlags.BOTH_A... | amolenaar/gaphas | gaphas/tool/scroll.py | Python | lgpl-2.1 | 724 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from bs4 import BeautifulSoup
def test():
html = """
<body>
<p>
天!仅此一天哦→<br />
<a href="https://item.taobao.com/item.htm?id=539146861037" target="_blank">
<img src="file://C:\\Users\gide\AppData\Local\Temp\[5UQ[BL(6~BS2JV6W}N6[%S.png" />h... | dormouse/read | test/test_img.py | Python | lgpl-3.0 | 752 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
"""
# Built-in modules #
# Internal modules #
# First party modules #
from autopaths.file_path import FilePath
################################################################################
def... | xapple/plumbing | plumbing/scraping/blockers.py | Python | mit | 1,536 |
# Licensed under the Apache License:
# http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/cdunklau/fbemissary/blob/master/NOTICE.txt
"""
fbemissary - A bot framework for the Facebook Messenger platform
"""
from .core import FacebookPageMessengerBot
from .conversation import (
Conversat... | cdunklau/fbemissary | fbemissary/__init__.py | Python | apache-2.0 | 476 |
def download(child_rel_path, child_abs_path, download_dir):
artifact_downloaded_path = ctx.download_resource(child_abs_path)
new_file = os.path.join(download_dir, child_rel_path)
new_file_dir = os.path.dirname(new_file)
if not os.path.exists(new_file_dir):
os.makedirs(new_file_dir)
os.rename... | victorkeophila/alien4cloud-cloudify3-provider | src/main/resources/recipe/velocity/includes/download_artifacts.py | Python | apache-2.0 | 1,225 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import os,datetime,string
import chardet
import sys
import re
import time
from bs4 import BeautifulSoup
import hashlib
#md5=hashlib.md5(‘字符串’.encode(‘utf-8′)).hexdigest()
#print(md5)
import hashlib
#a = {'a':'aaa','b':'bbb'}
#a['c']='ccc'
#>>> a
#{'a': 'aa... | raiet/spider-mvc | subscribe/paser_test/ganji_2.py | Python | gpl-2.0 | 3,829 |
#!/usr/bin/env python3
import re
import subprocess
import pprint
import logging
import sys
import time
logging.basicConfig()
log = logging.getLogger('procbot')
class XMPPAdapter(object):
def __init__(self, bot, config):
log.debug('Using XMPP adapter with config: ' + pprint.pformat(config))
self.... | jakebasile/procbot | procbot.py | Python | bsd-2-clause | 9,903 |
from mc_objects import (ENCHANT_WEAPONS, ENCHANT_ARMOR, ENCHANT_HELMETS,
ENCHANT_BOOTS, ENCHANT_TOOLS, ENCHANT_BOWS, ENCHANT_SHIELDS,
ENCHANT_ELYTRA, MCEnchant, register_enchant, register_item, MCItem,
WEAPONS, BOOTS, HELMETS, ARMOR, TOOLS, BOWS, SHIELDS, ELYTRA, AXES,
ENCHANT_AXES, register_attribute,... | Kovak/KivyNBT | mc_data/basemetals/__init__.py | Python | mit | 1,297 |
import urllib2
import json
import os
import glob
import time
from ISStreamer.Streamer import Streamer
# --------- User Settings ---------
STATE = "TN"
CITY = "Nashville"
WUNDERGROUND_API_KEY = "Wunderground_API_Key_Here"
BUCKET_NAME = ":partly_sunny: " + CITY + " Weather"
BUCKET_KEY = "wunderground"
ACCESS_KEY = "Your... | InitialState/piot-athome | wunderground.py | Python | mit | 8,055 |
from __future__ import division
from pySDC.Hooks import hooks
from pySDC.Stats import stats
import matplotlib.pyplot as plt
import numpy as np
class particles_output(hooks):
def __init__(self):
"""
Initialization of particles output
"""
super(particles_output,self).__init__()
... | torbjoernk/pySDC | examples/spiraling_particle/HookClass.py | Python | bsd-2-clause | 1,411 |
import numpy as np
from typing import Dict, List, Tuple
from collections import OrderedDict
from orderedset._orderedset import OrderedSet
from npf.variable import is_numeric, get_numeric
from npf import npf
import natsort
import csv
class Run:
def __init__(self, variables):
self.variables = variables
... | tbarbette/clickwatcher | npf/types/dataset.py | Python | gpl-3.0 | 12,766 |
from django.db import models
# Create your models here.
class Event(models.Model):
url = models.URLField(null=True)
img_url = models.URLField(null=True)
title = models.CharField(max_length=200)
description = models.TextField()
def __str__(self):
return self.title
| kermit666/posterwall | posterwall/apps/events/models.py | Python | agpl-3.0 | 294 |
# -*- coding: utf-8 -*-
""""
Folium Colormap Module
----------------------
"""
import folium.colormap as cm
def test_simple_step():
step = cm.StepColormap(['green', 'yellow', 'red'],
vmin=3., vmax=10.,
index=[3, 4, 8, 10], caption='step')
step = cm.StepCol... | BibMartin/folium | tests/test_colormap.py | Python | mit | 1,615 |
# -*- Mode: Python; test-case-name: flumotion.test.test_feedcomponent010 -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or mo... | timvideos/flumotion | flumotion/component/base/baseadminnode.py | Python | lgpl-2.1 | 10,955 |
# Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: Simplified BSD
import os.path as op
import warnings
from numpy.testing import assert_raises
from mne import io, read_events, pick_types
from mne.utils import requires_scipy_version, run_tests_if_main
from mne.viz.utils import _fake_click
# Set our plotte... | trachelr/mne-python | mne/viz/tests/test_raw.py | Python | bsd-3-clause | 4,667 |
import click
import os
import sys
from .linter import lint_css
from .inliner import inline_css
@click.command()
@click.argument('css_file', required=True, type=click.File('r'))
def lint(css_file):
"""Lints email css and prints issues per client."""
css = css_file.read()
issues = lint_css(css) or []
... | Parsely/emailipy | emailipy/cli.py | Python | apache-2.0 | 1,149 |
from django.utils.timezone import utc as timezone_utc
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timestamp import floor_to_hour, floor_to_day, ceiling_to_hour, \
ceiling_to_day, timestamp_to_datetime, datetime_to_timestamp, \
TimezoneNotUTCException, convert_to_UTC
from datetime import... | jackrzhang/zulip | zerver/tests/test_timestamp.py | Python | apache-2.0 | 1,871 |
import pygame
import os
from graphics import *
# class to define the easy difficulty map
class Tile(pygame.sprite.Sprite):
def __init__(self, gridX, gridY, x, y):
pygame.sprite.Sprite.__init__(self)
#self.tiles = []
self.image = grassTile
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
... | taytam/crystaldefense | easymap.py | Python | mit | 5,333 |
from guizero import App, Window, PushButton
from guizero.utilities import GUIZeroImage
from tkinter import PhotoImage
app = App(title="Main window")
app.icon = "guizero.gif"
window = Window(app, title="2nd window", visible=False)
open_window_button = PushButton(app, text="Open window", command=window.show)
close_w... | lawsie/guizero | examples/app_icon.py | Python | bsd-3-clause | 405 |
# -*- coding: utf-8 -*-
# Copyright 2020-2022 Mike Fährmann
#
# 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.
"""Extractors for https://www.furaffinity.net/"""
from .common import E... | mikf/gallery-dl | gallery_dl/extractor/furaffinity.py | Python | gpl-2.0 | 14,255 |
"""
This module contains the CharmmWriter class and associated methods,
which outputs a psf/pdb file with CHARMM names and parameters.
It does this by converting atom names to CHARMM names, writing
intermediate files as necessary to invoke the vmd psfgen plugin.
Author: Robin Betz
Copyright (C) 2015 Robin Betz
"""
#... | drorlab/dabble | Dabble/param/charmm.py | Python | gpl-2.0 | 43,577 |
"""
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 use this ... | sekikn/ambari | ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py | Python | apache-2.0 | 5,216 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2018 Paul Culley
#
# 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... | gramps-project/addons-source | FilterRules/hasrolerule.py | Python | gpl-2.0 | 3,783 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA 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 vers... | markovmodel/PyEMMA | pyemma/util/statistics.py | Python | lgpl-3.0 | 8,401 |
"""
This is a class that makes it possible to bulk-save cache entries.
For restclients methods that use threading, this can be used to prevent
innodb gap locks from deadlocking sequential inserts.
"""
__manage_bulk_inserts = False
__bulk_insert_queue = []
from django.db import IntegrityError
def store_cache_entry(ent... | jeffFranklin/uw-restclients | restclients/cache_manager.py | Python | apache-2.0 | 1,128 |
"""
Salt returner that reports execution results back to sentry. The returner will
inspect the payload to identify errors and flag them as such.
Pillar needs something like:
.. code-block:: yaml
raven:
servers:
- http://192.168.1.1
- https://sentry.example.com
public_key: deadbeefdead... | saltstack/salt | salt/returners/sentry_return.py | Python | apache-2.0 | 5,367 |
# coding: utf8
from django.contrib import admin
from import_export import resources
from import_export.admin import ExportMixin
from .models import Event, Speaker, Survey
from .tasks import event_notification
class EventAdmin(admin.ModelAdmin):
pass
admin.site.register(Event, EventAdmin)
class SpeakerAdmin(admi... | gdgand/Festi | festi/survey/admin.py | Python | mit | 2,401 |
__all__ = [
'AbstractBasicAuthHandler',
'AbstractDigestAuthHandler',
'BaseHandler',
'Browser',
'BrowserStateError',
'CacheFTPHandler',
'ContentTooShortError',
'Cookie',
'CookieJar',
'CookiePolicy',
'DefaultCookiePolicy',
'DefaultFactory',
'FTPHandler',
'Factory',
... | deanhiller/databus | webapp/play1.3.x/samples-and-tests/i-am-a-developer/mechanize/__init__.py | Python | mpl-2.0 | 3,800 |
#
# Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
# Use of this file is governed by the BSD 3-clause license that
# can be found in the LICENSE.txt file in the project root.
from antlr4.atn.ATNState import StarLoopEntryState
from antlr4.atn.ATNConfigSet import ATNConfigSet
from antlr4.dfa.DFAState im... | Pursuit92/antlr4 | runtime/Python2/src/antlr4/dfa/DFA.py | Python | bsd-3-clause | 5,280 |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_vat
| syci/partner-contact | base_vat_sanitized/tests/__init__.py | Python | agpl-3.0 | 89 |
from Tribler.Core.Socks5.connection import Socks5Connection, ConnectionState
from Tribler.Test.Core.base_test import MockObject
from Tribler.Test.test_as_server import AbstractServer
from twisted.internet.defer import inlineCallbacks
class MockTransport(MockObject):
"""
This object mocks the transport of the ... | Captain-Coder/tribler | Tribler/Test/Core/Socks5/test_connection.py | Python | lgpl-3.0 | 3,620 |
# 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... | airbnb/caravel | superset/data/birth_names.py | Python | apache-2.0 | 18,557 |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# 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 F... | CoolCloud/taiga-back | taiga/urls.py | Python | agpl-3.0 | 2,961 |
# Load the WCS information from a fits header, and use it
# to convert pixel coordinates to world coordinates.
from __future__ import division # confidence high
import numpy
import pywcs
import pyfits
import sys
# Load the FITS hdulist using pyfits
hdulist = pyfits.open(sys.argv[-1])
# Parse the WCS keywords in the... | zqhuang/COOP | mapio/pyscripts/readflat.py | Python | gpl-3.0 | 1,107 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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... | pkoutsias/SickRage | sickbeard/notifiers/growl.py | Python | gpl-3.0 | 7,058 |
__version_info__ = {
'major': 0,
'minor': 4,
'micro': 1,
'releaselevel': 'final',
}
def get_version():
"""
Return the formatted version information
"""
vers = ["%(major)i.%(minor)i" % __version_info__, ]
if __version_info__['micro']:
vers.append(".%(micro)i" % __version_in... | ifearcompilererrors/fle_redesign | fle_redesign/apps/radpress/__init__.py | Python | mit | 491 |
import glob
import re
import csv
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.backends.backend_pdf
pdf = matplotlib.backends.backend_pdf.PdfPages("test-results-plots.pdf")
# each name in the header is of format like: 5b#beer temp
# 5: subplot number
# b: optional plot type specifier
# after #:... | glibersat/firmware | test_results/plot_all.py | Python | agpl-3.0 | 2,367 |
# -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify... | adrienpacifico/openfisca-france-data | openfisca_france_data/tests/test_calibration.py | Python | agpl-3.0 | 2,331 |
import asyncio
import os
import pathlib
import pytest
import aiohttp
from aiohttp import web
try:
import ssl
except:
ssl = False
@pytest.fixture(params=['sendfile', 'fallback'], ids=['sendfile', 'fallback'])
def sender(request):
def maker(*args, **kwargs):
ret = web.FileResponse(*args, **kwargs... | juliatem/aiohttp | tests/test_web_sendfile_functional.py | Python | apache-2.0 | 14,325 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('menus', '0001_initial'),
]
opera... | kimond/miamm | miamm/menus/migrations/0002_auto_20150208_1525.py | Python | bsd-3-clause | 2,689 |
#Get celebrity data from posh24.com
from bs4 import BeautifulSoup
import json
import re
import requests
#Website to scrape top 100 celebrities from
website = "http://www.posh24.com/celebrities"
#Get website data
data = requests.get(website).text
#Parse data using bs4
soup = BeautifulSoup(data, "html.parser")
#List... | KingsleyBell/dotacelebbot | celebList.py | Python | mit | 2,351 |
# 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-web/azure/mgmt/web/models/domain_paged.py | Python | mit | 906 |
#!/usr/bin/env python
#
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All... | endlessm/chromium-browser | third_party/webrtc/tools_webrtc/cpu/cpu_mon.py | Python | bsd-3-clause | 2,057 |
# 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... | lmaycotte/quark | quark/plugin_modules/mac_address_ranges.py | Python | apache-2.0 | 4,485 |
#!/usr/bin/python
#
# Double Pulsar Checks
# https://github.com/countercept/doublepulsar-detection-script/blob/master/detect_doublepulsar_rdp.py
# Author: Luke Jennings (luke.jennings@countercept.com - @jukelennings)
# XOR Key calculation provided by https://github.com/FireFart
#
# Modified version that allows to be us... | Neo23x0/Loki | lib/doublepulsar.py | Python | gpl-3.0 | 11,278 |
from ert_gui.models.mixins import ModelMixin, AbstractMethodError
class BasicModelMixin(ModelMixin):
VALUE_CHANGED_EVENT = "value_changed_event"
def registerDefaultEvents(self):
super(BasicModelMixin, self).registerDefaultEvents()
self.observable().addEvent(BasicModelMixin.VALUE_CHANGED_EVENT... | iLoop2/ResInsight | ThirdParty/Ert/devel/python/python/ert_gui/models/mixins/basic_model.py | Python | gpl-3.0 | 484 |
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# This file is part of the E-Cell System
#
# Copyright (C) 1996-2016 Keio University
# Copyright (C) 2008-2016 RIKEN
# Copyright (C) 2005-2009 The Molecular Sciences Institute
#
#:::::::::::::::::::::::::::::::::::::::... | ecell/ecell3 | ecell/frontend/model-editor/ecell/ui/model_editor/LayoutCommand.py | Python | lgpl-3.0 | 21,379 |
# Leap + InMoov hand version MRL above 2000
inmoov = Runtime.createAndStart("inmoov","InMoov")
inmoov.startRightHand("COM7","atmega2560")
inmoov.rightHand.index.map(0,180,0,160)
inmoov.rightHand.thumb.map(0,180,55,135)
inmoov.rightHand.majeure.map(0,180,50,170)
inmoov.rightHand.ringFinger.map(0,180,48,145)
inmoov.righ... | MyRobotLab/pyrobotlab | home/hairygael/InMoov4.LeapMotion.py | Python | apache-2.0 | 533 |
# simpleui implements a number of simple UI patterns with fallback to CLI if the
# selected GUI fails.
#
# Copyright (C) 2012 NigelB
#
# 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 vers... | nigelb/simpleui | simpleui/cli_impl/__init__.py | Python | gpl-3.0 | 844 |
from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http import HttpRequest
from django.template.loader import render_to_string
# Return the HTML of home_page.
from schedule.views import home_page
# Import Name class from models.
from schedule.models import Name
class HomePageTe... | Giovanni21M/SecP | schedule/unit_tests/tests.py | Python | mit | 5,147 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './Project/TranslationPropertiesDialog.ui'
#
# Created: Tue Nov 18 17:53:58 2014
# by: PyQt5 UI code generator 5.3.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Translati... | davy39/eric | Project/Ui_TranslationPropertiesDialog.py | Python | gpl-3.0 | 8,712 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.