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 unittest
from operator import itemgetter
from rdp import (GrammarBuilder, Grammar, flatten, drop, epsilon, repeat, Terminal,
Regexp, Parser, LeftRecursion, ParseError, Optional, Lookahead, ignore, keep)
from rdp.formatter import GrammarFormatter
from rdp import builtins
from rdp.utils import product, uncurr... | emulbreh/rdp | rdp/tests/test_grammar.py | Python | mit | 959 |
"""new pm resource
Revision ID: 7aed6936ccee
Revises: 7aad615d6979
Create Date: 2020-01-29 08:51:35.381339
"""
from alembic import op
import sqlalchemy as sa
import model.utils
from sqlalchemy.dialects import mysql
from rdr_service.participant_enums import PhysicalMeasurementsStatus, QuestionnaireStatus, OrderStatus... | all-of-us/raw-data-repository | rdr_service/alembic/versions/7aed6936ccee_new_pm_resource.py | Python | bsd-3-clause | 2,573 |
# Copyright 2011 Cisco Systems, 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 requir... | onecloud/neutron | neutron/plugins/cisco/common/cisco_constants.py | Python | apache-2.0 | 2,838 |
"""add pjsip max_initial_qualify_time
Revision ID: a541e0b5e89
Revises: 461d7d691209
Create Date: 2015-04-15 14:37:36.424471
"""
# revision identifiers, used by Alembic.
revision = 'a541e0b5e89'
down_revision = '461d7d691209'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('ps_globa... | leedm777/asterisk | contrib/ast-db-manage/config/versions/a541e0b5e89_add_pjsip_max_initial_qualify_time.py | Python | gpl-2.0 | 455 |
#
# Copyright (c) 2015 Intel Corporation
#
# 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 t... | inteldcie/PtasHorizon | horizon/openstack_dashboard/dashboards/admin/alarm/views.py | Python | apache-2.0 | 5,737 |
# content of test_sample.py
def inc(x):
return x + 1
def test_answer():
assert inc(3) == 4 | scaffolder/cli | test_sample.py | Python | mit | 99 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.s... | manmeetsaini/etools | code/archive/qtui_test.py | Python | gpl-3.0 | 2,827 |
from __future__ import unicode_literals
import swapper
from accelerator_abstract.models import BaseMentoringSpecialties
class MentoringSpecialties(BaseMentoringSpecialties):
class Meta(BaseMentoringSpecialties.Meta):
swappable = swapper.swappable_setting(
BaseMentoringSpecialties.Meta.app_la... | masschallenge/django-accelerator | accelerator/models/mentoring_specialties.py | Python | mit | 349 |
"""
Created on Thu May 05 20:02:00 2011
@author: Tillsten
"""
import numpy as np
from scipy.linalg import qr
eps = np.finfo(float).eps
def mls(B, v, umin, umax, Wv=None, Wu=None, ud=None, u=None, W=None, imax=100):
"""
mls - Control allocation using minimal least squares.
[u,W,iter] = mls_alloc(... | treverhines/ModEst | modest/pymls/init.py | Python | mit | 7,780 |
#!/usr/bin/python3
"""
Global variables for onedrive_d.
"""
import os
import sys
import logging
import atexit
import json
from calendar import timegm
from datetime import timezone, datetime, timedelta
from pwd import getpwnam
from . import od_ignore_list
config_instance = None
logger_instance = None
update_last_run_... | kevinwincott/onedrive-d | onedrive_d/od_glob.py | Python | lgpl-3.0 | 5,976 |
from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.nzb.base import NZBProvider
from couchpotato.environment import Env
import re
import traceback
log = CP... | lebabouin/CouchPotatoServer-develop | couchpotato/core/providers/nzb/binsearch/main.py | Python | gpl-3.0 | 3,674 |
"""
This module is the test suite of the info CLI option for bowl.
Created on 27 July 2014
@author: Charlie Lewis
"""
from bowl.cli_opts import info
class Object(object):
pass
class TestClass:
"""
This class is responsible for all tests in the info CLI option.
"""
def test_cli_opts_info(self):
... | cglewis/bowl | tests/cli_opts/test_cli_opts_info.py | Python | apache-2.0 | 441 |
# Copyright 2013 University of Maryland. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE.TXT file.
import os
from framework.Targets import ApacheTarget
class Target(ApacheTarget):
def get_path(filename):
return os.path.dirname(os.pat... | UMD-SEAM/bugbox | framework/Targets/eXtplorer_2_1_0/__init__.py | Python | bsd-3-clause | 494 |
from django.db import models
from django.contrib.auth.models import User
from datetime import date
class Area(models.Model):
nombre = models.CharField(max_length=40)
class Meta:
verbose_name = 'area'
verbose_name_plural = 'areas'
def __unicode__(self):
return self.nombre
clas... | LuchoCastillo/RegistroTEA | ProyectoTEA/AppTEA/models.py | Python | gpl-2.0 | 2,550 |
# -*- coding: utf-8 -*-
from odoo.exceptions import AccessError
from odoo import api, fields, models, _
from odoo import SUPERUSER_ID
from odoo.exceptions import UserError, ValidationError
from odoo.http import request
from odoo.addons.account.models.account_tax import TYPE_TAX_USE
import logging
_logger = logging.g... | ddico/odoo | addons/account/models/chart_template.py | Python | agpl-3.0 | 68,522 |
a = raw_input("Yakin ? (y/t) : ")
list = ["y","Y"]
if a in list :
print "baiklah"
elif a in ["t","T"]:
print "Sayang Sekali"
else:
print "Liat Pilihan OON" | Jufianto/LearnPython | fistLearn/konsidi.py | Python | mit | 165 |
"""
WSGI config for lot project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_M... | Ecotrust/COMPASS | mp/wsgi.py | Python | apache-2.0 | 378 |
#/usr/local/env python
# Problem link: https://oj.leetcode.com/problems/insertion-sort-list/
# To acheive O(1) space complexity for singly-linked list (not required),
# this version alters the original insertion sort,
# which searches for insertion position from the beginning.
# (and would failed on sorted testing da... | erichoco/LeetCodeOJ | Insertion Sort/insertion_sort.py | Python | cc0-1.0 | 2,123 |
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME, login as auth_login
from django.contrib.sites.shortcuts import get_current_site
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.utils.six.moves.urllib.parse import urlparse
from ... | brutasse/django-ratelimit-backend | ratelimitbackend/views.py | Python | bsd-3-clause | 2,132 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Define utility functions and classes for ccdproc
"""
__all__ = ["slice_from_string"]
def slice_from_string(string, fits_convention=False):
"""
Convert a string to a tuple of slices.
Parameters
----------
string : str
A... | astropy/ccdproc | ccdproc/utils/slices.py | Python | bsd-3-clause | 4,170 |
import serial
_queries = {
'XPDR:MEAS:CAP?': [
'response',
'response_modes',
'modes_state',
'modes_level'
],
'XPDR:MEAS:ATCR:ACAL?': [
'allcall',
'allcall_modea',
'allcall_modec'
],
'XPDR:MEAS:ATCR:DEC?': [
'decoder',
'decoder_... | taiwenko/python | instruments/aeroflex.py | Python | mit | 4,146 |
# -*- coding: UTF-8 -*-
from behave import step
from dogtail.predicate import GenericPredicate
import dogtail.rawinput
from time import sleep
from behave_common_steps import wait_until
import pyatspi
from gi.repository import GLib
from __builtin__ import xrange
@step(u'Memo editor with title "{name}" is opened')
def ... | fedora-desktop-tests/evolution | features/steps/memo_steps.py | Python | gpl-2.0 | 8,165 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy import units as u
from astropy.utils.decorators import format_doc
from astropy.coordinates import representation as r
from astropy.coordinates.baseframe import BaseCoordinateFrame, RepresentationMapping, base_doc
from ... | StuartLittlefair/astropy | astropy/coordinates/builtin_frames/supergalactic.py | Python | bsd-3-clause | 2,565 |
# Copyright 2019 Google LLC, Andrew Hines
#
# 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 t... | google/visqol | scripts/make_svm_train_file.py | Python | apache-2.0 | 2,966 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | canarie/openstack-dashboard | django-openstack/src/django_openstack/nova/views/securitygroups.py | Python | apache-2.0 | 8,882 |
#!/usr/bin/python -t
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed... | henrysher/urlgrabber | test/test_mirror.py | Python | lgpl-2.1 | 13,630 |
# The following script will send a quote to a Log and Speech service every minute.
speech = Runtime.createAndStart("speech","Speech")
cron = Runtime.createAndStart("cron", "Cron")
log = Runtime.createAndStart("log", "Log")
cron.addScheduledEvent("* * * * *","speech","speak", "hello sir, time for your coffee")
cr... | sujitbehera27/MyRoboticsProjects-Arduino | src/resource/Python/examples/Cron.py | Python | apache-2.0 | 400 |
'''
Created on 2010-01-03
@author: cfournie
'''
import DocumentStructure
import re
import util
DISCOURSE_CONNECTIVES = [('[,]{1} ','actually', '[ ,.]{1}'),
('[,]{1} ','afterwards', '[ ,.]{1}'),
('[,]{1} ','again', '[ ,.]{1}'),
('... | cfournie/docstruct | module/src/docstruct/ParseText.py | Python | bsd-3-clause | 6,001 |
# coding=utf-8
from PyQt6 import QtWidgets, QtGui
from kataja.UIItem import UIWidget
from kataja.singletons import qt_prefs
from kataja.ui_widgets.buttons.OverlayButton import OverlayButton
class QuickEditButton(OverlayButton):
permanent_ui = True
def __init__(self, size=24, color_key='accent3', **kwargs):
... | jpurma/Kataja | kataja/ui_widgets/buttons/QuickEditButtons.py | Python | gpl-3.0 | 6,068 |
# Copyright 2022 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... | tensorflow/tensorflow | tensorflow/python/eager/function_spec.py | Python | apache-2.0 | 22,157 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | jonparrott/google-cloud-python | texttospeech/tests/unit/gapic/v1/test_text_to_speech_client_v1.py | Python | apache-2.0 | 4,667 |
'''
Created on Sep 10, 2012
@author: mchrzanowski
'''
from ProjectEulerLibrary import generate_next_prime
def main():
# it's hard to know whether a number even
# has a given number of prime factors
# (avg case is ln ln n). so, disallow
# the user from inputting a given number
# of prime factors... | mchrzanowski/ProjectEuler | src/python/Problem132.py | Python | mit | 1,191 |
#!/usr/bin/env python
########################################################################
# File : dirac-admin-get-proxy
# Author : Stuart Paterson
########################################################################
"""
Retrieve a delegated proxy for the given user and group
"""
import os
import DIRAC
f... | andresailer/DIRAC | FrameworkSystem/scripts/dirac-admin-get-proxy.py | Python | gpl-3.0 | 4,395 |
from warnings import warn
import numpy as np
from mizani.bounds import rescale_max
from mizani.palettes import abs_area, area_pal, rescale_pal
from ..doctools import document
from ..exceptions import PlotnineWarning
from ..utils import alias
from .scale import scale_discrete, scale_continuous, scale_datetime
@docum... | has2k1/plotnine | plotnine/scales/scale_size.py | Python | gpl-2.0 | 3,023 |
# -*- 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 Apache License, Version 2.0 (the
#... | Fokko/incubator-airflow | airflow/gcp/example_dags/example_automl_tables.py | Python | apache-2.0 | 10,051 |
#!/usr/bin/env python3
# dmd8a.py: copy of dmd8.py but use Maziar's streaming dmd algorith
# instead of pydmd
# dmd8.py: copy of dmd6.py (best background subtraction approach so far) but
# apply dmd (pydmd w/ sliding window) to the motion diff.
import argparse
import csv
import cv2
import skvideo.io # ... | UASLab/ImageAnalysis | motion/dmd8a.py | Python | mit | 13,207 |
"""
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.utils import datetime_safe
from django.utils i... | hunch/hunch-gift-app | django/core/serializers/json.py | Python | mit | 2,118 |
import ssl
import json
from tornado.testing import gen_test, AsyncTestCase, AsyncHTTPClient
import synapse.daemon as s_daemon
import synapse.dyndeps as s_dyndeps
import synapse.datamodel as s_datamodel
import synapse.lib.webapp as s_webapp
import synapse.lib.certdir as s_certdir
from synapse.tests.common import *
... | vivisect/synapse | synapse/tests/test_lib_webapp.py | Python | apache-2.0 | 7,277 |
# -*- coding: utf-8 -*-
# Mathmaker creates automatically maths exercises sheets
# with their answers
# Copyright 2006-2017 Nicolas Hainaux <nh.techn@gmail.com>
# This file is part of Mathmaker.
# Mathmaker is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License... | nicolashainaux/mathmaker | mathmaker/lib/document/content/calculation/mini_pb_proportionality.py | Python | gpl-3.0 | 2,239 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Red Hat, 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 l... | goneri/dci-control-server | client/test_utils.py | Python | apache-2.0 | 896 |
#===============================================================================
#
# SingleThreadGenerator.py
#
# This file is part of ANNarchy.
#
# Copyright (C) 2016-2021 Julien Vitay <julien.vitay@gmail.com>,
# Helge Uelo Dinkelbach <helge.dinkelbach@gmail.com>
#
# This program is free software:... | ANNarchy/ANNarchy | ANNarchy/generator/Projection/SingleThreadGenerator.py | Python | gpl-2.0 | 60,814 |
"""Test the API client"""
import json
from datetime import datetime, timedelta
from unittest import TestCase
import httpretty
import requests
from ddt import data, ddt, unpack
from mock import patch
from edx.analytics.tasks.util.edx_api_client import EdxApiClient
from edx.analytics.tasks.util.tests.config import wit... | Stanford-Online/edx-analytics-pipeline | edx/analytics/tasks/util/tests/test_edx_api_client.py | Python | agpl-3.0 | 10,339 |
"""
================
Precision-Recall
================
Example of Precision-Recall metric to evaluate classifier output quality.
Precision-Recall is a useful measure of success of prediction when the
classes are very imbalanced. In information retrieval, precision is a
measure of result relevancy, while recall is a m... | davidam/python-examples | scikit/plot_precision_recall.py | Python | gpl-3.0 | 10,580 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | jeffery9/mixprint_addons | plugin/__init__.py | Python | agpl-3.0 | 1,069 |
# (c) Copyright 2014 Cisco Systems 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 re... | beagles/neutron_hacking | neutron/api/v2/resource_helper.py | Python | apache-2.0 | 3,988 |
#! /usr/bin/env python
""" Copyright 2015 Akamai Technologies, 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
Unles... | jdreed/api-kickstart | examples/python/ccu.py | Python | apache-2.0 | 2,966 |
import unittest
import sys
from io import StringIO
from test import support
NotDefined = object()
# A dispatch table all 8 combinations of providing
# sep, end, and file.
# I use this machinery so that I'm not just passing default
# values to print, I'm either passing or not passing in the
# arguments.
dispatch = {
... | brython-dev/brython | www/src/Lib/test/test_print.py | Python | bsd-3-clause | 7,907 |
import time
import random
import os
import signal
import asyncio
from unittest.mock import patch
from molotov.api import scenario, global_setup
from molotov.tests.support import (TestLoop, coserver, dedicatedloop, set_args,
skip_pypy, only_pypy, catch_sleep,
... | loads/ailoads | molotov/tests/test_run.py | Python | apache-2.0 | 21,758 |
import _plotly_utils.basevalidators
class SeparatethousandsValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self,
plotly_name="separatethousands",
parent_name="histogram.marker.colorbar",
**kwargs
):
super(SeparatethousandsValidator, self).__init_... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram/marker/colorbar/_separatethousands.py | Python | mit | 488 |
#!/usr/bin/env python
#from distutils.core import setup
from setuptools import setup, find_packages
setup(name="clientend",
version="1.0.0",
description="Library for OAuth version 1.0a.",
author="Garrett Bjerkhoel",
author_email="garrett@clientend.com",
url="http://github.com/clientend/cl... | dewski/clientend-python | setup.py | Python | mit | 540 |
#!/usr/bin/env python
"""
DiabloHorn https://diablohorn.wordpress.com
Converts rsa primitives extracted with windbg from memory
to a workable rsa private key format
"""
import sys
import base64
from Crypto.PublicKey import RSA
def string_to_long(data):
data = data.split(' ')
data.reverse()
return long(("".join(dat... | DiabloHorn/pageant_xkeys | old_code/keycreate.py | Python | bsd-2-clause | 1,849 |
#!/usr/bin/env python
#coding: UTF-8
#
# Defines the crash class, representing a crash.
#
# Copyright (c) 2013 Samuel Groß
#
import re
class Crash:
verbosity = 1 # determines how much information will be returned by the __str__ method
output_all = False # if set to true the string representat... | saelo/iCrashalyzer | crash.py | Python | mit | 4,526 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import socket
from time import localtime, strftime
from django.shortcuts import render
from django.http import HttpResponse
from django.conf import settings as django_settings
from django.core.mail import send_mail
from django.views.decorators import csrf
from time import loca... | 0lidaxiang/WeArt | reader/view/registerView.py | Python | bsd-3-clause | 4,442 |
#
# A file that opens the neuroConstruct project LarkumEtAl2009 and run multiple simulations with random distributed synchonous synaptic input and record from all the terminal branches
#
# Author: Matteo Farinella
from sys import *
from java.io import File
from java.lang import System
from java.util import... | pgleeson/TestArea | models/LarkumEtAl2009/pythonScripts/PNMDAs_distributedinput50ms.py | Python | gpl-2.0 | 11,849 |
# coding:utf-8
import urllib
import settings as USettings
class UEditorEventHandler(object):
"""用来处理UEditor的事件侦听"""
def on_selectionchange(self):
return ""
def on_contentchange(self):
return ""
def render(self,editorID):
jscode="""
%(editor)s.addListene... | younfor/django-fly-blog | flyblog/site-packages/DjangoUeditor/commands.py | Python | apache-2.0 | 5,874 |
from axelrod import Actions, Player, init_args
C, D = Actions.C, Actions.D
class GoByMajority(Player):
"""A player examines the history of the opponent: if the opponent has more
defections than cooperations then the player defects.
In case of equal
number of defections and cooperations this player w... | marcharper/Axelrod | axelrod/strategies/gobymajority.py | Python | mit | 5,515 |
import os
from collections import OrderedDict
import pysam
import cairocffi as cairo
from shabam.parse_reads import parse_read
from shabam.plot_reads import plot_read
from shabam.plot_axis import plot_axis
from shabam.plot_gridlines import plot_grid
from shabam.utils import get_height, fileformat
from shabam.plot_co... | dlrice/shabam | shabam/plot.py | Python | gpl-3.0 | 5,805 |
#==========================================================================
#
# Copyright NumFOCUS
#
# 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/l... | malaterre/ITK | Modules/Core/Common/wrapping/test/itkMatrixTest.py | Python | apache-2.0 | 1,186 |
#! /usr/bin/env python
"""Test script for the gzip module.
"""
import unittest
from test import test_support
import sys, os
import gzip
data1 = """ int length=DEFAULTALLOC, err = Z_OK;
PyObject *RetVal;
int flushmode = Z_FINISH;
unsigned long start_total_out;
"""
data2 = """/* zlibmodule.c -- gzip-compatibl... | zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/test/test_gzip.py | Python | epl-1.0 | 3,913 |
while True:
pass
| museomix/2013_Quebec_thermoscope | raspberry/pygame-1.9.1release/test/test_test_.py | Python | mit | 27 |
from django import template
from django.utils.safestring import mark_safe
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
register = template.Library()
HIDDEN_URIS = (
"/login/",
"/register/",
"/podcast/",
"/device/",
"/user/subscriptions/",
... | gpodder/mygpo | mygpo/web/templatetags/menu.py | Python | agpl-3.0 | 4,544 |
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
import re
from pytest import raises
from jenkinsflow.flow import serial, parallel, FailedChildJobException
from .cfg import ApiType
from .framework import api_select
from .framework... | lechat/jenkinsflow | test/reporting_test.py | Python | bsd-3-clause | 14,873 |
"""The tests for Z-Wave JS device triggers."""
from unittest.mock import patch
import pytest
import voluptuous_serialize
from zwave_js_server.const import CommandClass
from zwave_js_server.event import Event
from zwave_js_server.model.node import Node
from homeassistant.components import automation
from homeassistant... | mezz64/home-assistant | tests/components/zwave_js/test_device_trigger.py | Python | apache-2.0 | 48,655 |
from optparse import make_option
from subprocess import Popen, PIPE
from django.conf import settings
from django.core.mail import mail_admins
from django.core.management.base import BaseCommand
from dynamic_scraper.models import Scraper
class Command(BaseCommand):
help = 'Runs all checker tests'
option_li... | tanzaho/django-dynamic-scraper | management/commands/run_checker_tests.py | Python | bsd-3-clause | 2,073 |
# -*- coding: utf-8 -*-
"""Top-level package for judicious."""
__author__ = """Jordan W. Suchow"""
__email__ = 'jwsuchow@gmail.com'
__version__ = '0.1.0'
import os
with open(".JUDICIOUS_SERVER_URL", "w") as f:
url = os.environ.get("JUDICIOUS_SERVER_URL", "http://127.0.0.1:5000")
f.write(url)
from .core i... | suchow/judicious | judicious/__init__.py | Python | mit | 2,320 |
from unittest import TestCase
from StringIO import StringIO
from mock import MagicMock
from nose.tools import raises
from apetools.commons.errors import CommandError
from apetools.commands.windowsssidconnect import WindowsSSIDConnect
OUTPUT = """
Connection request was completed successfully.
"""
ERROR = """
There ... | rsnakamura/oldape | tests/testunits/testcommands/testwindowsssidconnect/testwindowsssidconnect.py | Python | apache-2.0 | 1,258 |
# Add your Python code here. E.g.
from microbit import *
MAX_ROWS=4
level = 9
def scan(pause=500, reverse=False):
for i in range(0,10):
x = 0
rows = i
cols = i
while x <= i:
for y in range(0,rows+1):
if x <= MAX_ROWS and y <= MAX_ROWS:
... | OiNutter/microbit-scripts | scan/scan.py | Python | mit | 618 |
##~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~##
## ##
## This file forms part of the BayesLands surface processes modelling companion. ##
## ... | badlands-model/BayesLands | bl_mcmc.py | Python | gpl-3.0 | 33,526 |
"""
Django settings for biblio project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | BostonMarcin/django_kurs | biblio/settings.py | Python | mit | 2,152 |
def ans():
return None
if __name__ == '__main__':
print(ans())
| mackorone/euler | src/template.py | Python | mit | 77 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from mcm.cli import main
if __name__ == '__main__':
main()
| luqasz/mcm | mcm.py | Python | gpl-2.0 | 112 |
import unittest
from island import *
class TestIslandBounds(unittest.TestCase):
def test_one_point(self):
island = IslandBounds()
x,y = 4,5
island.addPixel(x,y)
self.assertEqual(island.minx, x)
self.assertEqual(island.maxx, x)
self.assertEqual(island.miny, y)
self.assertEqual(island.maxy, y)
self... | shaunlebron/PterodactylAttack | project/packer/test_island.py | Python | gpl-3.0 | 3,981 |
# -*- coding: utf-8 -*-
# Django
from django.db import models
from .mixins import SelfPublishModel
from .serializers import TodoListSerializer, TodoItemSerializer
class TodoList(SelfPublishModel, models.Model):
serializer_class = TodoListSerializer
channel_name = u"todo-list"
name = models.CharField(ma... | aaronbassett/djangocon-pusher | talk/todo/models.py | Python | mit | 891 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2013 AKFish <akfish@gmail.com> #
# Copyright 2013 Peter Golm <golm.peter@gmail.com> ... | pombredanne/PyGithub | github/Notification.py | Python | gpl-3.0 | 5,674 |
#
# Copyright (C) 2015 INRA
#
# 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 distributed in the hop... | FAANG/faang-methylation | workflowbs/src/jflow/featureiolib/gff3.py | Python | apache-2.0 | 7,391 |
#!/usr/bin/env python3
'''
@author Michele Tomaiuolo - http://www.ce.unipr.it/people/tomamic
@license This software is free - http://www.gnu.org/licenses/gpl.html
'''
def troll(text: str) -> str:
output = ""
trolling = False
for c in text:
if c == '*':
trolling = not trolling
e... | tomamic/fondinfo | exercises/e3_2014_7_troll.py | Python | gpl-3.0 | 789 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017-2019 Satpy developers
#
# This file is part of satpy.
#
# satpy 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 Licens... | pytroll/satpy | satpy/readers/file_handlers.py | Python | gpl-3.0 | 11,406 |
# Python stubs generated by omniidl from idl/emergency.idl
import omniORB, _omnipy
from omniORB import CORBA, PortableServer
_0_CORBA = CORBA
_omnipy.checkVersion(3,0, __file__)
#
# Start of module "_GlobalIDL"
#
__name__ = "_GlobalIDL"
_0__GlobalIDL = omniORB.openModule("_GlobalIDL", r"idl/emergency.idl")
_0__Glob... | kzmssk/penkobugui | emergency_idl.py | Python | gpl-3.0 | 2,354 |
from django.conf.urls import include, url
from django.contrib import admin
from blockchain.models import Block
from rest_framework import routers, serializers, viewsets
# Serializers define the API representation.
class BlockSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Block... | etherwire/etherwire | api/urls.py | Python | mit | 679 |
import sys
import argparse
from Bio import SeqIO
from Bio.Seq import Seq
import Bio.SeqUtils as SeqUtils
import HTSeq
import numpy as np
def idsContainGiven(givenId, transcriptIds):
for tId in transcriptIds:
if givenId.find(tId) != -1:
return True
return False
if __name__ == "__main__":
... | bioinfo-core-BGU/neatseq-flow_modules | neatseq_flow_modules/Liron/Qualimap/createQualimapInfoFile.py | Python | gpl-3.0 | 4,055 |
import numpy as np
import py
from .base import BaseWaveletBox, PI2
class WaveletBox(BaseWaveletBox):
def __init__(self, nsamples, samplerate, scale_resolution, omega0):
super(WaveletBox, self). \
__init__(nsamples, samplerate, scale_resolution, omega0)
self.wft = morlet_ft_box(self.... | ivanovwaltz/wavelet_sound_microscope | analyze/wavelet/intel_backend.py | Python | mit | 3,121 |
import commonware
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
from amo.helpers import fetch_amo_user
from person.managers import ProfileManager
log = commonware.log.getLogger('f.profile.models')
class Limit(models.Model):
email = models.... | mozilla/FlightDeck | apps/person/models.py | Python | bsd-3-clause | 3,050 |
import numpy as np
def sharperatio(lista):
nparray = np.array(lista)
count = 0
riskfree = 0
invest = []
for i in np.arange(len(nparray)-1):
invest.append((float(nparray[i+1])/float(nparray[i])) - 1)
count = count + 1
invest = np.array(invest... | jonthejon/Herodes-StockTrading | INDICADORES.py | Python | gpl-3.0 | 11,680 |
#!/usr/bin/python
import pickle
import cPickle
import numpy
from sklearn import cross_validation
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_selection import SelectPercentile, f_classif
def preprocess(words_file = "../tools/word_data.pkl", authors_file="../tools/email_authors.p... | napjon/ds-nd | p5-introml/tools/email_preprocess.py | Python | mit | 2,619 |
#!/usr/bin/env ambari-python-wrap
"""
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... | radicalbit/ambari | ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.9/service_advisor.py | Python | apache-2.0 | 6,291 |
"""
Copyright 2014 Magnus Briden
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
... | mbriden/FatbotIRC | modules/gamemanager.py | Python | apache-2.0 | 2,471 |
<<<<<<< HEAD
<<<<<<< HEAD
"""Fixer that changes raw_input(...) into input(...)."""
# Author: Andre Roberge
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixRawInput(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< name='raw_input' trailer< '(' [any]... | ArcherSys/ArcherSys | Lib/lib2to3/fixes/fix_raw_input.py | Python | mit | 1,502 |
# musiclog/api.py
import json
from tastypie import fields
from tastypie.authorization import DjangoAuthorization
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from musiclog.models import Track, Artist, Release, Airplay, Station
class ArtistResource(ModelResource):
class Meta:
query... | alexjh/whatson | django-view/whatson/musiclog/api.py | Python | gpl-2.0 | 1,371 |
import matplotlib as mpl
mpl.use('pgf')
import numpy as np
import scipy.constants as const
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from uncertainties import ufloat
import uncertainties.unumpy as unp
from uncertainties.unumpy import (nominal_values as noms, std_devs as stds)
mpl.rcParams.upd... | TimBizeps/BachelorAP | FP 2018/V51 Operationsverstärker/auswertung/auswertung6.py | Python | gpl-3.0 | 688 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2017, Gaudenz Steinlin <gaudenz.steinlin@cloudscale.ch>
# 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_ve... | alexlo03/ansible | lib/ansible/modules/cloud/cloudscale/cloudscale_server.py | Python | gpl-3.0 | 13,293 |
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Justin Vincent
# Lars Buitinck
# License: BSD 3 clause
import numpy as np
from nose.tools import assert_equal
from nose.tools import assert_false
from nose.tools import assert_true
from numpy.testing import (assert_almost_equal,
... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/sklearn/utils/tests/test_fixes.py | Python | gpl-2.0 | 1,829 |
# encoding: utf-8
"""Progress messages.
Print messages that overwrite each other.
"""
from __future__ import print_function
import os
import sys
class Error(Exception):
"""Raised when Messages are used incorrectly."""
class _Messages(object):
"""Abstract class to log progress messages."""
def log(self, msg)... | danielkitachewsky/reviewder | common/progress.py | Python | mit | 1,748 |
VERSION = (0, 7)
| ss-dev/django-generic-ratings | ratings/__init__.py | Python | mit | 17 |
#!/usr/bin/python
# This script is used to generate luabinding glue codes.
# Android ndk version must be ndk-r9b.
import sys
import os, os.path
import shutil
import ConfigParser
import subprocess
import re
from contextlib import contextmanager
def _check_ndk_root_env():
''' Checking the environment NDK_ROOT, w... | wanmaple/MWFrameworkForCocosJs | tools/tojs/genbindings_mwframework.py | Python | apache-2.0 | 6,430 |
#!/usr/bin/env python3
import binascii
import struct
with open('usbtrace', 'r') as f:
for linenum, line in enumerate(f):
if linenum < 12:
continue
parts = line.rstrip().split(' ', 7)
if len(parts) <= 7:
continue
if parts[3] == 'Bo:2:008:3':
dire... | fishilico/sstic-2014 | challenge/1_usb/read_androidcomm.py | Python | mit | 1,577 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND ... | mobb-io/django-erp | djangoerp/menus/tests/test_apps.py | Python | mit | 3,189 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-19 22:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def... | mahim97/zulip | zerver/migrations/0121_realm_signup_notifications_stream.py | Python | apache-2.0 | 1,286 |
import itertools
import options as opt
import quantifiers
import schema
import six
_PARAMETERS = []
_RUN_PARAMETERS = []
class _Parameter():
def __init__(self, name, title, option_name, option_validator,
is_numeric=False, value_namer=None, file_namer=None,
run_parameter=True):
... | COMBINE-lab/piquant | piquant/parameters.py | Python | mit | 5,012 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2013 Async Open Source
##
## 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 Foundation; either version 2
## of the License, or... | tiagocardosos/stoq | stoqlib/lib/test/test_stringutils.py | Python | gpl-2.0 | 2,658 |
"""
Drop-in replacement for ``django.conf.settings`` that provides a
consistent access method for settings defined in applications, the project
or Django itself. Settings can also be made editable via the admin.
"""
from __future__ import unicode_literals
from future.builtins import bytes, str
from functools import p... | batpad/mezzanine | mezzanine/conf/__init__.py | Python | bsd-2-clause | 7,856 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.