text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'a_medelyan'
import os
# class to hold our test instance (document plus its correct manual keywords)
class TestDoc:
def __init__(self, name):
self.name = name
self.text = ''
self.keywords = []
# reading documents and their keywords from a directory
def read_data(input_dir):
... | {
"repo_name": "azhar3339/RAKE-tutorial",
"path": "test_data.py",
"copies": "7",
"size": "1260",
"license": "mit",
"hash": -4995581503702450000,
"line_mean": 25.2708333333,
"line_max": 77,
"alpha_frac": 0.5357142857,
"autogenerated": false,
"ratio": 3.7837837837837838,
"config_test": true,
"ha... |
__author__ = 'a_medelyan'
import test_data
import rake
import sys
# reading a directory with test documents
input_dir = sys.argv[1]
# number of top ranked keywords to evaluate
top = int(sys.argv[2])
test_set = test_data.read_data(input_dir)
best_fmeasure = 0
best_vals = []
for min_char_length in range(3,8):
for... | {
"repo_name": "beallej/event-detection",
"path": "Keywords_Wordnet/RAKEtutorialmaster/optimize_rake.py",
"copies": "1",
"size": "1811",
"license": "mit",
"hash": -8717904885476824000,
"line_mean": 33.1886792453,
"line_max": 114,
"alpha_frac": 0.5875207068,
"autogenerated": false,
"ratio": 3.64386... |
__author__ = 'a_medelyan'
import rake
import operator
import sys
# EXAMPLE ONE - SIMPLE
stoppath = "SmartStoplist.txt"
# 1. initialize RAKE by providing a path to a stopwords file
rake_object = rake.Rake(stoppath, 5, 3, 4)
# 2. run on RAKE on a given text
sample_file = open(sys.argv[1], 'r')
text = sample_file.read... | {
"repo_name": "geoff111/AnnualReports",
"path": "RAKE-tutorial/rake_tutorial.py",
"copies": "1",
"size": "2312",
"license": "mit",
"hash": -1114474855520476400,
"line_mean": 35.125,
"line_max": 120,
"alpha_frac": 0.7525951557,
"autogenerated": false,
"ratio": 3.729032258064516,
"config_test": f... |
__author__ = 'a_medelyan'
import rake
import operator
# EXAMPLE ONE - SIMPLE
stoppath = "SmartStoplist.txt"
# 1. initialize RAKE by providing a path to a stopwords file
rake_object = rake.Rake(stoppath, 5, 3, 4)
# 2. run on RAKE on a given text
# sample_file = open("data/docs/fao_test/w2167e.txt", 'r')
sample_file ... | {
"repo_name": "scorpiovn/RAKE-tutorial",
"path": "rake_tutorial.py",
"copies": "1",
"size": "2433",
"license": "mit",
"hash": -731747729208282800,
"line_mean": 37.015625,
"line_max": 122,
"alpha_frac": 0.7464036169,
"autogenerated": false,
"ratio": 3.6044444444444443,
"config_test": false,
"h... |
__author__ = 'Ameen Tayyebi'
from preprocessor import *
class Generator:
# Whitespace character used to indent the output (switch to tab if desired)
indent_white_space = ' '
output_file_path = ""
module_name = ""
preprocessed_classes = []
preprocessed_enums = []
def __init__(self, pr... | {
"repo_name": "ameent/c2t",
"path": "generator.py",
"copies": "1",
"size": "4780",
"license": "apache-2.0",
"hash": 1536937414946798800,
"line_mean": 33.6449275362,
"line_max": 112,
"alpha_frac": 0.5849372385,
"autogenerated": false,
"ratio": 3.966804979253112,
"config_test": false,
"has_no_k... |
__author__ = 'Ameen Tayyebi'
import CppHeaderParser
import re
class Preprocessor:
# Methods that need to be ignored will be renamed to this string
ignore_tag = '____ignore____'
headers = []
module_name = ""
def __init__(self, module_name):
self.module_name = module_name
def add_hea... | {
"repo_name": "ameent/c2t",
"path": "preprocessor.py",
"copies": "1",
"size": "8512",
"license": "apache-2.0",
"hash": 5977455937693071000,
"line_mean": 35.6896551724,
"line_max": 114,
"alpha_frac": 0.5659069549,
"autogenerated": false,
"ratio": 4.387628865979382,
"config_test": false,
"has_n... |
__author__ = 'Ameen Tayyebi'
import os
import CppHeaderParser
from preprocessor import *
from generator import *
class Translator:
# List of header parsers
parsers = []
# Name of output file to produce
output_file_name = ""
# Location of header files to be parsed
header_folder = ""
# ... | {
"repo_name": "ameent/c2t",
"path": "translator.py",
"copies": "1",
"size": "3483",
"license": "apache-2.0",
"hash": -837560373749029500,
"line_mean": 32.8252427184,
"line_max": 122,
"alpha_frac": 0.6299167384,
"autogenerated": false,
"ratio": 4.517509727626459,
"config_test": false,
"has_no_... |
__author__ = 'amelie'
from copy import deepcopy
import numpy
from preimage.utils.alphabet import get_index_to_n_gram
from preimage.exceptions.n_gram import InvalidNGramLengthError, InvalidYLengthError, NoThresholdsError
from preimage.exceptions.shape import InvalidShapeError
class EulerianPath:
"""Eulerian pat... | {
"repo_name": "a-ro/preimage",
"path": "preimage/inference/euler.py",
"copies": "1",
"size": "10176",
"license": "bsd-2-clause",
"hash": 454338347416798900,
"line_mean": 47.2322274882,
"line_max": 120,
"alpha_frac": 0.6411163522,
"autogenerated": false,
"ratio": 3.657800143781452,
"config_test"... |
__author__ = 'amelie'
from itertools import product
import numpy
from preimage.exceptions.n_gram import InvalidNGramLengthError
class Alphabet:
latin = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z']
def get_n_gra... | {
"repo_name": "a-ro/preimage",
"path": "preimage/utils/alphabet.py",
"copies": "1",
"size": "1331",
"license": "bsd-2-clause",
"hash": -2887639538992597000,
"line_mean": 28.6,
"line_max": 117,
"alpha_frac": 0.6033057851,
"autogenerated": false,
"ratio": 2.7330595482546203,
"config_test": false,... |
__author__ = 'amelie'
from math import sqrt
import unittest2
import numpy.testing
from mock import patch
from preimage.kernels.generic_string import GenericStringKernel, element_wise_kernel
class TestGenericStringKernel(unittest2.TestCase):
def setUp(self):
self.setup_alphabet()
self.setup_posi... | {
"repo_name": "a-ro/preimage",
"path": "preimage/tests/kernels/test_generic_string.py",
"copies": "1",
"size": "11366",
"license": "bsd-2-clause",
"hash": -2260100661746290200,
"line_mean": 51.8697674419,
"line_max": 119,
"alpha_frac": 0.6679570649,
"autogenerated": false,
"ratio": 3.334115576415... |
__author__ = 'amelie'
from preimage.features.gs_feature_space import GenericStringFeatureSpace
from preimage.models.model import Model
from preimage.inference.graph_builder import GraphBuilder
from preimage.inference.branch_and_bound import branch_and_bound, branch_and_bound_no_length
from preimage.inference.bound_fac... | {
"repo_name": "a-ro/preimage",
"path": "preimage/models/generic_string_model.py",
"copies": "1",
"size": "3049",
"license": "bsd-2-clause",
"hash": -964787651570508200,
"line_mean": 53.4642857143,
"line_max": 113,
"alpha_frac": 0.6247950148,
"autogenerated": false,
"ratio": 3.700242718446602,
"... |
__author__ = 'amelie'
from preimage.features.n_gram_feature_space import NGramFeatureSpace
from preimage.models.model import Model
from preimage.inference.graph_builder import GraphBuilder
from preimage.inference.branch_and_bound import branch_and_bound, branch_and_bound_no_length
from preimage.inference.bound_factory... | {
"repo_name": "a-ro/preimage",
"path": "preimage/models/n_gram_model.py",
"copies": "1",
"size": "2887",
"license": "bsd-2-clause",
"hash": -4681046931271861000,
"line_mean": 51.5090909091,
"line_max": 115,
"alpha_frac": 0.6172497402,
"autogenerated": false,
"ratio": 3.6452020202020203,
"config... |
__author__ = 'amelie'
from preimage.features.weighted_degree_feature_space import WeightedDegreeFeatureSpace
from preimage.inference.graph_builder import GraphBuilder
from preimage.models.model import Model
class WeightedDegreeModel(Model):
def __init__(self, alphabet, n, is_using_length=True):
self._gra... | {
"repo_name": "a-ro/preimage",
"path": "preimage/models/weighted_degree_model.py",
"copies": "1",
"size": "1987",
"license": "bsd-2-clause",
"hash": 3192388092389131300,
"line_mean": 46.3333333333,
"line_max": 117,
"alpha_frac": 0.6240563664,
"autogenerated": false,
"ratio": 3.880859375,
"confi... |
__author__ = 'amelie'
from sklearn.base import BaseEstimator
from preimage.inference.graph_builder import GraphBuilder
from preimage.inference.branch_and_bound import branch_and_bound_multiple_solutions
from preimage.inference.bound_factory import get_gs_similarity_node_creator
from preimage.features.gs_similarity_fe... | {
"repo_name": "a-ro/preimage",
"path": "preimage/models/string_max_model.py",
"copies": "1",
"size": "1669",
"license": "bsd-2-clause",
"hash": -5382630819978568000,
"line_mean": 48.1176470588,
"line_max": 114,
"alpha_frac": 0.6279209107,
"autogenerated": false,
"ratio": 4.070731707317073,
"con... |
__author__ = 'amelie'
from sklearn.kernel_ridge import KernelRidge
from preimage.datasets.loader import load_bpps_dataset, AminoAcidFile
from preimage.kernels.generic_string import GenericStringKernel
from preimage.models.string_max_model import StringMaximizationModel
if __name__ == '__main__':
# Best paramete... | {
"repo_name": "a-ro/preimage",
"path": "preimage/examples/peptide_bpps.py",
"copies": "1",
"size": "1727",
"license": "bsd-2-clause",
"hash": -5205383543192448000,
"line_mean": 36.5652173913,
"line_max": 109,
"alpha_frac": 0.7017950203,
"autogenerated": false,
"ratio": 3.6511627906976742,
"conf... |
__author__ = 'amelie'
from sklearn.kernel_ridge import KernelRidge
from preimage.datasets.loader import load_camps_dataset, AminoAcidFile
from preimage.kernels.generic_string import GenericStringKernel
from preimage.models.string_max_model import StringMaximizationModel
if __name__ == '__main__':
# Best paramet... | {
"repo_name": "a-ro/preimage",
"path": "preimage/examples/peptide_camps.py",
"copies": "1",
"size": "1731",
"license": "bsd-2-clause",
"hash": 5851986476180057000,
"line_mean": 36.652173913,
"line_max": 109,
"alpha_frac": 0.703061814,
"autogenerated": false,
"ratio": 3.6829787234042555,
"config... |
__author__ = 'amelie'
import abc
from sklearn.base import BaseEstimator
import numpy
from preimage.exceptions.n_gram import NoYLengthsError
class Model(BaseEstimator):
__metaclass__ = abc.ABCMeta
def __init__(self, alphabet, n, is_using_length=True):
self._n = n
self._alphabet = alphabet
... | {
"repo_name": "a-ro/preimage",
"path": "preimage/models/model.py",
"copies": "1",
"size": "1092",
"license": "bsd-2-clause",
"hash": 782442731200210600,
"line_mean": 28.5405405405,
"line_max": 95,
"alpha_frac": 0.6401098901,
"autogenerated": false,
"ratio": 3.466666666666667,
"config_test": fal... |
__author__ = 'amelie'
import numpy
from preimage.features.gs_similarity_weights import compute_gs_similarity_weights
from preimage.utils.alphabet import transform_strings_to_integer_lists, get_n_grams
# Shouldn't label this as "feature-space" since we don't use a sparse matrix representation here.
class GenericStrin... | {
"repo_name": "a-ro/preimage",
"path": "preimage/features/gs_similarity_feature_space.py",
"copies": "1",
"size": "2709",
"license": "bsd-2-clause",
"hash": 8423391177972769000,
"line_mean": 42.7096774194,
"line_max": 116,
"alpha_frac": 0.6474713917,
"autogenerated": false,
"ratio": 3.97797356828... |
__author__ = 'amelie'
import numpy
from scipy import linalg
from sklearn.base import BaseEstimator
class StructuredKernelRidgeRegression(BaseEstimator):
"""Structured Kernel Ridge Regression.
Attributes
----------
alpha : float
Regularization term.
kernel : Callable
Kernel functi... | {
"repo_name": "a-ro/preimage",
"path": "preimage/learners/structured_krr.py",
"copies": "1",
"size": "3990",
"license": "bsd-2-clause",
"hash": 7025225755281436000,
"line_mean": 35.9537037037,
"line_max": 115,
"alpha_frac": 0.622556391,
"autogenerated": false,
"ratio": 4.109165808444902,
"confi... |
__author__ = 'amelie'
import numpy
from sklearn.base import BaseEstimator
class PolynomialKernel(BaseEstimator):
"""Polynomial kernel.
Attributes
----------
degree : int
Degree.
bias : float
Bias.
is_normalized : bool
True if the kernel should be normalized, False oth... | {
"repo_name": "a-ro/preimage",
"path": "preimage/kernels/polynomial.py",
"copies": "1",
"size": "2100",
"license": "bsd-2-clause",
"hash": -3924141016036158500,
"line_mean": 36.5178571429,
"line_max": 117,
"alpha_frac": 0.6114285714,
"autogenerated": false,
"ratio": 3.5413153456998314,
"config_... |
__author__ = 'amelie'
import numpy
from preimage.datasets.loader import load_amino_acids_and_descriptors
from preimage.kernels._generic_string import element_wise_generic_string_kernel, generic_string_kernel_with_sigma_c
from preimage.kernels._generic_string import element_wise_generic_string_kernel_with_sigma_c
from... | {
"repo_name": "a-ro/preimage",
"path": "preimage/kernels/generic_string.py",
"copies": "1",
"size": "9418",
"license": "bsd-2-clause",
"hash": 2481450509282818000,
"line_mean": 46.8121827411,
"line_max": 120,
"alpha_frac": 0.6403695052,
"autogenerated": false,
"ratio": 3.842513259893921,
"confi... |
__author__ = 'amelie'
import numpy
from preimage.features.string_feature_space import build_feature_space_without_positions
class NGramFeatureSpace:
"""Output feature space for the N-Gram Kernel
Creates a sparse matrix representation of the n-grams in each training string. This is used to compute the weigh... | {
"repo_name": "a-ro/preimage",
"path": "preimage/features/n_gram_feature_space.py",
"copies": "1",
"size": "2516",
"license": "bsd-2-clause",
"hash": -6160463989368870000,
"line_mean": 35.4782608696,
"line_max": 118,
"alpha_frac": 0.6323529412,
"autogenerated": false,
"ratio": 4.064620355411955,
... |
__author__ = 'amelie'
import numpy
from preimage.features.string_feature_space import build_feature_space_with_positions
from preimage.utils.position import compute_position_weights
from preimage.kernels.generic_string import element_wise_kernel
class GenericStringFeatureSpace:
"""Output feature space for the G... | {
"repo_name": "a-ro/preimage",
"path": "preimage/features/gs_feature_space.py",
"copies": "1",
"size": "4589",
"license": "bsd-2-clause",
"hash": -3927799469521612000,
"line_mean": 44,
"line_max": 120,
"alpha_frac": 0.6513401613,
"autogenerated": false,
"ratio": 3.817803660565724,
"config_test"... |
__author__ = 'amelie'
import numpy
from preimage.features.string_feature_space import build_feature_space_with_positions
class WeightedDegreeFeatureSpace:
"""Output feature space for the Weighted Degree kernel
Creates a sparse matrix representation of the n-grams in each training string. The representation... | {
"repo_name": "a-ro/preimage",
"path": "preimage/features/weighted_degree_feature_space.py",
"copies": "1",
"size": "3801",
"license": "bsd-2-clause",
"hash": 4884380261159694000,
"line_mean": 41.7191011236,
"line_max": 119,
"alpha_frac": 0.6400947119,
"autogenerated": false,
"ratio": 3.752221125... |
__author__ = 'amelie'
import numpy
from preimage.inference.euler import EulerianPath
from preimage.features.n_gram_feature_space import NGramFeatureSpace
from preimage.models.model import Model
from preimage.inference.graph_builder import GraphBuilder
from preimage.utils.alphabet import get_n_gram_to_index, get_n_gra... | {
"repo_name": "a-ro/preimage",
"path": "preimage/models/eulerian_path_model.py",
"copies": "1",
"size": "3854",
"license": "bsd-2-clause",
"hash": 4846979557600620000,
"line_mean": 48.4230769231,
"line_max": 119,
"alpha_frac": 0.6502335236,
"autogenerated": false,
"ratio": 3.4166666666666665,
"... |
__author__ = 'amelie'
import numpy
from preimage.utils.alphabet import get_index_to_n_gram
from preimage.exceptions.shape import InvalidShapeError
from preimage.exceptions.n_gram import InvalidYLengthError, InvalidMinLengthError
class GraphBuilder:
"""Graph builder for the pre-image of multiple string kernels.
... | {
"repo_name": "a-ro/preimage",
"path": "preimage/inference/graph_builder.py",
"copies": "1",
"size": "9729",
"license": "bsd-2-clause",
"hash": 8672618099265572000,
"line_mean": 48.8974358974,
"line_max": 120,
"alpha_frac": 0.6354198787,
"autogenerated": false,
"ratio": 3.6397306397306397,
"con... |
__author__ = 'amelie'
import unittest2
import numpy
import numpy.testing
from mock import patch, Mock
from preimage.models.generic_string_model import GenericStringModel
from preimage.learners.structured_krr import InferenceFitParameters
def branch_and_bound_side_effect(node_creator, y_length, alphabet, max_time):
... | {
"repo_name": "a-ro/preimage",
"path": "preimage/tests/models/test_generic_string_model.py",
"copies": "1",
"size": "4989",
"license": "bsd-2-clause",
"hash": -2732621493150583000,
"line_mean": 45.2037037037,
"line_max": 120,
"alpha_frac": 0.664461816,
"autogenerated": false,
"ratio": 3.295244385... |
__author__ = 'amelie'
import unittest2
import numpy.testing
from mock import patch
from preimage.inference.graph_builder import GraphBuilder
from preimage.exceptions.shape import InvalidShapeError
from preimage.exceptions.n_gram import InvalidYLengthError, InvalidMinLengthError
class TestGraphBuilder(unittest2.Test... | {
"repo_name": "a-ro/preimage",
"path": "preimage/tests/inference/test_graph_builder.py",
"copies": "1",
"size": "15256",
"license": "bsd-2-clause",
"hash": -516558613194166900,
"line_mean": 50.5439189189,
"line_max": 118,
"alpha_frac": 0.6672128998,
"autogenerated": false,
"ratio": 3.173044925124... |
__author__ = 'amelie'
import unittest2
import numpy.testing
from preimage.kernels.polynomial import PolynomialKernel
class TestPolynomialKernel(unittest2.TestCase):
def setUp(self):
self.X_one = [[1, 2]]
self.X_two = [[1, 0], [1, 3]]
self.gram_matrix_degree_one_x_one_x_one = [[5.]]
... | {
"repo_name": "a-ro/preimage",
"path": "preimage/tests/kernels/test_polynomial.py",
"copies": "1",
"size": "2192",
"license": "bsd-2-clause",
"hash": 103531104209910180,
"line_mean": 38.1607142857,
"line_max": 103,
"alpha_frac": 0.6797445255,
"autogenerated": false,
"ratio": 2.9986320109439126,
... |
__author__ = 'amelie'
import unittest2
import numpy.testing
from preimage.utils import alphabet
from preimage.exceptions.n_gram import InvalidNGramLengthError
class TestAlphabet(unittest2.TestCase):
def setUp(self):
self.a_b_alphabet = ['a', 'b']
self.abc_alphabet = ['a', 'b', 'c']
self.... | {
"repo_name": "a-ro/preimage",
"path": "preimage/tests/utils/test_alphabet.py",
"copies": "1",
"size": "3079",
"license": "bsd-2-clause",
"hash": 4831348079894199000,
"line_mean": 38.4871794872,
"line_max": 101,
"alpha_frac": 0.646638519,
"autogenerated": false,
"ratio": 2.869524697110904,
"con... |
__author__ = 'amelie'
class InvalidNGramError(ValueError):
def __init__(self, n, n_gram):
self.n = n
self.n_gram = n_gram
def __str__(self):
error_message = "{} is not a possible {:d}_gram for this alphabet".format(self.n_gram, self.n)
return error_message
class InvalidNGram... | {
"repo_name": "a-ro/preimage",
"path": "preimage/exceptions/n_gram.py",
"copies": "1",
"size": "1580",
"license": "bsd-2-clause",
"hash": 6513612622599046000,
"line_mean": 28.2777777778,
"line_max": 105,
"alpha_frac": 0.5981012658,
"autogenerated": false,
"ratio": 3.4273318872017353,
"config_te... |
__author__ = 'amentis'
from RxAPI import RxObject
class RxGUIObject(RxObject):
""" The main RxGUI class. Used as a superclass for all RxGUI classes"""
def __init__(self, name, parent):
"""
@param parent: RxGUIObject parent object
@param name: str name of the REXI object
"""
... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/RxGUIObject.py",
"copies": "1",
"size": "1243",
"license": "apache-2.0",
"hash": -1302139562896896800,
"line_mean": 30.1,
"line_max": 92,
"alpha_frac": 0.5695897023,
"autogenerated": false,
"ratio": 4.102310231023102,
"config_test": false,
"h... |
__author__ = 'amentis'
from RxAPI.RxGUI import Color, RxGUIObject
class Border(RxGUIObject):
"""
Drawable border for any drawable RxGUIObject.
"""
def __init__(self, name, color=None, style="solid", width="1px"):
"""
@param name: str name of the REXI object
@param color: Color ... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/Border.py",
"copies": "1",
"size": "1108",
"license": "apache-2.0",
"hash": -4780893838523832000,
"line_mean": 34.7741935484,
"line_max": 90,
"alpha_frac": 0.583032491,
"autogenerated": false,
"ratio": 3.7306397306397305,
"config_test": false,
... |
__author__ = 'amentis'
from RxAPI.RxGUI import Event
class KeyEvent(Event):
"""
definition for an event, being called upon keyboard event
"""
def __init__(self, parent, sender, key_name, actions, event_type="keypress", modifiers=""):
"""
@param parent: RxGUIObject parent object
... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/KeyEvent.py",
"copies": "1",
"size": "6916",
"license": "apache-2.0",
"hash": -3538725533437029000,
"line_mean": 41.6975308642,
"line_max": 115,
"alpha_frac": 0.4764314633,
"autogenerated": false,
"ratio": 3.218241042345277,
"config_test": fals... |
__author__ = 'amentis'
from RxAPI.RxGUI import Event
class MouseEvent(Event):
def __init__(self, parent, sender, button_name, modifiers, actions, event_type="click"):
"""
@param parent: RxGUIObject parent object
@param sender: str name of the object sending the event
@param button_... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/MouseEvent.py",
"copies": "1",
"size": "1659",
"license": "apache-2.0",
"hash": -4978891421162307000,
"line_mean": 36.7272727273,
"line_max": 96,
"alpha_frac": 0.5647980711,
"autogenerated": false,
"ratio": 4.232142857142857,
"config_test": fal... |
__author__ = 'amentis'
from RxAPI.RxGUI import *
class Console(Screen):
"""
A simple full-screen command-line user interface
"""
def __init__(self):
Screen.__init__(self, "REXI Console")
self._window = Window(self, 'consoleWindow')
self._output = TextView(self._window, 'output... | {
"repo_name": "amentis/Rexi",
"path": "UI/Console.py",
"copies": "1",
"size": "1625",
"license": "apache-2.0",
"hash": -5375768058629626000,
"line_mean": 44.1666666667,
"line_max": 112,
"alpha_frac": 0.5495384615,
"autogenerated": false,
"ratio": 3.676470588235294,
"config_test": false,
"has_... |
__author__ = 'amentis'
from RxAPI.RxGUI import RxGUIObject
class Color(RxGUIObject):
"""
color definition for wherever such is needed
"""
def __init__(self, name, color="Black"):
"""
@param name: str name of the REXI object
@param color: str color name. Acceptable values - HTML... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/Color.py",
"copies": "1",
"size": "12217",
"license": "apache-2.0",
"hash": 1780007010630904600,
"line_mean": 53.3022222222,
"line_max": 111,
"alpha_frac": 0.6044855529,
"autogenerated": false,
"ratio": 2.892282196969697,
"config_test": false,
... |
__author__ = 'amentis'
from RxAPI.RxGUI import RxGUIObject
class Font(RxGUIObject):
"""
text font definition for wherever such is needed
"""
def __init__(self, parent, name,
family="Arial, sans-serif", style="normal", size="medium", variant="normal",
weight="normal",... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/Font.py",
"copies": "1",
"size": "1721",
"license": "apache-2.0",
"hash": 3252251198082808300,
"line_mean": 41,
"line_max": 100,
"alpha_frac": 0.6095293434,
"autogenerated": false,
"ratio": 3.9563218390804598,
"config_test": false,
"has_no_ke... |
__author__ = 'amentis'
from RxAPI.RxGUI import RxGUIObject, RxDynamic
from RxAPI import RxObject
class Event(RxDynamic, RxGUIObject):
"""
Superclass for different dynamic events
"""
def __init__(self, parent, sender, modifiers, actions, event_type):
"""
@param parent: RxGUIObject pare... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/Event.py",
"copies": "1",
"size": "3191",
"license": "apache-2.0",
"hash": 7075634123362006000,
"line_mean": 29.4,
"line_max": 98,
"alpha_frac": 0.5596991539,
"autogenerated": false,
"ratio": 4.359289617486339,
"config_test": false,
"has_no_k... |
__author__ = 'amentis'
from RxAPI.RxGUI import RxGUIObject, RxDynamic
class Screen(RxGUIObject, RxDynamic):
"""
The main holder for GUI elements. Represents the entire HTML body
"""
def __init__(self, title, body=""):
"""
@param title: str Page __title
@param body: str HTML bo... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/Screen.py",
"copies": "1",
"size": "2033",
"license": "apache-2.0",
"hash": 8306816733274683000,
"line_mean": 24.1111111111,
"line_max": 71,
"alpha_frac": 0.4904082636,
"autogenerated": false,
"ratio": 4.107070707070707,
"config_test": false,
... |
__author__ = 'amentis'
from RxAPI.RxGUI import StylableObject, RxDynamic
class Button(StylableObject, RxDynamic):
"""A button for starting actions on push"""
def __init__(self, parent, name, value="Button"):
"""
@param parent: RxGUIObject parent REXI object
@param name: str name of the... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/Button.py",
"copies": "1",
"size": "2387",
"license": "apache-2.0",
"hash": 3722104164739765000,
"line_mean": 30.4210526316,
"line_max": 110,
"alpha_frac": 0.5295349811,
"autogenerated": false,
"ratio": 3.5206489675516224,
"config_test": false,... |
__author__ = 'amentis'
from RxAPI.RxGUI import StylableObject, RxDynamic
class Window(StylableObject, RxDynamic):
"""
an element holder to organize elements
"""
def __init__(self, parent, name):
"""
@param parent: RxGUIObject parent object
@param name: str name of the REXI obje... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/Window.py",
"copies": "1",
"size": "1493",
"license": "apache-2.0",
"hash": -7121578131655640000,
"line_mean": 25.2105263158,
"line_max": 86,
"alpha_frac": 0.5217682518,
"autogenerated": false,
"ratio": 3.9083769633507854,
"config_test": false,... |
__author__ = 'amentis'
from RxAPI.RxGUI import StylableObject, RxDynamic, TextContainer
class TextEdit(StylableObject, RxDynamic, TextContainer):
"""A GUI field for working with user-inputted multi-line text"""
def __init__(self, parent, name, text=" "):
"""
@param parent: RxGUIObject parent ... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/TextEdit.py",
"copies": "1",
"size": "2573",
"license": "apache-2.0",
"hash": -6768855730866793000,
"line_mean": 32,
"line_max": 112,
"alpha_frac": 0.5254566654,
"autogenerated": false,
"ratio": 3.3502604166666665,
"config_test": false,
"has_... |
__author__ = 'amentis'
from RxAPI.RxGUI import StylableObject, RxDynamic, TextContainer
class TextView(StylableObject, RxDynamic, TextContainer):
def __init__(self, parent, name, text=" "):
"""
@param parent: RxGUIObject parent REXI object
@param name: str name of the REXI object
... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/TextView.py",
"copies": "1",
"size": "2434",
"license": "apache-2.0",
"hash": -2118369161051558000,
"line_mean": 31.9054054054,
"line_max": 112,
"alpha_frac": 0.5225965489,
"autogenerated": false,
"ratio": 3.316076294277929,
"config_test": fals... |
__author__ = 'amentis'
from RxAPI.RxGUI import LineEdit
class PasswordEdit(LineEdit):
"""
password input field
"""
def __init__(self, parent, name, text=" "):
"""
@param parent: RxGUIObject parent REXI object
@param name: str name of the REXI object
@param text: str va... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/PasswordEdit.py",
"copies": "1",
"size": "2488",
"license": "apache-2.0",
"hash": 2143450686837399300,
"line_mean": 32.1866666667,
"line_max": 105,
"alpha_frac": 0.463022508,
"autogenerated": false,
"ratio": 3.675036927621861,
"config_test": fa... |
__author__ = 'amentis'
from RxAPI.RxGUI import RxDynamic, StylableObject, TextContainer
class LineEdit(StylableObject, RxDynamic, TextContainer):
"""
text input field of one line
"""
def __init__(self, parent, name, text=" "):
"""
@param parent: RxGUIObject parent REXI object
... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/LineEdit.py",
"copies": "1",
"size": "3124",
"license": "apache-2.0",
"hash": 4382366400535514600,
"line_mean": 32.2446808511,
"line_max": 112,
"alpha_frac": 0.4942381562,
"autogenerated": false,
"ratio": 3.6241299303944317,
"config_test": fals... |
__author__ = 'amentis'
from RxAPI.RxGUI import StylableObject, RxDynamic, TextContainer
class Label(StylableObject, RxDynamic, TextContainer):
"""
label object containing simple text
"""
def __init__(self, parent, name, text=None):
"""
@param parent: RxGUIObject parent object
... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/Label.py",
"copies": "1",
"size": "1040",
"license": "apache-2.0",
"hash": -7601019350115092000,
"line_mean": 29.6176470588,
"line_max": 64,
"alpha_frac": 0.5682692308,
"autogenerated": false,
"ratio": 3.8095238095238093,
"config_test": false,
... |
__author__ = 'amentis'
class TextContainer:
"""
superclass for objects containing text
"""
def __init__(self, text):
"""
@param text: value of the text object
"""
self._text = text
def set_text(self, text):
"""
set a value for the text object
... | {
"repo_name": "amentis/Rexi",
"path": "RxAPI/RxGUI/TextContainer.py",
"copies": "1",
"size": "1032",
"license": "apache-2.0",
"hash": -6466052319356276000,
"line_mean": 21.9555555556,
"line_max": 65,
"alpha_frac": 0.511627907,
"autogenerated": false,
"ratio": 4.410256410256411,
"config_test": f... |
__author__ = 'amertis'
from django.db import models
__all__ = ["OpeniContext","Group","GroupFriend","LocationVisit","OpeniContextAwareModel",]
class OpeniContext(models.Model):
objectid = models.TextField()
# id is missing because it is the default
time_created = models.TextField(null=True)
time_edi... | {
"repo_name": "OPENi-ict/ntua_demo",
"path": "openiPrototype/openiPrototype/APIS/Context/models.py",
"copies": "1",
"size": "6233",
"license": "apache-2.0",
"hash": 8203760856477506000,
"line_mean": 38.4493670886,
"line_max": 126,
"alpha_frac": 0.7166693406,
"autogenerated": false,
"ratio": 3.543... |
__author__ = 'ameyapandilwar'
import sys
import operator
import happybase
import hdf5_getters as GETTERS
from pyspark import SparkContext
COLUMN_FAMILY_NAME = 'cf'
ARTIST_HOTTTNESSS_COLUMNID = 'artist_hotttnesss'
ARTIST_ID_COLUMNID = 'artist_id'
ARTIST_NAME_COLUMNID = 'artist_name'
DANCEABILITY_COLUMNID = 'danceabili... | {
"repo_name": "Arulselvanmadhavan/Artist_Recognition_from_Audio_Features",
"path": "MRTasks/parsingTasks/writeMSDSubsetToFile_PySpark.py",
"copies": "1",
"size": "3243",
"license": "apache-2.0",
"hash": -7014637245730079000,
"line_mean": 34.2608695652,
"line_max": 116,
"alpha_frac": 0.667591736,
"a... |
__author__ = 'Amine Kerkeni'
import tornado.ioloop
import tornado.web
import tornado.httpserver
from tornado.web import url
import json
import requests
from sqlalchemy import create_engine,Table, MetaData, Column, Index, String, Integer, Text
import hashlib
import base64
import uuid
import config
import time
engine =... | {
"repo_name": "minus--/GuerrillaInterview",
"path": "main_tornado.py",
"copies": "1",
"size": "6812",
"license": "mit",
"hash": -7987970593194466000,
"line_mean": 31.7548076923,
"line_max": 117,
"alpha_frac": 0.5955666471,
"autogenerated": false,
"ratio": 4.141033434650456,
"config_test": false... |
__author__ = 'Amine'
import requests
import json
import pickle
import hashlib
import base64
import uuid
import config
from sqlalchemy import create_engine,Table, MetaData, Column, Index, String, Integer, Text
engine = create_engine(config.sql_connection_string)
def rextester_run():
headers = {'content-type': 'ap... | {
"repo_name": "minus--/GuerrillaInterview",
"path": "test.py",
"copies": "1",
"size": "1573",
"license": "mit",
"hash": 3551477177038700500,
"line_mean": 26.6140350877,
"line_max": 99,
"alpha_frac": 0.6795931341,
"autogenerated": false,
"ratio": 3.4344978165938866,
"config_test": false,
"has_... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
from codingame_solutions.utilities.graph import Graph
# MAIN
persons = Graph()
n = int(input()) # the number of adjacency relations
for i in range(n):
# xi: the ID of a person which is adjacent to yi
# yi: the ID of a person which is adja... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Teads_Sponsored_Challenge.py",
"copies": "1",
"size": "1988",
"license": "mit",
"hash": 3755305737188193000,
"line_mean": 30.0625,
"line_max": 84,
"alpha_frac": 0.7097585513,
"autogenerated": false,
"rat... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
from enum import Enum
class Direction(Enum):
south = 1
east = 2
north = 3
west = 4
def get_as_string(self):
r = ""
if self == Direction.south:
r = "SOUTH"
elif self == Direction.north:
... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Bender_a_depressed_robot.py",
"copies": "1",
"size": "8875",
"license": "mit",
"hash": -3959486521595050500,
"line_mean": 31.8703703704,
"line_max": 137,
"alpha_frac": 0.56,
"autogenerated": false,
"rati... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
from enum import Enum
class Direction(Enum):
top = 1
bottom = 2
left = 3
right = 4
na = 5
def get_from_text(text):
direction = Direction.na
if text == "TOP":
direction = Direction.top
... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Indiana_Level_1.py",
"copies": "1",
"size": "6458",
"license": "mit",
"hash": 2331319417559143000,
"line_mean": 34.097826087,
"line_max": 134,
"alpha_frac": 0.5808299783,
"autogenerated": false,
"ratio":... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
import itertools
def find_connections2(word1, word2):
longest_matched_part = ""
# check form first letter of word1 if it can be matched to beginning of word 2
for i in range(len(word1)):
matched_part = ""
w1_match_inde... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/hard/hard_Genome_Sequencing.py",
"copies": "1",
"size": "3562",
"license": "mit",
"hash": -9175904877766347000,
"line_mean": 31.0900900901,
"line_max": 125,
"alpha_frac": 0.639809096,
"autogenerated": false,
"ratio": ... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
import numpy as np
from enum import Enum
class Direction(Enum):
up = 1
down = 2
left = 3
right = 4
mixed = 5
@staticmethod
def get_opposite(direction):
if direction == Direction.up:
return Direction.... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/very_hard/very_hard_Triangulation.py",
"copies": "1",
"size": "29167",
"license": "mit",
"hash": -8817852553275873000,
"line_mean": 37.6830238727,
"line_max": 159,
"alpha_frac": 0.5648506874,
"autogenerated": false,
"... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
import numpy as np
class Building:
def __init__(self, width, height):
self.width = width
self.height = height
print("Width: " + str(self.width) + ", height: " + str(self.height), file=sys.stderr)
self.map = np.z... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Heat_Detector.py",
"copies": "1",
"size": "6224",
"license": "mit",
"hash": -8544830736182106000,
"line_mean": 34.7701149425,
"line_max": 114,
"alpha_frac": 0.5729434447,
"autogenerated": false,
"ratio":... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
import numpy as np
class Map:
def __init__(self, width, height):
self.width = width
self.height = height
self.graphical_representation = []
self.visited = np.zeros((self.height, self.width))
self.__init... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/hard/hard_Surface.py",
"copies": "1",
"size": "3615",
"license": "mit",
"hash": -2990221293524052500,
"line_mean": 27.6904761905,
"line_max": 119,
"alpha_frac": 0.5172890733,
"autogenerated": false,
"ratio": 3.4428571... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
calculations = []
n = int(input())
for i in range(n):
starting_day, duration = [int(j) for j in input().split()]
calculations.append((starting_day, duration))
calculations.sort(key=lambda tup: tup[0])
print(calculations, file=sys.stderr)
... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/hard/hard_Super_Computer.py",
"copies": "1",
"size": "1502",
"license": "mit",
"hash": -1902912102325353500,
"line_mean": 30.9574468085,
"line_max": 118,
"alpha_frac": 0.7217043941,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
from codingame_solutions.very_hard.very_hard_The_Resistance_utils import load_from_file, load_from_input, load_from_prepared_data
class MorseDictionaryElement:
def __init__(self, sign="x", flag_holds_words=False, number=0):
self.sign =... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/very_hard/very_hard_The_Resistance.py",
"copies": "1",
"size": "5550",
"license": "mit",
"hash": -1996902431697612500,
"line_mean": 30.8965517241,
"line_max": 129,
"alpha_frac": 0.5922522523,
"autogenerated": false,
"... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
class ContactManagerElement:
def __init__(self, number=-1):
self.digit = number
self.next = []
def contains(self, digit: int):
for element in self.next:
if element.digit == digit:
return ... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Telephone_Numbers.py",
"copies": "1",
"size": "1551",
"license": "mit",
"hash": -7588476389660458000,
"line_mean": 24.0161290323,
"line_max": 72,
"alpha_frac": 0.6144422953,
"autogenerated": false,
"rati... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
class MayanNumericalSystem:
def __init__(self, base=20):
self.base = base
self.numbers = []
for i in range(self.base):
self.numbers.append("")
self.l = 0
self.h = 0
self.__read_from_... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Mayan_Calculation.py",
"copies": "1",
"size": "2646",
"license": "mit",
"hash": 1171109061022263000,
"line_mean": 23.0545454545,
"line_max": 70,
"alpha_frac": 0.5487528345,
"autogenerated": false,
"ratio... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
class Player:
def __init__(self, number):
self.number = number
self.deck = []
def get_deck_as_text(self):
deck_as_text = ""
for card in self.deck:
deck_as_text += str(card)
deck_as_te... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Winamax_Sponsored_Challenge.py",
"copies": "1",
"size": "4776",
"license": "mit",
"hash": 559992022288150800,
"line_mean": 27.9454545455,
"line_max": 195,
"alpha_frac": 0.5649078727,
"autogenerated": false... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
class Word:
def __init__(self, text: str):
self.__number_of_letters = ord("z") - ord("a") + 1
# self.__alphabet_1_point = ["e", "a", "i", "o", "n", "r", "t", "l", "s", "u"]
# self.__alphabet_2_point = ["d", "g"]
... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Scrabble.py",
"copies": "1",
"size": "2839",
"license": "mit",
"hash": 6754119895113370000,
"line_mean": 28.5729166667,
"line_max": 153,
"alpha_frac": 0.4938358577,
"autogenerated": false,
"ratio": 2.920... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
def get_count_of_first_number(elements):
count = 1
number_to_look_for = elements[0]
for number in elements[1:]:
if number_to_look_for == number:
count += 1
else:
break
return number_to_look_... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Conway_Sequence.py",
"copies": "1",
"size": "1068",
"license": "mit",
"hash": -1334255756115997400,
"line_mean": 20.7959183673,
"line_max": 83,
"alpha_frac": 0.5889513109,
"autogenerated": false,
"ratio"... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
def o_1(n: int):
return 1
def o_log_n(n: int):
return math.log2(n)
def o_n(n: int):
return n
def o_n_log_n(n: int):
return n * math.log2(n)
def o_n_2(n: int):
return n * n
def o_n_2_log_n(n: int):
return n * n * ma... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/hard/hard_Bender_Algorithmic_Complexity.py",
"copies": "1",
"size": "3259",
"license": "mit",
"hash": -5894315202620934000,
"line_mean": 26.1583333333,
"line_max": 109,
"alpha_frac": 0.6452899662,
"autogenerated": false... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
n = int(input())
vs = input()
stock_values = []
for value in vs.split(" "):
stock_values.append(int(value))
start_value = stock_values[0]
difference = 0
global_difference = 0
trend = 0
for stock_value in stock_values:
if trend == 0:
... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Stock_Exchange_Losses.py",
"copies": "1",
"size": "1256",
"license": "mit",
"hash": -3720164446917385000,
"line_mean": 23.6274509804,
"line_max": 60,
"alpha_frac": 0.6178343949,
"autogenerated": false,
"... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
n = int(input())
c = int(input())
budgets = []
for i in range(n):
b = int(input())
budgets.append(b)
contributions = []
result = ""
if sum(budgets) < c:
result = "IMPOSSIBLE"
else:
budgets.sort()
flag_still_searching = True
... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_The_Gift.py",
"copies": "1",
"size": "1958",
"license": "mit",
"hash": 3777576429674442000,
"line_mean": 25.8219178082,
"line_max": 86,
"alpha_frac": 0.595505618,
"autogenerated": false,
"ratio": 3.52158... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
n = int(input())
whole_file = ""
for i in range(n):
cgxline = input()
whole_file += cgxline
whole_file = whole_file.strip()
r = ""
flag_string = False
intend = 0
for c in whole_file:
# register strings
if c == "'" and not flag_s... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/hard/hard_CGX_Formatter.py",
"copies": "1",
"size": "1740",
"license": "mit",
"hash": -2264450889739075000,
"line_mean": 23.1666666667,
"line_max": 73,
"alpha_frac": 0.4298850575,
"autogenerated": false,
"ratio": 3.65... |
__author__ = 'Amin'
# COMPLETED
# PYTHON 3.x
import sys
import math
# Weber problem
# http://www.matstos.pjwstk.edu.pl/no10/no10_mlodak.pdf
# https://en.wikipedia.org/wiki/Weber_problem
# https://en.wikipedia.org/wiki/Geometric_median
# simple solution:
# find the median point and that is all!
homes = []
n = int(... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/medium/medium_Network_Cabling.py",
"copies": "1",
"size": "1486",
"license": "mit",
"hash": -1078594770539370100,
"line_mean": 24.6206896552,
"line_max": 119,
"alpha_frac": 0.6298788694,
"autogenerated": false,
"ratio... |
__author__ = 'Amin'
from collections import deque, namedtuple
GraphEdge = namedtuple("GraphEdge", "starting_vertex, ending_vertex, distance")
EdgeProperties = namedtuple("EdgeProperties", "destitantion_vertex, distance")
class Graph(object):
"""
A simple Python graph class, demonstrating the essential fact... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/utilities/graph.py",
"copies": "1",
"size": "10083",
"license": "mit",
"hash": 633989918754274300,
"line_mean": 31.0095238095,
"line_max": 109,
"alpha_frac": 0.5234553208,
"autogenerated": false,
"ratio": 3.9157281553... |
__author__ = 'Amin'
from os import listdir
from os.path import isfile, join, exists
import cv2
import pickle
from lxml import etree
class Utils:
def __init__(self):
# IMPORTANT - PARAMETERS
# there is a problem with images that are bigger than screen resolution
# they are resized by thi... | {
"repo_name": "Michal-Fularz/database_marking_tool",
"path": "Utils.py",
"copies": "1",
"size": "6086",
"license": "mit",
"hash": -1996747124815045600,
"line_mean": 39.8456375839,
"line_max": 113,
"alpha_frac": 0.5504436411,
"autogenerated": false,
"ratio": 3.6684749849306812,
"config_test": fa... |
__author__ = 'Amin'
import cv2
from os import listdir
from os.path import isfile, join, exists
import pickle
from ObjectInformation import ObjectInformation
from MouseButton import MouseButton
import copy
# GLOBALS - required for OpenCV mouse callback
right_button = MouseButton()
left_button = MouseButton()
new_... | {
"repo_name": "Michal-Fularz/database_marking_tool",
"path": "database_marking_tool.py",
"copies": "1",
"size": "9668",
"license": "mit",
"hash": 4593501376108989000,
"line_mean": 35.4830188679,
"line_max": 130,
"alpha_frac": 0.5742656185,
"autogenerated": false,
"ratio": 3.579415031469826,
"co... |
__author__ = 'Amin'
import math
import cv2
class Point:
def __init__(self):
self.x = 0
self.y = 0
def update(self, x, y):
self.x = x
self.y = y
def change(self, dx=0, dy=0):
self.x += dx
self.y += dy
def to_tuple(self):
return self.x, self.y... | {
"repo_name": "Michal-Fularz/database_marking_tool",
"path": "ObjectInformation.py",
"copies": "1",
"size": "4896",
"license": "mit",
"hash": -99276013467842400,
"line_mean": 25.6086956522,
"line_max": 109,
"alpha_frac": 0.5261437908,
"autogenerated": false,
"ratio": 3.2041884816753927,
"config... |
__author__ = 'Amin'
import numpy as np
class MF_lbp:
def __init__(self, use_test_version=False):
if use_test_version:
self.encoded_lbp_lut = [0] * 256
self.encoded_lbp_lut[16] = 11
else:
self.encoded_lbp_lut = [29] * 256
self.encoded_lbp_lut[0], s... | {
"repo_name": "PUTvision/decision_tree",
"path": "decision_trees/LBP/MF_lbp.py",
"copies": "2",
"size": "3844",
"license": "mit",
"hash": 9209180079129229000,
"line_mean": 48.9220779221,
"line_max": 81,
"alpha_frac": 0.5319979188,
"autogenerated": false,
"ratio": 2.8729446935724963,
"config_tes... |
__author__ = 'Amin'
import sys
import math
from collections import deque
import copy
# TODO: ordered dict require manual sorting after all the items were inserted
# TODO: I am not sure if this will speed the is in part
#from collections import OrderedDict
import cProfile
from codingame_solutions.very_hard.very_hard_... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/very_hard/very_hard_The_Resistance_ineffective_dict.py",
"copies": "1",
"size": "6675",
"license": "mit",
"hash": 8914619105042898000,
"line_mean": 36.0833333333,
"line_max": 132,
"alpha_frac": 0.5911610487,
"autogenera... |
__author__ = 'Amin'
import sys
import math
import numpy as np
from collections import deque
from collections import namedtuple
PickupInfo = namedtuple("PickupInfo", ["number_of_groups_taken", "earnings", "rides_taken"])
number_of_places, number_of_rides_per_day, number_of_groups = [int(i) for i in input().split()]
#... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/hard/hard_Roller_Coaster.py",
"copies": "1",
"size": "8680",
"license": "mit",
"hash": 8812627106549451000,
"line_mean": 45.6666666667,
"line_max": 140,
"alpha_frac": 0.6483870968,
"autogenerated": false,
"ratio": 3.1... |
__author__ = 'Amin'
import sys
import math
import numpy as np
from enum import Enum
from codingame_solutions.very_hard.very_hard_Triangulation import Batman
from codingame_solutions.very_hard.very_hard_Triangulation import Building
def calculate_distances(x, y, building):
for i in range(building.height):
... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/very_hard/very_hard_Triangulation_helper.py",
"copies": "1",
"size": "2806",
"license": "mit",
"hash": 5079001830048179000,
"line_mean": 31.6279069767,
"line_max": 80,
"alpha_frac": 0.6297220242,
"autogenerated": false,... |
__author__ = 'Amin'
import sys
import math
# convert value provided as HH:MM to a number of minutes
def hours_and_minutes_to_minutes():
d=input()
print((int(d[0])*60+int(d[1])*6+int(d[3])*10+int(d[4])))
# check if provided number is lucky - sum of first three digits is equal to sum of next three digits
# eg.
# 11... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/Clash_of_Code/shortest.py",
"copies": "1",
"size": "5706",
"license": "mit",
"hash": 1043224973622212200,
"line_mean": 23.0759493671,
"line_max": 180,
"alpha_frac": 0.6342446547,
"autogenerated": false,
"ratio": 2.840... |
__author__ = 'Amin'
import sys
import math
from codingame_solutions.utilities.graph import Graph, GraphEdge
if __name__ == "__main__":
f = open("hard_Bender_The_Money_Machine/test06_in.txt")
n = int(f.readline())
n = int(input())
v_names = []
v_values = []
v_destination_1 = []
v_desti... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/hard/hard_Bender_The_Money_Machine.py",
"copies": "1",
"size": "1613",
"license": "mit",
"hash": -2691377800585047000,
"line_mean": 28.3272727273,
"line_max": 101,
"alpha_frac": 0.5902045877,
"autogenerated": false,
"... |
__author__ = 'Amin'
import sys
import math
from collections import deque
import copy
from codingame_solutions.very_hard.very_hard_The_Resistance_utils import load_from_file, load_from_input, load_from_prepared_data
from codingame_solutions.very_hard.very_hard_The_Resistance import generate_morse_dictionary, print_mo... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/very_hard/very_hard_The_Resistance_ineffective_tree.py",
"copies": "1",
"size": "4906",
"license": "mit",
"hash": 6062217816281297000,
"line_mean": 39.5454545455,
"line_max": 146,
"alpha_frac": 0.6161842642,
"autogenera... |
__author__ = 'Amin'
import sys
import math
function A*(start,goal)
ClosedSet := {} // The set of nodes already evaluated.
OpenSet := {start} // The set of tentative nodes to be evaluated, initially containing the start node
Came_From := the empty map // The map of navigated nodes.
g_score... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/hard/hard_The_Labyrinth.py",
"copies": "1",
"size": "2425",
"license": "mit",
"hash": -8521331160952456000,
"line_mean": 36.3076923077,
"line_max": 108,
"alpha_frac": 0.6313402062,
"autogenerated": false,
"ratio": 3.7... |
__author__ = 'Amin'
import sys
import math
class Floor:
def __init__(self, width):
self.width = width
self.contains_elevator = False
self.elevators_positions = []
self.contains_exit = False
self.exit_position = -1
def add_exit(self, exit_position):
self.contai... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/hard/hard_The_Paranoid_Android-One_step_further.py",
"copies": "1",
"size": "3295",
"license": "mit",
"hash": 552259232171963600,
"line_mean": 31.6237623762,
"line_max": 117,
"alpha_frac": 0.6273141123,
"autogenerated":... |
__author__ = 'Amin'
import sys
import math
def calc_distance(latitudeA, longitudeA, latitudeB, longitudeB):
x = (longitudeB - longitudeA) * math.cos((latitudeA + latitudeB) / 2)
y = latitudeB - latitudeA
d = math.sqrt(x*x + y*y) * 6371
return d
LON = raw_input()
LAT = raw_input()
N = int(raw_input()... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/easy/easy_Defibrillators.py",
"copies": "1",
"size": "1249",
"license": "mit",
"hash": 8021293627992946000,
"line_mean": 23.4901960784,
"line_max": 73,
"alpha_frac": 0.6509207366,
"autogenerated": false,
"ratio": 3.12... |
__author__ = 'Amin'
import sys
import math
def dna(s):
nuclobases = ["A", "T", "C", "G"]
nuclobases_complementary = ["T", "A", "G", "C"]
r = ""
for c in s:
if c in nuclobases:
index = nuclobases.index(c)
r += nuclobases_complementary[index]
return r
def dna_if(... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/Clash_of_Code/fastest.py",
"copies": "1",
"size": "3265",
"license": "mit",
"hash": 7433760439874466000,
"line_mean": 18.4345238095,
"line_max": 169,
"alpha_frac": 0.5071975498,
"autogenerated": false,
"ratio": 2.9844... |
__author__ = 'Amin'
import sys
import math
def prepare_answer(bit_type, count, flag_without_trailing_space=False):
answer = ""
if bit_type == 1:
answer += "0"
else:
answer += "00"
answer += " "
for i in xrange(0, count):
answer += "0"
if not flag_without_trailing_space... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/easy/easy_Chuck_Norris.py",
"copies": "1",
"size": "1322",
"license": "mit",
"hash": 8394152877300634000,
"line_mean": 21.0333333333,
"line_max": 80,
"alpha_frac": 0.567322239,
"autogenerated": false,
"ratio": 3.56334... |
__author__ = 'Amin'
import sys
import math
N = int(raw_input()) # Number of elements which make up the association table.
Q = int(raw_input()) # Number Q of file names to be analyzed.
known_extensions = []
mime_types = []
for i in xrange(N):
# EXT: file extension
# MT: MIME type.
EXT, MT = raw_inpu... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/easy/easy_MIME_Type.py",
"copies": "1",
"size": "1230",
"license": "mit",
"hash": 5308587271876881000,
"line_mean": 25.7391304348,
"line_max": 81,
"alpha_frac": 0.6048780488,
"autogenerated": false,
"ratio": 3.6936936... |
__author__ = 'Amin'
import sys
import math
road = int(raw_input()) # the length of the road before the gap.
gap = int(raw_input()) # the length of the gap.
platform = int(raw_input()) # the length of the landing platform.
required_speed = gap + 1
# game loop
while 1:
speed = int(raw_input()) # the motorbik... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/easy/easy_Skynet_the_Chasm.py",
"copies": "1",
"size": "1036",
"license": "mit",
"hash": -438199063306466750,
"line_mean": 25.5641025641,
"line_max": 87,
"alpha_frac": 0.5733590734,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'Amin'
import sys
import math
surfaceN = int(raw_input()) # the number of points used to draw the surface of Mars.
for i in xrange(surfaceN):
# landX: X coordinate of a surface point. (0 to 6999)
# landY: Y coordinate of a surface point. By linking all the points together
# in a sequential f... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/easy/easy_Mars_Lander_Level_1.py",
"copies": "1",
"size": "1121",
"license": "mit",
"hash": -701498166344011600,
"line_mean": 31.0285714286,
"line_max": 92,
"alpha_frac": 0.6396074933,
"autogenerated": false,
"ratio":... |
__author__ = 'Amin'
import sys
class Morse:
def __init__(self):
self.morse_alphabet = []
self.morse_alphabet.append((".", "E"))
self.morse_alphabet.append(("..", "I"))
self.morse_alphabet.append((".-", "A"))
self.morse_alphabet.append(("...", "S"))
self.morse_al... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/very_hard/very_hard_The_Resistance_utils.py",
"copies": "1",
"size": "3657",
"license": "mit",
"hash": -827668587071724500,
"line_mean": 27.1307692308,
"line_max": 97,
"alpha_frac": 0.5537325677,
"autogenerated": false,... |
__author__ = 'Amin'
input_header_filenames = ["header.h"]
input_source_filenames = ["source.cpp"]
output_filename = "code_in_game_file.cpp"
catchword_start = "abracadabra start"
catchword_stop = "abracadabra stop"
# add all the includes etc.
output_init_fragment = ""
output_init_fragment += "#include <iostream>\n"
... | {
"repo_name": "Michal-Fularz/codingame_solutions",
"path": "codingame_solutions/utilities/concatenate_sources.py",
"copies": "1",
"size": "1241",
"license": "mit",
"hash": 6300911852426638000,
"line_mean": 23.82,
"line_max": 56,
"alpha_frac": 0.6494762288,
"autogenerated": false,
"ratio": 3.37228... |
__author__ = "Amish Anand"
__copyright__ = "Copyright (c) 2015 Juniper Networks, Inc."
from setuptools import setup, find_packages
# parse requirements
req_lines = [line.strip() for line in open(
'requirements.txt').readlines()]
install_reqs = list(filter(None, req_lines))
setup(
name="snabb-junos",
name... | {
"repo_name": "amanand/vmx-docker-lwaftr",
"path": "jetapp/setup.py",
"copies": "1",
"size": "1540",
"license": "apache-2.0",
"hash": 9076671115743948000,
"line_mean": 36.5609756098,
"line_max": 79,
"alpha_frac": 0.6318181818,
"autogenerated": false,
"ratio": 4.242424242424242,
"config_test": f... |
__author__ = "Amish Anand"
__copyright__ = "Copyright (c) 2015 Juniper Networks, Inc."
import subprocess
import signal
from common.mylogging import LOG
import os
from string import Template
from conf_globals import *
SNABB_PROCESS_SEARCH_STRING = 'snabbvmx-lwaftr-xe'
SNABB_INSTANCE_LAUNCH_TEMPLATE = Template(
'/u... | {
"repo_name": "amanand/vmx-docker-lwaftr",
"path": "jetapp/src/conf/conf_action.py",
"copies": "1",
"size": "5051",
"license": "apache-2.0",
"hash": -2055800942879194600,
"line_mean": 38.4609375,
"line_max": 94,
"alpha_frac": 0.5668184518,
"autogenerated": false,
"ratio": 3.792042042042042,
"co... |
__author__ = "Amish Anand"
__copyright__ = "Copyright (c) 2017 Juniper Networks, Inc."
from mylogging import LOG
import conf.protos.mgd_service_pb2 as mgd_service_pb2
import conf.protos.openconfig_service_pb2 as openconfig_service_pb2
import common.app_globals
import json
from conf.conf_globals import *
class Sanity... | {
"repo_name": "amanand/vmx-docker-lwaftr",
"path": "jetapp/src/common/sanity.py",
"copies": "1",
"size": "5423",
"license": "apache-2.0",
"hash": 6523316843270282000,
"line_mean": 44.1916666667,
"line_max": 132,
"alpha_frac": 0.5568873317,
"autogenerated": false,
"ratio": 4.500414937759336,
"co... |
__author__ = 'Amish'
from process_sentence_dataset import *
import time
import datetime
def pipeline_runner():
#Setup
movieSents = MovieSentences()
# This should create results for a set # of sentences
movieSents.register_baseline_results()
# Apply Semantic Tuning
#movieSents.apply_semantic_... | {
"repo_name": "amishwins/PyUnit",
"path": "Charm/runner.py",
"copies": "1",
"size": "2084",
"license": "mit",
"hash": -4188403246305902000,
"line_mean": 33.1803278689,
"line_max": 121,
"alpha_frac": 0.6161228407,
"autogenerated": false,
"ratio": 3.490787269681742,
"config_test": false,
"has_n... |
__author__ = 'Amish'
from read_afin import *
from collections import Counter
# Sentence Sentiment (Announcement November 5, 2014)
class MovieSentences:
def __init__(self):
self.afinn = AFINNData()
self.neg_path = os.path.join('..', 'rt-polarity', 'rt-polaritydata', 'rt-polarity.neg')
self... | {
"repo_name": "amishwins/PyUnit",
"path": "Charm/process_sentence_dataset.py",
"copies": "1",
"size": "12830",
"license": "mit",
"hash": -7997528842089598000,
"line_mean": 38.8447204969,
"line_max": 139,
"alpha_frac": 0.5943881528,
"autogenerated": false,
"ratio": 3.2075,
"config_test": true,
... |
__author__ = 'amka'
__created__ = '16.12.12'
class Condition(object):
"""
Store forecast weather data for one day.
"""
def __init__(self, observation_time=None, temp_C=None, temp_F=None,
weatherCode=None, weatherIconUrl=None, weatherDesc=None,
windspeedMiles=None, wi... | {
"repo_name": "amka/wwolib",
"path": "condition.py",
"copies": "1",
"size": "1161",
"license": "mit",
"hash": 6975775635603916000,
"line_mean": 36.4838709677,
"line_max": 98,
"alpha_frac": 0.6425495263,
"autogenerated": false,
"ratio": 3.70926517571885,
"config_test": false,
"has_no_keywords"... |
from neurokernel.core import Manager
from neurokernel.LPU.LPU import LPU
from neurokernel.tools.comm import get_random_port
import neurokernel.base as base
from neurokernel.pattern import Pattern
def tracefunc(frame, event, arg, indent=[0]):
if event == "call":
indent[0] += 2
print "-" * indent[0... | {
"repo_name": "cerrno/neurokernel",
"path": "examples/testLPU_ports/testLPU_exec.py",
"copies": "1",
"size": "1977",
"license": "bsd-3-clause",
"hash": -7533036324109362000,
"line_mean": 28.5074626866,
"line_max": 200,
"alpha_frac": 0.6358118361,
"autogenerated": false,
"ratio": 2.541131105398457... |
from neurokernel.core import Manager
from neurokernel.LPU.LPU import LPU
from neurokernel.tools.comm import get_random_port
import neurokernel.base as base
from neurokernel.realtime_interface import io_interface
from neurokernel.pattern import Pattern
def tracefunc(frame, event, arg, indent=[0]):
if event == "c... | {
"repo_name": "cerrno/neurokernel",
"path": "examples/testLPU_io/testLPU_exec.py",
"copies": "1",
"size": "1950",
"license": "bsd-3-clause",
"hash": 5469243456748894000,
"line_mean": 25.3513513514,
"line_max": 180,
"alpha_frac": 0.6435897436,
"autogenerated": false,
"ratio": 2.6859504132231407,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.