text stringlengths 0 1.05M | meta dict |
|---|---|
# 3. Longest Substring Without Repeating Characters - LeetCode
# https://leetcode.com/problems/longest-substring-without-repeating-characters/description/
# class Solution(object):
# def lengthOfLongestSubstring_TLE(self, s):
# """
# :type s: str
# :rtype: int
# """
# if len... | {
"repo_name": "heyf/cloaked-octo-adventure",
"path": "leetcode/003_longest-substring-without-repeating-characters.py",
"copies": "1",
"size": "1963",
"license": "mit",
"hash": -2585491395327102000,
"line_mean": 26.661971831,
"line_max": 91,
"alpha_frac": 0.4589913398,
"autogenerated": false,
"rat... |
# 3. Longest Substring Without Repeating Characters
# Given a string, find the length of the longest substring without repeating characters.
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
start = 0
maxLen = 0
dic = {}
l... | {
"repo_name": "Vaibhav/InterviewPrep",
"path": "LeetCode/Medium/3-Longest-SubStr-No-Repeat.py",
"copies": "2",
"size": "1030",
"license": "mit",
"hash": 3052068324620559000,
"line_mean": 34.7857142857,
"line_max": 115,
"alpha_frac": 0.527184466,
"autogenerated": false,
"ratio": 4.364406779661017,... |
3
# -*- coding: utf-8 -*-
"""
Functions that encapsulate "usual" use-cases for pdfminer, for use making
bundled scripts and for using pdfminer as a module for routine tasks.
"""
import six
import sys
from .pdfdocument import PDFDocument
from .pdfparser import PDFParser
from .pdfinterp import PDFResourceManager, PDFPa... | {
"repo_name": "rotula/pdfminer",
"path": "pdfminer/high_level.py",
"copies": "1",
"size": "3883",
"license": "mit",
"hash": 2047943244812810000,
"line_mean": 39.8736842105,
"line_max": 86,
"alpha_frac": 0.6381663662,
"autogenerated": false,
"ratio": 4.197837837837838,
"config_test": false,
"h... |
# waveconverter decoding modules
import waveConvertVars as wcv
#from breakWave import breakdownWaveform
from breakWave import breakdownWaveform2
from widthToBits import separatePackets
from widthToBits import decodePacket
from statEngine import checkCRC
from statEngine import checkACS
#from widthToBits import printPac... | {
"repo_name": "paulgclark/waveconverter",
"path": "src/waveconverterEngine.py",
"copies": "1",
"size": "14624",
"license": "mit",
"hash": -1911008310976687400,
"line_mean": 41.8885630499,
"line_max": 130,
"alpha_frac": 0.5423276805,
"autogenerated": false,
"ratio": 4.505237215033888,
"config_te... |
import sys, pygame
from pygame.locals import *
from random import randint
import math
def drawApple():
red = pygame.Color(255,0,0)
green = pygame.Color(0,255,0)
pygame.draw.circle(window,red,apple,5,0)
def newApple():
x = randint(5,635)
y = randint(5,475)
while abs(snakeBody[0][0]-x)<20:
x = randint(1,63)
... | {
"repo_name": "Narcolapser/PyGameLearningByDoing",
"path": "Old PyGame stuff/snake/snake.py",
"copies": "1",
"size": "2886",
"license": "apache-2.0",
"hash": -3639217765777358300,
"line_mean": 22.2741935484,
"line_max": 100,
"alpha_frac": 0.6160776161,
"autogenerated": false,
"ratio": 2.638025594... |
## 3. Optional Arguments ##
# Default code
def tokenize(text_string, special_characters, clean=False):
if clean == True:
cleaned_story = clean_text(text_string, special_characters)
story_tokens = cleaned_story.split(" ")
else:
story_tokens = text_string.split(" ")
return(story_token... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Python Programming Beginner/Customizing Functions and Debugging Errors-61.py",
"copies": "1",
"size": "3286",
"license": "mit",
"hash": -639473868900443900,
"line_mean": 33.6,
"line_max": 101,
"alpha_frac": 0.6789409617,
"autogenerated":... |
# 3 options:
# 1: video player is dormant, and renders a frame and returns it on function call
# 2: video player is threaded, and a frame can be retrieved at any time via function call
# 3: video player is threaded, and a callback is made to external object with rendered frames
#
# For our purposes, 2 looks to be th... | {
"repo_name": "ilathid/ilathidEngine",
"path": "vplayer/old/m_movie.py",
"copies": "1",
"size": "25171",
"license": "epl-1.0",
"hash": 5845616176785844000,
"line_mean": 36.0161764706,
"line_max": 351,
"alpha_frac": 0.5212744825,
"autogenerated": false,
"ratio": 3.9341981869334166,
"config_test"... |
# 3p
from mock import Mock
# project
from tests.checks.common import AgentCheckTest
from tests.core.test_wmi import SWbemServices, TestCommonWMI
class WMITestCase(AgentCheckTest, TestCommonWMI):
CHECK_NAME = 'wmi_check'
WMI_CONNECTION_CONFIG = {
'host': "myhost",
'namespace': "some/namespace... | {
"repo_name": "WPMedia/dd-agent",
"path": "tests/checks/mock/test_wmi_check.py",
"copies": "14",
"size": "13506",
"license": "bsd-3-clause",
"hash": 8941542590753930000,
"line_mean": 33.8992248062,
"line_max": 112,
"alpha_frac": 0.5849992596,
"autogenerated": false,
"ratio": 3.869914040114613,
... |
# 3p
from mock import Mock
# project
from tests.checks.common import AgentCheckTest
from tests.core.test_wmi import TestCommonWMI
class WMITestCase(AgentCheckTest, TestCommonWMI):
CHECK_NAME = 'wmi_check'
WMI_CONNECTION_CONFIG = {
'host': "myhost",
'namespace': "some/namespace",
'use... | {
"repo_name": "Mashape/dd-agent",
"path": "tests/checks/mock/test_wmi_check.py",
"copies": "1",
"size": "11325",
"license": "bsd-3-clause",
"hash": 985024455868221200,
"line_mean": 34.0619195046,
"line_max": 98,
"alpha_frac": 0.5836644592,
"autogenerated": false,
"ratio": 3.850731043862632,
"co... |
# 3p
from nose.plugins.attrib import attr
# project
from checks import AgentCheck
from tests.checks.common import AgentCheckTest
@attr(requires='postgres')
class TestPostgres(AgentCheckTest):
CHECK_NAME = 'postgres'
def test_checks(self):
host = 'localhost'
port = 15432
dbname = 'con... | {
"repo_name": "pmav99/praktoras",
"path": "tests/checks/integration/test_postgres.py",
"copies": "1",
"size": "7727",
"license": "bsd-3-clause",
"hash": 5406629917522716000,
"line_mean": 34.2831050228,
"line_max": 111,
"alpha_frac": 0.5227125663,
"autogenerated": false,
"ratio": 4.215493726132024... |
# 3p
from nose.plugins.attrib import attr
# project
from checks import AgentCheck
from tests.checks.common import AgentCheckTest
# sample from /status?json
# {
# "accepted conn": 350,
# "active processes": 1,
# "idle processes": 2,
# "listen queue": 0,
# "listen queue len": 0,
# "max active p... | {
"repo_name": "packetloop/dd-agent",
"path": "tests/checks/integration/test_php_fpm.py",
"copies": "45",
"size": "2904",
"license": "bsd-3-clause",
"hash": -1853145356691680300,
"line_mean": 27.4705882353,
"line_max": 79,
"alpha_frac": 0.5468319559,
"autogenerated": false,
"ratio": 3.625468164794... |
# 3p
from nose.plugins.attrib import attr
# project
from tests.checks.common import AgentCheckTest
CONFIG = {
'init_config': {},
'instances': [
{
'rabbitmq_api_url': 'http://localhost:15672/api/',
'rabbitmq_user': 'guest',
'rabbitmq_pass': 'guest',
'queu... | {
"repo_name": "pmav99/praktoras",
"path": "tests/checks/integration/test_rabbitmq.py",
"copies": "4",
"size": "3408",
"license": "bsd-3-clause",
"hash": -2286134399942233600,
"line_mean": 26.9344262295,
"line_max": 78,
"alpha_frac": 0.5633802817,
"autogenerated": false,
"ratio": 3.613997879109225... |
# 3p
from nose.plugins.attrib import attr
# project
from tests.checks.common import AgentCheckTest
import requests
@attr(requires='powerdns_recursor')
class TestPowerDNSRecursorCheck(AgentCheckTest):
CHECK_NAME = 'powerdns_recursor'
GAUGE_METRICS = [
'cache-entries',
'concurrent-queries',
... | {
"repo_name": "takus/dd-agent",
"path": "tests/checks/integration/test_powerdns_recursor.py",
"copies": "1",
"size": "7547",
"license": "bsd-3-clause",
"hash": -2553422233908787000,
"line_mean": 31.8130434783,
"line_max": 108,
"alpha_frac": 0.5615476348,
"autogenerated": false,
"ratio": 3.7324431... |
# 3p
from nose.plugins.attrib import attr
# project
from tests.checks.common import AgentCheckTest
@attr(requires='etcd')
class CheckEtcdTest(AgentCheckTest):
CHECK_NAME = "etcd"
STORE_METRICS = [
'compareanddelete.fail',
'compareanddelete.success',
'compareandswap.fail',
'co... | {
"repo_name": "Shopify/dd-agent",
"path": "tests/checks/integration/test_etcd.py",
"copies": "1",
"size": "4088",
"license": "bsd-3-clause",
"hash": -4014821812009430000,
"line_mean": 34.2413793103,
"line_max": 105,
"alpha_frac": 0.5034246575,
"autogenerated": false,
"ratio": 4.063618290258449,
... |
# 3p
import ntplib
# project
from checks import AgentCheck
from utils.ntp import get_ntp_args, set_user_ntp_settings
DEFAULT_OFFSET_THRESHOLD = 60 # in seconds
class NtpCheck(AgentCheck):
DEFAULT_MIN_COLLECTION_INTERVAL = 900 # in seconds
def check(self, instance):
service_check_msg = None
... | {
"repo_name": "atlassian/dd-agent",
"path": "checks.d/ntp.py",
"copies": "34",
"size": "1756",
"license": "bsd-3-clause",
"hash": 7355940819758120000,
"line_mean": 34.12,
"line_max": 130,
"alpha_frac": 0.6173120729,
"autogenerated": false,
"ratio": 4.027522935779817,
"config_test": false,
"ha... |
# 3p
import requests
# project
from checks import AgentCheck
from util import headers
class PHPFPMCheck(AgentCheck):
"""
Tracks basic php-fpm metrics via the status module
Requires php-fpm pools to have the status option.
See http://www.php.net/manual/de/install.fpm.configuration.php#pm.status-path f... | {
"repo_name": "darron/dd-agent",
"path": "checks.d/php_fpm.py",
"copies": "34",
"size": "4348",
"license": "bsd-3-clause",
"hash": 5440082537980633000,
"line_mean": 35.5378151261,
"line_max": 98,
"alpha_frac": 0.5777368905,
"autogenerated": false,
"ratio": 3.97804208600183,
"config_test": false... |
# 3p
import simplejson as json
# datadog
from datadog import api
from datadog.dogshell.common import report_errors, report_warnings
class DowntimeClient(object):
@classmethod
def setup_parser(cls, subparsers):
parser = subparsers.add_parser('downtime', help="Create, edit, and delete downtimes")
... | {
"repo_name": "KyleJamesWalker/datadogpy",
"path": "datadog/dogshell/downtime.py",
"copies": "2",
"size": "4622",
"license": "bsd-3-clause",
"hash": 969029727424984700,
"line_mean": 41.7962962963,
"line_max": 99,
"alpha_frac": 0.6010385115,
"autogenerated": false,
"ratio": 4.068661971830986,
"c... |
# 3p
import simplejson as json
# datadog
from datadog import api
from datadog.dogshell.common import report_errors, report_warnings
class HostClient(object):
@classmethod
def setup_parser(cls, subparsers):
parser = subparsers.add_parser('host', help='Mute, unmute hosts')
verb_parsers = parser... | {
"repo_name": "KyleJamesWalker/datadogpy",
"path": "datadog/dogshell/host.py",
"copies": "2",
"size": "2059",
"license": "bsd-3-clause",
"hash": -3811913104783247400,
"line_mean": 37.8490566038,
"line_max": 97,
"alpha_frac": 0.5910636231,
"autogenerated": false,
"ratio": 3.921904761904762,
"con... |
# 3p
import simplejson as json
# datadog
from datadog import api
from datadog.dogshell.common import report_errors, report_warnings
class MonitorClient(object):
@classmethod
def setup_parser(cls, subparsers):
parser = subparsers.add_parser('monitor', help="Create, edit, and delete monitors")
... | {
"repo_name": "KyleJamesWalker/datadogpy",
"path": "datadog/dogshell/monitor.py",
"copies": "2",
"size": "8495",
"license": "bsd-3-clause",
"hash": -6256791372625888000,
"line_mean": 39.4523809524,
"line_max": 99,
"alpha_frac": 0.5552678046,
"autogenerated": false,
"ratio": 4.113801452784504,
"... |
# 3p
import simplejson as json
# datadog
from datadog import api
from datadog.dogshell.common import report_errors, report_warnings
class ServiceCheckClient(object):
@classmethod
def setup_parser(cls, subparsers):
parser = subparsers.add_parser('service_check', help="Perform service checks")
... | {
"repo_name": "clokep/datadogpy",
"path": "datadog/dogshell/service_check.py",
"copies": "2",
"size": "1676",
"license": "bsd-3-clause",
"hash": -6701624930970765000,
"line_mean": 43.1052631579,
"line_max": 99,
"alpha_frac": 0.63424821,
"autogenerated": false,
"ratio": 4,
"config_test": false,
... |
# 3p
import simplejson as json
# datadog
from datadog import api
from datadog.dogshell.common import report_errors, report_warnings
class TagClient(object):
@classmethod
def setup_parser(cls, subparsers):
parser = subparsers.add_parser('tag', help="View and modify host tags.")
verb_parsers =... | {
"repo_name": "clokep/datadogpy",
"path": "datadog/dogshell/tag.py",
"copies": "3",
"size": "4139",
"license": "bsd-3-clause",
"hash": -3754514619107495400,
"line_mean": 35.6283185841,
"line_max": 100,
"alpha_frac": 0.5136506403,
"autogenerated": false,
"ratio": 4.24077868852459,
"config_test":... |
# 3rd party imports
from bread.bread import LabelValueReadView
import django_filters
from django.utils.translation import ugettext_lazy as _
# This project imports
from .forms import RegistrationPeriodAddForm
from .models import Election, Ballot, Candidate, RegistrationPeriod
from libya_elections.libya_bread import Pa... | {
"repo_name": "SmartElect/SmartElect",
"path": "voting/views.py",
"copies": "1",
"size": "4910",
"license": "apache-2.0",
"hash": -7403713392118187000,
"line_mean": 36.4809160305,
"line_max": 99,
"alpha_frac": 0.6812627291,
"autogenerated": false,
"ratio": 3.7798306389530407,
"config_test": fal... |
# 3rd party imports
from django.db import connection
# Project imports
from register.models import Office, SubConstituency
from .utils import dictfetchall
def _get_registration_centers(must_allow_registrations=True):
"""This returns a dict populated by data from the table register_registrationcenter. The
dic... | {
"repo_name": "SmartElect/SmartElect",
"path": "reporting_api/data_pull_common.py",
"copies": "1",
"size": "2918",
"license": "apache-2.0",
"hash": -1216394739287062300,
"line_mean": 36.8961038961,
"line_max": 92,
"alpha_frac": 0.6579849212,
"autogenerated": false,
"ratio": 3.9972602739726026,
... |
# 3rd Party Imports
from flask import request, Response, make_response
from flask import jsonify
from functools import wraps
import logging
# Local Imports
from blockbuster import app
import bb_auditlogger
from blockbuster import bb_request_processor
from blockbuster import bb_api_request_processor
from blockbuster im... | {
"repo_name": "mattstibbs/blockbuster-server",
"path": "blockbuster/bb_routes.py",
"copies": "1",
"size": "4716",
"license": "mit",
"hash": 4013575952395925500,
"line_mean": 29.4258064516,
"line_max": 107,
"alpha_frac": 0.6916878711,
"autogenerated": false,
"ratio": 3.6276923076923078,
"config_... |
# 3rd party imports
from model_bakery import baker
# Django imports
from django import test
from django.core.exceptions import ValidationError
# Devilry imports
from devilry.devilry_qualifiesforexam import models as status_models
class TestStatus(test.TestCase):
def test_notready_no_message(self):
test... | {
"repo_name": "devilry/devilry-django",
"path": "devilry/devilry_qualifiesforexam/tests/test_models.py",
"copies": "1",
"size": "3089",
"license": "bsd-3-clause",
"hash": 3275388277236497400,
"line_mean": 48.0317460317,
"line_max": 116,
"alpha_frac": 0.6254451279,
"autogenerated": false,
"ratio":... |
# 3rd party imports
from reportlab.platypus import Image, Paragraph, PageBreak, Table, Spacer
from reportlab.lib.units import cm
from reportlab.lib.pagesizes import A4
# Django imports
from django.conf import settings
# Project imports
from .arabic_reshaper import reshape
from .pdf_canvas import NumberedCanvas, getAr... | {
"repo_name": "SmartElect/SmartElect",
"path": "rollgen/generate_pdf.py",
"copies": "1",
"size": "5841",
"license": "apache-2.0",
"hash": -202000613873670820,
"line_mean": 44.6328125,
"line_max": 100,
"alpha_frac": 0.6413285396,
"autogenerated": false,
"ratio": 3.7514450867052025,
"config_test"... |
# 3rd party modules
from django.core.urlresolvers import reverse
from django.utils import timezone
from rest_framework.test import APITestCase
from rest_framework import status
# Own
from pjfeedreader.models import Category, Feed
from .factories import CategoryFactory, FeedFactory
class CategoryAPITest(APITestCase)... | {
"repo_name": "jokimies/django-pj-feedreader",
"path": "tests/test_api.py",
"copies": "1",
"size": "3254",
"license": "bsd-3-clause",
"hash": -7694877073501989000,
"line_mean": 31.8686868687,
"line_max": 77,
"alpha_frac": 0.6075599262,
"autogenerated": false,
"ratio": 4.427210884353742,
"config... |
# 3rd-party modules
from lxml.builder import E
# local module
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class UserSSHKey(Resource):
"""
[edit system login user <name> authentication <key-type> <key-value> ]
Resource name: tuple(<key-type>, <key-value>)
<key-type> : [... | {
"repo_name": "JamesNickerson/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/user_ssh_key.py",
"copies": "9",
"size": "3394",
"license": "apache-2.0",
"hash": -6559505710584498000,
"line_mean": 32.603960396,
"line_max": 77,
"alpha_frac": 0.5070713023,
"autogenerated": false,
"ratio": 4.0891566265060... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
from jnpr.junos.cfg.prefix_list_item import PrefixListItem
class PrefixList(Resource):
"""
[edit policy-otions prefix-list <name>]
Resource name: str
<name> is ... | {
"repo_name": "jokerxs/pyez_resources",
"path": "prefix_list.py",
"copies": "1",
"size": "1585",
"license": "apache-2.0",
"hash": -922005044881638800,
"line_mean": 28.9056603774,
"line_max": 77,
"alpha_frac": 0.4864353312,
"autogenerated": false,
"ratio": 4.074550128534704,
"config_test": false... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
from jnpr.junos.cfg.srx.nat.nat_proxy_arp import NatProxyArp
class NatStaticRule(Resource):
"""
[edit security nat static rule-set <ruleset_name> rule <rule_name>]
Re... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/nat/nat_st_rule.py",
"copies": "1",
"size": "4661",
"license": "apache-2.0",
"hash": -7487769271916536000,
"line_mean": 34.045112782,
"line_max": 79,
"alpha_frac": 0.5153400558,
"autogenerated": false,
"ratio": 3.93001686340640... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
from jnpr.junos.cfg.srx.nat.nat_src_rule import NatSrcRule
class NatSrcRuleSet(Resource):
"""
[edit security nat source rule-set <name>]
"""
PROPERTIES = [
... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/nat/nat_src_ruleset.py",
"copies": "1",
"size": "3030",
"license": "apache-2.0",
"hash": -8945313619700559000,
"line_mean": 30.8947368421,
"line_max": 78,
"alpha_frac": 0.4646864686,
"autogenerated": false,
"ratio": 3.726937269... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
from jnpr.junos.cfg.srx.nat.nat_st_rule import NatStaticRule
class NatStaticRuleSet(Resource):
"""
[edit security nat static rule-set <name>]
"""
PROPERTIES = [
... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/nat/nat_st_ruleset.py",
"copies": "1",
"size": "2885",
"license": "apache-2.0",
"hash": 5260945967243561000,
"line_mean": 31.0555555556,
"line_max": 78,
"alpha_frac": 0.4651646447,
"autogenerated": false,
"ratio": 3.82119205298... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
from jnpr.junos.cfg.user_ssh_key import UserSSHKey
class User(Resource):
"""
[edit system login user <name>]
Resource name: str
<name> is the user login name
... | {
"repo_name": "shermdog/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/user.py",
"copies": "10",
"size": "3071",
"license": "apache-2.0",
"hash": -5571600771662971000,
"line_mean": 29.71,
"line_max": 77,
"alpha_frac": 0.4562031911,
"autogenerated": false,
"ratio": 4.2300275482093666,
"config_test"... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class Application(Resource):
"""
[edit applications application <name>]
Resource name: str
<name> is the application item name
"""
PROPERTIES = [
... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/app.py",
"copies": "1",
"size": "2795",
"license": "apache-2.0",
"hash": -1236523324711293200,
"line_mean": 32.2738095238,
"line_max": 79,
"alpha_frac": 0.4973166369,
"autogenerated": false,
"ratio": 4.222054380664653,
"confi... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class NatSrcPool(Resource):
"""
[edit security nat source pool <name>]
"""
PROPERTIES = [
'addr_from',
'addr_to'
]
def _xml_at_top(self):... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/nat/nat_src_pool.py",
"copies": "1",
"size": "2799",
"license": "apache-2.0",
"hash": 5408513588385456000,
"line_mean": 30.4494382022,
"line_max": 77,
"alpha_frac": 0.4758842444,
"autogenerated": false,
"ratio": 4.0331412103746... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class NatSrcRule(Resource):
"""
[edit security nat source rule-set <ruleset-name> rule <rule-name>]
"""
PROPERTIES = [
"match_src_addr",
"match_ds... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/nat/nat_src_rule.py",
"copies": "1",
"size": "3096",
"license": "apache-2.0",
"hash": 5122419344150648000,
"line_mean": 29.6534653465,
"line_max": 77,
"alpha_frac": 0.4253875969,
"autogenerated": false,
"ratio": 4,
"config_te... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class SharedAddrBookAddr(Resource):
"""
[edit security address-book <ab_name> address <name>]
Resource name: str
<name> is the address item name
Managed by... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/shared_ab_addr.py",
"copies": "1",
"size": "2074",
"license": "apache-2.0",
"hash": -850692669088859600,
"line_mean": 30.9076923077,
"line_max": 77,
"alpha_frac": 0.4590163934,
"autogenerated": false,
"ratio": 4.173038229376258... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class SharedAddrBookSet(Resource):
"""
[edit security address-book <ab_name> address-set <name>]
~! WARNING !~
This resource is managed only as a child of the :Zo... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/shared_ab_set.py",
"copies": "1",
"size": "2772",
"license": "apache-2.0",
"hash": 1734087912708846800,
"line_mean": 34.5384615385,
"line_max": 77,
"alpha_frac": 0.4512987013,
"autogenerated": false,
"ratio": 4.258064516129032,... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class ZoneAddrBookAddr(Resource):
"""
[edit security zone security-zone <zone> address-book address <name>]
Resource name: str
<name> is the name of the address... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/zone_ab_addr.py",
"copies": "1",
"size": "2218",
"license": "apache-2.0",
"hash": 3161191761403918000,
"line_mean": 29.3835616438,
"line_max": 77,
"alpha_frac": 0.4400360685,
"autogenerated": false,
"ratio": 4.2247619047619045,... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class ZoneAddrBookSet(Resource):
"""
[edit security zone security-zone <zone> address-book address-set <name>]
Resource name: str
<name> is the name of the addr... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/zone_ab_set.py",
"copies": "1",
"size": "2965",
"license": "apache-2.0",
"hash": -2956274465226112000,
"line_mean": 31.9444444444,
"line_max": 77,
"alpha_frac": 0.4300168634,
"autogenerated": false,
"ratio": 4.322157434402333,
... |
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg.srx.policy_rule import PolicyRule
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class PolicyContext(Resource):
"""
[edit security policy from-zone <from_zone> to-zone <to_zone>]
Resource name:... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/policy.py",
"copies": "1",
"size": "3160",
"license": "apache-2.0",
"hash": -1563588817259212000,
"line_mean": 32.9784946237,
"line_max": 79,
"alpha_frac": 0.5231012658,
"autogenerated": false,
"ratio": 3.8349514563106797,
"c... |
# 3rd party modules
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class OptionsMenu(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.player_list = QListWidget()
player_box = QHBoxLayout()
player_box.addWidget(self.player_list)
self.add_... | {
"repo_name": "cdodd/prisoners-dilemma-simulator",
"path": "optionsmenu.py",
"copies": "1",
"size": "3587",
"license": "mit",
"hash": 3283142860762167300,
"line_mean": 33.8252427184,
"line_max": 87,
"alpha_frac": 0.5971563981,
"autogenerated": false,
"ratio": 3.771819137749737,
"config_test": f... |
# 3rd Party Modules
import datetime
import os
from rq import Queue
from .run_worker_all import conn as qconn
from slot import db_fieldbook
from flask import request, redirect, render_template, json
import config
from . import utils
from slot.main import app
from slot import messaging
# Set up RQ queue to add backgr... | {
"repo_name": "nhshd-slot/SLOT",
"path": "slot/controller.py",
"copies": "1",
"size": "5507",
"license": "mit",
"hash": -1743624768873025500,
"line_mean": 32.1746987952,
"line_max": 118,
"alpha_frac": 0.5598329399,
"autogenerated": false,
"ratio": 4.162509448223734,
"config_test": false,
"has... |
# 3rd party modules
import PyQt4.QtCore as QtCore
import PyQt4.QtGui as QtGui
class OptionsMenu(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
# Create the "Lotka-Volterra Coefficients" options
self.a_sb = QtGui.QDoubleSpinBox()
self.b_sb = Q... | {
"repo_name": "cdodd/lotka-volterra-plotter",
"path": "options_menu.py",
"copies": "1",
"size": "5396",
"license": "mit",
"hash": 6142938208820558000,
"line_mean": 34.5,
"line_max": 78,
"alpha_frac": 0.6030392884,
"autogenerated": false,
"ratio": 3.599733155436958,
"config_test": false,
"has_... |
# 3rd party modules
import matplotlib.pyplot as plt
import numpy as np
# local modules
from callables import Constant
from callables import Circular
import draw
import wt_oscillators
def main():
sr = 1000
dur = 1.0
#--------------------------------------------------------------------------
# dr... | {
"repo_name": "weegreenblobbie/sd_audio_hackers",
"path": "20160724_wavetables/code/run_demo.py",
"copies": "1",
"size": "3800",
"license": "mit",
"hash": 784069450833047400,
"line_mean": 22.0303030303,
"line_max": 79,
"alpha_frac": 0.5365789474,
"autogenerated": false,
"ratio": 2.941176470588235... |
# 3rd party
from django.test import TestCase
from django.utils import timezone
import factory
# Own
from portfolio.models import Transaction
from .security_factories import SecurityFactory
from .account_factories import AccountFactory
from .currency_factories import CurrencyFactory
class TransactionFactory(factory... | {
"repo_name": "jokimies/django-pj-portfolio",
"path": "tests/test_transaction_model.py",
"copies": "1",
"size": "1886",
"license": "bsd-3-clause",
"hash": 2968621399080105000,
"line_mean": 26.7352941176,
"line_max": 71,
"alpha_frac": 0.6802757158,
"autogenerated": false,
"ratio": 4.30593607305936... |
# 3rd-party
from lxml.builder import E
# local module
from jnpr.junos.cfg.resource import Resource
class PhyPortBase(Resource):
"""
[edit interfaces <name>]
Resource name: str
<name> is the interface-name (IFD), e.g. 'ge-0/0/0'
"""
PROPERTIES = [
'admin', # True
... | {
"repo_name": "pklimai/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/phyport/base.py",
"copies": "2",
"size": "2565",
"license": "apache-2.0",
"hash": -7887126662052177000,
"line_mean": 29.1764705882,
"line_max": 79,
"alpha_frac": 0.4261208577,
"autogenerated": false,
"ratio": 4.077901430842608,
... |
# 3rd-party
from lxml.builder import E
# local
from jnpr.junos.cfg import Resource
from jnpr.junos import JXML
from jnpr.junos.cfg.phyport.base import PhyPortBase
class PhyPortSwitch(PhyPortBase):
PORT_SPEED = {
'auto': 'auto-negotiation',
'10m': 'ethernet-10m',
'100m': 'ethernet-100m',
... | {
"repo_name": "JamesNickerson/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/phyport/switch.py",
"copies": "10",
"size": "2349",
"license": "apache-2.0",
"hash": -225792791808148700,
"line_mean": 31.625,
"line_max": 77,
"alpha_frac": 0.4929757344,
"autogenerated": false,
"ratio": 3.876237623762376,
... |
# 3rd-party
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class ApplicationSet(Resource):
"""
[edit applications application-set <name>]
Resource name: str
<name> is the application-set name
"""
PROPERTIES = [
... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/app_set.py",
"copies": "1",
"size": "3887",
"license": "apache-2.0",
"hash": 8321137152307202000,
"line_mean": 34.018018018,
"line_max": 79,
"alpha_frac": 0.4767172627,
"autogenerated": false,
"ratio": 4.078698845750262,
"con... |
# 3rd party
from nose.plugins.attrib import attr
# Agent
from checks import AgentCheck
from tests.checks.common import AgentCheckTest
@attr(requires='gearman')
class GearmanTestCase(AgentCheckTest):
CHECK_NAME = "gearmand"
def test_metrics(self):
tags = ['first_tag', 'second_tag']
service_ch... | {
"repo_name": "jyogi/purvar-agent",
"path": "tests/checks/integration/test_gearmand.py",
"copies": "46",
"size": "2041",
"license": "bsd-3-clause",
"hash": -4799839925327136000,
"line_mean": 36.1090909091,
"line_max": 82,
"alpha_frac": 0.6153846154,
"autogenerated": false,
"ratio": 3.345901639344... |
# 3rd party
import gearman
# project
from checks import AgentCheck
class Gearman(AgentCheck):
SERVICE_CHECK_NAME = 'gearman.can_connect'
def get_library_versions(self):
return {"gearman": gearman.__version__}
def _get_client(self,host,port):
self.log.debug("Connecting to gearman at addre... | {
"repo_name": "lookout/dd-agent",
"path": "checks.d/gearmand.py",
"copies": "34",
"size": "2314",
"license": "bsd-3-clause",
"hash": 115428310171543520,
"line_mean": 29.8533333333,
"line_max": 79,
"alpha_frac": 0.5743301642,
"autogenerated": false,
"ratio": 3.7626016260162602,
"config_test": fa... |
# 3rd party
import gearman
# project
from checks import AgentCheck
MAX_NUM_TASKS = 200
class Gearman(AgentCheck):
SERVICE_CHECK_NAME = 'gearman.can_connect'
gearman_clients = {}
def get_library_versions(self):
return {"gearman": gearman.__version__}
def _get_client(self,host,port):
... | {
"repo_name": "StackVista/sts-agent-integrations-core",
"path": "gearmand/check.py",
"copies": "1",
"size": "3744",
"license": "bsd-3-clause",
"hash": 6551118845053240000,
"line_mean": 33.9906542056,
"line_max": 179,
"alpha_frac": 0.5827991453,
"autogenerated": false,
"ratio": 3.770392749244713,
... |
# 3rd party
import logging
import requests
# project
from monasca_agent.collector.checks import AgentCheck
import monasca_agent.collector.checks.services_checks as services_checks
from monasca_agent.common.util import headers
log = logging.getLogger(__name__)
class Etcd(AgentCheck):
DEFAULT_TIMEOUT = 5
SE... | {
"repo_name": "sapcc/monasca-agent",
"path": "monasca_agent/collector/checks_d/etcd.py",
"copies": "1",
"size": "7535",
"license": "bsd-3-clause",
"hash": -7724165326603452000,
"line_mean": 40.8611111111,
"line_max": 125,
"alpha_frac": 0.5682813537,
"autogenerated": false,
"ratio": 3.906168999481... |
# 3rd party
import memcache
# project
from checks import AgentCheck
# Ref: http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt
# Name Type Meaning
# ----------------------------------
# pid 32u Process id of this server process
# uptime 32u Number o... | {
"repo_name": "jamesandariese/dd-agent",
"path": "checks.d/mcache.py",
"copies": "22",
"size": "7699",
"license": "bsd-3-clause",
"hash": -6456080407131517000,
"line_mean": 37.8838383838,
"line_max": 83,
"alpha_frac": 0.5273412131,
"autogenerated": false,
"ratio": 4.157127429805615,
"config_tes... |
# 3rd party
import requests
# project
from checks import AgentCheck
from config import _is_affirmative
from util import headers
class Etcd(AgentCheck):
DEFAULT_TIMEOUT = 5
SERVICE_CHECK_NAME = 'etcd.can_connect'
STORE_RATES = {
'getsSuccess': 'etcd.store.gets.success',
'getsFail': 'etc... | {
"repo_name": "StackVista/sts-agent-integrations-core",
"path": "etcd/check.py",
"copies": "1",
"size": "7617",
"license": "bsd-3-clause",
"hash": 1518905868745106700,
"line_mean": 40.6229508197,
"line_max": 118,
"alpha_frac": 0.5636077196,
"autogenerated": false,
"ratio": 3.958939708939709,
"c... |
# 3rd party
import requests
# project
from checks import AgentCheck
from util import headers
class Etcd(AgentCheck):
DEFAULT_TIMEOUT = 5
SERVICE_CHECK_NAME = 'etcd.can_connect'
STORE_RATES = {
'getsSuccess': 'etcd.store.gets.success',
'getsFail': 'etcd.store.gets.fail',
'setsSu... | {
"repo_name": "Shopify/dd-agent",
"path": "checks.d/etcd.py",
"copies": "1",
"size": "6400",
"license": "bsd-3-clause",
"hash": 3329637165559591400,
"line_mean": 38.751552795,
"line_max": 95,
"alpha_frac": 0.5609375,
"autogenerated": false,
"ratio": 3.970223325062035,
"config_test": false,
"h... |
# 3rd party
import snakebite.client
import snakebite.version
# project
from checks import AgentCheck
# This is only available on snakebite >= 2.2.0
# but snakebite 2.x is only compatible with hadoop >= 2.2.0
# So we bundle snakebite 1.3.9 and let the possibility to upgrade to a newer version
# if people want to use H... | {
"repo_name": "urosgruber/dd-agent",
"path": "checks.d/hdfs.py",
"copies": "5",
"size": "4063",
"license": "bsd-3-clause",
"hash": 6188815789706363000,
"line_mean": 40.0404040404,
"line_max": 112,
"alpha_frac": 0.6118631553,
"autogenerated": false,
"ratio": 3.9523346303501947,
"config_test": fa... |
# 3rd party
from django.core.urlresolvers import reverse
from django.utils import timezone
from rest_framework.test import APITestCase
from rest_framework import status
# Own
from .price_factories import PriceFactory
from .security_factories import SecurityFactory
from .account_base import AccountBase
from .currency... | {
"repo_name": "jokimies/django-pj-portfolio",
"path": "tests/test_account_api.py",
"copies": "1",
"size": "1784",
"license": "bsd-3-clause",
"hash": -7623146752072046000,
"line_mean": 31.4363636364,
"line_max": 79,
"alpha_frac": 0.5969730942,
"autogenerated": false,
"ratio": 4.71957671957672,
"... |
# 3rd-party packages
from lxml.builder import E
# local packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class PolicyRule(Resource):
"""
[edit security policy from-zone <from_zone> to-zone <to_zone> policy
<policy_name>]
Resource name: str
<policy_name> is ... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "lib/jnpr/junos/cfg/srx/policy_rule.py",
"copies": "1",
"size": "5247",
"license": "apache-2.0",
"hash": -8668509499321357000,
"line_mean": 29.6842105263,
"line_max": 79,
"alpha_frac": 0.4863731656,
"autogenerated": false,
"ratio": 3.8076923076923075,... |
"""3rd update that adds Games table with API_KEY and backref on scores
Revision ID: 37a45401820b
Revises: 3414dfab0e91
Create Date: 2015-11-01 15:07:23.655544
"""
# revision identifiers, used by Alembic.
revision = '37a45401820b'
down_revision = '3414dfab0e91'
from alembic import op
import sqlalchemy as sa
def up... | {
"repo_name": "Rdbaker/GameCenter",
"path": "migrations/versions/37a45401820b_.py",
"copies": "2",
"size": "1092",
"license": "mit",
"hash": -6060552879588632000,
"line_mean": 29.3333333333,
"line_max": 80,
"alpha_frac": 0.6694139194,
"autogenerated": false,
"ratio": 3.309090909090909,
"config_... |
## 3. Read in a CSV file ##
import pandas as pd
food_info = pd.read_csv('food_info.csv')
print(type(food_info))
## 4. Exploring the DataFrame ##
print(food_info.head(3))
dimensions = food_info.shape
print(dimensions)
num_rows = dimensions[0]
print(num_rows)
num_cols = dimensions[1]
print(num_cols)
first_twenty = foo... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Data Analysis with Pandas Intermediate/Introduction to Pandas-8.py",
"copies": "1",
"size": "1392",
"license": "mit",
"hash": 6325883632415342000,
"line_mean": 21.4677419355,
"line_max": 84,
"alpha_frac": 0.6817528736,
"autogenerated": f... |
# 3SAT test
from random import randrange
import datetime
#predlist = {(0,1,2):0, (0,1,3):0}
#negs = {(0,1,2):255, (0,1,3):255}
def make_ks(reverse=False):
"""ks are the bits of the ints from 0 to 7, used as truth flags
for vars in predicates. I.e. 0 means the denial of a var, 0 for var X means notX
1 for var X ... | {
"repo_name": "orneryhippo/saturdays",
"path": "rabbit/3sat.py",
"copies": "1",
"size": "14850",
"license": "apache-2.0",
"hash": 7573117678572639000,
"line_mean": 21.5341426404,
"line_max": 139,
"alpha_frac": 0.5853872054,
"autogenerated": false,
"ratio": 2.2664835164835164,
"config_test": fal... |
# 3SAT test
from random import randrange
import datetime
T = 1
F = 0
S = 2
#predlist = {(0,1,2):0, (0,1,3):0}
#negs = {(0,1,2):255, (0,1,3):255}
def make_ks(reverse=False):
"""ks are the bits of the ints from 0 to 7, used as truth flags
for vars in predicates. I.e. 0 means the denial of a var, 0 for var X means ... | {
"repo_name": "orneryhippo/saturdays",
"path": "rabbit/sat.py",
"copies": "1",
"size": "15931",
"license": "apache-2.0",
"hash": -7419837833132468000,
"line_mean": 21.2825174825,
"line_max": 139,
"alpha_frac": 0.5865921788,
"autogenerated": false,
"ratio": 2.262926136363636,
"config_test": fals... |
""" 3: Sorting
thomas moll 2015
"""
def selection_sort(arr):
""" Selection Sort
Complexity: O(n^2)
"""
for i in xrange(len(arr)):
minimum = i
for j in xrange(i+1, len(arr)):
# "Select" the correct value
if arr[j] < arr[minimum]:
... | {
"repo_name": "aravindk1992/Data-Structure-Zoo",
"path": "2-Sorting/sorting.py",
"copies": "15",
"size": "2428",
"license": "mit",
"hash": 4041419608848496600,
"line_mean": 25.5909090909,
"line_max": 64,
"alpha_frac": 0.5251235585,
"autogenerated": false,
"ratio": 3.701219512195122,
"config_tes... |
## 3. Statistical significance ##
import numpy as np
import matplotlib.pyplot as plt
mean_group_a = np.mean(weight_lost_a)
mean_group_b = np.mean(weight_lost_b)
print(mean_group_a)
print(mean_group_b)
plt.hist(weight_lost_a)
plt.show()
plt.hist(weight_lost_b)
plt.show()
## 4. Test statistic ##
mean_difference = mean... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Probability Statistics Intermediate/Significance Testing-174.py",
"copies": "1",
"size": "1296",
"license": "mit",
"hash": 6481278559021243000,
"line_mean": 23.9423076923,
"line_max": 73,
"alpha_frac": 0.6782407407,
"autogenerated": fals... |
''' 3-statistics-step.py
=========================
AIM: Perform basic statistics on the data
INPUT: files: - <orbit_id>_misc/orbits.dat
variables: see section PARAMETERS (below)
OUTPUT: in <orbit_id>_misc/ : file one stat file
in <orbit_id>_figures/ : step distribution, step in function of time
CMD: python 3-sta... | {
"repo_name": "kuntzer/SALSA-public",
"path": "3a_statistics-step.py",
"copies": "1",
"size": "3499",
"license": "bsd-3-clause",
"hash": -6356447390310369000,
"line_mean": 23.9928571429,
"line_max": 96,
"alpha_frac": 0.6261789083,
"autogenerated": false,
"ratio": 2.998286203941731,
"config_test... |
"""3Sum Closest
Given an array nums of n integers and an integer target, find three integers in nums such that
the sum is closest to target. Return the sum of the three integers. You may assume that each
input would have exactly one solution.
Example:
Given array nums = [-1, 2, 1, -4], and target = 1.
The sum that... | {
"repo_name": "aiden0z/snippets",
"path": "leetcode/016_3sum_closest.py",
"copies": "1",
"size": "1459",
"license": "mit",
"hash": -8590764666176566000,
"line_mean": 26.0185185185,
"line_max": 95,
"alpha_frac": 0.4790952707,
"autogenerated": false,
"ratio": 3.5585365853658537,
"config_test": fa... |
"""3Sum
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0?
Find all unique triplets in the array which gives the sum of zero.
Note:
The solution set must not contain duplicate triplets.
Example:
Given array nums = [-1, 0, 1, 2, -1, -4],
A solution set is:
[
[-1, 0, 1]... | {
"repo_name": "aiden0z/snippets",
"path": "leetcode/015_3sum.py",
"copies": "1",
"size": "2641",
"license": "mit",
"hash": -6816610962878905000,
"line_mean": 26.5104166667,
"line_max": 98,
"alpha_frac": 0.4070427868,
"autogenerated": false,
"ratio": 3.4568062827225132,
"config_test": false,
"... |
datasets = [(train_set_x, train_set_y), (valid_set_x, valid_set_y), (test_set_x, test_set_y)]
n_train_batches = train_set_x.get_value(borrow=True).shape[0] / batch_size
numpy_rng = numpy.random.RandomState(123)
print '... building the model'
# construct the Deep Belief Network
dbn = DBN(numpy_rng=numpy_rng, n_ins=41,
... | {
"repo_name": "myt00seven/svrg",
"path": "cifar/jaehoon_sample.py",
"copies": "2",
"size": "1684",
"license": "mit",
"hash": -4094763895159368000,
"line_mean": 38.1860465116,
"line_max": 93,
"alpha_frac": 0.580760095,
"autogenerated": false,
"ratio": 2.9337979094076654,
"config_test": true,
"... |
## 3. The Math Module ##
import math
a = math.sqrt(16)
b= math.ceil(111.3)
c = math.floor(89.9)
## 4. Variables Within Modules ##
import math
print(math.pi)
a = math.sqrt(math.pi)
b = math.ceil(math.pi)
c = math.floor(math.pi)
## 5. The CSV Module ##
import csv
nfl = list(csv.reader(open('nfl.csv')))
## 6. Coun... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Python Programming Intermediate/Modules-5.py",
"copies": "1",
"size": "1674",
"license": "mit",
"hash": 1337254694158573600,
"line_mean": 18.2528735632,
"line_max": 71,
"alpha_frac": 0.5955794504,
"autogenerated": false,
"ratio": 2.483... |
3#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 15 13:47:44 2018
@author: BallBlueMeercat
"""
import random
import numpy as np
import zodesolve
import tools
import matplotlib.pyplot as plt
def redshift_picks(zmin, zmax, n):
"""
Takes in:
zmin = integer lowest redshift;
z... | {
"repo_name": "lefthandedroo/Cosmo-models",
"path": "Models/datasim.py",
"copies": "1",
"size": "10689",
"license": "mit",
"hash": 824570707624332400,
"line_mean": 33.4838709677,
"line_max": 167,
"alpha_frac": 0.6037982973,
"autogenerated": false,
"ratio": 3.2341906202723147,
"config_test": fal... |
3#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 15 13:47:44 2018
@author: BallBlueMeercat
"""
import random
import numpy as np
import zodesolve
import tools
def redshift_picks(zmin, zmax, n):
"""
Takes in:
zmin = integer lowest redshift;
zmax = integer highest redshift;
... | {
"repo_name": "lefthandedroo/Cosmo-models",
"path": "zprev versions/Models_py_backup/Models backup/datasim.py",
"copies": "1",
"size": "10286",
"license": "mit",
"hash": -3383922935678809000,
"line_mean": 32.2912621359,
"line_max": 91,
"alpha_frac": 0.596538985,
"autogenerated": false,
"ratio": 3... |
3#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 15 13:47:44 2018
@author: BallBlueMeercat
"""
from math import log10
import numpy as np
import odesolve
#import lnprior
# Empirical parameters.
M = -19 # Absolute brightness of supernovae.
def msim(gamma, m, de, zpicks):
... | {
"repo_name": "lefthandedroo/Cosmo-models",
"path": "zprev versions/msim.py",
"copies": "1",
"size": "2233",
"license": "mit",
"hash": 8328949473519787000,
"line_mean": 19.4862385321,
"line_max": 141,
"alpha_frac": 0.5620241827,
"autogenerated": false,
"ratio": 2.787765293383271,
"config_test":... |
"3-value logic (i.e. the way that boolean ops on nulls propagate up in the expression tree in SQL). doesn't rhyme with 'evil' but should."
class ThreeVL:
"Implementation of sql's 3VL. Warning: use == != for comparing python values, not for 3vl comparison. Caveat emptor."
# todo(awinter): is there any downside to u... | {
"repo_name": "abe-winter/pg13-py",
"path": "pg13/threevl.py",
"copies": "1",
"size": "2964",
"license": "mit",
"hash": 8921190341957108000,
"line_mean": 40.1666666667,
"line_max": 138,
"alpha_frac": 0.6477732794,
"autogenerated": false,
"ratio": 3.6014580801944107,
"config_test": false,
"has... |
""" 3-way String Quicksort.
An excellent algorithm to sort any kind of strings. In most cases,
it will perform better than LSD and MSD radix sorts.
Characteristics:
- O(W * N * log(N)).
- Extra memory usage: log(N) + W.
- It isn't stable.
- Has a short inner loop.
- Is cache-friendly (MSD Radix Sor... | {
"repo_name": "rcanepa/cs-fundamentals",
"path": "python/strings/three_way_quicksort.py",
"copies": "1",
"size": "2329",
"license": "mit",
"hash": 8124195156897148000,
"line_mean": 26.4,
"line_max": 86,
"alpha_frac": 0.5607556891,
"autogenerated": false,
"ratio": 3.5611620795107033,
"config_tes... |
3. XOR decryption:
Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A = 65, asterisk (*) = 42, and lowercase k = 107.
A modern encryption method is to take a text file, convert the bytes to ASCII, then... | {
"repo_name": "ojengwa/reportr",
"path": "apps/users/templates/users/xor.py",
"copies": "2",
"size": "2487",
"license": "mit",
"hash": 7146817627389416000,
"line_mean": 48.76,
"line_max": 351,
"alpha_frac": 0.6413349417,
"autogenerated": false,
"ratio": 4.124378109452737,
"config_test": false,
... |
# 400 Nth Digit
# Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...
#
# Note:
# n is positive and will fit within the range of a 32-bit signed integer (n < 231).
#
# Example 1:
#
# Input:
# 3
#
# Output:
# 3
#
# Example 2:
#
# Input:
# 11
#
# Output:
# 0
#
# Explanation:
# The ... | {
"repo_name": "gengwg/leetcode",
"path": "400_nth_digit.py",
"copies": "1",
"size": "1132",
"license": "apache-2.0",
"hash": 2657442882156131000,
"line_mean": 20.0204081633,
"line_max": 111,
"alpha_frac": 0.5106796117,
"autogenerated": false,
"ratio": 2.470023980815348,
"config_test": false,
... |
# 401. Binary Watch
# A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).
# Each LED represents a zero or one, with the least significant bit on the right.
# off off on on
# off on on off off ... | {
"repo_name": "aenon/OnlineJudge",
"path": "leetcode/5.BitManipulation/401.BinaryWatch.py",
"copies": "1",
"size": "2498",
"license": "mit",
"hash": 4058486185705010700,
"line_mean": 32.32,
"line_max": 156,
"alpha_frac": 0.5352281825,
"autogenerated": false,
"ratio": 3.668135095447871,
"config_... |
# 401. Binary Watch
# A binary watch has 4 LEDs on the top which represent the hours (0-11),
# and the 6 LEDs on the bottom represent the minutes (0-59).
#
# Each LED represents a zero or one, with the least significant bit on the right.
#
# For example, the above binary watch reads "3:25".
#
# Given a non-negative in... | {
"repo_name": "gengwg/leetcode",
"path": "401_binary_watch.py",
"copies": "1",
"size": "1897",
"license": "apache-2.0",
"hash": -424775331828466050,
"line_mean": 30.8,
"line_max": 102,
"alpha_frac": 0.586049171,
"autogenerated": false,
"ratio": 2.7074303405572757,
"config_test": false,
"has_n... |
"""4.0.1
Revision ID: 9aa6f74c9653
Revises: 333998bc1627
Create Date: 2017-04-26 13:16:33.880756
"""
from alembic import op
import sqlalchemy as sa
import manager_rest # Adding this manually
# revision identifiers, used by Alembic.
revision = '9aa6f74c9653'
down_revision = '333998bc1627'
branch_labels = None
de... | {
"repo_name": "isaac-s/cloudify-manager",
"path": "resources/rest-service/cloudify/migrations/versions/9aa6f74c9653_4_0_1.py",
"copies": "2",
"size": "21085",
"license": "apache-2.0",
"hash": 6190044995742350000,
"line_mean": 28.8654390935,
"line_max": 79,
"alpha_frac": 0.5412852739,
"autogenerated... |
# 402. Remove K Digits
# Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.
#
# Note:
#
# The length of num is less than 10002 and will be ≥ k.
# The given num does not contain any leading zero.
#
# Example 1:
#
# Input: nu... | {
"repo_name": "gengwg/leetcode",
"path": "402_remove_k_digits.py",
"copies": "1",
"size": "1517",
"license": "apache-2.0",
"hash": -593435708085099900,
"line_mean": 30.5625,
"line_max": 140,
"alpha_frac": 0.6244224422,
"autogenerated": false,
"ratio": 3.315098468271335,
"config_test": false,
... |
#40/40
#Part 1: Terminology (15 points) --> 15/15
#1 1pt) What is the symbol "=" used for?
#to assign and store values to and in variables
# 1pt
#
#2 3pts) Write a technical definition for 'function'
#a named sequence of calculations which takes input and returns output
# 3pts
#
#3 1pt) What does the keyword "return" d... | {
"repo_name": "ieuan1630-cmis/ieuan1630-cmis-cs2",
"path": "cs2quiz1.py",
"copies": "1",
"size": "2934",
"license": "cc0-1.0",
"hash": -890083904744678400,
"line_mean": 27.2115384615,
"line_max": 173,
"alpha_frac": 0.6932515337,
"autogenerated": false,
"ratio": 3.04989604989605,
"config_test": ... |
# 406. Queue Reconstruction by Height
# Suppose you have a random list of people standing in a queue.
# Each person is described by a pair of integers (h, k),
# where h is the height of the person
# and k is the number of people in front of this person who have a height greater than or equal to h.
# Write an algori... | {
"repo_name": "gengwg/leetcode",
"path": "406_queue_reconstruction_by_height.py",
"copies": "1",
"size": "2319",
"license": "apache-2.0",
"hash": 1504007671268904000,
"line_mean": 31.2083333333,
"line_max": 121,
"alpha_frac": 0.5286761535,
"autogenerated": false,
"ratio": 3.059366754617414,
"co... |
# 40824
import euler
s = """
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
622298934233803081353362766142828064... | {
"repo_name": "higgsd/euler",
"path": "py/8.py",
"copies": "1",
"size": "1212",
"license": "bsd-2-clause",
"hash": -9190594148758780000,
"line_mean": 35.7272727273,
"line_max": 50,
"alpha_frac": 0.900990099,
"autogenerated": false,
"ratio": 2.312977099236641,
"config_test": false,
"has_no_key... |
# 408 Valid Word Abbreviation
# Given a non-empty string s and an abbreviation abbr,
# return whether the string matches with the given abbreviation.
#
# A string such as “word” contains only the following valid abbreviations:
#
# [“word”, “1ord”, “w1rd”, “wo1d”, “wor1”, “2rd”, “w2d”, “wo2”, “1o1d”, “1or1”, “w1r1”, “1... | {
"repo_name": "gengwg/leetcode",
"path": "408_valid_word_abbreviation.py",
"copies": "1",
"size": "2077",
"license": "apache-2.0",
"hash": 164963088853278980,
"line_mean": 37.3958333333,
"line_max": 118,
"alpha_frac": 0.6098752035,
"autogenerated": false,
"ratio": 2.5561719833564496,
"config_te... |
# 409. Longest Palindrome
#
# Given a string which consists of lowercase or uppercase letters,
# find the length of the longest palindromes that can be built with those letters.
#
# This is case sensitive, for example "Aa" is not considered a palindrome here.
#
# Note:
# Assume the length of given string will not excee... | {
"repo_name": "gengwg/leetcode",
"path": "409_longest_palindrome.py",
"copies": "1",
"size": "1071",
"license": "apache-2.0",
"hash": 2610282620638048000,
"line_mean": 22.8,
"line_max": 82,
"alpha_frac": 0.5602240896,
"autogenerated": false,
"ratio": 3.5,
"config_test": false,
"has_no_keyword... |
"""4.0
Revision ID: 333998bc1627
Revises:
Create Date: 2017-04-26 12:42:40.587570
"""
from alembic import op
import sqlalchemy as sa
import manager_rest # Adding this manually
# revision identifiers, used by Alembic.
revision = '333998bc1627'
down_revision = None
branch_labels = None
depends_on = None
snapshot... | {
"repo_name": "cloudify-cosmo/cloudify-manager",
"path": "resources/rest-service/cloudify/migrations/versions/333998bc1627_4_0.py",
"copies": "2",
"size": "30101",
"license": "apache-2.0",
"hash": 7948732062613431000,
"line_mean": 34.7494061758,
"line_max": 79,
"alpha_frac": 0.5666256935,
"autogene... |
# 412. Fizz Buzz
# Difficulty:Easy
# Write a program that outputs the string representation of numbers from 1 to n.
#
# But for multiples of three it should output “Fizz” instead of the number
# and for the multiples of five output “Buzz”. For numbers which are
# multiples of both three and five output “FizzBuzz”.
#
# ... | {
"repo_name": "kingdaa/LC-python",
"path": "lc/412_Fizz_Buzz.py",
"copies": "1",
"size": "1109",
"license": "mit",
"hash": -832843010177393000,
"line_mean": 19.3148148148,
"line_max": 80,
"alpha_frac": 0.4703737466,
"autogenerated": false,
"ratio": 2.97289972899729,
"config_test": false,
"has... |
# 4-13-15
# John Vivian
"""
'Hello World' script for Toil
"""
from optparse import OptionParser
import os
from toil.job import Job
def hello_world(job, memory=100, cpu=0.5):
with open('foo_bam.txt', 'w') as handle:
handle.write('\nThis is a triumph...\n')
# Assign FileStoreID to a given file
fo... | {
"repo_name": "BD2KGenomics/toil-old",
"path": "src/toil/test/mesos/helloWorld.py",
"copies": "1",
"size": "1553",
"license": "mit",
"hash": -2727765192827979300,
"line_mean": 25.7931034483,
"line_max": 81,
"alpha_frac": 0.6471345782,
"autogenerated": false,
"ratio": 3.2902542372881354,
"config... |
import json
import requests
import csv
# url for get requests
url1 = """https://api.nutritionix.com/v1_1/search/?brand_id=51db37d0176fe9790a899db2&results=150%3A200&cal_min=0&cal_max=50000&fields=*&appId=[YourAPPId]2&appKey=[YourAPPKey]"""
# using requests library to pull the data
results = requests.get(url1)
resul... | {
"repo_name": "yedurag/juicevisrepo",
"path": "extras/initialanalysis.py",
"copies": "1",
"size": "5207",
"license": "apache-2.0",
"hash": -2722047756246722000,
"line_mean": 42.756302521,
"line_max": 177,
"alpha_frac": 0.4215479163,
"autogenerated": false,
"ratio": 4.353678929765886,
"config_te... |
# 415. Add Strings
# Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.
#
# Note:
#
# The length of both num1 and num2 is < 5100.
# Both num1 and num2 contains only digits 0-9.
# Both num1 and num2 does not contain any leading zero.
# You must not use ... | {
"repo_name": "gengwg/leetcode",
"path": "415_add_strings.py",
"copies": "1",
"size": "1340",
"license": "apache-2.0",
"hash": -1269664298907563300,
"line_mean": 22.9285714286,
"line_max": 103,
"alpha_frac": 0.5320895522,
"autogenerated": false,
"ratio": 3.526315789473684,
"config_test": false,... |
# the app file for the flask app
# importing required libraries
from flask import Flask, render_template, request,jsonify
from flask.ext.sqlalchemy import SQLAlchemy
from rq import Queue
from rq.job import Job
from worker import conn
import json
import requests
import os
import time
import dateti... | {
"repo_name": "yedurag/juicevisrepo",
"path": "app.py",
"copies": "1",
"size": "18821",
"license": "apache-2.0",
"hash": -6919481732262092000,
"line_mean": 36.6468172485,
"line_max": 203,
"alpha_frac": 0.5349343818,
"autogenerated": false,
"ratio": 4.019004911381593,
"config_test": false,
"ha... |
import json
import requests
import csv
import re
from nltk.stem.porter import *
stemmer = PorterStemmer()
from nltk.corpus import stopwords
cachedStopWords = stopwords.words("english")
# url for get requests
url1 = """https://api.nutritionix.com/v1_1/search/?brand_id=51db37d0176fe9790a899db2&results=0%3A50... | {
"repo_name": "yedurag/juicevisrepo",
"path": "extras/ingredientsanalysis.py",
"copies": "1",
"size": "2998",
"license": "apache-2.0",
"hash": 4670427632427565000,
"line_mean": 29.5578947368,
"line_max": 157,
"alpha_frac": 0.6891260841,
"autogenerated": false,
"ratio": 3.0160965794768613,
"conf... |
# 417. Pacific Atlantic Water Flow
# Given an m x n matrix of non-negative integers representing the height of each unit cell
# in a continent, the "Pacific ocean" touches the left and top edges of the matrix
# and the "Atlantic ocean" touches the right and bottom edges.
# Water can only flow in four directions (up... | {
"repo_name": "gengwg/leetcode",
"path": "417_pacific_atlantic_water_flow.py",
"copies": "1",
"size": "4131",
"license": "apache-2.0",
"hash": 1753416869539688200,
"line_mean": 37.9716981132,
"line_max": 135,
"alpha_frac": 0.5565238441,
"autogenerated": false,
"ratio": 3.217289719626168,
"confi... |
# 4/18/2014
# Charles O. Goddard
from __future__ import print_function
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from bs4 import BeautifulSoup, Comment
import os
import sys
import pickle
def striptext(text):
words = []
soup = BeautifulSoup(text, 'html5lib')
elems = [e... | {
"repo_name": "thomasnat1/DataScience2014CDC",
"path": "tfidf_search.py",
"copies": "1",
"size": "2453",
"license": "mit",
"hash": -7311856517917559000,
"line_mean": 34.0428571429,
"line_max": 329,
"alpha_frac": 0.6322869955,
"autogenerated": false,
"ratio": 3.529496402877698,
"config_test": fa... |
""" (4.1) Add RabbitMQ details to tenant model
Revision ID: 730403566523
Revises: 9aa6f74c9653
Create Date: 2017-05-10 15:33:46.837856
"""
from alembic import op
import sqlalchemy as sa
import manager_rest # Adding this manually
# revision identifiers, used by Alembic.
revision = '730403566523'
down_revision = ... | {
"repo_name": "isaac-s/cloudify-manager",
"path": "resources/rest-service/cloudify/migrations/versions/730403566523_4_1.py",
"copies": "1",
"size": "6587",
"license": "apache-2.0",
"hash": -7607092783233020000,
"line_mean": 64.2178217822,
"line_max": 126,
"alpha_frac": 0.6802793381,
"autogenerated"... |
""" (4.1) Add RabbitMQ details to tenant model
Revision ID: 730403566523
Revises: 9aa6f74c9653
Create Date: 2017-05-10 15:33:46.837856
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '730403566523'
down_revision = '9aa6f74c9653'
branch_labels = None
depends_on =... | {
"repo_name": "cloudify-cosmo/cloudify-manager",
"path": "resources/rest-service/cloudify/migrations/versions/730403566523_4_1.py",
"copies": "1",
"size": "7906",
"license": "apache-2.0",
"hash": 8030892484953816000,
"line_mean": 29.2911877395,
"line_max": 79,
"alpha_frac": 0.562357703,
"autogenera... |
#41. 模仿静态变量的用法。
class TestStatic:
staticVar = 10
def up_static(self):
self.staticVar += 1
print('this is to imitate the static var : ', self.staticVar)
print(TestStatic.staticVar)
x = TestStatic()
for i in range(3):
x.up_static()
#42. 学习使用auto定义变量的用法。
# auto 出自C: 函数中的局部变量,如不专门声明static,... | {
"repo_name": "cwenao/python_web_learn",
"path": "base100/base100/base_41-50.py",
"copies": "1",
"size": "2066",
"license": "apache-2.0",
"hash": 8483115535543728000,
"line_mean": 15.7777777778,
"line_max": 69,
"alpha_frac": 0.5529801325,
"autogenerated": false,
"ratio": 2.029115341545353,
"con... |
# 421. Maximum XOR of Two Numbers in an Array
# Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231.
#
# Find the maximum result of ai XOR aj, where 0 ≤ i, j < n.
#
# Could you do this in O(n) runtime?
#
# Example:
#
# Input: [3, 10, 5, 25, 2, 8]
#
# Output: 28
#
# Explanation: The maximum res... | {
"repo_name": "gengwg/leetcode",
"path": "421_maximum_xor_two_numbers_in_array.py",
"copies": "1",
"size": "2160",
"license": "apache-2.0",
"hash": 3189268984080900600,
"line_mean": 28.9166666667,
"line_max": 117,
"alpha_frac": 0.4726090994,
"autogenerated": false,
"ratio": 3.6020066889632107,
... |
""" (4.2) Add resource_availability property to a resource
Revision ID: 4dfd8797fdfa
Revises: 3496c876cd1a
Create Date: 2017-09-27 15:57:27.933008
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql # Adding this manually
# revision identifiers, used by Alembic.
revision =... | {
"repo_name": "cloudify-cosmo/cloudify-manager",
"path": "resources/rest-service/cloudify/migrations/versions/4dfd8797fdfa_4_2.py",
"copies": "1",
"size": "2927",
"license": "apache-2.0",
"hash": -3770660208741267500,
"line_mean": 40.8142857143,
"line_max": 77,
"alpha_frac": 0.6334130509,
"autogene... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.