text stringlengths 0 1.05M | meta dict |
|---|---|
"""ApacheParser is a member object of the ApacheConfigurator class."""
import fnmatch
import itertools
import logging
import os
import re
import subprocess
from certbot import errors
from certbot_apache import constants
logger = logging.getLogger(__name__)
class ApacheParser(object):
"""Class handles the fine ... | {
"repo_name": "bsmr-misc-forks/letsencrypt",
"path": "certbot-apache/certbot_apache/parser.py",
"copies": "7",
"size": "24118",
"license": "apache-2.0",
"hash": 5343351331119563000,
"line_mean": 36.450310559,
"line_max": 91,
"alpha_frac": 0.5715648064,
"autogenerated": false,
"ratio": 4.168337366... |
"""ApacheParser is a member object of the ApacheConfigurator class."""
import fnmatch
import itertools
import logging
import os
import re
import subprocess
from letsencrypt import errors
from letsencrypt_apache import constants
logger = logging.getLogger(__name__)
class ApacheParser(object):
"""Class handles t... | {
"repo_name": "TheBoegl/letsencrypt",
"path": "letsencrypt-apache/letsencrypt_apache/parser.py",
"copies": "1",
"size": "24118",
"license": "apache-2.0",
"hash": -388773089462318900,
"line_mean": 36.450310559,
"line_max": 91,
"alpha_frac": 0.5716062692,
"autogenerated": false,
"ratio": 4.17049974... |
"""ApacheParser is a member object of the ApacheConfigurator class."""
import fnmatch
import itertools
import logging
import os
import re
import subprocess
from letsencrypt import errors
logger = logging.getLogger(__name__)
class ApacheParser(object):
"""Class handles the fine details of parsing the Apache Con... | {
"repo_name": "ahojjati/letsencrypt",
"path": "letsencrypt-apache/letsencrypt_apache/parser.py",
"copies": "7",
"size": "21847",
"license": "apache-2.0",
"hash": -2344342698961028000,
"line_mean": 36.6024096386,
"line_max": 91,
"alpha_frac": 0.5760974047,
"autogenerated": false,
"ratio": 4.091964... |
"""ApacheParser is a member object of the ApacheConfigurator class."""
import os
import re
from letsencrypt import errors
class ApacheParser(object):
"""Class handles the fine details of parsing the Apache Configuration.
:ivar str root: Normalized abosulte path to the server root
directory. Without ... | {
"repo_name": "digideskio/lets-encrypt-preview",
"path": "letsencrypt_apache/parser.py",
"copies": "2",
"size": "15605",
"license": "apache-2.0",
"hash": 3979848765111191600,
"line_mean": 36.784503632,
"line_max": 80,
"alpha_frac": 0.5738545338,
"autogenerated": false,
"ratio": 4.046939834024896,... |
"""Apache plugin constants."""
import pkg_resources
from letsencrypt import le_util
CLI_DEFAULTS_DEBIAN = dict(
server_root="/etc/apache2",
vhost_root="/etc/apache2/sites-available",
vhost_files="*",
version_cmd=['apache2ctl', '-v'],
define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],
resta... | {
"repo_name": "mitnk/letsencrypt",
"path": "letsencrypt-apache/letsencrypt_apache/constants.py",
"copies": "2",
"size": "4123",
"license": "apache-2.0",
"hash": -9007105534221981000,
"line_mean": 32.25,
"line_max": 74,
"alpha_frac": 0.6458889158,
"autogenerated": false,
"ratio": 3.128224582701062... |
"""Apache plugin constants."""
import pkg_resources
CLI_DEFAULTS = dict(
server_root="/etc/apache2",
ctl="apache2ctl",
enmod="a2enmod",
dismod="a2dismod",
init_script="/etc/init.d/apache2",
le_vhost_ext="-le-ssl.conf",
)
"""CLI defaults."""
MOD_SSL_CONF_DEST = "options-ssl-apache.conf"
"""Nam... | {
"repo_name": "sjerdo/letsencrypt",
"path": "letsencrypt-apache/letsencrypt_apache/constants.py",
"copies": "1",
"size": "1221",
"license": "apache-2.0",
"hash": -551372323606391230,
"line_mean": 28.7804878049,
"line_max": 72,
"alpha_frac": 0.6814086814,
"autogenerated": false,
"ratio": 3.1550387... |
"""Apache plugin constants."""
import pkg_resources
CLI_DEFAULTS = dict(
server_root="/etc/apache2",
ctl="apache2ctl",
enmod="a2enmod",
dismod="a2dismod",
le_vhost_ext="-le-ssl.conf",
)
"""CLI defaults."""
MOD_SSL_CONF_DEST = "options-ssl-apache.conf"
"""Name of the mod_ssl config file as saved i... | {
"repo_name": "Sveder/letsencrypt",
"path": "letsencrypt-apache/letsencrypt_apache/constants.py",
"copies": "6",
"size": "1182",
"license": "apache-2.0",
"hash": 233862619065675070,
"line_mean": 28.55,
"line_max": 72,
"alpha_frac": 0.6827411168,
"autogenerated": false,
"ratio": 3.168900804289544,... |
"""Apache plugin constants."""
import pkg_resources
MOD_SSL_CONF_DEST = "options-ssl-apache.conf"
"""Name of the mod_ssl config file as saved in `IConfig.config_dir`."""
UPDATED_MOD_SSL_CONF_DIGEST = ".updated-options-ssl-apache-conf-digest.txt"
"""Name of the hash of the updated or informed mod_ssl_conf as saved i... | {
"repo_name": "letsencrypt/letsencrypt",
"path": "certbot-apache/certbot_apache/constants.py",
"copies": "1",
"size": "2562",
"license": "apache-2.0",
"hash": -6849753915097495000,
"line_mean": 39.6666666667,
"line_max": 96,
"alpha_frac": 0.725214676,
"autogenerated": false,
"ratio": 2.6330935251... |
'''Apache Sling Shell
#requires poster (http://atlee.ca/software/poster/index.html)
'''
import urllib2
import base64
import json
import subprocess
import os
#import poster
#
#def curl(url, username=None, password=None, method='GET', data=None, file_path=None):
# '''simple HTTP util. similar to curl
# data shoul... | {
"repo_name": "saml/rosling",
"path": "scripts/sling/__init__.py",
"copies": "1",
"size": "3895",
"license": "apache-2.0",
"hash": -6538723688089253000,
"line_mean": 28.5075757576,
"line_max": 110,
"alpha_frac": 0.5530166881,
"autogenerated": false,
"ratio": 3.560329067641682,
"config_test": fa... |
# Apache Thrift Binary Protocol Struct 2.0 Writer in Python
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift import Thrift
class Trade:
def __init__(self):
symbol=""
price=0.0
size=0
timestamp=0.0
trans = TTransport.TFileObjectTra... | {
"repo_name": "RandyAbernethy/ThriftBook",
"path": "part2/protocols/bin_file_write.py",
"copies": "1",
"size": "1126",
"license": "apache-2.0",
"hash": 3228636701239496700,
"line_mean": 23.4782608696,
"line_max": 63,
"alpha_frac": 0.7317939609,
"autogenerated": false,
"ratio": 3.4968944099378882,... |
# Apache Thrift Transport Exceptions in Python
import pickle
import sys
from thrift import Thrift
from thrift.transport import TTransport
class Trade:
def __init__(self):
symbol=""
price=0.0
size=0
try:
trans = TTransport.TFileObjectTransport(open("data","wb"))
trade = Trade()
... | {
"repo_name": "RandyAbernethy/ThriftBook",
"path": "part2/exceptions/trans_excep.py",
"copies": "1",
"size": "1237",
"license": "apache-2.0",
"hash": -5833475773840761000,
"line_mean": 28.4523809524,
"line_max": 75,
"alpha_frac": 0.5885206144,
"autogenerated": false,
"ratio": 3.5444126074498565,
... |
"""A package for creating Extract-Transform-Load (ETL) programs in Python.
The package contains a number of classes for filling fact tables
and dimensions (including snowflaked and slowly changing dimensions),
classes for extracting data from different sources, classes for defining
'steps' in an ETL flow,... | {
"repo_name": "haleemur/pygrametl-python3",
"path": "pygrametl/__init__.py",
"copies": "1",
"size": "38806",
"license": "bsd-2-clause",
"hash": 7515528065578614000,
"line_mean": 35.8878326996,
"line_max": 80,
"alpha_frac": 0.5969180024,
"autogenerated": false,
"ratio": 4.3305434661310125,
"conf... |
"""A package for managing OpenBSD's Packet Filter."""
__copyright__ = """
Copyright (c) 2008-2019, Daniele Mazzocchio
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source cod... | {
"repo_name": "dotpy/py-pf",
"path": "pf/__init__.py",
"copies": "1",
"size": "2483",
"license": "bsd-3-clause",
"hash": -8542995435415514000,
"line_mean": 31.6710526316,
"line_max": 80,
"alpha_frac": 0.6951268627,
"autogenerated": false,
"ratio": 4.237201365187714,
"config_test": false,
"has... |
"""A package (for Nevow) for defining the schema, validation and rendering of
HTML forms.
"""
version_info = (0, 12, 0)
version = '.'.join([str(i) for i in version_info])
from nevow import static
from formal.types import *
from formal.validation import *
from formal.widget import *
from formal.widgets.restwidget im... | {
"repo_name": "emgee/formal",
"path": "formal/__init__.py",
"copies": "1",
"size": "3033",
"license": "mit",
"hash": -8349110148061537000,
"line_mean": 42.3285714286,
"line_max": 107,
"alpha_frac": 0.8143752061,
"autogenerated": false,
"ratio": 3.8103015075376883,
"config_test": false,
"has_n... |
# A package manager meant for Pythonista, built on StaSh.
import requests
import sys
import argparse
from os import remove, mkdir, rename, listdir, getcwd
from shutil import rmtree
cwd = getcwd()
documentsIndex = cwd.index("Documents")
documentsIndex += len("Documents")
ROOT = cwd[:documentsIndex]
class stansi: # Co... | {
"repo_name": "cclauss/stash",
"path": "bin/latte.py",
"copies": "1",
"size": "5972",
"license": "mit",
"hash": 3187197564952764400,
"line_mean": 34.9759036145,
"line_max": 383,
"alpha_frac": 0.6790020094,
"autogenerated": false,
"ratio": 2.9785536159600996,
"config_test": true,
"has_no_keywo... |
''' a package of data mapping classes '''
__author__ = 'rcj1492'
__created__ = '2016.01'
__license__ = 'MIT'
from jsonmodel.exceptions import ModelValidationError
class mapModel(object):
'''
a helper class of recursive methods to map the json model
'''
_dummy_int = 1
_dummy_float = 1.1
... | {
"repo_name": "collectiveacuity/jsonModel",
"path": "jsonmodel/mapping.py",
"copies": "1",
"size": "4428",
"license": "mit",
"hash": -4817052465847150000,
"line_mean": 38.5357142857,
"line_max": 151,
"alpha_frac": 0.5433604336,
"autogenerated": false,
"ratio": 4.138317757009346,
"config_test": ... |
''' a package of extensions to a jsonModel class object '''
__author__ = 'rcj1492'
__created__ = '2018.03'
__license__ = 'MIT'
def tabulate(json_model):
'''
a function to add the tabulate method to a jsonModel object
:param json_model: jsonModel object
:return: jsonModel object
''... | {
"repo_name": "collectiveacuity/jsonModel",
"path": "jsonmodel/extensions.py",
"copies": "1",
"size": "1346",
"license": "mit",
"hash": 5716098381959122000,
"line_mean": 30.3023255814,
"line_max": 102,
"alpha_frac": 0.647102526,
"autogenerated": false,
"ratio": 3.958823529411765,
"config_test":... |
''' a package of functions for parsing STDOUT and STDERR '''
__author__ = 'rcj1492'
__created__ = '2018.02'
__license__ = 'MIT'
def convert_table(shell_output, delimiter='\t|\s{2,}', output='dict'):
'''
a method to convert a STDOUT shell table into a python data structure
:param shell_output:... | {
"repo_name": "collectiveacuity/labPack",
"path": "labpack/parsing/shell.py",
"copies": "1",
"size": "2633",
"license": "mit",
"hash": 6357947268402882000,
"line_mean": 32.7692307692,
"line_max": 102,
"alpha_frac": 0.5620964679,
"autogenerated": false,
"ratio": 3.941616766467066,
"config_test":... |
''' a package of helper functions for extensions.py '''
__author__ = 'rcj1492'
__created__ = '2018.03'
__license__ = 'MIT'
def _segment_path(dot_path):
import re
digit_pat = re.compile('\[(\d+)\]')
key_list = dot_path.split('.')
segment_list = []
for key in key_list:
if key:
ite... | {
"repo_name": "collectiveacuity/jsonModel",
"path": "jsonmodel/_extensions.py",
"copies": "1",
"size": "8008",
"license": "mit",
"hash": -8931232929679571000,
"line_mean": 37.3205741627,
"line_max": 206,
"alpha_frac": 0.4604145854,
"autogenerated": false,
"ratio": 4.214736842105263,
"config_tes... |
''' a package of methods for compiling information about ISO 3166 2 US state codes '''
__author__ = 'rcj1492'
__created__ = '2017.10'
__license__ = 'MIT'
# TODO scrape an online table to get latest csv values
def update_csv(csv_url=''):
pass
def compile_list(csv_file='datasets/iso_3166_2_US.csv'):
f... | {
"repo_name": "collectiveacuity/labPack",
"path": "labpack/datasets/iso_3166_2_US.py",
"copies": "1",
"size": "2157",
"license": "mit",
"hash": -2093339243405998000,
"line_mean": 28.9722222222,
"line_max": 101,
"alpha_frac": 0.6142790913,
"autogenerated": false,
"ratio": 3.7447916666666665,
"co... |
''' a package of methods for compiling information about ISO 3166 country codes '''
__author__ = 'rcj1492'
__created__ = '2017.10'
__license__ = 'MIT'
# TODO scrape an online table to get latest csv values
def update_csv(csv_url=''):
pass
def compile_list(csv_file='datasets/iso_3166.csv'):
from os i... | {
"repo_name": "collectiveacuity/labPack",
"path": "labpack/datasets/iso_3166.py",
"copies": "1",
"size": "2157",
"license": "mit",
"hash": 6629656093320428000,
"line_mean": 28.9722222222,
"line_max": 101,
"alpha_frac": 0.6152063051,
"autogenerated": false,
"ratio": 3.770979020979021,
"config_te... |
''' a package of methods for managing ssl authentication '''
__author__ = 'rcj1492'
__created__ = '2018.02'
__license__ = 'MIT'
def generate_keystore(key_alias, key_folder='./', root_cert='', truststore='', password='', organization='', organization_unit='', locality='', country='', key_size=2048, verbose=True, overwr... | {
"repo_name": "collectiveacuity/labPack",
"path": "labpack/authentication/ssl.py",
"copies": "1",
"size": "10536",
"license": "mit",
"hash": -1461070929057804800,
"line_mean": 45.6238938053,
"line_max": 202,
"alpha_frac": 0.6303151101,
"autogenerated": false,
"ratio": 3.5995900239152716,
"confi... |
''' a package of methods to compile search filters '''
__author__ = 'rcj1492'
__created__ = '2017.07'
__license__ = 'MIT'
def positional_filter(positional_filters, title=''):
'''
a method to construct a conditional filter function to test positional arguments
:param positional_filters: dictionary or... | {
"repo_name": "collectiveacuity/labPack",
"path": "labpack/compilers/filters.py",
"copies": "1",
"size": "5516",
"license": "mit",
"hash": 439457056498668740,
"line_mean": 36.277027027,
"line_max": 107,
"alpha_frac": 0.5598259608,
"autogenerated": false,
"ratio": 4.647009267059815,
"config_test... |
''' a package of methods to generate the differences between two data architectures '''
__author__ = 'rcj1492'
__created__ = '2015.08'
__license__ = 'MIT'
def compare_records(new_record, old_record):
'''
a method to generate the differences between two data architectures
:param new_record: se... | {
"repo_name": "collectiveacuity/labPack",
"path": "labpack/parsing/comparison.py",
"copies": "1",
"size": "7294",
"license": "mit",
"hash": -2678590979965319000,
"line_mean": 37.8031914894,
"line_max": 95,
"alpha_frac": 0.5681381958,
"autogenerated": false,
"ratio": 3.438943894389439,
"config_t... |
''' a package of methods to handle nginx configurations '''
__author__ = 'rcj1492'
__created__ = '2017.06'
__license__ = 'MIT'
def compile_nginx(server_list, http_port=80, ssl_port=None, ssl_gateway=''):
'''
a method to compile nginx configurations for forwarding to containers
:... | {
"repo_name": "collectiveacuity/pocketLab",
"path": "pocketlab/methods/nginx.py",
"copies": "1",
"size": "10418",
"license": "mit",
"hash": 4503319686365080000,
"line_mean": 49.068627451,
"line_max": 712,
"alpha_frac": 0.6045306201,
"autogenerated": false,
"ratio": 3.6073407202216066,
"config_t... |
''' a package of methods to handle node file generation '''
__author__ = 'rcj1492'
__created__ = '2020.12'
__license__ = '©2020 Collective Acuity'
def generate_json(template_path, model_path, fields_map, replacement_map, printer):
from os import path
if not path.exists(template_path):
import json
... | {
"repo_name": "collectiveacuity/pocketLab",
"path": "pocketlab/methods/node.py",
"copies": "1",
"size": "2221",
"license": "mit",
"hash": -1820349281759321600,
"line_mean": 44.3265306122,
"line_max": 92,
"alpha_frac": 0.6301801802,
"autogenerated": false,
"ratio": 4.043715846994536,
"config_tes... |
''' a package of methods to merge two or more json documents preserving order '''
__author__ = 'rcj1492'
__created__ = '2021.03'
__license__ = '©2021 Collective Acuity'
import json as json_lib
from collections import OrderedDict
def walk_data(target, source):
''' method to recursively walk parse tree and merge ... | {
"repo_name": "collectiveacuity/labPack",
"path": "labpack/compilers/json.py",
"copies": "1",
"size": "3592",
"license": "mit",
"hash": 1411518717079732200,
"line_mean": 36.40625,
"line_max": 86,
"alpha_frac": 0.6209969368,
"autogenerated": false,
"ratio": 4.627577319587629,
"config_test": fals... |
''' a package of methods to merge two or more yaml documents preserving order & comments '''
__author__ = 'rcj1492'
__created__ = '2021.03'
__license__ = '©2021 Collective Acuity'
'''
PLEASE NOTE: yaml package requires the ruamel.yaml module.
(all platforms) pip3 install ruamel.yaml
'''
try:
from ruamel.yaml ... | {
"repo_name": "collectiveacuity/labPack",
"path": "labpack/compilers/yaml.py",
"copies": "1",
"size": "8945",
"license": "mit",
"hash": 5721571771957876000,
"line_mean": 37.8869565217,
"line_max": 110,
"alpha_frac": 0.6180679785,
"autogenerated": false,
"ratio": 4.579621095750128,
"config_test"... |
# A palindromic number reads the same both ways.
# The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
# Find the largest palindrome made from the product of two 3-digit numbers.
from Problem import Problem
class LargestPalindromeProduct(Problem):
def __init__(self):
sel... | {
"repo_name": "hperreault/ProjectEuler",
"path": "004_LargestPalindromeProduct.py",
"copies": "1",
"size": "1244",
"license": "mit",
"hash": 4122042784353559600,
"line_mean": 31.7105263158,
"line_max": 88,
"alpha_frac": 0.6202735318,
"autogenerated": false,
"ratio": 3.7552870090634443,
"config_... |
""" a panel that dispaly user information """
from subprocess import Popen
from PyQt5.QtWidgets import QWidget, QMessageBox, QFileDialog
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import Qt
from PyQt5 import QtCore, QtGui, QtWidgets
class UserInfo(QWidget):
def __init__(self, parent=None):
super(... | {
"repo_name": "whuang001/cts",
"path": "gui/UserInfo.py",
"copies": "1",
"size": "9137",
"license": "mit",
"hash": -6596318253798461000,
"line_mean": 49.2032967033,
"line_max": 102,
"alpha_frac": 0.6919120061,
"autogenerated": false,
"ratio": 3.9332759362892813,
"config_test": false,
"has_no_... |
""" a panflute filter to find citations in markdown,
with attributes and prefixes,
- extract the attributes, classes and prefix
- wrap the cite with a Span with class 'attribute-Cite',
- add the classes, attributes and prefix to the Span, and
- remove the attribute string and prefix
For example:
```
+@label {}.class... | {
"repo_name": "chrisjsewell/ipypublish",
"path": "ipypublish/filters_pandoc/prepare_cites.py",
"copies": "1",
"size": "3600",
"license": "bsd-3-clause",
"hash": -7728732918395981000,
"line_mean": 25.6666666667,
"line_max": 83,
"alpha_frac": 0.6188888889,
"autogenerated": false,
"ratio": 3.6659877... |
""" a panflute filter to find raw elements
and convert them to format agnostic Span elements
"""
import re
from typing import Union # noqa: F401
from panflute import Element, Doc, Cite, RawInline, Link # noqa: F401
import panflute as pf
from ipypublish.filters_pandoc.definitions import (
ATTRIBUTE_CITE_CLASS,
... | {
"repo_name": "chrisjsewell/ipypublish",
"path": "ipypublish/filters_pandoc/prepare_raw.py",
"copies": "1",
"size": "16093",
"license": "bsd-3-clause",
"hash": -2014222299903282000,
"line_mean": 30.0675675676,
"line_max": 121,
"alpha_frac": 0.530230535,
"autogenerated": false,
"ratio": 4.04346733... |
""" a panflute filter to format Cite elements
The :py:mod:`ipypublish.filters_pandoc.prepare_cites` filter should be run
first to access the functionality below:
"""
from panflute import Element, Doc, Span, Cite # noqa: F401
import panflute as pf
from ipypublish.filters_pandoc.definitions import (
ATTRIBUTE_CIT... | {
"repo_name": "chrisjsewell/ipypublish",
"path": "ipypublish/filters_pandoc/format_cite_elements.py",
"copies": "1",
"size": "7980",
"license": "bsd-3-clause",
"hash": -7911466033817192000,
"line_mean": 31.8395061728,
"line_max": 88,
"alpha_frac": 0.4996240602,
"autogenerated": false,
"ratio": 3.... |
""" a panflute filter to format Span element
representations of RawInline elements
The :py:mod:`ipypublish.filters_pandoc.prepare_raw` filter should be run
first to access the functionality below:
"""
import itertools
# from textwrap import fill as textwrap
from panflute import Element, Doc, Span # noqa: F401
impo... | {
"repo_name": "chrisjsewell/ipypublish",
"path": "ipypublish/filters_pandoc/format_raw_spans.py",
"copies": "1",
"size": "9123",
"license": "bsd-3-clause",
"hash": 9211647737611015000,
"line_mean": 33.0410447761,
"line_max": 117,
"alpha_frac": 0.5139756659,
"autogenerated": false,
"ratio": 4.0083... |
""" a panflute filter to override vs-code Markdown Preview Enhanced (MPE)
interpretation of RMarkdown python cells.
MPE expects cells to have braced attributes after code name;
::
```python {cmnd=true}
print("hi")
```
whereas, in RMarkdown, the code name is included in the brace:
::
```{python ipub... | {
"repo_name": "chrisjsewell/ipypublish",
"path": "ipypublish/filters_pandoc/rmarkdown_to_mpe.py",
"copies": "1",
"size": "2324",
"license": "bsd-3-clause",
"hash": -5917130672298677000,
"line_mean": 25.1123595506,
"line_max": 77,
"alpha_frac": 0.5722891566,
"autogenerated": false,
"ratio": 3.3828... |
""" a panflute filter to prepare document labelling in markdown files:
1) Add a ``$$reference`` key to the Document metadata
Then, for each Image, Math and Table found;
2) Extract labels and attributes to the right of Math or Table captions,
in the form; ``{#id .class-name a="an attribute"}``
3) If attributes found... | {
"repo_name": "chrisjsewell/ipypublish",
"path": "ipypublish/filters_pandoc/prepare_labels.py",
"copies": "1",
"size": "5171",
"license": "bsd-3-clause",
"hash": 2912570272974019000,
"line_mean": 26.6524064171,
"line_max": 88,
"alpha_frac": 0.5851866177,
"autogenerated": false,
"ratio": 3.7228221... |
# A parallelized "find(1)" using the thread module.
# This demonstrates the use of a work queue and worker threads.
# It really does do more stats/sec when using multiple threads,
# although the improvement is only about 20-30 percent.
# (That was 8 years ago. In 2002, on Linux, I can't measure
# a speedup. :-( )
# ... | {
"repo_name": "wskplho/sl4a",
"path": "python/src/Demo/threads/find.py",
"copies": "47",
"size": "4215",
"license": "apache-2.0",
"hash": 2872756967697825000,
"line_mean": 26.1935483871,
"line_max": 71,
"alpha_frac": 0.5779359431,
"autogenerated": false,
"ratio": 3.6056458511548333,
"config_tes... |
#A parameter testing script for presentsGame
import presentsGame as pg
import numpy as np
import csv
numberOfPresents = 648
sleighDim = 1000
numberOfGenerations = 15000
num_ordered = 0
numberOfGenes = 30
fileOut = 'NumPresents' + str(numberOfPresents) + 'NumGenerations' + str(numberOfGenerations) + '.csv'
with open(... | {
"repo_name": "rhsimplex/santas-sleigh",
"path": "testparameters.py",
"copies": "1",
"size": "2439",
"license": "mit",
"hash": 3194216105770140000,
"line_mean": 52.0217391304,
"line_max": 244,
"alpha_frac": 0.5990159902,
"autogenerated": false,
"ratio": 3.3781163434903045,
"config_test": false,... |
"""A parser and instruction generator for transformation rule strings."""
from functools import lru_cache
import re
from parsimonious.grammar import Grammar
from parsimonious.nodes import NodeVisitor
from treepace.instructions import (AddNode, AddReference, Find, GoToParent,
GroupEnd, GroupStart, SearchReference, ... | {
"repo_name": "sulir/treepace",
"path": "treepace/compiler.py",
"copies": "1",
"size": "6904",
"license": "mit",
"hash": -1363488909267531500,
"line_mean": 36.3189189189,
"line_max": 80,
"alpha_frac": 0.614571263,
"autogenerated": false,
"ratio": 4.222629969418961,
"config_test": false,
"has_... |
""" A parser and other parser related classes. """
import pyparsing
from .models import Command, Input, Output, Grammar
from .models import command_template_factory as ctf
class Parser(object):
def __init__(self, string):
self.string = string
self.commands = []
self.paths = []
s... | {
"repo_name": "Sonictherocketman/metapipe",
"path": "metapipe/parser.py",
"copies": "2",
"size": "2968",
"license": "mit",
"hash": -5576982518445397000,
"line_mean": 34.3333333333,
"line_max": 80,
"alpha_frac": 0.5717654987,
"autogenerated": false,
"ratio": 4.0491132332878585,
"config_test": fa... |
"""A parser for ASN1 object encoded using BER
The doc string just sketches the names of objects in the module.
Consult the documentation for more details.
Burton S. Kaliski Jr. wrote a helpful introduction to ASN.1 and the
BER encoding titled 'A Layman's Guide to a Subset of ASN.1, BER, and
DER.' It is available fro... | {
"repo_name": "danieljohnlewis/pisces",
"path": "pisces/asn1.py",
"copies": "1",
"size": "20341",
"license": "mit",
"hash": -7129103285800786000,
"line_mean": 28.9572901325,
"line_max": 86,
"alpha_frac": 0.5218524163,
"autogenerated": false,
"ratio": 3.8900363358194685,
"config_test": false,
... |
"""A parser for axfs file system images"""
from stat import *
import zlib
from . import *
from ..io import *
from ..util import *
AxfsHeader = Struct('AxfsHeader', [
('magic', Struct.STR % 4),
('signature', Struct.STR % 16),
('digest', Struct.STR % 40),
('blockSize', Struct.INT32),
('files', Struct.INT64),
('s... | {
"repo_name": "ma1co/fwtool.py",
"path": "fwtool/archive/axfs.py",
"copies": "1",
"size": "3572",
"license": "mit",
"hash": -7714316123491403000,
"line_mean": 26.6899224806,
"line_max": 161,
"alpha_frac": 0.6637737962,
"autogenerated": false,
"ratio": 3.114210985178727,
"config_test": false,
... |
"""A parser for Backup.bin, the settings file used on Sony cameras"""
# see /usr/kmod/backup.ko
from collections import namedtuple
from ..util import *
BackupHeader = Struct('BackupHeader', [
('magic', Struct.INT32),
('cookie', Struct.INT32),
('writeComp', Struct.INT32),
('version', Struct.STR % 4),
('numSubsys... | {
"repo_name": "ma1co/fwtool.py",
"path": "fwtool/sony/backup.py",
"copies": "1",
"size": "2986",
"license": "mit",
"hash": 216220243290607970,
"line_mean": 28.5643564356,
"line_max": 114,
"alpha_frac": 0.7123241795,
"autogenerated": false,
"ratio": 3.48018648018648,
"config_test": false,
"has... |
"""A parser for cramfs file system images"""
from collections import namedtuple, OrderedDict
import io
import os
import posixpath
from stat import *
import zlib
from . import *
from ..io import *
from .. import lz77
from ..util import *
CramfsSuper = Struct('CramfsSuper', [
('magic', Struct.STR % 4),
('size', Stru... | {
"repo_name": "ma1co/fwtool.py",
"path": "fwtool/archive/cramfs.py",
"copies": "1",
"size": "5212",
"license": "mit",
"hash": -3229518717769806000,
"line_mean": 25.7282051282,
"line_max": 104,
"alpha_frac": 0.6686492709,
"autogenerated": false,
"ratio": 2.942970073404856,
"config_test": false,
... |
"""A parser for ext2 file system images"""
from stat import *
from . import *
from ..io import *
from ..util import *
Ext2Header = Struct('Ext2Header', [
('bootRecord', 1024),
('inodesCount', Struct.INT32),
('blocksCount', Struct.INT32),
('...', 16),
('blockSize', Struct.INT32),
('...', 4),
('blocksPerGroup',... | {
"repo_name": "ma1co/fwtool.py",
"path": "fwtool/archive/ext2.py",
"copies": "1",
"size": "3131",
"license": "mit",
"hash": -8448278426219147000,
"line_mean": 24.8760330579,
"line_max": 140,
"alpha_frac": 0.6349409134,
"autogenerated": false,
"ratio": 3.0398058252427185,
"config_test": false,
... |
"""A parser for FAT file system images"""
import io
import posixpath
import shutil
from stat import *
import time
from . import *
from ..io import *
from ..util import *
FatHeader = Struct('FatHeader', [
('jump', Struct.STR % 3),
('oemName', Struct.STR % 8),
('bytesPerSector', Struct.INT16),
('sectorsPerCluster'... | {
"repo_name": "ma1co/fwtool.py",
"path": "fwtool/archive/fat.py",
"copies": "1",
"size": "8219",
"license": "mit",
"hash": 8106126916554502000,
"line_mean": 29.4407407407,
"line_max": 180,
"alpha_frac": 0.6220951454,
"autogenerated": false,
"ratio": 2.974665218964893,
"config_test": false,
"h... |
"""A parser for HCL2 implemented using the Lark parser"""
import os
from os.path import exists, dirname
from lark import Lark
from lark.grammar import Rule
from lark.lexer import TerminalDef
from hcl2.transformer import DictTransformer
PARSER_FILE = os.path.join(dirname(__file__), 'lark_parser.py')
PARSER_FILE_TEMP... | {
"repo_name": "amplify-education/python-hcl2",
"path": "hcl2/parser.py",
"copies": "1",
"size": "2036",
"license": "mit",
"hash": -7207084062034242000,
"line_mean": 37.4150943396,
"line_max": 109,
"alpha_frac": 0.7357563851,
"autogenerated": false,
"ratio": 3.629233511586453,
"config_test": fal... |
"""A parser for HTML and XHTML.
Backported for python-future from Python 3.3.
"""
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity... | {
"repo_name": "thonkify/thonkify",
"path": "src/lib/future/backports/html/parser.py",
"copies": "1",
"size": "19849",
"license": "mit",
"hash": 5379010073604441000,
"line_mean": 35.9627560521,
"line_max": 80,
"alpha_frac": 0.487530858,
"autogenerated": false,
"ratio": 4.102728400165358,
"config... |
"""A parser for HTML and XHTML."""
########
# This is copied from Python3 and the slightly modified to support needed
# features. The original file can be found at:
# https://github.com/python/cpython/blob/44b548dda872c0d4f30afd6b44fd74b053a55ad8/Lib/html/parser.py
#
# The largest difference is the reinstatment of the... | {
"repo_name": "mankyd/htmlmin",
"path": "htmlmin/python3html/parser.py",
"copies": "1",
"size": "18039",
"license": "bsd-3-clause",
"hash": -4397138810753088500,
"line_mean": 36.5031185031,
"line_max": 100,
"alpha_frac": 0.5105604524,
"autogenerated": false,
"ratio": 4.094189741261916,
"config_... |
"""A parser for HTML and XHTML.
This code is a direct copy of Python 2.7.10 source.
It is intended for further customization as some special/adversarial cases
in web test are not handled by known parsers.
"""
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to disti... | {
"repo_name": "Livefyre/flaubert",
"path": "flaubert/HTMLParser.py",
"copies": "2",
"size": "17393",
"license": "mit",
"hash": -5723417758449017000,
"line_mean": 35.0103519669,
"line_max": 87,
"alpha_frac": 0.5058931754,
"autogenerated": false,
"ratio": 4.046765937645416,
"config_test": false,
... |
"""A parser for HTML and XHTML."""
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tags are special)
# and CDAT... | {
"repo_name": "franekp/millandict",
"path": "ankidict/thirdparty/bs4/builder/HTMLParser.py",
"copies": "2",
"size": "17138",
"license": "mit",
"hash": -3610825267012324000,
"line_mean": 34.928721174,
"line_max": 87,
"alpha_frac": 0.5027424437,
"autogenerated": false,
"ratio": 4.068850902184235,
... |
"""A parser for HTML and XHTML."""
# This file is a modified Version from htmlparser.HTMLParser
# in this version tag and attribute names aren't converted to
# lowercase
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to distinguish between PCDATA (parsed
# character... | {
"repo_name": "ernw/python-wcfbin",
"path": "wcf/MyHTMLParser.py",
"copies": "2",
"size": "13903",
"license": "bsd-3-clause",
"hash": -3600152253876996600,
"line_mean": 33.5845771144,
"line_max": 87,
"alpha_frac": 0.5019779904,
"autogenerated": false,
"ratio": 4.143964232488822,
"config_test": ... |
"""A parser for HTML and XHTML.
Backported for python-future from Python 3.3.
"""
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char a... | {
"repo_name": "agincel/AdamTestBot",
"path": "future/backports/html/parser.py",
"copies": "2",
"size": "20308",
"license": "mit",
"hash": -7757847978496462000,
"line_mean": 35.8175046555,
"line_max": 80,
"alpha_frac": 0.4765117195,
"autogenerated": false,
"ratio": 4.170876976791949,
"config_tes... |
"""A parser for HTML and XHTML."""
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tags are special)
# a... | {
"repo_name": "google/google-ctf",
"path": "third_party/edk2/AppPkg/Applications/Python/Python-2.7.10/Lib/HTMLParser.py",
"copies": "5",
"size": "17611",
"license": "apache-2.0",
"hash": -6723485861488223000,
"line_mean": 35.0757894737,
"line_max": 87,
"alpha_frac": 0.4892396797,
"autogenerated": f... |
"""A parser for HTML and XHTML."""
# This file is a modified Version from htmlparser.HTMLParser
# in this version tag and attribute names aren't converted to
# lowercase
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to distinguish between PCDATA (parsed
# c... | {
"repo_name": "InLefter/Air_Of_China",
"path": "wcf/MyHTMLParser.py",
"copies": "1",
"size": "14305",
"license": "mit",
"hash": 253369496792622620,
"line_mean": 33.5845771144,
"line_max": 87,
"alpha_frac": 0.4878713736,
"autogenerated": false,
"ratio": 4.238518518518519,
"config_test": false,
... |
"""A parser for HTML."""
# This file is derived from sgmllib.py, which is part of Python.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tags are special)
# and CDATA (character dat... | {
"repo_name": "NGSegovia/wsgi-intercept",
"path": "wsgi_intercept/webunit_intercept/HTMLParser.py",
"copies": "5",
"size": "15724",
"license": "mit",
"hash": 4301583849333503000,
"line_mean": 34.8177676538,
"line_max": 77,
"alpha_frac": 0.5062325108,
"autogenerated": false,
"ratio": 4.03800719054... |
'''A parser for redis messages
'''
from itertools import starmap
nil = b'$-1\r\n'
null_array = b'*-1\r\n'
REPLAY_TYPE = frozenset((b'$', # REDIS_REPLY_STRING,
b'*', # REDIS_REPLY_ARRAY,
b':', # REDIS_REPLY_INTEGER,
b'+', # REDIS_REPLY_S... | {
"repo_name": "dejlek/pulsar",
"path": "pulsar/apps/ds/pyparser.py",
"copies": "1",
"size": "6342",
"license": "bsd-3-clause",
"hash": -6504797495584087000,
"line_mean": 30.2413793103,
"line_max": 77,
"alpha_frac": 0.4886471145,
"autogenerated": false,
"ratio": 4.25923438549362,
"config_test": ... |
"""A parser for SGML, using the derived class as a static DTD."""
# Stolen from the Python 2.0 distribution and tweaked by JMT
# XXX This only supports those SGML features used by HTML.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable charact... | {
"repo_name": "hilbix/ekhtml",
"path": "testsuite/ek_sgmllib.py",
"copies": "1",
"size": "16039",
"license": "bsd-2-clause",
"hash": -1858468973763169800,
"line_mean": 31.66598778,
"line_max": 81,
"alpha_frac": 0.5004052622,
"autogenerated": false,
"ratio": 3.9997506234413964,
"config_test": tr... |
"""A parser for SGML, using the derived class as a static DTD."""
# XXX This only supports those SGML features used by HTML.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tag... | {
"repo_name": "ericlink/adms-server",
"path": "playframework-dist/play-1.1/python/Lib/sgmllib.py",
"copies": "2",
"size": "18320",
"license": "mit",
"hash": -8492274654981511000,
"line_mean": 31.4306569343,
"line_max": 79,
"alpha_frac": 0.4865174672,
"autogenerated": false,
"ratio": 4.20859177578... |
"""A parser for the Music Metadata XML Format (MMD).
This module contains L{MbXmlParser}, which parses the U{Music Metadata XML
Format (MMD) <http://musicbrainz.org/development/mmd/>} returned by the
MusicBrainz webservice.
There are also DOM helper functions in this module used by the parser which
probably aren't u... | {
"repo_name": "mineo/python-musicbrainz2",
"path": "src/musicbrainz2/wsxml.py",
"copies": "1",
"size": "47008",
"license": "bsd-3-clause",
"hash": -1789768180403304400,
"line_mean": 27.0644776119,
"line_max": 88,
"alpha_frac": 0.7034334581,
"autogenerated": false,
"ratio": 3.267167083680845,
"c... |
"""A parser for the pblite serialization format.
pblite (sometimes called "protojson") is a way of encoding Protocol Buffer
messages to arrays. Google uses this in Hangouts because JavaScript handles
arrays better than bytes.
This module allows parsing lists together with a schema to produce
programmer-friendly objec... | {
"repo_name": "taigrr/hangups",
"path": "hangups/pblite.py",
"copies": "5",
"size": "6015",
"license": "mit",
"hash": 9081935912682762000,
"line_mean": 30.9946808511,
"line_max": 79,
"alpha_frac": 0.6031587697,
"autogenerated": false,
"ratio": 4.6340523882896765,
"config_test": false,
"has_no... |
"""A parser for Thorsten Koch's final netlib results.model.lp
http://www.zib.de/koch/perplex/data/netlib/txt/
@article{Koch:2004:FNR:2308906.2309292,
author = {Koch, Thorsten},
title = {The Final NETLIB-LP Results},
journal = {Oper. Res. Lett.},
issue_date = {March, 2004},
volume = {32},
number = {2},
month = ... | {
"repo_name": "biosustain/optlang",
"path": "src/optlang/tests/data/parse_the_final_netlib_results.py",
"copies": "1",
"size": "1576",
"license": "apache-2.0",
"hash": -6105886372511711000,
"line_mean": 28.1851851852,
"line_max": 99,
"alpha_frac": 0.6516497462,
"autogenerated": false,
"ratio": 2.... |
# sgmlop support added by fredrik@pythonware.com (May 19, 1998)
__version__=''' $Id: xmllib.py 3660 2010-02-08 18:17:33Z damian $ '''
__doc__='''From before xmllib was in the Python standard library.
Probably ought to be removed'''
import re
import string
try:
import sgmlop # this works for both builtin on th... | {
"repo_name": "nakagami/reportlab",
"path": "src/reportlab/lib/xmllib.py",
"copies": "1",
"size": "25789",
"license": "bsd-3-clause",
"hash": 6492973456177945000,
"line_mean": 32.319121447,
"line_max": 80,
"alpha_frac": 0.5040521152,
"autogenerated": false,
"ratio": 4.062539382482671,
"config_t... |
"""A parser for XML, using the derived class as static DTD."""
# Author: Sjoerd Mullender.
import re
import string
import warnings
warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", DeprecationWarning)
del warnings
version = '0.3'
class Error(RuntimeError):
pass
# Regular expressions used f... | {
"repo_name": "salguarnieri/intellij-community",
"path": "python/lib/Lib/xmllib.py",
"copies": "160",
"size": "34848",
"license": "apache-2.0",
"hash": 3061496553857210000,
"line_mean": 36.5113024758,
"line_max": 109,
"alpha_frac": 0.4841023875,
"autogenerated": false,
"ratio": 4.1021777516185995... |
"""A parser for XML, using the derived class as static DTD."""
# Author: Sjoerd Mullender.
import re
import string
version = '0.3'
class Error(RuntimeError):
pass
# Regular expressions used for parsing
_S = '[ \t\r\n]+' # white space
_opS = '[ \t\r\n]*' # optional wh... | {
"repo_name": "Integral-Technology-Solutions/ConfigNOW",
"path": "Lib/xmllib.py",
"copies": "5",
"size": "34920",
"license": "mit",
"hash": 4782206203279085000,
"line_mean": 36.5888051668,
"line_max": 109,
"alpha_frac": 0.4829037801,
"autogenerated": false,
"ratio": 4.087078651685394,
"config_t... |
"""A parser for XML, using the derived class as static DTD."""
# Author: Sjoerd Mullender.
import re
import string
version = '0.3'
# Regular expressions used for parsing
_S = '[ \t\r\n]+' # white space
_opS = '[ \t\r\n]*' # optional white space
_Name = '[a-zA-Z_:][-a-zA-Z... | {
"repo_name": "MalloyPower/parsing-python",
"path": "front-end/testsuite-python-lib/Python-2.0/Lib/xmllib.py",
"copies": "4",
"size": "34935",
"license": "mit",
"hash": 2498084487694161400,
"line_mean": 36.9315960912,
"line_max": 109,
"alpha_frac": 0.4851009017,
"autogenerated": false,
"ratio": 4... |
"""A parser for XML, using the derived class as static DTD."""
# Author: Sjoerd Mullender.
import re
import string
version = '0.3'
class Error(RuntimeError):
pass
# Regular expressions used for parsing
_S = '[ \t\r\n]+' # white space
_opS = '[ \t\r\n]*' # optional whi... | {
"repo_name": "inessadl/kinect-2-libras",
"path": "Kinect2Libras/KinectFingerTracking/Lib/xmllib.py",
"copies": "41",
"size": "34728",
"license": "apache-2.0",
"hash": -977224960648606500,
"line_mean": 36.5437837838,
"line_max": 109,
"alpha_frac": 0.483010827,
"autogenerated": false,
"ratio": 4.1... |
# sgmlop support added by fredrik@pythonware.com (May 19, 1998)
__version__=''' $Id: xmllib.py 3342 2008-12-12 15:55:34Z andy $ '''
__doc__='''From before xmllib was in the Python standard library.
Probably ought to be removed'''
import re
import string
try:
import sgmlop # this works for both buil... | {
"repo_name": "commtrack/temp-aquatest",
"path": "reportlab/lib/xmllib.py",
"copies": "1",
"size": "26609",
"license": "bsd-3-clause",
"hash": 8476653236130839000,
"line_mean": 32.4230271669,
"line_max": 80,
"alpha_frac": 0.4914502612,
"autogenerated": false,
"ratio": 4.149228130360206,
"config... |
"""A parser for XML, using the derived class as static DTD."""
# Author: Sjoerd Mullender.
import re
import string
import warnings
warnings.warn("The xmllib module is obsolete. Use xml.sax instead.",
DeprecationWarning, 2)
del warnings
version = '0.3'
class Error(RuntimeError):
pa... | {
"repo_name": "diegocortassa/TACTIC",
"path": "src/context/client/tactic-api-python-4.0.api04/Lib/xmllib.py",
"copies": "25",
"size": "35795",
"license": "epl-1.0",
"hash": -8053630126297608000,
"line_mean": 36.4892473118,
"line_max": 109,
"alpha_frac": 0.4713228104,
"autogenerated": false,
"rati... |
"""A parser object for Psipred Ss2 files"""
from __future__ import print_function
__author__ = "Felix Simkovic & Jens Thomas"
__date__ = "13 Jan 2016"
__version__ = "0.1"
import collections
import logging
import warnings
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
class PsipredSs2Parser(object):
... | {
"repo_name": "rigdenlab/ample",
"path": "ample/parsers/psipred_parser.py",
"copies": "2",
"size": "3084",
"license": "bsd-3-clause",
"hash": 4166241374481594000,
"line_mean": 29.5346534653,
"line_max": 118,
"alpha_frac": 0.5703631647,
"autogenerated": false,
"ratio": 4.134048257372654,
"config... |
# A parser to parse the topics and questions schema for a single Analysis Type
# and populate the database
import json
from thresher.models import *
###### EXCEPTIONS ######
########################
class TopicsSchemaParser(object):
"""
Parses a json schema of topics and questions and populates the databas... | {
"repo_name": "Goodly/text-thresher-backend",
"path": "parse_schema.py",
"copies": "1",
"size": "5717",
"license": "apache-2.0",
"hash": 7913756455237670000,
"line_mean": 38.979020979,
"line_max": 79,
"alpha_frac": 0.5857967465,
"autogenerated": false,
"ratio": 4.869676320272572,
"config_test":... |
'''
A tokenizer for PDF streams.
In general, documentation used was "PDF reference",
sixth edition, for PDF version 1.7, dated November 2006.
'''
from __future__ import generators
try:
set
except NameError:
from sets import Set as set
import re
from pdfobjects import PdfString, PdfObject
class _Primitive... | {
"repo_name": "ddd332/presto",
"path": "presto-docs/target/sphinx/rst2pdf/extensions/vectorpdf/pdfrw/pdftokens.py",
"copies": "3",
"size": "7963",
"license": "apache-2.0",
"hash": 1715859251694604500,
"line_mean": 30.9799196787,
"line_max": 82,
"alpha_frac": 0.5082255431,
"autogenerated": false,
... |
'''
Converts pdfrw objects into reportlab objects.
Designed for and tested with rl 2.3.
Knows too much about reportlab internals.
What can you do?
The interface to this function is through the makerl() function.
Parameters:
canv - a reportlab "canvas" (also accepts a "document")
pdfobj -... | {
"repo_name": "lamby/pkg-pdfrw",
"path": "pdfrw/toreportlab.py",
"copies": "4",
"size": "4229",
"license": "mit",
"hash": 7467492906035797000,
"line_mean": 29.4244604317,
"line_max": 69,
"alpha_frac": 0.6552376448,
"autogenerated": false,
"ratio": 3.648835202761001,
"config_test": false,
"has... |
'''
Currently, this sad little file only knows how to decompress
using the flate (zlib) algorithm. Maybe more later, but it's
not a priority for me...
'''
import zlib
from pdfrw.objects import PdfDict, PdfName
from pdfrw.errors import log
def streamobjects(mylist, isinstance=isinstance, PdfDict=PdfDict):
for obj... | {
"repo_name": "ralsina/pdfrw",
"path": "pdfrw/uncompress.py",
"copies": "4",
"size": "1894",
"license": "mit",
"hash": -6176890301825510000,
"line_mean": 35.4230769231,
"line_max": 107,
"alpha_frac": 0.5760295671,
"autogenerated": false,
"ratio": 3.9789915966386555,
"config_test": false,
"has... |
'''
Currently, this sad little file only knows how to decompress
using the flate (zlib) algorithm. Maybe more later, but it's
not a priority for me...
'''
from __future__ import generators
try:
set
except NameError:
from sets import Set as set
import zlib
from pdfobjects import PdfDict, PdfName
def strea... | {
"repo_name": "kulbirsaini/pdfrw-fork",
"path": "pdfrw/pdfcompress.py",
"copies": "3",
"size": "1656",
"license": "mit",
"hash": -2773308251459607000,
"line_mean": 28.0526315789,
"line_max": 107,
"alpha_frac": 0.6117149758,
"autogenerated": false,
"ratio": 3.789473684210526,
"config_test": fals... |
'''
Currently, this sad little file only knows how to decompress
using the flate (zlib) algorithm. Maybe more later, but it's
not a priority for me...
'''
import zlib
from pdfrw.objects import PdfDict, PdfName
from pdfrw.errors import log
try:
from cStringIO import StringIO
except ImportError:
from StringIO... | {
"repo_name": "zhzhzoo/pdfrw",
"path": "pdfrw/uncompress.py",
"copies": "1",
"size": "4280",
"license": "mit",
"hash": -8809255261579455000,
"line_mean": 41.3762376238,
"line_max": 107,
"alpha_frac": 0.4331775701,
"autogenerated": false,
"ratio": 5.041224970553593,
"config_test": false,
"has_... |
'''
This module contains code to build PDF "Form XObjects".
A Form XObject allows a fragment from one PDF file to be cleanly
included in another PDF file.
Reference for syntax: "Parameters for opening PDF files" from SDK 8.1
http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters.pdf
supporte... | {
"repo_name": "ddd332/presto",
"path": "presto-docs/target/sphinx/rst2pdf/extensions/vectorpdf/pdfrw/buildxobj.py",
"copies": "2",
"size": "6560",
"license": "apache-2.0",
"hash": -4232938430954895400,
"line_mean": 33.3455497382,
"line_max": 91,
"alpha_frac": 0.6138719512,
"autogenerated": false,
... |
'''
Objects that can occur in PDF files. The most important
objects are arrays and dicts. Either of these can be
indirect or not, and dicts could have an associated
stream.
'''
from __future__ import generators
try:
set
except NameError:
from sets import Set as set
import re
class PdfObject(str):
indi... | {
"repo_name": "ddd332/presto",
"path": "presto-docs/target/sphinx/rst2pdf/extensions/vectorpdf/pdfrw/pdfobjects.py",
"copies": "2",
"size": "5677",
"license": "apache-2.0",
"hash": 3358826319210814500,
"line_mean": 30.0218579235,
"line_max": 102,
"alpha_frac": 0.5085432447,
"autogenerated": false,
... |
'''
The PdfReader class reads an entire PDF file into memory and
parses the top-level container objects. (It does not parse
into streams.) The object subclasses PdfDict, and the
document pages are stored in a list in the pages attribute
of the object.
'''
import gc
import re
import os
import pickle
from pdfrw.error... | {
"repo_name": "mzweilin/pdfrw",
"path": "pdfrw/pdfreader.py",
"copies": "1",
"size": "21671",
"license": "mit",
"hash": -9061637252224820000,
"line_mean": 37.4237588652,
"line_max": 143,
"alpha_frac": 0.5056527156,
"autogenerated": false,
"ratio": 4.518557130942452,
"config_test": false,
"has... |
'''
This file is an example parser that will parse a graphics stream
into a reportlab canvas.
Needs work on fonts and unicode, but works on a few PDFs.
Better to use Form XObjects for most things (see the example in rl1).
'''
from inspect import getargspec
import find_pdfrw
from pdfrw import PdfTokens
from pdfrw.p... | {
"repo_name": "lamby/pkg-pdfrw",
"path": "examples/rl2/decodegraphics.py",
"copies": "7",
"size": "11551",
"license": "mit",
"hash": 7086003697870987000,
"line_mean": 29.5582010582,
"line_max": 104,
"alpha_frac": 0.5855770063,
"autogenerated": false,
"ratio": 3.491837968561064,
"config_test": f... |
from pdfrw.objects.pdfindirect import PdfIndirect
from pdfrw.objects.pdfobject import PdfObject
def _resolved():
pass
class PdfArray(list):
''' A PdfArray maps the PDF file array object into a Python list.
It has an indirect attribute which defaults to False.
'''
indirect = False
def __i... | {
"repo_name": "tajtiattila/pdfrw",
"path": "pdfrw/objects/pdfarray.py",
"copies": "4",
"size": "1905",
"license": "mit",
"hash": 2203348472656169200,
"line_mean": 31.2881355932,
"line_max": 69,
"alpha_frac": 0.5769028871,
"autogenerated": false,
"ratio": 4.044585987261146,
"config_test": false,... |
from pdfrw.objects.pdfindirect import PdfIndirect
from pdfrw.objects.pdfobject import PdfObject
def _resolved():
pass
class PdfArray(list):
''' A PdfArray maps the PDF file array object into a Python list.
It has an indirect attribute which defaults to False.
'''
indirect = False
def _... | {
"repo_name": "mzweilin/pdfrw",
"path": "pdfrw/objects/pdfarray.py",
"copies": "1",
"size": "1873",
"license": "mit",
"hash": 1893097362119835400,
"line_mean": 28.265625,
"line_max": 69,
"alpha_frac": 0.5835557928,
"autogenerated": false,
"ratio": 3.951476793248945,
"config_test": false,
"has... |
from pdfrw.objects.pdfname import PdfName
from pdfrw.objects.pdfindirect import PdfIndirect
from pdfrw.objects.pdfobject import PdfObject
import copy
class _DictSearch(object):
''' Used to search for inheritable attributes.
'''
def __init__(self, basedict):
self.basedict = basedict
def __g... | {
"repo_name": "mzweilin/pdfrw",
"path": "pdfrw/objects/pdfdict.py",
"copies": "1",
"size": "8239",
"license": "mit",
"hash": 5301754810966906000,
"line_mean": 32.6285714286,
"line_max": 79,
"alpha_frac": 0.577740017,
"autogenerated": false,
"ratio": 4.468004338394794,
"config_test": false,
"h... |
from pdfrw.objects.pdfname import PdfName
from pdfrw.objects.pdfindirect import PdfIndirect
from pdfrw.objects.pdfobject import PdfObject
class _DictSearch(object):
''' Used to search for inheritable attributes.
'''
def __init__(self, basedict):
self.basedict = basedict
def __getattr__(self... | {
"repo_name": "zhzhzoo/pdfrw",
"path": "pdfrw/objects/pdfdict.py",
"copies": "1",
"size": "7771",
"license": "mit",
"hash": 6856068111144022000,
"line_mean": 33.3849557522,
"line_max": 83,
"alpha_frac": 0.582035774,
"autogenerated": false,
"ratio": 4.4481969089868345,
"config_test": false,
"h... |
import re
class PdfString(str):
''' A PdfString is an encoded string. It has a decode
method to get the actual string data out, and there
is an encode class method to create such a string.
Like any PDF object, it could be indirect, but it
defaults to being a direct object.
'''... | {
"repo_name": "ralsina/pdfrw",
"path": "pdfrw/objects/pdfstring.py",
"copies": "4",
"size": "2710",
"license": "mit",
"hash": -8005200650202152000,
"line_mean": 36.1232876712,
"line_max": 102,
"alpha_frac": 0.5121771218,
"autogenerated": false,
"ratio": 3.4260429835651074,
"config_test": false,... |
import re
class PdfString(str):
''' A PdfString is an encoded string. It has a decode
method to get the actual string data out, and there
is an encode class method to create such a string.
Like any PDF object, it could be indirect, but it
defaults to being a direct object.
''... | {
"repo_name": "zhzhzoo/pdfrw",
"path": "pdfrw/objects/pdfstring.py",
"copies": "1",
"size": "2771",
"license": "mit",
"hash": -1354004805640416000,
"line_mean": 34.987012987,
"line_max": 68,
"alpha_frac": 0.5009022014,
"autogenerated": false,
"ratio": 3.476787954830615,
"config_test": false,
... |
'''
A tokenizer for PDF streams.
In general, documentation used was "PDF reference",
sixth edition, for PDF version 1.7, dated November 2006.
'''
from __future__ import generators
import re
import itertools
from pdfrw.objects import PdfString, PdfObject
from pdfrw.errors import log, PdfParseError
def linepos(fda... | {
"repo_name": "nrcmedia/pdfrw",
"path": "pdfrw/tokens.py",
"copies": "1",
"size": "9043",
"license": "mit",
"hash": 61706952555355980,
"line_mean": 36.9957983193,
"line_max": 101,
"alpha_frac": 0.5011611191,
"autogenerated": false,
"ratio": 4.295961995249407,
"config_test": false,
"has_no_key... |
'''
This module contains code to build PDF "Form XObjects".
A Form XObject allows a fragment from one PDF file to be cleanly
included in another PDF file.
Reference for syntax: "Parameters for opening PDF files" from SDK 8.1
http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters.pdf
supporte... | {
"repo_name": "zhzhzoo/pdfrw",
"path": "pdfrw/buildxobj.py",
"copies": "1",
"size": "9067",
"license": "mit",
"hash": 4812321596284411000,
"line_mean": 32.5814814815,
"line_max": 78,
"alpha_frac": 0.6030660637,
"autogenerated": false,
"ratio": 3.827353313634445,
"config_test": false,
"has_no_... |
# A patched version of QMessageBox that allows copying the error
from __future__ import absolute_import, division, print_function
import os
from qtpy import QtWidgets, QtGui
__all__ = ['QMessageBoxPatched']
class QMessageBoxPatched(QtWidgets.QMessageBox):
def __init__(self, *args, **kwargs):
super(Q... | {
"repo_name": "saimn/glue",
"path": "glue/utils/qt/qmessagebox_widget.py",
"copies": "1",
"size": "1438",
"license": "bsd-3-clause",
"hash": 7266451257069533000,
"line_mean": 30.9555555556,
"line_max": 77,
"alpha_frac": 0.6870653686,
"autogenerated": false,
"ratio": 3.961432506887052,
"config_t... |
# A patched version of QMessageBox that allows copying the error
import os
from ...external.qt import QtGui
__all__ = ['QMessageBoxPatched']
class QMessageBoxPatched(QtGui.QMessageBox):
def __init__(self, *args, **kwargs):
super(QMessageBoxPatched, self).__init__(*args, **kwargs)
copy_action ... | {
"repo_name": "JudoWill/glue",
"path": "glue/utils/qt/qmessagebox_widget.py",
"copies": "1",
"size": "1346",
"license": "bsd-3-clause",
"hash": -909899314851793200,
"line_mean": 31.0476190476,
"line_max": 77,
"alpha_frac": 0.676077266,
"autogenerated": false,
"ratio": 3.8901734104046244,
"confi... |
"""A patch to the datetime module."""
from .base_patcher import BasePatcher
import sys
import datetime
try:
import copy_reg as copyreg
except ImportError:
import copyreg
_real_datetime = datetime.datetime
_real_date = datetime.date
def with_metaclass(meta, name, *bases):
"""Create a base class with a... | {
"repo_name": "snudler6/time-travel",
"path": "src/time_travel/patchers/datetime_patcher.py",
"copies": "1",
"size": "4881",
"license": "mit",
"hash": 6845699356640046000,
"line_mean": 26.4213483146,
"line_max": 76,
"alpha_frac": 0.5972136857,
"autogenerated": false,
"ratio": 4.248041775456919,
... |
"""A patch to the select.select function."""
from .base_patcher import BasePatcher
import select as select_lib
from enum import Enum
class SelectPatcher(BasePatcher):
"""Patcher for select.select."""
EVENTS_NAMESPACE = 'select'
EventTypes = Enum('select', ['READ', 'WRITE', 'EXCEPTIONAL'])
def __in... | {
"repo_name": "snudler6/time-travel",
"path": "src/time_travel/patchers/select_patcher.py",
"copies": "1",
"size": "3161",
"license": "mit",
"hash": 2262469886567089200,
"line_mean": 31.9270833333,
"line_max": 79,
"alpha_frac": 0.5890540968,
"autogenerated": false,
"ratio": 4.0629820051413885,
... |
# A * Pathfinding Algorithm 🌟
# Implemented with pygame, this script will find the shortest distance between two nodes using A * Algorithm 🎮
# Instructions / Keys Functionalities:
# -Left Click to add start and end nodes
# -Right Click to remove the nodes
# -Space Bar to start finding the shortest distance
... | {
"repo_name": "Logan1x/Python-Scripts",
"path": "bin/A-Star-GUI/AStarGUI.py",
"copies": "1",
"size": "7837",
"license": "mit",
"hash": -971223844160202900,
"line_mean": 26.2707581227,
"line_max": 110,
"alpha_frac": 0.517430724,
"autogenerated": false,
"ratio": 3.7450980392156863,
"config_test":... |
"""APC Power Distribution Unit control object."""
import logging
from datetime import datetime
from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.proto import rfc1902
from retrying import retry, RetryError
class APC(object):
"""APC Power Distribution Unit."""
# pylint: disable=too-many-instance-... | {
"repo_name": "SimplicityGuy/pynoc",
"path": "pynoc/apc.py",
"copies": "1",
"size": "22414",
"license": "apache-2.0",
"hash": -5774310688909020000,
"line_mean": 32.1568047337,
"line_max": 80,
"alpha_frac": 0.5862853574,
"autogenerated": false,
"ratio": 3.6546551443013207,
"config_test": false,
... |
# APC UPS message
from mMessage import mMessage
import re
from pprint import pprint
class SimpleValue:
def __init__(self, value):
self.value = value
def getValue(self):
return self.value
def __repr__(self):
return 'SimpleValue(' + repr(self.value) + ')'
class LabeledValue:
... | {
"repo_name": "arobb/multicast-comms",
"path": "mApcMessage.py",
"copies": "1",
"size": "3313",
"license": "mit",
"hash": 5228371414995910000,
"line_mean": 27.5603448276,
"line_max": 93,
"alpha_frac": 0.5342589798,
"autogenerated": false,
"ratio": 3.9346793349168645,
"config_test": false,
"ha... |
# APDS9960 i2c address
APDS9960_I2C_ADDR = 0x39
# APDS9960 gesture parameters
APDS9960_GESTURE_THRESHOLD_OUT = 10
APDS9960_GESTURE_SENSITIVITY_1 = 50
APDS9960_GESTURE_SENSITIVITY_2 = 20
# APDS9960 device IDs
APDS9960_DEV_ID = [0xab, 0x9c, 0xa8]
# APDS9960 times
APDS9960_TIME_FIFO_PAUSE = 0.03
# APDS9960 register ad... | {
"repo_name": "psby233/pibot",
"path": "src/apds9960/const.py",
"copies": "1",
"size": "5329",
"license": "mit",
"hash": 691456521780458900,
"line_mean": 30.5325443787,
"line_max": 97,
"alpha_frac": 0.6920623006,
"autogenerated": false,
"ratio": 2.2773504273504273,
"config_test": true,
"has_n... |
""" a peer's vote """
from collections import namedtuple
import json
class Vote(namedtuple('Vote', 'myid mystate proposed_id zxid')):
"""
Used in a FastLeaderElection to propose a leader (or to broadcast the current one).
Note: zxid refer's to the (proposed or current) leader's zxid
"""
def __st... | {
"repo_name": "rgs1/pyzab",
"path": "pyzab/vote.py",
"copies": "1",
"size": "1117",
"license": "apache-2.0",
"hash": -6367396478988713000,
"line_mean": 26.925,
"line_max": 87,
"alpha_frac": 0.5550581916,
"autogenerated": false,
"ratio": 3.7993197278911564,
"config_test": false,
"has_no_keywor... |
"""A Pelican plugin which minifies HTML pages."""
from logging import getLogger
from os import walk
from os.path import join
from htmlmin import minify
from pelican import signals
from joblib import Parallel, delayed
# We need save unicode strings to files.
try:
from codecs import open
except ImportError:
p... | {
"repo_name": "rdegges/pelican-minify",
"path": "minify.py",
"copies": "1",
"size": "1598",
"license": "unlicense",
"hash": -1651856778887837200,
"line_mean": 27.0350877193,
"line_max": 121,
"alpha_frac": 0.6670838548,
"autogenerated": false,
"ratio": 3.9166666666666665,
"config_test": false,
... |
"""A PEP 517 interface to setuptools
Previously, when a user or a command line tool (let's call it a "frontend")
needed to make a request of setuptools to take a certain action, for
example, generating a list of installation requirements, the frontend would
would call "setup.py egg_info" or "setup.py bdist_wheel" on t... | {
"repo_name": "lmregus/Portfolio",
"path": "python/design_patterns/env/lib/python3.7/site-packages/setuptools/build_meta.py",
"copies": "3",
"size": "8911",
"license": "mit",
"hash": 3735676748830441500,
"line_mean": 35.3714285714,
"line_max": 83,
"alpha_frac": 0.6460554371,
"autogenerated": false,... |
# A **Percolator** is a reverse query much like a match rule which is run whenever a new feed is added. These can be used to create alerts by causing the sensit to publish the feed that was just added. A percolator query is defined by a `name` and and valid `query` according to the according the the [elasticsearch Quer... | {
"repo_name": "cwadding/sensit-python",
"path": "sensit/api/percolator.py",
"copies": "1",
"size": "3422",
"license": "mit",
"hash": -8282176540384180000,
"line_mean": 51.6461538462,
"line_max": 615,
"alpha_frac": 0.7244301578,
"autogenerated": false,
"ratio": 3.432296890672016,
"config_test": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.