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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import with_statement
from time import sleep
from os.path import exists, join
from shutil import copy
from traceback import print_exc
from utils import chmod
# ignore these plugin configs, mainly because plugins were wiped out
IGNORE = (
"FreakshareNet", "SpeedManager", "A... | manuelm/pyload | module/ConfigParser.py | Python | gpl-3.0 | 11,895 |
"""
This module contains factory functions that attempt
to return Qt submodules from the various python Qt bindings.
It also protects against double-importing Qt with different
bindings, which is unstable and likely to crash
This is used primarily by qt and qt_for_kernel, and shouldn't
be accessed directly from the o... | RandallDW/Aruba_plugin | plugins/org.python.pydev/pysrc/pydev_ipython/qt_loaders.py | Python | epl-1.0 | 7,822 |
import random, math
import gimp_be
#from gimp_be.utils.quick import qL
from gimp_be.image.layer import editLayerMask
from effects import mirror
import numpy as np
import UndrawnTurtle as turtle
def brushSize(size=-1):
""""
Set brush size
"""
image = gimp_be.gimp.image_list()[0]
drawable = gimp_be.p... | J216/gimp_be | gimp_be/draw/draw.py | Python | mit | 26,770 |
from smallestPrimeDivisor import smallestPrimeDivisor
import numpy as np
def allPrimeFactors( n ):
smallestPrimeFactor = 1
allPrimeFactors = np.array(smallestPrimeFactor)
newQuotient = n
while (smallestPrimeFactor != newQuotient):
newQuotient = newQuotient/smallestPrimeFactor
smalle... | aerokappa/ProjectEuler | allPrimeFactors.py | Python | mit | 482 |
from expects import expect, equal
from primestg.report import Report
from ast import literal_eval
with description('Report S24 examples'):
with before.all:
self.data_filenames = [
'spec/data/CIR4621511030_0_S24_0_20180529093051',
'spec/data/CIR4621707229_0_S24_0_20180529200000',
... | gisce/primestg | spec/Report_S24_spec.py | Python | agpl-3.0 | 1,939 |
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | samrussell/sippy | sippy/UacStateUpdating.py | Python | gpl-2.0 | 5,543 |
#!/usr/bin/env python
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | pforret/python-for-android | python3-alpha/python-libs/gdata/test_config.py | Python | apache-2.0 | 17,822 |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from moto.ec2.utils import filters_from_querystring, sequence_from_querystring
class VPNConnections(BaseResponse):
def create_vpn_connection(self):
type = self.querystring.get("Type", [None])[0]
cgw_id = self.que... | heddle317/moto | moto/ec2/responses/vpn_connections.py | Python | apache-2.0 | 13,604 |
#!/usr/bin/env python
"""
detector.py is an out-of-the-box windowed detector
callable from the command line.
By default it configures and runs the Caffe reference ImageNet model.
Note that this model was trained for image classification and not detection,
and finetuning for detection can be expected to improve ... | Xiaomi2008/Caffe_3D_FF | python/detect.py | Python | bsd-2-clause | 5,423 |
__author__ = 'wangp11'
def decorator_fun(my_func):
def decorator(*args, **kwargs):
print 'before ' + my_func.__name__
print '1'
print args
print '2'
print kwargs
setattr(my_func, "New", "Test")
r = my_func(*args, **kwargs)
print 'after ' + my_func.__... | peter-wangxu/python_play | test/decorator_test/func_test.py | Python | apache-2.0 | 615 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'SourceRegionPolygon'
db.create_table('region_polygon', (
... | SeedScientific/polio | datapoints/migrations/0059_auto__add_sourceregionpolygon.py | Python | agpl-3.0 | 17,972 |
import os
import struct
import sys
import time
from serial import Serial
import chipDB
class IspBase():
def programChip(self, flashData):
self.curExtAddr = -1
self.chip = chipDB.getChipFromDB(self.getSignature())
if self.chip == False:
raise IspError(
"Chip w... | d42/octoprint-fork | src/octoprint/util/avr_isp/ispBase.py | Python | agpl-3.0 | 1,069 |
"""
WSGI config for costruttoridimondi 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("... | chiara-paci/costruttoridimondi | costruttoridimondi/costruttoridimondi/wsgi.py | Python | gpl-3.0 | 414 |
# Copyright (C) 2009 Alessandro Decina
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed... | alessandrod/cattivo | cattivo/clientlist/db.py | Python | gpl-2.0 | 755 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | LockScreen/Backend | venv/lib/python2.7/site-packages/awscli/customizations/waiters.py | Python | mit | 9,721 |
"""Main module for running this tool standalone.
When buck invokes this tool it generates its own main module.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import with_statement
from . import buck
if __name__ == '__main__':
buck... | daedric/buck | src/com/facebook/buck/json/buck_parser/__main__.py | Python | apache-2.0 | 328 |
import heapq
class Solution(object):
def maximumProduct(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
min2 = heapq.nsmallest(2, nums)
max3 = heapq.nlargest(3, nums)
return max(max3[0] * max3[1] * max3[2],
max3[0] * min2[0] * min2[... | wufangjie/leetcode | 628. Maximum Product of Three Numbers.py | Python | gpl-3.0 | 506 |
import sys
import csv
csv.field_size_limit(sys.maxsize)
import time
from collections import defaultdict
import math
DELIMITER = "\t"
class MutualInfo:
INPUTFILE_PAIRS = 'cooccurences.csv'
INPUTFILE_FREQUENCY = 'freq.csv'
def __init__(self):
self.pairs_file_name = self.INPUTFILE_PAIRS
se... | nlpub/russe-evaluation | russe/mutual_info.py | Python | mit | 2,454 |
# Copyright 2011 the Melange authors.
#
# 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 wr... | rhyolight/nupic.son | app/soc/views/user.py | Python | apache-2.0 | 4,262 |
import logging
import re
from urllib.parse import urlparse, urlunparse
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import import_string
from wagtail.core.utils import get_content_languages
logger = logging.getLogger('wagtail.frontendcach... | kaedroho/wagtail | wagtail/contrib/frontend_cache/utils.py | Python | bsd-3-clause | 5,993 |
# coding: iso-8859-1 -*-
"""
Created on Wed Oct 22 15:59:34 2014
@author: FábioPhillip
"""
from types import StringType
class DadosDeAmigoEmComum:
def __init__(self,notaCompatibilidade, coisasEmComumDosAmigos):
self.notaDeCompatibilidade = notaCompatibilidade
self.coisasEmComum = coisasEmComumDosA... | Topicos-3-2014/friendlyadvice | DadosDeAmigoEmComum.py | Python | epl-1.0 | 1,698 |
"""
Interactive Use
To prepare a terminal for interactive use:
>>> from pyeda.inter import *
"""
# Disable "unused-import", since that's basically all this module is for.
# pylint: disable=W0611
from pyeda.util import clog2, parity
from pyeda.boolalg.boolfunc import (
num2point, num2upoint, num2term,
... | cjdrake/pyeda | pyeda/inter.py | Python | bsd-2-clause | 1,468 |
"""A client for ClearCase."""
from __future__ import unicode_literals
import datetime
import itertools
import logging
import os
import re
import sys
import threading
from collections import defaultdict, deque
import six
from pkg_resources import parse_version
from pydiffx.dom import DiffX
from rbtools.api.errors im... | reviewboard/rbtools | rbtools/clients/clearcase.py | Python | mit | 75,719 |
# -*- coding: utf-8 -*-
#
# Insekta documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 24 16:48:19 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | teythoon/Insekta | docs/conf.py | Python | mit | 7,761 |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | tellesnobrega/storm_plugin | sahara/tests/integration/configs/config.py | Python | apache-2.0 | 23,834 |
import urllib2
import cookielib
import csv
from os import path
file_path = path.expanduser('~')+r'\abook.csv'
class Way2sms:
def __init__(self):
self.cookies = cookielib.CookieJar()
self.jession_id = ''
self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookies)... | Lucifer5545/Way2sms | lib/way2.py | Python | gpl-3.0 | 2,018 |
# vim: set et sw=3 tw=0 fo=awqorc ft=python:
#
# Astxx, the Asterisk C++ API and Utility Library.
# Copyright (C) 2005, 2006 Matthew A. Nicholson
# Copyright (C) 2006 Tim Blechmann
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License ... | m0tive/fsm | site_scons/site_tools/doxygen/doxygen_boehme_2007-07-18.py | Python | mit | 7,610 |
# BlockFormatter uses a stream (usually a file, but possibly any stream
# with read/write/seek/tell/truncate functionality) to represent a
# sequence of blocks, each containing some headers and some data.
#
# Following is an explaination of how the stream is actually formatted.
# Please note that the roles of the diffe... | hagai-helman/LABTypes | python2/LABTypes/LABAPI/BlockFormatter.py | Python | gpl-3.0 | 8,274 |
import rospy
class RosSub():
def __init__(self, dataType, scope):
self.data = None
self.dataType = dataType
self.scope = scope
self.people_sensor = rospy.Subscriber(name=self.scope, data_class=self.dataType, callback=self.callback)
print("Init RosSub Sensor with Scope %s an... | CentralLabFacilities/pepper_behavior_sandbox | pepper_behavior/sensors/ros_sub.py | Python | gpl-3.0 | 565 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# tools configuration file "tools.py" for the
# saga_cmd parameter interface generator "param_interface.py"
# copyright (C) 2015 by Volker Wichmann
# released under the GNU General Public License as published by the
# Free ... | UoA-eResearch/saga-gis | saga-gis/src/scripting/python/helpers/saga_cmd_param_interface/tools.py | Python | gpl-3.0 | 31,224 |
########################## LICENCE ###############################
# Copyright (c) 2005-2012, Michele Simionato
# 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 so... | ktan2020/legacy-automation | win/Lib/site-packages/decorator-3.4.0-py2.7.egg/decorator.py | Python | mit | 10,639 |
#!/usr/bin/env python
import re
from setuptools import setup, find_packages
pkgname = 'pyworkflow'
# gather the package information
main_py = open('pyworkflow/__init__.py').read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", main_py))
packages = filter(lambda p: p.startswith(pkgname), find_packages())
# c... | pyworkflow/pyworkflow | setup.py | Python | mit | 1,065 |
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | sassoftware/rbuild | plugins/createprojectbranch.py | Python | apache-2.0 | 8,529 |
from yowsup.layers.protocol_iq.protocolentities import IqProtocolEntity
from yowsup.structs import ProtocolTreeNode
'''
<iq xmlns="privacy" type="get" id="{{IQ_ID}}">
<privacy>
</privacy>
</iq>
'''
class GetPrivacyIqProtocolEntity(IqProtocolEntity):
XMLNS = "privacy"
def __init__(self):
super(GetPriva... | colonyhq/yowsup | yowsup/layers/protocol_profiles/protocolentities/iq_privacy_get.py | Python | gpl-3.0 | 919 |
__author__ = 'robswift'
__project__ = 'blastnfilter'
import os
from BlastNFilter.PreRelease import ParsePreRelease
from BlastNFilter.Blast import ParseAlignment
import OutPut
def run(options):
non_polymer = options.non_polymer
polymer = options.polymer
out = options.out
blast_dir = os.path.abspath(op... | rvswift/BlastNFilter | build/lib/BlastNFilter/Utilities/Run.py | Python | bsd-3-clause | 827 |
__author__ = 'Bohdan Mushkevych'
import functools
from werkzeug.wrappers import Request
from synergy.mx.utils import jinja_env
def valid_action_request(method):
""" wraps method with verification for is_request_valid"""
@functools.wraps(method)
def _wrapper(self, *args, **kwargs):
assert isinst... | eggsandbeer/scheduler | synergy/mx/base_request_handler.py | Python | bsd-3-clause | 1,418 |
import numpy as np
import pandas as pd
# from matplotlib.pyplot import plot,show,draw
import scipy.io
import sys
sys.path.append("../")
from functions import *
from pylab import *
from sklearn.decomposition import PCA
import _pickle as cPickle
import matplotlib.cm as cm
import os
#####################################... | gviejo/ThalamusPhysio | python/figure_talk/main_talk_7_corr.py | Python | gpl-3.0 | 14,903 |
#!/usr/bin/env python
from generator.actions import Actions
import copy
import random
import string
import numpy
import struct
valid_users = [ [6, 3, 4, 5], [9, 1, 6, 8], [12, 6, 8, 10], [18, 9, 12, 15], [19, 3, 10, 18], [20, 7, 14, 17], [24, 12, 16, 20], [25, 4, 17, 22], [27, 3, 18, 24], [28, 18, 19, 21], [29, 11, 1... | f0rki/cb-multios | original-challenges/Diophantine_Password_Wallet/poller/for-release/machine.py | Python | mit | 3,675 |
# -*- coding: utf-8 -*-
"""
Written by Daniel M. Aukes.
Email: danaukes<at>seas.harvard.edu.
Please see LICENSE.txt for full license.
"""
import PySide.QtCore as qc
import PySide.QtGui as qg
from . import modes
from popupcad.graphics2d.graphicsitems import Common
import popupcad
class InteractiveVertexBase(qg.QGraph... | Skylion007/popupcad | popupcad/graphics2d/interactivevertexbase.py | Python | mit | 7,350 |
from flask import Blueprint, Response, request, url_for
from thing_api.extensions import db
from thing_api.models import Thing
from thing_api.exceptions import ApplicationError
from flask_negotiate import consumes, produces
from datetime import datetime
from jsonschema import validate, ValidationError, FormatChecker
im... | matthew-shaw/thing-api | thing_api/views/thing_v1.py | Python | mit | 4,955 |
#!/usr/bin/env python
import sys
import os
block_dir = sys.argv[1]
suffix = "rbs.frequency.txt"
bins = []
totals = {}
total_count = 0
for i in range(0, 1000000):
prefix = "%013d" % i
freq_fn = os.path.join(block_dir, "%s.%s" % (prefix, suffix))
if not os.path.exists(freq_fn):
break
sys.stder... | alexpreynolds/byte-store | share/merge_block_frequencies.py | Python | mit | 754 |
import os
import sys
import tempfile
import imp
import shutil
import rw.testing
import rw.cli
| FlorianLudwig/rueckenwind | test/test_cli.py | Python | apache-2.0 | 95 |
from copy import deepcopy
from django import forms
from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
from .settings import markdown_config
__all__ = ['MarkdownEditor']
class MarkdownEditor(forms.Textarea):
def render(self, name, value, attrs=None):
... | MSA-Argentina/django-bootstrap-markdown | bootstrap_markdown/widgets.py | Python | bsd-3-clause | 1,721 |
""" Test class for Pilot
"""
from __future__ import absolute_import, division, print_function
# pylint: disable=protected-access, missing-docstring, invalid-name, line-too-long
# imports
import unittest
import json
import stat
import sys
import os
import shutil
from Pilot.pilotTools import PilotParams
from Pilot.pi... | DIRACGrid/Pilot | Pilot/tests/Test_Pilot.py | Python | gpl-3.0 | 4,597 |
#!/usr/bin/python
# initialize the flask app
# add configuration to the application
# register the blueprints with the app
from routes.deepzoom import dz
from routes.slides import slides
from routes.static import static
from flask import Flask
from utils.config import get_app_configurations
#start the flask app
app ... | DigitalSlideArchive/PanCanViewer | webservice/app.py | Python | mit | 638 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
import unittest
from meridian.acupoints import chengman23
class TestChengman23Functions(unittest.TestCase):
def setUp(self):
pass
def test_xxx(self):
pass
if __name__ == '__main__':
unittest.main()
| sinotradition/meridian | meridian/tst/acupoints/test_chengman23.py | Python | apache-2.0 | 301 |
"""Queue item for deep analysis by irwin"""
from default_imports import *
from modules.queue.Origin import Origin
from modules.game.Game import PlayerID
from datetime import datetime
import pymongo
from pymongo.collection import Collection
IrwinQueue = NamedTuple('IrwinQueue', [
('id', PlayerID),
('o... | clarkerubber/irwin | modules/queue/IrwinQueue.py | Python | agpl-3.0 | 1,421 |
import re
def clean_text(text):
return re.sub('[^\w\d_,\. -]', '', text, flags=re.UNICODE)
| aluminiumgeek/cc-telegram | modules/utils/text.py | Python | gpl-3.0 | 97 |
'''
Problem 18
31 May 2002
By starting at the top of the triangle below and moving to adjacent
numbers on the row below, the maximum total from top to bottom is 23.
3
7 4
2 4 6
8 5 9 3
That is, 3 + 7 + 4 + 9 = 23.
Find the maximum total from top to bottom of the triangle below:
... | arturh85/projecteuler | python/src/problem018.py | Python | mit | 5,836 |
"""
Simple fixes for Python 2/3 compatibility
"""
import sys
PY3K = sys.version_info[0] >= 3
if PY3K:
import builtins
import functools
reduce = functools.reduce
zip = builtins.zip
xrange = builtins.range
map = builtins.map
else:
import __builtin__
import itertools
builtins = __b... | plotly/plotly.py | packages/python/plotly/plotly/matplotlylib/mplexporter/_py3k_compat.py | Python | mit | 443 |
import uuid
from pdb import set_trace
from django import forms
from django.utils.translation import ugettext_lazy as _
from django_vcs_watch.models import Repository
from django_vcs_watch.settings import VCS_ONLY_PUBLIC_REPS, \
VCS_URL_REWRITER
from django_vcs_watch.utils import ... | svetlyak40wt/django-vcs-watch | src/django_vcs_watch/forms.py | Python | bsd-3-clause | 1,870 |
from datetime import datetime, timedelta
from importlib import import_module
from celery import shared_task
from django_db_geventpool.utils import close_connection
from django.contrib.auth import get_user_model
from django.conf import settings
from mygpo.celery import celery
from . import models
from celery.utils.l... | gpodder/mygpo | mygpo/users/tasks.py | Python | agpl-3.0 | 2,205 |
#!/usr/bin/python3
"""
A script to get the public ip address from http://checkip.dyndns.org
"""
import urllib.error
import urllib.request
import re
import time
def contact_server():
"""
Try to get public ip address
"""
ipv4_address_pattern=re.compile(r'[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
ip_addresses... | Bolt64/my_code | twitter_bot/get_ip.py | Python | mit | 881 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('books', '0007_auto_20160422_1121'),
]
operations = [
migrations.AlterField(
model_name='author',
... | MattRijk/ebook_site | books/migrations/0008_auto_20160422_1148.py | Python | mit | 1,122 |
print('이 문장은 화면폭에 비해 너무 길어 보기가 힘듭니다 \t\t\t\t\tasd') | JaeGyu/PythonEx_1 | py200_035.py | Python | mit | 94 |
import pcl
p = pcl.PointCloud()
p.from_file("test_pcd.pcd")
fil = p.make_statistical_outlier_filter()
fil.set_mean_k (50)
fil.set_std_dev_mul_thresh (1.0)
fil.filter().to_file("inliers.pcd") | hunter-87/binocular-dense-stereo | cpp_pcl_visualization/pcl_visualization_pcd/pcl_test.py | Python | gpl-2.0 | 190 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
#
# puding
# Copyright (C) Gökmen Görgen 2009 <gkmngrgn@gmail.com>
#
# puding 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 ... | gkmngrgn/puding | puding/main.py | Python | gpl-3.0 | 2,932 |
################################################################
# Voluto - Volunteering Computing Administration & Organization
# Copyright (C) 2015 Ioannis Charalampidis
#
# 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 t... | wavesoft/voluto | src/voluto/projects/management/commands/projectcron.py | Python | gpl-2.0 | 1,282 |
class Solution(object):
def simplifyPath(self, path):
"""
:type path: str
:rtype: str
"""
result = []
tokens = [x for x in path.split('/') if x != '' and x != '.']
for x in tokens:
if x == '..':
if len(result) != 0:
... | jason-xuan/Leetcode-is-Magic | Python/71. Simplify Path.py | Python | mit | 703 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Logging setup"""
from __future__ import absolute_import
import logging
from logging.handlers import RotatingFileHandler
from pyrochess.metadata import PROGRAM as _PROGRAM
_FMAT = r'%(asctime)s.%(msecs)-3d | ' + \
r'%(levelname)-8s | ' + \
r'{0:12s} | ' +... | idrmhyprbls/PyroChess | pyrochess/logger.py | Python | bsd-3-clause | 1,555 |
###############################################################################
##
## Copyright (C) 2014-2015, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | hjanime/VisTrails | vistrails/core/layout/version_tree_layout.py | Python | bsd-3-clause | 7,390 |
# Copyright (c) 2012 Gursev Singh Kalra McAfee, Foundstone
#
# This class contains information for all CAPTCHA providers that this tool targets
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; e... | OpenSecurityResearch/clipcaptcha | clipcaptcha/ProviderInfo.py | Python | gpl-3.0 | 5,374 |
from __future__ import print_function
from legacypipe.survey import LegacySurveyData
class DecamSurvey(LegacySurveyData):
def filter_ccd_kd_files(self, fns):
return [fn for fn in fns if 'decam' in fn]
def filter_ccds_files(self, fns):
return [fn for fn in fns if 'decam' in fn]
def filter_a... | legacysurvey/pipeline | py/legacypipe/runs.py | Python | gpl-2.0 | 2,529 |
"""`appengine_config` gets loaded when starting a new application instance."""
import os
import vendor
# insert `lib` as a site directory so our `main` module can load
# third-party libraries, and override built-ins with newer
# versions.
vendor.add(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib'))
| daniel924/BeerRatingsServer | appengine_config.py | Python | apache-2.0 | 317 |
from ddt import (
data,
ddt,
unpack
)
import mock
from django.test import (
override_settings,
TestCase
)
from courses.presenters.programs import ProgramsPresenter
from courses.tests.utils import CourseSamples, ProgramSamples, get_mock_programs
@ddt
class ProgramsPresenterTests(TestCase):
de... | Stanford-Online/edx-analytics-dashboard | analytics_dashboard/courses/tests/test_presenters/test_programs.py | Python | agpl-3.0 | 3,178 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 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
#
#... | tuskar/tuskar-ui | openstack_dashboard/dashboards/infrastructure/service_management/urls.py | Python | apache-2.0 | 923 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Newspipe - A web news aggregator.
# Copyright (C) 2010-2022 Cédric Bonhomme - https://www.cedricbonhomme.org
#
# For more information: https://sr.ht/~cedric/newspipe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | cedricbonhomme/pyAggr3g470r | newspipe/web/views/bookmark.py | Python | agpl-3.0 | 9,376 |
import unittest
import validate
import tests.unit.data
class TestDummy(unittest.TestCase):
def test(self):
self.assertTrue(True)
def test_CanHandleReciStipulation(self):
validate.validateStipulation(tests.unit.data.problems['reci-h#']['stipulation'])
| dturevski/olive-gui | tests/unit/dummy.py | Python | gpl-3.0 | 278 |
'''
Code for COMP90051 Project 1 (link prediction implementation for social network data on Twitter)
Created Date: 12 August 2015
Modified Date: TBA
Coded by:
- Cong Duy Vu Hoang (vhoang2@student.unimelb.edu.au)
- Quang Pham (t.pham4@student.unimelb.edu.au)
- Rabindra Kumar Panda (rpanda@student.unimelb.edu.au)
Prereq... | ravindrapanda/comp90051-2015-link-prediction | src/vtr-lp.py | Python | mit | 24,965 |
"""
Django admin page for course modes
"""
from django.conf import settings
from pytz import timezone, UTC
from ratelimitbackend import admin
from course_modes.models import CourseMode
from django import forms
from opaque_keys import InvalidKeyError
from xmodule.modulestore.django import modulestore
from opaque_keys.e... | motion2015/a3 | common/djangoapps/course_modes/admin.py | Python | agpl-3.0 | 3,158 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Multiple Analysis Generic Unifier and Interpreter aka Magui
# This program processes several snapshoot/sosreport files
# and processes citellus output for combined issues via plugins
# that search for specific plugin a... | zerodayz/citellus | maguiclient/magui.py | Python | gpl-3.0 | 27,189 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL1006230046.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL1006230046 | MODEL1006230046/model.py | Python | cc0-1.0 | 427 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2019 OSGeo
#
# 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 ... | francbartoli/geonode | geonode/geoserver/tests/test_server.py | Python | gpl-3.0 | 52,443 |
# -*- coding: utf-8 -*-
"""
Online Analysis Configuration Control - TANGO attribute model
Version 1.0
Michele Devetta (c) 2013
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 t... | wyrdmeister/OnlineAnalysis | OAGui/src/Control/OAAttrModel.py | Python | gpl-3.0 | 18,589 |
# encoding: utf-8
"""
config_file_backing_store.py
Created by Scott on 2014-08-12.
Copyright (c) 2014 Scott Rice. All rights reserved.
"""
import ConfigParser
import backing_store
class ConfigFileBackingStore(backing_store.BackingStore):
def __init__(self, path):
super(ConfigFileBackingStore, self).__init__... | rdoyle1978/Ice | src/ice/persistence/config_file_backing_store.py | Python | mit | 1,476 |
from behave import given, when, then
from test.factories.user import UserFactory
@given('Sou um usuario anonimo')
def step_impl(context):
# from django.contrib.auth.models import User
# Creates a dummy user for our tests (user is not authenticated at this point)
u = UserFactory(username='foo', email='foo@... | LEDS/gde-backend | wsgi/gde/features/steps/login.py | Python | gpl-3.0 | 1,966 |
#
# blast2demPro.py
#
# (c) 2013, martin isenburg - http://rapidlasso.com
# rapidlasso GmbH - fast tools to catch reality
#
# uses blast2dem.exe to raster a folder of LiDAR files
#
# LiDAR input: LAS/LAZ/BIN/TXT/SHP/BIL/ASC/DTM
# raster output: BIL/ASC/IMG/TIF/DTM/PNG/JPG
#
# for licensing see http://l... | strummerTFIU/TFG-IsometricMaps | LAStools/ArcGIS_toolbox/scripts_production/blast2demPro.py | Python | mit | 7,737 |
import pytest
from countries_plus.models import Country
@pytest.fixture
def default_country(db):
return Country.objects.create(
name='DefaultCountry',
iso='US',
iso3='USA',
iso_numeric='1',
)
@pytest.fixture
def other_country(db):
return Country.objects.create(
n... | cordery/django-countries-plus | tests/conftest.py | Python | mit | 409 |
#!/usr/bin/python
#
# Copyright (C) 2016 Google, Inc
# Written by Simon Glass <sjg@chromium.org>
#
# SPDX-License-Identifier: GPL-2.0+
#
import fdt_fallback
# Bring in either the normal fdt library (which relies on libfdt) or the
# fallback one (which uses fdtget and is slower). Both provide the same
# interface... | dasuimao/U-BOOT-Tiny4412 | tools/dtoc/fdt_select.py | Python | gpl-3.0 | 905 |
import os
from distutils.core import setup, Extension
top_srcdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def get_ver():
with open(os.path.join(top_srcdir, 'configure')) as f:
for line in f:
if line.startswith('PACKAGE_VERSION='):
return line.split('=')[1]... | cyrevolt/gentoo | sys-fs/cryptsetup/files/setup-1.7.0.py | Python | gpl-2.0 | 788 |
"""Resource lookup tests"""
from __future__ import unicode_literals
import unittest
from mediafire.client import (MediaFireClient, ResourceNotFoundError,
NotAFolderError)
class DummyMediaFireApi(object):
"""Dummy MediaFireApi class
A MediaFireApi implementation that serves ca... | MediaFire/mediafire-python-open-sdk | tests/client/test_resource_lookup.py | Python | bsd-2-clause | 5,011 |
# -*- coding: utf-8 -*-
import json
import networkx as nx
from utils import stat_graph, render_info, connection_details
"""
generate graph with networks http://networkx.github.io/
and reformat this graph into d3 - nodes and links
"""
def add_nodes(nxDG, mcLA):
"""
"""
mother_node = '/Applications'... | rebeling/networking | graph.py | Python | mit | 3,482 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""PauLLA Photomaton, exposed on THDF 2015."""
import subprocess
import sys
import time
import os
from collections import namedtuple
from datetime import datetime
from random import randint
import pygame
import RPi.GPIO as GPIO
from picamera import PiCamera
from pygame.loca... | paulla/photomaton | src/paulla/paullaroid/photomaton.py | Python | mit | 10,315 |
__source__ = 'https://leetcode.com/problems/cat-and-mouse/'
# Time: O(N^3)
# Space: O(N^2)
#
# Description: Leetcode # 913. Cat and Mouse
#
# A game on an undirected graph is played by two players, Mouse and Cat, who alternate turns.
#
# The graph is given as follows: graph[a] is a list of all nodes b such that ab is ... | JulyKikuAkita/PythonPrac | cs15211/CatandMouse.py | Python | apache-2.0 | 8,837 |
# -*- coding: utf-8 -*-
# pylint: disable=unused-argument, redefined-outer-name, no-self-use
# pylint: disable=too-few-public-methods
from collections import namedtuple
from datetime import datetime, time
import pytest
from django_dynamic_fixture import F, G
from rest_framework import status
from rest_framework.rever... | cailloumajor/home-web | backend/heating/tests/test_validation.py | Python | gpl-3.0 | 6,487 |
#/usr/bin/env python
import os
import sys
import atexit
from subprocess import Popen
pidfile = "/tmp/remote-python-code.pid"
if os.path.isfile(pidfile):
print("{0} already exists, exiting".format(pidfile))
sys.exit()
pid = Popen(["nohup", "python3", "main.py"]).pid
with open(pidfile, 'w') as f:
atexit.r... | moopling/remoteCode | launcher.py | Python | mit | 378 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('fruit', '0002_fruit_cover_image'),
]
operations = [
migrations.AlterField(
model_na... | jsmesami/naovoce | src/fruit/migrations/0003_added_indexes.py | Python | bsd-3-clause | 702 |
import os
base_config = '''{
"admins": ["YOUR-USER-ID-HERE"],
"autoreplies_enabled": true,
"autoreplies": [
[["^@[\\\\w\\s]+\\\\++$"],"/karma {}"],
[["^@[\\\\w\\\\s]+-+$"],"/karma {}"],
[["bot", "robot", "Yo"], "/think {}"],
[["^(https?:\\\\/\\\\/)?([\\\\da-z\\\\.-]+)\\\\.([a-z\\\\.]{2,6})([\\\\/... | johnwiseheart/HangoutsBot | Main.py | Python | gpl-3.0 | 2,165 |
from django.http import Http404
from django.conf import settings
from pages.views import page
class PagesMiddleware(object):
""" An almost exact copy of FlatpageFallbackMiddleware from Django.
"""
def process_response(self, request, response):
if response.status_code != 404:
return ... | sunlightlabs/tcamp | tcamp/pages/middleware.py | Python | bsd-3-clause | 544 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax):
def __init__(self):
GenericSyntax.__init__(self)
@staticmethod
de... | hackersql/sq1map | plugins/dbms/mssqlserver/syntax.py | Python | gpl-3.0 | 759 |
""" Custom API permissions. """
from rest_framework.permissions import BasePermission, DjangoModelPermissions
from openedx.core.lib.api.permissions import ApiKeyHeaderPermission
class ApiKeyOrModelPermission(BasePermission):
""" Access granted for requests with API key in header,
or made by user with appropr... | Semi-global/edx-platform | lms/djangoapps/commerce/api/v1/permissions.py | Python | agpl-3.0 | 541 |
#!/usr/bin/env python
"""
An example of how to use python3-progressbar
NOTES:
- maxval is 100 by default.
- calling pbar.update() (with no value) does nothing. you must pass a value.
"""
import time
import progressbar
pbar = progressbar.ProgressBar(maxval=10)
pbar.start()
for i in range(10):
# do something
... | veltzer/demos-python | src/examples/short/terminal/progressbar_demo.py | Python | gpl-3.0 | 406 |
"""
Settings sample for emencia-django-socialaggregator (EDSA)
"""
gettext = lambda s: s
# Twitter access keys
EDSA_TWITTER_TOKEN = 'FILLME'
EDSA_TWITTER_SECRET = 'FILLME'
EDSA_TWITTER_CONSUMER_KEY = 'FILLME'
EDSA_TWITTER_CONSUMER_SECRET = 'FILLME'
# Instagram access keys
EDSA_INSTAGRAM_ACCESS_TOKEN = 'FILLME'
# Fac... | emencia/emencia-django-socialaggregator | socialaggregator/settings.py | Python | agpl-3.0 | 2,491 |
from django import VERSION as DJANGO_VERSION
from django_comments_xtd.conf import settings
if DJANGO_VERSION[1] <= 5: # Django <= 1.5
from django_comments_xtd.compat import import_by_path as import_string
elif 6 <= DJANGO_VERSION[1] < 8: # Django v1.6.x and 1.7.x
from django.utils.module_loading import import_... | agilosoftware/django-comments-xtd | django_comments_xtd/__init__.py | Python | bsd-2-clause | 1,675 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
from xlrd import open_workbook
x_data1=[]
y_data1=[]
wb = open_workbook('phase_detector.xlsx')
for s in wb.sheets():
print 'Sheet:',s.name
for row in range(s.nrows):
print 'the row is:',row+1
values = []
for col in range(s.ncols):
valu... | MiracleWong/PythonBasic | PythonExcel/testExcel.py | Python | mit | 471 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from core import perf_benchmark
from measurements import webrtc
from telemetry import benchmark
import page_sets
# Disabled because the reference set beco... | CapOM/ChromiumGStreamerBackend | tools/perf/benchmarks/webrtc.py | Python | bsd-3-clause | 762 |
###################################################
# header_parties.py
# This file contains declarations for parties
# DO NOT EDIT THIS FILE!
###################################################
from header_common import bignum
pf_icon_mask = 0x000000ff
pf_disabled = 0x00000100
pf_is... | Sw4T/Warband-Development | mb_warband_module_system_1166/Module_system 1.166/headers/header_parties.py | Python | mit | 2,989 |
# Copyright 2008-2015 Canonical
# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Licens... | magicicada-bot/magicicada-server | lib/ubuntuone/supervisor/__init__.py | Python | agpl-3.0 | 858 |
# -*- coding=utf-8 -*-
import os
import tarfile
from six.moves import urllib
"""
Purpose:
Fetch data from GitHub
"""
__author__ = "Yue-Wen FANG"
__copyright__ = "Copyright 2018"
__version__ = "0.0.1"
__maintainer__ = "Yue-Wen FANG"
__email__ = "fyuewen@gmail.com"
__status__ = "development"
__date__ = "June 1, 201... | yw-fang/readingnotes | machine-learning/handson_scikitlearn_tf_2017/ch02/fetch_data_github.py | Python | apache-2.0 | 1,078 |
"""Tests for models supporting Program-related functionality."""
import ddt
from django.test import TestCase
import mock
from nose.plugins.attrib import attr
from openedx.core.djangoapps.programs.tests.mixins import ProgramsApiConfigMixin
@attr('shard_2')
@ddt.ddt
# ConfigurationModels use the cache. Make every cach... | waheedahmed/edx-platform | openedx/core/djangoapps/programs/tests/test_models.py | Python | agpl-3.0 | 4,035 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.