text stringlengths 0 1.05M | meta dict |
|---|---|
# A recursive descent parser that implements an integer calculator
# with variables and conditional statements.
# The grammar is LL(1), suitable for predictive parsing.
#
# EBNF:
#
# <stmt> : <assign_stmt>
# | <if_stmt>
# | <cmp_expr>
#
# <assign_stmt> : set <id> = <cmp_expr>
#
##... | {
"repo_name": "evandrix/Splat",
"path": "doc/parser/rd_parser_ebnf.py",
"copies": "1",
"size": "13915",
"license": "mit",
"hash": 65001764496569220,
"line_mean": 29.3820960699,
"line_max": 68,
"alpha_frac": 0.4421846928,
"autogenerated": false,
"ratio": 3.84073971846536,
"config_test": false,
... |
# A recursive descent parser that implements an integer calculator
# with variables and conditional statements.
#
# This parser implements exactly the same grammar as
# rd_parser_ebnf, but it evaluates expressions using a different
# technique. Instead of recursively evaluating them following the
# EBNF grammar... | {
"repo_name": "michaelyin/code-for-blog",
"path": "2009/py_rd_parser_example/rd_parser_infix_expr.py",
"copies": "12",
"size": "13987",
"license": "unlicense",
"hash": 3738381671224765400,
"line_mean": 32.6336633663,
"line_max": 81,
"alpha_frac": 0.4715092586,
"autogenerated": false,
"ratio": 4.2... |
# A recursive descent parser that implements an integer calculator
# with variables and conditional statements.
# The grammar is LL(1), suitable for predictive parsing.
#
# EBNF:
#
# <stmt> : <assign_stmt>
# | <if_stmt>
# | <cmp_expr>
#
# <assign_stmt> : set <id> = <cmp_e... | {
"repo_name": "bowlofstew/code-for-blog",
"path": "2009/py_rd_parser_example/rd_parser_ebnf.py",
"copies": "12",
"size": "14356",
"license": "unlicense",
"hash": -3741586921305043500,
"line_mean": 29.3820960699,
"line_max": 68,
"alpha_frac": 0.4286012817,
"autogenerated": false,
"ratio": 3.885250... |
""" A recursive descent pascal parser. """
import logging
from ...common import CompilerError
from ..tools.recursivedescent import RecursiveDescentParser
from .nodes import expressions, statements, symbols, types
from .symbol_table import Scope
class Parser(RecursiveDescentParser):
""" Parses pascal into ast-nod... | {
"repo_name": "windelbouwman/ppci-mirror",
"path": "ppci/lang/pascal/parser.py",
"copies": "1",
"size": "48001",
"license": "bsd-2-clause",
"hash": 3139028104172118500,
"line_mean": 34.7416232316,
"line_max": 147,
"alpha_frac": 0.520593321,
"autogenerated": false,
"ratio": 4.453609203933939,
"c... |
"""A Redis backed distributed global lock
This code uses the formula here:
https://github.com/jeffomatic/redis-exp-lock-js
It provides several improvements over the original version based on:
http://chris-lamb.co.uk/2010/06/07/distributing-locking-python-and-redis/
It provides a few improvements over the one present... | {
"repo_name": "yablochkin/vkontakte-viomg",
"path": "vkontakte_viomg/lock.py",
"copies": "1",
"size": "3261",
"license": "mit",
"hash": -3917200331624689000,
"line_mean": 29.7641509434,
"line_max": 77,
"alpha_frac": 0.6022692426,
"autogenerated": false,
"ratio": 4.133079847908745,
"config_test"... |
"""A Redis backed distributed global lock
This lock based mostly on this excellent example:
http://chris-lamb.co.uk/2010/06/07/distributing-locking-python-and-redis/
This code add's one change as suggested by the Redis documentation regarding
using locks in Redis, which is to only delete the Redis lock if we actually... | {
"repo_name": "mozilla-services/retools",
"path": "retools/lock.py",
"copies": "2",
"size": "3093",
"license": "mit",
"hash": -6077089054402341000,
"line_mean": 36.265060241,
"line_max": 77,
"alpha_frac": 0.6000646621,
"autogenerated": false,
"ratio": 4.541850220264317,
"config_test": false,
... |
### Maybe I'll need this one day
class Player(object):
def __init__(self):
pass
### Quick, sleek and pointy teeth
class Alien(object):
def __init__(self,name):
self.name = name
self.health = 100
def bite(self, weapon):
fight(alien, marine, weapon)
### Large, lumbering a... | {
"repo_name": "andersekbom/pyliens",
"path": "main/pyliens_bu.py",
"copies": "1",
"size": "3410",
"license": "mit",
"hash": 8887073904065293000,
"line_mean": 21.8859060403,
"line_max": 99,
"alpha_frac": 0.5363636364,
"autogenerated": false,
"ratio": 3.5082304526748973,
"config_test": false,
"... |
# A reference and starting point for your own Sly scripts.
#
# Python nano-tutorial:
# * Anything after a # character on a line is a comment, so Python will
# ignore it.
# * Indentation matters. Make sure every line in a section is indented the
# same number of spaces.
# * Python is case-sensitive.
#
# Import stat... | {
"repo_name": "meshulam/sly",
"path": "example/starter.py",
"copies": "1",
"size": "4408",
"license": "mit",
"hash": 4179153313929770000,
"line_mean": 39.0727272727,
"line_max": 79,
"alpha_frac": 0.7046279492,
"autogenerated": false,
"ratio": 3.479084451460142,
"config_test": false,
"has_no_k... |
# A regex-based Lexer/tokenizer.
# See the if __main__ section in the bottom for an example.
#
#-----------------------------------------------
# Eli Bendersky (eliben@gmail.com)
# License: this code is in the public domain
# Last modified: March 2009
#-----------------------------------------------
#
import re
import ... | {
"repo_name": "evandrix/Splat",
"path": "doc/parser/lexer.py",
"copies": "1",
"size": "4457",
"license": "mit",
"hash": -949195472658355300,
"line_mean": 30.1678321678,
"line_max": 67,
"alpha_frac": 0.4808166928,
"autogenerated": false,
"ratio": 4.417244796828543,
"config_test": false,
"has_n... |
# A regex-based Lexer/tokenizer.
# See the if __main__ section in the bottom for an example.
#
#-----------------------------------------------
# Eli Bendersky (eliben@gmail.com)
# License: this code is in the public domain
# Last modified: March 2009
#-----------------------------------------------
#
import r... | {
"repo_name": "AnthonyCAS/code-for-blog",
"path": "2009/py_rd_parser_example/lexer.py",
"copies": "14",
"size": "4583",
"license": "unlicense",
"hash": 8506505814438647000,
"line_mean": 30.1678321678,
"line_max": 67,
"alpha_frac": 0.4675976435,
"autogenerated": false,
"ratio": 4.4538386783284745,... |
"""A registry of :class:`Schema <marshmallow.Schema>` classes. This allows for string
lookup of schemas, which may be used with
class:`fields.Nested <marshmallow.fields.Nested>`.
.. warning::
This module is treated as private API.
Users should not need to use this module directly.
"""
import typing
from marsh... | {
"repo_name": "marshmallow-code/marshmallow",
"path": "src/marshmallow/class_registry.py",
"copies": "1",
"size": "2836",
"license": "mit",
"hash": -6978642883984595000,
"line_mean": 30.1648351648,
"line_max": 85,
"alpha_frac": 0.6357545839,
"autogenerated": false,
"ratio": 4.074712643678161,
"... |
# A Regression Digression
##########################
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.tokenize.casual import casual_tokenize
from nlpia.data.loaders import get_data
sms = get_data('sms-spam')
tfidf = TfidfVectorizer(tokenizer=casual_tokenize)
tfidf_docs = tfid... | {
"repo_name": "totalgood/nlpia",
"path": "src/nlpia/book/examples/ch05_regression_digression.py",
"copies": "1",
"size": "4707",
"license": "mit",
"hash": 5703010722630734000,
"line_mean": 27.8773006135,
"line_max": 118,
"alpha_frac": 0.6061185468,
"autogenerated": false,
"ratio": 2.8475499092558... |
"""A regularizer based on group-lasso.
All the weights that are related to a single output are grouped into one LASSO
group (https://arxiv.org/pdf/1611.06321.pdf).
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from morph_net.framework import generic_r... | {
"repo_name": "google-research/morph-net",
"path": "morph_net/op_regularizers/group_lasso_regularizer.py",
"copies": "1",
"size": "2417",
"license": "apache-2.0",
"hash": -1420001296472025000,
"line_mean": 36.1846153846,
"line_max": 80,
"alpha_frac": 0.704178734,
"autogenerated": false,
"ratio": ... |
# a relay forward local socks to a remote socks through meek (i.e., HTTP transport).
import logging
import uuid
import random
import ssl
from collections import defaultdict
import gevent
from gevent import select
from gevent import socket
from gevent.queue import Queue, LifoQueue
from gevent.event import Event
from g... | {
"repo_name": "kang000feng/firefly-proxy",
"path": "meeksocks/relay.py",
"copies": "6",
"size": "13509",
"license": "bsd-2-clause",
"hash": -6478067166150855000,
"line_mean": 36.1153846154,
"line_max": 100,
"alpha_frac": 0.5368273003,
"autogenerated": false,
"ratio": 4.042190305206463,
"config_... |
# a relay forward local socks to remote socks,
import logging
from gevent import socket
from relay import RelayFactory, RelaySession, RelaySessionError
from utils import pipe_tcp, bind_local_udp, request_fail, send_request, \
sock_addr_info, read_reply, request_success, pipe_udp, read_init_request, \
read_init_reply... | {
"repo_name": "yinghuocho/firefly-proxy",
"path": "DEPRECATED_PYTHON_SRC/gsocks/socks_relay.py",
"copies": "6",
"size": "4538",
"license": "bsd-2-clause",
"hash": 1914957146691816200,
"line_mean": 36.5123966942,
"line_max": 97,
"alpha_frac": 0.5973997356,
"autogenerated": false,
"ratio": 3.878632... |
# a relay with policy based forwarding.
import logging
import re
from gevent import socket
from relay import SocksSession, RelayFactory, RelaySession
from socks_relay import SocksForwardSession
import msg
import utils
log = logging.getLogger(__name__)
class ForwardDestination(object):
def __init__(self, scheme... | {
"repo_name": "yinghuocho/gsocks",
"path": "smart_relay.py",
"copies": "6",
"size": "6193",
"license": "bsd-2-clause",
"hash": -8492511650629450000,
"line_mean": 38.7051282051,
"line_max": 122,
"alpha_frac": 0.621669627,
"autogenerated": false,
"ratio": 4.0371577574967406,
"config_test": false,... |
"""A remote console into running diesel applications.
With the functions and classes in this module you can open remote Python
console sessions into your diesel applications. Technically, they aren't
remote because it is hardcoded to run over localhost. But they are remote
from a process point of view.
An application... | {
"repo_name": "dieseldev/diesel",
"path": "diesel/console.py",
"copies": "1",
"size": "5987",
"license": "bsd-3-clause",
"hash": -6159540925617853000,
"line_mean": 32.0773480663,
"line_max": 79,
"alpha_frac": 0.65040922,
"autogenerated": false,
"ratio": 4.10068493150685,
"config_test": false,
... |
# Author: Peter Hinch
# Copyright Peter Hinch 2017 Released under the MIT license
from sys import platform
import uasyncio as asyncio
from asyn import Event
from micropython import const
from array import array
from utime import ticks_us, ticks_diff
if platform == 'pyboard':
from pyb import Pin, ExtInt
else:
... | {
"repo_name": "peterhinch/micropython-async",
"path": "v2/nec_ir/aremote.py",
"copies": "1",
"size": "5208",
"license": "mit",
"hash": -5470052853985313000,
"line_mean": 40.9838709677,
"line_max": 103,
"alpha_frac": 0.5681905494,
"autogenerated": false,
"ratio": 3.7399425287356323,
"config_test... |
# Author: Peter Hinch
# Copyright Peter Hinch 2017 Released under the MIT license
from sys import platform
import uasyncio as asyncio
from primitives.message import Message
from micropython import const
from array import array
from utime import ticks_ms, ticks_us, ticks_diff
if platform == 'pyboard':
from pyb imp... | {
"repo_name": "peterhinch/micropython-async",
"path": "v3/as_drivers/nec_ir/aremote.py",
"copies": "1",
"size": "4878",
"license": "mit",
"hash": -1874614908168559400,
"line_mean": 40.6752136752,
"line_max": 96,
"alpha_frac": 0.5711648893,
"autogenerated": false,
"ratio": 3.8004676539360873,
"c... |
# Arena Game Mode
from __init__ import gameMode as mode
from random import uniform, choice
from copy import deepcopy as new
HS_RARITY_RANK = {0:'Free',1:'Common',2:'Rare',3:'Epic',4:'Legendary'}
HS_UPGRADE_CHANCE = 0.2
name = 'Arena'
key = 'arena'
description = "Emulate the standard Hearthstone arena and practic... | {
"repo_name": "AlexSafatli/HearthstoneDrafter",
"path": "modes/arena.py",
"copies": "1",
"size": "2090",
"license": "mit",
"hash": -5005491515839342000,
"line_mean": 30.1940298507,
"line_max": 105,
"alpha_frac": 0.5358851675,
"autogenerated": false,
"ratio": 3.779385171790235,
"config_test": fa... |
"""A replacement for the PYPI shove module, which unfortunately seems not to be thread safe.
Licensed under the 3-clause BSD License:
Copyright (c) 2011, Neeraj Kumar (neerajkumar.org)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that th... | {
"repo_name": "neeraj-kumar/nkpylib",
"path": "nkshove.py",
"copies": "1",
"size": "7036",
"license": "bsd-3-clause",
"hash": 1910703471329517600,
"line_mean": 33.8316831683,
"line_max": 131,
"alpha_frac": 0.5928084139,
"autogenerated": false,
"ratio": 4.300733496332518,
"config_test": false,
... |
# A replacement for the wrapper for the CCP4 program MTZDUMP using CCTBX
# to access the file directly.
import copy
import os
from iotbx import mtz
class Mtzdump:
"""A class to give the same functionality as the wrapper for the CCP4
MTZDUMP program."""
def __init__(self):
self._header = {"data... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/Mtzdump.py",
"copies": "1",
"size": "3590",
"license": "bsd-3-clause",
"hash": -5232688800228670000,
"line_mean": 31.0535714286,
"line_max": 88,
"alpha_frac": 0.591086351,
"autogenerated": false,
"ratio": 4.0610859728506785,
"config_test": fa... |
"""A repl across hosts."""
from __future__ import print_function, unicode_literals
import ast
import sys
import traceback
PY2 = sys.version_info < (3,)
if PY2:
from cStringIO import StringIO
else:
from io import StringIO
if PY2:
input = raw_input # noqa
def exec_(code, namespace):
exec('exec... | {
"repo_name": "lordmauve/chopsticks",
"path": "repl.py",
"copies": "1",
"size": "2656",
"license": "apache-2.0",
"hash": 4050363647918983700,
"line_mean": 23.3669724771,
"line_max": 65,
"alpha_frac": 0.5410391566,
"autogenerated": false,
"ratio": 3.7942857142857145,
"config_test": false,
"has... |
"""A repository for searching and holding loaded pyang modules"""
import os
import sys
import io
from . import util
from . import syntax
class Repository(object):
"""Abstract base class that represents a module repository"""
def get_modules_and_revisions(self, ctx):
"""Return a list of all modules a... | {
"repo_name": "mbj4668/pyang",
"path": "pyang/repository.py",
"copies": "1",
"size": "5853",
"license": "isc",
"hash": 7259231834219622000,
"line_mean": 35.1296296296,
"line_max": 79,
"alpha_frac": 0.5375021357,
"autogenerated": false,
"ratio": 4.491941673062164,
"config_test": false,
"has_no... |
"""A repository of custom sklearn estimators."""
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.cluster import MiniBatchKMeans
from sklearn.exceptions import NotFittedError
from sklearn.utils.validation import check_array
from nlp_playground.exceptions import BadValidation
from nlp_playground.l... | {
"repo_name": "jamesmishra/nlp-playground",
"path": "nlp_playground/lib/sklearn/estimators.py",
"copies": "1",
"size": "7347",
"license": "mit",
"hash": 5144869967980370000,
"line_mean": 33.1720930233,
"line_max": 77,
"alpha_frac": 0.6363141418,
"autogenerated": false,
"ratio": 4.455427531837477,... |
"""A representation of the World."""
import random
from sys import stdout
from existenz.globe import Globe
class World(object):
"""Representation of the world for denizens to live and die."""
def __init__(self, size=10):
self._size = size
self._day = 0
# create the two globes for cu... | {
"repo_name": "neoinsanity/existenz",
"path": "existenz/world.py",
"copies": "1",
"size": "3232",
"license": "apache-2.0",
"hash": 6868204092069047000,
"line_mean": 31,
"line_max": 80,
"alpha_frac": 0.5770420792,
"autogenerated": false,
"ratio": 4.15958815958816,
"config_test": false,
"has_no... |
# Ares HTTP-DDoS Module (LOIC Clone)
# Pythogen
# Build 1.2
# Not intended for illegal uses.
# 12/27/2015 - 4:34 PM - Bug fix: DDoS completion notice now correctly synchronized.
# 12/27/2015 - 4:42 PM - Update: Functional stop feature now included.
# 12/29/2015 - 1:01 PM - Update: Functionality refinement. Clean up... | {
"repo_name": "EzLucky/Wares",
"path": "client/modules/ddos.py",
"copies": "1",
"size": "3862",
"license": "mit",
"hash": -118286514455478420,
"line_mean": 22.265060241,
"line_max": 119,
"alpha_frac": 0.599430347,
"autogenerated": false,
"ratio": 3.9814432989690722,
"config_test": false,
"has... |
# A resource can be any object that implements the following protocol:
#
# PROPERTIES
#
# name
# """ The machine-readable name for the resource. This should be a valid
# URI path element, and by convention, should only use alphanumeric ASCII
# characters and/or - and _. Other characters will probably also work but
# pr... | {
"repo_name": "tracksinspector/papi",
"path": "papi/resource.py",
"copies": "1",
"size": "1959",
"license": "mit",
"hash": 6342293443702749000,
"line_mean": 38.18,
"line_max": 80,
"alpha_frac": 0.718734048,
"autogenerated": false,
"ratio": 3.7745664739884393,
"config_test": false,
"has_no_key... |
"""A reusable AST for manipulating or executing FPCores in python."""
import typing
def sexp_to_string(e):
if isinstance(e, list) or isinstance(e, tuple):
return '(' + ' '.join((sexp_to_string(x) for x in e)) + ')'
else:
return str(e)
def annotation_to_string(e, props, shape=None):
if pr... | {
"repo_name": "billzorn/fpunreal",
"path": "titanfp/fpbench/fpcast.py",
"copies": "1",
"size": "26421",
"license": "mit",
"hash": -5900697640643337000,
"line_mean": 27.6561822126,
"line_max": 133,
"alpha_frac": 0.5588357746,
"autogenerated": false,
"ratio": 3.4272927746789468,
"config_test": fa... |
# A revised version of CPython's turtle module written for Brython
#
# Note: This version is not intended to be used in interactive mode,
# nor use help() to look up methods/functions definitions. The docstrings
# have thus been shortened considerably as compared with the CPython's version.
#
# All public methods/fu... | {
"repo_name": "jonathanverner/brython",
"path": "www/src/Lib/turtle.py",
"copies": "2",
"size": "53120",
"license": "bsd-3-clause",
"hash": 144373378408001470,
"line_mean": 35.4584763212,
"line_max": 109,
"alpha_frac": 0.5578878012,
"autogenerated": false,
"ratio": 3.971291866028708,
"config_te... |
arf_blend_in_0 = 0x00000001
arf_blend_in_1 = 0x00000002
arf_blend_in_2 = 0x00000003
arf_blend_in_3 = 0x00000004
arf_blend_in_4 = 0x00000005
arf_blend_in_5 = 0x00000006
arf_blend_in_6 = 0x00000007
arf_blend_in_7 ... | {
"repo_name": "Sw4T/Warband-Development",
"path": "mb_warband_module_system_1166/Module_system 1.166/headers/header_animations.py",
"copies": "2",
"size": "4400",
"license": "mit",
"hash": -7104227487844999000,
"line_mean": 32.8461538462,
"line_max": 97,
"alpha_frac": 0.5579545455,
"autogenerated":... |
arf_blend_in_0 = 0x00000001
arf_blend_in_1 = 0x00000002
arf_blend_in_2 = 0x00000003
arf_blend_in_3 = 0x00000004
arf_blend_in_4 = 0x00000005
arf_blend_in_5 = 0x00000006
arf_blend_in_6 = 0x00000007
arf_blend_in_7 ... | {
"repo_name": "Eleyvie/wreck",
"path": "integrated/headers/header_animations.py",
"copies": "1",
"size": "4530",
"license": "mit",
"hash": -4842254718544660000,
"line_mean": 32.8461538462,
"line_max": 97,
"alpha_frac": 0.5419426049,
"autogenerated": false,
"ratio": 2.7638804148871263,
"config_t... |
"""ARFCN comparison logic."""
from . import arfcn_ref
class ArfcnComparator:
"""Initialization requires no arguments.
There are two attributes you want to pay attention to
uplink_to_arfcn and downlink_to_arfcn, which are generated on
instantiation. You'll use these as the reference input for the
... | {
"repo_name": "sitch-io/feed_builder",
"path": "sitch/sitchlib/arfcn_comparator.py",
"copies": "1",
"size": "2589",
"license": "apache-2.0",
"hash": -7162268235586793000,
"line_mean": 35.9857142857,
"line_max": 79,
"alpha_frac": 0.5855542681,
"autogenerated": false,
"ratio": 3.7795620437956203,
... |
a = rf'fo{{2}}'
a = r'fo{{2}}'
a = r'fo{2}'
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.... | {
"repo_name": "MagicStack/MagicPython",
"path": "test/regexp/fregexp4.py",
"copies": "1",
"size": "2163",
"license": "mit",
"hash": -8715927094252129000,
"line_mean": 59.0833333333,
"line_max": 137,
"alpha_frac": 0.6680536292,
"autogenerated": false,
"ratio": 3.904332129963899,
"config_test": f... |
a = r'foo#not a comment'
a = r'''
(?x) # multi-line regexp
foo # comment
'''
a = R'''
(?x) # not a
foo # comment
'''
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.pytho... | {
"repo_name": "MagicStack/MagicPython",
"path": "test/regexp/python5.py",
"copies": "1",
"size": "2539",
"license": "mit",
"hash": 4918201777474779000,
"line_mean": 56.7045454545,
"line_max": 136,
"alpha_frac": 0.6538007089,
"autogenerated": false,
"ratio": 3.91820987654321,
"config_test": fals... |
a = r'(<\' for
a = r"(<\" for
a = r'[<\' for
a = r"[<\" for
a = r'(?=\' for
a = r"(?=\" for
a = r'(?P<a>\' for
a = r"(?P<a>\" for
a = r'(?<!a\' for
a = r"(?<!a\" for
return some
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
... | {
"repo_name": "MagicStack/MagicPython",
"path": "test/regexp/python10.py",
"copies": "1",
"size": "10248",
"license": "mit",
"hash": -3107929691211272700,
"line_mean": 74.9111111111,
"line_max": 162,
"alpha_frac": 0.6820843091,
"autogenerated": false,
"ratio": 3.9521789433089087,
"config_test":... |
# arg[1]: RMG log file from a run with QM with the "both" option
# arg[2]: 0 for "check"; 1 for "confirm"
if __name__ == "__main__":
import sys
#Example output:
#*****Attempt #5 on species VLEXMQNIVAQEHV-UHFFFAOYAI (InChI=1/C10H14/c1-2-3-4-7-10-8-5-6-9-10/h2,7,10H,5-6,8-9H2,1H3) failed. Will attempt a new keyword.
#**... | {
"repo_name": "enochd/RMG-Java",
"path": "scripts/QMTPstats.py",
"copies": "11",
"size": "17345",
"license": "mit",
"hash": -7447140406291198000,
"line_mean": 65.972972973,
"line_max": 297,
"alpha_frac": 0.7289132315,
"autogenerated": false,
"ratio": 2.9669859733150874,
"config_test": false,
... |
arg_bot_with_arg = {"token": "slacktoken123",
"team_id": "team123",
"team_domain": "teamdomain",
"channel_id": "channelid",
"channel_name": "directmes1N8L",
"user_name": "derp",
"command": "/arg_bot",... | {
"repo_name": "forter/boten",
"path": "test/payloads.py",
"copies": "1",
"size": "3973",
"license": "apache-2.0",
"hash": 2343321549951832600,
"line_mean": 44.6666666667,
"line_max": 71,
"alpha_frac": 0.3470928769,
"autogenerated": false,
"ratio": 4.5353881278538815,
"config_test": false,
"ha... |
arg_input = Argument(ptr(const_float_), "input")
arg_output = Argument(ptr(float_), "output")
arg_length = Argument(size_t, "length")
arg_negative_slope = Argument(float_, "negative_slope")
with Function("nnp_relu__avx2",
(arg_input, arg_output, arg_length, arg_negative_slope),
target=uarch.default + isa.avx2):
reg... | {
"repo_name": "microblink/NNPACK",
"path": "src/x86_64-fma/relu.py",
"copies": "3",
"size": "4493",
"license": "bsd-2-clause",
"hash": 3945685513883665000,
"line_mean": 29.7739726027,
"line_max": 86,
"alpha_frac": 0.7360338304,
"autogenerated": false,
"ratio": 2.847275031685678,
"config_test": ... |
# Arg order is very important for task deconstruction.
# If order is changed make sure that the refresh API call is updated
def upload_to_ion(
task_id,
asset_type,
token,
asset_path,
name,
description="",
attribution="",
options={},
):
import sys
import time
import logging
... | {
"repo_name": "OpenDroneMap/WebODM",
"path": "coreplugins/cesiumion/uploader.py",
"copies": "1",
"size": "6717",
"license": "mpl-2.0",
"hash": 6143638130431106000,
"line_mean": 34.3578947368,
"line_max": 92,
"alpha_frac": 0.5681107637,
"autogenerated": false,
"ratio": 4.026978417266187,
"config... |
"""Argo schema primitives."""
import sys
import inspect
from . import types
from . import exceptions
PY2 = sys.version_info[0] == 2
if not PY2:
string_types = (str,)
else:
string_types = (str, unicode)
def _get_context(func, kwargs):
"""Prepare a context for the serialization.
:param func: Functi... | {
"repo_name": "olegpidsadnyi/argo",
"path": "argo/schema.py",
"copies": "1",
"size": "9015",
"license": "mit",
"hash": 4478417798570499600,
"line_mean": 30.8551236749,
"line_max": 113,
"alpha_frac": 0.5759290072,
"autogenerated": false,
"ratio": 4.564556962025317,
"config_test": false,
"has_n... |
""""Argo Workflow base builder for building OCI image using Kaniko"""
from kubeflow.kubeflow import ci
from kubeflow.testing import argo_build_util
class Builder(ci.workflow_utils.ArgoTestBuilder):
def __init__(self, name=None, namespace=None, bucket=None,
test_target_name=None, **kwargs):
... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/cd/kaniko_builder.py",
"copies": "1",
"size": "2033",
"license": "apache-2.0",
"hash": 7086189228530367000,
"line_mean": 45.2045454545,
"line_max": 83,
"alpha_frac": 0.581406788,
"autogenerated": false,
"ratio": 4.165983606557377,
... |
""""Argo Workflow for building notebook-server-tensorflow-full OCI images using Kaniko"""
from kubeflow.kubeflow.cd import config, kaniko_builder
def create_workflow(name=None, namespace=None, bucket=None, **kwargs):
"""
Args:
name: Name to give to the workflow. This can also be used to name
... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/cd/notebook_servers/notebook_server_jupyter_tensorflow_full.py",
"copies": "1",
"size": "1074",
"license": "apache-2.0",
"hash": -5141787884058130000,
"line_mean": 55.5263157895,
"line_max": 121,
"alpha_frac": 0.6638733706,
"autogener... |
""""Argo Workflow for building notebook-server-tensorflow OCI images using Kaniko"""
from kubeflow.kubeflow.cd import config, kaniko_builder
def create_workflow(name=None, namespace=None, bucket=None, **kwargs):
"""
Args:
name: Name to give to the workflow. This can also be used to name
... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/cd/notebook_servers/notebook_server_jupyter_tensorflow.py",
"copies": "1",
"size": "1044",
"license": "apache-2.0",
"hash": -2683801358010652700,
"line_mean": 53.9473684211,
"line_max": 116,
"alpha_frac": 0.6599616858,
"autogenerated"... |
""""Argo Workflow for building the notebook-server-jupyter-pytorch-full OCI images using Kaniko"""
from kubeflow.kubeflow.cd import config, kaniko_builder
def create_workflow(name=None, namespace=None, bucket=None, **kwargs):
"""
Args:
name: Name to give to the workflow. This can also be used to name
... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/cd/notebook_servers/notebook_server_jupyter_pytorch_full.py",
"copies": "1",
"size": "1068",
"license": "apache-2.0",
"hash": 8213372280398020000,
"line_mean": 55.2105263158,
"line_max": 118,
"alpha_frac": 0.6601123596,
"autogenerated... |
""""Argo Workflow for building the notebook-server-jupyter-pytorch OCI images using Kaniko"""
from kubeflow.kubeflow.cd import config, kaniko_builder
def create_workflow(name=None, namespace=None, bucket=None, **kwargs):
"""
Args:
name: Name to give to the workflow. This can also be used to name
... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/cd/notebook_servers/notebook_server_jupyter_pytorch.py",
"copies": "1",
"size": "1038",
"license": "apache-2.0",
"hash": 5149375695415718000,
"line_mean": 53.6315789474,
"line_max": 113,
"alpha_frac": 0.6560693642,
"autogenerated": fa... |
""""Argo Workflow for testing Admission Webhook"""
from kubeflow.kubeflow.ci import workflow_utils
from kubeflow.testing import argo_build_util
class Builder(workflow_utils.ArgoTestBuilder):
def __init__(self, name=None, namespace=None, bucket=None,
test_target_name=None, **kwargs):
super... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/ci/admission_webhook_tests.py",
"copies": "1",
"size": "2612",
"license": "apache-2.0",
"hash": 5358690045490798000,
"line_mean": 40.4603174603,
"line_max": 79,
"alpha_frac": 0.5872894334,
"autogenerated": false,
"ratio": 3.96358118... |
""""Argo Workflow for testing notebook-server-base OCI image"""
from kubeflow.kubeflow.ci import workflow_utils
from kubeflow.testing import argo_build_util
class Builder(workflow_utils.ArgoTestBuilder):
def __init__(self, name=None, namespace=None, bucket=None,
test_target_name=None, **kwargs):
... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/ci/notebook_servers/notebook_server_base_tests.py",
"copies": "1",
"size": "1781",
"license": "apache-2.0",
"hash": -5387063644461100000,
"line_mean": 40.4186046512,
"line_max": 85,
"alpha_frac": 0.6153846154,
"autogenerated": false,
... |
""""Argo Workflow for testing notebook-server-codeserver OCI image"""
from kubeflow.kubeflow.ci import workflow_utils
from kubeflow.testing import argo_build_util
class Builder(workflow_utils.ArgoTestBuilder):
def __init__(self, name=None, namespace=None, bucket=None,
test_target_name=None, **kwa... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/ci/notebook_servers/notebook_server_codeserver_tests.py",
"copies": "1",
"size": "1811",
"license": "apache-2.0",
"hash": -6946698984486942000,
"line_mean": 41.1162790698,
"line_max": 91,
"alpha_frac": 0.6217559359,
"autogenerated": f... |
""""Argo Workflow for testing notebook-server-jupyter-tensorflow OCI images"""
from kubeflow.kubeflow.ci import workflow_utils
from kubeflow.testing import argo_build_util
class Builder(workflow_utils.ArgoTestBuilder):
def __init__(self, name=None, namespace=None, bucket=None,
test_target_name=No... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/ci/notebook_servers/notebook_server_jupyter_tensorflow_tests.py",
"copies": "1",
"size": "2494",
"license": "apache-2.0",
"hash": 9086592361032856000,
"line_mean": 46.0566037736,
"line_max": 99,
"alpha_frac": 0.6110665597,
"autogenera... |
""""Argo Workflow for testing notebook-server-rstudio-tidyverse OCI image"""
from kubeflow.kubeflow.ci import workflow_utils
from kubeflow.testing import argo_build_util
class Builder(workflow_utils.ArgoTestBuilder):
def __init__(self, name=None, namespace=None, bucket=None,
test_target_name=None... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/ci/notebook_servers/notebook_server_rstudio_tidyverse_tests.py",
"copies": "1",
"size": "1846",
"license": "apache-2.0",
"hash": 7821207479933249000,
"line_mean": 41.9302325581,
"line_max": 98,
"alpha_frac": 0.6262188516,
"autogenerat... |
""""Argo Workflow for testing the notebook-server-jupyter-pytorch OCI images"""
from kubeflow.kubeflow.ci import workflow_utils
from kubeflow.testing import argo_build_util
class Builder(workflow_utils.ArgoTestBuilder):
def __init__(self, name=None, namespace=None, bucket=None,
test_target_name=N... | {
"repo_name": "kubeflow/kubeflow",
"path": "py/kubeflow/kubeflow/ci/notebook_servers/notebook_server_jupyter_pytorch_tests.py",
"copies": "1",
"size": "2453",
"license": "apache-2.0",
"hash": 7061610781880446000,
"line_mean": 45.2830188679,
"line_max": 96,
"alpha_frac": 0.60578883,
"autogenerated":... |
"""Argparse argument types and extensions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os, six, glob, itertools, argparse
_IMG_EXTS = ('.png', '.jpg', '.bmp', '.jpeg')
class ArgumentParser(argparse.A... | {
"repo_name": "Bellaktris/.files",
"path": "python/.local/lib/python/argparse_classes.py",
"copies": "1",
"size": "5753",
"license": "mit",
"hash": 7432103306581749000,
"line_mean": 24.0130434783,
"line_max": 59,
"alpha_frac": 0.5854336868,
"autogenerated": false,
"ratio": 3.6388361796331434,
"... |
"""argparse based argument parser for clang-hook"""
import abc
import sys
import argparse
from .auto_number import AutoNumber
class OptimisationLevel(AutoNumber):
"""Enumeration for -On option. Default is -O0."""
O0 = ()
O1 = ()
O2 = ()
O3 = ()
class OutputType(AutoNumber):
"""Enumeration f... | {
"repo_name": "s-i-newton/clang-hook",
"path": "lib_hook/hook_parser.py",
"copies": "1",
"size": "4353",
"license": "apache-2.0",
"hash": -2426956755473027000,
"line_mean": 40.0660377358,
"line_max": 114,
"alpha_frac": 0.6287617735,
"autogenerated": false,
"ratio": 3.6889830508474577,
"config_t... |
# argParser
# this class generates a RunParams object from the args passed to the script
from runparams import *
import os.path
import string
## handles args passed to the program
#
class ArgParser(object):
def parsePtCutString(self, ptCutString):
return map(float, string.split(ptCutString,',') )
de... | {
"repo_name": "mharrend/plotscripts",
"path": "argparser.py",
"copies": "2",
"size": "9893",
"license": "mit",
"hash": 7057918201830962000,
"line_mean": 38.8911290323,
"line_max": 153,
"alpha_frac": 0.5741433337,
"autogenerated": false,
"ratio": 3.4651488616462345,
"config_test": false,
"has_... |
"""argParser.py:
Parses arguments from a command line.
Requires four arguments: argv,required_arg,required_arg_type,optional_arg
argv is a direct pass of sys.argv
required_arg (list) arguments required for calling script execution.
FINISH ME!
"""
#*******************************************... | {
"repo_name": "harmsm/uhbd",
"path": "previous_releases/0.4.0/argParser.py",
"copies": "1",
"size": "6755",
"license": "unlicense",
"hash": -5768802788341243000,
"line_mean": 40.4417177914,
"line_max": 104,
"alpha_frac": 0.518430792,
"autogenerated": false,
"ratio": 4.476474486414844,
"config_t... |
# argparse tells script user if they have supplied the right values
import argparse
import requests #http for humans
def main():
parser = argparse.ArgumentParser()
# Checks if the arguments needed for the script are supplied.
parser.add_argument("event_oid", help="example: 'Ce6TKMojss' ")
parser.ad... | {
"repo_name": "talapus/Ophidian",
"path": "CC/requesting_json_content_with_appoid.py",
"copies": "1",
"size": "1208",
"license": "bsd-3-clause",
"hash": 4336362092733477400,
"line_mean": 26.4545454545,
"line_max": 93,
"alpha_frac": 0.6713576159,
"autogenerated": false,
"ratio": 3.4613180515759314... |
# *args & **kwargs
# https://freepythontips.wordpress.com/2013/08/04/args-and-kwargs-in-python-explained/
# Python has some great flexibility in calling functions with an assortment of arguments. Most
# functions you write have a set of arguments that you need and you have to place them in a specific
# order.
def fn_o... | {
"repo_name": "mysidewalk/training-django",
"path": "01-middling-python/04-debugging/debugging.py",
"copies": "1",
"size": "1719",
"license": "mit",
"hash": 668452319214059300,
"line_mean": 32.7254901961,
"line_max": 101,
"alpha_frac": 0.7178592205,
"autogenerated": false,
"ratio": 3.493902439024... |
iterations = 40;
gridWidth = 40;
## Vars ##
indentLevel = 0;
file = open("110-generated.fet", "w")
def indent():
global indentLevel
indentLevel = indentLevel + 1
def unindent():
global indentLevel
indentLevel = indentLevel - 1
def newline():
printCode( "" )
def printCode( code ):
global indentLevel
file.... | {
"repo_name": "KjeldSchmidt/Fetlang_110",
"path": "generator.py",
"copies": "1",
"size": "6098",
"license": "unlicense",
"hash": -8928657768424851000,
"line_mean": 21.5018450185,
"line_max": 117,
"alpha_frac": 0.693014103,
"autogenerated": false,
"ratio": 2.7518050541516246,
"config_test": fals... |
## _args.py
# Common argument parsing code.
import argparse
import functools
import logging
import pydle
def client_from_args(name, description, default_nick='Bot', cls=pydle.Client):
# Parse some arguments.
parser = argparse.ArgumentParser(name, description=description, add_help=False,
epilog='This pr... | {
"repo_name": "Shizmob/pydle",
"path": "pydle/utils/_args.py",
"copies": "1",
"size": "4050",
"license": "bsd-3-clause",
"hash": 2717457625572672000,
"line_mean": 57.6956521739,
"line_max": 210,
"alpha_frac": 0.6891358025,
"autogenerated": false,
"ratio": 3.7569573283858997,
"config_test": fals... |
## _args.py
# Common argument parsing code.
import argparse
import logging
import pydle
def client_from_args(name, description, default_nick='Bot', cls=pydle.Client):
# Parse some arguments.
parser = argparse.ArgumentParser(name, description=description, add_help=False,
epilog='This program is part of ... | {
"repo_name": "suut/psychic-happiness",
"path": "pydle/utils/_args.py",
"copies": "1",
"size": "3991",
"license": "unlicense",
"hash": 3083694092967911000,
"line_mean": 58.5671641791,
"line_max": 210,
"alpha_frac": 0.6885492358,
"autogenerated": false,
"ratio": 3.7650943396226415,
"config_test"... |
ARGS_UNARY = {
'DAEMON':'-d',
'MAX_CORE':'-r',
'LOCK_PAGE':'-k',
'HELP':'-h',
'LICENSE':'-i',
'LARGEPAGE':'-L',
'PREALLOC':'-E',
'CAS':'-C'
}
ARGS_BINARY = {
'PORT':'-p',
'UDP':'-U',
'SOCKET':'-s',
'ACCESS':'-a',
'SERVER':'-l',
'USER':'-u',
'EVICTION':'-M',
... | {
"repo_name": "twitter/twemcache",
"path": "tests/config/server/mem4mb.py",
"copies": "3",
"size": "3531",
"license": "bsd-3-clause",
"hash": 6012934092762226,
"line_mean": 31.3944954128,
"line_max": 89,
"alpha_frac": 0.6066270178,
"autogenerated": false,
"ratio": 2.877750611246944,
"config_tes... |
"""Argumentation structure RNN using dynet and AD3 inference"""
# Author: Vlad Niculae <vlad@vene.ro>
# License: BSD 3-clause
import warnings
from collections import Counter
from time import time
import numpy as np
import dynet as dy
from sklearn.utils import shuffle
from marseille.struct_models import BaseArgumen... | {
"repo_name": "vene/marseille",
"path": "marseille/argrnn.py",
"copies": "1",
"size": "26407",
"license": "bsd-3-clause",
"hash": -7546774200757549000,
"line_mean": 36.3507779349,
"line_max": 79,
"alpha_frac": 0.5577687734,
"autogenerated": false,
"ratio": 3.7832378223495704,
"config_test": fal... |
import clinic
from clinic import DSLParser
import collections
import inspect
from test import support
import sys
import unittest
from unittest import TestCase
class FakeConverter:
def __init__(self, name, args):
self.name = name
self.args = args
class FakeConverterFactory:
def __init__(self... | {
"repo_name": "batermj/algorithm-challenger",
"path": "code-analysis/programming_anguage/python/source_codes/Python3.5.9/Python-3.5.9/Tools/clinic/clinic_test.py",
"copies": "3",
"size": "20753",
"license": "apache-2.0",
"hash": 6013575597823115000,
"line_mean": 25.2364096081,
"line_max": 160,
"alpha... |
""" ArgumentEffects computes write effect on arguments. """
from pythran.analyses.aliases import Aliases
from pythran.analyses.global_declarations import GlobalDeclarations
from pythran.passmanager import ModuleAnalysis
from pythran.tables import MODULES
# FIXME: investigate why we need to import it that way
from pyth... | {
"repo_name": "serge-sans-paille/pythran",
"path": "pythran/analyses/argument_effects.py",
"copies": "1",
"size": "7686",
"license": "bsd-3-clause",
"hash": 3244019370482658300,
"line_mean": 39.03125,
"line_max": 76,
"alpha_frac": 0.549960968,
"autogenerated": false,
"ratio": 4.497366881217086,
... |
os.environ["KERAS_BACKEND"] = "tensorflow"
os.environ["CUDA_VISIBLE_DEVICES"] = GPU
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import tensorflow as tf
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)
from keras import backend as K
K.set_session(sess)
import keras
from ker... | {
"repo_name": "AdamLabISU/3DGradCAM",
"path": "test.py",
"copies": "1",
"size": "4625",
"license": "bsd-3-clause",
"hash": -8603497841296469000,
"line_mean": 43.4711538462,
"line_max": 163,
"alpha_frac": 0.6951351351,
"autogenerated": false,
"ratio": 3.4132841328413286,
"config_test": false,
... |
# Argument Noun
#
# Sublime Text plugin that extends Vintage mode with support
# for treating function arguments (including parameters) as
# an 'a' text noun.
#
# Usage:
# delete an argument by pressing "daa"
# change inner argument by pressing "cia"
# select inner argument by pressing "via"
#
# Copyright (c) 201... | {
"repo_name": "nliberg/argument-noun",
"path": "argument_noun.py",
"copies": "1",
"size": "5661",
"license": "mit",
"hash": 7841227986467533000,
"line_mean": 38.0413793103,
"line_max": 83,
"alpha_frac": 0.5394806571,
"autogenerated": false,
"ratio": 3.753978779840849,
"config_test": false,
"h... |
"""Argument of perigee change, with formulas developed by Pollard.
References
----------
* Pollard, J. E. "Simplified Approach for Assessment of Low-Thrust
Elliptical Orbit Transfers", 1997.
* Pollard, J. E. "Evaluation of Low-Thrust Orbital Maneuvers", 1998.
"""
import numpy as np
from poliastro.twobody.decorato... | {
"repo_name": "Juanlu001/pfc-uc3m",
"path": "code/argp.py",
"copies": "1",
"size": "1864",
"license": "mit",
"hash": 7813391985060625000,
"line_mean": 22.3,
"line_max": 95,
"alpha_frac": 0.5659871245,
"autogenerated": false,
"ratio": 2.798798798798799,
"config_test": false,
"has_no_keywords":... |
"""Argument of perigee change, with formulas developed by Pollard.
References
----------
* Pollard, J. E. "Simplified Approach for Assessment of Low-Thrust
Elliptical Orbit Transfers", 1997.
* Pollard, J. E. "Evaluation of Low-Thrust Orbital Maneuvers", 1998.
"""
import numpy as np
from numba import njit
from numpy... | {
"repo_name": "poliastro/poliastro",
"path": "src/poliastro/twobody/thrust/change_argp.py",
"copies": "1",
"size": "1193",
"license": "mit",
"hash": 3962008808821241300,
"line_mean": 24.9347826087,
"line_max": 77,
"alpha_frac": 0.6060352054,
"autogenerated": false,
"ratio": 2.8816425120772946,
... |
""" Argument parser for ConvNN """
import argparse as ap
def _args_parse():
""" Allows for command line hyperparameter inputs to models
Description
------------
--image_size: Sets up the size of a square image, default is 32*32 for CIFAR10
--features : Sizes of convolutional feature maps, the first one ought ... | {
"repo_name": "kkothari93/convNN_CIFAR10",
"path": "parseargs_convnn.py",
"copies": "1",
"size": "2612",
"license": "mit",
"hash": -2332818924359955500,
"line_mean": 48.2830188679,
"line_max": 123,
"alpha_frac": 0.6068147014,
"autogenerated": false,
"ratio": 4.030864197530864,
"config_test": fa... |
""" Argument parser for pp options. """
import re
from collections import namedtuple
from .api import Mods
Argument = namedtuple("Argument", "pattern kwarg_pattern type default")
mods_names = re.compile(r"\w{2}")
kwarg = r"{}=(?P<value>\S+)"
class RegexArgumentParser:
""" Create a simple orderless regex argum... | {
"repo_name": "PcBoy111/PCBOT",
"path": "plugins/osulib/args.py",
"copies": "2",
"size": "3243",
"license": "mit",
"hash": -7945878478429027000,
"line_mean": 31.7575757576,
"line_max": 89,
"alpha_frac": 0.5612087573,
"autogenerated": false,
"ratio": 3.710526315789474,
"config_test": false,
"h... |
'''Argument parsing module
'''
import argparse
import ast
import copy
import inspect
import logging
import re
import sys
from sphinxcontrib.napoleon import Config
from sphinxcontrib.napoleon.docstring import GoogleDocstring
from . import data, optimizer, train
__author__ = 'R Devon Hjelm'
__author_email__ = 'erron... | {
"repo_name": "rdevon/cortex",
"path": "cortex/_lib/parsing.py",
"copies": "1",
"size": "11374",
"license": "bsd-3-clause",
"hash": 2069801486658089200,
"line_mean": 29.3306666667,
"line_max": 79,
"alpha_frac": 0.5218920345,
"autogenerated": false,
"ratio": 3.880586830433299,
"config_test": tru... |
"""Argument parsing."""
import argparse
from encarne.stats import show_stats, clean_movies
# Specifying commands
parser = argparse.ArgumentParser(
description='Encarne reencoder')
parser.add_argument(
'-d', '--directory', type=str,
help='Directory that should be explored for video container to be encoded.... | {
"repo_name": "Nukesor/encarne",
"path": "encarne/argument_parser.py",
"copies": "1",
"size": "1664",
"license": "mit",
"hash": -6722204257746585000,
"line_mean": 27.6896551724,
"line_max": 80,
"alpha_frac": 0.6706730769,
"autogenerated": false,
"ratio": 3.4522821576763487,
"config_test": false... |
# Argument parsing/user input.
import argparse
import getpass
# Timestamp and date processing.
from datetime import datetime
import pytz
# ORM for Drupal database.
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
# String utiilities.... | {
"repo_name": "azaghal/zinnia-drupal",
"path": "zinnia_drupal/management/commands/drupal62zinnia.py",
"copies": "1",
"size": "28475",
"license": "bsd-3-clause",
"hash": -5674756424895577000,
"line_mean": 37.7414965986,
"line_max": 189,
"alpha_frac": 0.6206496927,
"autogenerated": false,
"ratio": ... |
"""Argument parsing utilities for command line tools."""
from __future__ import unicode_literals
import argparse
import os
import sys
import reviewboard
from reviewboard.cmdline.utils.console import get_console
class HelpFormatter(argparse.RawDescriptionHelpFormatter):
"""Formats help text by preserving paragr... | {
"repo_name": "chipx86/reviewboard",
"path": "reviewboard/cmdline/utils/argparsing.py",
"copies": "2",
"size": "2373",
"license": "mit",
"hash": 8393015104043398000,
"line_mean": 26.9176470588,
"line_max": 74,
"alpha_frac": 0.5710071639,
"autogenerated": false,
"ratio": 4.680473372781065,
"conf... |
# Arguments are:
# 1. Working directory.
# 2. Rope folder
import difflib
import io
import json
import os
import sys
import traceback
try:
import rope
from rope.base import libutils
from rope.refactor.rename import Rename
from rope.refactor.extract import ExtractMethod, ExtractVariable
import rope.... | {
"repo_name": "jwatson/dotfiles",
"path": "config/coc/extensions/node_modules/coc-python/pythonFiles/refactor.py",
"copies": "1",
"size": "10906",
"license": "mit",
"hash": -5576505466185262000,
"line_mean": 34.9933993399,
"line_max": 174,
"alpha_frac": 0.6114982578,
"autogenerated": false,
"rati... |
# Arguments are:
# 1. Working directory.
# 2. Rope folder
import io
import sys
import json
import traceback
import rope
from rope.base import libutils
from rope.refactor.rename import Rename
from rope.refactor.extract import ExtractMethod, ExtractVariable
import rope.base.project
import rope.base.taskhandle
WORKSPAC... | {
"repo_name": "DonJayamanne/pythonVSCode",
"path": "src/test/pythonFiles/refactoring/standAlone/refactor.py",
"copies": "1",
"size": "8579",
"license": "mit",
"hash": -5974611509158667000,
"line_mean": 34.0163265306,
"line_max": 174,
"alpha_frac": 0.6128919454,
"autogenerated": false,
"ratio": 4.... |
# arguments are:
# packetid unsigned byte ID of packet
# packet dict decoded packet
# serverprops class see mcproxy.py for details
# serverqueue queue use these to insert new packets
# clientqueue queue
import positioning, gui, mcpackets
def timeHook(packetid, packet, serverprops):
time = packet['time']
... | {
"repo_name": "gm-stack/mcproxy",
"path": "branches/guifix/mcproxy/hooks.py",
"copies": "1",
"size": "3475",
"license": "mit",
"hash": -2566379692144152600,
"line_mean": 38.5,
"line_max": 142,
"alpha_frac": 0.728057554,
"autogenerated": false,
"ratio": 3.0806737588652484,
"config_test": false,
... |
"""Arguments parsing"""
from copy import deepcopy
from functools import wraps
from webargs.flaskparser import FlaskParser
class ArgumentsMixin:
"""Extend Blueprint to add arguments parsing feature"""
ARGUMENTS_PARSER = FlaskParser()
def arguments(
self, schema, *, location='json', content_t... | {
"repo_name": "Nobatek/flask-rest-api",
"path": "flask_rest_api/arguments.py",
"copies": "1",
"size": "3261",
"license": "mit",
"hash": -6077204903436500000,
"line_mean": 40.8076923077,
"line_max": 79,
"alpha_frac": 0.6335479914,
"autogenerated": false,
"ratio": 4.925981873111782,
"config_test"... |
#Arguments_RAxML.py
#version 1.0.1
# For use with runRAxML.py
# Only very limited options have been coded.
import os, optparse
def getParser():
parser = optparse.OptionParser()
#general options
#parser.add_option('-x', dest = 'rapidBootstrapRandomNumberSeed', type='int', default = 12345, help = 'Random... | {
"repo_name": "BotanyHunter/RAxML",
"path": "arguments_RAxML.py",
"copies": "1",
"size": "2194",
"license": "mit",
"hash": 1632224071733857500,
"line_mean": 48.8636363636,
"line_max": 142,
"alpha_frac": 0.5683682771,
"autogenerated": false,
"ratio": 3.4936305732484074,
"config_test": false,
"... |
arguments = ["self", "info", "args"]
helpstring = "chanadduser <nick>"
minlevel = 3
def main(connection, info, args) :
"""Adds a user to the channel sonicbot access list"""
if args[1] in connection.users["users"] :
if connection.users["users"][args[1]]["userlevel"] >= 2 :
if connection.user... | {
"repo_name": "sonicrules1234/sonicbot",
"path": "oldplugins/chanadduser.py",
"copies": "1",
"size": "1339",
"license": "bsd-3-clause",
"hash": 5893471017838653000,
"line_mean": 59.8636363636,
"line_max": 159,
"alpha_frac": 0.5892457058,
"autogenerated": false,
"ratio": 3.997014925373134,
"conf... |
arguments = ["self", "info", "args"]
helpstring = "chanreg"
minlevel = 2
def main(connection, info, args) :
"""Registers a channel with sonicbot"""
if auth(connection, info) :
if connection.users["users"][info["sender"]]["userlevel"] == 2 :
connection.users["users"][info["sender"]]["userle... | {
"repo_name": "sonicrules1234/sonicbot",
"path": "oldplugins/chanreg.py",
"copies": "1",
"size": "1653",
"license": "bsd-3-clause",
"hash": -6766384353274021000,
"line_mean": 58.0357142857,
"line_max": 199,
"alpha_frac": 0.6110102843,
"autogenerated": false,
"ratio": 3.983132530120482,
"config_... |
arguments = ["self", "info", "args"]
minlevel = 3
helpstring = "disable <plugin>"
def main(connection, info, args) :
"""Disables a plugin"""
if args[1] not in ["disable", "enable", "*"] :
if args[1] in connection.users["channels"][info["channel"]]["enabled"] :
connection.users["channels"][i... | {
"repo_name": "sonicrules1234/sonicbot",
"path": "oldplugins/disable.py",
"copies": "1",
"size": "1231",
"license": "bsd-3-clause",
"hash": -6061289414388785000,
"line_mean": 60.55,
"line_max": 140,
"alpha_frac": 0.6238830219,
"autogenerated": false,
"ratio": 4.158783783783784,
"config_test": f... |
arguments = ["self", "info", "args"]
minlevel = 3
helpstring = "enable <plugin>"
def main(connection, info, args) :
"""Enables a plugin"""
if args[1] not in ["disable", "enable", "*"] :
if args[1] not in connection.users["channels"][info["channel"]]["enabled"] :
connection.users["channels"]... | {
"repo_name": "sonicrules1234/sonicbot",
"path": "oldplugins/enable.py",
"copies": "1",
"size": "1209",
"license": "bsd-3-clause",
"hash": 1152776277062208100,
"line_mean": 62.6315789474,
"line_max": 139,
"alpha_frac": 0.6277915633,
"autogenerated": false,
"ratio": 4.08445945945946,
"config_tes... |
#Arguments used by the algorithm
# POP_SIZE = [25,50]
# LK_PERCENTAGE = [0,0.2]
# NEW_POP_TYPE = [0,1,2,3]
# N_BEST = [5]
# RESET_PERCENTAGE = [0.5]
# NEW_TOUR_MODE = [2]
POP_SIZE = [25]
LK_PERCENTAGE = [0]
NEW_POP_TYPE = [0,1,2]
N_BEST = [5]
RESET_PERCENT... | {
"repo_name": "GAStudyGroup/GPX2",
"path": "scp/configs.py",
"copies": "1",
"size": "1249",
"license": "mit",
"hash": -4044112069713661400,
"line_mean": 26.152173913,
"line_max": 97,
"alpha_frac": 0.5396317054,
"autogenerated": false,
"ratio": 2.379047619047619,
"config_test": false,
"has_no_... |
"""`ArgusI`, `ArgusII`"""
import numpy as np
from collections import OrderedDict
from .base import ProsthesisSystem
from .electrodes import DiskElectrode
from .electrode_arrays import ElectrodeGrid
class ArgusI(ProsthesisSystem):
"""Create an Argus I array on the retina
This function creates an Argus I arra... | {
"repo_name": "uwescience/pulse2percept",
"path": "pulse2percept/implants/argus.py",
"copies": "1",
"size": "9355",
"license": "bsd-3-clause",
"hash": 6836969295041147000,
"line_mean": 36.42,
"line_max": 79,
"alpha_frac": 0.5741314805,
"autogenerated": false,
"ratio": 3.4330275229357796,
"confi... |
# argv[1] - file path to main folder (like $HOME/dsge-models)
# argv[2] - name of model (e.g. 'dsf' or 'nk' or 'ca')
from scipy.io import loadmat
from sys import argv
from json import load
TT = 30 # how many periods of results to send
model = argv[2]
fpath = argv[1] + '/' + model + '_mfiles/'
jso... | {
"repo_name": "wclark3/dsge-models",
"path": "dsf_mfiles/save_results.py",
"copies": "2",
"size": "1975",
"license": "mit",
"hash": 1113913892006379300,
"line_mean": 31.3770491803,
"line_max": 79,
"alpha_frac": 0.5913924051,
"autogenerated": false,
"ratio": 2.9129793510324484,
"config_test": fa... |
"""argvemulator - create sys.argv from OSA events. Used by applets that
want unix-style arguments.
"""
from warnings import warnpy3k
warnpy3k("In 3.x, the argvemulator module is removed.", stacklevel=2)
import sys
import traceback
from Carbon import AE
from Carbon.AppleEvents import *
from Carbon import Evt
from Carb... | {
"repo_name": "MalloyPower/parsing-python",
"path": "front-end/testsuite-python-lib/Python-2.7/Lib/plat-mac/argvemulator.py",
"copies": "73",
"size": "3061",
"license": "mit",
"hash": 2263519014946303000,
"line_mean": 32.2717391304,
"line_max": 85,
"alpha_frac": 0.6164652074,
"autogenerated": false... |
"""argvemulator - create sys.argv from OSA events. Used by applets that
want unix-style arguments.
"""
import sys
import traceback
from Carbon import AE
from Carbon.AppleEvents import *
from Carbon import Evt
from Carbon.Events import *
import aetools
class ArgvCollector:
"""A minimal FrameWork.Application-like ... | {
"repo_name": "MalloyPower/parsing-python",
"path": "front-end/testsuite-python-lib/Python-2.3/Lib/plat-mac/argvemulator.py",
"copies": "1",
"size": "3922",
"license": "mit",
"hash": 5486657790097544000,
"line_mean": 33.4035087719,
"line_max": 87,
"alpha_frac": 0.5634880163,
"autogenerated": false,... |
#argv is a list containing the arguments passed to the python interpreter
from sys import argv
#run this script like this:
#python ex16.py test16.txt
script, filename = argv
#using %r here allow actual commands to be input and converted to strings
#because %r uses repr() instead of str() to convert to a string, ie:
#... | {
"repo_name": "liggettla/python",
"path": "ex16.py",
"copies": "1",
"size": "1370",
"license": "mit",
"hash": -4245421582085026300,
"line_mean": 27.5416666667,
"line_max": 73,
"alpha_frac": 0.7065693431,
"autogenerated": false,
"ratio": 3.106575963718821,
"config_test": false,
"has_no_keyword... |
ARIES = "aries"
TAURUS = "taurus"
GEMINI = "gemini"
CANCER = 'cancer'
LEO = 'leo'
VIRGO = 'virgo'
LIBRA = "libra"
SCORPIO = "scorpio"
SAGITTARIUS = "sagittarius"
CAPRICORN = "capricorn"
AQUARIOU = "aquarius"
PISCES = "pisces"
COMMON = "common"
ANIMALS_DICT = {
ARIES: {
'daily_common_url': "https://hyrax.ru... | {
"repo_name": "adiletmaratov/horoscope-bot",
"path": "src/horoscope_parser/constants.py",
"copies": "1",
"size": "1424",
"license": "mit",
"hash": -1855375901391460000,
"line_mean": 26.3846153846,
"line_max": 77,
"alpha_frac": 0.5941011236,
"autogenerated": false,
"ratio": 2.507042253521127,
"c... |
"""arineto_website 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')
... | {
"repo_name": "arineto/arineto-website",
"path": "arineto_website/urls.py",
"copies": "1",
"size": "1184",
"license": "mit",
"hash": -5757070875297243000,
"line_mean": 31.8888888889,
"line_max": 79,
"alpha_frac": 0.6706081081,
"autogenerated": false,
"ratio": 3.5770392749244713,
"config_test": ... |
"""Arithmetic Coding
Functions for doing compression using arithmetic coding.
http://en.wikipedia.org/wiki/Arithmetic_coding
The functions and classes all need predictive models; see model.py
"""
import math
import itertools
def grouper(n, iterable, fillvalue=None):
args = [iter(iterable)] * n
return iterto... | {
"repo_name": "annakoop/forget-me-not",
"path": "ac.py",
"copies": "2",
"size": "7276",
"license": "unlicense",
"hash": -8301029140236450000,
"line_mean": 34.1497584541,
"line_max": 105,
"alpha_frac": 0.5783397471,
"autogenerated": false,
"ratio": 3.941495124593716,
"config_test": false,
"has... |
"""Arithmetic expression generator.
Usage:
arithgen [options]
arithgen --help
arithgen --version
Options:
-n, --count=<count> Specify how many expressions to
generate. [default: 1]
-d, --difficulty=<difficulty> Specify the complexity of
... | {
"repo_name": "yyt16384/arithgen",
"path": "arithgen/cmdline.py",
"copies": "2",
"size": "1088",
"license": "mit",
"hash": -1972982082473051100,
"line_mean": 27.6315789474,
"line_max": 66,
"alpha_frac": 0.5597426471,
"autogenerated": false,
"ratio": 4.2007722007722,
"config_test": false,
"has... |
"""Arithmetic expressions
Problem 93
By using each of the digits from the set, {1, 2, 3, 4}, exactly once, and making
use of the four arithmetic operations (+, −, *, /) and brackets/parentheses, it
is possible to form different positive integer targets.
For example,
8 = (4 * (1 + 3)) / 2
14 = 4 * (3 + 1 / 2)
19 = 4 *... | {
"repo_name": "feliposz/project-euler-solutions",
"path": "python/euler93.py",
"copies": "1",
"size": "3642",
"license": "mit",
"hash": 1709373575958708200,
"line_mean": 31.7747747748,
"line_max": 87,
"alpha_frac": 0.5258383727,
"autogenerated": false,
"ratio": 3.039264828738513,
"config_test":... |
"""arithmetichandler.py -- Basic math and arithmetic
Copyright 2016 Rylan Santinon
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
... | {
"repo_name": "rylans/figaro",
"path": "figaro/handlers/arithmetichandler.py",
"copies": "1",
"size": "6820",
"license": "apache-2.0",
"hash": 5487474149858438000,
"line_mean": 30.4285714286,
"line_max": 99,
"alpha_frac": 0.5304985337,
"autogenerated": false,
"ratio": 4.33015873015873,
"config_... |
''' Arithmetic implemented using Python builtin functions instead of logic gates '''
'''----------------------------- Imports -----------------------------'''
# Hack computer
from ._x__components import *
'''----------------------------- Helpers -----------------------------'''
largestInt_ = 2 ** ( N_BITS - 1 ) -... | {
"repo_name": "JetStarBlues/Nand-2-Tetris",
"path": "OldArchitecture/v1.0/Components/_2__arithmetic_performance.py",
"copies": "2",
"size": "1374",
"license": "mit",
"hash": 20984491368448300,
"line_mean": 15.962962963,
"line_max": 84,
"alpha_frac": 0.4366812227,
"autogenerated": false,
"ratio": ... |
# Arithmetic:
print(10 * 'x') # xxxxxxxxxx
print(5 / 2) # 2.5
print(5 // 2) # 2
print(2 ** 8) # 256
# Indexing:
list = [1, 2, 3, 4, 5]
print(list[0]) # 1
print(list[-1]) # 5
# print(list[99]) # IndexError: list index out of range
# Slicing:
list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(list[1:4]) # [2, 3,... | {
"repo_name": "s3rvac/talks",
"path": "2021-03-08-Introduction-to-Python/examples/14-operations.py",
"copies": "1",
"size": "1407",
"license": "bsd-3-clause",
"hash": -5558958110940477000,
"line_mean": 22.0655737705,
"line_max": 78,
"alpha_frac": 0.5579246624,
"autogenerated": false,
"ratio": 2.2... |
"""## Arithmetic Operators
TensorFlow provides several operations that you can use to add basic arithmetic
operators to your graph.
@@add
@@sub
@@mul
@@div
@@mod
## Basic Math Functions
TensorFlow provides several operations that you can use to add basic
mathematical functions to your graph.
@@add_n
@@abs
@@neg
@@... | {
"repo_name": "liyu1990/tensorflow",
"path": "tensorflow/python/ops/math_ops.py",
"copies": "5",
"size": "38848",
"license": "apache-2.0",
"hash": -902587780172944600,
"line_mean": 31.3463780183,
"line_max": 86,
"alpha_frac": 0.6608319605,
"autogenerated": false,
"ratio": 3.496040316774658,
"co... |
"""Arithmetics for dense recursive polynomials in ``K[x]`` or ``K[X]``."""
from .densebasic import (dmp_degree_in, dmp_one, dmp_one_p, dmp_slice_in,
dmp_strip, dmp_zero, dmp_zero_p, dmp_zeros)
from .polyconfig import query
def dup_add_term(f, c, i, K):
"""
Add ``c*x**i`` to ``f`` in ... | {
"repo_name": "skirpichev/omg",
"path": "diofant/polys/densearith.py",
"copies": "1",
"size": "14415",
"license": "bsd-3-clause",
"hash": -2591575587763517000,
"line_mean": 16.8624535316,
"line_max": 74,
"alpha_frac": 0.4096427333,
"autogenerated": false,
"ratio": 2.5773288038619704,
"config_te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.