text stringlengths 0 1.05M | meta dict |
|---|---|
"""Basic algorithms for breadth-first searching the nodes of a graph."""
import networkx as nx
from .breadth_first_search import generic_bfs_edges
__all__ = ['bfs_beam_edges']
def bfs_beam_edges(G, source, value, width=None):
"""Iterates over edges in a beam search.
The beam search is a generalized breadth... | {
"repo_name": "goulu/networkx",
"path": "networkx/algorithms/traversal/beamsearch.py",
"copies": "5",
"size": "3538",
"license": "bsd-3-clause",
"hash": -1318494968792474400,
"line_mean": 35.1020408163,
"line_max": 76,
"alpha_frac": 0.6466930469,
"autogenerated": false,
"ratio": 4.09965237543453,... |
"""
===========
Beam Search
===========
Beam search with dynamic beam width.
The progressive widening beam search repeatedly executes a beam search
with increasing beam width until the target node is found.
"""
import math
import networkx as nx
def progressive_widening_search(G, source, value, condition, initial_w... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/share/doc/networkx-2.4/examples/algorithms/plot_beam_search.py",
"copies": "1",
"size": "3830",
"license": "mit",
"hash": -7163742673466273000,
"line_mean": 36.9207920792,
"line_max": 78,
"alpha_frac": 0.701305483,
"autogenerated": false... |
"""Beam search with dynamic beam width.
The progressive widening beam search repeatedly executes a beam search
with increasing beam width until the target node is found.
"""
import math
import networkx as nx
def progressive_widening_search(G, source, value, condition, initial_width=1):
"""Progressive widening ... | {
"repo_name": "goulu/networkx",
"path": "examples/algorithms/beam_search.py",
"copies": "4",
"size": "3912",
"license": "bsd-3-clause",
"hash": -2889826119533222000,
"line_mean": 37.3529411765,
"line_max": 78,
"alpha_frac": 0.7065439673,
"autogenerated": false,
"ratio": 4.104931794333683,
"conf... |
"""Beancount plugin to link transactions to documents.
It goes through all transactions with a `document` metadata-key, and tries to
associate them to Document entries. It then adds a link from transactions to
documents, as well as the "#linked" tag.
"""
from collections import defaultdict
from os.path import basename... | {
"repo_name": "yagebu/fava",
"path": "src/fava/plugins/link_documents.py",
"copies": "2",
"size": "3193",
"license": "mit",
"hash": 3760945683794383400,
"line_mean": 30,
"line_max": 79,
"alpha_frac": 0.5900407141,
"autogenerated": false,
"ratio": 4.392022008253095,
"config_test": false,
"has_... |
"""Beancount plugin to tag discovered documents.
It looks through all Document entries that were added by Beancount
automatically through file discovery and adds the tag "#discovered".
"""
from typing import List
from typing import Tuple
from beancount.core.data import Document
from beancount.core.data import Entries... | {
"repo_name": "yagebu/fava",
"path": "src/fava/plugins/tag_discovered_documents.py",
"copies": "2",
"size": "1118",
"license": "mit",
"hash": 6891722062620929000,
"line_mean": 30.0555555556,
"line_max": 70,
"alpha_frac": 0.6842576029,
"autogenerated": false,
"ratio": 4.125461254612546,
"config_... |
beatbox.You.generate_realizations_from_posterior(beatbox.You.all_reconstructed_universes[0].fn, number_of_realizations=1000)
#for k in range(10):
# beatbox.You.all_simulated_universes[-1-k].show_CMB_T_map(from_perspective_of = "observer")
#for k in range(10):
# beatbox.You.all_simulated_universes[-1-k].show... | {
"repo_name": "LaurencePeanuts/Music",
"path": "Scripts/_PlotMargPost.py",
"copies": "2",
"size": "1717",
"license": "mit",
"hash": -4889177260676739000,
"line_mean": 38.0454545455,
"line_max": 218,
"alpha_frac": 0.7012230635,
"autogenerated": false,
"ratio": 2.3913649025069637,
"config_test": ... |
#################################### MODULES ####################################
from scipy import *
from math import *
################################### CONSTANTS ###################################
################################### FUNCTIONS ###################################
############### DetectBeat #... | {
"repo_name": "KappaEtaKappa/Sound-2-Disco",
"path": "KHK Light Show/KHK LightShow Versions/0.2.0/BeatDetection.py",
"copies": "1",
"size": "4169",
"license": "mit",
"hash": -880924410776916900,
"line_mean": 27.9513888889,
"line_max": 81,
"alpha_frac": 0.495562485,
"autogenerated": false,
"ratio"... |
from scipy import zeros
from numpy import average
########################################### CONSTANTS ##############################################
######################################### STATIC METHODS ###########################################
###################### calcTriggerLevel #####################... | {
"repo_name": "KappaEtaKappa/Sound-2-Disco",
"path": "KHK Light Show/KHK Light Show/2.x.x/2.0.0/BeatDetector.py",
"copies": "1",
"size": "7339",
"license": "mit",
"hash": 8410112875824247000,
"line_mean": 25.4028776978,
"line_max": 100,
"alpha_frac": 0.6105736476,
"autogenerated": false,
"ratio":... |
########################################### CONSTANTS ##############################################
######################################### STATIC METHODS ###########################################
############################################ CLASSES ###############################################
#######... | {
"repo_name": "KappaEtaKappa/Sound-2-Disco",
"path": "KHK Light Show/KHK Light Show/2.x.x/2.0.0/MusicFrameData.py",
"copies": "1",
"size": "2679",
"license": "mit",
"hash": -5448507730956263000,
"line_mean": 43.6666666667,
"line_max": 100,
"alpha_frac": 0.5938783128,
"autogenerated": false,
"rati... |
#beatDetected; # boolean: True if beat was detected
#triggerConstant; # float: Constant used for comparison of energyLevel to
# historyBuffer
#triggerCalc_A # float: Constant used for triggerConstant generation
# from equation: C = AV+B.
#triggerCalc_B # float: Constant used for triggerConsta... | {
"repo_name": "KappaEtaKappa/Sound-2-Disco",
"path": "KHK Light Show/KHK Light Show/2.x.x/2.0.0/Old/BeatDetector_old.py",
"copies": "1",
"size": "9246",
"license": "mit",
"hash": 739701429336005800,
"line_mean": 25.3447293447,
"line_max": 80,
"alpha_frac": 0.6802941813,
"autogenerated": false,
"r... |
#Beating Uber Bot on the Car Parking In Parking Lot game was fun
#Try out on https://codefights.com/signup/6BDTrS8CLRjtZkKWe/company-bots/bot_uber
def parkingSpot(carDimensions, parkingLot, luckySpot):
width = carDimensions[1]
length = carDimensions[0]
enter = 0
def frmLeft():
if length > len(p... | {
"repo_name": "jcchuks/MiscCodes",
"path": "CarParkingInParkingLot.py",
"copies": "2",
"size": "6442",
"license": "mit",
"hash": 4810611837457798000,
"line_mean": 35.191011236,
"line_max": 151,
"alpha_frac": 0.3765911208,
"autogenerated": false,
"ratio": 5.017133956386293,
"config_test": false,... |
"""Beatles Dataset Loader
.. admonition:: Dataset Info
:class: dropdown
The Beatles Dataset includes beat and metric position, chord, key, and segmentation
annotations for 179 Beatles songs. Details can be found in http://matthiasmauch.net/_pdf/mauch_omp_2009.pdf and
http://isophonics.net/content/refe... | {
"repo_name": "mir-dataset-loaders/mirdata",
"path": "mirdata/datasets/beatles.py",
"copies": "1",
"size": "9520",
"license": "bsd-3-clause",
"hash": -863432912989676200,
"line_mean": 28.2024539877,
"line_max": 115,
"alpha_frac": 0.6179621849,
"autogenerated": false,
"ratio": 3.5655430711610485,
... |
# beatmap.py
# Parses a mania .osu file and returns an object of the beatmap class
import operator
import textwrap
from pprint import pprint
class Beatmap(object):
def __init__(self, beatmap_path):
self.file_format = None
# [General]
self.audio_file_name = None
self.aud... | {
"repo_name": "Swan/ManiaStarReducer",
"path": "beatmap.py",
"copies": "1",
"size": "17174",
"license": "mit",
"hash": 1109940640130642600,
"line_mean": 39.4830917874,
"line_max": 141,
"alpha_frac": 0.4408408059,
"autogenerated": false,
"ratio": 4.6253703204955565,
"config_test": false,
"has_... |
#Beatriz Pessoa Longato 1615310001
#Equipe 3
carros=[]
kmsporlitro=[]
litrospara1000=[]
precopara1000=[]
menor_consumo=0
pos=0
print " "
print "Comparativo de Consumo de Combustível"
print " "
for i in range (5):
carro=raw_input('Veículo: ' )
kmporlitro= float(raw_input("Km por litro: "))
... | {
"repo_name": "any1m1c/ipc20161",
"path": "lista4/ipc_lista4.21.py",
"copies": "1",
"size": "1161",
"license": "apache-2.0",
"hash": -1620822078029572400,
"line_mean": 14.6351351351,
"line_max": 75,
"alpha_frac": 0.5747623163,
"autogenerated": false,
"ratio": 2.7287735849056602,
"config_test": ... |
"""Beat Scheduler Implementation."""
from __future__ import absolute_import, unicode_literals
import datetime
import logging
from multiprocessing.util import Finalize
from celery import current_app
from celery import schedules
from celery.beat import Scheduler, ScheduleEntry
from celery.five import values, items
fro... | {
"repo_name": "cloudera/hue",
"path": "desktop/core/ext-py/django-celery-beat-1.4.0/django_celery_beat/schedulers.py",
"copies": "2",
"size": "12387",
"license": "apache-2.0",
"hash": 4293570326713182000,
"line_mean": 33.504178273,
"line_max": 78,
"alpha_frac": 0.5747154275,
"autogenerated": false,... |
"""Beat-synchronous chroma feature calculation with LabROSA.
Dan Ellis dpwe@ee.columbia.edu 2016-04-08
"""
from __future__ import print_function
import cPickle as pickle
import getopt
import os
import sys
import time
import numpy as np
import scipy
import sklearn.mixture
import librosa
def read_iso_label_file(f... | {
"repo_name": "dpwe/elene4896",
"path": "prac11/beat_sync_chroma.py",
"copies": "1",
"size": "8080",
"license": "mit",
"hash": -8857790212862111000,
"line_mean": 37.4761904762,
"line_max": 119,
"alpha_frac": 0.5861386139,
"autogenerated": false,
"ratio": 3.4136037177862275,
"config_test": false... |
"""Beautiful and helpful exceptions
Just set your `BETTER_EXCEPTIONS` environment variable. It handles the rest.
Name: better_exceptions
Author: Josh Junon
Email: josh@junon.me
URL: github.com/qix-/better-exceptions
License: Copyright (c) 2017 Josh Junon, licensed under the MIT license
"""
from __future__... | {
"repo_name": "Delgan/better-exceptions",
"path": "better_exceptions/__init__.py",
"copies": "1",
"size": "1906",
"license": "mit",
"hash": 2823202442811121700,
"line_mean": 27.8787878788,
"line_max": 98,
"alpha_frac": 0.6867785939,
"autogenerated": false,
"ratio": 3.6795366795366795,
"config_t... |
"""Beautiful Soup bonus library: Unicode, Dammit
This class forces XML data into a standard format (usually to UTF-8 or
Unicode). It is heavily based on code from Mark Pilgrim's Universal
Feed Parser. It does not rewrite the XML or HTML to reflect a new
encoding; that's Beautiful Soup's job.
"""
import codecs
import... | {
"repo_name": "Pathoschild/stewbot",
"path": "stewbot/components/modules/dammit.py",
"copies": "1",
"size": "12322",
"license": "isc",
"hash": 6525729958840964000,
"line_mean": 41.198630137,
"line_max": 78,
"alpha_frac": 0.5021912027,
"autogenerated": false,
"ratio": 3.4847285067873304,
"config... |
"""Beautiful Soup Elixir and Tonic - "The Screen-Scraper's Friend".
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a pluggable XML or HTML parser to parse a
(possibly invalid) document into a tree representation. Beautiful Soup
provides methods and Pythonic idioms that make it easy to navigate,
sea... | {
"repo_name": "zhaodjie/py_learning",
"path": "venv/lib/python3.7/site-packages/bs4/__init__.py",
"copies": "3",
"size": "29063",
"license": "mit",
"hash": 3324109272573804500,
"line_mean": 39.7044817927,
"line_max": 536,
"alpha_frac": 0.5993875374,
"autogenerated": false,
"ratio": 4.595667299177... |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.
A well-formed X... | {
"repo_name": "systempuntoout/buckethandle",
"path": "app/lib/BeautifulSoup.py",
"copies": "51",
"size": "79254",
"license": "bsd-3-clause",
"hash": -825398637775092600,
"line_mean": 38.4102436599,
"line_max": 186,
"alpha_frac": 0.5709743357,
"autogenerated": false,
"ratio": 4.207357859531773,
... |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a pluggable XML or HTML parser to parse a
(possibly invalid) document into a tree representation. Beautiful Soup
provides methods and Pythonic idioms that make it easy to navigate,
search,... | {
"repo_name": "deanishe/alfred-duden",
"path": "src/lib/bs4/__init__.py",
"copies": "3",
"size": "23259",
"license": "mit",
"hash": 4407475414082944000,
"line_mean": 38.1565656566,
"line_max": 536,
"alpha_frac": 0.5884603809,
"autogenerated": false,
"ratio": 4.4789139225881,
"config_test": fals... |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a plug-in parser to parse a (possibly invalid) XML
or HTML document into a tree representation. The parser does the work
of building a parse tree, and Beautiful Soup provides provides meth... | {
"repo_name": "colinmcd94/kickdata",
"path": "lib/build/lib/bs4/__init__.py",
"copies": "2",
"size": "11511",
"license": "apache-2.0",
"hash": 367065738596408260,
"line_mean": 34.0945121951,
"line_max": 79,
"alpha_frac": 0.595256711,
"autogenerated": false,
"ratio": 4.242904533726502,
"config_t... |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.
A well-formed XML/HTML document yields a well-formed data
str... | {
"repo_name": "TheBrane/sodi-data-acquisition",
"path": "fetch_descriptions_and_urls/BeautifulSoup.py",
"copies": "6",
"size": "79331",
"license": "mit",
"hash": 828401470749776600,
"line_mean": 38.4490303332,
"line_max": 186,
"alpha_frac": 0.5703319005,
"autogenerated": false,
"ratio": 4.2096577... |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
v2.1.1
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses arbitrarily invalid XML- or HTML-like substance
into a tree representation. It provides methods and Pythonic idioms
that make it easy to search and modify the tree.
A well-formed... | {
"repo_name": "knittledan/netflixXBMC",
"path": "resources/mechanize/_beautifulsoup.py",
"copies": "131",
"size": "40725",
"license": "mit",
"hash": 2560149822505101000,
"line_mean": 36.8133704735,
"line_max": 186,
"alpha_frac": 0.5774340086,
"autogenerated": false,
"ratio": 4.155612244897959,
... |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
v3.0.0
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.
A well-f... | {
"repo_name": "couchbaselabs/priority15",
"path": "lib/builds/BeautifulSoup.py",
"copies": "2",
"size": "66370",
"license": "apache-2.0",
"hash": 2673484732957650400,
"line_mean": 37.7901811806,
"line_max": 186,
"alpha_frac": 0.565737532,
"autogenerated": false,
"ratio": 4.134172168929862,
"con... |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a pluggable XML or HTML parser to parse a
(possibly invalid) document into a tree representation. Beautiful Soup
provides provides methods and Pythonic idioms that make it easy to
... | {
"repo_name": "hentaiPanda/bgm_tenkou",
"path": "bs4/__init__.py",
"copies": "1",
"size": "15795",
"license": "mit",
"hash": -5618964176033445000,
"line_mean": 36.9039408867,
"line_max": 231,
"alpha_frac": 0.5817663818,
"autogenerated": false,
"ratio": 4.409547738693467,
"config_test": false,
... |
# Beaver: A beaver in the game.
# DO NOT MODIFY THIS FILE
# Never try to directly create an instance of this class, or modify its member variables.
# Instead, you should only be reading its variables and calling its functions.
from games.stumped.game_object import GameObject
# <<-- Creer-Merge: imports -->> - Code y... | {
"repo_name": "JacobFischer/Joueur.py",
"path": "games/stumped/beaver.py",
"copies": "1",
"size": "5742",
"license": "mit",
"hash": -237612392711026050,
"line_mean": 29.8709677419,
"line_max": 147,
"alpha_frac": 0.6086729363,
"autogenerated": false,
"ratio": 4.069454287739192,
"config_test": fa... |
# Be Careful: tools.py shouldn't use flask app context, it's for test
class NewsUrlCache(list):
"""
A Queue whose length is fixed by size parameter.
The instance saves some urls that was processed, and keep elements unique.
"""
def __init__(self, size=100):
list.__init__(self)
self... | {
"repo_name": "binking/News_website",
"path": "news_website/operations/tools.py",
"copies": "1",
"size": "1680",
"license": "bsd-3-clause",
"hash": -8984481220015343000,
"line_mean": 27.4915254237,
"line_max": 79,
"alpha_frac": 0.5166666667,
"autogenerated": false,
"ratio": 4.158415841584159,
"... |
# Because division is different in Python 2 and 3
from __future__ import division
from typing import Tuple
import numpy as np
from . import _ops as math
from . import extrapolation as extrapolation
from ._config import GLOBAL_AXIS_ORDER
from ._ops import stack
from ._shape import Shape, channel, batch, spatial
from ... | {
"repo_name": "tum-pbs/PhiFlow",
"path": "phi/math/_nd.py",
"copies": "1",
"size": "21446",
"license": "mit",
"hash": 2419932134710988000,
"line_mean": 39.5330812854,
"line_max": 180,
"alpha_frac": 0.6184124615,
"autogenerated": false,
"ratio": 3.5754543938635983,
"config_test": false,
"has_n... |
""" Because life's too short to not collect ABOUT THE AUTHOR:
data in the same place you work with it http://mikelev.in
_____ _ _ _ http://levinux.com
| __ (_) | | | | http://pipulate.com
| |__) | _ __ _ _| | __... | {
"repo_name": "whofman/my-pipulate",
"path": "pipulate.py",
"copies": "1",
"size": "50571",
"license": "mit",
"hash": -3699186389383471000,
"line_mean": 36.7677371173,
"line_max": 393,
"alpha_frac": 0.508512784,
"autogenerated": false,
"ratio": 3.720097101662498,
"config_test": false,
"has_no... |
# because of the PWD environment variables, this script CAN NOT run on itself
import os, ast
with open('export_all.list', 'r') as f:
file_list = f.readline().strip('\n')
root_path = f.readline().strip('\n')
root_path_2 = f.readline().strip('\n')
visit_src = f.readline().strip('\n')
file_list = ast.lite... | {
"repo_name": "pvpnvz/internshipsystem",
"path": "export_all.py",
"copies": "1",
"size": "1916",
"license": "mit",
"hash": -1060724208198564900,
"line_mean": 47.8648648649,
"line_max": 110,
"alpha_frac": 0.6167035398,
"autogenerated": false,
"ratio": 2.2238622386223863,
"config_test": false,
... |
# Because of the way django evaluates the settings file, importing the Sitemap classes
# at start-up time (when the settings file is parsed) leads to an invalid setting being
# read somewhere in the libraries backing up the Sitemap classes.
# This means that the import of these sitemaps must not be done and startup-tim... | {
"repo_name": "Uberlearner/uberlearner",
"path": "uberlearner/uberlearner/settings/base/sitemaps_settings.py",
"copies": "1",
"size": "1227",
"license": "mit",
"hash": 6926894720208780000,
"line_mean": 50.125,
"line_max": 97,
"alpha_frac": 0.7383863081,
"autogenerated": false,
"ratio": 4.26041666... |
# Because the csv module in Python 2.x does not support unicode, use this
# instead. Taken essentially verbatim from the python docs - see
# http://docs.python.org/library/csv.html.
import csv
import codecs
import cStringIO
class Writer(object):
"""
A CSV writer which will write rows to CSV file "f",
wh... | {
"repo_name": "maxdl/Synapse.py",
"path": "synapse/unicode_csv.py",
"copies": "3",
"size": "1591",
"license": "mit",
"hash": -8052766925515853000,
"line_mean": 29.5961538462,
"line_max": 80,
"alpha_frac": 0.6015084852,
"autogenerated": false,
"ratio": 4.069053708439898,
"config_test": false,
... |
# because the function move_global_zernikes does not have the delay_update parameter anymore need to add ote.update_opd
# however the latest version of poppy creates the following error: module 'poppy' has no attribute 'opd_from_zernikes'
# problem is the anaconda environment does not support pynrc => creating a class ... | {
"repo_name": "JarronL/pynrc",
"path": "dev_utils/20200617_Shared_Package_shared/Simulator.py",
"copies": "1",
"size": "14672",
"license": "mit",
"hash": -2364958591391949000,
"line_mean": 44.0061349693,
"line_max": 158,
"alpha_frac": 0.6070747001,
"autogenerated": false,
"ratio": 3.0688140556368... |
"""becours URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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-ba... | {
"repo_name": "eedf/becours",
"path": "becours/urls.py",
"copies": "1",
"size": "1058",
"license": "mit",
"hash": -2316688172191789600,
"line_mean": 38.1851851852,
"line_max": 79,
"alpha_frac": 0.7098298677,
"autogenerated": false,
"ratio": 3.526666666666667,
"config_test": false,
"has_no_key... |
# BedirT 2019
# Tic-Tac-Toe
# CMPUT 355
# UofA
# 0 1 2
# 3 4 5
# 6 7 8
#
# The board example.
# Done:
# - Environment is ready
# - 1v1 mode
#
# To-Do:
# - Implement solver
# - Alpha-beta pruning (best case O(b^(d/2)))
# - Minimax wo AlphaBeta
# - Explanation for the solvers (algorit... | {
"repo_name": "ryanbhayward/games-puzzles-algorithms",
"path": "simple/ttt/tttplus/ttt_simple_v0.1.py",
"copies": "1",
"size": "6132",
"license": "mit",
"hash": -3995897562680739000,
"line_mean": 29.9696969697,
"line_max": 78,
"alpha_frac": 0.5769732551,
"autogenerated": false,
"ratio": 3.6241134... |
# BedirT 2019
# Tic-Tac-Toe & Terni-Lapilli
# CMPUT 355
# UofA
# TIC-TAC-TOE
#
# C1 C2 C3
# | | |
# 0 1 2 - R1
# 3 4 5 - R2
# 6 7 8 - R3
# / \
# D1 D2
# The board example for Tic-Tac-Toe
#
# Game Rules:
#
# - Players play in alternating order
# - T... | {
"repo_name": "ryanbhayward/games-puzzles-algorithms",
"path": "simple/ttt/tttplus/tttplus_v0.3.py",
"copies": "1",
"size": "14343",
"license": "mit",
"hash": 8603768314187148000,
"line_mean": 30.8026607539,
"line_max": 107,
"alpha_frac": 0.588579795,
"autogenerated": false,
"ratio": 3.6833590138... |
""" Bedrock elevation
"""
import os
from icedata.common import ncload as _ncload
# NCFILE = os.path.join(datadir, "MCdataset-2014-10-16.nc")
NCFILE = os.path.join("greenland","MCdataset-2014-10-16.nc")
NAME = __name__
DESC = __doc__
GRID_MAPPING = {'ellipsoid': u'WGS84',
'false_easting': 0.0,
'fals... | {
"repo_name": "perrette/icedata",
"path": "icedata/greenland/morlighem2014.py",
"copies": "1",
"size": "1233",
"license": "mit",
"hash": -1455912629548018200,
"line_mean": 30.6153846154,
"line_max": 129,
"alpha_frac": 0.6261151663,
"autogenerated": false,
"ratio": 3.396694214876033,
"config_tes... |
_bedtools_path = ""
_R_path = ""
tempfile_prefix = 'pybedtools.'
tempfile_suffix = '.tmp'
# Checking for BEDTools will happen when creating the first BedTool; other
# checks happen at first use (BAM object creation; tabix-ing a BedTool)
_bedtools_installed = False
_R_installed = False
_v_2_15_plus = False
KEEP_TEMP... | {
"repo_name": "poojavade/Genomics_Docker",
"path": "Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/pybedtools-0.7.6-py2.7-linux-x86_64.egg/pybedtools/settings.py",
"copies": "1",
"size": "2117",
"license": "apache-2.0",
"hash": 5974071512302860000,
"line_mean": 23.6162790698,
"lin... |
"""Beep Boop Berry
This module can make your Raspberry sing if you have a Piezzo-Beeper connected
to it.
"""
from enum import IntEnum
from time import sleep
import RPi.GPIO as GPIO
class BeepBoop():
"""
The main class of the module. Without that, you can't make a sound. It needs
the pin where the buzzer... | {
"repo_name": "dusterherz/beep-boop-berry",
"path": "beep_boop_berry/__init__.py",
"copies": "1",
"size": "2533",
"license": "mit",
"hash": -2781173100890834400,
"line_mean": 26.2365591398,
"line_max": 80,
"alpha_frac": 0.5463876826,
"autogenerated": false,
"ratio": 3.741506646971935,
"config_t... |
""" beep on highlight """
import sushi
import string
def do_beep():
""" tries several beep methods for
different platforms and frameworks
and returns if one method was
successful.
"""
try:
import winsound
return winsound.Beep(30, 1)
except:
pass
try:
import MacOS
# not in 64 bit
return MacOS.S... | {
"repo_name": "sushi-irc/chirashi",
"path": "beep.py",
"copies": "1",
"size": "1265",
"license": "bsd-2-clause",
"hash": 7756350858035363000,
"line_mean": 17.3333333333,
"line_max": 57,
"alpha_frac": 0.6387351779,
"autogenerated": false,
"ratio": 2.75,
"config_test": false,
"has_no_keywords":... |
"""beernburger 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')
Clas... | {
"repo_name": "campovski/beernburger",
"path": "beernburger/urls.py",
"copies": "1",
"size": "1264",
"license": "mit",
"hash": 6412171642001123000,
"line_mean": 44.1428571429,
"line_max": 106,
"alpha_frac": 0.6962025316,
"autogenerated": false,
"ratio": 3.2661498708010335,
"config_test": false,... |
""" Beer Plugin (botwot plugins.beer) """
# Copyright 2014 Ray Schulz <https://rascul.io>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | {
"repo_name": "rascul/botwot",
"path": "plugins/beer.py",
"copies": "1",
"size": "2827",
"license": "apache-2.0",
"hash": 6266080016183812000,
"line_mean": 31.125,
"line_max": 187,
"alpha_frac": 0.6590024761,
"autogenerated": false,
"ratio": 2.878818737270876,
"config_test": false,
"has_no_ke... |
# beeswarm and boxplot display; tooltips on outlier data points
# option: ylog .... if True use a log Y axis; otherwise use linear
import svgdatashapes as s
import examples.sampledata2 as sampledata2
def example7( ylog=False ):
# get several 1-D example arrays of numbers sorted on magnitude, and put them into a... | {
"repo_name": "grubbcode/minplot",
"path": "examples/e7.py",
"copies": "2",
"size": "3103",
"license": "mit",
"hash": -6326186233696470000,
"line_mean": 41.5068493151,
"line_max": 115,
"alpha_frac": 0.6194005801,
"autogenerated": false,
"ratio": 3.069238377843719,
"config_test": false,
"has_n... |
"""Beets plugin to add imported files to Music Player Daemon queue.
This plugin listens for Beets import events and adds all imported items at the
end of the server queue at the end of Beets program execution.
This plugin uses the same configuration as the MPDUpdate plugin included with
Beets to connect to a server.
... | {
"repo_name": "Hamuko/beets-mpdqueue",
"path": "beetsplug/mpdqueue.py",
"copies": "1",
"size": "5906",
"license": "apache-2.0",
"hash": 8965580346520357000,
"line_mean": 32.7485714286,
"line_max": 85,
"alpha_frac": 0.5880460549,
"autogenerated": false,
"ratio": 4.289034132171387,
"config_test":... |
# beets stuff
import os.path, sqlite3, re, filecmp
confpath=os.path.join(os.getenv("XDG_CONFIG_HOME",default=os.path.join(os.getenv("HOME", default="~"),"config")),"beets","config.yaml")
dirpath = None
dbpath = None
with open(confpath,'r') as f:
# use re to parse YAML
for line in f:
m = re.match ("^di... | {
"repo_name": "AshleyYakeley/beets-tools",
"path": "beets.py",
"copies": "1",
"size": "2662",
"license": "mit",
"hash": -8249955674338074000,
"line_mean": 29.9534883721,
"line_max": 135,
"alpha_frac": 0.53756574,
"autogenerated": false,
"ratio": 3.554072096128171,
"config_test": true,
"has_no... |
# Before a code change on October 25th, roll_vocab_small2large() was not called
# when saving the model.
# This script modifies the "large" parameters when building the final model.
import numpy
import shelve
import cPickle
import argparse
from groundhog.utils import invert_dict
parser = argparse.ArgumentParser()
pa... | {
"repo_name": "OlafLee/LV_groundhog",
"path": "experiments/nmt/utils/build_final_model_s2l.py",
"copies": "3",
"size": "2380",
"license": "bsd-3-clause",
"hash": 701749903573900500,
"line_mean": 31.1756756757,
"line_max": 154,
"alpha_frac": 0.6714285714,
"autogenerated": false,
"ratio": 3.0789133... |
# Before continuing, we should examine Python's memory model
x = 10
# The id() function returns the memory address (or some other unique identifier) of a binding
print "id(x):", id(x)
y = x
print "id(y):", id(y)
# What gets printed?
# So y and x are bound to the same value in memory. Is that what you get for primitiv... | {
"repo_name": "ARGutierrez/Lectures",
"path": "Python/Functions/memory.py",
"copies": "5",
"size": "1027",
"license": "mit",
"hash": -7415168394911398000,
"line_mean": 25.3333333333,
"line_max": 98,
"alpha_frac": 0.7156767283,
"autogenerated": false,
"ratio": 3.48135593220339,
"config_test": fa... |
# Before continuing, we should examine Python's memory model
x = 10
# The id() function returns the memory address (or some other unique identifier) of a binding
print("id(x):", id(x))
y = x
print("id(y):", id(y))
# What gets printed?
# So y and x are bound to the same value in memory. Is that what you get for primit... | {
"repo_name": "cn46375/Lectures",
"path": "Python/Functions/memory.py",
"copies": "17",
"size": "1176",
"license": "mit",
"hash": -6102842975600707000,
"line_mean": 28.4,
"line_max": 98,
"alpha_frac": 0.7091836735,
"autogenerated": false,
"ratio": 3.43859649122807,
"config_test": false,
"has_... |
# Before I start work on the next portion of learning, I should probably make
# sure I have a basic frame for what the discussion class(es) look like.
from pyramid.view import view_config
from pyramid.view import view_defaults
from pyramid.httpexceptions import HTTPNotFound, HTTPFound
from .view_base import ViewBase
fr... | {
"repo_name": "riggtravis/SINS",
"path": "sins/views/discussion.py",
"copies": "1",
"size": "8746",
"license": "mit",
"hash": -7873673759292506000,
"line_mean": 36.5407725322,
"line_max": 106,
"alpha_frac": 0.5160073176,
"autogenerated": false,
"ratio": 3.321686289403722,
"config_test": false,
... |
# before
if 3 == 2: # on-line 3==2
# after first if
print "foo" # on-line
# after first body
elif 3 != 2: # on-line first elif
print "bar" # on-line elif print
if "foo" != "bar":
print "if in elif"
elif 1 != 0:
print "bla"
else:
print "bar"
# after second body (el... | {
"repo_name": "aptana/Pydev",
"path": "tests/org.python.pydev.refactoring.tests/src/python/rewriter/testIfWithComment.py",
"copies": "8",
"size": "1163",
"license": "epl-1.0",
"hash": -4288202280351606300,
"line_mean": 20.1636363636,
"line_max": 36,
"alpha_frac": 0.5253654342,
"autogenerated": fals... |
# Before reading this file, see lesson_10_aot_compilation_generate.cpp
# This is the code that actually uses the Halide pipeline we've
# compiled. It does not depend on libHalide, so we won't be including
# Halide.h.
#
# Instead, it depends on the header file that lesson_10_generate
# produced when we ran it:
#include... | {
"repo_name": "dougkwan/Halide",
"path": "python_bindings/tutorial/lesson_10_aot_compilation_run.py",
"copies": "14",
"size": "9117",
"license": "mit",
"hash": -459524064051885700,
"line_mean": 36.3647540984,
"line_max": 95,
"alpha_frac": 0.6062301196,
"autogenerated": false,
"ratio": 3.617857142... |
#BEFORE RUNNING PLEASE CHANGE THE IP ADDRESS
#PLEASE USE PYTHON 2.7 TO RUN
#Vivian Lam
#CS 3357
#OCT 21 2016
#from socket import *
import socket
import datetime
import time
#Variable intialization
#TCP_IP = '192.168.10.130'
#TCP_IP = '172.30.70.129'
TCP_IP = '192.168.10.1'
TCP_PORT = 5005
acceptedString = "What is t... | {
"repo_name": "V-Lam/School-Assignments-and-Labs-2014-2017",
"path": "CS 3357 - Python -- (Computer Networks 1)/assignment 2/Python_Server.py",
"copies": "1",
"size": "1670",
"license": "mit",
"hash": 6838326480583056000,
"line_mean": 22.8571428571,
"line_max": 99,
"alpha_frac": 0.6958083832,
"aut... |
# Before running this:
# - add pyMSpec,pyIMS and pySpatialMetabolomics to the sys.path
# - grab the example data from metabolights
# * http://www.ebi.ac.uk/metabolights/MTBLS317
# * http://www.ebi.ac.uk/metabolights/MTBLS313
# - edit the .json config file
#!!! These are mandatory edits for every dataset
### "file... | {
"repo_name": "alexandrovteam/pySM",
"path": "pySM/example/run_example.py",
"copies": "1",
"size": "2615",
"license": "apache-2.0",
"hash": 7341761489330230000,
"line_mean": 52.387755102,
"line_max": 169,
"alpha_frac": 0.6684512428,
"autogenerated": false,
"ratio": 3.009205983889528,
"config_te... |
# Before running this program, it might be necessary to update the AppleLang.txt file
# This file was created in swift by running Locale.availableLanguages and parsing it
# into locale | languageCode | scriptCode | name
# It is essential to parse out scriptCode from the identifer, because locale.scriptCode
# returns ni... | {
"repo_name": "garygriswold/Bible.js",
"path": "Versions/Release.2.1.x/py/LanguageTable.py",
"copies": "2",
"size": "1117",
"license": "mit",
"hash": -4288961662951769600,
"line_mean": 31.8529411765,
"line_max": 87,
"alpha_frac": 0.6956132498,
"autogenerated": false,
"ratio": 3.051912568306011,
... |
#Before starting, the script will help you set up the paths to the Stanford dependency parser
# components needed to run the raw text parser. As the system is set up, it will not print out
# the whole sentence as part of the array. You can change this by deleting the hashtag
# indicating that this was a note in the ... | {
"repo_name": "zaqari/Constructions-From-Dependencies",
"path": "KellyGEN_5.0.py",
"copies": "1",
"size": "7575",
"license": "mit",
"hash": -8004825365992274000,
"line_mean": 38.4114583333,
"line_max": 351,
"alpha_frac": 0.7045064094,
"autogenerated": false,
"ratio": 3.134631317315659,
"config_... |
beforeTxt = '''\
1100111
1100111
1100111
1100111
1100110
1100110
1100110
1100110
1100110
1100110
1100110
1100110
1111110
0000000\
'''
# Thanks to [http://www.network-science.de/ascii/ this site] and vim for these next two examples
smallrc01 = '''\
00000000000000000000000000000000
01111111110000000111111110000000
01110... | {
"repo_name": "aligoren/pyalgo",
"path": "zhang_suen_thinning_algo.py",
"copies": "1",
"size": "4279",
"license": "mit",
"hash": 581616829978683600,
"line_mean": 36.2086956522,
"line_max": 96,
"alpha_frac": 0.6683804627,
"autogenerated": false,
"ratio": 3.390649762282092,
"config_test": false,
... |
#***Before using this example the motor/controller combination must be
#***tuned and the settings saved to the Roboclaw using IonMotion.
#***The Min and Max Positions must be at least 0 and 50000
import time
from roboclaw import Roboclaw
#Windows comport name
rc = Roboclaw("COM3",115200)
#Linux comport name
... | {
"repo_name": "hopkira/k9-chess-angular",
"path": "python/roboclaw_speedaccel.py",
"copies": "1",
"size": "1368",
"license": "unlicense",
"hash": 7554445338747403000,
"line_mean": 19.746031746,
"line_max": 70,
"alpha_frac": 0.6659356725,
"autogenerated": false,
"ratio": 2.547486033519553,
"conf... |
# Before we do anything else, get some default settings built into Arkestra.
# They are not just Arkestra settings, but settings for other applications
# that Arkestra requires to be just so.
# These are the only settings you really need.
# If you need to modify other aspects of Arkestra's behaviour, see the
# settin... | {
"repo_name": "evildmp/Arkestra",
"path": "example/example/arkestra_settings.py",
"copies": "2",
"size": "1928",
"license": "bsd-2-clause",
"hash": -2619893885916263000,
"line_mean": 31.1333333333,
"line_max": 79,
"alpha_frac": 0.7048755187,
"autogenerated": false,
"ratio": 3.6934865900383143,
... |
# Before you make fun of this code, it was a direct line=by-line port from a PHP version.
# The goal was to make it perform exactly as the PHP without changing the logic; so called 'port refactoring'.
import re
inputFileName = '_disambiguator_input.csv'
outf1 = open('_attribute_line','wt')
outf2 = open('_attribute_m... | {
"repo_name": "CSSIP-AIR/InventorDisambiguator",
"path": "Initialize_ID.py",
"copies": "1",
"size": "2835",
"license": "bsd-2-clause",
"hash": 792107621120693500,
"line_mean": 26.8039215686,
"line_max": 110,
"alpha_frac": 0.5188712522,
"autogenerated": false,
"ratio": 2.9047131147540983,
"confi... |
""" Befunge support.
Epic esotheric language in 2D!
See also: https://en.wikipedia.org/wiki/Befunge
"""
hello_world = """\
>25*"!dlrow ,olleH":v
v:,_@
> ^
"""
quine = """01->1# +# :# 0# g# ,# :# 5# 8# *# 4# +# -# _@"""
def run_befunge(src):
""" Execute a slab of befunge.
... | {
"repo_name": "windelbouwman/ppci-mirror",
"path": "ppci/lang/befunge.py",
"copies": "1",
"size": "5192",
"license": "bsd-2-clause",
"hash": 8738452226269772000,
"line_mean": 24.702970297,
"line_max": 70,
"alpha_frac": 0.4539676425,
"autogenerated": false,
"ratio": 3.6744515215852798,
"config_t... |
# BEGIN ALL
#!/usr/bin/env python
from fake_actuator import FakeActuator
import rospy
import actionlib
from std_msgs.msg import Float32
# BEGIN IMPORT
from sensors.srv import Light,LightResponse
from sensors.msg import RotationAction,RotationFeedback,RotationResult
# END IMPORT
# BEGIN TOPIC_CALLBACK
def volume_ca... | {
"repo_name": "osrf/rosbook",
"path": "code/stuff/actuator.py",
"copies": "1",
"size": "1831",
"license": "apache-2.0",
"hash": 2907310636203237400,
"line_mean": 23.4133333333,
"line_max": 75,
"alpha_frac": 0.6531949754,
"autogenerated": false,
"ratio": 3.814583333333333,
"config_test": false,
... |
# BEGIN ALL
#!/usr/bin/env python
import rospy
from smach import State,StateMachine
from time import sleep
class Drive(State):
def __init__(self, distance):
State.__init__(self, outcomes=['success'])
self.distance = distance
def execute(self, userdata):
print 'Driving', self.distanc... | {
"repo_name": "osrf/rosbook",
"path": "code/patrol/src/shapes2.py",
"copies": "1",
"size": "1784",
"license": "apache-2.0",
"hash": -1170651974214213000,
"line_mean": 25.6268656716,
"line_max": 80,
"alpha_frac": 0.543161435,
"autogenerated": false,
"ratio": 4.101149425287356,
"config_test": fal... |
# BEGIN BASIC AUTH MODULE CODE (Comments removed)
import cookielib
import netrc
import urllib2
import re
import pydap.lib
from pydap.exceptions import ClientError
import logging
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
# Set the debug level for urllib2.
debuglevel=1
def install_basic_client(uri... | {
"repo_name": "jenfly/atmos-read",
"path": "pydap_auth.py",
"copies": "1",
"size": "2072",
"license": "mit",
"hash": -5979631343101667000,
"line_mean": 31.8888888889,
"line_max": 106,
"alpha_frac": 0.6322393822,
"autogenerated": false,
"ratio": 3.8158379373848987,
"config_test": false,
"has_n... |
# BEGIN BISECT_DEMO
#list comprehension
#this is list comprelist ,you can use it do such as cartesian product
#about cartesian product https://en.wikipedia.org/wiki/Cartesian_product
'''
>>> colors = ['black', 'white']
>>> sizes = ['S', 'M', 'L']
>>> tshirts = [(color, size) for color in colors for size in sizes]
>>> t... | {
"repo_name": "oxfordyang2016/learnfluentpython",
"path": "02-array-seq/bisect_demo.py",
"copies": "1",
"size": "1667",
"license": "mit",
"hash": -5822619482050390000,
"line_mean": 25.4603174603,
"line_max": 96,
"alpha_frac": 0.5800839832,
"autogenerated": false,
"ratio": 2.701782820097245,
"co... |
### BEGIN Cell #1 ###
import os, json, math, shutil
import datetime
import numpy as np
import tensorflow as tf
logging.info(tf.version.VERSION)
### END Cell #1 ###
### BEGIN PARAMS from notebook ###
# Note that this cell is special. It's got a tag (you can view tags by clicking on the wrench icon on the left menu in ... | {
"repo_name": "turbomanage/training-data-analyst",
"path": "quests/serverlessml/07_caip/labs/container/trainer/model.py",
"copies": "4",
"size": "12098",
"license": "apache-2.0",
"hash": 3412999295250043400,
"line_mean": 39.5973154362,
"line_max": 197,
"alpha_frac": 0.6473797322,
"autogenerated": f... |
# Begin configuration
TITLE = "ESP8266 WiFi Configurator"
GPIO_NUM = 2
# End configuration
import network
import machine
import usocket
from accessPoints import AccessPoints
accessPointsFile = 'accessPoints.json'
aPoints = AccessPoints(accessPointsFile)
from accessPoints import NetScan
netScan = NetScan()
# do a... | {
"repo_name": "carterw/esp8266Wifi",
"path": "webserv.py",
"copies": "1",
"size": "9096",
"license": "mit",
"hash": -3357667215349983000,
"line_mean": 30.3689655172,
"line_max": 189,
"alpha_frac": 0.5718997361,
"autogenerated": false,
"ratio": 3.491746641074856,
"config_test": true,
"has_no_k... |
# DEV NOTE: some of the variables defined here (docstring included)
# are parsed by setup.py, check it before modifying them.
"""
Pydoop: a Python MapReduce and HDFS API for Hadoop
--------------------------------------------------
Pydoop provides a MapReduce and HDFS API for Hadoop that allows
object-oriented Java-... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/__init__.py",
"copies": "1",
"size": "3081",
"license": "apache-2.0",
"hash": 7062395422869573000,
"line_mean": 27.7943925234,
"line_max": 122,
"alpha_frac": 0.7247646868,
"autogenerated": false,
"ratio": 3.1664953751284686,
"config_test": fals... |
# DEV NOTE: this module is used by the setup script, so it MUST NOT
# rely on extension modules.
import os, subprocess as sp, glob, re
import xml.dom.minidom as dom
from xml.parsers.expat import ExpatError
try:
from config import DEFAULT_HADOOP_HOME
except ImportError: # should only happen at compile time
DEFAU... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/hadoop_utils.py",
"copies": "1",
"size": "10840",
"license": "apache-2.0",
"hash": 7669901715990613000,
"line_mean": 30.3294797688,
"line_max": 79,
"alpha_frac": 0.6244464945,
"autogenerated": false,
"ratio": 3.36332609370152,
"config_test": fa... |
# FIXME: not finished
import sys, os, subprocess
import pydoop
pp = pydoop.import_version_specific_module('_pipes')
#--- message codes for the down protocol ---
START_MESSAGE = 0
SET_JOB_CONF = 1
SET_INPUT_TYPES = 2
RUN_MAP = 3
MAP_ITEM = 4
RUN_REDUCE = 5
REDUCE_KEY = 6
REDUCE_VALUE = 7
CLOSE = 8
ABORT = 9
#--- m... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/binary_protocol.py",
"copies": "1",
"size": "3449",
"license": "apache-2.0",
"hash": 933056713599158900,
"line_mean": 21.6907894737,
"line_max": 77,
"alpha_frac": 0.6381559872,
"autogenerated": false,
"ratio": 3.2568460812086872,
"config_test":... |
import os, tempfile
from pydoop.text_protocol import text_down_protocol
from pydoop.text_protocol import up_serializer
class pipes_runner(object):
def __init__(self, program, output_visitor,
down_protocol=text_down_protocol):
self.program = program
self.output_visitor = output_visitor
f... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/pipes_runner.py",
"copies": "1",
"size": "1741",
"license": "apache-2.0",
"hash": -6009201380474385000,
"line_mean": 33.82,
"line_max": 79,
"alpha_frac": 0.6680068926,
"autogenerated": false,
"ratio": 3.6346555323590812,
"config_test": false,
... |
import os, unittest
import pydoop.hdfs as hdfs
from pydoop.hdfs.common import DEFAULT_PORT, DEFAULT_USER
import pydoop.utils as utils
class TestSplit(unittest.TestCase):
def good(self):
cases = [
('hdfs://localhost:9000/', ('localhost', 9000, '/')),
('hdfs://localhost:9000/a/b', ('localhost', 900... | {
"repo_name": "jkahn/pydoop-code",
"path": "test/test_path.py",
"copies": "1",
"size": "6632",
"license": "apache-2.0",
"hash": 7208217017789657000,
"line_mean": 29.7037037037,
"line_max": 80,
"alpha_frac": 0.5867008444,
"autogenerated": false,
"ratio": 3.1180065820404326,
"config_test": true,
... |
import sys, gc
import iref
class py_wrap_payload(iref.payload):
def __init__(self, v):
sys.stderr.write("py_wrap_payload::__init__(%d)\n" % v)
iref.payload.__init__(self, v)
def __del__(self):
sys.stderr.write("py_wrap_payload::__del__ ()\n")
def payload_maker(x):
return py_wrap_payload(x)
def ... | {
"repo_name": "jkahn/pydoop-code",
"path": "iref/try_iref.py",
"copies": "1",
"size": "1601",
"license": "apache-2.0",
"hash": -3291798667838830600,
"line_mean": 25.2459016393,
"line_max": 77,
"alpha_frac": 0.6702061212,
"autogenerated": false,
"ratio": 3.0907335907335907,
"config_test": false,... |
import sys
from pydoop.pipes_runner import pipes_runner
class output_visitor(object):
def __init__(self):
pass
def output(self, key, value):
print 'output pair -> <%s,%s>' % (key, value)
def done(self):
print 'all done'
def progress(self, progress):
print 'we are at %f done.' % float(progress... | {
"repo_name": "jkahn/pydoop-code",
"path": "examples/text_pipe_runner.py",
"copies": "1",
"size": "1699",
"license": "apache-2.0",
"hash": -8813888867081321000,
"line_mean": 24.7424242424,
"line_max": 77,
"alpha_frac": 0.6645085344,
"autogenerated": false,
"ratio": 3.089090909090909,
"config_te... |
import sys, os, logging, re
logging.basicConfig(level=logging.INFO)
import pydoop.test_support as pts
import pydoop.hdfs as hdfs
import pydoop.hadut as hadut
try:
from collections import Counter # new in Python 2.7
except ImportError:
class Counter(dict):
def __init__(self, seq):
super(Counter, self)... | {
"repo_name": "jkahn/pydoop-code",
"path": "examples/self_contained/self_contained.py",
"copies": "1",
"size": "2594",
"license": "apache-2.0",
"hash": -6718577403082706000,
"line_mean": 26.3052631579,
"line_max": 77,
"alpha_frac": 0.6804163454,
"autogenerated": false,
"ratio": 3.019790454016298,... |
import sys, os, subprocess, glob
import pydoop
SRC = "net/sourceforge/pydoop/mapred/TextInputFormat.java"
CLASS = SRC.replace("java", "class")
def main(argv):
try:
jar_name = argv[1]
except IndexError:
print "Usage: python %s JAR_NAME" % os.path.basename(argv[0])
return 2
if not os.path.isfile(ja... | {
"repo_name": "jkahn/pydoop-code",
"path": "examples/input_format/compiler.py",
"copies": "1",
"size": "1206",
"license": "apache-2.0",
"hash": -2690409716986625000,
"line_mean": 28.4146341463,
"line_max": 77,
"alpha_frac": 0.7048092869,
"autogenerated": false,
"ratio": 3.304109589041096,
"conf... |
import sys, os, subprocess
import pydoop
pp = pydoop.import_version_specific_module('_pipes')
def _true_false_str(v):
return 'true' if v else 'false'
class text_down_protocol(object):
def __init__(self, pipes_program, out_file=None):
if out_file:
self.fd = open(out_file, "w")
else:
self.fd... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/text_protocol.py",
"copies": "1",
"size": "2968",
"license": "apache-2.0",
"hash": -7744860154528014000,
"line_mean": 23.5289256198,
"line_max": 77,
"alpha_frac": 0.634097035,
"autogenerated": false,
"ratio": 3.3348314606741574,
"config_test": ... |
import unittest
import pydoop
pp = pydoop.import_version_specific_module('_pipes')
import gc
class str_lifetime_tc(unittest.TestCase):
def memory_stress(self):
N = 10000
S = 10000000
for x in xrange(N):
s = pp.create_a_string(S)
def push_leak_map_context(self):
N = 100
S = 100000000
... | {
"repo_name": "jkahn/pydoop-code",
"path": "test/test_string_lifetime.py",
"copies": "1",
"size": "1686",
"license": "apache-2.0",
"hash": 978357333620712800,
"line_mean": 24.9384615385,
"line_max": 77,
"alpha_frac": 0.6553973903,
"autogenerated": false,
"ratio": 3.372,
"config_test": true,
"... |
import unittest
import pydoop
pp = pydoop.import_version_specific_module('_pipes')
class jobconf_tc(unittest.TestCase):
def setUp(self):
pass
def test_override_from_python(self):
d = {'str' : 'this is a string', 'float' : 0.23,
'int' : 22, 'bool' : False}
class jc(pp.JobConf):
def ... | {
"repo_name": "jkahn/pydoop-code",
"path": "test/test_jobconf.py",
"copies": "1",
"size": "2583",
"license": "apache-2.0",
"hash": -4581347121191758300,
"line_mean": 29.3882352941,
"line_max": 77,
"alpha_frac": 0.6356949284,
"autogenerated": false,
"ratio": 3.204714640198511,
"config_test": tru... |
import unittest
import pydoop
pp = pydoop.import_version_specific_module('_pipes')
from pydoop.pipes import InputSplit
example_input_splits = [
('\x00/hdfs://localhost:9000/user/zag/in-dir/FGCS-1.ps\x00\x00\x00\x00\x00\x08h(\x00\x00\x00\x00\x00\x08h\x05',
'hdfs://localhost:9000/user/zag/in-dir/FGCS-1.ps',
55... | {
"repo_name": "jkahn/pydoop-code",
"path": "test/test_task_context.py",
"copies": "1",
"size": "4070",
"license": "apache-2.0",
"hash": 8815996106400842000,
"line_mean": 33.4915254237,
"line_max": 121,
"alpha_frac": 0.6587223587,
"autogenerated": false,
"ratio": 2.902995720399429,
"config_test"... |
import unittest, tempfile, os, stat, shutil, logging
import subprocess as sp
from xml.dom.minidom import getDOMImplementation
DOM_IMPL = getDOMImplementation()
import pydoop
from pydoop.jc import jc_wrapper
import pydoop.utils as pu
import pydoop.hadoop_utils as hu
pp = pydoop.import_version_specific_module('_pipes')... | {
"repo_name": "jkahn/pydoop-code",
"path": "test/test_utils.py",
"copies": "1",
"size": "12769",
"license": "apache-2.0",
"hash": 5867268334785463000,
"line_mean": 32.7804232804,
"line_max": 77,
"alpha_frac": 0.6195473412,
"autogenerated": false,
"ratio": 2.967464559609575,
"config_test": true,... |
"""
Check that resetting the hdfs module after changing
os.environ['HADOOP_CONF_DIR'] works (i.e., Pydoop references the
correct HDFS service).
Note that it does **NOT** work if you've already instantiated an hdfs
handle, and this is NOT due to the caching system.
"""
import sys, os, argparse
import pydoop.hdfs as ... | {
"repo_name": "jkahn/pydoop-code",
"path": "test/try_hdfs.py",
"copies": "1",
"size": "1599",
"license": "apache-2.0",
"hash": 8375855029284278000,
"line_mean": 26.5689655172,
"line_max": 77,
"alpha_frac": 0.6904315197,
"autogenerated": false,
"ratio": 3.2699386503067487,
"config_test": false,
... |
"""
Convert text to upper or lower case. By default, the program will
switch text to upper case. Set the config property
'caseswitch.case=lower' if you prefer to switch to lower case.
Set --kv-separator to the empty string when running this example.
"""
def mapper(_, record, writer, conf):
if conf['caseswitch.ca... | {
"repo_name": "jkahn/pydoop-code",
"path": "examples/pydoop_script/caseswitch.py",
"copies": "1",
"size": "1162",
"license": "apache-2.0",
"hash": -4476439826271547400,
"line_mean": 33.1764705882,
"line_max": 79,
"alpha_frac": 0.7254733219,
"autogenerated": false,
"ratio": 3.7483870967741937,
"... |
"""
Counts occurrences of IP addresses in Apache access log files,
optionally ignoring IP addresses listed in a given file. The input
directory must contain files formatted as described in:
http://httpd.apache.org/docs/1.3/logs.html#common
NOTE: the MapReduce application launched by this script is a
Pydoop r... | {
"repo_name": "jkahn/pydoop-code",
"path": "examples/ipcount/ipcount.py",
"copies": "1",
"size": "4121",
"license": "apache-2.0",
"hash": 885469150891165400,
"line_mean": 34.2222222222,
"line_max": 78,
"alpha_frac": 0.6937636496,
"autogenerated": false,
"ratio": 3.3287560581583198,
"config_test... |
"""
Generate an HDFS tree containing files of different block size.
"""
import sys, random
import pydoop.hdfs as hdfs
from common import isdir, MB, TEST_ROOT
BS_RANGE = [_*MB for _ in range(50, 101, 10)]
def treegen(fs, root, depth, span):
if isdir(fs, root) and depth > 0:
for i in xrange(span):
path ... | {
"repo_name": "jkahn/pydoop-code",
"path": "examples/hdfs/treegen.py",
"copies": "1",
"size": "1830",
"license": "apache-2.0",
"hash": 7823812605498285000,
"line_mean": 25.1428571429,
"line_max": 77,
"alpha_frac": 0.631147541,
"autogenerated": false,
"ratio": 3.2049036777583186,
"config_test": ... |
"""
Miscellaneous utilities for testing.
"""
import sys, os, tempfile
from hdfs import default_is_local
def inject_code(new_code, target_code):
"""
Inject new_code into target_code, before the first import.
NOTE: this is just a hack to make examples work out-of-the-box, in
the general case it can fail in s... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/test_support.py",
"copies": "1",
"size": "3119",
"license": "apache-2.0",
"hash": -5443189990135354000,
"line_mean": 25.4322033898,
"line_max": 78,
"alpha_frac": 0.6316126964,
"autogenerated": false,
"ratio": 3.2659685863874346,
"config_test": ... |
"""
Provides a wrapper for the JobConf object.
"""
class jc_wrapper(object):
"""
Simple JobConf wrapper to cache type-converted items.
.. method:: jc_wrapper[k]
Use the ``[]`` operator to get the original conf string value for
property ``k``.
:param k: name of the property.
:raises KeyError:... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/jc.py",
"copies": "1",
"size": "5532",
"license": "apache-2.0",
"hash": -6478791632242241000,
"line_mean": 31.7337278107,
"line_max": 77,
"alpha_frac": 0.6390093999,
"autogenerated": false,
"ratio": 3.6733067729083664,
"config_test": false,
"... |
"""
Pydoop command line tool.
"""
import argparse, importlib
from pydoop.version import version
SUBMOD_NAMES = [
"script",
]
def make_parser():
parser = argparse.ArgumentParser(
description="Pydoop command line tool",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/app/main.py",
"copies": "1",
"size": "1336",
"license": "apache-2.0",
"hash": 142953308893229250,
"line_mean": 26.8333333333,
"line_max": 77,
"alpha_frac": 0.7140718563,
"autogenerated": false,
"ratio": 3.742296918767507,
"config_test": false,
... |
"""
pydoop.hdfs.file -- HDFS File Objects
-------------------------------------
"""
import os
import common
def _complain_ifclosed(closed):
if closed:
raise ValueError("I/O operation on closed HDFS file object")
class hdfs_file(object):
"""
Instances of this class represent HDFS file objects.
Object... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/hdfs/file.py",
"copies": "1",
"size": "9728",
"license": "apache-2.0",
"hash": 4784605718203434000,
"line_mean": 25.2210242588,
"line_max": 80,
"alpha_frac": 0.6292146382,
"autogenerated": false,
"ratio": 3.5883437845813355,
"config_test": fals... |
"""
pydoop.hdfs.fs -- File System Handles
-------------------------------------
"""
import os, socket, urlparse, getpass, re
import operator as ops
import pydoop
hdfs_ext = pydoop.import_version_specific_module("_hdfs")
import common
from file import hdfs_file, local_file
class _FSStatus(object):
def __init__(s... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/hdfs/fs.py",
"copies": "1",
"size": "15999",
"license": "apache-2.0",
"hash": 380041749148215100,
"line_mean": 28.4099264706,
"line_max": 79,
"alpha_frac": 0.6233514595,
"autogenerated": false,
"ratio": 3.5704083909841553,
"config_test": false,... |
"""
pydoop.hdfs.path -- Path Name Manipulations
-------------------------------------------
"""
import os, re
import common
import fs as hdfs_fs
class _HdfsPathSplitter(object):
PATTERN = re.compile(r"([a-z0-9+.-]+):(.*)")
@classmethod
def raise_bad_path(cls, hdfs_path, why=None):
msg = "'%s' is not a ... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/hdfs/path.py",
"copies": "1",
"size": "5617",
"license": "apache-2.0",
"hash": -8716169401252824000,
"line_mean": 26.8069306931,
"line_max": 78,
"alpha_frac": 0.6264910094,
"autogenerated": false,
"ratio": 3.458743842364532,
"config_test": fals... |
"""
Support module for running pydoop script examples.
"""
import os, subprocess as sp
import pydoop.hadut as hadut
import pydoop.test_support as pts
PYDOOP_EXE = os.path.join(os.path.dirname(__file__), "../../scripts/pydoop")
PREFIX = os.getenv("PREFIX", pts.get_wd_prefix())
class PydoopScriptRunner(hadut.PipesR... | {
"repo_name": "jkahn/pydoop-code",
"path": "examples/pydoop_script/psrunner.py",
"copies": "1",
"size": "1362",
"license": "apache-2.0",
"hash": -413040173903846460,
"line_mean": 29.9545454545,
"line_max": 77,
"alpha_frac": 0.7195301028,
"autogenerated": false,
"ratio": 3.422110552763819,
"conf... |
"""
This module allows you to connect to an HDFS installation, read and
write files and get information on files, directories and global
filesystem properties.
Configuration
-------------
The hdfs module is built on top of ``libhdfs``, in turn a JNI wrapper
around the Java fs code: therefore, for the module to work... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/hdfs/__init__.py",
"copies": "1",
"size": "9007",
"license": "apache-2.0",
"hash": 8888066113628438000,
"line_mean": 28.531147541,
"line_max": 77,
"alpha_frac": 0.644609748,
"autogenerated": false,
"ratio": 3.3860902255639096,
"config_test": fa... |
"""
This module allows you to write the components of your MapReduce application.
The basic MapReduce components (Mapper, Reducer, RecordReader, etc.)
are provided as abstract classes. Application developers must subclass
them, providing implementations for all methods called by the
framework.
"""
import pydoop
pp =... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/pipes.py",
"copies": "1",
"size": "8006",
"license": "apache-2.0",
"hash": -6584212617431284000,
"line_mean": 27.390070922,
"line_max": 78,
"alpha_frac": 0.6767424432,
"autogenerated": false,
"ratio": 4.057780030410543,
"config_test": false,
... |
"""
This module contains general utility functions for application writing.
"""
import logging, uuid
from struct import pack
import pydoop
pp = pydoop.import_version_specific_module('_pipes')
# for backwards compatibility
from pydoop.hdfs.path import split as split_hdfs_path
DEFAULT_LOG_LEVEL = "WARNING"
def ra... | {
"repo_name": "jkahn/pydoop-code",
"path": "pydoop/utils.py",
"copies": "1",
"size": "4056",
"license": "apache-2.0",
"hash": 4684002624471101000,
"line_mean": 25.3376623377,
"line_max": 80,
"alpha_frac": 0.6686390533,
"autogenerated": false,
"ratio": 3.2448,
"config_test": true,
"has_no_keyw... |
"""
Traverse an HDFS tree and output disk space usage by block size.
"""
import sys
import pydoop.hdfs as hdfs
from common import isdir, MB, TEST_ROOT
def treewalker(fs, root_info):
yield root_info
if root_info['kind'] == 'directory':
for info in fs.list_directory(root_info['name']):
for item in treew... | {
"repo_name": "jkahn/pydoop-code",
"path": "examples/hdfs/treewalk.py",
"copies": "1",
"size": "1612",
"license": "apache-2.0",
"hash": 8402195482258192000,
"line_mean": 25,
"line_max": 77,
"alpha_frac": 0.6575682382,
"autogenerated": false,
"ratio": 3.263157894736842,
"config_test": false,
"... |
"""
Utilities for unit tests.
"""
import sys, os, random, uuid, tempfile
import pydoop
_HADOOP_HOME = pydoop.hadoop_home()
_HADOOP_CONF_DIR = pydoop.hadoop_conf()
_RANDOM_DATA_SIZE = 32
_DEFAULT_HDFS_HOST = "localhost"
_DEFAULT_HDFS_PORT = 8020 if pydoop.is_cloudera() else 9000
_DEFAULT_BYTES_PER_CHECKSUM = 512
HD... | {
"repo_name": "jkahn/pydoop-code",
"path": "test/utils.py",
"copies": "1",
"size": "2871",
"license": "apache-2.0",
"hash": -556347616517409300,
"line_mean": 24.407079646,
"line_max": 77,
"alpha_frac": 0.6290491118,
"autogenerated": false,
"ratio": 2.9813084112149535,
"config_test": false,
"h... |
# DEV NOTE: some of the variables defined here (docstring included)
# are parsed by setup.py, check it before modifying them.
"""
Pydoop: a Python MapReduce and HDFS API for Hadoop
--------------------------------------------------
Pydoop is a Python interface to Hadoop that allows you to write
MapReduce application... | {
"repo_name": "ilveroluca/pydoop",
"path": "pydoop/__init__.py",
"copies": "1",
"size": "4726",
"license": "apache-2.0",
"hash": 5135377249846847000,
"line_mean": 24.967032967,
"line_max": 77,
"alpha_frac": 0.6732966568,
"autogenerated": false,
"ratio": 3.3375706214689265,
"config_test": false,... |
# DEV NOTE: this module is used by the setup script, so it MUST be
# importable even if Pydoop has not been installed (yet).
"""
Tools for retrieving information on the available Hadoop
installation(s): version, classpath, etc.
Known issues: from-tarball CDH installation is not supported.
"""
import os
import glob
... | {
"repo_name": "ilveroluca/pydoop",
"path": "pydoop/hadoop_utils.py",
"copies": "2",
"size": "20493",
"license": "apache-2.0",
"hash": 5284307911003815000,
"line_mean": 32.3219512195,
"line_max": 99,
"alpha_frac": 0.5362806812,
"autogenerated": false,
"ratio": 3.652290144359294,
"config_test": f... |
from abc import ABCMeta, abstractmethod
from pydoop.utils.serialize import private_decode
class ProtocolError(Exception):
pass
class ProtocolAbort(ProtocolError):
pass
class StreamFilter(object):
__metaclass__ = ABCMeta
def __init__(self, stream):
self.stream = stream
def __iter__... | {
"repo_name": "ilveroluca/pydoop",
"path": "pydoop/mapreduce/streams.py",
"copies": "3",
"size": "4229",
"license": "apache-2.0",
"hash": 2729940077741959700,
"line_mean": 25.9363057325,
"line_max": 78,
"alpha_frac": 0.5996689525,
"autogenerated": false,
"ratio": 4.400624349635796,
"config_test... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.