text
stringlengths
0
1.05M
meta
dict
""" Custom authentication backend """ import logging, traceback, crypt from django.contrib.auth import backends from django.conf import settings from django.db import connection from rest_framework import permissions from . import models, exchange log = logging.getLogger(__name__) ACTION_MAPS = { 'object': {...
{ "repo_name": "philchristensen/antioch", "path": "antioch/core/auth.py", "copies": "1", "size": "2332", "license": "mit", "hash": 6705590292026686000, "line_mean": 26.7619047619, "line_max": 80, "alpha_frac": 0.5797598628, "autogenerated": false, "ratio": 4.24, "config_test": false, "has_no_k...
""" Default database bootstrap. """ from antioch.core import interface, bootstrap from antioch.util import sql for name in interface.default_permissions: exchange.connection.runOperation(sql.build_insert('permission', name=name)) exchange.load_permissions() system = exchange.instantiate('object', name='Syste...
{ "repo_name": "philchristensen/antioch", "path": "antioch/core/bootstrap/default.py", "copies": "1", "size": "7958", "license": "mit", "hash": 2705103815562514400, "line_mean": 28.9172932331, "line_max": 94, "alpha_frac": 0.6305604423, "autogenerated": false, "ratio": 3.2938741721854305, "confi...
""" Encode/decode antioch JSON antioch-flavored JSON contains object references, where objects are saved in the format:: {'o#1':'ObjectName'} {'v#1':'VerbName'} {'p#1':'PropertyName'} These will be converted transparently by the dumps/loads functions in this module. """ import json def loads(j, excha...
{ "repo_name": "philchristensen/antioch", "path": "antioch/util/ason.py", "copies": "1", "size": "1913", "license": "mit", "hash": -2307692342454263300, "line_mean": 25.5694444444, "line_max": 77, "alpha_frac": 0.542603241, "autogenerated": false, "ratio": 3.650763358778626, "config_test": false...
""" Graphical object editor support. """ from zope.interface import provider from antioch import IPlugin from . import forms from django.conf import settings def edit(p, item): p.exchange.send_message(p.caller.get_id(), dict( command = 'edit', details = item.get_details(), ))...
{ "repo_name": "philchristensen/antioch", "path": "antioch/plugins/editors/plugin.py", "copies": "1", "size": "1438", "license": "mit", "hash": 712589949140565400, "line_mean": 23.7931034483, "line_max": 116, "alpha_frac": 0.5312934631, "autogenerated": false, "ratio": 3.7253886010362693, "confi...
""" Log customization support. """ import sys, time from django.utils import termcolors styles = dict( ERROR = termcolors.make_style(fg='red', opts=['bold']), WARNING = termcolors.make_style(fg='yellow', opts=['bold']), INFO = termcolors.make_style(fg='cyan'), DEBUG = termcolors.make_style(fg='blue'...
{ "repo_name": "philchristensen/antioch", "path": "antioch/util/logs.py", "copies": "1", "size": "1859", "license": "mit", "hash": -731590708571011000, "line_mean": 28.5079365079, "line_max": 91, "alpha_frac": 0.5621301775, "autogenerated": false, "ratio": 3.8810020876826723, "config_test": fals...
import logging from celery import shared_task from celery.utils.log import get_task_logger from django.conf import settings from django.db import connection from antioch.core import code, exchange, errors, parser from antioch.util import sql, ason log = get_task_logger(__name__) def get_exchange(ctx=None): ...
{ "repo_name": "philchristensen/antioch", "path": "antioch/core/tasks.py", "copies": "1", "size": "5308", "license": "mit", "hash": 4492224547416739000, "line_mean": 28.6592178771, "line_max": 89, "alpha_frac": 0.5981537302, "autogenerated": false, "ratio": 3.7196916608269097, "config_test": fal...
import logging from celery import shared_task from antioch.util import ason from antioch.core import parser, tasks log = logging.getLogger(__name__) @shared_task def openeditor(user_id, object_id, type, name): with tasks.get_exchange(user_id) as x: if(type == 'object'): item = x.get_objec...
{ "repo_name": "philchristensen/antioch", "path": "antioch/plugins/editors/tasks.py", "copies": "1", "size": "3711", "license": "mit", "hash": 3263516196533420000, "line_mean": 28.935483871, "line_max": 92, "alpha_frac": 0.6087308003, "autogenerated": false, "ratio": 3.325268817204301, "config_t...
""" Online signup for new players. """ import logging import pkg_resources as pkg from zope.interface import provider from antioch import IPlugin from antioch.util import ason from antioch.core import parser, code log = logging.getLogger(__name__) @provider(IPlugin) class SignupPlugin(object): script_url = N...
{ "repo_name": "philchristensen/antioch", "path": "antioch/plugins/signup/plugin.py", "copies": "1", "size": "1580", "license": "mit", "hash": -2498613053845139000, "line_mean": 26.7192982456, "line_max": 80, "alpha_frac": 0.5917721519, "autogenerated": false, "ratio": 3.7264150943396226, "confi...
""" Parse command strings sent by the client. This parser can understand a variety of phrases, but they are all represented by the (BNF?) form: <verb>[[[<dobj spec> ]<direct-object> ]+[<prep> [<pobj spec> ]<object-of-the-preposition>]*] There are a long list of prepositions supported, some of which are interchange...
{ "repo_name": "philchristensen/antioch", "path": "antioch/core/parser.py", "copies": "1", "size": "19767", "license": "mit", "hash": 5805749098907629000, "line_mean": 34.8097826087, "line_max": 114, "alpha_frac": 0.5184398239, "autogenerated": false, "ratio": 4.01278928136419, "config_test": fa...
""" Plugins add additional client or server functionality """ import os, sys from django.conf import settings from django.conf.urls import include, url from importlib import import_module from django.utils.module_loading import module_has_submodule plugin_cache = {} def iterate(): """ Iterate through insta...
{ "repo_name": "philchristensen/antioch", "path": "antioch/plugins/__init__.py", "copies": "1", "size": "2076", "license": "mit", "hash": 5481634730638895000, "line_mean": 29.9850746269, "line_max": 90, "alpha_frac": 0.6411368015, "autogenerated": false, "ratio": 3.8949343339587243, "config_test...
""" Represent objects in-universe """ from antioch.core import errors, code from antioch.util import ason # These are the default list of permissions, auto-created # first thing during universe boostrapping default_permissions = ( 'anything', 'read', 'write', 'entrust', 'grant', 'execute', ...
{ "repo_name": "philchristensen/antioch", "path": "antioch/core/interface.py", "copies": "1", "size": "30511", "license": "mit", "hash": -1406239294605088500, "line_mean": 29.664321608, "line_max": 115, "alpha_frac": 0.534168005, "autogenerated": false, "ratio": 4.218304991013411, "config_test":...
""" SQL building facilities. """ import sys, types, time, datetime, array, decimal def strftime(dt, fmt): """ Format the provided datetime object using the given format string. This function will properly format dates before 1900. """ # I hope I did this math right. Every 28 years the # ...
{ "repo_name": "philchristensen/antioch", "path": "antioch/util/sql.py", "copies": "1", "size": "13461", "license": "mit", "hash": -108087687997182980, "line_mean": 30.0877598152, "line_max": 152, "alpha_frac": 0.5847262462, "autogenerated": false, "ratio": 3.850400457665904, "config_test": fals...
#!antioch if not has_pobj_str('on'): stype = 'object' if(has_dobj()): subject = get_dobj() else: subject = get_object(get_dobj_str()) else: if(has_pobj('on')): origin = get_pobj('on') else: origin = get_object(get_pobj_str('on')) subjects = get_dobj_str().sp...
{ "repo_name": "philchristensen/antioch", "path": "antioch/core/bootstrap/default_verbs/author_class_inspect.py", "copies": "1", "size": "3130", "license": "mit", "hash": 8955892736202530000, "line_mean": 33.4065934066, "line_max": 109, "alpha_frac": 0.5325878594, "autogenerated": false, "ratio": ...
#!antioch if(runtype == 'method'): obj = args[0] if args else caller.location target = this else: if(has_dobj_str()): obj = get_dobj() target = caller else: obj = caller.get_location() target = caller current = target.get_observing() if(current and current is not obj): ...
{ "repo_name": "philchristensen/antioch", "path": "antioch/core/bootstrap/default_verbs/player_class_look.py", "copies": "1", "size": "1877", "license": "mit", "hash": -5958852698472515000, "line_mean": 31.9473684211, "line_max": 102, "alpha_frac": 0.5482152371, "autogenerated": false, "ratio": 3....
# antioch # # import os import setuptools # disables creation of .DS_Store files inside tarballs on Mac OS X os.environ['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true' os.environ['COPYFILE_DISABLE'] = 'true' dist = setuptools.setup( name = "antioch", version = "0.9", packages ...
{ "repo_name": "philchristensen/antioch", "path": "setup.py", "copies": "1", "size": "1146", "license": "mit", "hash": 7153396612457010000, "line_mean": 39.9285714286, "line_max": 107, "alpha_frac": 0.5776614311, "autogenerated": false, "ratio": 3.9246575342465753, "config_test": false, "has_n...
#!antioch username = args[0] password = args[1] if(username != 'guest'): return None room = get_object("The Lobby") guest_class = get_object('guest class') # get the list of available guest names, which # also sets the total number of possible guests if('guest_names' in system): guest_names = system['guest_...
{ "repo_name": "philchristensen/antioch", "path": "antioch/core/bootstrap/default_verbs/system_authenticate.py", "copies": "1", "size": "1424", "license": "mit", "hash": 977828115343129000, "line_mean": 28.6666666667, "line_max": 78, "alpha_frac": 0.6762640449, "autogenerated": false, "ratio": 3.5...
# antispam.py: Basic services-side spamfilters for IRC from pylinkirc import conf, utils from pylinkirc.log import log mydesc = ("Provides anti-spam functionality.") sbot = utils.register_service("antispam", default_nick="AntiSpam", desc=mydesc) def die(irc=None): utils.unregister_service("antispam") _UNICODE_C...
{ "repo_name": "GLolol/PyLink", "path": "plugins/antispam.py", "copies": "1", "size": "19675", "license": "mpl-2.0", "hash": -5323735254086303000, "line_mean": 40.826405868, "line_max": 141, "alpha_frac": 0.6027357222, "autogenerated": false, "ratio": 2.1227199404392603, "config_test": false, ...
"""ANTLR3 exception hierarchy""" # begin[licence] # # [The "BSD licence"] # Copyright (c) 2005-2006 Terence Parr # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source c...
{ "repo_name": "ncbray/pystream", "path": "lib/antlr3/exceptions.py", "copies": "1", "size": "12739", "license": "apache-2.0", "hash": 4642764974015753000, "line_mean": 33.9972527473, "line_max": 86, "alpha_frac": 0.6462830677, "autogenerated": false, "ratio": 4.472963483146067, "config_test": f...
"""ANTLR3 exception hierarchy""" # begin[licence] # # [The "BSD licence"] # Copyright (c) 2005-2008 Terence Parr # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source c...
{ "repo_name": "legatoproject/legato-af", "path": "framework/tools/ifgen/antlr3/exceptions.py", "copies": "1", "size": "12590", "license": "mpl-2.0", "hash": 4312229561777484000, "line_mean": 33.5879120879, "line_max": 86, "alpha_frac": 0.6539316918, "autogenerated": false, "ratio": 4.429978888106...
"""ANTLR3 exception hierarchy""" # begin[licence] # # [The "BSD licence"] # Copyright (c) 2005-2012 Terence Parr # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source c...
{ "repo_name": "pballand/congress", "path": "thirdparty/antlr3-antlr-3.5/runtime/Python3/antlr3/exceptions.py", "copies": "6", "size": "12546", "license": "apache-2.0", "hash": 963743598186781600, "line_mean": 33.467032967, "line_max": 81, "alpha_frac": 0.635501355, "autogenerated": false, "ratio"...
"""ANTLR3 runtime package""" # begin[licence] # # [The "BSD licence"] # Copyright (c) 2005-2006 Terence Parr # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code ...
{ "repo_name": "ncbray/pystream", "path": "lib/antlr3/tokens.py", "copies": "1", "size": "12016", "license": "apache-2.0", "hash": -2647893228699563000, "line_mean": 27.8846153846, "line_max": 87, "alpha_frac": 0.5937916112, "autogenerated": false, "ratio": 4.671850699844479, "config_test": fals...
"""ANTLR3 runtime package""" # begin[licence] # # [The "BSD licence"] # Copyright (c) 2005-2008 Terence Parr # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code ...
{ "repo_name": "legatoproject/legato-af", "path": "framework/tools/ifgen/antlr3/constants.py", "copies": "1", "size": "2109", "license": "mpl-2.0", "hash": -6999353295242839000, "line_mean": 36.6607142857, "line_max": 75, "alpha_frac": 0.7591275486, "autogenerated": false, "ratio": 4.1111111111111...
"""ANTLR3 runtime package""" # begin[licence] # # [The "BSD licence"] # Copyright (c) 2005-2012 Terence Parr # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code ...
{ "repo_name": "ramineni/my_congress", "path": "thirdparty/antlr3-antlr-3.5/runtime/Python3/antlr3/tokens.py", "copies": "6", "size": "9741", "license": "apache-2.0", "hash": 186915511319662900, "line_mean": 30.4225806452, "line_max": 81, "alpha_frac": 0.6006570167, "autogenerated": false, "ratio"...
import sys import antlr4 from gen.TeX2SymLexer import TeX2SymLexer from gen.TeX2SymParser import TeX2SymParser from gen.TeX2SymVisitor import TeX2SymVisitor from sympy import * # variable : a,b,...,z, A,B,..,Z, \\alpha, \\beta,..,\pi,... , \\omega (except E, I, N, O, S, zeta, omicron) # math constant : pi; --> \\ppi...
{ "repo_name": "AkiraHakuta/antlr4_tex2sym", "path": "antlr4_tex2sym.py", "copies": "1", "size": "11716", "license": "mit", "hash": -5533862589729912000, "line_mean": 31.6378830084, "line_max": 153, "alpha_frac": 0.516473199, "autogenerated": false, "ratio": 3.097012952683056, "config_test": tru...
# ANTLR Tree -> AST # antlr4 -Dlanguage=Python3 Cstar.g4 # python3 main.py test.cx # nLine = x.start.line # как работает импорт # в defs[] создается запись вида {isa: import, unit: *ast, id: ID} (по сути - линк) # он имеет ID определенный в импортирующем модуле (import as ID) # и ссылается на откомпиленный AST/ASG #...
{ "repo_name": "ammaaim/cx", "path": "main.py", "copies": "1", "size": "7652", "license": "mit", "hash": -2289755926452632000, "line_mean": 19.060518732, "line_max": 88, "alpha_frac": 0.6002011205, "autogenerated": false, "ratio": 2.5470179290157335, "config_test": false, "has_no_keywords": fa...
from __future__ import absolute_import, print_function, division import array import collections import struct import threading import time try: # Python 3 import queue except ImportError: # Python 2 import Queue as queue import logging import usb.core import usb.util from .message import Message ...
{ "repo_name": "jforge/openant", "path": "ant/base/ant.py", "copies": "1", "size": "12367", "license": "mit", "hash": 6939613810685109000, "line_mean": 38.7652733119, "line_max": 109, "alpha_frac": 0.5525188, "autogenerated": false, "ratio": 4.297081306462822, "config_test": false, "has_no_key...
from __future__ import absolute_import, print_function import array import logging try: from functools import reduce except ImportError: pass from .commons import format_list _logger = logging.getLogger("ant.base.message") class Message: class ID: INVALID = 0x00 # Configuration mess...
{ "repo_name": "jforge/openant", "path": "ant/base/message.py", "copies": "1", "size": "5473", "license": "mit", "hash": -5153328611619358000, "line_mean": 29.7471910112, "line_max": 77, "alpha_frac": 0.6069797186, "autogenerated": false, "ratio": 3.593565331582403, "config_test": false, "has_...
from __future__ import absolute_import, print_function import collections import threading import logging try: # Python 3 import queue except ImportError: # Python 2 import Queue as queue from ant.base.ant import Ant from ant.base.message import Message from ant.easy.channel import Channel from ant....
{ "repo_name": "jforge/openant", "path": "ant/easy/node.py", "copies": "1", "size": "4727", "license": "mit", "hash": 8332523864201892000, "line_mean": 33.2536231884, "line_max": 84, "alpha_frac": 0.6445948805, "autogenerated": false, "ratio": 3.999153976311337, "config_test": false, "has_no_k...
from __future__ import absolute_import, print_function import logging from ant.base.message import Message from ant.easy.exception import AntException, TransferFailedException _logger = logging.getLogger("ant.easy.filter") def wait_for_message(match, process, queue, condition): """ Wait for a specific mes...
{ "repo_name": "jforge/openant", "path": "ant/easy/filter.py", "copies": "1", "size": "4099", "license": "mit", "hash": -6887332983168702000, "line_mean": 36.6055045872, "line_max": 96, "alpha_frac": 0.6650402537, "autogenerated": false, "ratio": 4.2520746887966805, "config_test": false, "has_...
from __future__ import absolute_import, print_function import logging from ant.base.message import Message from ant.easy.exception import TransferFailedException from ant.easy.filter import wait_for_event, wait_for_response, wait_for_special _logger = logging.getLogger("ant.easy.channel") class Channel(): cla...
{ "repo_name": "jforge/openant", "path": "ant/easy/channel.py", "copies": "1", "size": "4994", "license": "mit", "hash": 2141833254105536500, "line_mean": 40.6166666667, "line_max": 93, "alpha_frac": 0.6938325991, "autogenerated": false, "ratio": 3.637290604515659, "config_test": false, "has_n...
from __future__ import absolute_import, print_function import struct class Beacon: class ClientDeviceState: LINK = 0x00 # 0b0000 AUTHENTICATION = 0x01 # 0b0001 TRANSPORT = 0x02 # 0b0010 BUSY = 0x03 # 0b0011 BEACON_ID = 0x43 def is_data_available(self): retur...
{ "repo_name": "jforge/openant", "path": "ant/fs/beacon.py", "copies": "1", "size": "2391", "license": "mit", "hash": 3355720921504279000, "line_mean": 33.1571428571, "line_max": 77, "alpha_frac": 0.6896695943, "autogenerated": false, "ratio": 3.7012383900928794, "config_test": false, "has_no_...
import array import collections import struct import threading import logging from commons import format_list _logger = logging.getLogger("garmin.ant.base.message") class Message: class ID: INVALID = 0x00 # Configuration messages UNASSIGN_CHANNEL ...
{ "repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork", "path": "ant/base/message.py", "copies": "1", "size": "6620", "license": "mit", "hash": -3803489629086382600, "line_mean": 37.2658959538, "line_max": 82, "alpha_frac": 0.4954682779, "autogenerated": false, "ratio": 4.166142227816237, ...
import array import collections import struct import threading import time import queue import logging import usb.core import usb.util from .message import Message from .commons import format_list from .driver import find_driver _logger = logging.getLogger("ant.base.ant") class Ant: _RESET_WAIT = 1 def _...
{ "repo_name": "Tigge/openant", "path": "ant/base/ant.py", "copies": "1", "size": "14211", "license": "mit", "hash": -646820878127171300, "line_mean": 35.7209302326, "line_max": 98, "alpha_frac": 0.5176271902, "autogenerated": false, "ratio": 4.409246044058331, "config_test": false, "has_no_ke...
import array import collections import struct import threading import time import Queue import logging import usb from message import Message from commons import format_list from driver import find_driver _logger = logging.getLogger("garmin.ant.base.ant") class Ant(): _RESET_WAIT = 1 def __init__(self): ...
{ "repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork", "path": "ant/base/ant.py", "copies": "1", "size": "12100", "license": "mit", "hash": 8895778030284559000, "line_mean": 39.0662251656, "line_max": 109, "alpha_frac": 0.555785124, "autogenerated": false, "ratio": 4.245614035087719, "c...
import collections import threading import logging import Queue from ant.base.ant import Ant from ant.base.message import Message from ant.easy.channel import Channel from ant.easy.filter import wait_for_event, wait_for_response, wait_for_special _logger = logging.getLogger("garmin.ant.easy.node") class Node(): ...
{ "repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork", "path": "ant/easy/node.py", "copies": "1", "size": "4653", "license": "mit", "hash": 4643246813690936000, "line_mean": 35.0697674419, "line_max": 84, "alpha_frac": 0.6303460133, "autogenerated": false, "ratio": 4.0673076923076925, "...
import collections import threading import logging from ant.base.message import Message from ant.easy.exception import TransferFailedException from ant.easy.filter import wait_for_event, wait_for_response, wait_for_special _logger = logging.getLogger("garmin.ant.easy.channel") class Channel(): class Type: ...
{ "repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork", "path": "ant/easy/channel.py", "copies": "1", "size": "5112", "license": "mit", "hash": 7199680817698983000, "line_mean": 41.2479338843, "line_max": 93, "alpha_frac": 0.6852503912, "autogenerated": false, "ratio": 3.6566523605150216, ...
import logging from ant.base.message import Message from ant.easy.exception import AntException, TransferFailedException _logger = logging.getLogger("garmin.ant.easy.filter") def wait_for_message(match, process, queue, condition): """ Wait for a specific message in the *queue* guarded by the *condition* ...
{ "repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork", "path": "ant/easy/filter.py", "copies": "1", "size": "3914", "license": "mit", "hash": 1324127365280454700, "line_mean": 42.010989011, "line_max": 77, "alpha_frac": 0.673479816, "autogenerated": false, "ratio": 4.177161152614728, "c...
import struct class Beacon: class ClientDeviceState: LINK = 0x00 # 0b0000 AUTHENTICATION = 0x01 # 0b0001 TRANSPORT = 0x02 # 0b0010 BUSY = 0x03 # 0b0011 BEACON_ID = 0x43 def is_data_available(self): return bool(self._status_byte_1 & 0x...
{ "repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork", "path": "ant/fs/beacon.py", "copies": "1", "size": "2371", "license": "mit", "hash": -8777183386375832000, "line_mean": 33.8676470588, "line_max": 77, "alpha_frac": 0.6773513286, "autogenerated": false, "ratio": 3.7875399361022364, ...
import collections import threading import logging try: # Python 3 import queue except ImportError: # Python 2 import Queue as queue from ant.base.ant import Ant from ant.base.message import Message from ant.easy.channel import Channel from ant.easy.filter import wait_for_event, wait_for_response, w...
{ "repo_name": "Tigge/openant", "path": "ant/easy/node.py", "copies": "1", "size": "5190", "license": "mit", "hash": 4628207201333385000, "line_mean": 35.2937062937, "line_max": 84, "alpha_frac": 0.638150289, "autogenerated": false, "ratio": 3.9984591679506933, "config_test": false, "has_no_ke...
import logging from ant.base.message import Message from ant.easy.exception import AntException, TransferFailedException _logger = logging.getLogger("ant.easy.filter") def wait_for_message(match, process, queue, condition): """ Wait for a specific message in the *queue* guarded by the *condition* matc...
{ "repo_name": "Tigge/openant", "path": "ant/easy/filter.py", "copies": "1", "size": "4086", "license": "mit", "hash": 2913082721724383000, "line_mean": 34.8421052632, "line_max": 77, "alpha_frac": 0.6566324033, "autogenerated": false, "ratio": 4.260688216892596, "config_test": false, "has_no_...
import logging from ant.base.message import Message from ant.easy.exception import TransferFailedException from ant.easy.filter import wait_for_event, wait_for_response, wait_for_special _logger = logging.getLogger("ant.easy.channel") class Channel: class Type: BIDIRECTIONAL_RECEIVE = 0x00 BID...
{ "repo_name": "Tigge/openant", "path": "ant/easy/channel.py", "copies": "1", "size": "5602", "license": "mit", "hash": 6322932716671687000, "line_mean": 39.5942028986, "line_max": 85, "alpha_frac": 0.6847554445, "autogenerated": false, "ratio": 3.609536082474227, "config_test": false, "has_no...
import struct class Beacon: class ClientDeviceState: LINK = 0x00 # 0b0000 AUTHENTICATION = 0x01 # 0b0001 TRANSPORT = 0x02 # 0b0010 BUSY = 0x03 # 0b0011 BEACON_ID = 0x43 def __init__(self, status_byte_1, status_byte_2, authentication_type, descriptor): self._...
{ "repo_name": "Tigge/openant", "path": "ant/fs/beacon.py", "copies": "1", "size": "2548", "license": "mit", "hash": -7227692724954946000, "line_mean": 34.8873239437, "line_max": 86, "alpha_frac": 0.6911302983, "autogenerated": false, "ratio": 3.7142857142857144, "config_test": false, "has_no_...
## Antony Philip - 01/10/2016 - Developed for Teaching ## ACSL 2012-2013 - Cells def cell_divide(cell): """ Pick the first 4 characters replicate it Pick the last 4 characters replicate it return the concatenated copy of above 2 """ first = cell[:4] ## Maximum 4 characters star...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest2/cells.py", "copies": "1", "size": "1981", "license": "mit", "hash": -1310818381106106400, "line_mean": 25.7702702703, "line_max": 87, "alpha_frac": 0.6158505805, "autogenerated": false, "ratio": 3.4037800687285222, "config_test": false, "...
## Antony Philip - 01/10/2016 - Developed for Teaching ## ACSL 2013-2014 - PRINT FORMATTING def acsl_format(format_str, value_str): """ Define a function which takes a value string and formats it using the passed in value string """ pre_formatted_value = [] ## Array in which we accumula...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest2/print_formatting.py", "copies": "1", "size": "5416", "license": "mit", "hash": -3929356945103358500, "line_mean": 37.1408450704, "line_max": 92, "alpha_frac": 0.5781019202, "autogenerated": false, "ratio": 3.9161243673174257, "config_test":...
## Antony Philip (01/17/2016) - Developed for Teaching ## ACSL 2011-2012 - Search def find_match(pattern, value): """ This function return true or false depending on whether the pattern (with embedded wild card chars) matched the given value string or not """ p_len = len(pattern...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest2/search.py", "copies": "1", "size": "2572", "license": "mit", "hash": 6328735338947809000, "line_mean": 27.5888888889, "line_max": 114, "alpha_frac": 0.5948678072, "autogenerated": false, "ratio": 3.8388059701492536, "config_test": false, ...
## Antony Philip - 01/17/2016 - Initial version ## ACSL 2011-2012 - Bits """ Prefixes of a string are all substrings starting at 0. For example prefix of a string 'ABCDE' are ['', 'A', 'AB','ABC', 'ABCD' , 'ABCDE'] Key observation in this problem is when we encounter a '*' we replicate the...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest2/bits.py", "copies": "1", "size": "2582", "license": "mit", "hash": -7938319823977481000, "line_mean": 32.1025641026, "line_max": 102, "alpha_frac": 0.6324554609, "autogenerated": false, "ratio": 3.7044476327116214, "config_test": false, "...
## Antony Philip - 01/18/2016 - Developed for Teaching ## ACSL 2014-2015 - LISP Expressions class LispExpr(object) : """ This class is intended to be used as a base class for lisp expressions LISP expression is defined as an Atom (integer or character in this case) or a list. Th...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest2/lisp_expr.py", "copies": "1", "size": "4408", "license": "mit", "hash": 5432339831124417000, "line_mean": 33.4375, "line_max": 106, "alpha_frac": 0.567831216, "autogenerated": false, "ratio": 3.7772065124250216, "config_test": false, "has...
## Antony Philip (02/07/2016) - Developed for Teaching ## ACSL - 2014-2015 - ACSL Isola class Board(object): """ Board is abstracted as a class with arbitrary number of rows and columns In Isola board we will be passing in 7 x 7 for rows x cols Note: Tile number starts at 1, Tile posit...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest3/acsl_isola.py", "copies": "1", "size": "5701", "license": "mit", "hash": -8391748332474909000, "line_mean": 30.5027624309, "line_max": 100, "alpha_frac": 0.5393790563, "autogenerated": false, "ratio": 3.88881309686221, "config_test": false,...
## Antony Philip (02/14/2016) - Developed for Teaching ## ACSL 2011-2012 - ACSL Grid Fit class Board(object): """ Board is abstracted as a class with arbitrary number of rows and columns In ACSL chess board we will be passing in 5 x 5 for rows x cols We have the matrix as [0..4][0..4]....
{ "repo_name": "antonyrp/teach-acsl", "path": "contest3/acsl_grid_fit.py", "copies": "1", "size": "4939", "license": "mit", "hash": 1962320094708977000, "line_mean": 29.875, "line_max": 112, "alpha_frac": 0.5480866572, "autogenerated": false, "ratio": 4.065020576131687, "config_test": false, "...
## Antony Philip (02/14/2016) - Developed for Teaching ## ACSL 2012-2013 - ACSL Chess Queen class Board(object): """ Board is abstracted as a class with arbitrary number of rows and columns In ACSL chess board we will be passing in 5 x 5 for rows x cols We have the matrix as [0..4][0.....
{ "repo_name": "antonyrp/teach-acsl", "path": "contest3/acsl_chess_queen.py", "copies": "1", "size": "3322", "license": "mit", "hash": 8062865132213596000, "line_mean": 32.23, "line_max": 131, "alpha_frac": 0.552077062, "autogenerated": false, "ratio": 3.6030368763557483, "config_test": false, ...
## Antony Philip (02/15/2016) - Developed for Teaching ## ACSL - 2010-2011 - ACSL Mancala class Board(object): """ Mancala board - 12 bowls Player A owns bowls 1..6 and mancala A Player B owns bowls 7..12 and mancala B Again, Python index starts at 0, but the game ...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest3/acsl_mancala.py", "copies": "1", "size": "2784", "license": "mit", "hash": -6566919280171965000, "line_mean": 30.6477272727, "line_max": 107, "alpha_frac": 0.5610632184, "autogenerated": false, "ratio": 3.2791519434628977, "config_test": fa...
## Antony Philip - 02/28/2016 - Developed in hacker-rank platform ## Normal distribution from math import * class normdist(object) : def __init__(self, mu, sigma) : """ Init with mu and sigma """ self._mu = mu self._sigma = sigma def cdf(self, x): """ ...
{ "repo_name": "antonyrp/misc-code", "path": "normdist.py", "copies": "1", "size": "1246", "license": "mit", "hash": -152035282924132770, "line_mean": 23.92, "line_max": 68, "alpha_frac": 0.4526484751, "autogenerated": false, "ratio": 2.756637168141593, "config_test": false, "has_no_keywords":...
## Antony Philip - 03/19/2016 - Developed for teaching ## ACSL Encryption 2010-2011 def CodeNumber(c) : """ Expects capital letter alphabets or ' ' as character input Converts the character into its numeric value A->1, B->2,,,,Z->26, ' '->27 In simple terms: ord(c) gives out...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest4/acsl_matrix_encryption.py", "copies": "1", "size": "3282", "license": "mit", "hash": -668750606430569100, "line_mean": 25.0555555556, "line_max": 75, "alpha_frac": 0.5627666057, "autogenerated": false, "ratio": 3.3592630501535314, "config_t...
## Antony Philip - 03/30/2016 - Developed for ACSL teaching ## ACSL 2011-2012 - Infix to Prefix (PIP) from curses.ascii import isspace class Node : """ Simple class to represent tree node (which is expression - variable or expression made with operators and variables in tree form) """ ...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest4/acsl_pip.py", "copies": "1", "size": "6396", "license": "mit", "hash": 1689897935175814400, "line_mean": 29.0328638498, "line_max": 118, "alpha_frac": 0.5587867417, "autogenerated": false, "ratio": 4.401927047487956, "config_test": false, ...
## Antony Philip - 03/31/2016 - Developed for ACSL teaching ## ACSL 2014-2015 - Quine-McClusky Algorithm (Simplify Boolean Expressions) """ Here some additional Python features are used for you to learn about 1) Ternary operator: https://www.python.org/dev/peps/pep-0308/ 2) +=, -=, operators 3) lambda...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest4/quine_mcclusky.py", "copies": "1", "size": "3501", "license": "mit", "hash": 1009976901565686300, "line_mean": 32.0283018868, "line_max": 97, "alpha_frac": 0.5995429877, "autogenerated": false, "ratio": 3.4089581304771177, "config_test": fa...
## Antony Philip - 04/03/2016 - Developed for ACSL teaching ## ACSL 2012-2013 - ACSL Rummy class Rummy : """ Simple class wrapper to do ACSL Rummy thing """ def __init__(self, draw): """ Arrange the drawn 7 cards into sets and runs Using dictionaries to store card a...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest4/acsl_rummy.py", "copies": "1", "size": "7942", "license": "mit", "hash": 8353015751837990000, "line_mean": 34.6188340807, "line_max": 148, "alpha_frac": 0.450264417, "autogenerated": false, "ratio": 3.4560487380330724, "config_test": false,...
## Antony Philip - 04/17/2016 - Initial version ## ACSL 2015-2016 - ACSL ABC class Board(object): def __init__(self, alphabets): """ Board initializer - Alphabets to be placed are passed-in In this case alphabets will be ['A','B','C'] number of rows and columns of the ...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest3/acsl_abc.py", "copies": "1", "size": "3505", "license": "mit", "hash": -9050889472236668000, "line_mean": 31.462962963, "line_max": 112, "alpha_frac": 0.5446504993, "autogenerated": false, "ratio": 3.6358921161825726, "config_test": false, ...
## Antony Philip (12/06/2015) - Developed for Teaching ## ACSL 2001-2002 - Wrap Around Code import sys def AlphabetToPosition(c): """ This function converts the given character c to its positional value [1..26] Find out a better way to do this mapping Learn about dictionaries, maps,.. ...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest1/wrap_around.py", "copies": "1", "size": "5248", "license": "mit", "hash": -7842075675276503000, "line_mean": 25.24, "line_max": 100, "alpha_frac": 0.5123856707, "autogenerated": false, "ratio": 3.5080213903743314, "config_test": false, "h...
## Antony Philip (12/06/2015) - Developed for Teaching ## ACSL 2010-2011 - ACSL Prints ## Finger number and its corresponding whorl number finger_number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] whorl_number = [16, 16, 8, 8, 4, 4, 2, 2, 1, 1] def even(finger): """ Small function to check whether the finger is ...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest1/fingerprintpgr.py", "copies": "1", "size": "2085", "license": "mit", "hash": 5565256886074213000, "line_mean": 25.0625, "line_max": 81, "alpha_frac": 0.5976019185, "autogenerated": false, "ratio": 3.183206106870229, "config_test": false, ...
## Antony Philip (12/06/2015) - Developed for Teaching ## ACSL 2011-2012 - Draft Picks ## We need to import this library which has special values holding ## Smallest and largest floating point numbers import sys ## We need to gather contract years and the contract salary for 5 players contract_years = [] contract_sa...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest1/draft_picks.py", "copies": "1", "size": "2898", "license": "mit", "hash": 3473372900018831000, "line_mean": 35.6962025316, "line_max": 97, "alpha_frac": 0.6939268461, "autogenerated": false, "ratio": 2.8721506442021805, "config_test": false...
## Antony Philip (12/06/2015) - Developed for Teaching ## ACSL 2012-2013 - Time Sheets def get_time_code_as_integer(char_time_code) : """ This function gets an integer code corresponding alphanumeric code entered for the time employee entered work location and the time he exited the work l...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest1/time_sheets.py", "copies": "1", "size": "4182", "license": "mit", "hash": 6770244559429494000, "line_mean": 30.9312977099, "line_max": 93, "alpha_frac": 0.5973218556, "autogenerated": false, "ratio": 3.4110929853181076, "config_test": false...
## Antony Philip (12/06/2015) - Developed for Teaching ## ACSL 2013-2014 - ACSL Scrabble def letter_value(letter): """ Given a letter this function returns its point value as per defined rules """ points = 0 if letter in ['A', 'E'] : points = 1 elif letter in ['D'...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest1/acsl_scrabble.py", "copies": "1", "size": "3077", "license": "mit", "hash": -8259558007406861000, "line_mean": 31.0625, "line_max": 107, "alpha_frac": 0.6272343191, "autogenerated": false, "ratio": 3.7800982800982803, "config_test": false, ...
## Antony Philip (12/06/2015) - Developed for Teaching ## ACSL 2014-2015 - Navigating ACSL Land ## We simply keep the distance for the current place from its previous place ## Note for place A it is 0 distance_from_previous_place = [0, 450, 140, 120, 320, 250, 80] def place_position (location): """ This f...
{ "repo_name": "antonyrp/teach-acsl", "path": "contest1/acsl_navigation.py", "copies": "1", "size": "3315", "license": "mit", "hash": -5713956966338857000, "line_mean": 28.0789473684, "line_max": 144, "alpha_frac": 0.6398190045, "autogenerated": false, "ratio": 3.256385068762279, "config_test": ...
# ANT+ - Open Rx Scan Mode Example # # Open Rx demo working with OpenAnt Library (https://github.com/Tigge/openant) # For further details on Open Rx Mode ("Continious Scann Mode"), check out the thisisant.com webpage from ant.easy.node import Node from ant.easy.channel import Channel from ant.base.message impor...
{ "repo_name": "Tigge/openant", "path": "examples/continuous_scan.py", "copies": "1", "size": "2245", "license": "mit", "hash": 7214754451382281000, "line_mean": 28.7534246575, "line_max": 100, "alpha_frac": 0.646325167, "autogenerated": false, "ratio": 3.3557548579970105, "config_test": false, ...
a = { "tournament_id":"550d1d68cd7bd10003000003", # Id of the current tournament "game_id":"550da1cb2d909006e90004b1", # Id of the current sit'n'go game. You can use this to link a # sequence of game states together for logging purposes, or to ...
{ "repo_name": "turbek/poker-player-piton", "path": "player.py", "copies": "1", "size": "12359", "license": "mit", "hash": 2542364105092288000, "line_mean": 47.8498023715, "line_max": 121, "alpha_frac": 0.380936969, "autogenerated": false, "ratio": 3.578170237405906, "config_test": false, "has...
"""ANTS Apply Transforms interface Change directory to provide relative paths for doctests >>> import os >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) >>> os.chdir(datadir) """ from builtins import range impor...
{ "repo_name": "FCP-INDI/nipype", "path": "nipype/interfaces/ants/resampling.py", "copies": "6", "size": "21783", "license": "bsd-3-clause", "hash": 2337702489026583000, "line_mean": 49.5406032483, "line_max": 178, "alpha_frac": 0.5647982372, "autogenerated": false, "ratio": 4.340972499003587, "...
# ANT+ - Stride Based Speed and Distance Sensor Example # # SDM demo working with OpenAnt Library (https://github.com/Tigge/openant) # using feature of: # - acting as Transmitting Device (TX-Broadcast) # - gracefully close ANT-Channels # # For further details on Speed & Distance Sensor, check out the thisisant.c...
{ "repo_name": "Tigge/openant", "path": "examples/speed_and_distance.py", "copies": "1", "size": "8403", "license": "mit", "hash": -973838366314077400, "line_mean": 35.5133928571, "line_max": 123, "alpha_frac": 0.5884803047, "autogenerated": false, "ratio": 3.790257104194858, "config_test": fals...
# A number chain is created by continuously adding the square # of the digits in a number to form a new number until it has # been seen before. # For example, # 44 -> 32 -> 13 -> 10 -> 1 -> 1 # 85 -> 89 -> 145 -> 42 -> 20 -> 4 -> 16 -> 37 -> 58 -> 89 # Therefore any chain that arrives at 1 or 89 will become stuck # ...
{ "repo_name": "cloudzfy/euler", "path": "src/92.py", "copies": "1", "size": "1031", "license": "mit", "hash": 5958949826176366000, "line_mean": 29.3235294118, "line_max": 90, "alpha_frac": 0.6779825412, "autogenerated": false, "ratio": 3.191950464396285, "config_test": false, "has_no_keywords...
# A number chain is created by continuously adding the square of the digits in a number to form a new number until it has been seen before. # # For example, # # 44 → 32 → 13 → 10 → 1 → 1 # 85 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89 # # Therefore any chain that arrives at 1 or 89 will become stuck in an endless ...
{ "repo_name": "bgwines/project-euler", "path": "src/solved/problem92.py", "copies": "1", "size": "1172", "license": "bsd-3-clause", "hash": 5078906206434369000, "line_mean": 22.8541666667, "line_max": 169, "alpha_frac": 0.6582167832, "autogenerated": false, "ratio": 2.4923747276688455, "config_...
# a "number" class with fuzzy values class FuzzNum(object): # a floating point number with a fuzzy value def __init__(self, median = 0., variance = 0.): self.med = median # radius must be zero or positive self.var = max(variance,0) def __str__(self): return "{0} +- {1}".for...
{ "repo_name": "dudecon/Gatheling", "path": "Old Reference Files/Fuzzy_Number.py", "copies": "1", "size": "2094", "license": "unlicense", "hash": -51167928862811070, "line_mean": 40.0588235294, "line_max": 95, "alpha_frac": 0.5210124164, "autogenerated": false, "ratio": 3.519327731092437, "confi...
# A number is Sparse if there are no two adjacent 1s in its binary representation. # Given a number n, find the smallest Sparse number which greater than or equal to n. # eg. 5 (binary representation: 101) is sparse, but 6 (binary representation: 110) is not sparse. # Example # Given n = 6, return 8 # Next Sparse Num...
{ "repo_name": "AtlantisFox/Green-Point-Challenge", "path": "leetcode/next-sparse-number.py", "copies": "1", "size": "1114", "license": "mit", "hash": -3192023976232195000, "line_mean": 25.5476190476, "line_max": 97, "alpha_frac": 0.5897666068, "autogenerated": false, "ratio": 3.0189701897018972, ...
"""A number of GUIDs with invalid or missing referents were found during the mongo -> postgres migration. These GUIDS were parsed from the migration logs and written to scripts/orphaned_guids.json. This script adds a field, `is_orphaned` to these GUIDS and sets it to True so that they can be skipped during the mongo -...
{ "repo_name": "cwisecarver/osf.io", "path": "scripts/mark_orphaned_guids.py", "copies": "7", "size": "1452", "license": "apache-2.0", "hash": -8794698365640142000, "line_mean": 29.25, "line_max": 91, "alpha_frac": 0.6391184573, "autogenerated": false, "ratio": 3.7714285714285714, "config_test":...
"""A number of hard-to-fit functions taken from Wikipedia: http://en.wikipedia.org/wiki/Test_functions_for_optimization The number of iterations for convergence may differ, so if these tests fail, carefully check if this is simply because the test fit has not converged yet. (A.k.a. tests need to be improved.) """ im...
{ "repo_name": "evertrol/mpyfit", "path": "test/testfunctions.py", "copies": "1", "size": "2078", "license": "bsd-2-clause", "hash": -6800201053774186000, "line_mean": 27.0810810811, "line_max": 70, "alpha_frac": 0.5866217517, "autogenerated": false, "ratio": 3.0922619047619047, "config_test": t...
"""A number of useful helper functions to automate common tasks.""" from __future__ import unicode_literals from django.contrib import admin from django.contrib.admin.sites import NotRegistered from django.utils.encoding import force_text from reversion.admin import VersionAdmin def patch_admin(model, admin_site=N...
{ "repo_name": "Glasgow2015/team-10", "path": "env/lib/python2.7/site-packages/reversion/helpers.py", "copies": "13", "size": "3062", "license": "apache-2.0", "hash": -1127671526485623900, "line_mean": 34.6046511628, "line_max": 100, "alpha_frac": 0.6694970607, "autogenerated": false, "ratio": 4.2...
"""A number of useful helper functions to automate common tasks.""" from django.contrib import admin from django.contrib.admin.sites import NotRegistered from reversion.admin import VersionAdmin def patch_admin(model, admin_site=None): """ Enables version control with full admin integration for a model tha...
{ "repo_name": "empty/django-reversion", "path": "reversion/helpers.py", "copies": "1", "size": "2254", "license": "bsd-3-clause", "hash": 8538974544560545000, "line_mean": 32.1470588235, "line_max": 96, "alpha_frac": 0.6805678793, "autogenerated": false, "ratio": 4.174074074074074, "config_test...
# An unbelievably disgusting compatibility layer because I'm being rushed. # ---AG from __future__ import absolute_import, division, print_function from collections import defaultdict import dossier.web as web import yakonfig class Folders(web.Folders): DEFAULT_ANNOTATOR_ID = 'unknown' def __init__(self, ...
{ "repo_name": "dossier/dossier.models", "path": "dossier/models/folder.py", "copies": "1", "size": "2756", "license": "mit", "hash": 105541709091413090, "line_mean": 31.4235294118, "line_max": 75, "alpha_frac": 0.5504354136, "autogenerated": false, "ratio": 3.865357643758766, "config_test": tru...
# An undercomplete autoencoder on MNIST dataset from __future__ import division, print_function, absolute_import import tensorflow.contrib.layers as lays import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from skimage import transform from tensorflow.examples.tutorials.mnist import input_data ...
{ "repo_name": "astorfi/TensorFlow-World", "path": "codes/3-neural_networks/undercomplete-autoencoder/code/autoencoder.py", "copies": "1", "size": "3507", "license": "mit", "hash": -1064150865968228100, "line_mean": 37.9666666667, "line_max": 115, "alpha_frac": 0.626746507, "autogenerated": false, ...
"""An unidirectional pipe. Your average example:: @coro def iterator(): iterator = yield Iterate(producer) while 1: val = yield iterator if val is sentinel: break # do something with val @coro def producer(): f...
{ "repo_name": "ionelmc/python-cogen", "path": "cogen/core/pipe.py", "copies": "4", "size": "3383", "license": "mit", "hash": -3571057870388024300, "line_mean": 24.8492063492, "line_max": 70, "alpha_frac": 0.5184747266, "autogenerated": false, "ratio": 4.4222222222222225, "config_test": false, ...
"""An unofficial library to access the Cleverbot service.""" from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import str # pylint: disable=redefined-builtin from builtins import object # pylint: disable=redefined-builtin import collections imp...
{ "repo_name": "Beefywhale/WeenieBot", "path": "modules/custom_cleverbot/cleverbot.py", "copies": "1", "size": "6201", "license": "mit", "hash": -1214166607860077600, "line_mean": 31.9840425532, "line_max": 80, "alpha_frac": 0.5360425738, "autogenerated": false, "ratio": 4.005813953488372, "conf...
# An "updater" determines when assets should automatically be recreated. import os from courant.core.assets.conf import settings def get_updater(name=None): """Return a callable(output, sources) that returns True if the file ``output``, based on the files in the list ``sources`` needs to be recr...
{ "repo_name": "maxcutler/Courant-News", "path": "courant/core/assets/updater.py", "copies": "1", "size": "1372", "license": "bsd-3-clause", "hash": -1410696102093851000, "line_mean": 24.9019607843, "line_max": 72, "alpha_frac": 0.6166180758, "autogenerated": false, "ratio": 4.083333333333333, "...
"""An upgrade card.""" from csrv.model import actions from csrv.model import events from csrv.model import game_object from csrv.model import timing_phases from csrv.model.cards import installable_card from csrv.model.cards import card_info class Upgrade(installable_card.InstallableCard): TYPE = card_info.UPGRADE...
{ "repo_name": "mrroach/CentralServer", "path": "csrv/model/cards/upgrade.py", "copies": "1", "size": "1210", "license": "apache-2.0", "hash": -4127110076934129700, "line_mean": 26.5, "line_max": 80, "alpha_frac": 0.7297520661, "autogenerated": false, "ratio": 3.3241758241758244, "config_test": ...
""" An utility module containing utility functions used by the grader module and some useful pre-test hooks. """ import json import traceback def import_module(path, name=None): if name is None: name = path import importlib.machinery loader = importlib.machinery.SourceFileLoader(name, path) ...
{ "repo_name": "macobo/python-grader", "path": "grader/utils.py", "copies": "1", "size": "1858", "license": "mit", "hash": -5235387913198303000, "line_mean": 25.9275362319, "line_max": 76, "alpha_frac": 0.6899892357, "autogenerated": false, "ratio": 4.021645021645021, "config_test": true, "has...
# Använder python 2.7 # Script for capturing images # # sudo apt-get install python-picamera python-requests pika # # Arduino URL # http://intranet.strongest.se/gympassv4/index.php/doorpassV5/rmq_store_message_to_queue/doorpass_skagget_picture/tag_en_bild # import requests import MySQLdb import time import picamera im...
{ "repo_name": "declint/gympassv5", "path": "gympass_camera.py", "copies": "1", "size": "2525", "license": "apache-2.0", "hash": -3893323866615433000, "line_mean": 25.8510638298, "line_max": 141, "alpha_frac": 0.6953248811, "autogenerated": false, "ratio": 2.711063372717508, "config_test": false...
# A with open("day5.txt", "r") as fh: l = fh.readline().strip() index = 0 any_change = True while any_change: any_change = False d = '' for i, c in enumerate(l[index:]): if (c.islower() and d == c.upper()) or (d.upper() == c and d.islower()): l = l[:i + index - 1] + l[i + index +1:] any_change = ...
{ "repo_name": "Dakror/AdventOfCode", "path": "aoc18/day5.py", "copies": "1", "size": "1033", "license": "apache-2.0", "hash": 469934941815241660, "line_mean": 21, "line_max": 76, "alpha_frac": 0.5469506292, "autogenerated": false, "ratio": 2.51338199513382, "config_test": false, "has_no_keywo...
"""An XBlock providing thumbs-up/thumbs-down voting.""" import logging import pkg_resources from web_fragments.fragment import Fragment from xblock.core import XBlock, XBlockAside from xblock.fields import Boolean, Integer, Scope log = logging.getLogger(__name__) class ThumbsBlockBase: """ An XBlock with...
{ "repo_name": "stvstnfrd/xblock-sdk", "path": "sample_xblocks/thumbs/thumbs.py", "copies": "2", "size": "4235", "license": "apache-2.0", "hash": -3476643052535740000, "line_mean": 31.5769230769, "line_max": 95, "alpha_frac": 0.6061393152, "autogenerated": false, "ratio": 4.151960784313726, "con...
"""An XBlock providing thumbs-up/thumbs-down voting. This is a completely artifical test case for the filesystem field type. It behaves just like the sample_xblocks/thumbs example, except it uses filesystem fields. Votes are stored in a JSON object in the file system, and up/down arrow PNGs are constructed as files o...
{ "repo_name": "stvstnfrd/xblock-sdk", "path": "sample_xblocks/filethumbs/filethumbs.py", "copies": "2", "size": "5295", "license": "apache-2.0", "hash": 4030897286463813600, "line_mean": 32.5126582278, "line_max": 109, "alpha_frac": 0.5765816808, "autogenerated": false, "ratio": 3.999244712990936...
# )A)Nx&E_@@YPDXoV import string import random from base64 import b64encode, b64decode FLAG = 'flag{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}' enc_ciphers = ['rot13', 'b64e', 'caesar'] # dec_ciphers = ['rot13', 'b64d', 'caesard'] def rot13(s): _rot13 = string.maketrans( "ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstu...
{ "repo_name": "frankcash/ctfs", "path": "csaw2015/foo.py", "copies": "2", "size": "1194", "license": "mit", "hash": -1151768246741732700, "line_mean": 24.4042553191, "line_max": 60, "alpha_frac": 0.6783919598, "autogenerated": false, "ratio": 2.9336609336609336, "config_test": false, "has_no_...
ANXIETY_PLAIN = """ Dear {0}, {1} {2} {3} {4} Sincerely, Your Anxiety P.S You can deactivate your account anytime at {domain}/deactivate?uuid={uid}, or just straight up delete it at {domain}/delete?uuid={uid} """ ANXIETY_HTML= """ Dear {0},<br><br> {1} <br> {2} <br> {3} <br> {4} <br><br> Sincerely, <br> Your Anxie...
{ "repo_name": "padraic-padraic/AnxietyFlask", "path": "AnxietyFlask/emails.py", "copies": "1", "size": "1730", "license": "mit", "hash": 5352549597242694000, "line_mean": 21.7631578947, "line_max": 178, "alpha_frac": 0.6780346821, "autogenerated": false, "ratio": 2.750397456279809, "config_test...
"""An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. """ from . import handler from ._exceptions import SAXNotSupportedException, SAXNotRecognizedException # ===== XMLREADER ===== class XMLReader: """Interface for reading an XML document using callbacks. XMLReade...
{ "repo_name": "ms-iot/python", "path": "cpython/Lib/xml/sax/xmlreader.py", "copies": "53", "size": "12684", "license": "bsd-3-clause", "hash": -7144981601337528000, "line_mean": 32.3789473684, "line_max": 78, "alpha_frac": 0.6615421003, "autogenerated": false, "ratio": 4.649560117302053, "confi...
"""An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. """ import handler from _exceptions import SAXNotSupportedException, SAXNotRecognizedException # ===== XMLREADER ===== class XMLReader: """Interface for reading an XML document using callbacks. XMLReader is the...
{ "repo_name": "valkjsaaa/sl4a", "path": "python/src/Lib/xml/sax/xmlreader.py", "copies": "60", "size": "12638", "license": "apache-2.0", "hash": 1993893840719387000, "line_mean": 32.1706036745, "line_max": 78, "alpha_frac": 0.6615761988, "autogenerated": false, "ratio": 4.653166421207659, "conf...
""" an XML-RPC server to allow remote control of PyMol Author: Greg Landrum (glandrum@users.sourceforge.net) Created: January 2002 $LastChangedDate$ License: PyMol Requires: - a python xmlrpclib distribution containing the SimpleXMLRPCServer module (1.0 or greater should be ...
{ "repo_name": "rdkit/rdkit-orig", "path": "External/pymol/modules/pymol/rpc.py", "copies": "1", "size": "16968", "license": "bsd-3-clause", "hash": -5787077171439044000, "line_mean": 27.2329450915, "line_max": 83, "alpha_frac": 0.6523455917, "autogenerated": false, "ratio": 3.4362089914945324, ...
""" an XML-RPC server to allow remote control of PyMol Author: Greg Landrum (glandrum@users.sourceforge.net) Created: January 2002 $LastChangedDate$ License: This file is part of the RDKit. The contents are covered by the terms of the BSD license which is included in the file license.txt, f...
{ "repo_name": "adalke/rdkit", "path": "External/pymol/modules/pymol/rpc.py", "copies": "1", "size": "17243", "license": "bsd-3-clause", "hash": -3496266979421166000, "line_mean": 27.548013245, "line_max": 84, "alpha_frac": 0.6534245781, "autogenerated": false, "ratio": 3.4534348087322253, "conf...
"""Any auxiliary code, that we might need.""" import os import json ENV_DEV = "dev" """When run on localhots (dev env).""" ENV_BM = "BM" """When run on IBM Bluemix.""" def select_run_location(): """Decide where is the server running.""" # TODO: for now, this is not "smart", so lets assume, that it's dev: ...
{ "repo_name": "FiB3/pyWebRedis", "path": "src/auxil.py", "copies": "1", "size": "2408", "license": "mit", "hash": 4189479809760018400, "line_mean": 26.3636363636, "line_max": 82, "alpha_frac": 0.5884551495, "autogenerated": false, "ratio": 3.840510366826156, "config_test": false, "has_no_keyw...
ANYCHAR = '.'; ESCAPE = '\\' REGIONA = '['; REGIONO = ']'; RANGE = '-'; COMPLEMENT = '^' GROUPA = '(' ; GROUPO = ')'; ALTERNATIVE = '|' PERHAPS = '?' ; STAR = '*'; JUST_ONE_and_STAR = '+' EXTENSION = '(?'; SKIPSTORE = '?:' def match_region(ch, pattern): """ region: a list of comparation chars and ranges in [] or [...
{ "repo_name": "ActiveState/code", "path": "recipes/Python/577251_Simple_regex_engine_elementary_/recipe-577251.py", "copies": "1", "size": "7508", "license": "mit", "hash": -8155037987477256000, "line_mean": 41.6590909091, "line_max": 90, "alpha_frac": 0.5663292488, "autogenerated": false, "ratio...
from dummyprobe import DummyProbe import subprocess import platform import re import com.xhaus.jyson.JysonCodec as json import logging logger = logging.getLogger(__name__) class ExecProbe(DummyProbe): def initialize(self): if self.getInputProperty("regex") != None: logger.info("Got regex for parsing: %s", self....
{ "repo_name": "filipealmeida/probespawner", "path": "execprobe.py", "copies": "1", "size": "2263", "license": "unlicense", "hash": 6497893528812113000, "line_mean": 30.4305555556, "line_max": 108, "alpha_frac": 0.6482545294, "autogenerated": false, "ratio": 3.2514367816091956, "config_test": fa...
from __future__ import division import os import shutil import subprocess import tempfile import numpy as np from .coords import angstrom __all__ = ['MopacSolver'] def MopacSolver(cmd='mopac', method='PM7', workdir=None): """ Crate a solver that wraps `MOPAC <http://openmopac.net>`_. Mopac needs to b...
{ "repo_name": "azag0/pyberny", "path": "src/berny/solvers.py", "copies": "1", "size": "3411", "license": "mpl-2.0", "hash": 1405582267500833300, "line_mean": 36.0760869565, "line_max": 83, "alpha_frac": 0.4986807388, "autogenerated": false, "ratio": 3.6716899892357375, "config_test": false, "...
from __future__ import unicode_literals from chatbot_reply import Script, rule class HokeyPokeyScript(Script): def setup(self): self.botvars["mood"] = "good" self.botvars["bodypart"] = "right foot" self.botvars["danced"] = False self.bodyparts = ['right foot', 'left foot', 'right ar...
{ "repo_name": "gazally/indigo-chatbot", "path": "example_scripts/dance.py", "copies": "1", "size": "3626", "license": "mpl-2.0", "hash": 3315244519027177500, "line_mean": 34.2038834951, "line_max": 83, "alpha_frac": 0.5730832874, "autogenerated": false, "ratio": 3.2903811252268604, "config_test...
from __future__ import unicode_literals from chatbot_reply import Script, rule class ValveScript(Script): def setup(self): self.alternates = {} self.alternates["mainvalve"] = \ "((shutoff|shut off|main|main water|city water) valve)" self.alternates["drainvalve"] = "([water] dra...
{ "repo_name": "gazally/indigo-chatbot", "path": "test/test_scripts/valves.py", "copies": "1", "size": "6135", "license": "mpl-2.0", "hash": 8341321681530088000, "line_mean": 36.8703703704, "line_max": 97, "alpha_frac": 0.5926650367, "autogenerated": false, "ratio": 3.548293811451706, "config_te...
from __future__ import unicode_literals import string from chatbot_reply import Script, rule class TutorialScript(Script): def setup(self): self.alternates = {"colors": "(red|yellow|orange|green|blue|indigo|violet)"} self.help_ideas = ["valve", "eliza", "fun stuff"] @rule("random help") de...
{ "repo_name": "gazally/indigo-chatbot", "path": "example_scripts/examples.py", "copies": "1", "size": "4555", "license": "mpl-2.0", "hash": 8235274292606235000, "line_mean": 32.0072463768, "line_max": 84, "alpha_frac": 0.5732162459, "autogenerated": false, "ratio": 3.2699210337401294, "config_t...
# Creates the precomplete file containing the remove and rmdir application # update instructions which is used to remove files and directories that are no # longer present in a complete update. The current working directory is used for # the location to enumerate and to create the precomplete file. import sys import ...
{ "repo_name": "kostaspl/SpiderMonkey38", "path": "config/createprecomplete.py", "copies": "4", "size": "2980", "license": "mpl-2.0", "hash": -4383991119488843000, "line_mean": 43.4776119403, "line_max": 80, "alpha_frac": 0.6573825503, "autogenerated": false, "ratio": 3.5182998819362457, "config...