code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
##############################################################################
#
# Usage example for the procedure PPXF, which
# implements the Penalized Pixel-Fitting (pPXF) method by
# Cappellari M., & Emsellem E., 2004, PASP, 116, 138.
# The example also shows how to include a library of templa... | moustakas/impy | lib/ppxf/ppxf_kinematics_example_sauron.py | Python | gpl-2.0 | 8,518 |
import enum
import inspect
import pydoc
import sys
import unittest
import threading
from collections import OrderedDict
from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto
from io import StringIO
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
from test import support
from datetime im... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/test/test_enum.py | Python | apache-2.0 | 108,504 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PySgp4(PythonPackage):
"""Track earth satellite TLE orbits using up-to-date 2010 version o... | iulian787/spack | var/spack/repos/builtin/packages/py-sgp4/package.py | Python | lgpl-2.1 | 635 |
# Copyright 2011 Viewfinder Inc. All Rights Reserved.
"""Tests for Job class.
"""
__author__ = 'marc@emailscrubbed.com (Marc Berhault)'
import time
from viewfinder.backend.base import constants
from viewfinder.backend.base.dotdict import DotDict
from viewfinder.backend.db.job import Job
from viewfinder.backend.db.l... | 0359xiaodong/viewfinder | backend/db/test/job_test.py | Python | apache-2.0 | 6,345 |
# ProgressReport.py
# Progress Report For Zaid
#This is an all encompassing program that does everything at once, hopefully placing all
#of the BAMS query results into a single CSV file
#doesn't run properly unless the path is accessed first, interactive python is activated,
#and the code is pasted into terminal..... | rsoscia/BAMS-to-NeuroLex | src/ProgressReport.py | Python | mit | 7,486 |
import re, random, hexchat
from subprocess import Popen, PIPE
__module_name__ = 'Fake CTCP'
__module_version__ = '0.1'
__module_description__ = 'Fakes unessential CTCP requests: VERSION PING TIME'
FAKE_VERSION = 'pinoyChat v1.3.3.4 - Windows XP SP2,'\
' @400MHz Celeron Mendocino, Administrator:passwor... | Veek/Python | IRC/Hexchat/fake_ctcp.py | Python | mit | 2,339 |
import chute
import random
NUM_SERVERS = 4
SERVERS = ['server %d' % i for i in range(NUM_SERVERS)]
@chute.process(chute.dist.exponential(.5))
class Customer(object):
ACTIVE = set()
def __call__(self):
# Track existing customers so we can randomly use them as resources.
self.ACTIVE.add(self)
... | ryanjoneil/chute | examples/mmkrazy.py | Python | bsd-2-clause | 1,355 |
#!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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
#
# U... | sunqm/pyscf | pyscf/mcscf/test/test_n2_df.py | Python | apache-2.0 | 10,791 |
# Copyright 2015 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... | AnishShah/tensorflow | tensorflow/tools/api/tests/api_compatibility_test.py | Python | apache-2.0 | 12,593 |
from django.contrib import admin
from .organisms import CollectiveAdmin, GrowthAdmin, IndividualAdmin
from core.models.organisms import Individual, Collective, Growth
admin.site.register(Individual, IndividualAdmin)
admin.site.register(Collective, CollectiveAdmin)
admin.site.register(Growth, GrowthAdmin)
| fako/datascope | src/core/admin/__init__.py | Python | gpl-3.0 | 309 |
from django.core.exceptions import ValidationError
from django.shortcuts import redirect, render
from lists.models import Item, List
def home_page(request):
return render(request, 'home.html')
def new_list(request):
list_ = List.objects.create()
item = Item(text=request.POST['item_text'], list=list_)
... | freddyiniguez/cimat_scrum_developer | superlists/lists/views.py | Python | gpl-2.0 | 1,022 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2011 Nick Hall
#
# 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 late... | Nick-Hall/gramps | gramps/plugins/gramplet/mediapreview.py | Python | gpl-2.0 | 3,153 |
from ..base import ShopifyResource
from shopify import mixins
from comment import Comment
class Article(ShopifyResource, mixins.Metafields, mixins.Events):
_prefix_source = "/admin/blogs/$blog_id/"
@classmethod
def _prefix(cls, options={}):
blog_id = options.get("blog_id")
if blog_id:
... | roninio/gae-shopify-python-boilerplate | shopify/resources/article.py | Python | lgpl-3.0 | 663 |
#! /usr/bin/env python
from sklearn import datasets
print datasets , type(datasets)
iris = datasets.load_iris()
digits = datasets.load_digits()
#print iris
print digits.target
#plot them
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
images_and_labels = zip(digits.images, digit... | alexshires/ml | sklearn/basics.py | Python | gpl-2.0 | 709 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.OrganizationListView.as_view(),
name="list"),
url(r'^data.geojson$', views.OrganizationMapLayer.a... | watchdogpolska/watchdog-kj-kultura | watchdog_kj_kultura/organizations/urls.py | Python | mit | 907 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Thibault Kruse
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copy... | tkruse/unilint | src/unilint/pychecker_plugin.py | Python | bsd-2-clause | 4,991 |
from __future__ import unicode_literals, absolute_import
import telegram
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from smartmin.views import SmartFormView
from ...models import Channel
from ...views import ClaimViewMixin
clas... | onaio/rapidpro | temba/channels/types/telegram/views.py | Python | agpl-3.0 | 1,824 |
# Benjamin Slack
# CS 5310
# Chan's Minimalist Convex Hull in R^3
import array
import random
import geo
class Point():
"""
Generalized point class
"""
def __init__(self, x=0.0, y=0.0, z=0.0, n=None, p=None):
"""
Creates a point. Optional attributes
given as the parameters belo... | baslack/quickhull | chan/__init__.py | Python | gpl-3.0 | 10,525 |
# This file contains the dialogBox class
import pygame
from transcendence.graphics import widget, button, text
import transcendence.graphics as graphics
from transcendence import util
"""class ContentBox(Box):
def size_changed(self):
self.parent.needs_redraw = True
self.recalculate_collision_rect... | Scaatis/Endgame | transcendence/graphics/dialogbox.py | Python | gpl-2.0 | 3,672 |
from flask import Blueprint, render_template
projects = Blueprint('projects', __name__,
template_folder='templates')
@projects.route('/')
def home():
return render_template('projects/index.html')
| ardinor/mojibake | mojibake/projects/views.py | Python | mit | 224 |
# Copyright 2012 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 by applicable law or ... | henrymp/coursebuilder | main.py | Python | apache-2.0 | 2,562 |
'''Shorty Template Tags'''
from django import template
from django.core.urlresolvers import reverse
register = template.Library()
@register.simple_tag(takes_context=True)
def build_short_url(context, path):
return context['request'].build_absolute_uri(reverse('redirect', kwargs={'slug': path}))
| ocadotechnology/djshorty | shorty/templatetags/shorty.py | Python | apache-2.0 | 303 |
# Copyright 2016 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... | xuleiboy1234/autoTitle | tensorflow/tensorflow/contrib/ffmpeg/encode_audio_op_test.py | Python | mit | 4,151 |
# -*- coding: utf-8 -*-
#
from collections import OrderedDict
import copy
from rest_framework.generics import ListCreateAPIView
from rest_framework import viewsets
from rest_framework.views import APIView, Response
from rest_framework.permissions import AllowAny
from django.shortcuts import get_object_or_404
from res... | choldrim/jumpserver | apps/applications/api.py | Python | gpl-2.0 | 3,907 |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 13 21:37:43 2019
@author: CHaithcock
"""
import RHState
s1 = RHState.RHState(273852143882168472463624642887680, 13)
'''
array([[6, 6, 0, 0, 4, 0],
[0, 0, 0, 0, 4, 0],
[0, 6, 6, 0, 0, 0],
[0, 0, 0, 6, 6, 0],
[4, 0, 0, 0, 0, 0],
[4, 0,... | crhaithcock/RushHour | RHGraph/RHLibrary.py | Python | cc0-1.0 | 1,692 |
import unittest, doctest, copy
from logSort import logSort
from pivotArray import PartiallySortedArray, maxBubblePass, minBubblePass, preorder
class PartiallySortedArrayTest(unittest.TestCase):
"""Basic tests for algorithms computing prefix free codes.
"""
def testMaxBubblePassOnSortedArray(self)... | jyby/DDSRankSelectInMultisets | Implementations/Python/pivotArray.test.py | Python | gpl-3.0 | 7,221 |
from orders import models
from orders.models import Surcharge
NZ_GST = 1.15
def add_gst(amount):
return float(amount) * NZ_GST
def order_total_incl_gst(ingredients, quantities):
item_total = lambda i, q: float(i.unit_cost_excl_gst_incl_surcharge) * q
total = sum(map(item_total, ingredients, quantities)... | gkampjes/ucbc | orders/utils.py | Python | mit | 584 |
# coding:utf-8
"""
Use this module to write functional tests for the view-functions, only!
"""
import os
import unittest
from django_webtest import WebTest
from django.core.urlresolvers import reverse
from django.core import mail
from django.test import TestCase
from journalmanager.tests import modelfactories
from jo... | jamilatta/scielo-manager | scielomanager/journalmanager/tests/tests_forms.py | Python | bsd-2-clause | 131,301 |
###################################################
# header_music.py
# This file contains declarations for music tracks
# DO NOT EDIT THIS FILE!
###################################################
mtf_culture_1 = 0x00000001
mtf_culture_2 = 0x00000002
mtf_culture_3 ... | Sw4T/Warband-Development | mb_warband_module_system_1166/Module_system 1.166/headers/header_music.py | Python | mit | 1,662 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""
This file contains the definition of the GCS Blob storage Class used to
integrate GCS Blob storage with spack buildcac... | LLNL/spack | lib/spack/spack/util/gcs.py | Python | lgpl-2.1 | 7,039 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/enums/types/ad_group_criterion_approval_status.py | Python | apache-2.0 | 1,262 |
# Copyright 2016 Cloudbase Solutions Srl
# 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 r... | xuweiliang/Codelibrary | nova/policies/keypairs.py | Python | apache-2.0 | 1,555 |
from __future__ import absolute_import
import json
import numpy as np
from ..app import app
from . import test_utils
from ...plotting import (reset_output, output_server, push, curdoc, figure)
from ...session import TestSession
from ...models.sources import ServerDataSource
from ...models.ranges import Range1d
from... | rhiever/bokeh | bokeh/server/tests/remotedata_tests.py | Python | bsd-3-clause | 6,798 |
"""Utility class for formatting scansion patterns"""
import logging
from cltk.prosody.lat.scansion_constants import ScansionConstants
LOG = logging.getLogger(__name__)
LOG.addHandler(logging.NullHandler())
__author__ = ["Todd Cook <todd.g.cook@gmail.com>"]
__license__ = "MIT License"
class ScansionFormatter:
... | kylepjohnson/cltk | src/cltk/prosody/lat/scansion_formatter.py | Python | mit | 4,537 |
from __future__ import absolute_import, print_function
from django.conf.urls import patterns, url
from .endpoints.auth_index import AuthIndexEndpoint
from .endpoints.broadcast_index import BroadcastIndexEndpoint
from .endpoints.catchall import CatchallEndpoint
from .endpoints.event_details import EventDetailsEndpoint... | 1tush/sentry | src/sentry/api/urls.py | Python | bsd-3-clause | 11,496 |
import argparse
import csv
import json
import os
import numpy as np
import warnings
parser = argparse.ArgumentParser()
parser.add_argument('metafile')
args = parser.parse_args()
GLOBAL_PHASE = np.linspace(0, 1, num = 50).tolist()
with open(args.metafile) as f:
meta = json.load(f)
raw = {"data":{}}
for... | zhewang/lcvis | python_scripts/PLV_to_New_Format/get_raw.py | Python | gpl-2.0 | 881 |
# -*- encoding: utf-8 -*-
import os
from abjad.tools import documentationtools
from abjad.tools import systemtools
from abjad.tools.developerscripttools.DeveloperScript import DeveloperScript
from abjad.tools.developerscripttools.ReplaceInFilesScript \
import ReplaceInFilesScript
class RenameModulesScript(Develop... | mscuthbert/abjad | abjad/tools/developerscripttools/RenameModulesScript.py | Python | gpl-3.0 | 13,078 |
import unittest
import mock
from mopidy_playbackdefaults import PlaybackDefaultsFrontend
class PlaybackDefaultsFrontendTest(unittest.TestCase):
def test_no_settings(self):
config = {'playbackdefaults': {'default_random': '', 'default_repeat': '', 'default_consume': '', 'default_single': ''}}
co... | DavisNT/mopidy-playbackdefaults | tests/test_frontend.py | Python | apache-2.0 | 5,145 |
# Copyright (c) 2018 PaddlePaddle 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 app... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/sequence/test_sequence_slice_op.py | Python | apache-2.0 | 2,865 |
# Domato - main generator script
# -------------------------------
#
# Written and maintained by Ivan Fratric <ifratric@google.com>
#
# Copyright 2017 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wi... | googleprojectzero/domato | webgl/generator.py | Python | apache-2.0 | 4,364 |
# Copyright 2015 VMware, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-only
from __future__ import print_function
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
'.molecule/ansible_inventory').get_hosts('all')
# Use testinfra to... | vmware/ansible-role-sshkeys | tests/test_default.py | Python | apache-2.0 | 730 |
# -*- coding: utf-8 -*-
__title__ = 'transliterate.tests.data.python32'
__author__ = 'Artur Barseghyan'
__copyright__ = '2013-2015 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
latin_text = "Lorem ipsum dolor sit amet"
armenian_text = 'Լօրեմ իպսում դօլօր սիտ ամետ'
cyrillic_text = 'Лорем ипсум долор сит амет'
ukr... | akosiaris/transliterate | src/transliterate/tests/data/python32.py | Python | gpl-2.0 | 1,382 |
# encoding: utf-8
from __future__ import unicode_literals
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
compat_urllib_parse,
)
from ..utils import (
ExtractorError,
int_or_none,
unified_strdate,
)
class SoundcloudIE(InfoExtra... | 0x7678/youtube-dl | youtube_dl/extractor/soundcloud.py | Python | unlicense | 14,130 |
import os
import re
import sys
import textwrap
from doctest import ELLIPSIS, OutputChecker
import pytest
from tests.lib import (
_create_test_package,
_create_test_package_with_srcdir,
_git_commit,
need_bzr,
need_mercurial,
need_svn,
path_to_url,
)
distribute_re = re.compile('^distribute=... | xavfernandez/pip | tests/functional/test_freeze.py | Python | mit | 25,185 |
r"""File-like objects that read from or write to a string buffer.
This implements (nearly) all stdio methods.
f = StringIO() # ready for writing
f = StringIO(buf) # ready for reading
f.close() # explicitly release resources held
flag = f.isatty() # always false
pos = f.tell() # get cur... | babyliynfg/cross | tools/project-creator/Python2.6.6/Lib/StringIO.py | Python | mit | 10,944 |
#!/usr/bin/env python
class ColorScheme(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually."""
def __init__(self):
"""
Attributes:
swaggerTypes (dict): The key is attribute name and the value is attribute type.
... | sohail-aspose/Aspose_Slides_Cloud | SDKs/Aspose.Slides_Cloud_SDK_for_Python/asposeslidescloud/models/ColorScheme.py | Python | mit | 1,920 |
# coding=utf-8
# Copyright (c) 2001, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and op... | CanalTP/kirin | tests/mock_navitia/vj_bad_order.py | Python | agpl-3.0 | 13,166 |
###
# Copyright (c) 2011, Alex Wood
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, an... | kg-bot/SupyBot | plugins/Asci/__init__.py | Python | gpl-3.0 | 2,672 |
# coding=utf-8
import sys
from kg.db.generate_words import generate
try:
if len(sys.argv) > 1:
generate(sys.argv[1])
else:
generate()
except Exception as e:
print(u"Ката:")
print("\t"+e.message) | MasterAlish/kyrgyz_tili | generator.py | Python | gpl-3.0 | 232 |
"""
Utils for URLs (to avoid circular imports)
"""
DASHBOARD_URL = '/dashboard/'
PROFILE_URL = '/profile/'
PROFILE_PERSONAL_URL = '{}personal/?'.format(PROFILE_URL)
PROFILE_EDUCATION_URL = '{}education/?'.format(PROFILE_URL)
PROFILE_EMPLOYMENT_URL = '{}professional/?'.format(PROFILE_URL)
SETTINGS_URL = "/settings/"
SE... | mitodl/micromasters | ui/url_utils.py | Python | bsd-3-clause | 662 |
from copy import deepcopy
from plenum.common.constants import NAME, VERSION
from plenum.test import waits as plenumWaits
from indy_client.test.helper import checkRejects, checkNacks
from indy_common.constants import CANCEL, \
ACTION
from indy_node.test.upgrade.helper import sendUpgrade, ensureUpgradeSent, \
bu... | TechWritingWhiz/indy-node | indy_node/test/upgrade/test_pool_upgrade_reject.py | Python | apache-2.0 | 2,714 |
"""Event Decorators for custom components."""
import functools
from homeassistant.helpers import event
HASS = None
def track_state_change(entity_ids, from_state=None, to_state=None):
"""Decorator factory to track state changes for entity id."""
def track_state_change_decorator(action):
"""Decorator ... | justyns/home-assistant | homeassistant/helpers/event_decorators.py | Python | mit | 2,402 |
#!/usr/bin/env python3
# Copyright (C) 2015 Robert Jordens <jordens@gmail.com>
import argparse
import os
import subprocess
import tempfile
import shutil
from artiq import __artiq_dir__ as artiq_dir
from artiq.frontend.bit2bin import bit2bin
def scripts_path():
p = ["share", "openocd", "scripts"]
if os.name ... | JQIamo/artiq | artiq/frontend/artiq_flash.py | Python | lgpl-3.0 | 5,247 |
# coding: utf-8
import tensorflow as tf
import numpy as np
#get_ipython().run_line_magic('matplotlib', 'inline')
import matplotlib.pyplot as plt
import sys
import glob
import os
from tensorflow.python.platform import flags
import argparse
tf.app.flags.FLAGS = flags._FlagValues()
tf.app.flags._global_parser = argparse... | zxjzxj9/deeplearning | gan_talk_tensorflow/dcgan_w_gp.py | Python | gpl-3.0 | 18,360 |
from setuptools import setup, find_packages
setup(
name='museris-data',
version='0.1',
description='Data models and scraper for https://museris.lausanne.ch/',
author='Cruncher',
author_email='marco@cruncher.ch',
url='https://github.com/cruncher/museris',
license='MIT',
packages=find_pack... | cruncher/museris | setup.py | Python | mit | 944 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import pytest
from pootle.core.delegate imp... | unho/pootle | pytest_pootle/fixtures/models/translation_project.py | Python | gpl-3.0 | 2,531 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import cPickle
from binascii import unhexlify
from functools import partial
from PyQt5.Qt import (QPixmap, QSize, QWidget... | elssar/calibre | src/calibre/gui2/book_details.py | Python | gpl-3.0 | 27,090 |
import itemizer
class Importer(object):
def __init__(self):
self.itemizer = itemizer.Itemizer()
def get_ingredients(self, item_name, quantity=1, bundle=None,
stop_names=None, stop_groups=None):
if stop_names is None:
stop_names = []
if stop_groups is None:
... | tflovorn/profiteer | importer.py | Python | mit | 1,352 |
import os, sys, time
from config import *
from checker import facebook, gmail
if( int(time.strftime('%H')) >= 8 and int(time.strftime('%H')) <= 21 ):
#facebook.checkFacebook()
gmail.checkGmail()
elif( int(time.strftime('%H')) == 22 ) :
state_gpio = [ True, GPIO.input(11), GPIO.input(16) ] #Night mode stat... | maelg/RaspiNotifier | checker.py | Python | gpl-2.0 | 706 |
import logging
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.urls import reverse
from django.db.models import F
from django.http.response import HttpResponseRedirect, JsonResponse
from django.views.decorators.clickjacking import xframe_options_exempt
fro... | interlegis/sapl | sapl/comissoes/views.py | Python | gpl-3.0 | 15,757 |
import random
import textwrap
from configparser import ConfigParser
def explain() -> str:
"""Explain Person Action Object"""
return textwrap.dedent(
"""\
Person Action Object (PAO)
The PAO is a system of encoding where you attribute a specific Person with an
Action that includ... | patrickshuff/artofmemory | artofmemory/pao.py | Python | mit | 2,868 |
from func.overlord.groups import Groups,get_hosts_spec
from certmaster.config import read_config, CONFIG_FILE
from certmaster.commonconfig import CMConfig
import os
import fnmatch
from func.overlord.group.conf_backend import ConfBackend
from func.overlord.group.sqlite_backend import SqliteBackend
TEST_DB_FILE = "/tm... | dockerera/func | test/unittest/test_groups_api.py | Python | gpl-2.0 | 16,593 |
# -*- coding:utf-8 -*-
from PIL import Image
from PIL import ImageEnhance
import numpy as np
def get_image(path, shape, format):
"""
:param path:
:param shape:
:param format:
:return:
"""
img = Image.open(path)
img = img.resize(size=(shape[1], shape[2]), resample=Image.LANCZOS)
... | gu-yan/mlAlgorithms | mxnet/cv_tools/image_tool.py | Python | apache-2.0 | 2,253 |
""" PublisherHandler
This service has been built to provide the RSS web views with all the information
they need. NO OTHER COMPONENT THAN Web controllers should make use of it.
"""
__RCSID__ = '$Id$'
# pylint: disable=no-self-use
import types
from datetime import datetime, timedelta
# DIRAC
from DIRAC import gLo... | andresailer/DIRAC | ResourceStatusSystem/Service/PublisherHandler.py | Python | gpl-3.0 | 11,982 |
from transform import transform
def modify_proxy_request(request, log):
# Fake the header to ensure that mathml is rendered
request.headers['User-Agent'] = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.11) Gecko/20101013 Ubuntu/10.10 (maverick) Firefox/3.6.11'
return request
| Rhaptos/cnxmobile | src/cnxmobile/cnxmobile/__init__.py | Python | lgpl-2.1 | 294 |
# -*- encoding: utf-8 -*-
# import time
# from project.settings import log_debug
#
# def main():
# i = 0
#
# while i < 500:
# time.sleep(0.01)
# i += 1
# log_debug(i)
#
# if __name__ == '__main__':
# main()
import asyncio
@asyncio.coroutine
def echo_server():
yield from async... | INP-Group/ProjectN-Control | src/server.py | Python | mit | 688 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('problems', '0004_problem_main_problem_instance'),
('portals', '0001_initial'),
]
operations = [
migrations.AddField(... | sio2project/oioioi | oioioi/portals/migrations/0002_node_problems_in_content.py | Python | gpl-3.0 | 521 |
## Matt Moehr
| mattmoehr/ks-power-rankings | code/code-get-data/web_scraper.py | Python | gpl-2.0 | 14 |
"""
Giving models custom methods
Any method you add to a model will be available to instances.
"""
import datetime
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Article(models.Model):
headline = models.CharField(max_length=100)
... | kisna72/django | tests/custom_methods/models.py | Python | bsd-3-clause | 1,265 |
#!/usr/bin/env python
import sys
import netrc
import time
from alarmdealerscrape import AlarmDealerClient
def main(argv=None):
if argv is None:
argv = sys.argv
auth = netrc.netrc().authenticators(AlarmDealerClient.DOMAIN)
username, code, password = auth
client = AlarmDealerClient()
pri... | tubaman/alarmdealerscrape | examples/test_long_interval_status.py | Python | bsd-3-clause | 748 |
/*******************************************************************************
* Copyright 2013 University of Southern California
*
* 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... | usc-isi-i2/KarmaSpatialClustering | split.py | Python | apache-2.0 | 1,857 |
from subprocess32 import Popen,call,PIPE
from uuid import uuid4
import os
import time
import logging
logger = logging.getLogger("FileCrypto.root.LUKS")
class CryptoLuks(object):
def __init__(self,cryptfile,mountdir):
self.cryptfile = cryptfile
self.mountdir = mountdir
self.fuuid = uuid4().... | dkumor/meDB | connector/crypto/disk/rootprocess/luks/luks.py | Python | mit | 6,510 |
# _*_ coding:utf-8 _*_
# Filename:ClientUI.py
# Python在线聊天客户端
from socket import *
from ftplib import FTP
import ftplib
import socket
import thread
import time
import sys
import codecs
import os
reload(sys)
sys.setdefaultencoding( "utf-8" )
class ClientMessage():
#设置用户名密码
def setUsrANDPwd(self,usr,pwd):
... | gzxultra/IM_programming | class_ClientMessage.py | Python | gpl-2.0 | 6,373 |
import os
import six
from aleph.util import checksum
class Archive(object):
def _get_file_path(self, meta):
ch = meta.content_hash
if ch is None:
raise ValueError("No content hash available.")
path = os.path.join(ch[:2], ch[2:4], ch[4:6], ch)
file_name = 'data'
... | smmbllsm/aleph | aleph/archive/archive.py | Python | mit | 1,182 |
# Copyright 2016 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... | AnishShah/tensorflow | tensorflow/python/autograph/utils/multiple_dispatch.py | Python | apache-2.0 | 2,263 |
('\xef\xbb\xbf')
#Coded for Python 3.4.3
from tkinter import *
import re, linecache, os, sys
import xlwt, xlrd
#Created by Myles Morrone
#Ver(2.0) 12:05 8/3/2015
#The xlwt module is available at: https://pypi.python.org/pypi/xlwt
#The xlrd module is available at: https://pypi.python.org/pypi/xlrd
#Current... | pickpocket689/Jack-the-Ripper | JtR_no_GUI.py | Python | mit | 14,782 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-07-28 15:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('podcasts', '0053_auto_20180715_0432'),
]
operations = [
migrations.AddField(
... | Pinecast/pinecast | podcasts/migrations/0054_podcast_owner_email_override.py | Python | apache-2.0 | 487 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import argparse
import gettext
from formbar.config import Config, parse
def _(message):
if message == "":
return ""
result = gettext.gettext(message)
if isinstance(result, unicode):
result = result.encode("UTF-8")
return result
d... | ringo-framework/formbar | contrib/formspec.py | Python | gpl-2.0 | 9,487 |
# This file is part of Heapkeeper.
#
# Heapkeeper 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.
#
# Heapkeeper is distributed in the ... | hcs42/heapkeeper-old | plugins/review/src/hkp_review.py | Python | gpl-3.0 | 4,623 |
__author__ = 'Dongwoo Kim'
import numpy as np
from sklearn.metrics import precision_recall_curve, auc
import path_tool
heaviside = lambda x: 1 if x >= 0 else 0
class TAMDC:
"""
Implementation of Active Multi-relational Data Construction (AMDC) method.
Reference:
Kajino, H., Kishimoto, A., Botea, A.... | chubbymaggie/almc | amdc/tri_model.py | Python | gpl-2.0 | 9,709 |
#!/usr/bin/env python
"""
CsPython Tutorial Example 1
A pure-Python script to show the use of Crystal Space.
To use this, ensure that your PYTHONPATH, CRYSTAL, and LD_LIBRARY_PATH
(or DYLD_LIBRARY_PATH for MacOS/X; or PATH for Windows) variables are set
approrpriately, and then run the script with the command:
p... | garinh/cs | scripts/python/tutorial1.py | Python | lgpl-2.1 | 8,233 |
import logging
import math
import time
from robotics.controllers.pid_controller import PIDController
from robotics.robots.factory import RobotFactory
def uni_to_diff(v, w):
R = 0.032
L = 0.1
vel_l = (2.0 * v - L * w) / (2.0 * R)
vel_r = (2.0 * v + L * w) / (2.0 * R)
return vel_l, vel_r
def uni_... | asydorchuk/robotics | python/robotics/examples/aizek_supervisor.py | Python | mit | 2,300 |
import yaml
import re
import numpy as np
from .._base import DReprError
from ....core.error import SimpleGaussianError, MatrixGaussianError
from ...xy import XYContainer
__all__ = ["add_error_to_container", "write_errors_to_yaml", "process_error_sources",
"MatrixYamlDumper", "MatrixYamlLoader"]
_yaml_err... | dsavoiu/kafe2 | kafe2/fit/representation/error/common_error_tools.py | Python | gpl-3.0 | 10,614 |
import glob
import os
from unittest import TestCase
from qtpy.QtCore import QPoint
from qtpy.QtTest import QTest
from qtpy.QtWidgets import QMainWindow, QWidget, QVBoxLayout
from mtpy.core import mt
from mtpy.gui.SmartMT.Components.PlotParameter import FrequencySelection
from tests.SmartMT import _click_area
edi_pat... | MTgeophysics/mtpy | tests/SmartMT/test_frequencySelect.py | Python | gpl-3.0 | 5,393 |
#! /usr/bin/env python
# Author: David Goodger
# Contact: goodger@users.sourceforge.net
# Revision: $Revision: 4233 $
# Date: $Date: 2005-12-29 00:48:48 +0100 (Thu, 29 Dec 2005) $
# Copyright: This module has been placed in the public domain.
"""
Tests for docutils.transforms.references.Substitutions.
"""
from __ini... | alon/polinax | libs/external_libs/docutils-0.4/test/test_transforms/test_substitutions.py | Python | gpl-2.0 | 9,979 |
# Copyright 2013 OpenStack Foundation.
# Copyright 2013 IBM Corp.
# 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/LI... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/glanceclient/tests/unit/v2/test_tasks.py | Python | mit | 11,379 |
from SuperDiffer import app, db
from SuperDiffer.id import controllers as ID
from flask import Flask, render_template, request, abort, jsonify
import json,base64,pdb
"""Routes to allow clients to add left and right base64 encoded on JSON values and fetch their diff"""
#References: https://blog.miguelgrinberg.com/post... | gpaOliveira/SuperDiffer | SuperDiffer/routes.py | Python | mit | 2,533 |
from BarTable import BarTable
import BigWorld
from gui.shared.gui_items.Vehicle import VEHICLE_CLASS_NAME
from gui.shared.gui_items.Vehicle import VEHICLE_TYPES_ORDER
from gui.battle_control import g_sessionProvider
from plugins.Engine.ModUtils import BattleUtils
import re
from StarsBar import StarsBar
import GUI
clas... | jstar88/wotmods | files/uncompyled/wot_folder/res_mods/0.9.10/scripts/client/plugins/Statistics_plugin/BattleLoadingBarTable.py | Python | gpl-2.0 | 3,899 |
#!/usr/bin/env python
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
__author__="mcanuto"
__date__ ="$Feb 13, 2014 6:03:13 PM$"
from domain_info import domainsVM, VMobject
from ConfigParser... | bsc-renewit/d2.2 | monitoringFramework/init_parallel.py | Python | apache-2.0 | 12,800 |
#
# DBus interface for the interactive partitioning module
#
# Copyright (C) 2019 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.... | jkonecny12/anaconda | pyanaconda/modules/storage/partitioning/interactive/interactive_interface.py | Python | gpl-2.0 | 1,424 |
# -*- coding: UTF-8 -*-
import __future__
import os
import sys
import traceback
import site
import tempfile
from drawBot.misc import getDefault
class StdOutput(object):
def __init__(self, output, isError=False, outputView=None):
self.data = output
self.isError = isError
self.outputView =... | bitforks/drawbot | drawBot/scriptTools.py | Python | bsd-2-clause | 6,306 |
# coding: utf-8
from fabkit import task
from fablib.openstack import Nova, Neutron
nova = Nova('compute')
neutron = Neutron('compute')
@task
def setup():
nova.setup()
neutron.setup()
return {'status': 1}
@task
def restart():
nova.restart_services()
neutron.restart_services()
| syunkitada/fabkit-repo | fabscript/openstack/compute.py | Python | mit | 303 |
#
# Thierry Parmentelat - INRIA
#
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Auth import Auth
from PLC.Sites import Sites
from PLC.Nodes import Nodes
from PLC.Interfaces import Interface, Interfaces
from PLC.TagTypes import TagType, TagTypes
from PLC.Inte... | dreibh/planetlab-lxc-plcapi | PLC/Methods/AddInterfaceTag.py | Python | bsd-3-clause | 2,707 |
r'''
Copyright 2014 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 by applicable law or agreed to i... | google/nogotofail | nogotofail/clients/linux/__init__.py | Python | apache-2.0 | 583 |
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Maximilian Köhl <mail@koehlma.de>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License version 3 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope th... | koehlma/uv | tests/test_gc.py | Python | lgpl-3.0 | 2,404 |
__author__ = "Ryan Dale"
__copyright__ = "Copyright 2016, Ryan Dale"
__email__ = "dalerr@niddk.nih.gov"
__license__ = "MIT"
import os
from snakemake.shell import shell
from snakemake.utils import makedirs
# fastqc creates a zip file and an html file but the filename is hard-coded by
# replacing fastq|fastq.gz|fq|fq.g... | lcdb/lcdb-wrapper-tests | wrappers/fastqc/wrapper.py | Python | mit | 1,337 |
"""
Unit test for the parser.
"""
import unittest
from six import StringIO
from lesscpy.lessc.parser import LessParser
class TestLessParser(unittest.TestCase):
"""
Unit tests for LessParser.
"""
def setUp(self):
self.parser = LessParser()
def test_parse_stream(self):
"""
... | joequery/lesscpy | test/test_parser.py | Python | mit | 888 |
from .. import register_backend
from ..elf import ELF
from ...patched_stream import PatchedStream
ELF_HEADER = "7f45 4c46 0101 0100 0000 0000 0000 0000".replace(" ","").decode('hex')
CGC_HEADER = "7f43 4743 0101 0143 014d 6572 696e 6f00".replace(" ","").decode('hex')
class CGC(ELF):
"""
Backend to support th... | Ruide/angr-dev | cle/cle/backends/cgc/cgc.py | Python | bsd-2-clause | 1,452 |
#!/bin/python
# Simple script for shutting down the raspberry Pi at the press of a button.
# by Inderpreet Singh
import RPi.GPIO as GPIO
import time
import os
# Use the Broadcom SOC Pin numbers
# Setup the Pin with Internal pullups enabled and PIN in reading mode.
GPIO.setmode(GPIO.BCM)
GPIO.setu... | mikestebbins/openapsdev | Scripts/shutdown_pi.py | Python | mit | 691 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_generated_aiplatform_v1beta1_metadata_service_query_context_lineage_subgraph_async.py | Python | apache-2.0 | 1,624 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.