repo_name stringlengths 6 90 | path stringlengths 4 230 | copies stringlengths 1 4 | size stringlengths 4 7 | content stringlengths 734 985k | license stringclasses 15
values | hash int64 -9,223,303,126,770,100,000 9,223,233,360B | line_mean float64 3.79 99.6 | line_max int64 19 999 | alpha_frac float64 0.25 0.96 | autogenerated bool 1
class | ratio float64 1.5 8.06 | config_test bool 2
classes | has_no_keywords bool 2
classes | few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Eureka22/ASM_xf | PythonD/site_python/numarray/nd_image/filters.py | 2 | 30179 | # Copyright (C) 2003-2005 Peter J. Verveer
#
# 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 must retain the above copyright
# notice, this list of conditions and the following ... | gpl-2.0 | 2,190,124,927,647,001,600 | 43.909226 | 76 | 0.630372 | false | 4.031392 | false | false | false |
jonathandunn/c2xg | c2xg/modules/rdrpos_tagger/SCRDRlearner/SCRDRTreeLearner.py | 2 | 11391 | # -*- coding: utf-8 -*-
from .Node import Node
from .Object import getObjectDictionary
from .SCRDRTree import SCRDRTree
#Generate concrete rules based on input object of 5-word window context object
def generateRules(object):
# 1. Current word
rule1 = "object.word == \"" + object.word + "\""
# 2. Next 1... | gpl-3.0 | -8,273,076,653,013,750,000 | 35.983766 | 169 | 0.551488 | false | 4.314773 | false | false | false |
NedYork/viper | tests/parser/exceptions/test_variable_declaration_exception.py | 1 | 1093 | import pytest
from pytest import raises
from viper import compiler
from viper.exceptions import VariableDeclarationException
fail_list = [
"""
x: num
x: num
""",
"""
x: num
def foo(x: num): pass
""",
"""
def foo(x: num, x: num): pass
""",
"""
def foo(num: num):
pass
""",
"""
... | mit | -4,124,558,135,278,014,000 | 11.563218 | 57 | 0.479414 | false | 3.282282 | false | false | false |
Hack42/MuseumDB | backend/models.py | 1 | 4589 | """
models.py
Module that handles everything related to hardware models. Showing, Adding, Removing, etc.
"""
# Imports
import pymongo
import os.path
import logging
from bson.objectid import ObjectId
from bson import json_util
import datetime
# Tornado imports
import torndb
import tornado.auth
import tornado.httpserv... | gpl-2.0 | 449,306,112,610,264,060 | 35.420635 | 125 | 0.635433 | false | 3.746122 | false | false | false |
KukojinOyama/l5rcm | dal/report.py | 3 | 2490 | # -*- coding: utf-8 -*-
# Copyright (C) 2011 Daniele Simonetti
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Thi... | gpl-3.0 | 4,296,842,108,863,939,600 | 34.585714 | 130 | 0.613253 | false | 3.577586 | false | false | false |
graphql-python/graphql-core | src/graphql/error/located_error.py | 1 | 1848 | from typing import TYPE_CHECKING, Collection, Optional, Union
from ..pyutils import inspect
from .graphql_error import GraphQLError
if TYPE_CHECKING:
from ..language.ast import Node # noqa: F401
__all__ = ["located_error"]
def located_error(
original_error: Exception,
nodes: Optional[Union["None", Col... | mit | 5,509,377,521,123,753,000 | 35.96 | 88 | 0.701299 | false | 4.442308 | false | false | false |
screen6/spotprice | spotprice/libs/ec2.py | 1 | 1723 | #!/usr/bin/env python
import sys
import logging as log
import boto.ec2
import boto.ec2.elb
class Ec2:
""" a class to create a ec2 (elb) connection, and some shortcuts """
def __init__(self, ec2_region=None, ec2_key=None, ec2_secret=None, connection=None):
if not connection:
if not ec2_reg... | apache-2.0 | 9,188,866,392,185,276,000 | 36.456522 | 91 | 0.542078 | false | 3.96092 | false | false | false |
lahwaacz/wiki-scripts | ws/utils/TLSAdapter.py | 1 | 1173 | #! /usr/bin/env python3
import ssl
import requests
from requests.packages.urllib3.poolmanager import PoolManager
from requests.packages.urllib3.util import ssl_
__all__ = ["TLSAdapter"]
class TLSAdapter(requests.adapters.HTTPAdapter):
"""
Snippet based on https://stackoverflow.com/a/44432829
Example:
... | gpl-3.0 | 8,788,992,956,349,447,000 | 34.545455 | 82 | 0.663257 | false | 3.439883 | false | false | false |
ypid-bot/check_mk | tests/livestatus/test_livestatus.py | 1 | 1988 | #!/usr/bin/env python
# encoding: utf-8
import pytest
from testlib import web
@pytest.fixture(scope="module")
def default_cfg(web):
web.add_host("livestatus-test-host", attributes={
"ipaddress": "127.0.0.1",
})
web.discover_services("livestatus-test-host")
web.activate_changes()
yield No... | gpl-2.0 | 3,943,473,064,669,230,600 | 27.811594 | 91 | 0.649899 | false | 3.56912 | true | false | false |
mondwan/ProjectCUWG | cuwg/transaction/httpAuthentication.py | 1 | 1808 | """
- `File`: httpAuthentication.py
- `Description`: Transaction challenge 3: Http Authentication
"""
import webapp2
from google.appengine.ext.webapp import template
import os
import constants
class HttpAuthenticationHandler(webapp2.RequestHandler):
"""Handler for /transaction/httpAuthentication"""
@classm... | mit | 4,299,144,304,042,018,000 | 28.16129 | 74 | 0.531527 | false | 4.720627 | false | false | false |
JosefJezek/ZenPacks.community.Synology | ZenPacks/community/Synology/Definition.py | 1 | 5791 | from ZenPacks.community.ConstructionKit.BasicDefinition import *
from ZenPacks.community.ConstructionKit.Construct import *
BASE = "Synology"
VERSION = Version(1, 0, 0)
def getMapValue(ob, datapoint, map):
'''Attempt to map number to data dict'''
try:
value = int(ob.getRRDValue(datapoint))
ret... | gpl-2.0 | 4,385,845,508,801,072,000 | 39.222222 | 104 | 0.657572 | false | 3.936778 | false | false | false |
zauberpony/ansible-mysql-query | tests/test_mysql_query_multi_check.py | 1 | 3789 | from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch
from ansible.module_utils import basic
from library import mysql_query
from tests.fixtures import MYSQL_CONNECTION_PARAMS, Fixture
from tests.utils import set_module_args, AnsibleFailJson, exit_json, fail_json, AnsibleExitJson
class... | gpl-3.0 | -2,515,577,122,010,961,400 | 42.056818 | 120 | 0.642914 | false | 3.858452 | true | false | false |
nathanntg/lin-train | lintrain/trainer.py | 1 | 1638 | import numpy as np
from basetrainer import BaseTrainer
# Feature selection + linear regression training and validation toolkit
class Trainer(BaseTrainer):
def _do_forward_selection(self, col_indices_for_inputs, best_score):
# column indices
l_indices = np.shape(self.x)[1]
# no more column... | mit | -8,170,771,363,807,392,000 | 31.76 | 95 | 0.603175 | false | 4.167939 | false | false | false |
crisely09/horton | horton/meanfield/convergence.py | 1 | 3066 | # -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2016 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by th... | gpl-3.0 | -6,079,511,431,307,384,000 | 29.356436 | 87 | 0.650033 | false | 3.619835 | false | false | false |
patrickwestphal/colsplit | colsplit/main.py | 1 | 2015 | import csv
import sys
from colsplit.colsplitter import ColSplitter
def run(input_file_path, outfile_path=None, csv_file_header=False,
delimiter=',', encoding='utf8', considered_fixed_lengths=[2, 3],
greedy_merge=True):
col_names = None
col_splitters = []
with open(input_file_path, encod... | gpl-2.0 | -3,675,839,355,111,313,400 | 28.632353 | 72 | 0.551365 | false | 3.816288 | false | false | false |
fhahn/luna | luna/tests/test_compiled.py | 1 | 4097 | import os
import subprocess
from luna.tests.helpers import test_file
class TestCompiled(object):
"""
Tests compiled binary
"""
PYLUA_BIN = os.path.join(os.path.dirname(os.path.abspath(__file__)), ('../../lunac'))
def test_addition(self):
f = test_file(src="""
-- short add
... | bsd-3-clause | -4,286,930,682,592,533,500 | 20.909091 | 89 | 0.356602 | false | 4.150963 | true | false | false |
krull/docker-zenoss4 | init_fs/usr/local/zenoss/ZenPacks/ZenPacks.zenoss.MySqlMonitor-3.0.7.egg/ZenPacks/zenoss/MySqlMonitor/datasources/MySqlMonitorDataSource.py | 3 | 6500 | ##############################################################################
#
# Copyright (C) Zenoss, Inc. 2008, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
#####################################... | gpl-3.0 | 2,194,572,609,716,953,900 | 33.210526 | 79 | 0.587385 | false | 3.934625 | false | false | false |
georgyberdyshev/ascend | models/johnpye/moody.py | 1 | 1508 | import ascpy
import extpy
browser = extpy.getbrowser()
from pylab import *
from solverreporter import *
def setsomevalue(self):
""" a silly listing testing routine """
self = ascpy.Registry().getInstance('context')
f = 0.005
self.f.setRealValue(f)
s = "Set f to %f (confirmed as: %f)" % (f, self.f.getRealValue())... | gpl-2.0 | -337,613,699,385,552,060 | 26.418182 | 127 | 0.700928 | false | 2.509151 | false | false | false |
ksmit799/Toontown-Source | toontown/hood/ToonHood.py | 2 | 8072 | from pandac.PandaModules import *
from toontown.toonbase.ToonBaseGlobal import *
from toontown.toonbase.ToontownGlobals import *
from toontown.distributed.ToontownMsgTypes import *
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from toontown.mini... | mit | 7,618,767,279,221,161,000 | 40.823834 | 171 | 0.669722 | false | 3.718102 | false | false | false |
tarikkdiry/Flock | flask/lib/python2.7/site-packages/coverage/execfile.py | 9 | 9700 | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""Execute files of Python code."""
import marshal
import os
import sys
import types
from coverage.backward import BUILTINS
from coverage.backward import PYC_MAGI... | bsd-3-clause | -7,140,731,525,824,997,000 | 35.603774 | 97 | 0.579381 | false | 4.157737 | false | false | false |
live-clones/luatex | source/libs/zziplib/zziplib-src/docs/cpp2markdown.py | 1 | 7930 | from __future__ import print_function
import pygments.lexers.compiled as lexer
import optparse
import re
from pygments.token import Token
import logging
logg = logging.getLogger(__name__)
FileComment = "FileComment"
FileInclude = "FileInclude"
FunctionComment = "FunctionComment"
FunctionPrototype = "FunctionPrototyp... | gpl-2.0 | -8,281,590,406,727,388,000 | 39.253807 | 82 | 0.499496 | false | 4.211365 | false | false | false |
eustislab/horton | doc/update_basis.py | 1 | 1692 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2015 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licens... | gpl-3.0 | -6,661,099,415,402,221,000 | 33.530612 | 76 | 0.677896 | false | 3.474333 | false | false | false |
mudler/entropy | client/solo/commands/download.py | 5 | 5987 | # -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Command Line Client}.
"""
import os
import sys
import argparse
from entropy.i18n import _
from entropy.output import darkred, darkgreen, blue... | gpl-2.0 | 4,152,298,268,623,174,700 | 29.085427 | 72 | 0.537498 | false | 4.201404 | false | false | false |
Cindicator/CindicatorArbitrageBot | ArbitrageBot.py | 1 | 9534 | # -*- coding: utf-8 -*-
"""
Copyright 2017 Evgeniy Koltsov, Sergey Zhirnov.
This file is part of CindicatorArbitrageBot.
CindicatorArbitrageBot is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of... | gpl-3.0 | 2,638,614,555,977,146,400 | 50.275676 | 122 | 0.492937 | false | 4.609329 | true | false | false |
ggabriel96/cfg_analyzer | NDFA.py | 1 | 8206 | from DFA import *
from const import *
from GrammarError import *
from collections import OrderedDict
class NDFA():
def __init__(self):
# the first-level array holds the states (lines of table)
# each position in it holds an OrderedDict, which maps
# a char to destination states (an array)
... | unlicense | 7,574,148,155,950,767,000 | 43.597826 | 115 | 0.423714 | false | 4.85275 | false | false | false |
FescueFungiShare/hydroshare | hs_tools_resource/receivers.py | 2 | 2249 | from django.dispatch import receiver
from hs_core.signals import pre_metadata_element_create, pre_metadata_element_update, \
pre_create_resource
from hs_tools_resource.models import ToolResource
from hs_tools_resource.forms import SupportedResTypesValidationForm, VersionForm, \
... | bsd-3-clause | 8,834,255,420,321,286,000 | 41.433962 | 92 | 0.687861 | false | 4.016071 | false | false | false |
b-mueller/mythril | mythril/analysis/traceexplore.py | 1 | 4569 | """This module provides a function to convert a state space into a set of state
nodes and transition edges."""
from z3 import Z3Exception
from mythril.laser.smt import simplify
from mythril.laser.ethereum.svm import NodeFlags
import re
colors = [
{
"border": "#26996f",
"background": "#2f7e5b",
... | mit | 2,000,883,587,573,905,400 | 27.55625 | 86 | 0.481944 | false | 3.634845 | false | false | false |
ash-ishh/torrentXtractor | main.py | 1 | 6673 | #!/usr/bin/env python3
# Author: Ash-Ishh..
# <mr.akc@outlook.com>
# Modules Required:
# requests
# pip install requests
# beautifulSoup4: https://pypi.python.org/pypi/beautifulsoup4/4.3.2
# pip install BeautifulSoup4
import requests
from bs4 import BeautifulSoup
import re
import sys,os
import webbrowser
#import sl4a... | gpl-3.0 | -8,914,733,517,343,934,000 | 32.532663 | 197 | 0.549078 | false | 3.504727 | false | false | false |
joker2594/sas-challenge | police/analyse_data.py | 1 | 4049 | import json
import pandas as pd
from pandas import DataFrame
import os
import operator
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
related_events_path = os.path.join(BASE_DIR, 'police/related_events.txt')
city_event_path = os.path.join(BASE_DIR, 'police/CityEvents.txt')
related_events = js... | gpl-2.0 | -8,012,809,170,795,110,000 | 32.188525 | 127 | 0.609286 | false | 3.362957 | false | false | false |
pfeyz/django-inplaceedit | inplaceeditform/commons.py | 10 | 4354 | # -*- coding: utf-8 -*-
from django import template
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.db.models.fields.related import ForeignKey, ManyToManyField
from django.conf import settings
from inplaceeditform.adaptors import ADAPTOR_INPLACEEDIT as DEFAULT_ADAPTOR_INP... | lgpl-3.0 | -4,077,086,167,039,411,700 | 36.213675 | 130 | 0.614378 | false | 3.815951 | false | false | false |
flv0/museek-plus | mucous/pymucous/MucousTransfers.py | 2 | 32451 | # This is part of the Mucous Museek Client, and distributed under the GPLv2
# Copyright (c) 2006 daelstorm.
import os
import curses.wrapper
## Transfers (Uploads and Downloads)
#
class Transfers:
## Constructor
# @param self Transfers (class)
# @param mucous Mucous (class)
def __init__(self, mucous):
## @var mu... | gpl-2.0 | -6,117,079,542,931,661,000 | 32.489164 | 251 | 0.62485 | false | 2.863408 | false | false | false |
hotdoc/hotdoc | hotdoc/extensions/gi/languages/c.py | 1 | 2676 | # -*- coding: utf-8 -*-
#
# Copyright 2019 Collabora Ltd
#
# This library is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# ... | lgpl-2.1 | 22,706,346,766,115,004 | 35.657534 | 117 | 0.65994 | false | 3.779661 | false | false | false |
robclark/chromium | tools/isolate/read_trace.py | 1 | 2262 | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Reads a trace. Mostly for testing."""
import logging
import optparse
import os
import sys
import trace_inputs
BASE_DIR = os.p... | bsd-3-clause | 4,583,128,759,867,189,000 | 29.567568 | 79 | 0.652962 | false | 3.607656 | false | false | false |
janmedlock/HIV-95-vaccine | model/ODEs.py | 1 | 9735 | '''
ODEs representing the HIV model.
'''
import warnings
import numpy
from scipy import integrate
import pandas
from . import control_rates
variables = (
'susceptible', # S
'vaccinated', # Q
'acute', # A
'undiagnosed', # U
'diagnosed', # D
'treate... | agpl-3.0 | -3,704,828,191,271,420,000 | 31.45 | 79 | 0.561685 | false | 3.261307 | false | false | false |
awacha/cct | cct/core/utils/callback.py | 1 | 8281 | import gc
import itertools
import logging
import traceback
from typing import Callable, Optional
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class SignalFlags(object):
RUN_FIRST = 1
RUN_LAST = 2
RUN_CLEANUP = 4
NO_RECURSE = 8
DETAILED = 16
ACTION = 32
NO_HOOKS = 64
... | bsd-3-clause | -6,933,174,988,752,020,000 | 39.99505 | 120 | 0.574206 | false | 4.490781 | false | false | false |
kichkasch/pisi | modules/generic_remote.py | 1 | 3010 | """
Abstract class for providing remote features (download, upload) for file based modules
This file is part of Pisi.
Only HTTP (Webdav) is supported.
Urllib2 (read, D{http://www.python.org/doc/2.5/lib/module-urllib2.html}) and Pythonwebdavlib (write, D{http://sourceforge.net/projects/pythonwebdavlib} are used for i... | gpl-3.0 | 811,700,740,481,336,000 | 33.204545 | 181 | 0.654153 | false | 4.306152 | false | false | false |
Anton04/IoT-kit | IoTtoolkit.py | 1 | 13675 | #!/bin/python
from pubsub import pub
import json
import mosquitto
from InfluxDBInterface import InfluxDBInterface
import pandas as pd
import uuid
from IoT_sources import *
from Universe import *
#///////////////
class FeedBuffer():
def __init__(self,Feed,Size,AutoDecompress=True):
self.Feed = Feed
... | mit | -2,129,965,856,565,422,000 | 23.246454 | 180 | 0.651335 | false | 3.767218 | false | false | false |
Acrisel/projenv | environ/setup.py | 1 | 4909 | import os
import sys
from setuptools import setup
from distutils.sysconfig import get_python_lib
'''
is the Python package in your project. It's the top-level folder containing the
__init__.py module that should be in the same directory as your setup.py file
/-
|- README.rst
|- CHANGES.txt
|- setup.py
|- do... | mit | 7,544,092,625,894,447,000 | 33.787234 | 92 | 0.655454 | false | 3.902148 | false | false | false |
kerbrose/odoo-playground | open_academy/models/res_partner.py | 1 | 1195 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2017 All Rights Reserved
#
# Created on Feb 19, 2017
#
# @author: kerbrose (Khaled Said)
# @contact: kerbrose ==> hotmail ==> com
#####################################
from odoo import api, models, fields
class ResPartner(models.Model):
_inherit = 'res.partner'
_ord... | gpl-3.0 | 1,137,619,265,673,531,100 | 30.447368 | 86 | 0.469456 | false | 4.283154 | false | false | false |
alviproject/alvi | alvi/client/scenes/binary_search_tree.py | 1 | 1035 | import random
from . import base
import alvi.containers
class BinarySearchTree(base.Scene):
def run(self, **kwargs):
data_generator = kwargs['data_generator']
tree = kwargs['container']
#create root
tree.create_root(next(data_generator.values))
tree.sync()
#creat... | mit | 5,221,543,558,289,512,000 | 24.268293 | 53 | 0.562319 | false | 4.461207 | false | false | false |
Naeka/vosae-app | www/core/pdf/utils.py | 1 | 3367 | # -*- coding:Utf-8 -*-
from django.conf import settings
from reportlab.platypus import (
BaseDocTemplate,
PageBreak,
Paragraph as _Paragraph
)
__all__ = (
'Paragraph',
'RestartPageBreak',
'ReportingDocTemplate',
)
def sanitize(text):
"""
Replace interpreted chars.
"""
REPLAC... | agpl-3.0 | 4,756,420,536,198,973,000 | 27.058333 | 141 | 0.611821 | false | 3.942623 | false | false | false |
tpow/pytds | src/pytds/login.py | 1 | 5067 | # vim: set fileencoding=utf8 :
"""
.. module:: login
:platform: Unix, Windows, MacOSX
:synopsis: Login classes
.. moduleauthor:: Mikhail Denisenko <denisenkom@gmail.com>
"""
import socket
import logging
logger = logging.getLogger(__name__)
class SspiAuth(object):
""" SSPI authentication
:platform: Wi... | mit | -2,869,302,704,537,988,600 | 33.469388 | 105 | 0.585948 | false | 3.888718 | false | false | false |
martyni/amazon | amazon_client.py | 1 | 2231 | import os
import boto3
import string
import random
import datetime
from pprint import pprint
from fabric.api import local
if 'martyn' in os.environ.get('VIRTUAL_ENV', ''):
boto3 = boto3.Session(profile_name='martyn', region_name='eu-west-1')
def random_str(size=6, chars=string.ascii_lowercase):
return ''.joi... | mit | -5,308,934,360,453,444,000 | 27.974026 | 133 | 0.576871 | false | 3.6042 | false | false | false |
MarkuNauma2/Markus | py/openage/convert/stringresource.py | 46 | 1211 | from collections import defaultdict
from . import dataformat
from .util import dbg
class StringResource(dataformat.Exportable):
name_struct = "string_resource"
name_struct_file = "string_resource"
struct_description = "string id/language to text mapping, extracted from language.dll file."
dat... | gpl-3.0 | 5,750,467,361,484,456,000 | 29.275 | 96 | 0.562345 | false | 4.091216 | false | false | false |
mykoch/rs232-obd-sim | lib/utils.py | 6 | 2017 | import random
import string
def debug(msg):
pass #print('-- ' + msg)
def sample(var):
if var == 'VSS':
self = hex (int(random.randrange(40,90)))[2:].upper()
elif var == 'RPM':
self = hex (int(random.randrange(750,4500)))[2:].upper()
else:
self = hex (int(random.ran... | gpl-3.0 | 1,021,832,634,560,720,100 | 26.408451 | 64 | 0.466039 | false | 3.285016 | false | false | false |
levilucio/SyVOLT | ExFamToPerson/transformation/no_contains/HcopersonsSolveRefCountryFamilyParentCommunityWoman.py | 1 | 4189 | from core.himesis import Himesis
import uuid
class HcopersonsSolveRefCountryFamilyParentCommunityWoman(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule copersonsSolveRefCountryFamilyParentCommunityWoman.
"""
# Flag this instance a... | mit | 4,637,497,514,006,169,000 | 35.112069 | 164 | 0.513249 | false | 3.966856 | false | false | false |
afmurillo/ICS-SDN | nids/pyonos.py | 1 | 18375 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=C0103
'''
ONOS Core REST API python client module
BASE URL: /onos/v1 , API VERSION: 1.0
'''
import json
import re
import requests
class ONOSClient():
'''
REST API client interface.
Currently only works using the default URI based on the IPv... | apache-2.0 | -3,377,835,960,899,985,400 | 46.727273 | 129 | 0.621061 | false | 4.060773 | false | false | false |
DMPwerkzeug/DMPwerkzeug | rdmo/options/serializers/v1.py | 1 | 2251 | from rest_framework import serializers
from rdmo.core.serializers import TranslationSerializerMixin
from rdmo.core.utils import get_language_warning
from ..models import OptionSet, Option
from ..validators import OptionSetUniqueKeyValidator, OptionUniquePathValidator
class OptionSetSerializer(serializers.ModelSeria... | apache-2.0 | -7,622,227,058,600,988,000 | 21.51 | 99 | 0.56908 | false | 4.779193 | false | false | false |
czapiga/mimiker | debug/ctx.py | 1 | 1204 | import gdb
import ptable
from collections import OrderedDict
class Context(object):
names = ['at', 'v0', 'v1', 'a0', 'a1', 'a2', 'a3',
't0', 't1', 't2', 't3', 't4', 't5', 't6', 't7',
's0', 's1', 's2', 's3', 's4', 's5', 's6', 's7',
't8', 't9', 'gp', 'sp', 's8', 'ra',
... | bsd-3-clause | 1,018,757,556,769,054,500 | 29.871795 | 69 | 0.4701 | false | 3.040404 | false | false | false |
bleedingwolf/Spyglass | spyglass/backend.py | 1 | 2154 |
import socket
import datetime
from urlparse import urlparse
import time
from celery.decorators import task
from celery.result import AsyncResult
from spyglass.models import format_request, HttpRedirect, HttpSession
from spyglass.http import HttpRequestor
def session_is_ready(session):
result = AsyncResult(sess... | bsd-3-clause | -2,791,218,594,253,155,300 | 32.138462 | 97 | 0.635097 | false | 4.342742 | false | false | false |
Prakti/striptease | striptease/bitfield.py | 1 | 1079 | # -*- coding: utf-8 -*-
"""
striptease.bitfield
~~~~~~~~~~~~~~~~~~~
Bitfield encoding support for striptease.
..warning:: has the bitstring library as dependency
"""
from bitstring import BitString
class Bitfield(Token):
def __init__(self, name, bytecount):
Token.__init__(self)
... | bsd-3-clause | -1,513,411,599,367,025,700 | 26.666667 | 77 | 0.569045 | false | 4.041199 | false | false | false |
riga/law | examples/docker_sandboxes/tasks.py | 1 | 1691 | # coding: utf-8
"""
Example showing docker sandboxing.
Example status: review
"""
import os
from random import random
import luigi
import law
law.contrib.load("docker")
luigi.namespace("example.docker")
class CreateNumbers(law.SandboxTask):
n_nums = luigi.IntParameter(default=100, description="amount of r... | bsd-3-clause | 1,414,123,161,310,464,300 | 23.507246 | 100 | 0.596097 | false | 3.458078 | false | false | false |
RaspberryPiFi/CloudCode | handlers/settings.py | 1 | 2773 | """settings.py: Handles requests related to the settings page"""
__author__ = "Tom Hanson"
__copyright__ = "Copyright 2014"
__credits__ = ["Tom Hanson"]
__license__ = "GPL"
__maintainer__ = "Tom Hanson"
__email__ = "tom@aporcupine.com"
from google.appengine.api import users, memcache
from google.appengine.ext import... | gpl-2.0 | -606,257,114,032,218,400 | 31.635294 | 74 | 0.654886 | false | 3.667989 | false | false | false |
rauljim/power-pcap-analyzer | many_cdf_power.py | 1 | 1959 | from matplotlib import pyplot
import csv
import os
POWER_FREQ = 5
output_filename = 'many_power_cdf.png'
EXPERIMENT_LABEL_TIMESTAMPS = (
('wifi baseline (304)', '201306201525', 'k:'),#131430'),
('wifi leecher (326)', '201306201300', 'k--'),#191050'),
('wifi peer (333)', '201306201415', 'k-'),#... | apache-2.0 | 6,389,393,861,565,892,000 | 31.114754 | 75 | 0.601327 | false | 3.149518 | false | false | false |
istommao/codingcatweb | server/info/models.py | 1 | 2404 | """info models."""
from django.db import models
from simditor.fields import RichTextField
from extensions.modelutils import RandomFixedCharField, PathAndRename
from info import consts
class Column(models.Model):
"""Column Model."""
uid = RandomFixedCharField('编号', max_length=8, unique=True)
image = mod... | mit | 1,256,636,951,550,674,400 | 26.325301 | 69 | 0.615961 | false | 3.462595 | false | false | false |
trhongbinwang/data_science_journey | deep_learning/tensorflow/tutorials/tutorial1/06_autoencoder.py | 1 | 2866 | import tensorflow as tf
import numpy as np
import input_data
# hyperparameters
mnist_width = 28
n_visible = mnist_width * mnist_width
n_hidden = 500
corruption_level = 0.3
def inputs_placeholder():
# create node for input data
X = tf.placeholder("float", [None, n_visible], name='X')
# create no... | apache-2.0 | 5,131,178,509,758,008,000 | 29.168421 | 101 | 0.585136 | false | 3.125409 | false | false | false |
alexryndin/ambari | ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/status_params.py | 4 | 1772 | #!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... | apache-2.0 | -1,988,901,467,128,981,200 | 48.25 | 130 | 0.805869 | false | 3.920354 | false | false | false |
Titulacion-Sistemas/PythonTitulacion-EV | Lib/site-packages/pylint/checkers/utils.py | 2 | 18083 | # pylint: disable=W0611
#
# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either v... | mit | -1,339,050,061,648,341,800 | 35.093812 | 98 | 0.576398 | false | 4.348966 | false | false | false |
jonathanmorgan/django_reference_data | migrations/0004_auto__add_postal_code.py | 1 | 6695 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Postal_Code'
db.create_table(u'django_reference_data_postal_code', (
(u'id', sel... | gpl-3.0 | -377,816,539,611,731,460 | 79.674699 | 131 | 0.575653 | false | 3.421053 | false | false | false |
pybel/pybel-tools | src/pybel_tools/document_utils.py | 1 | 6764 | # -*- coding: utf-8 -*-
"""Utilities to merge multiple BEL documents on the same topic."""
import logging
from typing import Iterable, Mapping, Optional, Set, TextIO, Union
from xml.etree import ElementTree
import pandas as pd
import requests
from bel_resources import make_knowledge_header
from pybel.utils import e... | mit | 8,326,133,659,989,210,000 | 36.787709 | 117 | 0.66026 | false | 3.632653 | false | false | false |
wpjesus/codematch | ietf/sync/views.py | 1 | 6049 | import datetime
import subprocess
import os
import json
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseServerError, HttpResponseRedirect, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.conf import settings
from django.contrib.aut... | bsd-3-clause | 8,173,850,242,559,690,000 | 39.059603 | 133 | 0.61597 | false | 4.253868 | false | false | false |
noahfx/lobster | lobster/audio.py | 1 | 4819 | import subprocess
from pydub import AudioSegment
from .filemanager import get_workingdir, get_album_dir
class StreamSegment(object):
def __init__(self, name, position, initial_time=None, end_time=None):
self.name = name
self.position = position
self.initial_time = initial_time
self... | mit | 4,071,389,534,527,602,700 | 42.026786 | 86 | 0.596597 | false | 3.628765 | false | false | false |
geky/pyDAPLink | pyDAPLink/server/transport.py | 1 | 7317 | """
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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
Unless required by applicable ... | apache-2.0 | 6,010,114,878,765,228,000 | 25.415162 | 75 | 0.581112 | false | 4.035852 | false | false | false |
pchandramouli/python-tictactoe | tictactoe.py | 1 | 4428 | from random import randint
import sys
board = [
[' ',' ',' '],
[' ',' ',' '],
[' ',' ',' ']
]
def draw_box_sample():
box_sample = '''
|---|---|---|
| | | |
|---|---|---|
| | | |
|---|---|---|
| | | |
|---|---|---|
'''
return box_sample
def user_coin(user='c')... | mit | 887,147,458,272,124,500 | 26.503106 | 132 | 0.537489 | false | 3.17192 | false | false | false |
vilisimo/ads | python/algorithms/searching/test/test_linear.py | 1 | 1923 | import unittest
from algorithms.searching.linear import search
from helpers.contrived import Contrived
class TestLinearSearch(unittest.TestCase):
def test_invalid_collection(self):
with self.assertRaises(TypeError):
search(collection=None, target=1)
def test_invalid_element(self):
... | mit | -2,799,009,881,654,739,000 | 25.708333 | 73 | 0.610504 | false | 3.669847 | true | false | false |
MobileWebApps/backend-python-rest-gae | settings.py | 1 | 2552 | # Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
import os
#Add ./lib and ./apps directories to PYTHONPATH
import sys
PROJECT_ROOT = os.path.dirname(__file__)
sys.path.insert(0... | bsd-3-clause | -1,767,086,716,059,037,200 | 29.023529 | 83 | 0.721787 | false | 3.589311 | false | false | false |
tysonclugg/django | tests/backends/base/test_base.py | 12 | 1377 | from django.db import DEFAULT_DB_ALIAS, connection, connections
from django.db.backends.base.base import BaseDatabaseWrapper
from django.test import SimpleTestCase
class DatabaseWrapperTests(SimpleTestCase):
def test_initialization_class_attributes(self):
"""
The "initialization" class attributes... | bsd-3-clause | 8,992,849,065,648,507,000 | 42.03125 | 72 | 0.6565 | false | 4.559603 | true | false | false |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/debug_toolbar/panels/cache.py | 1 | 6698 | from __future__ import absolute_import, unicode_literals
import inspect
import sys
import time
from django.conf import settings
from django.core import cache
from django.core.cache import cache as original_cache, get_cache as original_get_cache
from django.core.cache.backends.base import BaseCache
from django.dispatc... | agpl-3.0 | 507,762,876,957,642,500 | 30.153488 | 86 | 0.562407 | false | 3.93537 | false | false | false |
michaupl/wordtester | src/ui/ui_TestDialog.py | 1 | 7521 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'TestDialog.ui'
#
# Created: Tue Apr 5 23:35:30 2011
# by: PyQt4 UI code generator 4.7.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_testDialog(object):
def setupUi(self, testD... | apache-2.0 | -6,075,857,453,616,469,000 | 57.757813 | 138 | 0.744582 | false | 4.241963 | true | false | false |
jteehan/cfme_tests | cfme/web_ui/form_buttons.py | 2 | 7512 | """This module unifies working with CRUD form buttons.
Whenever you use Add, Save, Cancel, Reset button, use this module.
You can use it also for the other buttons with same shape like those CRUD ones.
"""
from selenium.common.exceptions import NoSuchElementException
from xml.sax.saxutils import quoteattr
from widget... | gpl-2.0 | -3,652,114,185,650,259,000 | 40.274725 | 99 | 0.585064 | false | 3.820956 | false | false | false |
clsb/miles | miles/dihedrals.py | 1 | 1949 | """Compute different kinds of dihedral angles.
"""
__all__ = ['compute_chi', 'compute_pseudo_rotation', 'compute_dihedral', 'compute_dihedrals'] # noqa: E501
import numpy as np
SIN_ALPHA1 = np.sin(np.deg2rad(36.0))
SIN_ALPHA2 = np.sin(np.deg2rad(72.0))
def compute_dihedral(xyz, indices):
"""Compute a dihed... | mit | -7,694,937,939,231,204,000 | 28.089552 | 107 | 0.571062 | false | 2.433208 | false | false | false |
laurentb/weboob | modules/sogecartenet/pages.py | 1 | 6833 | # -*- coding: utf-8 -*-
# Copyright(C) 2015 Budget Insight
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | lgpl-3.0 | 627,964,631,692,131,200 | 40.560976 | 158 | 0.634243 | false | 3.648822 | false | false | false |
darkpudding/Projet-Fractal | ArnoldCat.py | 1 | 2028 | import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy
from matplotlib import animation
import random as rdm
class ArnoldCat:
def __init__(self, N, lien = None, image = None, p=1, q=1):
self.N = N
self.p = p
self.q = q
if image != None:
self.imgOr... | mit | -243,394,884,904,344,260 | 30.6875 | 141 | 0.529093 | false | 3.533101 | false | false | false |
grnet/snf-vncauthproxy | vncauthproxy/proxy.py | 1 | 36634 | #!/usr/bin/env python
"""
vncauthproxy - a VNC authentication proxy
"""
#
# Copyright (c) 2010-2014 Greek Research and Technology Network S.A.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; e... | gpl-2.0 | 2,477,839,600,628,035,600 | 36.573333 | 79 | 0.542529 | false | 4.450194 | false | false | false |
CondensedOtters/PHYSIX_Utils | Projects/Heu_2019/Zundel-BPNN/classification.py | 1 | 1200 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 2 11:30:57 2019
@author: julienh
"""
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import... | gpl-3.0 | 4,847,126,677,143,866,000 | 31.388889 | 83 | 0.690833 | false | 3.870968 | false | false | false |
castelao/maud | maud/tests_support.py | 1 | 2817 | import numpy as np
from numpy import ma
from numpy.random import random
def inputsizes_f2D(f):
l = 3
# 1D input
#x = np.arange(10)
#y = x
#z = random(x.shape)
#h = wmean_2D(x, y, z, l)
# 2D input
x = np.arange(10)
y = np.arange(3)
X, Y = np.meshgrid(x, y)
Z = random(X.sha... | bsd-3-clause | 237,411,309,089,989 | 22.475 | 64 | 0.543486 | false | 2.64507 | false | false | false |
alvason/probability-insighter | code/poisson_random_distribution.py | 1 | 6195 |
# coding: utf-8
# # Probability-insighter
# https://github.com/alvason/probability-insighter
#
# ### Poisson random distribution
# In[1]:
'''
author: Alvason Zhenhua Li
date: 03/19/2015
'''
get_ipython().magic(u'matplotlib inline')
import numpy as np
import matplotlib.pyplot as plt
import os
dir_path = '/User... | gpl-2.0 | 3,734,770,866,108,930,000 | 30.287879 | 139 | 0.65569 | false | 2.657658 | false | false | false |
gbossert/pylstar | src/pylstar/KnowledgeBase.py | 1 | 5846 | # -*- coding: utf-8 -*-
# +---------------------------------------------------------------------------+
# | pylstar : Implementation of the LSTAR Grammatical Inference Algorithm |
# +---------------------------------------------------------------------------+
# | Copyright (C) 2015 Georges Bossert ... | gpl-3.0 | 2,142,996,939,336,065,000 | 38.5 | 96 | 0.514369 | false | 4.356185 | false | false | false |
andmatand/midi-to-pico8 | pico8/music/music.py | 1 | 5922 | """The music (song) region of a Pico-8 cart.
The music region consists of 256 bytes. The .p8 representation is one
line for each of 64 patterns, with a hex-encoded flags byte, a space,
and four hex-encoded one-byte sound numbers.
The flags are:
1: begin pattern loop
2: end pattern loop
4: stop at end of pattern
T... | mit | -7,106,462,838,977,822,000 | 33.631579 | 80 | 0.542553 | false | 3.69202 | false | false | false |
7Puentes/Amazon | train.py | 1 | 5574 | import os
import datetime , time
import amazon
from log import LoggerHook
from settings import *
import tensorflow as tf
def _generate_image_and_label_batch(image, label, min_queue_examples,
batch_size, shuffle):
"""Construct a queued batch of images and labels.
Args:
ima... | apache-2.0 | 1,279,824,825,036,696,600 | 34.056604 | 148 | 0.680481 | false | 3.589182 | false | false | false |
openstate/yournextrepresentative | candidates/management/commands/candidates_recreate_memberships.py | 2 | 1555 | # From (I believe) historical bugs, some candidates are missing PopIt
# memberships. This command will recreate them based on their
# standing_in and party_memberships data.
#
# e.g. ./manage.py candidates_recreate_memberships 2825 3411
from django.core.management.base import BaseCommand, CommandError
from candida... | agpl-3.0 | 6,073,894,675,731,748,000 | 43.428571 | 78 | 0.685531 | false | 4.070681 | false | false | false |
imperial-genomics-facility/data-management-python | ehive/runnable/process/alignment/RunFeatureCounts.py | 1 | 4008 | import os,json
from ehive.runnable.IGFBaseProcess import IGFBaseProcess
from igf_data.utils.tools.subread_utils import run_featureCounts
from igf_data.utils.fileutils import get_datestamp_label
from igf_data.utils.tools.reference_genome_utils import Reference_genome_utils
class RunFeatureCounts(IGFBaseProcess):
def ... | apache-2.0 | 7,440,437,719,108,915,000 | 37.92233 | 115 | 0.576098 | false | 3.799052 | false | false | false |
LeetCodeGroup/PythonDescription | 98.ValidateBinarySearchTree.py | 1 | 1482 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isValidBST(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
... | mit | 4,804,099,964,362,487,000 | 36 | 114 | 0.527665 | false | 3.641278 | false | false | false |
qiyeboy/SpiderBook | ch07/SpiderNode/SpiderWork.py | 1 | 2073 | #coding:utf-8
from multiprocessing.managers import BaseManager
from .HtmlDownloader import HtmlDownloader
from .HtmlParser import HtmlParser
class SpiderWork(object):
def __init__(self):
#初始化分布式进程中的工作节点的连接工作
# 实现第一步:使用BaseManager注册获取Queue的方法名称
BaseManager.register('get_task_queue')
... | mit | -7,861,401,162,812,202,000 | 31 | 90 | 0.526521 | false | 2.705438 | false | false | false |
chrislawlor/recommendr | recommendr/__init__.py | 1 | 3922 | __version__ = '0.0.1'
"""
Functions for performing similarity calculations.
"""
import sys
from eventlet import GreenPool
from .similarity import sim_pearson, sim_distance
from .db import RedisBackend
from .config import REDIS_HOST, REDIS_PORT, REDIS_DB
db = RedisBackend(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_... | bsd-3-clause | -8,391,727,787,966,021,000 | 31.147541 | 91 | 0.653748 | false | 3.661998 | false | false | false |
tjcsl/cslbot-tjhsst | cslbot-tjhsst/commands/brain.py | 1 | 1699 | # -*- coding: utf-8 -*-
# Copyright (C) 2013-2018 Tris Wilson, Peter Foley, Srijay Kasturi, Samuel Damashek, James Forcier and Reed Koser
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either... | gpl-2.0 | -4,867,059,680,030,479,000 | 35.148936 | 126 | 0.689229 | false | 3.539583 | false | false | false |
googlegenomics/cloudml-examples | trainer/util.py | 1 | 2296 | #!/usr/bin/python
# Copyright 2016 Google Inc.
#
# 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
#
# Unless required by applicable law or agre... | apache-2.0 | 5,249,225,032,412,544,000 | 29.210526 | 78 | 0.738676 | false | 4.035149 | false | false | false |
darth-dodo/what_2_watch | reddit_to_csv.py | 1 | 1094 | import pprint
import praw
import datetime
import csv
def sub2csv(sub_name,num_posts=20):
agent = praw.Reddit('url scraper by /u/Chutta')
subreddit_name = sub_name
num_posts = int(num_posts)
title = []
links = []
for submission in agent.get_subreddit(subreddit_name).get_top_from_all(limit=num_... | mit | 3,443,437,557,411,463,000 | 27.051282 | 92 | 0.573126 | false | 3.540453 | false | false | false |
pytorch/fairseq | fairseq/optim/__init__.py | 1 | 1552 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""isort:skip_file"""
import importlib
import os
from fairseq import registry
from fairseq.optim.bmuf import FairseqBMUF # noqa
from fairseq... | mit | 7,435,211,920,560,642,000 | 31.333333 | 86 | 0.721649 | false | 3.45657 | false | false | false |
DS-100/sp17-materials | sp17/labs/lab14/mnist_viz.py | 1 | 9637 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import tensorflow as tf
import math
###################################################################
# Some functions for visualizing images and filters in the MNIST
# dataset. (As usual, visualization code is long and in... | gpl-3.0 | -2,239,939,359,334,668,500 | 40.183761 | 135 | 0.624883 | false | 3.545622 | false | false | false |
Sarah-Alsinan/muypicky | lib/python3.6/site-packages/gunicorn/arbiter.py | 13 | 19974 | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from __future__ import print_function
import errno
import os
import random
import select
import signal
import sys
import time
import traceback
from gunicorn.errors import HaltServer, AppImpor... | mit | 2,879,693,332,261,853,000 | 30.160686 | 78 | 0.525984 | false | 4.074663 | false | false | false |
ResolveWang/algrithm_qa | stackandqueue/q6.py | 1 | 3514 | """
问题描述:汉诺塔问题比较经典,现在修改一下规则:现在限制不能从最左侧的塔直接移动到最右侧,
也不能从最右侧直接移动到最左侧,而必须经过中间,求当塔有N层的时候,打印最优移动过程和最优
移动总步数。比如N=2,则打印:
move 1 from left to mid
move 1 from mid to right
move 2 from left to mid
move 1 from right to mid
move 1 from mid to left
move 2 from mid to right
move 1 from left to mid
move 1 from mid to right
it will mov... | mit | 2,538,083,462,742,116,400 | 24.677686 | 103 | 0.566323 | false | 2.4749 | false | false | false |
mitshell/libmich | libmich/asn1/BER.py | 1 | 41732 | # -*- coding: UTF-8 -*-
#/**
# * Software Name : libmich
# * Version : 0.2.3
# *
# * Copyright © 2015. Benoit Michau. ANSSI.
# *
# * This program is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License version 2 as published
# * by the Free Software Foundation. ... | gpl-2.0 | -4,244,149,216,065,239,600 | 37.356618 | 81 | 0.439734 | false | 3.965036 | false | false | false |
pemami4911/POMDPy | pomdpy/solvers/pomcp.py | 1 | 4810 | from __future__ import absolute_import
from __future__ import division
from builtins import range
from past.utils import old_div
import time
import numpy as np
from pomdpy.util import console
from pomdpy.action_selection import ucb_action
from .belief_tree_solver import BeliefTreeSolver
module = "pomcp"
class POMCP(... | mit | 2,035,006,978,067,384,300 | 34.109489 | 118 | 0.605405 | false | 3.573551 | false | false | false |
sassoftware/mint | mint/db/users.py | 1 | 6730 | #
# Copyright (c) SAS Institute Inc.
#
# 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
#
# Unless required by applicable law or agreed to in w... | apache-2.0 | -8,139,187,457,663,006,000 | 33.336735 | 79 | 0.549629 | false | 4.504685 | false | false | false |
3dfxsoftware/cbss-addons | mrp_webkit_report_wizard/wizard/wizard_report_variation.py | 1 | 8831 | # -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
####################################... | gpl-2.0 | -3,842,774,708,718,732,300 | 42.289216 | 109 | 0.532103 | false | 4.270309 | false | false | false |
suvit/speedydeploy | speedydeploy/monitoring.py | 1 | 1040 |
from .base import ObjectWithCommand
# TODO inherit daemon
class NewRelic(ObjectWithCommand):
namespace = 'newrelicd'
license_key = None
@command
def install(self):
# XXX for Debian only
fab.sudo('wget -O /etc/apt/sources.list.d/newrelic.list http://download.newrelic.com/d... | mit | -6,534,276,778,594,206,000 | 24.365854 | 115 | 0.654808 | false | 3.291139 | false | false | false |
emencia/dr-dump | setup.py | 1 | 1260 | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='dr-dump',
version=__import__('drdump').__version__,
description=__import__('drdump').__doc__,
long_description=open('README.rst').read(),
long_description_content_type="text/x-rst",
author='David Thenon',
aut... | mit | -4,698,904,179,942,077,000 | 31.307692 | 71 | 0.584921 | false | 4.131148 | false | true | false |
probml/pyprobml | scripts/kf_spiral_demo.py | 1 | 2142 | # This demo exemplifies the use of the Kalman Filter
# algorithm when the linear dynamical system induced by the
# matrix A has imaginary eigenvalues
# Author: Gerardo Durán-Martín (@gerdm)
import jax.numpy as jnp
import lds_lib as lds
import matplotlib.pyplot as plt
import pyprobml_utils as pml
from jax import random... | mit | -4,634,577,093,573,902,000 | 30.485294 | 100 | 0.587383 | false | 2.772021 | false | false | false |
llfccc/weekly | weekly/analysis/viewsSale.py | 1 | 4083 | # -*- coding: utf-8 -*-
import os
import json
import re
import StringIO
import pandas as pd
import datetime
from collections import defaultdict
from django.views.generic import View
from django.db.models import Q
from django.http import HttpResponse, FileResponse, Http404
from django.core.cache import cache
from api.mo... | apache-2.0 | -7,475,932,145,461,026,000 | 37.398058 | 207 | 0.66043 | false | 3.436142 | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.