text stringlengths 0 1.05M | meta dict |
|---|---|
"""Auto NAT Rules class."""
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
from .ftdnatpolicies import FTDNatPolicies
from fmcapi.api_objects.object_services.networkaddresses import NetworkAddresses
from fmcapi.api_objects.object_services.interfaceobjects import InterfaceObjects
from fmcapi.api_objec... | {
"repo_name": "daxm/fmcapi",
"path": "fmcapi/api_objects/policy_services/autonatrules.py",
"copies": "1",
"size": "9646",
"license": "bsd-3-clause",
"hash": -830776855915894900,
"line_mean": 35.9578544061,
"line_max": 106,
"alpha_frac": 0.5546340452,
"autogenerated": false,
"ratio": 4.23441615452... |
#! /auton/home/lxiong/local/bin/python
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
print 'Pyplot backend:', plt.get_backend()
import smtplib
from email.mime.text import MIMEText
def SendNotice(title, msg):
sender = 'auton.sdss@gmail.edu'
receiver = 'excelly@gmail.com'
msg = MI... | {
"repo_name": "excelly/xpy-ml",
"path": "sdss_iii/fetch_batch.py",
"copies": "1",
"size": "3265",
"license": "apache-2.0",
"hash": -455475840790510800,
"line_mean": 30.3942307692,
"line_max": 98,
"alpha_frac": 0.6468606432,
"autogenerated": false,
"ratio": 3.0343866171003717,
"config_test": fal... |
"""Autonomous control client that solves IEEE Hardware Competition 2014.
UPDATE (Vijay - 9/27/15): Pilot does not work since the last year's
code has been erased. This file is here for reference and is expected to
be modified for IEEE Hardware Competition 2016.
Please do not instantiate Pilot before it is fixed.
"""
... | {
"repo_name": "deepakiam/bot",
"path": "bot/pilot.py",
"copies": "2",
"size": "5902",
"license": "bsd-2-clause",
"hash": -8437349818062702000,
"line_mean": 30.5614973262,
"line_max": 75,
"alpha_frac": 0.5496441884,
"autogenerated": false,
"ratio": 3.971736204576043,
"config_test": false,
"has... |
"""Autonomous control client that solves IEEE Hardware Competition 2016.
"""
import sys
import time
import lib.lib as lib
import client.ctrl_client as ctrl_client_mod
import client.sub_client as sub_client_mod
class Pilot:
"""Autonomous control client based on comprehensive state machine."""
def __init__(... | {
"repo_name": "IEEERobotics/bot",
"path": "bot/pilot.py",
"copies": "1",
"size": "6040",
"license": "bsd-2-clause",
"hash": 5555028235078735000,
"line_mean": 30.7894736842,
"line_max": 76,
"alpha_frac": 0.5062913907,
"autogenerated": false,
"ratio": 3.8276299112801015,
"config_test": false,
"... |
# AUTO_PATCH=True python test_backoff.py
import collections
import math
from context import Meta
meta = Meta(globals=globals())
# @meta("get most frequent character from string")
# def get_most_frequent_character(string):
# if string == "": return None
# return collections.Counter(string).most_common(1)[0]
#
... | {
"repo_name": "Ejhfast/meta",
"path": "test/test_backoff.py",
"copies": "1",
"size": "1592",
"license": "mit",
"hash": -1651171297761444900,
"line_mean": 27.9454545455,
"line_max": 101,
"alpha_frac": 0.7129396985,
"autogenerated": false,
"ratio": 2.7353951890034365,
"config_test": false,
"has... |
""" autopilotpattern/mysql ContainerPilot handlers """
from __future__ import print_function
from datetime import datetime
import os
import socket
import subprocess
import sys
# pylint: disable=invalid-name,no-self-use,dangerous-default-value
from manager.client import MySQL, MySQLError
from manager.config import Cont... | {
"repo_name": "tgross/triton-mysql",
"path": "bin/manage.py",
"copies": "2",
"size": "16044",
"license": "mpl-2.0",
"hash": 7008070520216381000,
"line_mean": 37.109263658,
"line_max": 84,
"alpha_frac": 0.6168661182,
"autogenerated": false,
"ratio": 4.044366019662213,
"config_test": false,
"ha... |
"""autoplot ya'll"""
import calendar
import datetime
from pandas.io.sql import read_sql
import pandas as pd
from pyiem.plot.use_agg import plt
from pyiem.util import get_autoplot_context, get_dbconn, convert_value
from pyiem.exceptions import NoDataFound
UNITS = {"mph": "miles per hour", "kt": "knots", "mps": "meters... | {
"repo_name": "akrherz/iem",
"path": "htdocs/plotting/auto/scripts100/p173.py",
"copies": "1",
"size": "8916",
"license": "mit",
"hash": -7490355532473832000,
"line_mean": 27.6688102894,
"line_max": 77,
"alpha_frac": 0.4705024675,
"autogenerated": false,
"ratio": 3.5850422195416165,
"config_tes... |
"""autopush/autoendpoint daemon scripts"""
import os
from argparse import Namespace # noqa
from twisted.application.internet import (
TCPServer,
TimerService,
SSLServer,
StreamServerEndpointService,
)
from twisted.application.service import MultiService
from twisted.internet import reactor
from twiste... | {
"repo_name": "mozilla-services/autopush",
"path": "autopush/main.py",
"copies": "1",
"size": "10560",
"license": "mpl-2.0",
"hash": 3030786306505043500,
"line_mean": 33.3973941368,
"line_max": 76,
"alpha_frac": 0.6339015152,
"autogenerated": false,
"ratio": 3.9654524971836276,
"config_test": t... |
"""Autopush Exceptions"""
class AutopushException(Exception):
"""Parent Autopush Exception"""
class InvalidTokenException(Exception):
"""Invalid URL token Exception"""
class InvalidRequest(AutopushException):
"""Invalid request exception, may include custom status_code and message
to write for the... | {
"repo_name": "mozilla-services/autopush",
"path": "autopush/exceptions.py",
"copies": "1",
"size": "1934",
"license": "mpl-2.0",
"hash": -6178858587223419000,
"line_mean": 26.6285714286,
"line_max": 76,
"alpha_frac": 0.6778697001,
"autogenerated": false,
"ratio": 4.346067415730337,
"config_tes... |
""" AutoQuoteTransformer: IPython Transformer so we can shortcut
Workbench commands by using 'auto-quotes' """
import re
from IPython.core.prefilter import PrefilterTransformer
# Helper Classes
class AutoQuoteTransformer(PrefilterTransformer):
""" AutoQuoteTransformer: IPython Transformer so we can shortcut
... | {
"repo_name": "djtotten/workbench",
"path": "workbench_apps/workbench_cli/auto_quote_xform.py",
"copies": "2",
"size": "3227",
"license": "mit",
"hash": 2457609754958240000,
"line_mean": 40.3717948718,
"line_max": 92,
"alpha_frac": 0.5841338705,
"autogenerated": false,
"ratio": 4.246052631578947,... |
# Autor: Abdel G. Martinez L.
#
# Instrucciones: Explicacion de herencia
class Padre(object): # define clase Padre
# Atributo publico y privado, respectivamente
atributoPadre = 100
__contador = 0
# Constructor
def __init__(self):
print("Llamando al constructor del padre")
# Metodos publicos
... | {
"repo_name": "ampotty/uip-pc3",
"path": "Ejemplos/ejemplo05.py",
"copies": "1",
"size": "1408",
"license": "mit",
"hash": 5886244655060397000,
"line_mean": 27.16,
"line_max": 66,
"alpha_frac": 0.6427556818,
"autogenerated": false,
"ratio": 2.9456066945606696,
"config_test": false,
"has_no_ke... |
# Autor: Abdel G. Martinez L.
#
# Instrucciones: Simular un cliente de un banco
class Cliente(object):
"""
Representacion de un cliente del Banco ABC con una
cuenta de ahorros.
Atributos:
nombre: Una cadena que representa el nombre del cliente
balance: Un flotante que lleva registro de... | {
"repo_name": "ampotty/uip-pc3",
"path": "Ejemplos/ejemplo06b.py",
"copies": "1",
"size": "1078",
"license": "mit",
"hash": 4861510941168037000,
"line_mean": 28.9444444444,
"line_max": 69,
"alpha_frac": 0.6437847866,
"autogenerated": false,
"ratio": 3.488673139158576,
"config_test": false,
"h... |
# Autor: Abdel G. Martinez L.
#
# Instrucciones: Simular un directorio telefonico
def imprimirNumero(numeros):
print("Numeros Telefonicos:")
for k, v in numeros.items():
print("Nombre:", k, "\tNumero:", v)
print()
def agregarNumero(numeros, nombre, numero):
numeros[nombre] = numero
def buscar... | {
"repo_name": "ampotty/uip-pc3",
"path": "Ejemplos/ejemplo04.py",
"copies": "1",
"size": "2774",
"license": "mit",
"hash": 7347741384166995000,
"line_mean": 29.8222222222,
"line_max": 67,
"alpha_frac": 0.5493871665,
"autogenerated": false,
"ratio": 3.2482435597189694,
"config_test": false,
"h... |
# Autor: Alexander Herbrich
# Wann: 03.02.2016
# Thema: Hangman
from random import *
import time
import sys
Hangman_Pics = ["""
============== """ , """
|
|
|
|
|
============== """ , """
+====+
|
... | {
"repo_name": "phy234/FirstPythonSteps",
"path": "Hangman.py",
"copies": "2",
"size": "5007",
"license": "apache-2.0",
"hash": -8669121962595200000,
"line_mean": 23.4292682927,
"line_max": 110,
"alpha_frac": 0.447972838,
"autogenerated": false,
"ratio": 2.964476021314387,
"config_test": false,
... |
# Autor: Alexander Herbrich
# Wann: 03.02.2016
# Thema: Programm zum loesen des magischen Quadrats erstellen
def quadrat():
# DIESES PRORAMM ENTHAELT NOCH FEHLER!!!!!
# A + B + C = S
# D + M + d = S
# a + b + c = S
# A + D + a = S
# B + M + b = S
# C + d + c = S
# A + M + c = S
# C + M + a =... | {
"repo_name": "phy234/FirstPythonSteps",
"path": "Quadrat.py",
"copies": "2",
"size": "2362",
"license": "apache-2.0",
"hash": 7957603904105683000,
"line_mean": 32.2676056338,
"line_max": 137,
"alpha_frac": 0.3247248095,
"autogenerated": false,
"ratio": 2.578602620087336,
"config_test": false,
... |
# Autor: Alexander Herbrich
# Wann: 09.02.16
# Thema: Turtle "Haus vom Nicolaus"
from turtle import *
def nicolaus ():
a = 1
i = 3
x = 0
pencolor("white")
lt(180)
fd(220)
rt(90)
fd(60)
rt(90)
pencolor("red")
lt(90)
fd(140)
lt(30)
fd(140)
lt(120)
fd(140)
... | {
"repo_name": "phy234/FirstTurtleSteps",
"path": "Nicolaus.py",
"copies": "3",
"size": "1854",
"license": "apache-2.0",
"hash": 3927290927298157600,
"line_mean": 16.6571428571,
"line_max": 35,
"alpha_frac": 0.3133764833,
"autogenerated": false,
"ratio": 3.4269870609981514,
"config_test": false,... |
# Autor: Alexander Herbrich
# Wann: 10.02.16
# Thema: Turtle "Honeycomb"
from turtle import *
from math import sqrt
# ========================
# = Draws a single petal =
# ========================
def drawFlower(a="orange", b="brown", penSize=2.5, size=80, rightTurn=False):
color(b,a)
pensize(penSize)
be... | {
"repo_name": "phy234/FirstTurtleSteps",
"path": "Honeycomb.py",
"copies": "1",
"size": "2249",
"license": "apache-2.0",
"hash": 5014670414333353000,
"line_mean": 21.9591836735,
"line_max": 77,
"alpha_frac": 0.6047132059,
"autogenerated": false,
"ratio": 2.603009259259259,
"config_test": false,... |
import os
import signal
import subprocess
import sys
import time
import traceback
import _thread
from django.apps import apps
from django.conf import settings
from django.core.signals import request_finished
# This import does nothing, but it's necessary to avoid some race conditions
# in the threading module. See ... | {
"repo_name": "frankvdp/django",
"path": "django/utils/autoreload.py",
"copies": "7",
"size": "10553",
"license": "bsd-3-clause",
"hash": -964556934877811700,
"line_mean": 31.6718266254,
"line_max": 84,
"alpha_frac": 0.6212451436,
"autogenerated": false,
"ratio": 4.130332681017612,
"config_test... |
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
# Adjustments made by Michael Elsdoerfer (michael@elsdoerfer.com).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights res... | {
"repo_name": "gregarmer/trunserver",
"path": "trunserv/autoreload.py",
"copies": "3",
"size": "5239",
"license": "mit",
"hash": 624409894048403600,
"line_mean": 36.1560283688,
"line_max": 107,
"alpha_frac": 0.6531780874,
"autogenerated": false,
"ratio": 4.020721412125863,
"config_test": false,... |
import os
import signal
import sys
try:
import termios
except ImportError:
termios = None
USE_INOTIFY = False
try:
# Test whether inotify is enabled and likely to work
import pyinotify
fd = pyinotify.INotifyWrapper.create().inotify_init()
if fd >= 0:
USE_INOTIFY = True
os.clo... | {
"repo_name": "dejlek/pulsar",
"path": "pulsar/utils/autoreload.py",
"copies": "1",
"size": "5308",
"license": "bsd-3-clause",
"hash": -1035936667822684400,
"line_mean": 27.385026738,
"line_max": 79,
"alpha_frac": 0.5776186888,
"autogenerated": false,
"ratio": 3.928941524796447,
"config_test": ... |
# Avoid importing `importlib` from this package.
from __future__ import absolute_import
import os
import signal
import sys
import time
import traceback
from django.apps import apps
from django.conf import settings
from django.core.signals import request_finished
from django.utils.six.moves import _thread as thread
... | {
"repo_name": "abhattad4/Digi-Menu",
"path": "build/lib.linux-x86_64-2.7/django/utils/autoreload.py",
"copies": "37",
"size": "10655",
"license": "bsd-3-clause",
"hash": -4729660780055338000,
"line_mean": 31.9876160991,
"line_max": 84,
"alpha_frac": 0.6265603003,
"autogenerated": false,
"ratio": ... |
from __future__ import absolute_import # Avoid importing `importlib` from this package.
import os
import signal
import sys
import time
import traceback
from django.apps import apps
from django.conf import settings
from django.core.signals import request_finished
try:
from django.utils.six.moves import _thread a... | {
"repo_name": "aleksandra-tarkowska/django",
"path": "django/utils/autoreload.py",
"copies": "1",
"size": "9737",
"license": "bsd-3-clause",
"hash": 4258835625471432000,
"line_mean": 31.8952702703,
"line_max": 88,
"alpha_frac": 0.6250385129,
"autogenerated": false,
"ratio": 4.1346072186836516,
... |
from __future__ import absolute_import # Avoid importing `importlib` from this package.
import os
import signal
import sys
import time
import traceback
from django.conf import settings
from django.core.signals import request_finished
from django.utils._os import upath
from importlib import import_module
try:
fr... | {
"repo_name": "AlexHill/django",
"path": "django/utils/autoreload.py",
"copies": "1",
"size": "8810",
"license": "bsd-3-clause",
"hash": -1450174887050607600,
"line_mean": 31.6296296296,
"line_max": 88,
"alpha_frac": 0.61861521,
"autogenerated": false,
"ratio": 4.132270168855535,
"config_test":... |
import os
import signal
import subprocess
import sys
import time
import traceback
from contextlib import suppress
import _thread
from django.apps import apps
from django.conf import settings
from django.core.signals import request_finished
# This import does nothing, but it's necessary to avoid some race conditions... | {
"repo_name": "kosz85/django",
"path": "django/utils/autoreload.py",
"copies": "9",
"size": "10665",
"license": "bsd-3-clause",
"hash": 8808618026344499000,
"line_mean": 32.2242990654,
"line_max": 84,
"alpha_frac": 0.6313173933,
"autogenerated": false,
"ratio": 4.109826589595376,
"config_test":... |
import os
import signal
import subprocess
import sys
import time
import traceback
from django.apps import apps
from django.conf import settings
from django.core.signals import request_finished
from django.utils import six
from django.utils._os import npath
from django.utils.encoding import get_system_encoding
from dj... | {
"repo_name": "cycotech/WAR-app",
"path": "env/lib/python3.5/site-packages/django/utils/autoreload.py",
"copies": "18",
"size": "11260",
"license": "mit",
"hash": 6814394423558857000,
"line_mean": 32.0205278592,
"line_max": 84,
"alpha_frac": 0.6253108348,
"autogenerated": false,
"ratio": 4.117001... |
import os
import signal
import subprocess
import sys
import time
import traceback
import _thread
from django.apps import apps
from django.conf import settings
from django.core.signals import request_finished
# This import does nothing, but it's necessary to avoid some race conditions
# in the threading module. See ... | {
"repo_name": "rlugojr/django",
"path": "django/utils/autoreload.py",
"copies": "30",
"size": "10719",
"license": "bsd-3-clause",
"hash": -8099084275153847000,
"line_mean": 31.4818181818,
"line_max": 84,
"alpha_frac": 0.6259912305,
"autogenerated": false,
"ratio": 4.114779270633397,
"config_tes... |
import os
import signal
import sys
import time
import traceback
from django.apps import apps
from django.conf import settings
from django.core.signals import request_finished
from django.utils import six
from django.utils._os import npath
from django.utils.six.moves import _thread as thread
# This import does nothin... | {
"repo_name": "kholidfu/django",
"path": "django/utils/autoreload.py",
"copies": "295",
"size": "10877",
"license": "bsd-3-clause",
"hash": 5684227616221140000,
"line_mean": 31.6636636637,
"line_max": 84,
"alpha_frac": 0.6256320677,
"autogenerated": false,
"ratio": 4.102980007544323,
"config_te... |
import os
import sys
import time
from pyll.utils import walk_ignore
try:
import thread
except ImportError:
import dummy_thread as thread
# This import does nothing, but it's necessary to avoid some race conditions
# in the threading module. See http://code.djangoproject.com/ticket/2330 .
try:
import thr... | {
"repo_name": "arthurk/pyll",
"path": "src/pyll/autoreload.py",
"copies": "1",
"size": "4804",
"license": "bsd-3-clause",
"hash": -1459164643754459000,
"line_mean": 34.0656934307,
"line_max": 82,
"alpha_frac": 0.6615320566,
"autogenerated": false,
"ratio": 4.003333333333333,
"config_test": fals... |
import os, sys, time, signal
try:
import thread
except ImportError:
import dummy_thread as thread
# This import does nothing, but it's necessary to avoid some race conditions
# in the threading module. See http://code.djangoproject.com/ticket/2330 .
try:
import threading
except ImportError:
pass
try... | {
"repo_name": "disqus/django-old",
"path": "django/utils/autoreload.py",
"copies": "3",
"size": "5045",
"license": "bsd-3-clause",
"hash": 6880237529128358000,
"line_mean": 34.780141844,
"line_max": 107,
"alpha_frac": 0.642814668,
"autogenerated": false,
"ratio": 4.042467948717949,
"config_test... |
import os, sys, time, signal, traceback
try:
from django.utils.six.moves import _thread as thread
except ImportError:
from django.utils.six.moves import _dummy_thread as thread
# This import does nothing, but it's necessary to avoid some race conditions
# in the threading module. See http://code.djangoprojec... | {
"repo_name": "yaroslavprogrammer/django",
"path": "django/utils/autoreload.py",
"copies": "109",
"size": "6239",
"license": "bsd-3-clause",
"hash": 6707021632967041000,
"line_mean": 33.2802197802,
"line_max": 82,
"alpha_frac": 0.6194903029,
"autogenerated": false,
"ratio": 4.1345261762756795,
... |
import os
import signal
import sys
try:
import termios
except ImportError:
termios = None
USE_INOTIFY = False
try:
# Test whether inotify is enabled and likely to work
import pyinotify
fd = pyinotify.INotifyWrapper.create().inotify_init()
if fd >= 0:
USE_INOTIFY = True
os.clo... | {
"repo_name": "tempbottle/pulsar",
"path": "pulsar/utils/autoreload.py",
"copies": "5",
"size": "6831",
"license": "bsd-3-clause",
"hash": -6380512369369160000,
"line_mean": 31.0704225352,
"line_max": 79,
"alpha_frac": 0.6190894452,
"autogenerated": false,
"ratio": 4.100240096038416,
"config_te... |
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
# Via Django (http://djangoproject.com)
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution a... | {
"repo_name": "cargocult/rowan-python",
"path": "rowan/utils/autoreload.py",
"copies": "1",
"size": "4301",
"license": "mit",
"hash": 5211523703195286000,
"line_mean": 32.6015625,
"line_max": 78,
"alpha_frac": 0.6614740758,
"autogenerated": false,
"ratio": 4.046095954844779,
"config_test": fals... |
# Avoid importing `importlib` from this package.
from __future__ import absolute_import
import os
import signal
import sys
import time
import traceback
from django.apps import apps
from django.conf import settings
from django.core.signals import request_finished
from django.utils.six.moves import _threa... | {
"repo_name": "diego-d5000/MisValesMd",
"path": "env/lib/python2.7/site-packages/django/utils/autoreload.py",
"copies": "1",
"size": "10978",
"license": "mit",
"hash": 5038281540485504000,
"line_mean": 31.9876160991,
"line_max": 84,
"alpha_frac": 0.6081253416,
"autogenerated": false,
"ratio": 4.1... |
import os, sys, time
try:
import thread
except ImportError:
import dummy_thread as thread
# This import does nothing, but it's necessary to avoid some race conditions
# in the threading module. See http://code.djangoproject.com/ticket/2330 .
try:
import threading
except ImportError:
pass... | {
"repo_name": "rimbalinux/LMD3",
"path": "django/utils/autoreload.py",
"copies": "3",
"size": "4398",
"license": "bsd-3-clause",
"hash": -3917041444560171000,
"line_mean": 34.9579831933,
"line_max": 107,
"alpha_frac": 0.6455206912,
"autogenerated": false,
"ratio": 4.042279411764706,
"config_tes... |
"""Autoreply viewsets."""
from django_filters import rest_framework as filters
from rest_framework import mixins, permissions, viewsets
from modoboa.admin import models as admin_models
from modoboa.lib.email_utils import split_mailbox
from . import models
from . import serializers
class ARMessageFilterSet(filters.... | {
"repo_name": "modoboa/modoboa-postfix-autoreply",
"path": "modoboa_postfix_autoreply/viewsets.py",
"copies": "1",
"size": "1854",
"license": "mit",
"hash": 9067359226519621000,
"line_mean": 32.1071428571,
"line_max": 76,
"alpha_frac": 0.6693635383,
"autogenerated": false,
"ratio": 4.074725274725... |
"""autoresizelist.py - list wrapper that automatically expands the list when
indices outside its current range are accessed """
__author__ = 'caleb'
__date__ = "2015-02-17"
class AutoResizeList:
def __init__(self, initial_data=None, fill=None):
if initial_data is None:
self._data = []
... | {
"repo_name": "calebmadrigal/algorithms-in-python",
"path": "autoresizelist.py",
"copies": "1",
"size": "1296",
"license": "mit",
"hash": -2826586549573981700,
"line_mean": 26.5744680851,
"line_max": 82,
"alpha_frac": 0.5632716049,
"autogenerated": false,
"ratio": 3.640449438202247,
"config_tes... |
#autoreturn.py
#contains handler for Paypal Autoreturn
#this is the url that paypal returns the customer to after sucessful purchase
import webapp2
from google.appengine.api import urlfetch
import os
import urllib
import urlparse
import util
import my_db
import random
import html
pdt_token = '';
PP_URL = "https://www... | {
"repo_name": "whamtet/gae-webstore",
"path": "autoreturn.py",
"copies": "1",
"size": "2291",
"license": "epl-1.0",
"hash": 6721801968409041000,
"line_mean": 29.9594594595,
"line_max": 79,
"alpha_frac": 0.6403317329,
"autogenerated": false,
"ratio": 3.7252032520325202,
"config_test": false,
"... |
import os
import os.path as osp
import PIL
from utils.cython_bbox import bbox_overlaps
import numpy as np
import scipy.sparse
import datasets
class imdb(object):
"""Image database."""
def __init__(self, name):
self._name = name
self._num_classes = 0
self._classes = []
self._im... | {
"repo_name": "jbhuang0604/WSL",
"path": "lib/datasets/imdb.py",
"copies": "1",
"size": "6943",
"license": "mit",
"hash": -2780765472534055400,
"line_mean": 34.2436548223,
"line_max": 80,
"alpha_frac": 0.5245571079,
"autogenerated": false,
"ratio": 3.819031903190319,
"config_test": false,
"ha... |
_autor_ = "Jorge R. Encinas"
import os
from time import sleep
from framework.drivers.simulator.dataVirtual import dataVirtual
from framework.drivers.driver import driver
class Ultrasonic(driver):
def __init__(self):
self.file = 'sensorUltrasonico.gpio.serial'
self.file = os.path.join(os.getcwd()... | {
"repo_name": "GeorgEncinas/backtraking",
"path": "framework/drivers/distanceSensor.py",
"copies": "1",
"size": "1330",
"license": "mit",
"hash": -5127079796304886000,
"line_mean": 29.9302325581,
"line_max": 96,
"alpha_frac": 0.6481203008,
"autogenerated": false,
"ratio": 3.735955056179775,
"co... |
__autor__ = 'nickbortolotti'
__licencia__ = 'Apache 2.0'
import os
import sys
import simplejson
import jinja2
import webapp2
from apiclient.discovery import build
from oauth2client.appengine import OAuth2DecoratorFromClientSecrets
#Decorador para el cliente de BigQuery - ** Recuerde utilizar su client_secrets.json *... | {
"repo_name": "nbortolotti/Dashboard-Bigquery",
"path": "main.py",
"copies": "1",
"size": "3252",
"license": "apache-2.0",
"hash": -8577072792289296000,
"line_mean": 36.8255813953,
"line_max": 108,
"alpha_frac": 0.5827183272,
"autogenerated": false,
"ratio": 3.781395348837209,
"config_test": fa... |
#Autor: Rafael Arquero Gimeno
import math
import random
import time
import collections
#agafa length bits comencant a contar per la dreta
# bitsplit(101001, 0, 3) = 001
def bitsplit(n, first, length):
return (n >> first) & (2 ** length - 1)
def binlen(n):#longitud d'un enter representat en binari
if n == 0:
... | {
"repo_name": "UB-info/algorismica",
"path": "exercici9.py",
"copies": "1",
"size": "12356",
"license": "mit",
"hash": 8372915143041435000,
"line_mean": 36.329305136,
"line_max": 232,
"alpha_frac": 0.5764001295,
"autogenerated": false,
"ratio": 3.0967418546365915,
"config_test": false,
"has_n... |
__autor__ = 'Roman'
from model.contacts import Contacts
import re
import random
class ContactsHelper:
def __init__(self, app):
self.app = app
def open_adress_page(self):
wd = self.app.wd
if not wd.current_url.endswith("/addressbook/"):
wd.find_element_by_link_text("home").... | {
"repo_name": "rwajs75/python_szkolenie",
"path": "fixture/contacts.py",
"copies": "1",
"size": "10221",
"license": "apache-2.0",
"hash": 7691380286568430000,
"line_mean": 45.8853211009,
"line_max": 119,
"alpha_frac": 0.5937775169,
"autogenerated": false,
"ratio": 3.234493670886076,
"config_tes... |
__autor__ = 'Roman'
from model.group import Group
import random
def test_modify_group_name(app, db, check_ui):
if len(db.get_group_list()) == 0:
app.group.create(Group(name="Dodana przed modyfikacją"))
old_groups = db.get_group_list()
group = random.choice(old_groups)
group.name = "zmodyfikowa... | {
"repo_name": "rwajs75/python_szkolenie",
"path": "test/test_mod_group.py",
"copies": "1",
"size": "1375",
"license": "apache-2.0",
"hash": 1571522238523641300,
"line_mean": 39.3529411765,
"line_max": 113,
"alpha_frac": 0.6596209913,
"autogenerated": false,
"ratio": 2.706114398422091,
"config_t... |
__autor__ = 'Roman'
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new")) > 0):
wd.find_element_by_link_te... | {
"repo_name": "rwajs75/python_szkolenie",
"path": "fixture/group.py",
"copies": "1",
"size": "3850",
"license": "apache-2.0",
"hash": 746377331375763100,
"line_mean": 32.4869565217,
"line_max": 100,
"alpha_frac": 0.5888311688,
"autogenerated": false,
"ratio": 3.330449826989619,
"config_test": f... |
__autor__ = 'Roman'
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.contacts import Contacts
from pymysql.converters import decoders
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(int, column='... | {
"repo_name": "rwajs75/python_szkolenie",
"path": "fixture/orm.py",
"copies": "1",
"size": "2577",
"license": "apache-2.0",
"hash": 132071486685594100,
"line_mean": 39.265625,
"line_max": 130,
"alpha_frac": 0.6689949554,
"autogenerated": false,
"ratio": 3.6814285714285715,
"config_test": false,... |
__autor__ = 'Roman'
from sys import maxsize
class Contacts:
def __init__(self, name=None, firstname=None, lastname=None, nickname=None, company=None, adress=None, home=None, mobile=None,
work=None, fax=None, all_phones_from_home_page=None, email=None, byear=None, id=None):
self.firstname =... | {
"repo_name": "rwajs75/python_szkolenie",
"path": "model/contacts.py",
"copies": "1",
"size": "1153",
"license": "apache-2.0",
"hash": -2279937749569371000,
"line_mean": 33.9696969697,
"line_max": 130,
"alpha_frac": 0.5897658283,
"autogenerated": false,
"ratio": 3.558641975308642,
"config_test"... |
__autor__ = 'Roman'
import mysql.connector
from model.group import Group
from model.contacts import Contacts
from model.address_in_groups import AddressInGroups
class DbFixture:
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.... | {
"repo_name": "rwajs75/python_szkolenie",
"path": "fixture/db.py",
"copies": "1",
"size": "1897",
"license": "apache-2.0",
"hash": -9189026734291718000,
"line_mean": 33.5090909091,
"line_max": 128,
"alpha_frac": 0.5977859779,
"autogenerated": false,
"ratio": 4.141921397379913,
"config_test": fa... |
__autor__ = 'Roman'
from pytest_bdd import given, when, then
from model.contacts import Contacts
import random
@given('a contact list')
def contact_list(db):
return db.get_contacts_list()
@given('a contact with <firstname> and <lastname>')
def new_contact(firstname, lastname):
return Contacts(firstname=firs... | {
"repo_name": "rwajs75/python_szkolenie",
"path": "bdd/contact_steps.py",
"copies": "1",
"size": "3003",
"license": "apache-2.0",
"hash": 3482080143727693300,
"line_mean": 39.5945945946,
"line_max": 103,
"alpha_frac": 0.693972694,
"autogenerated": false,
"ratio": 3.5,
"config_test": false,
"h... |
__autor__ = 'Roman'
from pytest_bdd import given, when, then
from model.group import Group
import random
@given('a group list')
def group_list(db):
return db.get_group_list()
@given('a group with <name>, <header> and <footer>')
def new_group(name, header, footer):
return Group(name=name, header=header, foot... | {
"repo_name": "rwajs75/python_szkolenie",
"path": "bdd/group_steps.py",
"copies": "1",
"size": "1644",
"license": "apache-2.0",
"hash": -1005136271975047800,
"line_mean": 32.5510204082,
"line_max": 113,
"alpha_frac": 0.6976885645,
"autogenerated": false,
"ratio": 3,
"config_test": false,
"has... |
__autor__ = 'Roman'
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_by_... | {
"repo_name": "rwajs75/python_szkolenie",
"path": "fixture/session.py",
"copies": "1",
"size": "1430",
"license": "apache-2.0",
"hash": -563124598427426800,
"line_mean": 28.8125,
"line_max": 76,
"alpha_frac": 0.5622377622,
"autogenerated": false,
"ratio": 3.348946135831382,
"config_test": false... |
#Autor: Virginia Riego del Castillo
def mostrar_operaciones():
print("Las operaciones de la CALCULADORA son:")
print("1-Sumar")
print("2-Restar")
print("3-Multiplicar")
print("4-Dividir")
try:
operacion = int(input("Introduzca el número de la operación: "))
except ValueError... | {
"repo_name": "vrdelc/Aprendiendo-Python",
"path": "Introduccion/calculadora.py",
"copies": "1",
"size": "2313",
"license": "mit",
"hash": 2245730028144479500,
"line_mean": 32.3134328358,
"line_max": 74,
"alpha_frac": 0.6254893432,
"autogenerated": false,
"ratio": 3.081769436997319,
"config_tes... |
""" Auto Scale with Fabric, based on rabbitmq queue size """
import os
import subprocess
import cloudservers
from time import sleep
from conf import settings
def get_rabbitmq_queue_size():
""" Check rabbitmq queue """
p1 = subprocess.Popen(["/usr/sbin/rabbitmqctl",
"list_queues",
... | {
"repo_name": "nicholaskuechler/autoscale-rackspacecloud-fabric-celery",
"path": "auto-scale.py",
"copies": "1",
"size": "4272",
"license": "mit",
"hash": 7184588787198778000,
"line_mean": 33.4516129032,
"line_max": 76,
"alpha_frac": 0.5739700375,
"autogenerated": false,
"ratio": 4.06083650190114... |
"""
Fabric fabfile to build workers using Rackspace Cloud api
and then configure them with the code base.
"""
import cloudservers
import urllib2
import uuid
from time import sleep
from subprocess import call
from threading import Thread
from fabric.api import *
from conf import settings
env.colors = True
en... | {
"repo_name": "nicholaskuechler/autoscale-rackspacecloud-fabric-celery",
"path": "fabfile.py",
"copies": "1",
"size": "6031",
"license": "mit",
"hash": 2347812802936748000,
"line_mean": 26.4136363636,
"line_max": 153,
"alpha_frac": 0.5778477864,
"autogenerated": false,
"ratio": 3.577105575326216,... |
"""Autoscaler monitoring loop daemon."""
import argparse
import logging
import logging.handlers
import os
import sys
import signal
import time
import traceback
import json
from multiprocessing.synchronize import Event
from typing import Optional
import grpc
import prometheus_client
import ray
from ray.autoscaler._pr... | {
"repo_name": "ray-project/ray",
"path": "python/ray/autoscaler/_private/monitor.py",
"copies": "1",
"size": "16419",
"license": "apache-2.0",
"hash": -3343150249632283000,
"line_mean": 38.46875,
"line_max": 79,
"alpha_frac": 0.6212315001,
"autogenerated": false,
"ratio": 4.217569997431287,
"co... |
"""autoscaling URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | {
"repo_name": "cuongnb14/autoscaling-paas",
"path": "project/dashboard/config/urls.py",
"copies": "1",
"size": "1411",
"license": "mit",
"hash": -70724852611958330,
"line_mean": 37.1351351351,
"line_max": 92,
"alpha_frac": 0.6966690291,
"autogenerated": false,
"ratio": 3.4414634146341463,
"conf... |
#auto scaling version of bam metrics
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Pool
import subprocess
import shlex
import logging
import argparse
import datetime
from subprocess import call
import os
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="FASTQC ... | {
"repo_name": "raonyguimaraes/ngs_metrics",
"path": "fastq_multiple.py",
"copies": "1",
"size": "1561",
"license": "mit",
"hash": 6801557280078679000,
"line_mean": 25.0166666667,
"line_max": 96,
"alpha_frac": 0.66367713,
"autogenerated": false,
"ratio": 3.2318840579710146,
"config_test": false,... |
#auto scaling version of bam metrics
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Pool
import subprocess
import shlex
import logging
import argparse
import datetime
import os
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="BAM files (can be the location on S... | {
"repo_name": "raonyguimaraes/ngs_metrics",
"path": "bam/bam_qualimap.py",
"copies": "1",
"size": "1998",
"license": "mit",
"hash": 3852521509988267500,
"line_mean": 28.3823529412,
"line_max": 114,
"alpha_frac": 0.6431431431,
"autogenerated": false,
"ratio": 3.2225806451612904,
"config_test": f... |
#auto scaling version of bam metrics
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Pool
import subprocess
import shlex
import logging
import argparse
import datetime
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="BAM files (can be the location on S3)", nargs... | {
"repo_name": "raonyguimaraes/ngs_metrics",
"path": "bam/bam_pipeline.py",
"copies": "1",
"size": "1275",
"license": "mit",
"hash": -2459379323472552000,
"line_mean": 26.7173913043,
"line_max": 114,
"alpha_frac": 0.6533333333,
"autogenerated": false,
"ratio": 3.390957446808511,
"config_test": f... |
import time
import logging
logger = logging.getLogger()
import os
import hostapd
def test_autoscan_periodic(dev, apdev):
"""autoscan_periodic"""
hostapd.add_ap(apdev[0]['ifname'], { "ssid": "autoscan" })
try:
if "OK" not in dev[0].request("AUTOSCAN periodic:1"):
raise Exception("Fail... | {
"repo_name": "wangybgit/Chameleon",
"path": "hostapd-OpenWrt/tests/hwsim/test_autoscan.py",
"copies": "3",
"size": "3221",
"license": "apache-2.0",
"hash": -473705865186112260,
"line_mean": 39.7721518987,
"line_max": 96,
"alpha_frac": 0.5625582117,
"autogenerated": false,
"ratio": 3.615039281705... |
# auto_serial.py 15/09/2015 D.J.Whale
# No specific protocol is implied by this interface.
# This just provides a generic transport adaptor to any device via pyserial
# This was cloned (as a starting point) from the mb_remote project.
# That project came originally from github.com/whaleygeek/anyio.
# NOTE: thi... | {
"repo_name": "whaleygeek/mb_sdcard",
"path": "src/microbit/auto_serial/auto_serial.py",
"copies": "1",
"size": "4223",
"license": "mit",
"hash": 7402797947300059000,
"line_mean": 26.2451612903,
"line_max": 83,
"alpha_frac": 0.6163864551,
"autogenerated": false,
"ratio": 4.060576923076923,
"con... |
"""AutoShare"""
import requests
import json
from settings import Facebook_base_url,Access_token
from youtube_url_generator import video_post
def facebook_post():
"""Posts the video url on facebook wall"""
post_message = video_post
post_message.replace(' ', '+')
response_get = requests.get(Facebook_... | {
"repo_name": "trishnaguha/AutoShare",
"path": "autoshare.py",
"copies": "1",
"size": "2255",
"license": "mit",
"hash": -3654220369511650000,
"line_mean": 35.9672131148,
"line_max": 87,
"alpha_frac": 0.4988913525,
"autogenerated": false,
"ratio": 4.678423236514523,
"config_test": false,
"has_... |
# autosmartevaluate_rolethemes.py
# This is an automatable version of
# smartevaluate_rolethemes.py, that
# can be called as a function from
# measure_variation.py.
import sys, csv, random
import numpy as np
import pandas as pd
from scipy.spatial.distance import cosine
from collections import Counter
def getdoc(anid... | {
"repo_name": "tedunderwood/biographies",
"path": "topicmodel/interpret/autosmartevaluate_rolethemes.py",
"copies": "1",
"size": "4399",
"license": "mit",
"hash": -5129991206364341000,
"line_mean": 26.8417721519,
"line_max": 101,
"alpha_frac": 0.6090020459,
"autogenerated": false,
"ratio": 3.6935... |
##auto start powermeter in case reboot
#sudo cp powermeter /etc/init.d/
#sudo chmod a+x /etc/init.d/powermeter
#sudo update-rc.d powermeter defaults
import sys
import RPi.GPIO as GPIO
import time
import subprocess
import json
import requests
import datetime
from apscheduler.scheduler import Scheduler
import logging
lo... | {
"repo_name": "teemuhirsikangas/magicaespeculo",
"path": "scripts/send_powermeter.py",
"copies": "1",
"size": "1454",
"license": "mit",
"hash": -5162582390994217000,
"line_mean": 22.4516129032,
"line_max": 78,
"alpha_frac": 0.7331499312,
"autogenerated": false,
"ratio": 2.931451612903226,
"conf... |
AUTO_STOP=False
DATADIR='data'
SHORTCUT_PREFIX='s'
OUTDIR='render'
TASKFN='task.org'
BACKLOG='Backlog'
STORY_SEPARATOR='/'
STATUSES=['REVIEW','DOING','TODO','DONE','DUPE','POSTPONED','CANCELLED', 'PARENT', 'STORAGE']
DONESTATES=['DONE','DUPE','CANCELLED','POSTPONED']
DOINGSTATES=['REVIEW','DOING']
DEFAULT_STATUS='TODO... | {
"repo_name": "SandStormHoldings/ScratchDocs",
"path": "config.py",
"copies": "1",
"size": "3499",
"license": "mit",
"hash": 2579981862041039400,
"line_mean": 27.9173553719,
"line_max": 122,
"alpha_frac": 0.5887396399,
"autogenerated": false,
"ratio": 3.2731524789522917,
"config_test": false,
... |
# auto_telnet.py - remote control via telnet
import os, sys, string, telnetlib
from getpass import getpass
class AutoTelnet:
def __init__(self, user_list, cmd_list, **kw):
self.host = kw.get('host', 'localhost')
self.timeout = kw.get('timeout', 600)
self.command_prompt = kw.get('command_pro... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/52228_Remote_control_with_telnetlib/recipe-52228.py",
"copies": "1",
"size": "2741",
"license": "mit",
"hash": 5347265057363463000,
"line_mean": 33.6962025316,
"line_max": 76,
"alpha_frac": 0.538124772,
"autogenerated": false,
"ratio": 3.6... |
# autotorch.py 31/01/2015 D.J.Whale
#
# Show how to turn torches on and off automatically.
# Builds the turner prize "room with a light going on and off"
# Stand in the room, and the lights go on and off.
# Stand outside the room, and they don't (or do they?!)
import mcpi.minecraft as minecraft
import mcpi.block as... | {
"repo_name": "whaleygeek/mcpi_recipes",
"path": "geofence/autotorch.py",
"copies": "1",
"size": "3390",
"license": "mit",
"hash": -7748506181743684000,
"line_mean": 22.3793103448,
"line_max": 107,
"alpha_frac": 0.591740413,
"autogenerated": false,
"ratio": 2.7427184466019416,
"config_test": fa... |
# autotracker-bottomup - the quite a few times more ultimate audio experience
# by Ben "GreaseMonkey" Russell, 2011. Public domain.
#
#
#
# BUGS:
# - sometimes gets stuck in an infinite loop. attempted to alleviate it but it doesn't work.
# - i think it sometimes jumps further than an octave in some situations
# oh and... | {
"repo_name": "stoman/LudumDare26",
"path": "autotracker/autotracker.py",
"copies": "2",
"size": "31611",
"license": "mit",
"hash": -2047143142651643600,
"line_mean": 28.9072847682,
"line_max": 173,
"alpha_frac": 0.4758786498,
"autogenerated": false,
"ratio": 3.1485059760956173,
"config_test": ... |
"""Auto tune Transformer via Vizier."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import app
from absl import flags
import tensorflow as tf
from bin import t2t_trainer
from bin import vizier_flags # pylint: disable=unused-import
from bin ... | {
"repo_name": "mlperf/training_results_v0.6",
"path": "Google/benchmarks/transformer/implementations/tpu-v3-32-transformer/transformer/bin/t2t_trainer_vizier.py",
"copies": "6",
"size": "1850",
"license": "apache-2.0",
"hash": 6031283803427012000,
"line_mean": 25.8115942029,
"line_max": 73,
"alpha_fr... |
'''auto-tuning batch sgd
ARGS
regularizer_weight: number
gradient : function(theta, ...) -> vector
loss : function(theta, x, y) -> number
theta0 : vector
train_x : matrix
train_y : vector
validate_x : matrix
validate_y : vector
alpha0_subset_set : numb... | {
"repo_name": "rlowrance/mlpack",
"path": "sgd_batch_auto.py",
"copies": "1",
"size": "12979",
"license": "mit",
"hash": -6935913504167882000,
"line_mean": 32.9764397906,
"line_max": 78,
"alpha_frac": 0.535711534,
"autogenerated": false,
"ratio": 4.125556261919899,
"config_test": true,
"has_n... |
# autounban.py by ApolloJustice
# for use with Python 3
# non PEP-8 compliant because honestly fuck that
# probably not commented because too lazy
__module_name__ = "AutoUnban"
__module_version__ = "1.0"
__module_description__ = "Unbans you if you have flag +r on a channel"
__author__ = "ApolloJustice"
import hexchat... | {
"repo_name": "ApolloJustice/HexChat-pyscripts",
"path": "autounban.py",
"copies": "1",
"size": "2719",
"license": "mit",
"hash": -1371919698884704800,
"line_mean": 39,
"line_max": 270,
"alpha_frac": 0.7149687385,
"autogenerated": false,
"ratio": 2.8264033264033266,
"config_test": false,
"has... |
"""Auto unsubscribe
Write a program that scans through your email account, finds all the unsubscribe
links in all your emails, and automatically opens them in a browser. This program
will have to log in to your email provider’s IMAP server and download all of your
emails. You can use BeautifulSoup to check for any ins... | {
"repo_name": "JoseALermaIII/python-tutorials",
"path": "pythontutorials/books/AutomateTheBoringStuff/Ch16/Projects/P3_autoUnsubscribe.py",
"copies": "1",
"size": "2318",
"license": "mit",
"hash": -2416132743006965000,
"line_mean": 35.1875,
"line_max": 96,
"alpha_frac": 0.6476683938,
"autogenerated... |
"""Auto updating module."""
import config
import requests
import zipfile
import shutil
import os
def gitupdate():
"""Public method."""
_setup()
local = _get_local_version()
remote = _get_remote_version()
if local is 0:
print("No application found, installing...")
_install()
els... | {
"repo_name": "Riptide00/gitupdate",
"path": "gitupdate.py",
"copies": "1",
"size": "2686",
"license": "mit",
"hash": 3376646005003166700,
"line_mean": 20.3174603175,
"line_max": 54,
"alpha_frac": 0.5483991065,
"autogenerated": false,
"ratio": 3.5957161981258365,
"config_test": false,
"has_no... |
"""auto URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | {
"repo_name": "park-python/course",
"path": "lectures/09_Web_Development/auto/auto/urls.py",
"copies": "1",
"size": "1088",
"license": "bsd-3-clause",
"hash": 5043473515544607000,
"line_mean": 34.0967741935,
"line_max": 79,
"alpha_frac": 0.7288602941,
"autogenerated": false,
"ratio": 3.6146179401... |
# Autumn 2015 sources, the end product.
import requests
ENDPOINT = "https://en.wikipedia.org/w/api.php"
parameters = { 'action' : 'query',
'prop' : 'revisions',
'titles' : 'Python (programming language)',
'rvlimit' : 100,
'rvprop' : 'timestamp|user',
... | {
"repo_name": "ben-zen/wikipedia-session",
"path": "sources/wiki_test.py",
"copies": "1",
"size": "1530",
"license": "mit",
"hash": -8583228557474847000,
"line_mean": 31.5531914894,
"line_max": 69,
"alpha_frac": 0.5183006536,
"autogenerated": false,
"ratio": 4.058355437665782,
"config_test": fa... |
# autumn.util.py
from threading import local as threading_local
# Autumn ORM
from autumn.model import Model
from autumn.db.relations import ForeignKey, OneToMany
from autumn.db.query import Query
from autumn.db.connection import Database
class Cache(object):
cached = {}
def add(self, obj):
self... | {
"repo_name": "MaxMorais/autumn",
"path": "autumn/util/__init__.py",
"copies": "1",
"size": "2624",
"license": "mit",
"hash": -6173919502335107000,
"line_mean": 25.24,
"line_max": 77,
"alpha_frac": 0.6288109756,
"autogenerated": false,
"ratio": 3.634349030470914,
"config_test": false,
"has_no... |
# AUV resizable thread pool - forked from the eventlet thread pool,
# but with modifications that allow it to dynamically grow as more
# threads are added. For now, it never shrinks - that shouldn't be a
# large issue, as the threads are doing legitimate waits instead of busy
# waits.
# Copyright (c) 2007-2009, Linden... | {
"repo_name": "cuauv/software",
"path": "vision/resizable_eventlet_tpool.py",
"copies": "1",
"size": "11451",
"license": "bsd-3-clause",
"hash": 3253907242222020600,
"line_mean": 30.8083333333,
"line_max": 83,
"alpha_frac": 0.6207318138,
"autogenerated": false,
"ratio": 3.768015794669299,
"conf... |
"""AUX CPP
Auxilary file for the cpp converter.
"""
import os
from excentury.command import error, trace, exec_cmd, date
from excentury.lang import format_input, format_return, gen_cmd
from excentury.lang import write_file
from datetime import datetime
TEMPLATE = """// File generated on {date} by xcpp.
#define XC_C... | {
"repo_name": "jmlopez-rod/excentury",
"path": "excentury/lang/cpp/aux.py",
"copies": "1",
"size": "4958",
"license": "bsd-2-clause",
"hash": -1635230671336339700,
"line_mean": 32.9589041096,
"line_max": 75,
"alpha_frac": 0.5235982251,
"autogenerated": false,
"ratio": 3.370496261046907,
"config... |
def add_item(request):
item_id = request.POST.get('item_id')
name = request.POST.get('item_name')
price = request.POST.get('item_price')
quantity = request.POST.get('quantity')
shipping = request.POST.get('shipping_choices')
try:
# add an item to the cart if there is a cart
request.session['cart'].append({
... | {
"repo_name": "agconti/shopping_cart",
"path": "shopping_cart_project/shopping_cart/view_functions.py",
"copies": "1",
"size": "1754",
"license": "mit",
"hash": 2738705888210830000,
"line_mean": 29.7894736842,
"line_max": 100,
"alpha_frac": 0.6556442417,
"autogenerated": false,
"ratio": 3.0189328... |
"""Aux functions"""
# Authors: Dmitrii Altukhov <daltuhov@hse>
# Annalisa Pascarella <a.pascarella@iac.cnr.it>
#
# License: BSD (3-clause)
from contextlib import contextmanager
import os
# Define a context manager to suppress stdout and stderr.
class suppress_stdout_stderr(object): # noqa
"""Context ... | {
"repo_name": "neuropycon/ephypype",
"path": "ephypype/aux_tools.py",
"copies": "1",
"size": "2814",
"license": "bsd-3-clause",
"hash": 4594994149653669400,
"line_mean": 26.0576923077,
"line_max": 76,
"alpha_frac": 0.592039801,
"autogenerated": false,
"ratio": 3.7026315789473685,
"config_test":... |
''' auxilary file for io operations
'''
__author__ = 'Brooks MacBeth'
__version__ = '1.0.0'
def parse_input_file(file):
''' Parses an input file and returns the score dictionary
This method takes in a PROPERLY FORMATTED file and returns a properly formatted
dictionary to be fed into the `relati... | {
"repo_name": "blmacbeth/scoring-system",
"path": "input_output.py",
"copies": "1",
"size": "4822",
"license": "mit",
"hash": 4733310059663278000,
"line_mean": 28.2242424242,
"line_max": 83,
"alpha_frac": 0.5922853588,
"autogenerated": false,
"ratio": 3.4516821760916248,
"config_test": false,
... |
"""Auxilary files for those who wanted to solve breakout with CEM or policy gradient"""
import numpy as np
import gym
from scipy.misc import imresize
from gym.core import Wrapper
from gym.spaces.box import Box
def make_pong():
"""creates breakout env with all preprocessing done for you"""
return PreprocessAta... | {
"repo_name": "yandexdataschool/Practical_RL",
"path": "week01_intro/pong.py",
"copies": "1",
"size": "1689",
"license": "unlicense",
"hash": 4704256174593340000,
"line_mean": 34.9361702128,
"line_max": 89,
"alpha_frac": 0.63883955,
"autogenerated": false,
"ratio": 3.632258064516129,
"config_te... |
"""Auxilary functions for the API controllers."""
def set_timestamp():
"""Format POSIX UTC time for metadata."""
from time import gmtime
t = gmtime()
return '{0:4d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d} UTC'.format(
t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec)
def get_ch... | {
"repo_name": "EarthLifeConsortium/elc_api",
"path": "swagger_server/elc/aux.py",
"copies": "1",
"size": "3202",
"license": "apache-2.0",
"hash": 7445980781688307000,
"line_mean": 28.1090909091,
"line_max": 75,
"alpha_frac": 0.5712054966,
"autogenerated": false,
"ratio": 3.693194925028835,
"con... |
"""Auxiliar methods to deal with loading the dataset."""
import os
import random
import numpy as np
from keras.preprocessing.image import apply_transform, flip_axis
from keras.preprocessing.image import transform_matrix_offset_center
from keras.preprocessing.image import Iterator, load_img, img_to_array
class TwoIm... | {
"repo_name": "costapt/vess2ret",
"path": "util/data.py",
"copies": "1",
"size": "10271",
"license": "mit",
"hash": -7669574231487032000,
"line_mean": 38.9649805447,
"line_max": 110,
"alpha_frac": 0.5599260053,
"autogenerated": false,
"ratio": 3.6564613741545036,
"config_test": false,
"has_no... |
"""Auxiliary classes and functions to support the model"""
from re import match
from .odata_object_base import Guid
from . import *
def get_object_class(odata_context, odata_type=None):
"""Returns class corresponding to the odata context and type specified by parameters.
:param odata_context: odata context.
... | {
"repo_name": "elexpander/odataPyModel",
"path": "input/extension.py",
"copies": "1",
"size": "3538",
"license": "mit",
"hash": 6373093664917601000,
"line_mean": 38.7528089888,
"line_max": 115,
"alpha_frac": 0.5602035048,
"autogenerated": false,
"ratio": 3.935483870967742,
"config_test": false,... |
"""Auxiliary class to generate fake data for Alligator."""
# 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
#
# ... | {
"repo_name": "google/alligator2",
"path": "test/data_filler.py",
"copies": "1",
"size": "24703",
"license": "apache-2.0",
"hash": 2557459464275745300,
"line_mean": 35.4859675037,
"line_max": 132,
"alpha_frac": 0.5403020121,
"autogenerated": false,
"ratio": 4.178819150735916,
"config_test": fal... |
"""Auxiliary code for generated optimization models."""
import collections
import functools
import inspect
import types
import numpy as np
def optimization_meta(name, bases, dict):
cls = type(name, bases, dict)
base_shapes = cls.base_shapes
for name, desc in cls.constraints.items():
method... | {
"repo_name": "dimasad/ceacoest",
"path": "ceacoest/modelling/genoptim.py",
"copies": "2",
"size": "8067",
"license": "mit",
"hash": 2611120169760854000,
"line_mean": 31.3975903614,
"line_max": 79,
"alpha_frac": 0.5810090492,
"autogenerated": false,
"ratio": 4.061933534743202,
"config_test": fa... |
"""Auxiliary code for generated SDE models."""
import numpy as np
from . import stats
class ConditionalGaussianTransition:
def trans_pdf(self, k, x, xnext):
"""Unnormalized state transition probability density function."""
f = self.f(k, x)
Q = self.Q(k, x)
return stats.multivari... | {
"repo_name": "dimasad/qwfilter",
"path": "ceacoest/modelling/gensde.py",
"copies": "2",
"size": "1134",
"license": "mit",
"hash": 7861181001605690000,
"line_mean": 26,
"line_max": 73,
"alpha_frac": 0.5758377425,
"autogenerated": false,
"ratio": 3.7302631578947367,
"config_test": false,
"has_... |
# Auxiliary file containing functions for parallelization
import multiprocessing
import time
import math
from psutil import virtual_memory
# Global variables within module's scope
__start_time_for_x = 0
__x_marker = 0
def __output(log, indicator="TOP"):
""" Helper function to store in a file the lo... | {
"repo_name": "git-persistence/git-persistence",
"path": "examples/parallel_lib.py",
"copies": "1",
"size": "3885",
"license": "mit",
"hash": 7449683631183943000,
"line_mean": 28.3515625,
"line_max": 116,
"alpha_frac": 0.548005148,
"autogenerated": false,
"ratio": 4.0175801447776625,
"config_te... |
"""Auxiliary funcitons to dump the data."""
import mako.runtime
import mako.template
from typing import List, Optional
pages_revisions_template = '''
<%!
from itertools import groupby
def groupby_action(diff):
return groupby(diff, lambda d: d.action)
%>
<root>
% for page in pages:
<page>
... | {
"repo_name": "youtux/wikidump",
"path": "wikidump/dumper.py",
"copies": "2",
"size": "3368",
"license": "mit",
"hash": -6248444134842143000,
"line_mean": 30.1851851852,
"line_max": 94,
"alpha_frac": 0.5225653207,
"autogenerated": false,
"ratio": 4.385416666666667,
"config_test": false,
"has_... |
#Auxiliary functionality that doesn't fit into any particular module
from collections import defaultdict
from re import match
def isDomain(domain):
"""Validates a domain"""
if match("^[a-z0-9.]{3,}$", domain):
return True
return False
def add_alexa_rank(c, results):
"""Adds the alexa rank to a list of di... | {
"repo_name": "matthewruttley/Bucketerer",
"path": "interface/auxiliary.py",
"copies": "3",
"size": "2882",
"license": "mit",
"hash": 5907463245846156000,
"line_mean": 24.7321428571,
"line_max": 122,
"alpha_frac": 0.6689798751,
"autogenerated": false,
"ratio": 3.0724946695095947,
"config_test":... |
# Auxiliary functions for analysis of
# ll_4320 mitgcm simulation
# crocha, sio summer 2014
import numpy as np
def rmean(A):
""" Removes time-mean of llc_4320 3d fields; axis=2 is time"""
ix,jx,kx = A.shape
Am = np.repeat(A.mean(axis=2),kx)
Am = Am.reshape(ix,jx,kx)
return A-Am
def spec_est... | {
"repo_name": "crocha700/dp_spectra",
"path": "src/aux_func_3dfields.py",
"copies": "1",
"size": "4725",
"license": "mit",
"hash": -1793386592613275100,
"line_mean": 27.6363636364,
"line_max": 86,
"alpha_frac": 0.557037037,
"autogenerated": false,
"ratio": 2.5904605263157894,
"config_test": fal... |
"""Auxiliary functions for managing results of algorithms"""
import matplotlib.pyplot as plt
from athenet.utils import save_data_to_pickle, load_data_from_pickle
def merge_pickles(out_pkl, in_pkl1, in_pkl2):
""" Merge pickled dictionaries.
Merges two pickled dictionaries from two files named in_pkl1 and in_... | {
"repo_name": "heurezjusz/Athena",
"path": "athenet/utils/results_maintenance.py",
"copies": "2",
"size": "2083",
"license": "bsd-2-clause",
"hash": -1003795290668737500,
"line_mean": 35.5438596491,
"line_max": 78,
"alpha_frac": 0.6509841575,
"autogenerated": false,
"ratio": 3.6543859649122807,
... |
""" Auxiliary functions for models """
def unpack_args(args, layer_no, layers_max):
""" Return layer parameters """
new_args = {}
for arg in args:
if isinstance(args[arg], list):
if len(args[arg]) >= layers_max:
arg_value = args[arg][layer_no]
else:
... | {
"repo_name": "analysiscenter/dataset",
"path": "batchflow/models/utils.py",
"copies": "1",
"size": "1105",
"license": "apache-2.0",
"hash": 8781846208963370000,
"line_mean": 25.9512195122,
"line_max": 55,
"alpha_frac": 0.5131221719,
"autogenerated": false,
"ratio": 3.553054662379421,
"config_t... |
## Auxiliary functions for Pandas DataFrames ##
import numpy as np
import scipy as sp
from pandas import DataFrame, Series
def describe(df):
"""
Returns the descriptive statistics of a given dataframe.
Parameters
----------
df : DataFrane
the dataframe you want to describe.
Returns
... | {
"repo_name": "agconti/KaggleAux",
"path": "kaggleaux/dataframe.py",
"copies": "1",
"size": "3741",
"license": "apache-2.0",
"hash": -4520711652727484400,
"line_mean": 24.6301369863,
"line_max": 93,
"alpha_frac": 0.6214915798,
"autogenerated": false,
"ratio": 4.231900452488688,
"config_test": f... |
"""Auxiliary functions for statistics."""
import scipy.stats
from functools import lru_cache
from math import sqrt
@lru_cache(maxsize=10)
def confidence_level(nsigma):
r"""Return the confidence level corresponding to a number of sigmas,
i.e. the probability contained in the normal distribution between $-n\sig... | {
"repo_name": "flav-io/flavio",
"path": "flavio/statistics/functions.py",
"copies": "1",
"size": "1547",
"license": "mit",
"hash": 2108856377696798200,
"line_mean": 33.3777777778,
"line_max": 80,
"alpha_frac": 0.6748545572,
"autogenerated": false,
"ratio": 3.144308943089431,
"config_test": fals... |
"""Auxiliary functions for the refinement package"""
import logging
import math
import random
import scitbx.matrix
from scitbx.array_family import flex
from dials_refinement_helpers_ext import CrystalOrientationCompose as xloc_cpp
from dials_refinement_helpers_ext import PanelGroupCompose as pgc_cpp
from dials_refi... | {
"repo_name": "dials/dials",
"path": "algorithms/refinement/refinement_helpers.py",
"copies": "1",
"size": "10365",
"license": "bsd-3-clause",
"hash": -7818889437693235000,
"line_mean": 32.1150159744,
"line_max": 87,
"alpha_frac": 0.6243125904,
"autogenerated": false,
"ratio": 3.2936129647283128,... |
"""Auxiliary functions."""
import cPickle as pickle
import os
import sys
import gzip
import urllib
import numpy
import theano
import theano.tensor as T
import theano.sandbox.cuda
from athenet.utils import BIN_DIR, DATA_DIR
def load_data_from_pickle(filename):
"""Load data from pickle file.
:param filename... | {
"repo_name": "heurezjusz/Athenet",
"path": "athenet/utils/misc.py",
"copies": "2",
"size": "7019",
"license": "bsd-2-clause",
"hash": -8549405178507212000,
"line_mean": 29.3852813853,
"line_max": 77,
"alpha_frac": 0.6126228808,
"autogenerated": false,
"ratio": 3.850246845858475,
"config_test":... |
"""Auxiliary functions."""
try:
import cPickle as pickle
except ImportError:
import pickle
import re
import os
from SPARQLWrapper import SPARQLWrapper, JSON
YAGO_ENPOINT_URL = "https://linkeddata1.calcul.u-psud.fr/sparql"
RESOURCE_PREFIX = 'http://yago-knowledge.org/resource/'
def safe_mkdir(dir_name):
... | {
"repo_name": "MIREL-UNC/mirel-scripts",
"path": "yago_scripts/utils.py",
"copies": "1",
"size": "4600",
"license": "bsd-3-clause",
"hash": 5139483361887489000,
"line_mean": 32.5766423358,
"line_max": 80,
"alpha_frac": 0.6373913043,
"autogenerated": false,
"ratio": 3.9861351819757367,
"config_t... |
"""Auxiliary methods."""
import os
import json
from errno import EEXIST
import numpy as np
import seaborn as sns
import cPickle as pickle
import matplotlib.pyplot as plt
sns.set()
DEFAULT_LOG_DIR = 'log'
ATOB_WEIGHTS_FILE = 'atob_weights.h5'
D_WEIGHTS_FILE = 'd_weights.h5'
class MyDict(dict):
"""
Dictionar... | {
"repo_name": "costapt/vess2ret",
"path": "util/util.py",
"copies": "1",
"size": "6272",
"license": "mit",
"hash": 7907623391323375000,
"line_mean": 29.8965517241,
"line_max": 89,
"alpha_frac": 0.5739795918,
"autogenerated": false,
"ratio": 3.2837696335078532,
"config_test": false,
"has_no_ke... |
"""Auxiliary module for discovering Rotest resources within an app."""
from __future__ import absolute_import
from importlib import import_module
import six
from django.conf import settings
from django.utils.module_loading import module_has_submodule
from rotest.management.base_resource import BaseResource
RESOURC... | {
"repo_name": "gregoil/rotest",
"path": "src/rotest/management/utils/resources_discoverer.py",
"copies": "1",
"size": "1741",
"license": "mit",
"hash": -1266827612394189600,
"line_mean": 27.5409836066,
"line_max": 77,
"alpha_frac": 0.6794945434,
"autogenerated": false,
"ratio": 4.086854460093897,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.