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 |
|---|---|---|---|---|---|---|
from kazoo.exceptions import NoNodeError
from sys import maxsize
from .mutex import Mutex
from .internals import LockDriver
from .utils import lazyproperty
READ_LOCK_NAME = "__READ__"
WRITE_LOCK_NAME = "__WRIT__"
class _LockDriver(LockDriver):
def sort_key(self, string, _lock_name):
string = super(_LockD... | pseudomuto/kazurator | kazurator/read_write_lock.py | Python | mit | 3,177 | 0 |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import gyp
import gyp.common
import gyp.SCons as SCons
import os.path
import pprint
import re
# TODO: remove when we delete the last WriteList() call in this mo... | AlericInglewood/3p-google-breakpad | src/tools/gyp/pylib/gyp/generator/scons.py | Python | bsd-3-clause | 34,839 | 0.00643 |
#!/usr/bin/env python2
'''
Copyright (c) 2012 Peter Andrews
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by app... | aurule/Sociogram | src/sociogram.py | Python | apache-2.0 | 60,889 | 0.008836 |
class PlatformHelper:
def __init__(self, app):
self.app = app
def fill_contact_form(self, contact_model):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_link_text("add new").click()
self.fillin_contact_form(contact_model)
def fillin_contact_form(sel... | verdyanna/new_troika | fixture/platform_helper.py | Python | apache-2.0 | 2,490 | 0.002477 |
#!/usr/bin/env python
from pathlib import Path
from datetime import datetime
from typing import Dict, Union, Any, Sequence
from typing.io import TextIO
import xarray
import numpy as np
import logging
from .rio import opener, rinexinfo
from .common import rinex_string_to_float
#
STARTCOL2 = 3 # column where numerical... | scienceopen/pyrinex | src/georinex/nav2.py | Python | mit | 8,213 | 0.001461 |
# from: http://cairographics.org/freetypepython/
import ctypes
import cairo
class FreeTypeLibInitializationFailed(Exception):
pass
class PycairoContext(ctypes.Structure):
_fields_ = [("PyObject_HEAD", ctypes.c_byte * object.__basicsize__),
("ctx", ctypes.c_void_p), ("base", ctypes.c_void_p)... | cajone/pychess | lib/pychess/System/cairoextras.py | Python | gpl-3.0 | 2,930 | 0.000341 |
from django.apps import AppConfig
class MainAppConfig(AppConfig):
name = 'main_app'
| Mdlkxzmcp/various_python | Alpha & Beta/Django/WaifuTracker/main_app/apps.py | Python | mit | 90 | 0 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can... | ghorn/debian-casadi | docs/examples/python/simulation.py | Python | lgpl-3.0 | 4,875 | 0.01641 |
'''
Test proxy serving stale content when DNS lookup fails
'''
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you un... | duke8253/trafficserver | tests/gold_tests/proxy_protocol/proxy_serve_stale_dns_fail.test.py | Python | apache-2.0 | 3,341 | 0.002095 |
"""
This module contains the web controllers for Repositories.
"""
import logging
import sys
import web
from pulp.common import dateutils
from pulp.server.auth.authorization import READ
from pulp.server.db.model.criteria import UnitAssociationCriteria
from pulp.server.webservices import serialization
from pulp.server... | mhrivnak/pulp | server/pulp/server/webservices/controllers/repositories.py | Python | gpl-2.0 | 7,350 | 0.000952 |
"""
The Enrollment API Views should be simple, lean HTTP endpoints for API access. This should
consist primarily of authentication, request validation, and serialization.
"""
import logging
from ipware.ip import get_ip
from django.core.exceptions import ObjectDoesNotExist
from django.utils.decorators import method_de... | mushtaqak/edx-platform | common/djangoapps/enrollment/views.py | Python | agpl-3.0 | 21,774 | 0.004225 |
normIncludes = [
{"fieldName": "field1", "includes": "GOOD,VALUE", "excludes": "BAD,STUFF", "begins": "", "ends": "", "replace": "goodvalue"},
{"fieldName": "field1", "includes": "", "excludes": "", "begins": "ABC", "ends": "", "replace": "goodvalue"},
{"fieldName": "field1", "includes": "", "excludes": "",... | rh-marketingops/dwm | dwm/test/test_normIncludes.py | Python | gpl-3.0 | 407 | 0.007371 |
""" 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... | martynovp/edx-platform | openedx/core/djangoapps/util/testing.py | Python | agpl-3.0 | 8,831 | 0.002038 |
from .SignalDataCanvas import SignalDataCanvas
from .SignalDataCanvas import SignalDataCanvasFast
| peace098beat/pyside_cookbook | 10_MatplotlibVSPygraph/mplcanvas/__init__.py | Python | gpl-3.0 | 104 | 0 |
"""
Ceph Version
============
Combiner for Ceph Version information. It uses the results of
the ``CephVersion``, ``CephInsights`` and ``CephReport`` parsers.
The order from most preferred to least preferred is `CephVersion``, ``CephInsights``, ``CephReport``.
"""
from insights import combiner
from insights.parsers.c... | RedHatInsights/insights-core | insights/combiners/ceph_version.py | Python | apache-2.0 | 2,860 | 0.001399 |
# Copyright 2018 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 applicab... | derekjchow/models | research/feelvos/utils/video_input_generator.py | Python | apache-2.0 | 24,003 | 0.006208 |
"""Tests for `gryaml` module."""
from __future__ import print_function
from textwrap import dedent
from typing import Callable, List, Union
import pytest
import yaml
from boltons.iterutils import first
import gryaml
import py2neo_compat
# noinspection PyProtectedMember
from gryaml.pyyaml import _unregister as gryam... | wcooley/python-gryaml | tests/test_gryaml.py | Python | mit | 18,899 | 0.000106 |
import introbot
# Connect to twitter, using your own account...
try: from introbot import connection
except:
print "IntroBot: unable to connect to to Twitter"
sys.exit()
print "IntroBot: connected to Twitter: ",connection.line
# Instantiate a host, who will do the introductions:
jeeves = introbot.Host()
#... | drphilmarshall/IntroBot | introbot.py | Python | gpl-2.0 | 594 | 0.005051 |
import re
from collections import namedtuple, deque
from .regex import RE_SPLIT, RE_KEY, RE_INDEX
from .utils import Enum, _missing
StackItem = namedtuple('StackItem', ['name', 'access_method'])
# Accessor methods:
# INDEX means this accessor is index or key-based, eg. [1] or ['foo']
# DEFAULT means property
Access... | dansimau/pystringattr | stringattr.py | Python | bsd-3-clause | 5,928 | 0.000506 |
#!/usr/bin/env python
from distutils.core import setup
setup(
name='targetd',
version='0.8.8',
description='Linux remote storage API daemon',
license='GPLv3',
maintainer='Andy Grover',
maintainer_email='agrover@redhat.com',
url='http://github.com/open-iscsi/targetd',
packages=['targetd... | agrover/targetd | setup.py | Python | gpl-3.0 | 358 | 0 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 30, transform = "Anscombe", sigma = 0.0, exog_count = 0, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_Lag1Trend/cycle_30/ar_/test_artificial_1024_Anscombe_Lag1Trend_30__0.py | Python | bsd-3-clause | 264 | 0.087121 |
"""
A brief demonstration of using the prover within Forseti
"""
from __future__ import print_function
from forseti.prover import Prover
# pylint: disable=duplicate-code
prover = Prover()
prover.add_formula("or(iff(G,H),iff(not(G),H))")
prover.add_goal("or(iff(not(G),not(H)),not(iff(G,H)))")
print(prover.run_prover()... | MasterOdin/forseti | main.py | Python | mit | 702 | 0.001425 |
#!/usr/bin/env python
# This demonstrates a node group configurations.
#
# Node groups can be defined with the syntax "-g N@IP0,IP1-IP2,IP3".
# This says to create a group of N nodes with IPs IP0, IP1, ..., IP2,
# IP3. Run it with deterministic IPs causes lots of gratuitous IP
# reassignments. Running with --nd fixe... | rootfs/ctdb | tests/takeover/simulation/node_group.py | Python | gpl-3.0 | 1,299 | 0.004619 |
from PyQt5.QtCore import pyqtSignal
from model.modelitem import ModelItem
from model.rating import RatingType
from model.transaction import transactional
class Player(ModelItem):
newCurrentGame = pyqtSignal(object, object, object)
"""
Represents a player the client knows about.
"""
def __init__... | FAForever/client | src/model/player.py | Python | gpl-3.0 | 4,165 | 0 |
# -*- coding: utf-8 -*-
"""Asynchronous task queue module."""
from celery import Celery
from celery.utils.log import get_task_logger
from raven import Client
from raven.contrib.celery import register_signal
from website import settings
app = Celery()
# TODO: Hardcoded settings module. Should be set using framework... | petermalcolm/osf.io | framework/tasks/__init__.py | Python | apache-2.0 | 1,133 | 0.004413 |
from pony.orm.core import *
| buddyli/private2w | libs/pony/orm/__init__.py | Python | apache-2.0 | 28 | 0 |
#: E211
spam(1)
#: E211 E211
dict['key'] = list[index]
#: E211
dict['key']['subkey'] = list[index]
#: Okay
spam(1)
dict['key'] = list[index]
# This is not prohibited by PEP8, but avoid it.
class Foo (Bar, Baz):
pass
| ruchee/vimrc | vimfiles/bundle/vim-python/submodules/autopep8/test/suite/out/E21.py | Python | mit | 222 | 0 |
from django.dispatch import Signal
# Sent when a payment is successfully processed.
alipay_ptn_successful = Signal()
alipay_ptn_flagged = Signal()
| tualatrix/django-alipay | alipay/trade_create_by_buyer/ptn/signals.py | Python | gpl-3.0 | 149 | 0 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Lice... | redmeros/Lean | Algorithm.Python/BasicTemplateAlgorithm.py | Python | apache-2.0 | 2,223 | 0.010806 |
import datetime
import re
import requests
import tempestmail.constants as constants
from six.moves.urllib.parse import urljoin
def compare_tests(failures):
''' Detect fails covered by bugs and new'''
covered, new = [], []
for fail in failures:
for test in constants.TESTS:
if re.searc... | arxcruz/tempest-tool | tempestmail/utils.py | Python | gpl-3.0 | 2,611 | 0.001532 |
# stdlib
import subprocess
import os
import sys
import re
import traceback
# project
from checks import AgentCheck
from util import Platform
# 3rd party
import pymysql
GAUGE = "gauge"
RATE = "rate"
STATUS_VARS = {
'Connections': ('mysql.net.connections', RATE),
'Max_used_connections': ('mysql.net.max_connec... | JohnLZeller/dd-agent | checks.d/mysql.py | Python | bsd-3-clause | 15,405 | 0.003505 |
###
# Copyright (c) 2003-2005, Daniel DiPaolo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of cond... | tecan/xchat-rt | plugins/scripts/encryption/supybot-code-6361b1e856ebbc8e14d399019e2c53a35f4e0063/plugins/MoobotFactoids/__init__.py | Python | gpl-2.0 | 2,507 | 0.000399 |
class Nipe(object):
def __init__(self, nome, simbolo):
self.nome = nome
self.simbolo = simbolo
def __repr__(self):
return self.simbolo
| lopesivan/blackjack | cartas/nipe.py | Python | gpl-2.0 | 169 | 0 |
#!/usr/bin/env python3
import pefile, pathlib, shutil
dlls = set()
dllpath = pathlib.Path('/windows/mingw64/bin')
pe_modules = set([pefile.PE('wesnoth.exe')])
while pe_modules:
pe = pe_modules.pop()
for entry in pe.DIRECTORY_ENTRY_IMPORT:
path = dllpath / pathlib.Path(entry.dll.decode())
if p... | gfgtdf/wesnoth-old | utils/dockerbuilds/mingw/get_dlls.py | Python | gpl-2.0 | 470 | 0.002128 |
###################################################################################
# Copyright (c) 2005 John Judd
#
# 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, inclu... | Ripsnorta/pyui2 | docs/demos/widgetdemo/widgetdemo.py | Python | lgpl-2.1 | 7,972 | 0.005394 |
"""
Compute design and response by calling R subprocess.
"""
import os
import subprocess
import pandas as pd
my_dir = os.path.dirname(__file__)
R_dir = os.path.join(my_dir, "R_code")
DR_module = os.path.join(R_dir, "design_and_response.R")
R_template = r"""
source('{module}')
meta.data <- read.table('{meta_file}'... | AaronWatters/inferelator_strawman | inferelator_strawman/design_response_R.py | Python | bsd-2-clause | 3,334 | 0.003599 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-30 19:33
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contratos', '0002_auto_20170330_1328'),
]
operations = [
migrations.RenameField(
... | axelleonhart/TrainingDjango | materiales/apps/contratos/migrations/0003_auto_20170330_1333.py | Python | lgpl-3.0 | 432 | 0 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
BirdChooserDialog
A QGIS plugin
Show bird observations
-------------------
begin : 2015-11-05
git sha : $Fo... | jguelat/BirdChooser | bird_chooser_dialog.py | Python | gpl-2.0 | 3,907 | 0.003327 |
from typing import Any, Dict, List, Union
from unittest import mock
import orjson
from zerver.lib.actions import (
do_remove_realm_custom_profile_field,
do_update_user_custom_profile_data_if_changed,
try_add_realm_custom_profile_field,
try_reorder_realm_custom_profile_fields,
)
from zerver.lib.externa... | punchagan/zulip | zerver/tests/test_custom_profile_data.py | Python | apache-2.0 | 35,581 | 0.002108 |
def omp_parallel_for_lastprivate():
sum = 0
i0 = -1
'omp parallel for reduction(+:sum) schedule(static,7) lastprivate(i0)'
for i in range(1,1001):
sum += i
i0 = i
known_sum = (1000 * (1000 + 1)) / 2
return known_sum == sum and i0 == 1000
| pombredanne/pythran | pythran/tests/openmp.legacy/omp_parallel_for_lastprivate.py | Python | bsd-3-clause | 279 | 0.003584 |
from __future__ import unicode_literals
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.completion import WordCompleter, PathCompleter
from prompt_toolkit.contrib.completers.system import SystemCompleter
from prompt_toolkit.contrib.regular_languages.completion import GrammarCompleter
f... | jonathanslenders/pyvim | pyvim/commands/completer.py | Python | bsd-3-clause | 1,985 | 0.001008 |
#!/usr/bin/env python
print("""# ******* WARNING - AUTO GENERATED CODE - DO NOT EDIT *******
module VimSdk
module VmomiSupport
""")
import ServerObjects
import PbmObjects
import SmsObjects
print(""" end
end
""")
| cloudfoundry-incubator/bosh-vsphere-cpi-release | scripts/pyvmomi_to_ruby/gen_server_objects.py | Python | apache-2.0 | 219 | 0.013699 |
'''
test_json.py: Singularity Hub testing functions for Singularity in Python
Copyright (c) 2016-2017, Vanessa Sochat. All rights reserved.
"Singularity" Copyright (c) 2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from ... | Trophime/singularity | libexec/python/tests/test_json.py | Python | bsd-3-clause | 9,089 | 0.022335 |
#!/usr/bin/env python
"""
Measure the performance of STM based spike prediction by repeatedly
using all but one cell for training and the remaining cell for testing.
"""
import os
import sys
from argparse import ArgumentParser
from pickle import dump
from scipy.io import savemat
from numpy import mean, std, corrcoef... | lucastheis/c2s | scripts/c2s-leave-one-out.py | Python | mit | 3,513 | 0.022773 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... | Alecto3-D/testable-greeter | bb-master/sandbox/lib/python3.5/site-packages/autobahn/wamp/types.py | Python | mit | 36,554 | 0.003146 |
from datetime import datetime
from .base import BaseModel
class Comment(BaseModel):
def __init__(self, **kwargs):
# Add created and updated attrs by default.
self.created = self.updated = datetime.now()
super().__init__(**kwargs)
def update(self):
""" Extends update method to... | oldani/nanodegree-blog | app/models/comment.py | Python | mit | 422 | 0 |
import serial
import time
import datetime
import csv
ser = serial.Serial('/dev/cu.usbmodem1411', 9600, timeout=0)
my_file = 'data.csv'
f = open(my_file, 'wt')
writer = csv.writer(f)
writer.writerow(('dateTime', 'analogValue')) # csv column headers
while True:
try:
# write a csv row
writer.writer... | jaredmcqueen/hot-wheels-radar-gun | getSerialData.py | Python | mit | 779 | 0 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... | pferreir/indico-backup | indico/MaKaC/plugins/EPayment/yellowPay/__init__.py | Python | gpl-3.0 | 882 | 0.013605 |
#
# Copyright 2006 The Apache Software Foundation
#
# 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... | moreus/hadoop | hadoop-0.11.2/src/contrib/abacus/examples/pyAbacus/JythonAbacus.py | Python | apache-2.0 | 2,577 | 0.014358 |
from __future__ import unicode_literals
import logging
import os
from mopidy import config, ext
__version__ = '0.3.0'
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = 'Mopidy-Webhooks'
ext_name = 'webhooks'
version = __version__
def get_default_config(self):
... | pombredanne/mopidy-webhooks | mopidy_webhooks/__init__.py | Python | apache-2.0 | 877 | 0 |
# Copyright 2014-2015 Insight Software Consortium.
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
from . import scanner
# keep py2exe happy
import xml.etree.ElementTree
import xml.etree.cElementTree as ElementTree
class... | zachary-williamson/ITK | Modules/ThirdParty/pygccxml/src/pygccxml/parser/etree_scanner.py | Python | apache-2.0 | 1,759 | 0.000569 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/ip_configuration.py | Python | mit | 2,982 | 0.001677 |
"""Application update utilities using esky"""
import sys
import errno
import json
from urlparse import urljoin
from urllib2 import URLError
from urllib2 import HTTPError
import socket
from esky import Esky
from esky.errors import EskyBrokenError
from nxdrive.logging_config import get_logger
from nxdrive.engine.workers... | loopingz/nuxeo-drive | nuxeo-drive-client/nxdrive/updater.py | Python | lgpl-2.1 | 17,952 | 0.001337 |
import sublime, sublime_plugin
def clean_layout(layout):
row_set = set()
col_set = set()
for cell in layout["cells"]:
row_set.add(cell[1])
row_set.add(cell[3])
col_set.add(cell[0])
col_set.add(cell[2])
row_set = sorted(row_set)
col_set = sorted(col_set)
rows =... | ciechowoj/minion | output.py | Python | mit | 6,974 | 0.004158 |
import weakref
import functools
import itertools
from mongoengine.common import _import_class
from mongoengine.errors import DoesNotExist, MultipleObjectsReturned
__all__ = ("BaseDict", "BaseList", "EmbeddedDocumentList")
class BaseDict(dict):
"""A special dict so we can watch any changes"""
_dereferenced =... | elephanter/mongoengine | mongoengine/base/datastructures.py | Python | mit | 15,294 | 0.001504 |
# VMware vCloud Python helper
# Copyright (c) 2014 Huawei, 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
#
# Unl... | HybridF5/hybrid-jacket | nova_jacket/virt/jacket/vcloud/vcloud.py | Python | apache-2.0 | 51,929 | 0.003216 |
import click
import os
import penguin.pdf as pdf
import penguin.utils as utils
def check_src(src):
if not all((map(utils.is_valid_source, src))):
raise click.BadParameter("src arguments must be either a valid directory"
" or pdf file.")
@click.group()
def penguin():
... | zrluety/penguin | penguin/scripts/penguin_cli.py | Python | mit | 1,738 | 0.004028 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='loanproduct',
name='acc... | AjabWorld/ajabsacco | ajabsacco/core/migrations/0002_auto_20150508_0542.py | Python | apache-2.0 | 1,088 | 0.000919 |
from django.conf.urls import url
from yell import views
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^testing/$', views.testing, name='testing'),
url(r'^results/$', views.restaurants, name='restaurants'),
url(r'^api/... | andrewjton/SHOUT | app/shout/yell/urls.py | Python | mit | 435 | 0.013793 |
"""
meuh.commands.distro
~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import, print_function, unicode_literals
__all__ = ['InitCommand',
'DestroyAllCommand',
'DestroyCommand',
'ShowCommand']
import logging
from cliff.command import Command
from meuh.action import ... | johnnoone/meuh-python | meuh/commands/distro.py | Python | mit | 2,649 | 0.000378 |
from django import forms
from django.forms.forms import BoundField
from .helpers import LMIForAllClient
from .fields import MultiCharField
class FieldSet(object):
"""
Taken from stackoverflow.com/questions/10366745/django-form-field-grouping
Helper class to group BoundField objects together.
"""
... | lm-tools/situational | situational/apps/sectors/forms.py | Python | bsd-3-clause | 2,817 | 0 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
... | scode/pants | contrib/spindle/src/python/pants/contrib/spindle/tasks/spindle_gen.py | Python | apache-2.0 | 10,402 | 0.007402 |
#!/usr/bin/env python
import logging
LOGGER = logging.getLogger('controller')
USER = 'user'
ROOT = 'root'
ADMIN = 'administrator'
| thomashuang/Lilac | lilac/controller/__init__.py | Python | lgpl-3.0 | 136 | 0.007353 |
from django.http import HttpResponse
import datetime
def hello(request):
return HttpResponse("Hello world")
def home(request):
datetime.datetime.now()
now = datetime.datetime.now()
html = "<html><body>It is now %s.</body></html>" % now
return HttpResponse(html)
def hours_ahead(request, offset... | arventwei/django_test | mysite/mysite/view.py | Python | mit | 589 | 0.010187 |
#-*- coding: utf-8 -*-
import hashlib
import getpass
from pymongo import MongoClient
id = raw_input("등록할 아이디를 입력하세요: ")
pw = getpass.getpass("등록할 비밀번호를 입력하세요(입력하는 것은 보이지 않습니다): ")
client = MongoClient('localhost', 27017)
db = client.RnBCafe
member_collection = db.member
if member_collection.find_one({'id': id}) is N... | Prokuma/cafe-order-system | register.py | Python | mit | 598 | 0.006356 |
#!/usr/bin/env python3
"""Loads an HDF5 file representing Landsat data into a triple store via
SPARQL."""
from argparse import ArgumentParser
from base64 import b64encode
from io import StringIO, BytesIO
from itertools import islice, chain
from dateutil.parser import parse as date_parse
import h5py
import numpy as n... | ANU-Linked-Earth-Data/middleware | batch-demo/import_agdc_data.py | Python | apache-2.0 | 12,109 | 0.000165 |
# $Id: PlotItems.py,v 2.13 2003/08/18 22:33:00 mhagger Exp $
# Copyright (C) 1998-2003 Michael Haggerty <mhagger@alum.mit.edu>
#
# This file is licensed under the GNU Lesser General Public License
# (LGPL). See LICENSE.txt for details.
"""PlotItems.py -- Objects that can be plotted by Gnuplot.
This module contains ... | pombredanne/ompc | ompclib/gplot/PlotItems.py | Python | bsd-3-clause | 24,085 | 0.001412 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2015, Syed Faisal Akber
#
| VA3SFA/rpi_hw_demo | hc-sr04/distance.py | Python | gpl-2.0 | 82 | 0.012195 |
from __future__ import absolute_import, print_function, unicode_literals
import unittest
from nose.plugins.attrib import attr
from indra.databases.lincs_client import get_drug_target_data
from indra.sources.lincs_drug import process_from_web
@attr('webservice')
@unittest.skip('LINCS web service very unreliable.')
de... | pvtodorov/indra | indra/tests/test_lincs_drug.py | Python | bsd-2-clause | 980 | 0 |
# Webhooks for external integrations.
from __future__ import absolute_import
from django.utils.translation import ugettext as _
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
fr... | SmartPeople/zulip | zerver/webhooks/crashlytics/view.py | Python | apache-2.0 | 1,910 | 0.002618 |
"""
WSGI config for django_playlist project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLIC... | kburts/django-playlist | django_playlist/django_playlist/wsgi.py | Python | mit | 1,578 | 0.001267 |
from feedly.verbs import register
from feedly.verbs.base import Verb
class Pin(Verb):
id = 5
infinitive = 'pin'
past_tense = 'pinned'
register(Pin)
| azurefang/flask-zheye | app/main/verbs.py | Python | lgpl-3.0 | 163 | 0.006135 |
class Solution:
def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int:
xs = sorted(x for x, y in points)
return max(xs[i] - xs[i - 1] for i in range(1, len(xs)))
| jiadaizhao/LeetCode | 1601-1700/1637-Widest Vertical Area Between Two Points Containing No Points/1637-Widest Vertical Area Between Two Points Containing No Points.py | Python | mit | 193 | 0 |
# coding=utf-8
class Parent(object):
__parentAttr = 100
_parentAttr = 100
parentAttr = 100
def __init__(self):
print "父类构造函数"
def parentMethod(self):
print "父类方法"
def _protectedMethod(self):
print "我是protected方法"
def __privateMethod(self):
print "我是private方法"
def overWriteMethod(self):
print "父... | seasonfif/python | learning/classmodule/Parent.py | Python | apache-2.0 | 1,829 | 0.03897 |
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
#initialize flask app with correct configurations
app = Flask(__name__)
app.config.from_object('steerclear.settings.windows_settings')
app.config.from_envvar('STEERCLEAR_SETTINGS')
db = SQLAlchemy(app)
from flask.ext.login import LoginManager
login_m... | beblount/Steer-Clear-Backend-Web | steerclear/__init__.py | Python | mit | 723 | 0.006916 |
# 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/openstack/tests/unit/block_storage/v2/test_type.py | Python | gpl-3.0 | 1,577 | 0 |
#!/usr/bin/env python
# sphinxy: commandline continuous integration sphinx documentation
#
# Copyright (C) 2015 Charlie Taylor <ctatsourceforge@gmail.com>
#
# 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... | sonofeft/ODSCharts | docs/sphinxy.py | Python | gpl-3.0 | 4,251 | 0.008469 |
# -*- coding: utf-8 -*-
"""
celery.backends.base
~~~~~~~~~~~~~~~~~~~~
Result backend base classes.
- :class:`BaseBackend` defines the interface.
- :class:`KeyValueStoreBackend` is a common base class
using K/V semantics like _get and _put.
"""
from __future__ import absolute_import
import... | sivaprakashniet/push_pull | p2p/lib/python2.7/site-packages/celery/backends/base.py | Python | bsd-3-clause | 19,323 | 0.000052 |
import re
import bleach
from tower import ugettext_lazy as _lazy
ALLOWED_TAGS = bleach.ALLOWED_TAGS + [
'div', 'span', 'p', 'br', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'pre', 'code', 'cite',
'dl', 'dt', 'dd', 'small', 'sub', 'sup', 'u', 'strike', 'samp', 'abbr',
'ul', 'ol', 'li',
'nobr', 'dfn', 'cap... | robhudson/kuma | kuma/wiki/constants.py | Python | mpl-2.0 | 12,819 | 0.000546 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostLicenseConnectInfo(vim, *args, **kwargs):
'''This data object type describes lice... | xuru/pyvisdk | pyvisdk/do/host_license_connect_info.py | Python | mit | 1,053 | 0.009497 |
#!/usr/bin/env python
#
# Read doxygen xml files to find all members of the dolfin
# name space and generate API doc files per subdirectory of
# dolfin
#
# Written by Tormod Landet, 2017
#
from __future__ import print_function
import sys, os
import parse_doxygen
DOXYGEN_XML_DIR = 'doxygen/xml'
API_GEN_DIR = 'generate... | FEniCS/dolfin | doc/generate_api_rst.py | Python | lgpl-3.0 | 8,783 | 0.001708 |
# -*- coding: utf-8 -*-
"""
zenfig.log
~~~~~~~~~~~~~
Nice output
:copyright: (c) 2016 by Alejandro Ricoveri
:license: MIT, see LICENSE for more details.
"""
import sys
from clint.textui.colored import white, red, cyan, yellow, green
from clint.textui import puts
# Globals
_stdout = False
def init(*, quiet_stdou... | axltxl/zenfig | zenfig/log.py | Python | mit | 1,553 | 0.001288 |
from django.db import models
from django.contrib.auth.models import User
class IntegerRangeField(models.IntegerField):
def __init__(self, verbose_name=None, name=None, min_value=None, max_value=None, **kwargs):
self.min_value, self.max_value = min_value, max_value
models.IntegerField.__init__(self,... | bath-hacker/binny | binny/db/models.py | Python | mit | 1,478 | 0.004736 |
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
import numpy#
from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType
class FeatureSelectionDialog(QtGui.QDialog):
def __init__(self,viewer, parent):
super(FeatureSelectionDialog, self).__init... | timoMa/vigra | vigranumpy/examples/boundary_gui/bv_feature_selection.py | Python | mit | 3,993 | 0.013023 |
import io, sys
import json
import pandas as pd
from . import categories
from . import proc_df_labels
from . import data_formats
from . import make_unique_labels
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
def load_file(net, filename):
# reset network when loaing file, prev... | MaayanLab/clustergrammer-widget | clustergrammer_widget/clustergrammer/load_data.py | Python | mit | 2,352 | 0.022109 |
import functools
import sys
import traceback
from stacked import Stacked
from .xtraceback import XTraceback
class TracebackCompat(Stacked):
"""
A context manager that patches the stdlib traceback module
Functions in the traceback module that exist as a method of this class are
replaced with equival... | g2p/xtraceback | xtraceback/tracebackcompat.py | Python | mit | 3,453 | 0.001158 |
# coding=utf-8
# Copyright 2021 TF.Text 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 ag... | chromium/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/regex_split_ops.py | Python | bsd-3-clause | 10,403 | 0.003557 |
#!/usr/bin/env python
# encoding: utf-8
import os
import tempfile
import unittest
class TestSlug(unittest.TestCase):
"""tests features related to creating slugs"""
def setUp(self):
self.tempd_path = tempfile.mkdtemp()
def tearDown(self):
import shutil
shutil.rmtree(self.tempd_p... | dandesousa/lapis | tests/test_slugs.py | Python | cc0-1.0 | 2,165 | 0.000924 |
# Generated by Django 3.1.13 on 2021-09-16 07:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("github", "0003_githubusertoken"),
]
operations = [
migrations.AddField(
model_name="githubwebhookmessage",
name="er... | comic/comic-django | app/grandchallenge/github/migrations/0004_auto_20210916_0746.py | Python | apache-2.0 | 769 | 0 |
__author__ = 'harsha'
import telegram_methods.getMe
import telegram_methods.getUpdates
import telegram_methods.sendMessage
import telegram.Update
import telegram.Message
import telegram.User
import telegram.GroupChat
import bot_utilities.tgtwitter
import re
base_url = "https://api.telegram.org/bot"
auth_file_name = "... | harsha5500/pytelegrambot | bots/doloresBot.py | Python | gpl-3.0 | 3,494 | 0.002862 |
import pandas
WEATHER_FNAME = 'weather.dat'
FOOTBALL_FNAME = 'football.dat'
def read_weather(fname=WEATHER_FNAME):
"""Read the weather file into a DataFrame and return it.
Pandas has many input routines (all prefixed with "read")
- http://pandas.pydata.org/pandas-docs/stable/io.html
Examining t... | galtay/data_sci_ale | code_kata_04/kata_04.py | Python | gpl-3.0 | 2,540 | 0.000787 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redist... | fpeyre/shinken | shinken/daemons/brokerdaemon.py | Python | agpl-3.0 | 33,165 | 0.002503 |
#!/usr/bin/env python
# Copyright(C) 2011-2016 Thomas Voegtlin
#
# 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, m... | bauerj/electrum-server | src/storage.py | Python | mit | 22,202 | 0.003288 |
def __init_break_indices__(num):
indices = [1]*num
for i in xrange(1, num):
indices[num-1-i] = indices[num-i]*i
return indices
def get_lex_permutation (N, base_string, break_indices):
stringPermutation = []
divident = []
base_string = list(base_string)
divident_prefix = 0
f... | MayankAgarwal/euler_py | 024/euler024.py | Python | mit | 991 | 0.009082 |
import http.server
import urllib.parse
class BaseServer(http.server.BaseHTTPRequestHandler):
pass
HTTPServer = http.server.HTTPServer
urllib_urlparse = urllib.parse.urlparse
| cslarsen/vev | vev/server_py3.py | Python | lgpl-2.1 | 180 | 0.011111 |
#!/usr/bin/env python
'''
https://projecteuler.net/problem=7
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10001st prime number?
'''
import math
def prime(n):
# we start with the knowledge of at least one prime
primes = [2]
# and the next po... | ArthurZey/toyproblems | projecteuler/0007_10001st_prime.py | Python | mit | 1,337 | 0.016455 |
from .datareduction import DataReduction
from .datareductionpipeline import DataReductionPipeLine, ProcessingError
| awacha/cct | cct/core2/instrument/components/datareduction/__init__.py | Python | bsd-3-clause | 115 | 0 |
import sys
PYVERSION = 2
if sys.version_info > (3,):
PYVERSION = 3
| csirtgadgets/csirtg-mail-py | csirtg_mail/constants.py | Python | lgpl-3.0 | 72 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2007-2008 The PyAMF Project.
# See LICENSE for details.
"""
Tests for Local Shared Object (LSO) Implementation.
@author: U{Nick Joyce<mailto:nick@boxdesign.co.uk>}
@since: 0.1.0
"""
import unittest, os.path, warnings
import pyamf
from pyamf import sol
warnings.simplefilte... | jamesward-demo/air-quick-fix | AIRQuickFixServer/pyamf/tests/test_sol.py | Python | apache-2.0 | 6,453 | 0.004029 |
# -*- coding: utf-8 -*-
"""
Translator module that uses the Google Translate API.
Adapted from Terry Yin's google-translate-python.
Language detection added by Steven Loria.
"""
from __future__ import absolute_import
import json
import re
import codecs
from textblob.compat import PY2, request, urlencode
from textblob.... | nvoron23/TextBlob | textblob/translate.py | Python | mit | 2,924 | 0.00171 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.