text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# coding: utf8
from wsgidav.dav_provider import DAVCollection, DAVNonCollection
from wsgidav.dav_error import DAVError, HTTP_FORBIDDEN
from wsgidav import util
from wsgidav.addons.tracim import role, MyFileStream
from time import mktime
from datetime import datetime
from os.path import normpath, dirname, basename
try... | tracim/tracim-webdav | wsgidav/addons/tracim/sql_resources.py | Python | mit | 16,929 | 0.000945 |
#
# 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 ... | shahankhatch/aurora | src/main/python/apache/aurora/executor/common/announcer.py | Python | apache-2.0 | 8,388 | 0.008345 |
import argparse
from ..api import _v1
class HelloHandler:
def __init__(
self, args: argparse.Namespace, now: _v1.Now, add_entry: _v1._private.AddEntry,
):
self._args = args
self._now = now
self._add_entry = add_entry
def __call__(self):
self._add_entry(_v1.Entry(s... | larose/utt | utt/plugins/0_hello.py | Python | gpl-3.0 | 593 | 0.003373 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
from django.conf import settings
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODE... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/edx_proctoring/migrations/0001_initial.py | Python | agpl-3.0 | 13,525 | 0.00414 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from django.utils.translation import ugettex... | dogukantufekci/supersalon | supersalon/users/admin.py | Python | bsd-3-clause | 1,106 | 0.000904 |
#!/usr/bin/env python
from sre_parse import isdigit
import sys
__author__ = 'jpijper'
import roslib; roslib.load_manifest('smach_tutorials')
import rospy
import smach_ros
from DialogStateMachine import SMDialog
def main():
# To restrict the amount of feedback to the screen, a feedback level can be given on the... | Rctue/DialogStateMachine | DialogTest_2_AskDeviceOnFinger.py | Python | gpl-2.0 | 1,079 | 0.013902 |
import json
import numbers
import html
import config
class command:
"""
Used to store an incoming player command
"""
def __init__(self, message):
"""
Called with a raw message string from a client
:raise: ValueError if the message isn't a valid command
"""
# Try... | JoelEager/pyTanks.Server | dataModels/command.py | Python | mit | 2,194 | 0.002735 |
# -*- coding: utf-8 -*-
import boto.sqs
import uuid
from beaver.transports.base_transport import BaseTransport
from beaver.transports.exception import TransportException
class SqsTransport(BaseTransport):
def __init__(self, beaver_config, logger=None):
super(SqsTransport, self).__init__(beaver_config, l... | moniker-dns/debian-beaver | beaver/transports/sqs_transport.py | Python | mit | 3,043 | 0.003615 |
from django import forms
from django.contrib import admin
from django.utils.translation import ugettext
from django.contrib.auth.admin import UserAdmin
from django.contrib.admin.sites import NotRegistered
from django.contrib.auth.models import User, Group, Permission
from django.contrib.admin.widgets import FilteredSel... | vongochung/ngudan | permission_backend_nonrel/admin.py | Python | bsd-3-clause | 5,050 | 0.002178 |
"""This is (more-or-less) the example experiment described in the getting
started section of the manual.
In this experiment we simply measure the number of packets received as we ramp
up the amount of traffic generated.
"""
import sys
import random
from network_tester import Experiment, to_csv
# Take the SpiNNaker ... | project-rig/network_tester | examples/getting_started_example.py | Python | gpl-2.0 | 1,458 | 0.000686 |
import sys
import threading
import time
io_lock = threading.Lock()
blocker = threading.Lock()
def block(i):
t = threading.current_thread()
with io_lock:
print('{} with ident {} going to sleep'.format(
t.name, t.ident))
if i:
blocker.acquire() # acquired but never released
... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_runtime_features/sys_current_frames.py | Python | apache-2.0 | 1,093 | 0 |
"""
Tests for whether the standard library hooks in ``future`` are compatible with
the ``requests`` package.
"""
from __future__ import absolute_import, unicode_literals, print_function
from future import standard_library
from future.tests.base import unittest, CodeHandler
import textwrap
import sys
import os
import i... | hughperkins/kgsgo-dataset-preprocessor | thirdparty/future/tests/test_future/test_requests.py | Python | mpl-2.0 | 3,385 | 0.001182 |
def all_substr(string):
s = set()
length = len(string)
for i in range(length):
for j in range(i, length + 1):
s.add(string[i:j])
return s
def compr(string, substring):
l = len(substring)
c = string.count(substring)
return len(string) - c * (l-1) + l
def min_enc(string... | JonSteinn/Kattis-Solutions | src/Red Rover/Python 3/rr.py | Python | gpl-3.0 | 479 | 0.004175 |
# Copyright (C) 2010-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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 v... | KaiSzuttor/espresso | samples/immersed_boundary/sampleImmersedBoundary.py | Python | gpl-3.0 | 3,388 | 0.001771 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "GPSstorage.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that t... | seftler/GPSstorage | manage.py | Python | mit | 808 | 0 |
# -*- coding: utf-8 -*-
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change th... | dsajkl/123 | lms/envs/common.py | Python | agpl-3.0 | 62,841 | 0.002803 |
import importlib.util
import logging
import os
import warnings
from os import getenv
from typing import Any, Optional, Mapping, ClassVar
log = logging.getLogger(__name__)
default_settings_dict = {
'connect_timeout_seconds': 15,
'read_timeout_seconds': 30,
'max_retry_attempts': 3,
'base_backoff_ms': 2... | pynamodb/PynamoDB | pynamodb/settings.py | Python | mit | 2,509 | 0.004384 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001 David R. Hampton
# Copyright (C) 2001-2006 Donald N. Allingham
# Copyright (C) 2007 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of ... | pmghalvorsen/gramps_branch | gramps/gen/plug/report/_reportbase.py | Python | gpl-2.0 | 2,801 | 0.002499 |
# fMBT, free Model Based Testing tool
# Copyright (c) 2013, Intel Corporation.
#
# Author: antti.kervinen@intel.com
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foun... | pombreda/fMBT | pythonshare/pythonshare/__init__.py | Python | lgpl-2.1 | 2,903 | 0.004478 |
# -*- coding: utf-8 -*-
#from django.contrib import admin
| AdrianRibao/notifintime | notifintime/admin.py | Python | bsd-3-clause | 58 | 0.017241 |
# ===================================================================
#
# Copyright (c) 2014, Legrandin <helderijs@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributio... | hclivess/Stallion | nuitka/Cryptodome/Hash/MD2.py | Python | gpl-3.0 | 6,130 | 0.001305 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('grades.exceptions', 'lms.djangoapps.grades.excepti... | eduNEXT/edunext-platform | import_shims/lms/grades/exceptions.py | Python | agpl-3.0 | 374 | 0.008021 |
import kronos
import random
@kronos.register('0 0 * * *')
def complain():
complaints = [
"I forgot to migrate our applications's cron jobs to our new server! Darn!",
"I'm out of complaints! Damnit!"
]
print random.choice(complaints)
| Weatherlyzer/weatherlyzer | base/cron.py | Python | mit | 264 | 0.003788 |
import sysconfig
# Category metadata.
# Category icon show in the menu
ICON = "icons/star2.svg"
# Background color for category background in menu
# and widget icon background in workflow.
BACKGROUND = "light-blue"
# Location of widget help files.
WIDGET_HELP_PATH = (
# No local documentation (There are problems... | salvacarrion/orange3-recommendation | orangecontrib/recommendation/widgets/__init__.py | Python | bsd-2-clause | 2,082 | 0.001921 |
a = "nabb jasj jjs, jjsajdhh kjkda jj"
a1 = a.split(",")
for i in range(0,len(a1)):
print (len(a1[i].split())) | shakcho/Indic-language-ngram-viewer | demo.py | Python | mit | 120 | 0.033333 |
# Copyright (c) 2014 Rackspace, 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 wr... | obulpathi/poppy | poppy/transport/pecan/controllers/v1/services.py | Python | apache-2.0 | 9,877 | 0 |
from pandac.PandaModules import *
from toontown.toonbase.ToonBaseGlobal import *
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from direct.fsm import StateData
from toontown.toontown... | ksmit799/Toontown-Source | toontown/trolley/Trolley.py | Python | mit | 7,361 | 0.005434 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, tools, _
from odoo.exceptions import ValidationError
from odoo.addons import decimal_precision as dp
from odoo.addons.website.models import ir_http
from odoo.tools.translate import h... | t3dev/odoo | addons/website_sale/models/product.py | Python | gpl-3.0 | 20,625 | 0.003782 |
# 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... | mnahm5/django-estore | Lib/site-packages/awscli/customizations/emr/ssh.py | Python | mit | 7,731 | 0 |
from functools import wraps
import json
from django.http import JsonResponse, HttpResponseNotAllowed
from django.utils.decorators import available_attrs
def methods(method_list):
def decorator(func):
@wraps(func, assigned=available_attrs(func))
def inner(request, *args, **kw):
if requ... | baby5/Django-httpbin | httpbin/bin/helpers.py | Python | mit | 1,339 | 0.004481 |
from unittest import mock
from unittest import TestCase
from sewer.dns_providers.rackspace import RackspaceDns
from . import test_utils
class TestRackspace(TestCase):
"""
"""
def setUp(self):
self.domain_name = "example.com"
self.domain_dns_value = "mock-domain_dns_value"
self.R... | komuW/sewer | sewer/dns_providers/tests/test_rackspace.py | Python | mit | 8,481 | 0.003184 |
"""Support the ISY-994 controllers."""
import asyncio
from functools import partial
from typing import Optional
from urllib.parse import urlparse
from pyisy import ISY
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeass... | tchellomello/home-assistant | homeassistant/components/isy994/__init__.py | Python | apache-2.0 | 8,442 | 0.000711 |
from __future__ import print_function
import re, os, sys, multiprocessing, zipfile, Queue
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
from urlparse import urlparse
#https://pypi.python.org/pypi/etaprogress/
from etaprogress.progress import ProgressBar
#337304 total HTML files, some are actuall... | carlsonp/kaggle-TrulyNative | processURLS_count.py | Python | gpl-3.0 | 2,502 | 0.031575 |
"""
Dtella - Core P2P Module
Copyright (C) 2008 Dtella Labs (http://www.dtella.org)
Copyright (C) 2008 Paul Marks
$Id$
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 Licen... | pmarks-net/dtella | dtella/common/core.py | Python | gpl-2.0 | 131,965 | 0.001523 |
"""
Studio editing view for OpenAssessment XBlock.
"""
import copy
import logging
from uuid import uuid4
from django.template.loader import get_template
from django.utils.translation import ugettext_lazy
from voluptuous import MultipleInvalid
from xblock.fields import List, Scope
from xblock.core import XBlock
from... | edx/edx-ora2 | openassessment/xblock/studio_mixin.py | Python | agpl-3.0 | 20,504 | 0.003414 |
#!/usr/bin/env python3
#
# Locate casts in the code
#
import cppcheckdata
import sys
for arg in sys.argv[1:]:
if arg.startswith('-'):
continue
print('Checking %s...' % arg)
data = cppcheckdata.CppcheckData(arg)
for cfg in data.iterconfigurations():
print('Checking %s, config %s...' %... | boos/cppcheck | addons/findcasts.py | Python | gpl-3.0 | 1,197 | 0.001671 |
import sys
import os
from pkg_resources import resource_filename
pythonversion = sys.version_info.major
from six import StringIO
import mock
import nose.tools as nt
import numpy as np
import numpy.testing as nptest
import matplotlib.pyplot as plt
import pandas
import pandas.util.testing as pdtest
import... | lucashtnguyen/pybmpdb | pybmpdb/tests/summary_tests.py | Python | bsd-3-clause | 29,742 | 0.001143 |
from mindfeed.mindfeed import main
if __name__ == "__main__":
main()
| zeckalpha/mindfeed | mindfeed/__init__.py | Python | mit | 75 | 0 |
from .ppo import PPOAgent
| qsheeeeen/Self-Driving-Car | rl_toolbox/agent/__init__.py | Python | mit | 26 | 0 |
from subprocess import call
import os
from flask.ext.script import Manager
from commands.utils import perform
def alt_exec(cmd, alt=None):
"""
Tries to execute command.
If command not found, it tries to execute the alternative comand
"""
try:
call(cmd)
except OSError as e:
if... | uaprom-summer-2015/Meowth | commands/static.py | Python | bsd-3-clause | 3,080 | 0 |
import pytest
from cfme import test_requirements
from cfme.configure import about
@test_requirements.appliance
@pytest.mark.tier(3)
@pytest.mark.sauce
def test_appliance_version(appliance):
"""Check version presented in UI against version retrieved directly from the machine.
Version retrieved from appliance... | izapolsk/integration_tests | cfme/tests/configure/test_version.py | Python | gpl-2.0 | 824 | 0.002427 |
#-------------------------------------------------------------------------------
# Name: run_jensen
# Purpose: Automated execution of diatomic M-L computations in the form
# of Jensen et al. J Chem Phys 126, 014103 (2007)
#
# Author: Brian
#
# Created: 8 May 2015
# Copyright: ... | bskinn/run_jensen | run_jensen.py | Python | mit | 65,917 | 0.008829 |
from django.contrib import admin
from django.db import models
from django_summernote.widgets import SummernoteWidget, SummernoteInplaceWidget
from django_summernote.settings import summernote_config, get_attachment_model
__widget__ = SummernoteWidget if summernote_config['iframe'] \
else SummernoteInplaceWidget
... | lqez/django-summernote | django_summernote/admin.py | Python | mit | 974 | 0.001027 |
import pygame
pygame.init()
#-- SCREEN CHARACTERISTICS ------------------------->>>
background_color = (255,255,255)
(width, height) = (300, 200)
class Particle:
def __init__(self, (x, y), radius):
self.x = x
self.y = y
self.radius = radius
self.color = (255, 0, 0)
self.t... | withtwoemms/pygame-explorations | render_particle.py | Python | mit | 926 | 0.009719 |
"""
For using OpenGL to render to an off screen buffer
Ref:
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from OpenGL.GL import *
from OpenGL.raw.GL.VERSION import GL_1_1,GL_1_2, GL_3_0
class OffScreenRender(... | mpvismer/gltk | offscreenrender.py | Python | mit | 3,321 | 0.013851 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | d4l3k/compute-archlinux-image-builder | arch-staging.py | Python | apache-2.0 | 5,271 | 0.011762 |
from test.support import verbose, run_unittest, gc_collect, bigmemtest, _2G, \
cpython_only
import io
import re
from re import Scanner
import sys
import string
import traceback
from weakref import proxy
# Misc tests from Tim Peters' re.doc
# WARNING: Don't change details in these tests if you don't know
# wha... | mancoast/CPythonPyc_test | fail/331_test_re.py | Python | gpl-3.0 | 54,426 | 0.002536 |
#/bin/env/python
A=[3,4,5,5,2]
M=6
def solution(M, A) :
n=len(A)
total = 0
for back in xrange(n) :
front = back
while front < n and A[front] not in A[back:front] :
total += 1
front += 1
if total >= 1000000000 :
return 1000000000
retur... | ffakhraei/pProj | python/codility/ch15/countDistinctSlices.py | Python | gpl-3.0 | 350 | 0.04 |
"""Contain common module fields."""
# pylint: disable=too-many-public-methods
from __future__ import absolute_import
import re
from django.db import models
from django.core.exceptions import ValidationError
class NameField(models.CharField):
"""Item name string field.
This field is limited to 64 characters ... | gregoil/rotest | src/rotest/common/django_utils/fields.py | Python | mit | 2,999 | 0 |
"""Flow based node and edge disjoint paths."""
import networkx as nx
from networkx.exception import NetworkXNoPath
# Define the default maximum flow function to use for the undelying
# maximum flow computations
from networkx.algorithms.flow import edmonds_karp
from networkx.algorithms.flow import preflow_push
from net... | SpaceGroupUCL/qgisSpaceSyntaxToolkit | esstoolkit/external/networkx/algorithms/connectivity/disjoint_paths.py | Python | gpl-3.0 | 14,544 | 0.000619 |
# Copyright 2015 IBM Corp.
#
# 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 agree... | tmenjo/cinder-2015.1.1 | cinder/tests/objects/test_objects.py | Python | apache-2.0 | 36,876 | 0 |
import turtle
class C(turtle.TurtleScreenBase):
pass | siosio/intellij-community | python/testData/override/qualified.py | Python | apache-2.0 | 57 | 0.035088 |
#!/usr/bin/env python
import json
import numpy
import scipy.sparse as sp
from optparse import OptionParser
__author__ = "Gregory Ditzler"
__copyright__ = "Copyright 2014, EESI Laboratory (Drexel University)"
__credits__ = ["Gregory Ditzler"]
__license__ = "GPL"
__version__ = "0.1.0"
__maintainer__ = "Gregory Ditzler... | gditzler/BigLS2014-Code | src/bmu.py | Python | gpl-3.0 | 2,945 | 0.021053 |
"""
A script for testing / benchmarking HMM Implementations
"""
import argparse
import collections
import logging
import time
import hmmlearn.hmm
import numpy as np
import sklearn.base
LOG = logging.getLogger(__file__)
class Benchmark:
def __init__(self, repeat, n_iter, verbose):
self.repeat = repeat... | hmmlearn/hmmlearn | scripts/benchmark.py | Python | bsd-3-clause | 8,715 | 0.000115 |
from apero_imac.models import *
from django.shortcuts import render_to_response
from datetime import datetime
def home(request):
return render_to_response('home.html', locals())
def about(request):
return render_to_response('about.html', locals())
| Elfhir/apero-imac | apero_imac/views.py | Python | mpl-2.0 | 255 | 0.023529 |
import os
import nipype.interfaces.utility as util
from CPAC.utils.interfaces.function import Function
from CPAC.pipeline import nipype_pipeline_engine as pe
def run_surface(post_freesurfer_folder,
freesurfer_folder,
subject,
t1w_restore_image,
atlas_spa... | FCP-INDI/C-PAC | CPAC/surface/surf_preproc.py | Python | bsd-3-clause | 6,597 | 0.00864 |
# -*- coding: utf-8 -*-
cont = 0
v = []
for i in range(6):
v.append(float(raw_input()))
if (v[i] > 0):
cont = cont + 1
print("%d valores positivos" % cont)
| bergolho1337/URI-Online-Judge | Basicos/Python/1060/main.py | Python | gpl-2.0 | 173 | 0 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
'''Unit tests for the 'grit build' tool.
'''
import codecs
import os
import sys
import tempfile
if __name__ == '__main__':
sys.p... | sgraham/nope | tools/grit/grit/tool/build_unittest.py | Python | bsd-3-clause | 11,256 | 0.00613 |
# coding: utf-8
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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 o... | ganeshrn/ansible | test/units/parsing/yaml/test_loader.py | Python | gpl-3.0 | 17,230 | 0.002266 |
# -*- coding: utf-8 -*-
from django.contrib.contenttypes.models import ContentType
from django.db import models
class TCMSLogManager(models.Manager):
def for_model(self, model):
"""
QuerySet for all comments for a particular model (either an instance or
a class).
"""
ct = ... | Nitrate/Nitrate | src/tcms/logs/managers.py | Python | gpl-2.0 | 527 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2016 James Clark <james.clark@ligo.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
#... | astroclark/numrel_bursts | nrburst_utils/nrburst_pickle_preserve.py | Python | gpl-2.0 | 2,870 | 0.007666 |
# The MIT License
#
# Copyright (c) 2008 James Piechota
#
# 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 without limitation the rights
# to use, copy,... | redpawfx/massiveImporter | python/ns/tests/TestGenotype.py | Python | mit | 2,335 | 0.02227 |
from dxr.lines import Ref
from dxr.utils import search_url
class _PythonPluginAttr(object):
plugin = 'python'
class ClassRef(Ref, _PythonPluginAttr):
"""A reference attached to a class definition"""
def menu_items(self):
qualname = self.menu_data
yield {'html': 'Find subclasses',
... | bozzmob/dxr | dxr/plugins/python/menus.py | Python | mit | 674 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: zengchunyun
"""
from twisted.internet import reactor
from twisted.internet import protocol
class EchoClient(protocol.Protocol):
def connectionMade(self):
self.transport.write(bytes("hello zengchunyun", "utf8"))
def dataReceived(self, data):
... | zengchunyun/s12 | day9/temp/ext/twisted_client.py | Python | gpl-2.0 | 935 | 0.00107 |
"""
xml.py -
Copyright (C) 2016 Tobias Helfenstein <tobias.helfenstein@mailbox.org>
Copyright (C) 2016 Anton Hammer <hammer.anton@gmail.com>
Copyright (C) 2016 Sebastian Hein <hein@hs-rottenburg.de>
Copyright (C) 2016 Hochschule für Forstwirtschaft Rottenburg <hfr@hs-rottenburg.de>
This file is part of Wuchshüllenre... | tobiashelfenstein/wuchshuellenrechner | wuchshuellenrechner/lib/xml.py | Python | gpl-3.0 | 6,767 | 0.005619 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import os
import fnmatch
import logging
from gcdt_bundler.bundler_utils import glob_files, get_path_info
from . import here
ROOT_DIR = here('./resources/static_files')
log = logging.getLogger(__name__)
def test_find_two_files():
re... | glomex/gcdt-bundler | tests/test_bundler_utils.py | Python | mit | 2,286 | 0.000875 |
# -*- coding: utf-8 -*-
from ..internal.misc import json
from ..internal.MultiAccount import MultiAccount
class OverLoadMe(MultiAccount):
__name__ = "OverLoadMe"
__type__ = "account"
__version__ = "0.13"
__status__ = "testing"
__config__ = [("mh_mode", "all;listed;unlisted", "Filter hosters to u... | Arno-Nymous/pyload | module/plugins/accounts/OverLoadMe.py | Python | gpl-3.0 | 1,824 | 0.001096 |
# Copyright 2008 (C) Nicira, Inc.
#
# This file is part of NOX.
#
# NOX 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.
#
# NOX is d... | bigswitch/snac-nox-zaku | src/nox/lib/packet/dhcp.py | Python | gpl-3.0 | 8,935 | 0.005708 |
#!/usr/local/bin/python3
import secrets, string
length = 16
chars = string.ascii_letters + string.digits + '!@#$%^&*()'
print(''.join(secrets.choice(chars) for i in range(length)))
| supermari0/config | utils/pwgen.py | Python | gpl-2.0 | 183 | 0.005464 |
import os
import sys
import glob
import json
import subprocess
from collections import defaultdict
from utils import UnicodeReader, slugify, count_pages, combine_pdfs, parser
import addresscleaner
from click2mail import Click2MailBatch
parser.add_argument("directory", help="Path to downloaded mail batch")
parser.add_... | yourcelf/btb | printing/print_mail.py | Python | agpl-3.0 | 4,703 | 0.002126 |
#!/usr/bin/env python
from nose.tools import *
from networkx import *
from networkx.convert import *
from networkx.algorithms.operators import *
from networkx.generators.classic import barbell_graph,cycle_graph
class TestRelabel():
def test_convert_node_labels_to_integers(self):
# test that empty graph co... | ChristianKniep/QNIB | serverfiles/usr/local/lib/networkx-1.6/networkx/tests/test_relabel.py | Python | gpl-2.0 | 5,962 | 0.032372 |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='django-quickadmin',
version='0.1.2',
description='Django appli... | zniper/django-quickadmin | setup.py | Python | mit | 1,119 | 0.000894 |
import os
from zeroinstall.injector import namespaces
from zeroinstall.injector.reader import InvalidInterface, load_feed
from xml.dom import minidom, Node, XMLNS_NAMESPACE
import tempfile
from logging import warn, info
group_impl_attribs = ['version', 'version-modifier', 'released', 'main', 'stability', 'arch', 'lice... | timdiels/0publish | validator.py | Python | lgpl-2.1 | 2,847 | 0.038286 |
# -*- coding: utf-8 -*-
#
# restblog documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 12 17:19:21 2010.
#
# 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.
#
# Al... | artolaluis/restblog | docs/source/conf.py | Python | bsd-3-clause | 7,320 | 0.007104 |
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.mail import Mail
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.pagedown import PageDown
from config import config
bootstrap = Bootstrap()
mail = Mai... | fakdora/flaksy-upto-login | app/__init__.py | Python | mit | 1,012 | 0 |
from sys import exit
from random import randint
class Scene(object):
def enter(self):
print "This scene is not yet configured. Subclass it and implement enrer()."
exit(1)
class Engine(object):
def __init__(self, scene_map):
self.scene_map = scene_map
def play(self):
curr... | tridvaodin/Assignments-Valya-Maskaliova | LPTHW/ex43.py | Python | gpl-2.0 | 5,149 | 0.004273 |
# -*- coding: utf-8 -*-
###############################################################################
##
## Copyright (C) 2014-2016, 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 p... | VisTrails/VisTrails | vistrails/packages/spreadsheet/cell_rc.py | Python | bsd-3-clause | 211,544 | 0.000151 |
"""
An exception is what occurs when you have a run time error in your
program.
what you can do is "try" a statement wether it is invalid or not
if an error does occur withan that statement you can catch that error
in the except clause and print out a corresponding message
(or you can print out the error message).
... | ajn123/Python_Tutorial | Python Version 2/Advanced/exceptions.py | Python | mit | 1,154 | 0.034662 |
import hashlib
import hmac
import json
import requests
class GitHubResponse:
"""Wrapper for GET request response from GitHub"""
def __init__(self, response):
self.response = response
@property
def is_ok(self):
"""Check if request has been successful
:return: if it was OK
... | MarekSuchanek/repocribro | repocribro/github.py | Python | mit | 9,565 | 0 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | beernarrd/gramps | gramps/gen/filters/rules/person/_hascitation.py | Python | gpl-2.0 | 1,883 | 0.006373 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Peter Mounce <public@neverrunwithscissors.com>
#
# This file is part of Ansible
#
# Ansible 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... | gundalow/ansible-modules-extras | windows/win_webpicmd.py | Python | gpl-3.0 | 1,852 | 0.00162 |
"""
tests: this package contains all Scrapy unittests
see http://doc.scrapy.org/en/latest/contributing.html#running-tests
"""
import os
# ignore system-wide proxies for tests
# which would send requests to a totally unsuspecting server
# (e.g. because urllib does not fully understand the proxy spec)
os.environ['http... | rolando-contrib/scrapy | tests/__init__.py | Python | bsd-3-clause | 1,205 | 0 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
#
# 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 you... | Forage/Gramps | gramps/gui/widgets/linkbox.py | Python | gpl-2.0 | 1,754 | 0.005701 |
from datetime import datetime, timedelta
import csv
from cStringIO import StringIO
from django.test import TestCase
from django.contrib.auth.models import User
from django.test import Client
from django.http import HttpRequest, QueryDict, response
from mock import patch, Mock
from .models import Variable, Session, Vi... | ResearchSoftwareInstitute/MyHPOM | hs_tracking/tests.py | Python | bsd-3-clause | 15,515 | 0.001482 |
from .blueprint import bp
from .submission import *
| SpeedProg/eve-inc-waitlist | waitlist/blueprints/xup/__init__.py | Python | mit | 52 | 0 |
#!/usr/bin/python
# omega - python client
# https://github.com/jfillmore/Omega-API-Engine
#
# Copyright 2011, Jonathon Fillmore
# Licensed under the MIT license. See LICENSE file.
# http://www.opensource.org/licenses/mit-license.php
"""Omega core library."""
__all__ = ['client', 'dbg', 'browser', 'box_factory', 'er... | jfillmore/Omega-API-Engine | clients/python/omega/__init__.py | Python | mit | 402 | 0.002488 |
from cfme.utils.version import get_stream
from collections import namedtuple
from contextlib import contextmanager
from cfme.test_framework.sprout.client import SproutClient
from cfme.utils.conf import cfme_data, credentials
from cfme.utils.log import logger
import pytest
from wait_for import wait_for
from cfme.test_fr... | jkandasa/integration_tests | cfme/fixtures/cli.py | Python | gpl-2.0 | 4,212 | 0.002374 |
import os
import glob
SOURCE_FILES = glob.glob(os.path.dirname(__file__) + "/*.py")
__all__ = [os.path.basename(f)[: -3] for f in SOURCE_FILES]
__doc__ = """\
Module for advanced plotting based on matplotlib
"""
from .popups import * | Repythory/Libraries | amolf/plotting/__init__.py | Python | bsd-2-clause | 236 | 0.008475 |
#!/usr/bin/env python
# encoding: utf-8
import unittest
from ..test import TestCase, Spy
from ..http.mocks.presence_subscription_mock import PresenceSubscriptionMock
from ..http.mocks.subscription_mock import SubscriptionMock
from . import *
class TestSubscription(TestCase):
def test_presence_decryption(self):
... | RingCentralVuk/ringcentral-python | ringcentral/subscription/__init__test.py | Python | mit | 2,725 | 0.001835 |
#-*- coding: utf-8 -*-
from django import forms
from models import User
from captcha.fields import CaptchaField
class UserForm(forms.ModelForm):
captcha = CaptchaField()
cgu = forms.BooleanField()
class Meta:
model = User
widgets = { 'pseudo': forms.TextInput(attrs={'class':'form-contr... | remontees/EliteHebergPanel | home/forms.py | Python | lgpl-3.0 | 442 | 0.020362 |
from pycp2k.inputsection import InputSection
from ._print55 import _print55
from ._interpolator10 import _interpolator10
class _nmr1(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Interpolate_shift = None
self.Nics = None
... | SINGROUP/pycp2k | pycp2k/classes/_nmr1.py | Python | lgpl-3.0 | 844 | 0.00237 |
### Interactively plot points
### to show the correlation between the x and y directions.
### By Rajeev Raizada, Jan.2011.
### Requires Python, with the Matplotlib and SciPy modules.
### You can download Python and those modules for free from
### http://www.python.org/download
### http://scipy.org
### http://matplotlib... | sniemi/SamPy | plot/interactive_correlation_plot.py | Python | bsd-2-clause | 11,714 | 0.015025 |
import logging
import struct
_LOGGER = logging.getLogger(__name__)
typical_types = {
0x11: {
"desc": "T11: ON/OFF Digital Output with Timer Option", "size": 1,
"name": "Switch Timer",
"state_desc": { 0x00: "off",
0x01: "on"}
},
... | maoterodapena/pysouliss | souliss/Typicals.py | Python | mit | 9,295 | 0.00979 |
#!/usr/bin/env python2.7
import click
from common import KGC_PORT
from server import KgcRpcServer
import privipk
from privipk.keys import LongTermSecretKey
@click.group()
def cli():
"""
Use this tool to spawn a KGC server and/or to generate
a private key for a KGC server.
"""
pass
@cli.command(... | PriviPK/privipk-sync-engine | kgc/kgc-service.py | Python | agpl-3.0 | 1,469 | 0.001361 |
# Copyright 2015: Hewlett-Packard Development Company, L.P.
# 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-... | vishnu-kumar/PeformanceFramework | tests/unit/plugins/openstack/scenarios/nova/test_keypairs.py | Python | apache-2.0 | 2,878 | 0 |
def test_var_args(f_arg, *argv):
print("normal:", f_arg)
for arg in argv:
print("another one:", arg)
def greet_me(**kwargs):
for key, value in kwargs.items():
print("{0} = {1}".format(key, value))
test_var_args('hello', 'there', 'general', 'Kenobi')
greet_me(name="test", surname="me")
| CajetanP/code-learning | Python/Learning/Tips/args_and_kwargs.py | Python | mit | 319 | 0 |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 11 14:10:30 2017
@author: WİN7
"""
# 4 basamaklı, basamakları tekrarsız sayıların (4lü karakter dizisi)
# tümünü bir liste olarak (5040 tane) üretip döndürür.
def sayilariUret():
S = []
for n in range(10000):
ss = "%04d"%n
if ss[0]==ss[1] or s... | akpeker/sayi-tahmin-cozucu | py/sayitahminCozucu.py | Python | mit | 5,341 | 0.02385 |
# -*- coding: utf-8 -*-
from collections import defaultdict
from functools import partial
from itertools import count
import json
import networkx as nx
from networkx.algorithms import weakly_connected_component_subgraphs
from numpy import subtract
from numpy.linalg import norm
from typing import Any, DefaultDict, Dict... | tomka/CATMAID | django/applications/catmaid/control/graph2.py | Python | gpl-3.0 | 24,814 | 0.004796 |
## Package for various utility functions to execute build and shell commands
#
# @copyright (c) 2007 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Australia
# atnf-enquiries@csiro.au
#
# This file is part of the ... | ATNF/askapsdp | Tools/Dev/rbuild/askapdev/rbuild/utils/create_init_file.py | Python | gpl-2.0 | 2,053 | 0.002923 |
"""
Helper functions for creating Form classes from Django models
and database field objects.
"""
from __future__ import unicode_literals
from collections import OrderedDict
from itertools import chain
import warnings
from django.core.exceptions import (
ImproperlyConfigured, ValidationError, NON_FIELD_ERRORS, F... | runekaagaard/django-contrib-locking | django/forms/models.py | Python | bsd-3-clause | 54,740 | 0.00148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.