text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'anthonyfullam'
import sys
import argparse
import pandas as pd
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=('''\
Takes ASCAT output file and modifies it to add an event descriptor
'''))
parser.add_argument('-f', '--ASCATfile', h... | {
"repo_name": "fullama/Tools",
"path": "add_cytoband_to_ascat.py",
"copies": "1",
"size": "2776",
"license": "mit",
"hash": -159375459585933120,
"line_mean": 32.8536585366,
"line_max": 107,
"alpha_frac": 0.5576368876,
"autogenerated": false,
"ratio": 3.4271604938271607,
"config_test": false,
... |
__author__ = 'Anthony Mansour'
import urllib.request
import smtplib
import getpass
from time import asctime, sleep
def find_between(s, first, last): # Returns substring with in 's' using 'first' and 'last' as string bounds
try:
start = s.index(first) + len(first)
end = s.index(last, start)
... | {
"repo_name": "Tontiwisk/kijiji_alert",
"path": "kijiji_alert.py",
"copies": "1",
"size": "3379",
"license": "mit",
"hash": 5635426562814232000,
"line_mean": 32.1274509804,
"line_max": 117,
"alpha_frac": 0.5794613791,
"autogenerated": false,
"ratio": 3.0062277580071175,
"config_test": false,
... |
__author__ = 'anthony <>'
from collections import OrderedDict
from django import forms
class FormOrderMixin(object):
def order_fields(self, field_order):
"""
Rearranges the fields according to field_order.
field_order is a list of field names specifying the order. Fields not
inclu... | {
"repo_name": "unicefuganda/uSurvey",
"path": "survey/forms/form_helper.py",
"copies": "1",
"size": "1258",
"license": "bsd-3-clause",
"hash": -2947720120880769000,
"line_mean": 28.9523809524,
"line_max": 80,
"alpha_frac": 0.6470588235,
"autogenerated": false,
"ratio": 4.7293233082706765,
"conf... |
__author__ = 'anthony'
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.safestring import mark_safe
from django import forms
from form_helper import FormOrderMixin, get_form_field_no_validation
from survey.models import (
ListingSample,
Answer,
Interview,... | {
"repo_name": "unicefuganda/uSurvey",
"path": "survey/forms/answer.py",
"copies": "1",
"size": "16166",
"license": "bsd-3-clause",
"hash": -3717709061841165000,
"line_mean": 39.0148514851,
"line_max": 119,
"alpha_frac": 0.5784980824,
"autogenerated": false,
"ratio": 4.195691668829483,
"config_t... |
__author__ = 'anthony'
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User, Permission, Group
from django.contrib.contenttypes.models import ContentType
from survey.models import AnswerAccessDefinition, AutoResponse, NumericalAnswer, TextAnswer, \
MultiChoiceAnswer, Multi... | {
"repo_name": "unicefuganda/uSurvey",
"path": "survey/management/commands/load_parameters.py",
"copies": "1",
"size": "4593",
"license": "bsd-3-clause",
"hash": 5453410104468545000,
"line_mean": 56.4125,
"line_max": 110,
"alpha_frac": 0.6886566514,
"autogenerated": false,
"ratio": 3.7040322580645... |
__author__ = 'anthony <>'
from django.db import models
from survey.models.base import BaseModel
from survey.models.generics import TemplateQuestion
from survey.models.questions import Question, QuestionSet, QuestionOption, QuestionFlow
from survey.models.interviews import Answer
from survey.models.interviews import Mul... | {
"repo_name": "unicefuganda/uSurvey",
"path": "survey/models/respondents.py",
"copies": "1",
"size": "5585",
"license": "bsd-3-clause",
"hash": -3146114916379316000,
"line_mean": 35.2662337662,
"line_max": 119,
"alpha_frac": 0.6349149508,
"autogenerated": false,
"ratio": 4.574119574119574,
"con... |
__author__ = 'anthony <>'
from django.db import models
from survey.models.questions import Question
from survey.models.respondents import RespondentGroup, SurveyParameterList
class BatchQuestion(Question):
group = models.ForeignKey(
RespondentGroup,
related_name='questions',
null=True,
... | {
"repo_name": "unicefuganda/uSurvey",
"path": "survey/models/batch_questions.py",
"copies": "1",
"size": "1178",
"license": "bsd-3-clause",
"hash": -4441865973716074500,
"line_mean": 34.696969697,
"line_max": 106,
"alpha_frac": 0.6502546689,
"autogenerated": false,
"ratio": 4.133333333333334,
"... |
__author__ = 'anthony <>'
from model_utils.managers import InheritanceManager
from django.db import models
from survey.models.base import BaseModel
from survey.models.response_validation import ResponseValidation
from survey.models.interviews import Answer
class GenericQuestion(BaseModel):
ANSWER_TYPES = [(name, ... | {
"repo_name": "unicefuganda/uSurvey",
"path": "survey/models/generics.py",
"copies": "1",
"size": "1855",
"license": "bsd-3-clause",
"hash": -6978053095705062000,
"line_mean": 31.5438596491,
"line_max": 112,
"alpha_frac": 0.6819407008,
"autogenerated": false,
"ratio": 4.103982300884955,
"config... |
__author__ = 'Anthony'
"""
Solve the unique lowest-cost assignment problem using the
Hungarian algorithm (also known as Munkres algorithm).
"""
# Based on original code by Brain Clapper, adapted to NumPy by Gael Varoquaux.
# Heavily refactored by Lars Buitinck.
# Copyright (c) 2008 Brian M. Clapper <bmc@clapper.org>,... | {
"repo_name": "amlozano1/kalman_car_counter",
"path": "hungarian.py",
"copies": "1",
"size": "9370",
"license": "mit",
"hash": 7571692663038496000,
"line_mean": 32.4678571429,
"line_max": 78,
"alpha_frac": 0.614941302,
"autogenerated": false,
"ratio": 3.654446177847114,
"config_test": false,
... |
import numpy as np
from utils.distances import euclidianDist
class Kmeans:
def __init__(self, data, k=1, distance=euclidianDist):
'''
:param data: Training data set with samples as row elements
:param k: number of cluster
:param distance: metric measurement of the space. default : ... | {
"repo_name": "antoinebrl/practice-ML",
"path": "kmeans.py",
"copies": "1",
"size": "3022",
"license": "mit",
"hash": 1422231827983793200,
"line_mean": 36.3086419753,
"line_max": 96,
"alpha_frac": 0.5929847783,
"autogenerated": false,
"ratio": 3.434090909090909,
"config_test": false,
"has_no_... |
import numpy as np
class KNN:
'''K-Nearest Neighbors classifier'''
def __init__(self, inputs, targets, k=1):
if k < 1:
raise Exception("[KNN][init] k must be greater than zero")
self.inputs = inputs
self.targets = targets
self.k = k
def train(self):
re... | {
"repo_name": "antoinebrl/practice-ML",
"path": "knn.py",
"copies": "1",
"size": "2038",
"license": "mit",
"hash": 2520039606085003300,
"line_mean": 34.1379310345,
"line_max": 141,
"alpha_frac": 0.5961727184,
"autogenerated": false,
"ratio": 2.7841530054644807,
"config_test": false,
"has_no_k... |
import numpy as np
class LinReg:
'''Linear Regression. Least-squares optimisation'''
def __init__(self, inputs, targets):
'''Constructor'''
# target is a column vector
#if np.ndim(targets) != 2 or np.shape(targets)[1] != 1:
# raise Exception('[linreg][init] targets variable... | {
"repo_name": "antoinebrl/practice-ML",
"path": "linreg.py",
"copies": "1",
"size": "1977",
"license": "mit",
"hash": -1559392116206620400,
"line_mean": 30.380952381,
"line_max": 120,
"alpha_frac": 0.6064744562,
"autogenerated": false,
"ratio": 3.4929328621908127,
"config_test": false,
"has_n... |
import numpy as np
import math
class Node:
def __init__(self, attr, child=None):
self.attr = attr
self.child = {} if child == None else child
def addChild(self, value, node):
self.child[value] = node
def __repr__(self):
return repr(self.__dict__)
class Leaf:
def __in... | {
"repo_name": "antoinebrl/practice-ML",
"path": "dtree.py",
"copies": "1",
"size": "11660",
"license": "mit",
"hash": -1770192916410395100,
"line_mean": 45.8273092369,
"line_max": 101,
"alpha_frac": 0.5169811321,
"autogenerated": false,
"ratio": 3.046772929187353,
"config_test": false,
"has_n... |
import numpy as np
from kmeans import Kmeans
from pcn import PCN
from utils.distances import euclidianDist
class RBF:
'''Radial Basis Function Network. Can be used for classification or function approximation'''
def __init__(self, inputs, targets, n=1, sigma=0, distance=euclidianDist,
weight... | {
"repo_name": "antoinebrl/practice-ML",
"path": "rbf.py",
"copies": "1",
"size": "3759",
"license": "mit",
"hash": 6610266292566702000,
"line_mean": 36.59,
"line_max": 100,
"alpha_frac": 0.6134610269,
"autogenerated": false,
"ratio": 3.607485604606526,
"config_test": false,
"has_no_keywords":... |
import numpy as np
import sys
class MLP:
'''Multi-layers Perceptron.'''
def __init__(self, inputs, targets, nbNodes=1, outputType='logic'):
'''
Constructor
:param inputs: set of data points as row vectors
:param nbNodes: number of hidden nodes
:param output... | {
"repo_name": "antoinebrl/practice-ML",
"path": "mlp.py",
"copies": "1",
"size": "8561",
"license": "mit",
"hash": 8686671399922136000,
"line_mean": 36.548245614,
"line_max": 114,
"alpha_frac": 0.5742319822,
"autogenerated": false,
"ratio": 3.3999205718824466,
"config_test": false,
"has_no_ke... |
import numpy as np
import sys
class PCN:
'''Perceptron. Based on McCulloch and Pitts neurons'''
def __init__(self, inputs, targets, bias=True, delta=False):
'''
Constructor
:param inputs : set of data points as row vectors
:param targets : set of targets as row vectors... | {
"repo_name": "antoinebrl/practice-ML",
"path": "pcn.py",
"copies": "1",
"size": "5893",
"license": "mit",
"hash": 6499169524509226000,
"line_mean": 32.867816092,
"line_max": 115,
"alpha_frac": 0.5543865603,
"autogenerated": false,
"ratio": 3.5758495145631066,
"config_test": false,
"has_no_ke... |
import os, sys, atexit
class DaemonContext:
"""
following the PEP 3143
"""
is_open = False
def __init__(self, stdin=None, stdout=None, stderr=None,
working_directory='/', chroot_directory=None,
uid=os.getuid(), gid=os.getgid(), files_preserve=None,
... | {
"repo_name": "apointeau/python-daemonizer",
"path": "daemon/DaemonContext.py",
"copies": "1",
"size": "2022",
"license": "mit",
"hash": 7501072426225854000,
"line_mean": 23.962962963,
"line_max": 73,
"alpha_frac": 0.5766567755,
"autogenerated": false,
"ratio": 3.6830601092896176,
"config_test"... |
author = 'Anton Bobrov<bobrov@vl.ru>/Fabien Devaux<fdev31@gmail.com>'
name = 'Pylint'
desc = 'Advanced python linter'
langs = ['python']
import os.path
import re
from snaked.core.problems import mark_problems, attach_to_editor, clear_problems
def init(manager):
manager.add_global_option('PYLINT_CHECK_ON_SAVE', ... | {
"repo_name": "baverman/snaked",
"path": "snaked/plugins/python_lint/__init__.py",
"copies": "1",
"size": "3208",
"license": "mit",
"hash": 6533604438474508000,
"line_mean": 26.6551724138,
"line_max": 106,
"alpha_frac": 0.5798004988,
"autogenerated": false,
"ratio": 3.3347193347193347,
"config_... |
author = 'Anton Bobrov<bobrov@vl.ru>'
name = 'Bad python code save preventer'
desc = 'Prevents from saving of code with syntax errors'
import weakref
import time
import glib
last_feedbacks = weakref.WeakKeyDictionary()
def init(injector):
injector.on_ready('editor-with-new-buffer', editor_created)
from sna... | {
"repo_name": "baverman/snaked",
"path": "snaked/plugins/python_bcsp/__init__.py",
"copies": "1",
"size": "2403",
"license": "mit",
"hash": -3999120746779475000,
"line_mean": 30.6315789474,
"line_max": 85,
"alpha_frac": 0.5925925926,
"autogenerated": false,
"ratio": 3.5234604105571847,
"config_... |
author = 'Anton Bobrov<bobrov@vl.ru>'
name = 'Complete words'
desc = 'Cycle through possible word completions'
from gobject import timeout_add
from string import whitespace
from uxie.utils import refresh_gui, connect, idle
buffers_to_update = []
def init(injector):
injector.bind('editor-active', 'complete-word',... | {
"repo_name": "baverman/snaked",
"path": "snaked/plugins/complete_words/__init__.py",
"copies": "1",
"size": "4035",
"license": "mit",
"hash": 3105432452709599700,
"line_mean": 27.8214285714,
"line_max": 101,
"alpha_frac": 0.648574969,
"autogenerated": false,
"ratio": 3.6748633879781423,
"confi... |
author = 'Anton Bobrov<bobrov@vl.ru>'
name = 'Edit and Select'
desc = 'Various edit shortcuts'
import weakref
import gtk
from uxie.floating import TextFeedback
last_smart_selections = weakref.WeakKeyDictionary()
def init(injector):
injector.add_context('editor-with-cursor-in-string', 'editor', in_string)
in... | {
"repo_name": "baverman/snaked",
"path": "snaked/plugins/edit_and_select/__init__.py",
"copies": "1",
"size": "7314",
"license": "mit",
"hash": 7166423206878682000,
"line_mean": 32.2454545455,
"line_max": 100,
"alpha_frac": 0.649165983,
"autogenerated": false,
"ratio": 3.406613879832324,
"confi... |
author = 'Anton Bobrov<bobrov@vl.ru>'
name = 'Goto line'
desc = 'Navigates to specified line'
import gtk
from uxie.utils import idle
def init(injector):
injector.bind('editor-active', 'goto-line', 'Edit/_Goto line#50', goto_line).to('<ctrl>l')
def goto_line(editor):
widget = get_widget(editor)
editor.w... | {
"repo_name": "baverman/snaked",
"path": "snaked/plugins/goto_line/__init__.py",
"copies": "1",
"size": "1488",
"license": "mit",
"hash": -7508768625825674000,
"line_mean": 24.2372881356,
"line_max": 94,
"alpha_frac": 0.6565860215,
"autogenerated": false,
"ratio": 3.2920353982300883,
"config_te... |
author = 'Anton Bobrov<bobrov@vl.ru>'
name = 'Hash comment'
desc = '(Un)Comments line or selection with hashes'
import gtk
import re
langs = ['python', 'sh', 'ruby', 'perl']
def init(injector):
injector.add_context('hash-comment-aware', 'editor-active',
lambda e: e if e.buffer.lang in langs else None)
... | {
"repo_name": "baverman/snaked",
"path": "snaked/plugins/hash_comment/__init__.py",
"copies": "1",
"size": "3128",
"license": "mit",
"hash": 8769296276037808000,
"line_mean": 28.2336448598,
"line_max": 94,
"alpha_frac": 0.5882352941,
"autogenerated": false,
"ratio": 3.3454545454545452,
"config_... |
author = 'Anton Bobrov<bobrov@vl.ru>'
name = 'Python REPL'
desc = 'Slim and slick python console'
import os.path
import gtk.gdk, pango
import gtksourceview2
from cPickle import dumps
from snaked.core.prefs import update_view_preferences
def init(injector):
injector.add_context('python-repl', 'editor',
la... | {
"repo_name": "baverman/snaked",
"path": "snaked/plugins/python_repl/__init__.py",
"copies": "1",
"size": "4645",
"license": "mit",
"hash": -6066174497733822000,
"line_mean": 29.3660130719,
"line_max": 104,
"alpha_frac": 0.6626480086,
"autogenerated": false,
"ratio": 3.2482517482517483,
"config... |
author = 'Anton Bobrov<bobrov@vl.ru>'
name = 'Search'
desc = 'Searches words in document'
import re
import weakref
import gtk
import glib
from uxie.utils import idle, refresh_gui, widget_is_child_of, text_buffer_user_action
from uxie.escape import Escapable
active_search_widgets = weakref.WeakKeyDictionary()
active... | {
"repo_name": "baverman/snaked",
"path": "snaked/plugins/search/__init__.py",
"copies": "1",
"size": "17544",
"license": "mit",
"hash": -2434180063020168000,
"line_mean": 30.4426523297,
"line_max": 105,
"alpha_frac": 0.6171910625,
"autogenerated": false,
"ratio": 3.5024955080854463,
"config_tes... |
author = 'Anton Bobrov<bobrov@vl.ru>'
name = 'Snippets'
desc = "SnipMate's clone"
import os.path
import re
import weakref
import gtk
from uxie.utils import idle, join_to_data_dir
from snaked.core.completer import attach_completer, add_completion_provider, Provider
from .parser import parse_snippets_from
loaded_sni... | {
"repo_name": "baverman/snaked",
"path": "snaked/plugins/snippets/__init__.py",
"copies": "1",
"size": "12534",
"license": "mit",
"hash": -1359475713241179000,
"line_mean": 31.5558441558,
"line_max": 91,
"alpha_frac": 0.5863251955,
"autogenerated": false,
"ratio": 3.720391807658059,
"config_tes... |
author = 'Anton Bobrov<bobrov@vl.ru>'
name = 'Spell check'
desc = 'Attaches spell checker to current editor'
import weakref
import glib
import gtk
attached_spells = weakref.WeakKeyDictionary()
def init(injector):
injector.bind('editor', 'toggle-spell-check', 'Edit/Toggle spel_l check#50',
toggle_spell).t... | {
"repo_name": "baverman/snaked",
"path": "snaked/plugins/spell/__init__.py",
"copies": "1",
"size": "1836",
"license": "mit",
"hash": 2805823160802279400,
"line_mean": 31.7857142857,
"line_max": 88,
"alpha_frac": 0.6775599129,
"autogenerated": false,
"ratio": 3.592954990215264,
"config_test": f... |
import os
import sys
import re
TOC_LIST_PREFIX = "-"
# TOC_LIST_PREFIX = "*"
HEADER_LINE_RE = re.compile("^(#+)\s*(.*?)\s*(#+$|$)", re.IGNORECASE)
HEADER1_UNDERLINE_RE = re.compile("^-+$")
HEADER2_UNDERLINE_RE = re.compile("^=+$")
# Dictionary of anchor name to number of instances found so far
anchors = {}
def pri... | {
"repo_name": "julianpistorius/magnetosphere",
"path": ".repo-scripts/md-to-toc.py",
"copies": "2",
"size": "2628",
"license": "bsd-3-clause",
"hash": 8797843081328236000,
"line_mean": 23.3333333333,
"line_max": 89,
"alpha_frac": 0.6468797565,
"autogenerated": false,
"ratio": 2.903867403314917,
... |
import os
import sys
import re
TOC_LIST_PREFIX = "-"
# TOC_LIST_PREFIX = "*"
HEADER_LINE_RE = re.compile("^(#+)\s*(.*?)\s*(#+$|$)", re.IGNORECASE)
# Dictionary of anchor name to number of instances found so far
anchors = {}
def print_usage():
print("\nUsage: md-to-toc <markdown_file>")
def to_github_anchor(titl... | {
"repo_name": "wilsonmar/md-to-toc",
"path": "md-to-toc.py",
"copies": "1",
"size": "2158",
"license": "mit",
"hash": -1905618930589763300,
"line_mean": 24.3882352941,
"line_max": 89,
"alpha_frac": 0.6459684893,
"autogenerated": false,
"ratio": 2.9400544959128063,
"config_test": false,
"has_n... |
import os
import sys
import tempfile
import platform
def PrintUsage():
print """
Plots an HSM defined in cpp file(s) via hsmToDot -> dot -> default image viewer
Requires GraphViz (Windows: https://graphviz.gitlab.io/_pages/Download/Download_windows.html)
Usage: {} <filespec>
""".format(os.path.basename(sys.argv[0]... | {
"repo_name": "amaiorano/hsm",
"path": "tools/plotHsm.py",
"copies": "1",
"size": "1395",
"license": "mit",
"hash": 9150551174184714000,
"line_mean": 23.9107142857,
"line_max": 127,
"alpha_frac": 0.6817204301,
"autogenerated": false,
"ratio": 3,
"config_test": false,
"has_no_keywords": false,... |
import sys
import re
TOC_LIST_PREFIX = "-"
# TOC_LIST_PREFIX = "*"
HEADER_LINE_RE = re.compile("^(#+)\s*(.*?)\s*(#+$|$)", re.IGNORECASE)
HEADER1_UNDERLINE_RE = re.compile("^-+$")
HEADER2_UNDERLINE_RE = re.compile("^=+$")
# Dictionary of anchor name to number of instances found so far
anchors = {}
def print_usage(... | {
"repo_name": "amaiorano/md-to-toc",
"path": "md-to-toc.py",
"copies": "1",
"size": "3087",
"license": "mit",
"hash": 5929427442366323000,
"line_mean": 25.8434782609,
"line_max": 80,
"alpha_frac": 0.5607385811,
"autogenerated": false,
"ratio": 3.5523590333716917,
"config_test": false,
"has_no... |
__author__ = 'Antonio Segura Cano'
__name__ = 'utils'
import os
import math
import tkMessageBox
def fix_size(s, l):
r = s
if s.__len__() != l:
r = fix_size("0"+s, l)
return r
def hasindeterminacy(edge):
res = False
if '-' in edge[1]:
res = True
return res
def matchindeterm... | {
"repo_name": "GOYUSO/FSpyChine",
"path": "src/FSM_utils.py",
"copies": "1",
"size": "2392",
"license": "mit",
"hash": -2731391135184983600,
"line_mean": 24.4468085106,
"line_max": 116,
"alpha_frac": 0.5334448161,
"autogenerated": false,
"ratio": 3.497076023391813,
"config_test": false,
"has_... |
__author__ = 'Antonio Segura Cano'
import numpy as np
import time
from graphviz import Digraph
import tkMessageBox
from wildcards import wildcard
from FSM_utils import *
# We'll create a FSMachine class
# FSMachine class will generate all methods about the program
# A random FSMachine: FSMachine.random
# KIS... | {
"repo_name": "GOYUSO/FSpyChine",
"path": "src/FSM_class.py",
"copies": "1",
"size": "11776",
"license": "mit",
"hash": 4614024261350587000,
"line_mean": 30.2360742706,
"line_max": 112,
"alpha_frac": 0.4668817935,
"autogenerated": false,
"ratio": 4.116043341488989,
"config_test": false,
"has_... |
__author__ = 'Antonio Segura Cano'
import os
import re
import numpy as np
# We'll create a FSMachine class
# FSMachine class will generate all methods about the program
# A random FSMachine: FSMachine.random
# KISS2 headers include the following information:
#
# .i # number of inputs
# .o # number ... | {
"repo_name": "GOYUSO/FSpyChine",
"path": "src/FSM_functions.py",
"copies": "1",
"size": "10209",
"license": "mit",
"hash": -8004902952611181000,
"line_mean": 30.0303951368,
"line_max": 123,
"alpha_frac": 0.4594965227,
"autogenerated": false,
"ratio": 4.108249496981891,
"config_test": false,
... |
__author__ = 'Anton Melnikov'
from collections import Counter, OrderedDict
from enum import Enum
from itertools import chain
from pprint import pprint
class FeatureValue(Enum):
"""
enum for values of phonological features
"""
yes = 1
no = 0
both = 2
unspecified = -1
class FeatureValueDi... | {
"repo_name": "notnami/phonemes",
"path": "phonemelib/phoneme.py",
"copies": "1",
"size": "5779",
"license": "mit",
"hash": -6695121573522030000,
"line_mean": 28.0301507538,
"line_max": 105,
"alpha_frac": 0.578601108,
"autogenerated": false,
"ratio": 4.715102040816326,
"config_test": false,
"... |
__author__ = 'Anton Purin'
"""
AnLinq - Linq analog for Python
Contact: purin.anton@gmail.com
The MIT License (MIT)
Copyright (c) 2015 Anton Purin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Softwar... | {
"repo_name": "anpur/anlinq",
"path": "anlinq/__init__.py",
"copies": "1",
"size": "13908",
"license": "mit",
"hash": 7610082816602367000,
"line_mean": 32.1957040573,
"line_max": 114,
"alpha_frac": 0.5944779983,
"autogenerated": false,
"ratio": 4.602250165453342,
"config_test": false,
"has_no... |
__author__ = 'Anton'
import os
import jinja2
import webapp2
import simplejson as json
from utils import get_current_user
from model.model import User, Bookmark
from google.appengine.api import users
jinja_environment = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__fi... | {
"repo_name": "sloot14/flexifod",
"path": "view/pages.py",
"copies": "1",
"size": "2193",
"license": "mit",
"hash": 2207551038548645000,
"line_mean": 35.1694915254,
"line_max": 104,
"alpha_frac": 0.6155950752,
"autogenerated": false,
"ratio": 3.8205574912891986,
"config_test": false,
"has_no_... |
__author__ = 'Anton'
import re
import md5
import webapp2
from time import time
import simplejson as json
from utils import get_current_user
from model.model import User, Bookmark
from google.appengine.api import users
from datetime import datetime, timedelta
reg = re.compile(r'\b(((\S+)?)(@|mailto\:|(news... | {
"repo_name": "sloot14/flexifod",
"path": "view/api.py",
"copies": "1",
"size": "4460",
"license": "mit",
"hash": 8186933402622245000,
"line_mean": 38.1801801802,
"line_max": 138,
"alpha_frac": 0.6022421525,
"autogenerated": false,
"ratio": 3.6647493837304848,
"config_test": false,
"has_no_ke... |
__author__ = 'Antony Cherepanov'
from datetime import datetime
import random
import tweepy
import dbhandler
import generator
class RandBot(object):
def __init__(self):
self.db = dbhandler.DBHandler()
self.auth = tweepy.OAuthHandler(*(self.db.get_consumer_data()))
self.auth.set_access_toke... | {
"repo_name": "iamantony/randbot",
"path": "src/randbot.py",
"copies": "1",
"size": "3545",
"license": "mit",
"hash": 5402749398009376000,
"line_mean": 32.1308411215,
"line_max": 74,
"alpha_frac": 0.5466854725,
"autogenerated": false,
"ratio": 3.767268862911796,
"config_test": false,
"has_no_... |
__author__ = 'Antony Cherepanov'
from exceptions import Exception
from math import fabs, pow, sqrt
class PointException(Exception):
pass
class Point(object):
"""
2D Point object
"""
def __init__(self, t_x=0, t_y=0):
self.__x = t_x
self.__y = t_y
def __str__(self):
... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/objects/point.py",
"copies": "1",
"size": "1597",
"license": "mit",
"hash": -518499129016724300,
"line_mean": 22.8358208955,
"line_max": 76,
"alpha_frac": 0.5597996243,
"autogenerated": false,
"ratio": 3.6797235023041477,
"config_test": false,... |
__author__ = 'Antony Cherepanov'
import argparse
import os
import multiprocessing
from PIL import Image
def main():
folder, save_folder = parse_arguments()
is_ok = check_arguments(folder, save_folder)
if is_ok is True:
start(folder, save_folder)
else:
print("Invalid arguments. Try aga... | {
"repo_name": "iamantony/images2grey",
"path": "images2grey.py",
"copies": "1",
"size": "6153",
"license": "mit",
"hash": -8434002787829895000,
"line_mean": 28.5865384615,
"line_max": 80,
"alpha_frac": 0.6070209654,
"autogenerated": false,
"ratio": 3.788793103448276,
"config_test": false,
"ha... |
__author__ = 'Antony Cherepanov'
import argparse
import os
import multiprocessing
from PIL import Image
def parse_arguments():
""" Parse arguments and start slice process
:return tuple of arguments
"""
parser = argparse.ArgumentParser(
description="Multi-thread python app for slicing images"... | {
"repo_name": "iamantony/images_slicer",
"path": "images_slicer.py",
"copies": "1",
"size": "8689",
"license": "mit",
"hash": 2203926127672149500,
"line_mean": 31.5468164794,
"line_max": 80,
"alpha_frac": 0.5759005639,
"autogenerated": false,
"ratio": 3.9122017109410177,
"config_test": false,
... |
__author__ = 'Antony Cherepanov'
import sqlite3
import os
class DBHandler(object):
def __init__(self):
self.db_name = 'bot.db'
self.db_path = os.path.dirname(os.path.abspath(__file__)) + \
os.sep + self.db_name
self.__check_db()
self.connection = sqlite3.connect(self.d... | {
"repo_name": "iamantony/randbot",
"path": "src/dbhandler.py",
"copies": "1",
"size": "4738",
"license": "mit",
"hash": 8273032128214237000,
"line_mean": 32.8428571429,
"line_max": 79,
"alpha_frac": 0.5635289152,
"autogenerated": false,
"ratio": 4.152497808939526,
"config_test": false,
"has_n... |
__author__ = 'Antony Cherepanov'
from matrix import Matrix, MatrixException
def Start():
first = Matrix(4, 4, [i for i in range(1, 17)])
second = Matrix(4, 4, [i for i in range(17, 33)])
print "First = ", first
print "Second = ", second
print "Multiplication: ", first * second
prin... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/algorithms/matrix/strassen_multiplication.py",
"copies": "1",
"size": "1926",
"license": "mit",
"hash": 526298607596635500,
"line_mean": 30.1,
"line_max": 79,
"alpha_frac": 0.5036344756,
"autogenerated": false,
"ratio": 2.857566765578635,
"con... |
__author__ = 'Antony Cherepanov'
from Objects import Point, PointException
class SortBy(object):
X_COORD = 0
Y_COORD = 1
def Start():
input = [Point(1, 1), Point(5, 7), Point(3, 0), Point(6, 2), Point(10, 10),
Point(2, 1), Point(0, 10), Point(6, 5), Point(7, 2)]
result = Clos... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/algorithms/search/closestpoints.py",
"copies": "1",
"size": "2620",
"license": "mit",
"hash": -6640703467111342000,
"line_mean": 26.5,
"line_max": 79,
"alpha_frac": 0.5145038168,
"autogenerated": false,
"ratio": 4.0184049079754605,
"config_tes... |
__author__ = 'Antony Cherepanov'
from random import randint
import sys
sys.setrecursionlimit(10000)
class PivotPosition(object):
""" List of names of rules to choose pivot position """
FIRST, LAST, MEDIAN, RANDOM = range(0, 4)
def quick_sort(t_input, t_pivot_position=PivotPosition.RANDOM):
... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/algorithms/sort/quicksort.py",
"copies": "1",
"size": "2567",
"license": "mit",
"hash": 6123720753447051000,
"line_mean": 27.5287356322,
"line_max": 76,
"alpha_frac": 0.5862874951,
"autogenerated": false,
"ratio": 3.5702364394993045,
"config_t... |
__author__ = 'Antony Cherepanov'
glob_str = "i'm global"
print("Names at the top level of a file are global to code within that " +
"single file only")
print("If we want use them in other modules, than we should import them")
print("This is global variable: " + glob_str)
glob_list = [1, 2, 3, 4]
... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/functions/scopes.py",
"copies": "1",
"size": "7183",
"license": "mit",
"hash": -660773789471181000,
"line_mean": 28.9525862069,
"line_max": 80,
"alpha_frac": 0.6232065747,
"autogenerated": false,
"ratio": 4.03314606741573,
"config_test": false... |
__author__ = 'Antony Cherepanov'
import os
import sys
def different_ways_to_print():
print("\ndifferent_ways_to_print()")
a, b, c = 42, "i'm a string", [99, 0.2]
print("The standard way:")
print(a, b, c)
print("With special separator:")
print(a, b, c, sep=" -- ")
print(... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/tools/printing.py",
"copies": "1",
"size": "1471",
"license": "mit",
"hash": 8462925440992717000,
"line_mean": 24.3035714286,
"line_max": 72,
"alpha_frac": 0.5914343984,
"autogenerated": false,
"ratio": 3.389400921658986,
"config_test": false,... |
__author__ = 'Antony Cherepanov'
import pickle
import json
import os
def save_dict_to_file_via_pickle():
print("\nsave_dict_to_file_via_pickle()")
simple_dict = {"key1": 224, "kkl": "strong"}
print("Our dict: " + str(simple_dict))
print("Let's serialise it and save to file")
test_... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/tools/serialisation.py",
"copies": "1",
"size": "1387",
"license": "mit",
"hash": -5379272974747288000,
"line_mean": 26.3469387755,
"line_max": 77,
"alpha_frac": 0.613554434,
"autogenerated": false,
"ratio": 3.1666666666666665,
"config_test": ... |
__author__ = 'Antony Cherepanov'
def get_list_of_items():
print("\nget_list_of_items():")
some_dict = dict(test=1, some_list=[1, 2, 3], useful="This is a dict!")
print("Dict: " + str(some_dict))
print("Dict keys: " + str(some_dict.keys()))
print("Dict values: " + str(some_dict.values()))
... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/types/dict.py",
"copies": "1",
"size": "1079",
"license": "mit",
"hash": 5577652131674973000,
"line_mean": 28.8857142857,
"line_max": 87,
"alpha_frac": 0.5634847081,
"autogenerated": false,
"ratio": 3.0055710306406684,
"config_test": false,
... |
__author__ = 'Antony Cherepanov'
def gnome_sort(t_input):
""" Gnome Sort Algorithm
Simple and slow algorithm
http://en.wikipedia.org/wiki/Gnome_sort
Best case performance: O(n^2)
Worst case performance: O(n)
Worst Case Auxiliary Space Complexity: O(1)
:param t_input: [list] o... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/algorithms/sort/gnomesort.py",
"copies": "1",
"size": "1355",
"license": "mit",
"hash": -5063976868646683000,
"line_mean": 30.2619047619,
"line_max": 75,
"alpha_frac": 0.5129151292,
"autogenerated": false,
"ratio": 4.1692307692307695,
"config_... |
__author__ = 'Antony Cherepanov'
def immutable_set():
print("\nimmutable_set():")
simple_list = [1, 2, 1, 5, 4, 7, 7]
simple_set = set(simple_list)
print("List :" + str(simple_list))
print("Set that based on this list :" + str(simple_set))
print("Check that sets are immutable:")
... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/types/sets.py",
"copies": "1",
"size": "1443",
"license": "mit",
"hash": -4599833167454836700,
"line_mean": 25.7884615385,
"line_max": 81,
"alpha_frac": 0.5717255717,
"autogenerated": false,
"ratio": 3.510948905109489,
"config_test": false,
... |
__author__ = "Antony Cherepanov"
def merge_sort(t_input):
length = len(t_input)
if 2 < length:
half_length = length // 2
left_half = t_input[:half_length]
right_half = t_input[half_length:]
sorted_left = merge_sort(left_half)
sorted_right = merge_sort(right_ha... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/algorithms/sort/mergesort.py",
"copies": "1",
"size": "1163",
"license": "mit",
"hash": 7740609142568472000,
"line_mean": 25.7380952381,
"line_max": 48,
"alpha_frac": 0.4393809114,
"autogenerated": false,
"ratio": 4.1535714285714285,
"config_t... |
__author__ = 'Antony Cherepanov'
def nesting():
""" List can hold another list! """
matrix = list()
# First row
matrix.append([1, 2, 3])
# Second
matrix.append([4, 5, 6])
# Third
matrix.append([7, 8, 9])
print("Our matrix as list of lists: " + str(matrix))
prin... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/types/lists.py",
"copies": "1",
"size": "1285",
"license": "mit",
"hash": 3814658780672597500,
"line_mean": 21.8333333333,
"line_max": 63,
"alpha_frac": 0.5556420233,
"autogenerated": false,
"ratio": 3.165024630541872,
"config_test": false,
... |
__author__ = 'Antony Cherepanov'
def passing_arguments():
print("\npassing_arguments()")
print("Immutable arguments are effectively passed 'by value'")
print("So inside a function we work with copy of variable and")
print("any changed made inside the function will not affect")
print("ori... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/functions/arguments.py",
"copies": "1",
"size": "5218",
"license": "mit",
"hash": -4258642881229772000,
"line_mean": 28.3372093023,
"line_max": 80,
"alpha_frac": 0.6150306748,
"autogenerated": false,
"ratio": 3.7906976744186047,
"config_test":... |
__author__ = 'Antony Cherepanov'
def range_iteration():
print("\nrange_iteration")
rng = range(10)
print("When we call range() functions, we get object tht can iterate: " +
str(rng))
print("But it's not an iterator! Let's try:")
try:
next(rng)
print("Wow, ite... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/operations/iteration.py",
"copies": "1",
"size": "1628",
"license": "mit",
"hash": 943196206723900900,
"line_mean": 29.9607843137,
"line_max": 79,
"alpha_frac": 0.5847665848,
"autogenerated": false,
"ratio": 3.4638297872340424,
"config_test": ... |
__author__ = 'Antony Cherepanov'
def repeat_string():
""" Repeat string several times simply multiplying it by some number """
string = "And Again "
long_string = string * 5
print("Original string :", string)
print("Repeated string :", long_string)
def immutability():
""" Strings... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/types/strings.py",
"copies": "1",
"size": "1829",
"license": "mit",
"hash": -1436668460843254300,
"line_mean": 28.0163934426,
"line_max": 102,
"alpha_frac": 0.6145434664,
"autogenerated": false,
"ratio": 3.709939148073022,
"config_test": false... |
__author__ = 'Antony Cherepanov'
def Start():
input = [4, 2, 8, 5, 3, 1, 6, 7]
# input = [6, 5, 4, 3, 2, 1]
# input = [1, 3, 5, 2, 4, 6]
print "input =", input
sortedInput, inversionsNum = InversionsCounter(input)
print "number of inversions =", inversionsNum
# The main idea: use... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/algorithms/search/inversionscount.py",
"copies": "1",
"size": "2269",
"license": "mit",
"hash": -2276744506828214500,
"line_mean": 30.4142857143,
"line_max": 77,
"alpha_frac": 0.5130013222,
"autogenerated": false,
"ratio": 4.289224952741021,
"... |
__author__ = 'Antony Cherepanov'
def ways_to_create():
print("\nways_to_create()")
# On the end - comma!
first = "first value",
print("1: ", str(first))
# Also we can create tuple via tuple()
second = ("second value", 2)
print("2: ", str(second))
nested = (1, (2, 3))
... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/types/tuples.py",
"copies": "1",
"size": "1639",
"license": "mit",
"hash": -3393803989563968500,
"line_mean": 23.640625,
"line_max": 80,
"alpha_frac": 0.5820622331,
"autogenerated": false,
"ratio": 3.5399568034557234,
"config_test": false,
"... |
__author__ = 'Antony Cherepanov'
def while_with_else():
print("\nwhile_with_else")
print("If inside while() loop 'break' was not called, code under the 'else' will be executed")
print("\nLoop without break:")
i = 2
while i < 5:
print("Inside loop")
i += 1
else:
... | {
"repo_name": "iamantony/PythonNotes",
"path": "src/operations/loops.py",
"copies": "1",
"size": "2463",
"license": "mit",
"hash": 461948605431415230,
"line_mean": 22.898989899,
"line_max": 98,
"alpha_frac": 0.5403978888,
"autogenerated": false,
"ratio": 3.4788135593220337,
"config_test": false... |
__author__ = 'Antring'
import urllib.request
import os
import feedparser
import datetime
from time import *
class rssReader:
'''Class for finding and downloading podcast'''
def __init__(self, url):
self.rssurl = url
self.podstream = feedparser.parse(self.rssurl)
self.podLink = self.p... | {
"repo_name": "antring/RssThingyServer",
"path": "server.py",
"copies": "1",
"size": "1585",
"license": "mit",
"hash": 1476858080664317400,
"line_mean": 32.0416666667,
"line_max": 118,
"alpha_frac": 0.6012618297,
"autogenerated": false,
"ratio": 3.530066815144766,
"config_test": false,
"has_n... |
__author__ = 'Antti Pohjola'
# DynDns autologin
# automatically logins to dyndns
import webapp2
import logging
import urllib
import urllib2
import cookielib
import time
class Settings:
dyndns_username = ""
dyndns_password = ""
loginurl = "https://account.dyn.com/entrance"
loginredirecturl = "https://a... | {
"repo_name": "Summeli/dyndns-autologin",
"path": "cron.py",
"copies": "1",
"size": "3348",
"license": "mit",
"hash": 5769142636215022000,
"line_mean": 31.1923076923,
"line_max": 152,
"alpha_frac": 0.6350059737,
"autogenerated": false,
"ratio": 3.9715302491103204,
"config_test": false,
"has_n... |
__author__ = 'anuvrat'
class WeightedQuickUnion(object):
def __init__(self, size, debug=False, compress_path=True):
self.group_count = self.size = size
self.group = [i for i in range(size)]
self.tree_size = [1] * size
self.debug = debug
self.compress_path = compress_path
... | {
"repo_name": "anuvrat/spoj",
"path": "problems/partial/003188_mst.py",
"copies": "1",
"size": "2460",
"license": "mit",
"hash": -8294627334888914000,
"line_mean": 33.1666666667,
"line_max": 80,
"alpha_frac": 0.5756097561,
"autogenerated": false,
"ratio": 3.455056179775281,
"config_test": false... |
__author__ = 'anuvrat'
"""
Problem: http://www.spoj.com/problems/ACS/
"""
if __name__ == '__main__':
rows = [x for x in range(1234)]
columns = [x for x in range(5678)]
try:
entry = raw_input()
while entry:
command = entry.split()
if command[0] == 'R':
... | {
"repo_name": "anuvrat/spoj",
"path": "problems/classical/acs.py",
"copies": "1",
"size": "1028",
"license": "mit",
"hash": -6960644796639814000,
"line_mean": 29.2352941176,
"line_max": 78,
"alpha_frac": 0.4270428016,
"autogenerated": false,
"ratio": 3.2738853503184715,
"config_test": false,
... |
__author__ = 'apatti'
import getopt
from sys import exit,argv
from readData import getAverageQuantity,getPreviousDayErrorRate,storePredictedValue
def getQuantityValue(date,school):
average = getAverageQuantity(date,school)
errorRate = getPreviousDayErrorRate(date)
prediction = average*errorRate
store... | {
"repo_name": "prashishh/musichackday",
"path": "model/predictIndentQuantity.py",
"copies": "3",
"size": "1063",
"license": "cc0-1.0",
"hash": -8570101341501990000,
"line_mean": 24.9512195122,
"line_max": 83,
"alpha_frac": 0.6058325494,
"autogenerated": false,
"ratio": 3.627986348122867,
"confi... |
__author__ = 'apatti'
class fwrapper:
def __init__(self, function, childcount, name):
self.function = function
self.childcount = childcount
self.name = name
class node:
def __init__(self, fw, children):
self.function = fw.function
self.children = children
sel... | {
"repo_name": "apatti/apatti_ml",
"path": "genetic_programing/gptree.py",
"copies": "1",
"size": "1038",
"license": "mit",
"hash": 2438494341723220000,
"line_mean": 19.76,
"line_max": 60,
"alpha_frac": 0.5741811175,
"autogenerated": false,
"ratio": 3.6167247386759582,
"config_test": false,
"h... |
__author__ = 'apatti'
from matplotlib import pyplot as plt
import numpy as np
class MultiPanelPlot:
@staticmethod
def insetPlot():
"""
The add_axes method allows you to create an axes instance by specifying the size relative to the figure edges.
The argument is [left, bottom, width, h... | {
"repo_name": "apatti/apatti_ml",
"path": "python_data_examples/matplot_example.py",
"copies": "1",
"size": "2311",
"license": "mit",
"hash": 5859317978782247000,
"line_mean": 31.1111111111,
"line_max": 141,
"alpha_frac": 0.5716140199,
"autogenerated": false,
"ratio": 3.329971181556196,
"config... |
__author__ = 'apatti'
import numpy as np
class sModel:
def __init__(self):
self.__table = np.zeros(shape=(3, 3, 3, 3), dtype=int)
self.__tofill = range(0, 81)
self.__possiblenumbers={}
def display(self):
#print self.__table
print self.__table[0,0,0,:],self.__table[0,... | {
"repo_name": "apatti/apatti_ml",
"path": "sudoku/model.py",
"copies": "1",
"size": "4410",
"license": "mit",
"hash": 6245762479828066000,
"line_mean": 36.0672268908,
"line_max": 93,
"alpha_frac": 0.5585034014,
"autogenerated": false,
"ratio": 3.458823529411765,
"config_test": false,
"has_no_... |
__author__ = 'apatti'
import requests
from lxml import html
import csv
class BowlerScrapper:
@staticmethod
def scrap(matchUrl):
print "Working on {}".format(matchUrl)
inningData ={}
for innings in [1,2]:
url = "http://www.espncricinfo.com{}?innings={};view=commentary".form... | {
"repo_name": "apatti/cricstat",
"path": "cricscrapper/bowler.py",
"copies": "2",
"size": "3687",
"license": "mit",
"hash": -4638719609255339000,
"line_mean": 44.5308641975,
"line_max": 159,
"alpha_frac": 0.5977759696,
"autogenerated": false,
"ratio": 3.636094674556213,
"config_test": false,
... |
__author__ = 'apatti'
import unittest
from gptree import fwrapper, constnode, node, paramnode
class gbtree_test_case(unittest.TestCase):
def test_complex_tree(self):
print 'test_complex_tree'
def iffunc(i):
if i[0] > 0:
return i[1]
else:
re... | {
"repo_name": "apatti/apatti_ml",
"path": "genetic_programing/gptree_unit_test.py",
"copies": "1",
"size": "1029",
"license": "mit",
"hash": -7665151400587928000,
"line_mean": 26.0789473684,
"line_max": 69,
"alpha_frac": 0.491739553,
"autogenerated": false,
"ratio": 3.3517915309446256,
"config_... |
__author__ = 'apatti'
#tutorial from kaggle
#introduction to NLP
import pandas as pd
from bs4 import BeautifulSoup
import re
import nltk
nltk.download()
from nltk.corpus import stopwords
def review_to_words(review_text):
#remove html
review_text = BeautifulSoup.get_text(review_text)
#remove puntuation ... | {
"repo_name": "apatti/apatti_ml",
"path": "kaggle/bag_of_words/BagOfWords.py",
"copies": "1",
"size": "1564",
"license": "mit",
"hash": -5858346239414024000,
"line_mean": 23.8253968254,
"line_max": 105,
"alpha_frac": 0.6739130435,
"autogenerated": false,
"ratio": 3.5707762557077625,
"config_tes... |
__author__ = 'apg'
#import copy
import cProfile
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
print '%r took %2.2f sec' % \
(method.__name__, te - ts)
return result
return timed
c... | {
"repo_name": "amitgardharia/codekata",
"path": "alphameticoo.py",
"copies": "1",
"size": "5105",
"license": "unlicense",
"hash": 6917707663163828000,
"line_mean": 33.04,
"line_max": 117,
"alpha_frac": 0.5077375122,
"autogenerated": false,
"ratio": 3.4539918809201624,
"config_test": false,
"h... |
import wx
import sys
## make sure the windows is focused than press any button, and the program will move a plate. keep ## pressing until the problem is solved
## by default it will display 5 plates. To change this, you have to call the script with a second ## argument, wich is the number of plates (max 10)
def g... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577511_Hanoi_Towers_solver_wxPython/recipe-577511.py",
"copies": "1",
"size": "3977",
"license": "mit",
"hash": 5366395803616002000,
"line_mean": 31.867768595,
"line_max": 150,
"alpha_frac": 0.543122957,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'apoorva'
from py2neo.database import Record
from graph_stix.config import stixGraph
from pandas import DataFrame as df
def getIPInfo(ipaddr):
result = df(stixGraph.run("MATCH (a:ObservableNode) WHERE a.AddressValue={x} RETURN a.ObservableID, a.ObjectID, a.IndicatorID",
... | {
"repo_name": "arangaraju/graph-stix",
"path": "webDemo/model.py",
"copies": "1",
"size": "1599",
"license": "mit",
"hash": 8318012064140282000,
"line_mean": 39,
"line_max": 167,
"alpha_frac": 0.6485303315,
"autogenerated": false,
"ratio": 3.1663366336633665,
"config_test": false,
"has_no_key... |
__author__ = 'apoorva'
import sys
from pprint import pprint
from datetime import datetime
from lxml import etree
try:
# python-stix : Used in initial parsing, only to get stix file as a dictionary
from stix.core import STIXPackage
from stix.coa import CourseOfAction
from cybox.bindings.file_object imp... | {
"repo_name": "arangaraju/graph-stix",
"path": "graph_stix/graph_sticks.py",
"copies": "1",
"size": "62613",
"license": "mit",
"hash": 8544116483894264000,
"line_mean": 53.97190518,
"line_max": 240,
"alpha_frac": 0.607557536,
"autogenerated": false,
"ratio": 4.045290089158806,
"config_test": fa... |
__author__ = 'aprocysanae'
#coding: utf-8
import re
from abc import ABCMeta, abstractmethod
class Token(object):
EOL = '\n'
def __init__(self, line_number):
self.current_line = line_number
def is_identifier(self):
return False
def is_number(self):
return False
def is_str... | {
"repo_name": "SeavantUUz/Shyaru",
"path": "archive/old/tokens.py",
"copies": "1",
"size": "1812",
"license": "mit",
"hash": -3431961005126009300,
"line_mean": 19.8275862069,
"line_max": 47,
"alpha_frac": 0.5656732892,
"autogenerated": false,
"ratio": 3.775,
"config_test": false,
"has_no_keyw... |
__author__ = 'aram'
from userLogin import *
from dataBase import *
from operations import *
sys.path.insert(0, '../graphics')
from graphicController import *
import os.path, random
#This class will be the one that controls
#the inputs and outputs for the user interface.
print("Hello Worker! Welcome to ContablePlus!... | {
"repo_name": "aramusss/contableplus",
"path": "controller/userInterface.py",
"copies": "1",
"size": "3036",
"license": "apache-2.0",
"hash": 1463559889084886800,
"line_mean": 36.0365853659,
"line_max": 83,
"alpha_frac": 0.6040843215,
"autogenerated": false,
"ratio": 3.927554980595084,
"config_... |
__author__ = 'aram'
import turtle
import datetime
#DNI;IBAN;DATE(24/02/2014);+/-IMPORT
class GraphicController:
def showGrapicWithDNI(self, inputIban):
filePath = "../database/log.txt"
actualMoney = 0
maxMoney = 0
minMoney = 0
startDate = datetime.datetime(2014, 1, 1)
... | {
"repo_name": "aramusss/contableplus",
"path": "graphics/graphicController.py",
"copies": "1",
"size": "1990",
"license": "apache-2.0",
"hash": -1486351289620722400,
"line_mean": 25.9054054054,
"line_max": 68,
"alpha_frac": 0.4924623116,
"autogenerated": false,
"ratio": 3.8640776699029127,
"con... |
__author__ = 'Arana Fireheart'
lowestLow = 200
lowestLowYear = 0
highestHigh = -200
highestHighYear = 0
try:
with open('testfile1.txt', 'r') as testFileHandle:
header = testFileHandle.readline()
for line in testFileHandle.readlines():
temperatures = line.strip().split('\t')
... | {
"repo_name": "NewburyCS/StudentExamples",
"path": "fileReadWrite1.py",
"copies": "1",
"size": "1196",
"license": "mit",
"hash": 421741106269951170,
"line_mean": 41.75,
"line_max": 134,
"alpha_frac": 0.6287625418,
"autogenerated": false,
"ratio": 4,
"config_test": false,
"has_no_keywords": fa... |
__author__ = 'arana'
from datetime import datetime
class Person(object):
def __init__(self, startingName):
self.name = startingName
self.dateOfBirth = datetime.date(datetime.now())
self.age = datetime.date(datetime.now()) - self.dateOfBirth
self.height = 0
self.weight = 0
... | {
"repo_name": "NewburyCS/StudentExamples",
"path": "Person.py",
"copies": "1",
"size": "2500",
"license": "mit",
"hash": 5124461137187543000,
"line_mean": 22.8095238095,
"line_max": 161,
"alpha_frac": 0.6352,
"autogenerated": false,
"ratio": 3.4059945504087192,
"config_test": false,
"has_no_k... |
__author__ = 'arash'
import copy
import logging
import asyncio
import ssl
import pickle
from message_types import ackknowledgment
from message_types import measurement_msg
from message_types import requests
_logger = logging.getLogger(__name__)
def create_ssl_context(certfile, keyfile, root_pem):
"""
Creat... | {
"repo_name": "i13tum/i13monserver",
"path": "server.py",
"copies": "2",
"size": "8954",
"license": "mit",
"hash": -6250001729452612000,
"line_mean": 35.2510121457,
"line_max": 113,
"alpha_frac": 0.5771722135,
"autogenerated": false,
"ratio": 4.241591662719091,
"config_test": false,
"has_no_k... |
from selenium import webdriver
import os
import getpass
import json
from selenium.common.exceptions import WebDriverException, NoSuchElementException
home_path = os.getenv('HOME')
base_path = home_path + os.sep + '.nfw'
try:
input = raw_input
except NameError:
pass
if not os.path.exists(base_path):
os.... | {
"repo_name": "Aravind-Suresh/nfw-access-iitm",
"path": "main.py",
"copies": "1",
"size": "4181",
"license": "mit",
"hash": 3599964512201232000,
"line_mean": 34.735042735,
"line_max": 115,
"alpha_frac": 0.5462807941,
"autogenerated": false,
"ratio": 4.012476007677543,
"config_test": false,
"h... |
"""
Monte Carlo estimation of value functions for BlackJack for a given policy
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import axes3d
import sys
CARDS_LIST = ['A'] + map(str, range(2, 11)) + map(str, [10]*3)
ACTIONS = ['H', 'S']
tr = []
init = True
M... | {
"repo_name": "Aravind-Suresh/rl-trials",
"path": "chapter-5/example-5.1/main.py",
"copies": "1",
"size": "3656",
"license": "mit",
"hash": 760592212909890400,
"line_mean": 21.1575757576,
"line_max": 74,
"alpha_frac": 0.5183260394,
"autogenerated": false,
"ratio": 2.8742138364779874,
"config_te... |
"""
Monte Carlo control with Exploring starts for BlackJack
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import axes3d
import sys
CARDS_LIST = ['A'] + map(str, range(2, 11)) + map(str, [10]*3)
ACTIONS = ['H', 'S']
init = True
MAX_ITER = 10000#*50
iter = ... | {
"repo_name": "Aravind-Suresh/rl-trials",
"path": "chapter-5/example-5.3/main.py",
"copies": "1",
"size": "4234",
"license": "mit",
"hash": 6331226023374175000,
"line_mean": 21.8864864865,
"line_max": 89,
"alpha_frac": 0.5075578649,
"autogenerated": false,
"ratio": 2.7565104166666665,
"config_t... |
__author__ = 'Archana V Menon, Sujith V'
def vertex_cover(G):
"""
Finds a 2-approximation for a minimal vertex cover of the specified
graph. The algorithm promises a cover that is at most double the size
of a minimal cover. The algorithm takes O(|E|) time.
http://en.wikipedia.org/wiki/Vertex_cove... | {
"repo_name": "sujithvm/skynet",
"path": "code/approximate_vertex_cover.py",
"copies": "1",
"size": "1837",
"license": "mit",
"hash": 8934462671471336000,
"line_mean": 20.6117647059,
"line_max": 73,
"alpha_frac": 0.5797495917,
"autogenerated": false,
"ratio": 3.566990291262136,
"config_test": f... |
__author__ = 'Archana V Menon, Sujith V'
from approximate_vertex_cover import vertex_cover
def seed():
# get graph
from read_graph import read_graph
G = read_graph("data/CA-GrQc.txt")
print "Number of nodes: ", len(G.nodes())
v=vertex_cover(G)
v10=[]
for i in range(0,10,1):
v10... | {
"repo_name": "sujithvm/skynet",
"path": "code/spread.py",
"copies": "1",
"size": "1691",
"license": "mit",
"hash": 6594275640039391000,
"line_mean": 23.1714285714,
"line_max": 108,
"alpha_frac": 0.6002365464,
"autogenerated": false,
"ratio": 3.0914076782449724,
"config_test": false,
"has_no_... |
__author__ = 'Archana V Menon, Sujith V'
from test_graphs import test_graph2
from approximate_dominating_set import dominating_set
from fibonacci import fibonacci
# get graph
G = test_graph2()
# find approximate vertex cover
vertex_cover = dominating_set(G)
# generate fibonacci series
fib = fibonacci(len(vertex_cov... | {
"repo_name": "sujithvm/skynet",
"path": "code/clone.py",
"copies": "1",
"size": "1240",
"license": "mit",
"hash": 6973469797583474000,
"line_mean": 20.0169491525,
"line_max": 84,
"alpha_frac": 0.6758064516,
"autogenerated": false,
"ratio": 3.2291666666666665,
"config_test": false,
"has_no_ke... |
__author__ = 'Archana V Menon, Sujith V'
import networkx as nx
from approximate_dominating_set import dominating_set
from approximate_vertex_cover import vertex_cover
from random import choice
from random import randint
from pso import pso
BENEFIT_LOWER = 30
BENEFIT_UPPER = 70
COST_LOWER = 20
COST_UPPER = 50
OPT_B... | {
"repo_name": "sujithvm/skynet",
"path": "code/seeding_pso.py",
"copies": "1",
"size": "4181",
"license": "mit",
"hash": -8079048116457714000,
"line_mean": 21.722826087,
"line_max": 110,
"alpha_frac": 0.5850275054,
"autogenerated": false,
"ratio": 2.915620641562064,
"config_test": false,
"has... |
__author__ = 'Archana V Menon, Sujith V'
import networkx as nx
from approximate_dominating_set import dominating_set
from approximate_vertex_cover import vertex_cover
from random import choice
'''
type :
1 - dominating set
2 - vertex cover
3 - pso
4 - random
'''
def seed(G, type):
current_infec... | {
"repo_name": "sujithvm/skynet",
"path": "code/seeding.py",
"copies": "1",
"size": "2726",
"license": "mit",
"hash": -8806401143688628000,
"line_mean": 24.2407407407,
"line_max": 110,
"alpha_frac": 0.5950110051,
"autogenerated": false,
"ratio": 3.1734575087310826,
"config_test": false,
"has_n... |
__author__ = 'Archana V Menon, Sujith V'
import networkx as nx
import matplotlib.pyplot as plt
def draw_graph(G, nodes_list1, nodes_list2, edge_list1, edge_list2):
"""
This function is used to draw graphs
:param G: networkx graph
:param nodes_list1: list of nodes
:param nodes_list2: list of nod... | {
"repo_name": "sujithvm/skynet",
"path": "code/draw_graph.py",
"copies": "1",
"size": "1349",
"license": "mit",
"hash": 2388437118848211500,
"line_mean": 24.9423076923,
"line_max": 86,
"alpha_frac": 0.6434395849,
"autogenerated": false,
"ratio": 2.8280922431865827,
"config_test": false,
"has_... |
__author__ = 'Archana V Menon, Sujith V'
def approximate_set_cover(sets):
"""
Find approximate set cover for a list of sets
:param sets: list of sets
:return: set cover
:raise ValueError: when list of sets is null
"""
if not sets:
raise ValueError("Error : Empty list of sets")
... | {
"repo_name": "sujithvm/skynet",
"path": "code/approximate_set_cover.py",
"copies": "1",
"size": "1143",
"license": "mit",
"hash": 956742298919094000,
"line_mean": 18.3728813559,
"line_max": 54,
"alpha_frac": 0.4978127734,
"autogenerated": false,
"ratio": 3.322674418604651,
"config_test": false... |
__author__ = 'Archana V Menon, Sujith V'
def dominating_set(G):
"""
Finds a greedy approximation for a minimal vertex cover of a specified
graph. At each iteration, the algorithm picks the vertex with the
highest degree and adds it to the cover, until all edges are covered.
:param G: networkx gr... | {
"repo_name": "sujithvm/skynet",
"path": "code/approximate_dominating_set.py",
"copies": "1",
"size": "1633",
"license": "mit",
"hash": -2566313254082010000,
"line_mean": 21.6944444444,
"line_max": 74,
"alpha_frac": 0.6111451317,
"autogenerated": false,
"ratio": 3.7113636363636364,
"config_test... |
__author__ = 'ArchBang'
### A stab at a spell system ###
# The idea is that you need at least 3 letters to form a workable spell
# one vowel must be included, this designates something about the spell
# perhaps its type (create rock, summon ally, etc)
# or its form (line, area, self, spot, nearest, everywhere)
# a, e... | {
"repo_name": "ArchBang85/S_Crimson",
"path": "Vallat.py",
"copies": "1",
"size": "4776",
"license": "apache-2.0",
"hash": -3850972031202221600,
"line_mean": 25.9830508475,
"line_max": 87,
"alpha_frac": 0.5789363484,
"autogenerated": false,
"ratio": 3.478514202476329,
"config_test": false,
"h... |
__author__ = 'archen'
# Core Django imports
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
# Third party imports
# App-specific imports
from mantises import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
# Mantis URLs
url(r'... | {
"repo_name": "archen/mantistrack",
"path": "mantistrack/mantises/urls.py",
"copies": "1",
"size": "1745",
"license": "mit",
"hash": -2667998183315673600,
"line_mean": 44.9473684211,
"line_max": 105,
"alpha_frac": 0.635530086,
"autogenerated": false,
"ratio": 2.7567140600315954,
"config_test": ... |
__author__ = 'archen'
# Core Django imports
from django import forms
# Third party imports
from datetimewidget.widgets import DateTimeWidget
# App-specific imports
from mantises.models import Mantis, Breed, Molt, Ooth
class MantisForm(forms.ModelForm):
class Meta:
model = Mantis
fields = ('name... | {
"repo_name": "archen/mantistrack",
"path": "mantistrack/mantises/forms.py",
"copies": "1",
"size": "1267",
"license": "mit",
"hash": 5692427383241126000,
"line_mean": 26.5652173913,
"line_max": 118,
"alpha_frac": 0.588792423,
"autogenerated": false,
"ratio": 3.549019607843137,
"config_test": f... |
__author__ = 'Archon_ren'
import json
from gensim.models import Word2Vec
from gensim import matutils
from numpy import float32 as REAL,array
class patchdata(object):
def __init__(self,model_path,patch_patch,verbosity):
self.patch_path = patch_patch
self.user_data = {}
self.tag_data = []
... | {
"repo_name": "archonren/similarity",
"path": "patch.py",
"copies": "1",
"size": "2347",
"license": "apache-2.0",
"hash": -4325610464215146500,
"line_mean": 32.0563380282,
"line_max": 103,
"alpha_frac": 0.5317426502,
"autogenerated": false,
"ratio": 3.7372611464968153,
"config_test": false,
"... |
__author__ = 'Archon_ren'
import json,pickle
from gensim.models import Word2Vec
from gensim import matutils
from numpy import float32 as REAL,array,shape,str,zeros
from scivq import *
from scipy.stats.stats import pearsonr
class user(object):
def __init__(self,user_dict):
self.id = user_dict['id']
... | {
"repo_name": "archonren/similarity",
"path": "design_group.py",
"copies": "1",
"size": "8532",
"license": "apache-2.0",
"hash": -8498851844953210000,
"line_mean": 37.09375,
"line_max": 148,
"alpha_frac": 0.5094936709,
"autogenerated": false,
"ratio": 3.7819148936170213,
"config_test": false,
... |
__author__ = 'ardevelop'
import os
import sys
import pwd
import grp
import time
import signal
import fcntl
import threading
import multiprocessing
import argparse
#region constants
ERROR_MESSAGE_PATTERN = "ERROR: %s\n"
WARNING_MESSAGE_PATTERN = "WARNING: %s\n"
START = "start"
STOP = "stop"
RESTART = "restart"
INSTAL... | {
"repo_name": "ardevelop/ardaemon",
"path": "ardaemon/__init__.py",
"copies": "1",
"size": "10763",
"license": "mit",
"hash": 5975705047077450000,
"line_mean": 26.8139534884,
"line_max": 120,
"alpha_frac": 0.5519836477,
"autogenerated": false,
"ratio": 3.7488679902473008,
"config_test": false,
... |
__author__ = 'ardevelop'
import struct
import zlib
import cStringIO
read_ui8 = lambda c: struct.unpack("<B", c)[0]
read_ui16 = lambda c: struct.unpack("<H", c)[0]
read_ui32 = lambda c: struct.unpack("<I", c)[0]
def from_stream(stream):
metadata = {}
signature = "".join(struct.unpack("<3c", stream.read(3)))... | {
"repo_name": "ardevelop/arswf",
"path": "arswf/__init__.py",
"copies": "1",
"size": "2189",
"license": "mit",
"hash": 5601663334607820000,
"line_mean": 26.7215189873,
"line_max": 66,
"alpha_frac": 0.5577889447,
"autogenerated": false,
"ratio": 3.5024,
"config_test": false,
"has_no_keywords":... |
__author__ = 'Areg'
import random
index = 0
def InsertionSort(InputArray):
for j in range(1, len(InputArray), 1):
key = InputArray[j]
i = j-1
while (InputArray[i] < key) and (i >= 0):
InputArray[i+1] = InputArray[i]
i = i - 1
InputArray[i+1] = key
fo... | {
"repo_name": "Arnukk/DAA",
"path": "main.py",
"copies": "1",
"size": "6606",
"license": "mit",
"hash": 1309539648214479400,
"line_mean": 27.6017316017,
"line_max": 50,
"alpha_frac": 0.4831970936,
"autogenerated": false,
"ratio": 2.983739837398374,
"config_test": false,
"has_no_keywords": fal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.