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 |
|---|---|---|---|---|---|---|
# mock.py
# Test tools for mocking and patching.
# E-mail: fuzzyman AT voidspace DOT org DOT uk
#
# mock 1.0.1
# http://www.voidspace.org.uk/python/mock/
#
# Copyright (c) 2007-2013, Michael Foord & the mock team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modificatio... | catapult-project/catapult | third_party/gsutil/third_party/mock/mock/mock.py | Python | bsd-3-clause | 83,928 | 0.001513 |
import hashlib
from django.conf import settings
from django.core.cache import cache
from django.db.models import Count
from elasticsearch.exceptions import TransportError
from statsd import statsd
from kitsune.products.models import Topic
from kitsune.wiki.models import Document, DocumentMappingType
def topics_for... | dbbhattacharya/kitsune | kitsune/wiki/facets.py | Python | bsd-3-clause | 5,435 | 0 |
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
from .menu import ProposalsMenu
class ProposalsApp(CMSApp):
name = _("Proposals app")
urls = ["pyconde.proposals.urls"]
menus = [ProposalsMenu]
apphook_pool.register(Proposa... | EuroPython/djep | pyconde/proposals/cms_app.py | Python | bsd-3-clause | 327 | 0.003058 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2019 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#... | fifengine/fifengine | engine/python/fife/extensions/pychan/widgets/slider.py | Python | lgpl-2.1 | 7,472 | 0.054738 |
class Scheduler(object):
"""Define a domain."""
def __init__(self, matches, problem):
""".
PARAMETERS TYPE Potential Arguments
-----------------------------------------------
"""
self.matches = matches
schedule = []
self.allSchedules = []... | renatorangel/scheduler | src/structures/scheduler.py | Python | apache-2.0 | 566 | 0 |
# Copyright (C) 2013-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This progr... | cupertinomiranda/binutils | gdb/testsuite/gdb.perf/lib/perftest/testresult.py | Python | gpl-2.0 | 2,216 | 0.002708 |
import os
PACKAGE_NAME = 'pyflux'
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration(PACKAGE_NAME, parent_package, top_path)
config.add_subpackage('__check_build')
config.add_subpackage('arma')
config.add_subpacka... | RJT1990/pyflux | pyflux/setup.py | Python | bsd-3-clause | 792 | 0.002525 |
"""Tests covering utilities for integrating with the catalog service."""
# pylint: disable=missing-docstring
from __future__ import absolute_import
from collections import defaultdict
from datetime import timedelta
import mock
import six
from django.contrib.auth import get_user_model
from django.core.cache import ca... | ESOedX/edx-platform | openedx/core/djangoapps/catalog/tests/test_utils.py | Python | agpl-3.0 | 34,566 | 0.00243 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2018-09-15 15:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gestioneide', '0049_auto_20180516_2118'),
]
operations = [
migrations.AddFie... | Etxea/gestioneide | gestioneide/migrations/0050_auto_20180915_1745.py | Python | gpl-3.0 | 721 | 0.001387 |
from fbchat import Client, log
from getpass import getpass
from datetime import datetime
import sys, os, urllib, time, socket, shutil, requests
from glob import glob
from zipfile import ZipFile
socket.setdefaulttimeout(60)
reload(sys)
sys.setdefaultencoding("utf-8")
ending = '</div></div>'
username = str(raw_input("... | satendrapandeymp/Facebook_message_download | Message_windows.py | Python | mit | 13,157 | 0.031618 |
## @file
# Warning information of Eot
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the lic... | bitcrystal/buildtools-BaseTools | Source/Python/Eot/ParserWarning.py | Python | bsd-2-clause | 1,000 | 0.01 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-12 14:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('type_page', '0004_auto_20170711_1241'),
]
operations = [
migrations.AddFiel... | dumel93/project- | type_page/migrations/0005_footballtype_comments.py | Python | mit | 471 | 0 |
# -*- coding: utf-8 -
#
# This file is part of offset. See the NOTICE for more information.
from offset import run, maintask
from offset.time import Ticker, SECOND
@maintask
def main():
ticker = Ticker(0.1 * SECOND)
for i in range(3):
print(ticker.c.recv())
ticker.stop()
run()
| benoitc/offset | examples/demo_ticker.py | Python | mit | 302 | 0.003311 |
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from sklearn.model_selection import train_test_split
from bartpy.sklearnmodel import SklearnModel
def run(size=100,
alpha=0.95,
beta=2.0,
n_trees=50):
import warnings
warnings.simplefilter("error", UserWarni... | JakeColtman/bartpy | examples/score/core/sin.py | Python | mit | 1,238 | 0 |
import numpy as np
# ===== Patch normalization by mean intensity ========================
def mean_intensity_norm(patch):
mu = np(np.sum(patch))*1.0/(patch.shape[0]*shape[1])
return (patch - mu[np.newaxis,np.newaxis])
| tntrung/youCVML | misc/patch.py | Python | gpl-2.0 | 222 | 0.022523 |
#!/usr/bin/env python3
import os
import errno
import requests
url='http://www.jeep.com/hostd/getlocatedealers.json?zipCode=60202&zipDistance=2500'
directory_name=os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'data'))
try:
os.makedirs(directory_name)
except OSError as exc:
if exc... | simon-wenmouth/dealerships | dealerships/manufacturers/jeep/download_data.py | Python | mit | 628 | 0.009554 |
import commands
from dataservice.DDM import ddm
#print ddm.DQ2ProductionClient.generateUUID()
#print ddm.DQ2.getFilesFromCatalog('aho.xml')
#print ddm.DQ2ProductionClient.dq2_makeblocks('input.data')
ids=['pandatest.000003.dd.input._00047.junk','09801b0a-9fd0-4237-8caf-a37932c26e39',
'pandatest.000003.dd.input._... | RRCKI/panda-server | pandaserver/test/testDQ.py | Python | apache-2.0 | 6,730 | 0.021545 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-09 14:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('find_a_pad_app', '0003_auto_20170709_1432'),
]
operations = [
migrations.Al... | findapad/find_a_pad | find_a_pad_app/migrations/0004_auto_20170709_1432.py | Python | mit | 653 | 0 |
from Foundation import *
from AppKit import *
class FileSettings(NSObject):
fsdefault_py = None
fsdefault_pyw = None
fsdefault_pyc = None
default_py = None
default_pyw = None
default_pyc = None
factorySettings = None
prefskey = None
settings = None
def getFactorySettingsForFile... | albertz/music-player | mac/pyobjc-framework-Cocoa/Examples/AppKit/PyObjCLauncher/FileSettings.py | Python | bsd-2-clause | 6,020 | 0.001495 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | pivonroll/Qt_Creator | tests/system/shared/classes.py | Python | gpl-3.0 | 7,863 | 0.004324 |
from jobber import jobber
from redis import Redis
client = Redis()
progress = jobber.JobProgress(client=client)
progress.run()
| tomlepaine/jobber | jobber/scripts/progress.py | Python | bsd-3-clause | 130 | 0 |
#!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from utils import utils, inspector
# http://www.usda.gov/oig/rptsaudits.htm
archive = 1978
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
# - Some reports have li... | divergentdave/inspectors-general | inspectors/agriculture.py | Python | cc0-1.0 | 11,641 | 0.007559 |
import django
from django.utils.six.moves.urllib import parse
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from django.contrib.auth import signals as auth_signals, REDIRECT_FIELD_NAME
from django.contrib.auth.forms import AuthenticationForm
from django.test import Tr... | PaesslerAG/django-act-as-auth | tests/testapp/tests.py | Python | bsd-3-clause | 17,168 | 0 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | lukecwik/incubator-beam | sdks/python/apache_beam/utils/annotations.py | Python | apache-2.0 | 5,756 | 0.003648 |
import MySQLdb
class DatabaseHandler:
def __init__(self):
pass
def is_delete(self, tableName):
reservedTableNameList = ["mantis_user_table", "mantis_tokens_table", "mantis_config_table"]
isDeleteFlag = 1
for name in reservedTableNameList:
isIdentical = cmp(tab... | ezScrum/ezScrum | robotTesting/keywords/lib/DatabaseHandler.py | Python | gpl-2.0 | 1,547 | 0.007111 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-07-27 13:08
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comments', '0003_auto_20170726_1348'),
]
operations = [
migrations.AlterField(
... | Bugheist/website | comments/migrations/0004_auto_20170727_1308.py | Python | agpl-3.0 | 559 | 0.001789 |
import flask; from flask import request
import os
import urllib.parse
from voussoirkit import flasktools
from voussoirkit import gentools
from voussoirkit import stringtools
import etiquette
from .. import common
site = common.site
session_manager = common.session_manager
# Individual albums ######################... | voussoir/etiquette | frontends/etiquette_flask/backend/endpoints/album_endpoints.py | Python | bsd-2-clause | 9,106 | 0.003075 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-talent | samples/generated_samples/jobs_v4beta1_generated_profile_service_delete_profile_sync.py | Python | apache-2.0 | 1,401 | 0.000714 |
# coding=utf-8
"""Test configuration of toolbox."""
import importlib
import os
import pytest
from snntoolbox.bin.utils import update_setup
from snntoolbox.utils.utils import import_configparser
with open(os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..', 'req... | NeuromorphicProcessorProject/snn_toolbox | tests/core/test_config.py | Python | mit | 1,363 | 0 |
"""Assertions related to event validation"""
import json
import pprint
import six
def assert_event_matches(expected, actual, tolerate=None):
"""
Compare two event dictionaries.
Fail if any discrepancies exist, and output the list of all discrepancies. The intent is to produce clearer
error messages... | edx-solutions/edx-platform | openedx/core/lib/tests/assertions/events.py | Python | agpl-3.0 | 9,836 | 0.004778 |
# Copyright 2015 Peter van Zetten
#
# This file is part of pypkgmirror.
#
# pypkgmirror 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.... | Zetten/pypkgmirror | pypkgmirror/__init__.py | Python | gpl-3.0 | 3,339 | 0.000898 |
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
from gi.repository import Gtk
import os
import... | elbeardmorez/quodlibet | quodlibet/tests/test_library_libraries.py | Python | gpl-2.0 | 24,563 | 0.000366 |
# $Id: stp.py 23 2006-11-08 15:45:33Z dugsong $
# -*- coding: utf-8 -*-
"""Spanning Tree Protocol."""
import dpkt
class STP(dpkt.Packet):
__hdr__ = (
('proto_id', 'H', 0),
('v', 'B', 0),
('type', 'B', 0),
('flags', 'B', 0),
('root_id', '8s', ''),
('root_path', 'I',... | lkash/test | dpkt/stp.py | Python | bsd-3-clause | 1,695 | 0.00059 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your ... | ofer43211/unisubs | apps/comments/__init__.py | Python | agpl-3.0 | 763 | 0.006553 |
# 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... | stackforge/solum | solum/api/controllers/v1/component.py | Python | apache-2.0 | 4,074 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Auther: Xiaowei Deng
#
# This file is part of Mini Proxy Pool
#
# This program is free software and it is distributed under
# the terms of the MIT license. Please see LICENSE file for details.
PROXY_DB_FILE = "_proxies.db"
VALIDATOR_TIMEOUT = 1 # seconds
... | xwdeng/MiniProxyPool | miniproxypool/config.py | Python | mit | 2,154 | 0.011142 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import socket
import traceback
from lineup.datastructures import Queue
class Node(object):
def __init__(self, *args, **kw):
self.initialize(*args, **kw)
def initialize(self, *args, **kw):
pass
... | pombredanne/lineup | lineup/framework.py | Python | mit | 1,964 | 0.000509 |
# -*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
CSRF_ENABLED = True
SECRET_KEY = 'UsTd+_P&kv#jdQ!3Oc.Kb$yd,ey/B2i-aM8em'
SITE_NAME = 'basilinna'
MYSQL_DB = 'basilinna'
MYSQL_USER = 'root'
MYSQL_PASSWD = 'root'
MYSQL_HOST = 'localhost'
MYSQL_POST = 3306
basedir = os.path.abspa... | allotory/basilinna | config.py | Python | mit | 850 | 0.002353 |
from . import audio
import pytest
import re
@pytest.mark.parametrize('input,expected', [
('http://foo.bar https://bar.foo',
('http://foo.bar', 'https://bar.foo', None)),
('http://test.foo',
('http://test.foo', None, None)),
('https://test.foo',
('https://test.foo', None, None)),
... | 2015fallhw/cdw11 | static/plugin/liquid_tags/test_audio.py | Python | agpl-3.0 | 1,494 | 0 |
from flask.ext.wtf import Form
from wtforms import StringField, BooleanField, TextAreaField
from wtforms.validators import DataRequired, Length
from app.models import User
class LoginForm(Form):
openid = StringField('openid', validators=[DataRequired()])
remember_me = BooleanField('remember_me', default=False)... | hei-hilman/microblog | app/forms.py | Python | bsd-3-clause | 1,059 | 0.004721 |
#!/usr/bin/env python
import psutil
def main():
for proc in psutil.process_iter():
if any(name in proc.name() for name in ['start_producer', 'start_converter', 'start_online']) or any(name in ''.join(proc.cmdline()) for name in ['start_producer', 'start_converter', 'start_online']):
proc.kill(... | SiLab-Bonn/online_monitor | online_monitor/stop_online_monitor.py | Python | mit | 362 | 0.002762 |
#!/usr/bin/env python
import rospy
import actionlib
from play_motion_msgs.msg import PlayMotionAction, PlayMotionGoal
from sensor_msgs.msg import JointState
if __name__ == "__main__":
rospy.init_node("grasp_demo")
rospy.loginfo("Waiting for play_motion...")
client = actionlib.SimpleActionClient("/play_motion", ... | robosafe/mc-vs-bdi | tiago_simulator/scripts/grasp_demo.py | Python | gpl-3.0 | 1,252 | 0.023962 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | moto-timo/robotframework | src/robot/running/timeouts/__init__.py | Python | apache-2.0 | 3,987 | 0.000251 |
import numpy as np
# for the double bounded trafo
def i2e(v, u, l):
return l + 0.5 * (u - l) * (np.sin(v) + 1)
def e2i(v, u, l, eps2):
piby2 = 2. * np.arctan(1.)
distnn = 8. * np.sqrt(eps2)
vlimhi = piby2 - distnn
vlimlo = -piby2 + distnn
yy = 2. * (v - l) / (u - l) - 1.
yy2 = yy * yy
... | roofit-dev/parallel-roofit-scripts | int2ext_precision_solution.py | Python | apache-2.0 | 1,674 | 0.001792 |
# Lint as: python3
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | google/tf-quant-finance | tf_quant_finance/models/legacy/brownian_motion.py | Python | apache-2.0 | 19,227 | 0.003173 |
"""Supporting definitions for the Python regression tests."""
if __name__ != 'test.test_support':
raise ImportError, 'test_support must be imported from the test package'
import sys
class Error(Exception):
"""Base class for regression test exceptions."""
class TestFailed(Error):
"""Test failed."""
clas... | certik/pyjamas | pgen/test_support.py | Python | apache-2.0 | 18,242 | 0.003728 |
# -*- coding: utf-8 -*-
#
# pygeocodio documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 22 14:09:09 2014.
#
# 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.
#
... | bennylope/pygeocodio | docs/conf.py | Python | bsd-3-clause | 8,264 | 0.000242 |
###############################
# This file is part of PyLaDa.
#
# Copyright (C) 2013 National Renewable Energy Lab
#
# PyLaDa is a high throughput computational platform for Physics. It aims to
# make it easier to submit large numbers of jobs on supercomputers. It
# provides a python interface to physical input, ... | pylada/pylada-light | tests/ipython/conftest.py | Python | gpl-3.0 | 2,390 | 0.000837 |
'''
Wireshark Analyzer(s)
@author: Michael Eddington
@version: $Id$
'''
#
# Copyright (c) Michael Eddington
#
# 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... | thecrackofdawn/Peach2.3 | Peach/Analyzers/shark.py | Python | mit | 32,258 | 0.048112 |
# pdteco.py
# A public-domain Python implementation of the core commands of TECO.
# This code is released to the public domain.
# "Share and enjoy....." ;)
#
# *** To do...... ***
# NOTE - the built-in functions f.tell() and f.seek() should be very
# useful.
# From the Python docs -
# f.tell() ... | mooseman/pdteco | pdteco.py | Python | unlicense | 6,753 | 0.041636 |
# Copyright 2021 The Waymo Open Dataset 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... | waymo-research/waymo-open-dataset | waymo_open_dataset/metrics/ops/motion_metrics_ops_test.py | Python | apache-2.0 | 13,287 | 0.001806 |
"""
sidewalk.exceptions
This module contains custom exceptions that can be thrown by Sidewalk.
:copyright: (c) 2013 by Blake Rohde.
:license: ISC, see LICENSE for more details.
"""
class SidewalkSettingsFileIOError(Exception):
"""Settings file IOError."""
def __init__(self, filename, permission):
self.filenam... | blakerohde/sidewalk | sidewalk/core/exceptions.py | Python | isc | 1,924 | 0.04262 |
import gtk
import pygtk
import pexpect
import gio
import commands
import gobject
class RemoteMounter:
def login_remote(self, host, port, username, password):
'''
Mount the remote file system and update the remote file
chooser to the corresponding location.
Any remote filesystem, previously mounted by the ... | viswanathgs/EratoSCP | src/mountremote.py | Python | gpl-3.0 | 2,361 | 0.034307 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This python module defines a wrapper for synthesising spectra using TurboSpectrum.
"""
import logging
from numpy import RankWarning
from warnings import simplefilter
from .turbospectrum import TurboSpectrum
from .solar_abundances import solar_abundances
__version__... | dcf21/4most-4gp | src/pythonModules/fourgp_specsynth/fourgp_specsynth/__init__.py | Python | mit | 666 | 0.001502 |
# -*- coding: utf-8 -*-
"""py.test fixtures for kuma.wiki.tests."""
import base64
import json
from collections import namedtuple
from datetime import datetime
import pytest
from django.contrib.auth.models import Permission
from waffle.testutils import override_flag
from ..models import Document, DocumentDeletionLog, ... | SphinxKnight/kuma | kuma/wiki/tests/conftest.py | Python | mpl-2.0 | 11,242 | 0.000089 |
import numpy as np
from bokeh.plotting import figure, show, output_file
from bokeh.models import TapTool
xx, yy = np.meshgrid(range(0,101,4), range(0,101,4))
x = xx.flatten()
y = yy.flatten()
N = len(x)
inds = [str(i) for i in np.arange(N)]
radii = np.random.random(size=N)*0.4 + 1.7
colors = [
"#%02x%02x%02x" % (... | percyfal/bokeh | examples/plotting/file/tap.py | Python | bsd-3-clause | 898 | 0.005568 |
import ssadata
# how many boys names are also girls names?
# implementation details:
# find all names in the boys data set that are
# also keys in the girls data set.
num_shared_names = 0
for name in ssadata.boys:
if name in ssadata.girls:
num_shared_names = num_shared_names + 1
print(str(num_shared_... | guyrt/teaching | 2017/Com597I/babynames/problem8.py | Python | mit | 607 | 0.003295 |
from __future__ import unicode_literals
import httplib
import wac
class BalancedError(Exception):
def __str__(self):
attrs = ', '.join([
'{0}={1}'.format(k, repr(v))
for k, v in self.__dict__.iteritems()
])
return '{0}({1})'.format(self.__class__.__name__, attrs)... | balanced/balanced-python | balanced/exc.py | Python | mit | 2,557 | 0.000391 |
#! /usr/bin/env python
class myclass:
"zx class"
i = 11111
def f(self):
return 'hw'
def pi(self):
print "pi i={0}".format(self.i)
def si(self, v):
self.i = v
def pp(self):
print 'pp',
self.pi()
x = myclass()
x.f()
x.pi()
x.si(9)
x.pi()
x.pp()
print '============================'
class newclass(mycl... | jencce/stuff | py/class.py | Python | gpl-2.0 | 693 | 0.049062 |
from __future__ import print_function
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os
import os.path as op
import glob
from copy import deepcopy
import warnings
import itertools as itt
import numpy as np
... | Odingod/mne-python | mne/io/fiff/tests/test_raw.py | Python | bsd-3-clause | 38,869 | 0 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | SHH_WT_models/SHH_WT_models_final_output_0.1_-0.1_11000/SHH_WT_models12702.py | Python | gpl-3.0 | 17,583 | 0.025081 |
# 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/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py | Python | mit | 27,117 | 0.00579 |
#!/usr/bin/env python
import rospy
from art_msgs.msg import ObjInstance, InstancesArray
import time
import sys
import random
from tf import transformations
from math import pi
def a2q(q, arr):
q.x = arr[0]
q.y = arr[1]
q.z = arr[2]
q.w = arr[3]
class FakeDetector:
def __init__(self, obj_id, fr... | robofit/artable | art_simple_tracker/scripts/fake_detector.py | Python | lgpl-2.1 | 2,036 | 0.002456 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Testing and testing related modules.
''' | vagonbar/GNUnetwork | gwn/utils/testing/__init__.py | Python | gpl-3.0 | 90 | 0.011111 |
# -*- coding: utf-8 -*-
#
from rest_framework.viewsets import ModelViewSet
from rest_framework.generics import RetrieveAPIView, ListAPIView
from django.shortcuts import get_object_or_404
from django.db.models import Q
from common.utils import get_logger, get_object_or_none
from common.mixins.api import SuggestionMixin... | jumpserver/jumpserver | apps/assets/api/asset.py | Python | gpl-3.0 | 10,108 | 0.001187 |
from elasticsearch import Elasticsearch
from django.conf import settings
def get_es_client(silent=False):
"""
Returns the elasticsearch client which uses the configuration file
"""
es_client = Elasticsearch([settings.ELASTIC_SEARCH_HOST],
scheme='http',
... | fako/datascope | src/online_discourse/elastic.py | Python | gpl-3.0 | 1,813 | 0 |
from superset import tables_cache
from flask import request
def view_cache_key(*unused_args, **unused_kwargs):
args_hash = hash(frozenset(request.args.items()))
return 'view/{}/{}'.format(request.path, args_hash)
def memoized_func(timeout=5 * 60, key=view_cache_key):
"""Use this decorator to cache funct... | asdf2014/superset | superset/cache_util.py | Python | apache-2.0 | 1,105 | 0 |
import os
import shutil
import hashlib
from collections import namedtuple, defaultdict
from calaldees.files.scan import fast_scan
ProcessedFileType = namedtuple('ProcessedFileType', ('source_hash_group', 'dict_key', 'attachment_type', 'ext', 'salt'))
class ProcessedFilesManager(object):
FILE_TYPES = (
Pr... | calaldees/KaraKara | processmedia2/processmedia_libs/processed_files_manager.py | Python | gpl-3.0 | 3,137 | 0.000638 |
import hashlib
import hmac
def hmac_sha256_digest(key, msg):
"""
Return the HMAC-SHA256 message authentication code of the message
'msg' with key 'key'.
"""
return hmac.new(key, msg, hashlib.sha256).digest()
| masterkorp/obfsproxy | obfsproxy/common/hmac_sha256.py | Python | bsd-3-clause | 230 | 0.004348 |
import pytest
from thefuck.rules.git_remote_seturl_add import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('command', [
Command('git remote set-url origin url', "fatal: No such remote")])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', ... | nvbn/thefuck | tests/rules/test_git_remote_seturl_add.py | Python | mit | 920 | 0 |
def extractMyTranslations(item):
"""
Parser for 'My Translations'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'WATTT' in item['tags']:
return buildReleaseMessageWithType(item, 'WATTT', vol, chp, frag=fr... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractMyTranslations.py | Python | bsd-3-clause | 355 | 0.028169 |
"""Dev server used for running a chalice app locally.
This is intended only for local development purposes.
"""
from __future__ import print_function
import re
import threading
import time
import uuid
import base64
import functools
import warnings
from collections import namedtuple
import json
from six.moves.BaseHTT... | awslabs/chalice | chalice/local.py | Python | apache-2.0 | 29,826 | 0 |
###########################################
# #
# cp_hand.py #
# author: irza pulungan #
# #
# this py will forward incoming MQTT #
# message to Serial USB port arduino #
# loaded wit... | irzaip/chippy | cp_hand.py | Python | lgpl-3.0 | 1,479 | 0.006085 |
#!/usr/bin/python
# Copyright 2013 Gandi SAS
#
# 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 option) any later versio... | ericgarrigues/ansible-modules-extras | cloud/gandi/gandi_iface.py | Python | gpl-3.0 | 7,326 | 0.000546 |
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rlib.rarithmetic import intmask
from hippy import consts
from hippy.error import PHPException
from hippy.builtin import wrap_method, ThisUnwrapper, StringArg
from hippy.builtin_klass import GetterSetterWrapper, k_Exception
from hippy.klass import def_cl... | ericpp/hippyvm | hippy/module/date/dateinterval_klass.py | Python | mit | 9,931 | 0.003927 |
# -*- coding: utf-8 -*-
r'''This module contains a base class for modeling computation graphs.'''
import downhill
import gzip
import hashlib
import numpy as np
import pickle
import theano
import time
import warnings
from . import layers
from . import losses
from . import regularizers
from . import trainer
from . imp... | lmjohns3/theanets | theanets/graph.py | Python | mit | 28,912 | 0.001349 |
# 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/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_container_registry_management_client.py | Python | mit | 6,266 | 0.003671 |
#from apetools.commands.ifconfig import IfconfigCommand
#from apetools.commands.iwconfig import Iwconfig
from apetools.commons.enumerations import OperatingSystem
from apetools.devices.basedevice import BaseDevice
from apetools.commons.errors import ConfigurationError
class IosDevice(BaseDevice):
"""
A class... | rsnakamura/oldape | apetools/devices/iosdevice.py | Python | apache-2.0 | 3,060 | 0.003922 |
#
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
#
from __future__ import print_function
import errno
import logging
import os
import pickle
import shutil
import sys
import tempfile
import textwrap
import six
from ipalib.install import certmonger, sysrestore
from ipapython import ipautil
from ip... | apophys/freeipa | ipaserver/install/server/install.py | Python | gpl-3.0 | 44,536 | 0.000135 |
# Tai Sakuma <tai.sakuma@gmail.com>
import numbers
##__________________________________________________________________||
def cmp_obj_list_almost_equal(list1, list2, rtol=1e-05, atol=1e-08):
if not len(list1) == len(list2):
return False
for obj1, obj2 in zip(list1, list2):
if not cmp_obj_almost... | TaiSakuma/scribblers | tests/compare_obj.py | Python | bsd-3-clause | 1,134 | 0.003527 |
# Copyright 2009-2012 10gen, 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 writing,... | edisonlz/fruit | web_project/base/site-packages/gridfs/__init__.py | Python | apache-2.0 | 11,413 | 0 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | xuweiliang/Codelibrary | openstack_dashboard/dashboards/admin/overview/views.py | Python | apache-2.0 | 3,126 | 0.00032 |
import os
from unittest import TestCase
from cookiejar.client import CookiejarClient
class ClientTests(TestCase):
maxDiff = None
def test_pagination(self):
index = os.path.join((os.path.dirname(os.path.abspath(__file__))), 'index.1.json')
client = CookiejarClient(index=index)
... | fcurella/cookiejar | tests/test_client.py | Python | mit | 2,942 | 0.004079 |
'''
Copyright (c) 2015, Salesforce.com, Inc.
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 conditions and the foll... | SalesforceEng/Providence | providence.py | Python | bsd-3-clause | 10,230 | 0.006158 |
#!/usr/bin/python
##--Michael duPont (flyinactor91.com)
##--Display increasing values on the seven-segment display
from Adafruit_7Segment import SevenSegment
import time
segment = SevenSegment(address=0x70)
num = 0
rest = float(raw_input('Step: '))
while True:
segment.setColon((num / 10000)%2)
segment.writeDigit(0... | flyinactor91/Raspi-Hardware | 7Segment/Counter.py | Python | mit | 481 | 0.035343 |
import subprocess
import pandas as pd
import tempfile
import os
__all__ = ['runRscript']
def runRscript(Rcmd, inDf=None, outputFiles=0, removeTempFiles=None):
"""Runs an R cmd with option to provide a DataFrame as input and file
as output.
Params
------
Rcmd : str
String containing the R-... | agartland/utils | .ipynb_checkpoints/quickr-checkpoint.py | Python | mit | 5,563 | 0.007011 |
import unittest
from google.appengine.api import mail
from google.appengine.ext import testbed
class MailTestCase(unittest.TestCase):
def setUp(self):
self.testbed = testbed.Testbed()
self.testbed.activate()
self.testbed.init_mail_stub()
self.mail_stub = self.testbed.get_stub(tes... | ioGrow/iogrowCRM | crm/tests/test_mail.py | Python | agpl-3.0 | 811 | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2008 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the multi project management functionality.
"""
from __future__ import unicode_literals
import os
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QFileInfo, QFile, \
QIODevice, QObject
f... | davy39/eric | MultiProject/MultiProject.py | Python | gpl-3.0 | 32,000 | 0.004 |
import json, time
import glob
import timer
from utils import *
class Item(object):
__slots__ = ( 'type', 'cbid', 'dbid', 'wfid', 'step', 'when', 'meta', 'body', 'repo', 'path', 'size', 'id' )
def __init__( self, obj={}, **kwargs ):
# Three situations: Network streamed data (obj), Database data (obj), Newly create... | nkremerh/cctools | prune/src/prune/class_item.py | Python | gpl-2.0 | 6,649 | 0.048428 |
"""
XX. Generating HTML forms from models
This is mostly just a reworking of the ``form_for_model``/``form_for_instance``
tests to use ``ModelForm``. As such, the text may not make sense in all cases,
and the examples are probably a poor fit for the ``ModelForm`` syntax. In other
words, most of these tests should be r... | h4r5h1t/django-hauthy | tests/model_forms/models.py | Python | bsd-3-clause | 12,503 | 0.00192 |
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from pypom import Region
from selenium.webdriver.common.by import By
from pages.base_page import ... | Tayamarn/socorro | e2e-tests/pages/crash_report_page.py | Python | mpl-2.0 | 2,049 | 0.00244 |
'''
Copyright 2015 - 2018 University College London.
This file is part of Nammu.
Nammu 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.
Nam... | oracc/nammu | python/nammu/test/test_yaml_update.py | Python | gpl-3.0 | 2,813 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Eike Frost <ei@kefro.st>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1... | resmo/ansible | lib/ansible/modules/identity/keycloak/keycloak_client.py | Python | gpl-3.0 | 33,175 | 0.003044 |
# maximum number of letters(ignoring spaces and duplicates) if tie choose alphabetical order.
# import sys
# text = "".join(sys.stdin.readlines())
# name_list = text.split("\n")
inputList = ["kylan charles", "raymond strickland", "julissa shepard", "andrea meza", "destiny alvarado"]
inputList2 = ["maria garcia", "smit... | saisankargochhayat/algo_quest | Company-Based/SAP/social_sabatical_name.py | Python | apache-2.0 | 938 | 0.007463 |
import os
from spinspy import local_data
def isdim(dim):
if os.path.isfile('{0:s}{1:s}grid'.format(local_data.path,dim)):
return True
else:
return False
| bastorer/SPINSpy | spinspy/isdim.py | Python | mit | 178 | 0.011236 |
from django.db.models import Q
from links.models import Post
from comments.models import ThreadedComment as comments
from django.utils import timezone
from datetime import datetime, timedelta
from django.contrib import messages
KARMA_LOW = 100
KARMA_MEDIUM = 1000
KARMA_HIGH = 5000
INTERVAL_LOW = 3600
INTERVAL_MEDIUM... | sheshkovsky/jaryan | links/utils.py | Python | apache-2.0 | 1,792 | 0.029576 |
from decimal import Decimal
from customers.models import Customer
from django.contrib import auth
from products.models import *
from django_quickblocks.models import *
import re
from smartmin.views import *
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django... | nyaruka/motome | motome/public/views.py | Python | bsd-3-clause | 11,780 | 0.005772 |
import os
import subprocess
import yaml
from django.views.generic import View
from django.views.generic.base import TemplateView
from django.views.generic.edit import FormView
from django.core.urlresolvers import reverse
from django.core import serializers
from django.conf import settings
from django.template.loader i... | Havate/havate-openstack | proto-build/gui/horizon/openstack-dashboard/config/views.py | Python | apache-2.0 | 15,052 | 0.007109 |
"""Suite CodeWarrior suite: Terms for scripting the CodeWarrior IDE
Level 0, version 0
Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5
AETE/AEUT resource version 1/0, language 0, script 0
"""
import aetools
import MacOS
_code = 'CWIE'
class... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.3/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py | Python | mit | 23,097 | 0.012296 |
#! /usr/bin/env python
#edited on c9
import os
import array as array
import sys
if (len(sys.argv)==1):
print "usage >>seqCheck.py [fileRootName, path ('.') for cwd]"
sys.exit()
elif (len(sys.argv)==2):
fileRootName = sys.argv[1]
rootpath = os.getcwd()
elif (len(sys.argv)==3):
fileRootName = sys.a... | bkonersman/utils | seqCheck.py | Python | artistic-2.0 | 1,631 | 0.010423 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.