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 python3
from __future__ import unicode_literals
# -*- coding: utf-8 -*-
#
# rtrlib-python documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 20 14:26:25 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible... | rtrlib/python-binding | docs/conf.py | Python | mit | 10,116 |
from __future__ import absolute_import
import logging
from django import forms
from django.contrib.auth import logout
from sentry import roles
from sentry.api import client
from sentry.models import (
Organization, OrganizationMember, User
)
from sentry.web.frontend.base import BaseView
class RemoveAccountForm... | imankulov/sentry | src/sentry/web/frontend/remove_account.py | Python | bsd-3-clause | 2,546 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import logging
import datetime
from django.utils import timezone
from snisi_core.models.Reporting import (ExpectedReporting,
... | yeleman/snisi | snisi_epidemiology/aggregations.py | Python | mit | 6,677 |
# -*- coding: utf-8 -*-
# Copyright 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 requi... | SmartInfrastructures/fuel-web-dev | nailgun/nailgun/api/v1/handlers/base.py | Python | apache-2.0 | 18,596 |
from django.db import models
from lighthouse.models.lapack_choiceDict import *
from lighthouse.models.lapack_routineInfo import lapack_RoutineInfo
###---------------- for guided search ----------------###
###--- Sylvester ---###
class lapack_sylvester(models.Model):
thePrecision = models.CharField('Precision... | LighthouseHPC/lighthouse | src/lighthouseProject/lighthouse/models/lapack_sylvester.py | Python | mit | 1,140 |
from threading import Thread
import Queue
from django.core.urlresolvers import reverse
from django.conf import settings
from django import forms
from django.http import HttpRequest
from django.test import TestCase
import haystack
from haystack.forms import model_choices, SearchForm, ModelSearchForm
from haystack.query ... | soad241/django-haystack | tests/core/tests/views.py | Python | bsd-3-clause | 7,147 |
from roslib.packages import get_pkg_dir
from python_qt_binding.QtGui import *
from python_qt_binding.QtCore import *
from airbus_cobot_gui.context import Context
from plugin_provider import PluginProvider
from plugin import Plugin
from xml.etree import ElementTree as ET
def getStandAloneInstance(pkg_name, plugin_class... | ipa-led/airbus_coop | airbus_cobot_gui/src/airbus_cobot_gui/plugin/__init__.py | Python | apache-2.0 | 739 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-10-25 19:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hackers', '0003_auto_20171017_1526'),
]
operations = [
migrations.AddField(... | HacktheCampus/my | hackers/migrations/0004_team_github_url.py | Python | agpl-3.0 | 447 |
# -*- coding: utf-8 -*-
import datetime as dt
import pydash as _
from . import fixtures
from .fixtures import parametrize
today = dt.date.today()
@parametrize('case,expected', [
(({'name': 'fred'}, {'employer': 'slate'}),
{'name': 'fred', 'employer': 'slate'}),
(({'name': 'fred'}, {'employer': 'slat... | jacobbridges/pydash | tests/test_objects.py | Python | mit | 17,731 |
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2017 KG
"""
$ python new-post "title of the post"
or, new-post can be executed directly,
$ new-post "title of the post"
"""
import argparse
import time
import uuid
def main():
parser = argparse.ArgumentParser(descriptio... | gridclub/gridclub.github.io | new-post.py | Python | mit | 1,155 |
# -*- coding: utf-8 -*-
'''
Copyright 2014-2016 GoodCrypto
Last modified: 2016-08-01
This file is open source, licensed under GPLv3 <http://www.gnu.org/licenses/>.
'''
import os, re, sh, sys, time
from syr.exception import record_exception
from syr.log import get_log, get_log_path, _debug
from syr.python ... | goodcrypto/goodcrypto-oce | python/goodcrypto/utils/log_file.py | Python | gpl-3.0 | 5,408 |
#! /usr/bin/env python
import json, bitcoinrpc, urllib2, shelve
debug = True
class BTCAvgs:
pass
class bitcoinapi(object):
def __init__(self, user, password, server="127.0.0.1", port="8332", shelvefile="/tmp/pybtlib"):
# self.btcd = AuthServiceProxy("http://" + user + ":" + password + "@127.0.0.1:8332")
s... | coolacid/pybtcstatlib | bitcoin2.py | Python | mit | 7,515 |
# -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... | stackforge/cloudkitty | cloudkitty/backend/file.py | Python | apache-2.0 | 892 |
"""
pygments.lexers.ldif
~~~~~~~~~~~~~~
Pygments lexer for LDAP Data Interchange Format.
:copyright: (c) 2015 by Rob McBroom.
:license: MIT, see LICENSE.txt for more details.
"""
from pygments.lexer import RegexLexer, bygroups
from pygments.token import *
class LdifLexer(RegexLexer):
"""Pyg... | skurfer/pygments-ldif | ldif_lexer.py | Python | mit | 1,867 |
#!/usr/bin/python
#-*- coding: UTF-8 -*-
print '[OK] Embedded bytecode'
| jhg/python-swimming | test/src/embedded_bytecode.py | Python | gpl-3.0 | 73 |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | google/uncertainty-baselines | baselines/jft/experiments/imagenet21k_vit_base16_eval_imagenet.py | Python | apache-2.0 | 10,052 |
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError
from .models import Voter
import re
def parse_voters(text):
""" Parse the input and get a list of (Full Name, ID)
The input consists of multiple lines, each line is in the fo... | lzh9102/ee-voting | voting/forms.py | Python | mit | 2,440 |
from typing import List
class NamedList:
"""A contaner class for storing a list of named integers."""
def __init__(self, names: List[str], values: List[int]) -> None:
self._names = names
self._values = values
def __getitem__(self, name: str) -> int:
idx = self._names.index(name)
... | pyta-uoft/pyta | examples/pylint/e1138_unsupported_delete_operation.py | Python | gpl-3.0 | 595 |
try:
# Django 1.6 requires this
from django.conf.urls import url, patterns, include
except ImportError:
# Django 1.3 compatibility, kept in minor release
from django.conf.urls.defaults import url, patterns, include
urlpatterns = patterns('fluent_comments.views',
url(r'^post/ajax/$', 'post_comment_... | Afnarel/django-fluent-comments | fluent_comments/urls.py | Python | apache-2.0 | 412 |
import random
def expo(n: int, base=2, factor=1, max_value=None):
"""Exponential decay.
Adapted from https://github.com/litl/backoff/blob/master/backoff.py (MIT License)
Args:
base: The mathematical base of the exponentiation operation
factor: Factor to multiply the exponentation by.
... | zalando-incubator/postgres-operator | ui/operator_ui/backoff.py | Python | mit | 1,547 |
# -*- coding: utf-8 *-*
# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any ... | DeveloperMal/wger | wger/exercises/management/commands/download-exercise-images.py | Python | agpl-3.0 | 5,449 |
#-*- coding:utf-8 -*-
import copy
class Stack():
def __init__(self):
self.stack=[];
self.top=-1;
def Push(self,ele):
self.stack.append(ele);
self.top = self.top+1;
def Pop(self):
self.top = self.top-1;
return self.stack.pop();
def IsEmpty(self):
... | lvshaco/ejoy2d | tool/flash-parser/scripts/stack.py | Python | mit | 2,833 |
import hashlib
from pitcrew import task
@task.arg("path", type=str, desc="The path of the file to write to")
@task.arg("content", type=bytes, desc="The contents to write")
class FsWrite(task.BaseTask):
"""Write bytes to a file"""
async def verify(self):
stat = await self.fs.stat(self.params.path)
... | joshbuddy/crew | pitcrew/tasks/fs/write.py | Python | mit | 980 |
from win32com.shell import shell, shellcon
import pythoncom, win32api, os, sys
temp_dir=win32api.GetTempPath()
linkname=win32api.GetTempFileName(temp_dir,'cmd')[0]
os.remove(linkname)
linkname+='.lnk'
print('Link name:',linkname)
ish=pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None,
pythoncom.CLSCTX_INPROC_SERV... | sserrot/champion_relationships | venv/Lib/site-packages/win32comext/shell/demos/IShellLinkDataList.py | Python | mit | 1,666 |
#!/usr/bin/env python
import roslib; roslib.load_manifest('rfh_follow_me')
import sys
import rospy
import numpy as np
from geometry_msgs.msg import Twist
from p2os_msgs.msg import MotorState, SonarArray
class sonar_verification:
def __init__(self):
self.sonar_sub = rospy.Subscriber("/sonar", SonarArray, self.callba... | amasiero/rfh_follow_me | nodes/rfh_sonar_verification.py | Python | gpl-2.0 | 1,073 |
"""
Structural Analysis Model (:mod:`structmanager.structmodel`)
============================================================
.. currentmodule:: structmanager.structmodel
"""
import os
from collections import defaultdict
from string import strip
import numpy as np
from .structelem.base import SE1D, SE2D
from .struc... | saullocastro/structMan | structmanager/structmodel.py | Python | bsd-3-clause | 4,154 |
# -*- coding: utf-8 -*-
import logging
from django.contrib.auth import login as auth_login
from django.contrib.auth.views import logout_then_login
from django.shortcuts import render, redirect
from django.utils import timezone
from .constants import DASHBOARD_URL, LOGIN_URL
from .forms import LoginForm
log = loggi... | alexander-ae/django-project-manager | project_manager/project_manager_auth/views.py | Python | gpl-3.0 | 1,461 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | platform/polycommon/polycommon/settings/api.py | Python | apache-2.0 | 4,027 |
# coding:utf-8
from django.urls import path, re_path
from rest_framework_nested import routers
from rest_framework_bulk.routes import BulkRouter
from common import api as capi
from .. import api
app_name = 'assets'
router = BulkRouter()
router.register(r'assets', api.AssetViewSet, 'asset')
router.register(r'account... | jumpserver/jumpserver | apps/assets/urls/api_urls.py | Python | gpl-3.0 | 5,320 |
#!/usr/bin/env python3
import unittest
import os
import random
import string
import sys
# modificamos el path para poder acceder mejor a los modulos
this_dir = os.path.dirname(os.path.abspath(__file__))
trunk_dir = os.path.split(this_dir)[0]
sys.path.insert(0,trunk_dir)
import directory
class DirectoryTest(unitte... | lokiteitor/ikol | test/directorytest.py | Python | gpl-2.0 | 2,775 |
from unittest import TestCase
from tests.test_basetestcase import SpicedhamTestCase
from spicedham import Spicedham
from spicedham.digitdestroyer import DigitDestroyer
class TestDigitDestroyer(SpicedhamTestCase):
def setUp(self):
self.sh = Spicedham({'backend': 'SqlAlchemyWrapper',
... | mozilla/spicedham | tests/test_digitdestroyer.py | Python | mpl-2.0 | 1,419 |
from addons.base.serializer import StorageAddonSerializer
from addons.owncloud.settings import DEFAULT_HOSTS, USE_SSL
from website.util import web_url_for
from owncloud import Client as OwnCloudClient
class OwnCloudSerializer(StorageAddonSerializer):
addon_short_name = 'owncloud'
def serialized_folder(self,... | erinspace/osf.io | addons/owncloud/serializer.py | Python | apache-2.0 | 2,361 |
# -*- coding: utf-8 -*-
# Copyright 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 requi... | huntxu/fuel-web | nailgun/nailgun/test/unit/test_version_handler.py | Python | apache-2.0 | 1,730 |
import re
def safe_filename(text, max_length=200):
"""
Sanitizes filenames for many operating systems.
Keyword arguments:
text -- The unsanitized pending filename.
"""
#Quickly truncates long filenames.
truncate = lambda text: text[:max_length].rsplit(' ', 0)[0]
#Tidy up ugly formatt... | sauloal/PiCastPy | pytube/utils.py | Python | mit | 1,363 |
""" unit tests for Transformation Clients
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=protected-access,missing-docstring,invalid-name
import six
import unittest
import json
import mock
from DIRAC.RequestManagementSystem.Client.Req... | ic-hep/DIRAC | src/DIRAC/TransformationSystem/Client/test/Test_Client_TransformationSystem.py | Python | gpl-3.0 | 13,918 |
"""Spyse OODA behaviour module"""
import time
# http://www.mindsim.com/MindSim/Corporate/OODA.html
# http://www.d-n-i.net/second_level/boyd_military.htm
# http://www.belisarius.com/modern_business_strategy/boyd/essence/eowl_frameset.htm
# http://www.valuebasedmanagement.net/methods_boyd_ooda_loop.html
# http:... | davidko/evolspyse | core/behaviours/ooda.py | Python | lgpl-2.1 | 1,291 |
# -*- python -*-
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
#... | bleepbloop/Pivy | scons/scons-local-1.2.0.d20090919/SCons/Tool/textfile.py | Python | isc | 6,037 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import six
from sentry.api.serializers import serialize
from sentry.api.serializers.models.event import SharedEventSerializer
from sentry.testutils import TestCase
from sentry.models import EventError
class EventSerializerTest(TestCase):
def test_s... | alexm92/sentry | tests/sentry/api/serializers/test_event.py | Python | bsd-3-clause | 1,571 |
__author__ = 'bcarson'
from signals import image, image_buffer
class ImageBuffer(object):
def __init__(self, buffer_length=3):
self.buffer_length = buffer_length
self.image_buffer = []
# Handle image events
image.connect(self.handle_image)
image_buffer.connect(self.handle... | hebenon/oversight | oversight/image_buffer.py | Python | apache-2.0 | 628 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from collect_filenames import collect
from action.prepare_files import prepare
def restore(config, debug):
"""
Restores all the ownerships and permissions on all files
"""
filenames = collect(config)
for item in filenames[0]:
prepare(item, 'R... | open-dynaMIX/experms | src/experms/restore.py | Python | gpl-3.0 | 435 |
from typing import Iterable
import pytest
from plenum.test.pool_transactions.helper import disconnect_node_and_ensure_disconnected
from stp_core.loop.eventually import eventually
from stp_core.common.log import getlogger
from plenum.common.startable import Status
from plenum.test.greek import genNodeNames
from plenum... | evernym/plenum | plenum/test/instances/test_instance_cannot_become_active_with_less_than_four_servers.py | Python | apache-2.0 | 3,555 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typi... | Azure/azure-sdk-for-python | sdk/search/azure-search-documents/azure/search/documents/_headers_mixin.py | Python | mit | 824 |
"""
Request Delegation
(from web.py)
"""
__all__ = ["handle", "nomethod", "autodelegate", "webpyfunc", "run"]
import sys, re, types, os.path, urllib
import http, wsgi, utils, webapi
import webapi as web
def handle(mapping, fvars=None):
"""
Call the appropriate function based on the url to function mapping i... | stucchio/DJ-Pirate | djpirate/web/request.py | Python | gpl-3.0 | 5,532 |
#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2005, 2006, 2007, 2008, 2012 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. This program is distributed in the hop... | bcl/pykickstart | pykickstart/commands/logvol.py | Python | gpl-2.0 | 40,258 |
import math
if __name__ == '__main__':
target = 200
ways = 0
for a in range(target, -1, -200):
for b in range(a, -1, -100):
for c in range(b, -1, -50):
for d in range(c, -1, -20):
for e in range(d, -1, -10):
for f in range(e... | kylebegovich/ProjectEuler | Python/Solved/Page1/Problem31.py | Python | gpl-3.0 | 464 |
# -*- coding: utf-8 -*-
from .exc import IllegalArgument, IntervalException, RangeBoundsException
from .interval import (
AbstractInterval,
canonicalize,
CharacterInterval,
DateInterval,
DateTimeInterval,
DecimalInterval,
FloatInterval,
Interval,
IntervalFactory,
IntInterval,
... | williamfeng323/py-web | flask/lib/python3.6/site-packages/intervals/__init__.py | Python | mit | 689 |
import random, pylab
#set line width
pylab.rcParams['lines.linewidth'] = 6
#set font size for titles
pylab.rcParams['axes.titlesize'] = 20
#set font size for labels on axes
pylab.rcParams['axes.labelsize'] = 20
#set size of numbers on x-axis
pylab.rcParams['xtick.major.size'] = 5
#set size of numbers on y-axis
pylab.... | parmarmanojkumar/MITx_Python | 6002x/week2/lectureCode_l15-3.py | Python | mit | 2,310 |
#
# rpclib - Copyright (C) Rpclib contributors.
#
# 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 lib... | martijnvermaat/rpclib | src/rpclib/model/_base.py | Python | lgpl-2.1 | 9,028 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 OpenERP SA (<http://openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | OpusVL/odoo | addons/base_vat/base_vat.py | Python | agpl-3.0 | 12,582 |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2013 Task Coach developers <developers@taskcoach.org>
Task Coach 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
... | TaskEvolution/Task-Coach-Evolution | taskcoach/taskcoachlib/domain/base/__init__.py | Python | gpl-3.0 | 1,033 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 the BabelFish authors. All rights reserved.
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
from __future__ import unicode_literals
from collections import namedtuple
from functools import partial
from pkg_resour... | Hellowlol/PyTunes | libs/babelfish/country.py | Python | gpl-3.0 | 2,911 |
from humanname.version import *
from humanname.name import Name
| djudd/human-name-py | humanname/__init__.py | Python | apache-2.0 | 64 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2012 Michal Kalewski <mkalewski at cs.put.poznan.pl>
#
# This file is a part of the Simple Network Simulator (sim2net) project.
# USE, MODIFICATION, COPYING AND DISTRIBUTION OF THIS SOFTWARE IS SUBJECT TO
# THE TERMS AND CONDITIONS OF THE MIT LICENSE. YOU SHOULD H... | mkalewski/sim2net | sim2net/area/rectangle.py | Python | mit | 4,035 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2009 by the FIFE team
# http://www.fifengine.de
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Le... | mgeorgehansen/FIFE_Technomage | demos/pychan_demo/pychan_demo.py | Python | lgpl-2.1 | 5,871 |
# 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... | AsimmHirani/ISpyPi | tensorflow/contrib/tensorflow-master/tensorflow/contrib/labeled_tensor/python/ops/ops_test.py | Python | apache-2.0 | 34,852 |
"""system_manager
Classes:
SystemManager: Manages all systems in the game world.
"""
# Matthew Westbrook
#
# The system manager handles adding, storing, and removing systems from the
# game world as well as the proper inclusion of entities to systems
# entities belong to.
class SystemManager(object):
"""S... | horrorvacui/ent-system | entsystem/system_manager.py | Python | mit | 1,733 |
class Solution:
def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]:
paths = []
seen = {}
cur = {}
graph = [[] for i in range(numCourses)]
for x, y in prerequisites:
graph[y].append(x)
def topologicalSort(i):
seen[... | zuun77/givemegoogletshirts | leetcode/python/210_course-schedule-ii.py | Python | apache-2.0 | 781 |
"""
Test SimKit core.
"""
from simkit.core import Q_, UREG
from nose.tools import eq_, ok_
def test_pv_context():
"""
Test Pint PV context - specifically suns to power flux and v.v.
"""
esun = Q_(876.5, UREG.W / UREG.m / UREG.m)
eq_(esun.to('suns', 'pv'), 0.8765 * UREG.suns)
esun = Q_(0.8765,... | SunPower/Carousel | simkit/tests/test_core.py | Python | bsd-3-clause | 431 |
# Copyright 2015 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 ... | magic0704/oslo.messaging | oslo_messaging/_drivers/zmq_driver/client/publishers/zmq_req_publisher.py | Python | apache-2.0 | 3,103 |
"""
HTML Widget classes
"""
from __future__ import unicode_literals
import copy
import datetime
import re
from itertools import chain
from django.conf import settings
from django.forms.utils import flatatt, to_current_timezone
from django.templatetags.static import static
from django.utils import datetime_safe, form... | himleyb85/django | django/forms/widgets.py | Python | bsd-3-clause | 36,632 |
import wx.lib.newevent
try:
import thread as _thread
except ImportError:
import _thread
import shlex
import subprocess
import os
import re
from os.path import isfile, join
from sys import platform
if platform.startswith("win"):
from subprocess import STARTF_USESHOWWINDOW
(scriptEvent, EVT_SCRIPT_UPDATE) ... | Traumflug/Teacup_Firmware | configtool/build.py | Python | gpl-2.0 | 16,446 |
# Finds recursively files with given extension in the given directory
# IMPORTS
from os import listdir
from os.path import join, isdir
# FUNCTIONS
def find(parent_dir, extension):
for file in listdir(parent_dir):
child = join(parent_dir, file)
if isdir(child):
find(child, extension)
... | futurepr0n/Books-solutions | Python-For-Everyone-Horstmann/Chapter11-Recursion/find.py | Python | mit | 385 |
def listsum(numList):
if len(numList) == 1: return numList[0]
else:
return numList[0] + listsum(numList[1:]) | robin1885/algorithms-exercises-using-python | source-code-from-author-book/Listings-for-Second-Edition/listing_4_2.py | Python | mit | 148 |
import pathlib
import meshplex
this_dir = pathlib.Path(__file__).resolve().parent
def test_pacman():
mesh = meshplex.read(this_dir / "meshes" / "pacman.vtu")
mesh = meshplex.MeshTri(mesh.points[:, :2], mesh.cells("points"))
mesh._compute_cell_values()
mesh._compute_cell_values(mask=[0, 12, 53, 54, ... | nschloe/voropy | tests/test_compute_cell_values.py | Python | mit | 325 |
# Copyright (c) 2013 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 perf_tools import histogram as histogram_module
BROWSER_HISTOGRAM = 'browser_histogram'
RENDERER_HISTOGRAM = 'renderer_histogram'
class HistogramMe... | hujiajie/pa-chromium | tools/perf/perf_tools/histogram_metric.py | Python | bsd-3-clause | 1,675 |
"""Test praw.models.listing.generator."""
from ... import IntegrationTest
class TestListingGenerator(IntegrationTest):
def test_exhaust_items_with_before(self):
with self.use_cassette():
submissions = list(
self.reddit.redditor("spez").top(
limit=None, param... | praw-dev/praw | tests/integration/models/listing/test_generator.py | Python | bsd-2-clause | 771 |
# Documentation for Zulip's authentication backends is split across a few places:
#
# * https://zulip.readthedocs.io/en/latest/production/authentication-methods.html and
# zproject/prod_settings_template.py have user-level configuration documentation.
# * https://zulip.readthedocs.io/en/latest/development/authenticat... | punchagan/zulip | zproject/backends.py | Python | apache-2.0 | 103,525 |
# Copyright (C) 2009 Abdelhalim Ragab <abdelhalim@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 3
# of the License or (at your option) any later version of
# the License... | abdelhalim/gits3 | src/gits3/amazon_s3_transport.py | Python | gpl-2.0 | 5,828 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import xbmcgui
import xbmc
import xbmcvfs
import xbmcaddon
import time
import urllib
import urllib2
import re
import sys
import traceback
import json
import base64
import pprint
import zipfile
import StringIO
import Database
from t0mm0.common.net import Net
from bs4 ... | repotvsupertuga/tvsupertuga.repository | script.premium.TVsupertuga/resources/lib/Trakt.py | Python | gpl-2.0 | 15,537 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-19 01:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('neighborhood', '0006_auto_20160917_2154'),
]
operations = [
migrations.AlterF... | josephkane/neighborhood | nh_rest/neighborhood/migrations/0007_auto_20160919_0110.py | Python | mit | 605 |
from django.conf import settings
IMAGE_URL = getattr(settings, 'AWARDS_IMAGE_URL', 'icons/awards/{slug}.png')
| fgmacedo/django-awards | awards/settings.py | Python | mit | 112 |
# Copyright 2012 VMware, Inc.
#
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | sajuptpm/neutron-ipam | neutron/plugins/vmware/api_client/eventlet_request.py | Python | apache-2.0 | 9,138 |
import re
import sys
import tempfile
print 'pyblish_utils loaded'
def temp_dir(context):
"""Provide a temporary directory in which to store extracted files"""
extract_dir = context.data('extractDir')
if not extract_dir:
extract_dir = tempfile.mkdtemp()
context.set_data('extractDir', val... | ProgressiveFX/pyblish-pfx | pyblish_pfx/plugins/pyblish_utils.py | Python | lgpl-3.0 | 1,904 |
# 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
# distributed under t... | ctrlaltdel/neutrinator | vendor/keystoneauth1/identity/v3/totp.py | Python | gpl-3.0 | 3,239 |
"""Tests for the InsertAlongAxis op."""
import numpy as np
import theano
from theano import config
from theano import tensor
from pylearn2.utils.insert_along_axis import (
insert_columns, insert_rows, InsertAlongAxis
)
def test_insert_along_axis():
x = tensor.matrix()
y = insert_columns(x, 10, range(0, 1... | CIFASIS/pylearn2 | pylearn2/utils/tests/test_insert_along_axis.py | Python | bsd-3-clause | 2,327 |
"""
Tests for self-paced course due date overrides.
"""
from datetime import datetime
from dateutil.tz import tzutc
from django.test.utils import override_settings
from student.tests.factories import UserFactory
from lms.djangoapps.ccx.tests.test_overrides import inject_field_overrides
from lms.djangoapps.courseware.... | simbs/edx-platform | lms/djangoapps/courseware/tests/test_self_paced_overrides.py | Python | agpl-3.0 | 2,240 |
def nth_combination(start_combination, combination_options, n_value):
"""
Calculate the N-th combination of a string. The function does not evaluate
n combination before outputing the n combination. The function acts upon
the combination as a "natural number" with radix equals to the number of
comb... | yosi-dediashvili/nth_combination | nth_combination.py | Python | gpl-2.0 | 2,156 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2008, 2009 Adriano Monteiro Marques
#
# Author: Tianwei Liu <liutianweidlut@gmail.com>
#
# 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 Foundat... | umitproject/openmonitor-desktop-agent | install_scripts/windows/setup.py | Python | gpl-2.0 | 5,231 |
from LECA.node_stats import run_LDOcomp, percLDOs
from LECA import csv_parser
import cPickle as pickle
import pandas as pd
### This program runs the oversplitting analysis, used for false negative analysis
### Outputs three files:
### _results.p # pickle file used by consensus scripts
### _results.csv # the results... | bliebeskind/Gene-Ages | CannedScripts/calc_LDOs.py | Python | mit | 1,609 |
from django.test import TestCase
class HomeTest(TestCase):
def setUp(self):
self.response = self.client.get('/')
def test_get(self):
"""GET / must return status code 200"""
self.assertEqual(200, self.response.status_code)
def test_template(self):
"""Must use index.html""... | joaopcanario/eventex | eventex/core/tests/test_view_home.py | Python | mit | 486 |
#!/usr/bin/env python
#
# -*- coding: utf-8 -*-
import zerigo
if __name__ == '__main__':
try:
host = zerigo.Host('www', 'test.vmlayers.org')
except zerigo.NotFound: # zone not found
zone = zerigo.Zone('test.vmlayers.org')
zone.create()
host = zerigo.Host('www', 'test.vmlayers.o... | timcubb/pyzerigo | tests/test_host_create.py | Python | mit | 672 |
from django import template
from manage_treemap.views.roles import options_for_permission
from treemap.audit import FieldPermission
from treemap.lib.object_caches import role_field_permissions
register = template.Library()
@register.filter
def photo_permission_level(role):
photo_perms = role_field_permissions(... | maurizi/otm-core | opentreemap/manage_treemap/templatetags/roles.py | Python | agpl-3.0 | 594 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#example AVHRR file selector
import logging
logging.basicConfig()
#logging.debug("-- log message: ")
from granule_utils import generate_avhrr_platform_passes_over_aoi, get_pass_for_granule,save_passes_as_shp, read_tle_from_file_db, get_tle_spacetrack
import numpy as np... | qbazd/leo_pass_selector | granule_selector.py | Python | mit | 3,028 |
#!python3
#encoding:utf-8
import os.path
import configparser
import argparse
from database.src.Database import Database
import pyotp
import pyperclip
import web.log.Log
class OtpCopy:
def __init__(self):
self.__path_dir_this = os.path.abspath(os.path.dirname(__file__))
self.__db = Database(self.__pa... | trysrv/GitHub.Uploader.CuiCmd.201706231541 | OtpCopy.py | Python | cc0-1.0 | 2,445 |
# Copyright 2014 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 law or agre... | projectcalico/calico-neutron | neutron/tests/functional/agent/linux/test_process_monitor.py | Python | apache-2.0 | 3,900 |
""" Mixins for setting up particular course structures (such as split tests or cohorted content) """
from datetime import datetime
from pytz import UTC
from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
f... | ahmadiga/min_edx | openedx/core/djangoapps/util/testing.py | Python | agpl-3.0 | 8,664 |
import json
from dojo.models import Finding
class TwistlockParser(object):
def __init__(self, json_output, test):
tree = self.parse_json(json_output)
if tree:
self.items = [data for data in self.get_items(tree, test)]
else:
self.items = []
def parse_json(self... | OWASP/django-DefectDojo | dojo/tools/twistlock/parser.py | Python | bsd-3-clause | 3,005 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015-2016 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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... | unioslo/cerebrum | Cerebrum/modules/pwcheck/__init__.py | Python | gpl-2.0 | 1,022 |
from django import forms
from core.models import URL
class UrlCreateForm(forms.ModelForm):
class Meta:
model = URL
fields = ['primary',]
| tmnkv/shrt | shrt/core/forms.py | Python | mit | 160 |
"""Various Apache Beam pipeline pieces for the prove-train loop.
This file contains all Apache Beam pipelines specific to the prove-train
loops.
"""
from __future__ import absolute_import
from __future__ import division
# Import Type Annotations
from __future__ import print_function
import io
import os
import random
i... | tensorflow/deepmath | deepmath/deephol/deephol_loop/loop_pipeline.py | Python | apache-2.0 | 16,840 |
# -*- coding: utf-8 -*-
# This file is part of emesene.
#
# emesene 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.
#
#... | emesene/emesene | emesene/gui/gtkui/ExtensionList.py | Python | gpl-3.0 | 26,398 |
#!/usr/bin/python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for cgroups.py."""
from __future__ import print_function
import os
import sys
sys.path.insert(0, os.path.dirname(os.p... | mxOBS/deb-pkg_trusty_chromium-browser | third_party/chromite/lib/cgroups_unittest.py | Python | bsd-3-clause | 1,137 |
from nose.tools import eq_
from django.test import TestCase
class TestAppList(TestCase):
def test_everyone_can_see_applications(self):
response = self.client.get('/apps/')
eq_(response.status_code, 200)
eq_(len(response.context['page'].object_list), 0)
| us-ignite/us_ignite | us_ignite/apps/tests/integration_tests.py | Python | bsd-3-clause | 285 |
#!/usr/bin/env python
"""
Implement a queue data structure.
The :mod:`myqueue.queue` module provide one class:
* :class:`MyQueue`: queue data structure.
"""
from .mystack import MyStack
from .error import Empty
class MyQueue:
"""
A queue data structure.
Items are added at the top and peeked from ... | dfroger/myqueue | myqueue/myqueue.py | Python | gpl-2.0 | 2,150 |
#!/usr/bin/python3
import sys
import string
import re
import os
# runtime for the AEXP example
#--------------------------------------------------------
def error(*args):
print(*args)
sys.exit(1)
#--------------------------------------------------------
# Supporting functions
PC = 0
ENV = {}
STACK = []
... | stuartwray/metaphor | aexp-runtime-header.py | Python | gpl-2.0 | 1,022 |
# Copyright 2019 The Magenta 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 ... | jesseengel/magenta | magenta/tensor2tensor/t2t_trainer.py | Python | apache-2.0 | 1,130 |
#!/usr/bin/env python
import time
import serial
arduinoSerialData = serial.Serial('/dev/serial/by-id/usb-Arduino__www.arduino.cc__0042_95432313138351F00180-if00',9600)
input = int(input("Press 1 to start IR Sensor"))
Time = []
for i in range(0,100,1):
## print("Test ", i)
Start = time.clock()
... | DFEC-R2D2/r2d2 | archives/old_2017-2018_code/code/tests/Arduino2Raspberry/Response.py | Python | mit | 1,257 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_clusters_operations.py | Python | mit | 40,587 |
import urllib2
import mechanize
from bs4 import BeautifulSoup
import os
def get_html(url):
header = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Ac... | tripatheea/Simple-IMDB-Scraper | scraper.py | Python | mit | 2,978 |
"""Test SBValue::Persist"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class SBValuePersistTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
@add_test_categories(['pyapi'])
... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py | Python | bsd-3-clause | 2,991 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.