text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'leif'
from django.contrib.auth.models import User
from django import forms
from models import Team, Rating, Demo, RATING_CHOICES
class UserForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
username = forms.CharField()
email = forms.EmailField()
class Meta:
... | {
"repo_name": "sleonr0792/twd",
"path": "made_with_twd_project/showcase/forms.py",
"copies": "7",
"size": "1283",
"license": "mit",
"hash": 3149028857181137400,
"line_mean": 31.075,
"line_max": 130,
"alpha_frac": 0.6648480125,
"autogenerated": false,
"ratio": 3.9476923076923076,
"config_test": ... |
__author__ = 'leif'
from django.db import models
from django.contrib.auth.models import User
from django.forms import ModelForm
from django import forms
from django.forms.widgets import RadioSelect, Textarea
from import_export import resources
from survey.forms import clean_to_zero
SEX_CHOICES = \
(
('N... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/snippets/models.py",
"copies": "1",
"size": "41800",
"license": "mit",
"hash": -8594168985527523000,
"line_mean": 33.7464671654,
"line_max": 159,
"alpha_frac": 0.6425598086,
"autogenerated": false,
"ratio": 3.984367553140787,
"con... |
__author__ = 'leif'
from django import forms
from django.contrib.auth.models import User
from rango.models import Page, Category, UserProfile
class CategoryForm(forms.ModelForm):
name = forms.CharField(max_length=128, help_text="Please enter the category name.")
views = forms.IntegerField(widget=forms.HiddenIn... | {
"repo_name": "leifos/tango_with_django_17",
"path": "rango/forms.py",
"copies": "2",
"size": "1966",
"license": "mit",
"hash": 8858844598978610000,
"line_mean": 34.1071428571,
"line_max": 92,
"alpha_frac": 0.6581892167,
"autogenerated": false,
"ratio": 4.264642082429501,
"config_test": false,
... |
__author__ = 'leif'
from django.shortcuts import render
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from treconomics.experiment_functions import get_experiment_context
from treco... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/snippets/views.py",
"copies": "1",
"size": "9639",
"license": "mit",
"hash": 8958788623798220000,
"line_mean": 39.1625,
"line_max": 154,
"alpha_frac": 0.6597157381,
"autogenerated": false,
"ratio": 3.797872340425532,
"config_test"... |
__author__ = 'leif'
from faker import Factory as FakeFactory
from house import House
import math
import random
class Street(object):
def __init__(self, name, house_list):
self.name = name
self.num_of_houses = len(house_list)
self.current_house = 0
self.house_list = house_list
... | {
"repo_name": "leifos/wad",
"path": "projects/game/engine/streetfactory.py",
"copies": "1",
"size": "1583",
"license": "mit",
"hash": -4410045992549848600,
"line_mean": 25.8474576271,
"line_max": 130,
"alpha_frac": 0.5919140872,
"autogenerated": false,
"ratio": 3.479120879120879,
"config_test":... |
__author__ = 'leif'
from ifind.common.rotation_ordering import PermutatedRotationOrdering
class ExperimentSetup(object):
"""
The 0th task is the practice task, then 1st task is next, etc, in each list i.e. interface, engine, timeout, etc.
if it is not a list, then it assigns the value to all setups.
"... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/treconomics/experiment_setup.py",
"copies": "1",
"size": "7727",
"license": "mit",
"hash": 7784849792854854000,
"line_mean": 33.1902654867,
"line_max": 150,
"alpha_frac": 0.5295716319,
"autogenerated": false,
"ratio": 3.888777050830... |
__author__ = 'leif'
from ifind.search.engine import Engine
from ifind.search.response import Response
class Dummy(Engine):
"""
This search engine makes no internet requests
It serves up pre-programmed responses for testing
For all queries, it returns the same response which is:
a list of resul... | {
"repo_name": "leifos/ifind",
"path": "ifind/search/engines/dummy.py",
"copies": "1",
"size": "1444",
"license": "mit",
"hash": -5286790855783859000,
"line_mean": 23.8965517241,
"line_max": 93,
"alpha_frac": 0.5706371191,
"autogenerated": false,
"ratio": 4.185507246376812,
"config_test": false,... |
__author__ = 'leif'
from ifind.seeker.list_reader import ListReader
from ifind.search.engine import Engine
from ifind.search.response import Response
from ifind.search.exceptions import EngineConnectionException, QueryParamException
from whoosh.index import open_dir
from whoosh.query import *
from whoosh.qparser import... | {
"repo_name": "leifos/ifind",
"path": "ifind/search/engines/whooshtrec.py",
"copies": "1",
"size": "8789",
"license": "mit",
"hash": 6077686702949730000,
"line_mean": 30.7292418773,
"line_max": 115,
"alpha_frac": 0.5898281943,
"autogenerated": false,
"ratio": 4.114700374531835,
"config_test": f... |
__author__ = 'leif'
from language_model import LanguageModel
from smoothed_language_model import SmoothedLanguageModel
import math
class QueryRanker(object):
def __init__(self, smoothed_language_model):
"""
takes in a smoothed language model object which contains
:param docLM: ifind.commo... | {
"repo_name": "leifos/ifind",
"path": "ifind/common/query_ranker.py",
"copies": "1",
"size": "2836",
"license": "mit",
"hash": 3091479604531828000,
"line_mean": 33.1807228916,
"line_max": 121,
"alpha_frac": 0.6135401975,
"autogenerated": false,
"ratio": 4.074712643678161,
"config_test": false,
... |
__author__ = 'leif'
from loggers import Actions
from stopping_decision_makers.base_decision_maker import BaseDecisionMaker
import logging
log = logging.getLogger('decsion_makers.ift_based_decision_makers')
class IftBasedDecisionMaker(BaseDecisionMaker):
"""
A concrete implementation of a decision maker.
... | {
"repo_name": "leifos/simiir",
"path": "simiir/stopping_decision_makers/ift_based_decision_maker.py",
"copies": "1",
"size": "4878",
"license": "mit",
"hash": 7066791945078581000,
"line_mean": 43.752293578,
"line_max": 162,
"alpha_frac": 0.6369413694,
"autogenerated": false,
"ratio": 3.6676691729... |
__author__ = 'leif'
from simiir.query_generators.base_generator import BaseQueryGenerator
from simiir.query_generators.smarter_generator import SmarterQueryGenerator
from simiir.utils import lm_methods
from ifind.common.language_model import LanguageModel
from ifind.common.query_generation import SingleQueryGeneration... | {
"repo_name": "leifos/simiir",
"path": "simiir/query_generators/qs34_query_generator.py",
"copies": "1",
"size": "2043",
"license": "mit",
"hash": -2760052196420241400,
"line_mean": 30.9375,
"line_max": 110,
"alpha_frac": 0.6984826236,
"autogenerated": false,
"ratio": 3.6810810810810812,
"confi... |
__author__ = 'leif'
from threading import Thread
from django.core.cache import cache
class Worker(Thread):
def __init__(self, query, search_engine):
Thread.__init__(self)
self.query = query
self.search_engine = search_engine
def run(self):
key = make_key(self.query, self.sear... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/search/result_cache.py",
"copies": "1",
"size": "1736",
"license": "mit",
"hash": -2369519026549842000,
"line_mean": 23.4507042254,
"line_max": 84,
"alpha_frac": 0.6140552995,
"autogenerated": false,
"ratio": 3.564681724845996,
"c... |
__author__ = 'leif'
from whoosh.index import open_dir
import nltk
def tokenize_text(raw_text):
"""
:return: list of terms that are normalize (i.e. lowercase, a-z, longer than 2)
"""
tokens = nltk.wordpunct_tokenize(raw_text)
text = nltk.Text(tokens)
words = [w.lower() for w in text if w.isalph... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/data/extract_bigrams.py",
"copies": "1",
"size": "1515",
"license": "mit",
"hash": -4777041800967133000,
"line_mean": 20.0555555556,
"line_max": 82,
"alpha_frac": 0.5570957096,
"autogenerated": false,
"ratio": 3.0792682926829267,
... |
__author__ = 'leif'
from xml.dom import minidom
from whoosh.index import create_in
from whoosh.fields import *
from whoosh.analysis import StemmingAnalyzer
import os
def readDataFiles( datafile ):
filelist = []
f = open(datafile,"rb")
for line in f.readlines():
filelist.append(line.rstrip())
... | {
"repo_name": "leifos/ifind",
"path": "ifind/examples/sample_data/create_trec_whoosh_index.py",
"copies": "1",
"size": "2483",
"license": "mit",
"hash": -8043865498033503000,
"line_mean": 28.5595238095,
"line_max": 128,
"alpha_frac": 0.6488119211,
"autogenerated": false,
"ratio": 3.42482758620689... |
__author__ = 'leif'
import json
import os
import sys
import random
from ifind.common.pagecapture import PageCapture
from ifind.common.utils import convert_url_to_filename, read_in_urls
from game_models import Page, Category
sys.path.append(os.getcwd())
from configuration import DATA_DIR
from configuration import MEDI... | {
"repo_name": "leifos/pagefetch",
"path": "pagefetch_project/pagefetch/game_model_functions.py",
"copies": "1",
"size": "4327",
"license": "mit",
"hash": -7748819302730744000,
"line_mean": 30.5839416058,
"line_max": 133,
"alpha_frac": 0.6216778368,
"autogenerated": false,
"ratio": 3.8565062388591... |
__author__ = 'leif'
import math
from ifind.common.language_model import LanguageModel
from ifind.common.query_generation import SingleQueryGeneration
from simiir.text_classifiers.base_classifier import BaseTextClassifier
from ifind.common.smoothed_language_model import SmoothedLanguageModel
from simiir.utils.tidy impor... | {
"repo_name": "leifos/simiir",
"path": "simiir/text_classifiers/lm_classifier.py",
"copies": "1",
"size": "6837",
"license": "mit",
"hash": 5334414730950957000,
"line_mean": 33.5303030303,
"line_max": 118,
"alpha_frac": 0.6129881527,
"autogenerated": false,
"ratio": 3.8195530726256983,
"config_... |
__author__ = 'leif'
import math
import random
from streetfactory import StreetFactory
from copy import deepcopy
MAX_MOVE_TIME = 10
MAX_SEARCH_TIME = 5
WAIT_TIME = 20
FIGHT_TIME = 5
RUN_TIME = 2
ENTER_TIME = 1
EXIT_TIME = 1
NONE_TIME = 0
LENGTH_OF_DAY = 100
class PlayerState(object):
def __init__(self):
s... | {
"repo_name": "leifos/wad",
"path": "projects/game/engine/game.py",
"copies": "1",
"size": "7504",
"license": "mit",
"hash": -6127626085356045000,
"line_mean": 25.8960573477,
"line_max": 110,
"alpha_frac": 0.5720948827,
"autogenerated": false,
"ratio": 3.464450600184672,
"config_test": false,
... |
__author__ = 'leif'
import nltk
from bs4 import BeautifulSoup
def extract_entity_names(t):
entity_names = []
if hasattr(t, 'label') and t.label:
if t.label() == 'NE':
entity_names.append(', '.join([child[0] for child in t]))
else:
for child in t:
entity... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/search/snippets.py",
"copies": "1",
"size": "1328",
"license": "mit",
"hash": 328282479257571900,
"line_mean": 29.8837209302,
"line_max": 83,
"alpha_frac": 0.6483433735,
"autogenerated": false,
"ratio": 3.8830409356725144,
"config... |
__author__ = 'leif'
import os
import logging
import logging.config
import logging.handlers
my_experiment_log_dir = os.getcwd()
event_logger = logging.getLogger('event_log')
event_logger.setLevel(logging.INFO)
event_logger_handler = logging.FileHandler(os.path.join(my_experiment_log_dir, 'move.log'))
formatter = loggi... | {
"repo_name": "leifos/boxes",
"path": "treasure-houses/asg/log.py",
"copies": "1",
"size": "1834",
"license": "mit",
"hash": 1562401962933558800,
"line_mean": 38.0212765957,
"line_max": 136,
"alpha_frac": 0.5714285714,
"autogenerated": false,
"ratio": 3.0566666666666666,
"config_test": false,
... |
__author__ = 'leif'
import os
import socket
import logging
import logging.config
import logging.handlers
from autocomplete_trie import AutocompleteTrie
from ifind.search.engines.whooshtrec import Whooshtrec
from experiment_setup import ExperimentSetup
work_dir = os.getcwd()
# when deployed this needs to match up with... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/treconomics/experiment_configuration.py",
"copies": "1",
"size": "8405",
"license": "mit",
"hash": -6718161360040850000,
"line_mean": 35.7030567686,
"line_max": 129,
"alpha_frac": 0.6805472933,
"autogenerated": false,
"ratio": 2.914... |
__author__ = 'leif'
import os
import sys
from datetime import datetime, timedelta
class ActionCounter(object):
def __init__(self, label, event):
self.event = event
self.label = label
self.count = 0
def __str__(self):
return "%d" % (self.count)
def action(self):
re... | {
"repo_name": "leifos/treconomics",
"path": "snippet_log_parser/log-time-action-processor.py",
"copies": "1",
"size": "14392",
"license": "mit",
"hash": 7327028264133671000,
"line_mean": 40.7188405797,
"line_max": 200,
"alpha_frac": 0.5192468038,
"autogenerated": false,
"ratio": 3.407196969696969... |
__author__ = 'leif'
import os
def populate():
print 'Adding Task Descriptions'
add_task(topic_num='341',
title='Airport Security',
description='<p>For this task, '
'your job is to find articles '
'that discuss procedures taken by inte... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/populate_treconomics_db.py",
"copies": "1",
"size": "5999",
"license": "mit",
"hash": -8623337994371253000,
"line_mean": 56.6826923077,
"line_max": 157,
"alpha_frac": 0.5695949325,
"autogenerated": false,
"ratio": 4.388441843452816,... |
__author__ = 'leif'
import os
def populate():
print 'Adding Users'
for i in range(0,20):
uname = 'fin'+str(i)
add_user(uname,uname,0,2,i)
def add_user(username, password, condition, experiment, rotation, data=None):
u = User.objects.get_or_create(username=username)[0]
u.set_password(... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/populate_users.py",
"copies": "1",
"size": "1373",
"license": "mit",
"hash": -1157701599194242300,
"line_mean": 29.5111111111,
"line_max": 83,
"alpha_frac": 0.5484340859,
"autogenerated": false,
"ratio": 4.25077399380805,
"config_... |
__author__ = 'leif'
import random
class House(object):
def __init__(self, player_state):
self.room_list = []
self.num_of_rooms = 0
self.current_room = 0
self.create_rooms(player_state)
def get_house_stats(self):
np = 0
nf = 0
na = 0
nz = 0
... | {
"repo_name": "leifos/wad",
"path": "projects/game/engine/house.py",
"copies": "1",
"size": "3429",
"license": "mit",
"hash": -393121914451367200,
"line_mean": 23.5,
"line_max": 134,
"alpha_frac": 0.5138524351,
"autogenerated": false,
"ratio": 3.247159090909091,
"config_test": false,
"has_no_... |
__author__ = 'leif'
import re
import abc
import sys
import math
import collections
class DifferenceHelper(object):
"""
Abstract difference class.
Contains helper methods for setting up - the difference() method is abstract.
"""
def __init__(self, stopword_file=None, vocab_file=None):
self.v... | {
"repo_name": "leifos/simiir",
"path": "simiir/utils/difference_methods.py",
"copies": "1",
"size": "6217",
"license": "mit",
"hash": 8642009255357104000,
"line_mean": 30.5634517766,
"line_max": 135,
"alpha_frac": 0.5332153772,
"autogenerated": false,
"ratio": 3.823493234932349,
"config_test": ... |
__author__ = 'leif'
import string
import httplib
from urlparse import urlparse
def read_in_urls(filename):
# read in file - store in a list (url_list)
# Open the file with read only permit
f = open(filename, 'r')
# Read the first line
url_list = []
for line in f:
# Strip urls from spac... | {
"repo_name": "leifos/ifind",
"path": "ifind/common/utils.py",
"copies": "1",
"size": "3741",
"license": "mit",
"hash": 2659943442591808000,
"line_mean": 32.1061946903,
"line_max": 127,
"alpha_frac": 0.6345896819,
"autogenerated": false,
"ratio": 3.664054848188051,
"config_test": false,
"has_... |
__author__ = 'leif'
# Can access them all methods but they need to be prefaced with os or datetime for example
# Django
from django.template.context import RequestContext
from django.shortcuts import render_to_response, render
from django.http import HttpResponseRedirect
from django.contrib.auth.models import User
fro... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/survey/views.py",
"copies": "1",
"size": "5972",
"license": "mit",
"hash": -1020329017728964000,
"line_mean": 37.5290322581,
"line_max": 118,
"alpha_frac": 0.6622572003,
"autogenerated": false,
"ratio": 3.9083769633507854,
"config... |
__author__ = 'leif'
from django.contrib import admin
from django import forms
from import_export.admin import ImportExportModelAdmin
from models import DocumentsExamined, UserProfile
from models import TaskDescription, TopicQuerySuggestion
from snippets.models import AnitaPreTaskSurvey, AnitaPreTaskResource
from snip... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/treconomics/admin.py",
"copies": "1",
"size": "4427",
"license": "mit",
"hash": 6000698028579967000,
"line_mean": 35.8916666667,
"line_max": 183,
"alpha_frac": 0.7896995708,
"autogenerated": false,
"ratio": 3.593344155844156,
"con... |
__author__ = 'leif'
from django.db import models
from django import forms
from django.contrib.auth.models import User
SEX_CHOICES = (('N', 'Not Indicated'),
('M', 'Male'), ('F', 'Female'))
class UKDemographicsSurvey(models.Model):
user = models.ForeignKey(User)
age = models.IntegerField(defau... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/survey/models.py",
"copies": "1",
"size": "7812",
"license": "mit",
"hash": 3178268631409863000,
"line_mean": 38.4545454545,
"line_max": 100,
"alpha_frac": 0.7314388121,
"autogenerated": false,
"ratio": 3.657303370786517,
"config_... |
__author__ = 'leif'
from game_models import HighScore, UserProfile
from ifind.common.utils import encode_string_to_url
from django.contrib.auth.models import User
from django.db.models import Max, Sum, Avg
# ranking based on highest total score (top x players)
# ranking of players based on level/xp
# top players in ... | {
"repo_name": "leifos/pagefetch",
"path": "pagefetch_project/pagefetch/game_leaderboards.py",
"copies": "1",
"size": "5894",
"license": "mit",
"hash": -5800961853610642000,
"line_mean": 28.9187817259,
"line_max": 136,
"alpha_frac": 0.5892432983,
"autogenerated": false,
"ratio": 3.739847715736041,... |
__author__ = 'leif'
from ifind.search.engines.whooshtrec import Whooshtrec
from ifind.search import Query
from ifind.common.language_model import LanguageModel
import nltk
import math
from bs4 import BeautifulSoup
def read_in_query_file(query_filename):
"""
:param query_filename: query number and query stri... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/data/compute_snippet_len_gain.py",
"copies": "1",
"size": "3426",
"license": "mit",
"hash": 8153463590384242000,
"line_mean": 20.8280254777,
"line_max": 90,
"alpha_frac": 0.575890251,
"autogenerated": false,
"ratio": 3.3920792079207... |
__author__ = 'leif'
from query_generation import QueryGeneration, SingleQueryGeneration, BiTermQueryGeneration
import unittest
import logging
import sys
class TestQueryGeneration(unittest.TestCase):
def setUp(self):
self.logger = logging.getLogger("TestQueryGeneration")
self.qg = QueryGeneration... | {
"repo_name": "leifos/ifind",
"path": "ifind/common/test_query_generation.py",
"copies": "1",
"size": "3785",
"license": "mit",
"hash": 2467747990719352000,
"line_mean": 39.2765957447,
"line_max": 95,
"alpha_frac": 0.6615587847,
"autogenerated": false,
"ratio": 3.8193743693239153,
"config_test"... |
__author__ = 'leif'
import json
import urllib, urllib2
# Add your BING_API_KEY to a file called keys, which will not be commited to the repo
from keys import BING_API_KEY
def run_query(search_terms):
# Specify the base
root_url = 'https://api.datamarket.azure.com/Bing/Search/'
source = 'Web'
# Spec... | {
"repo_name": "leifos/tango_with_django_17",
"path": "rango/bing_search.py",
"copies": "2",
"size": "2933",
"license": "mit",
"hash": 5386386840329753000,
"line_mean": 30.8913043478,
"line_max": 85,
"alpha_frac": 0.6413228776,
"autogenerated": false,
"ratio": 4.079276773296245,
"config_test": f... |
__author__ = 'leif'
import operator
import datrie
import string
import os
class AutocompleteTrie(object):
"""
A class implementing a trie data structure to provide suggestions to aid participants to complete queries.
Employs the use of the datrie package.
Removed the dependencies on whoosh, but it n... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/treconomics/autocomplete_trie.py",
"copies": "1",
"size": "5342",
"license": "mit",
"hash": -813672293529303900,
"line_mean": 35.595890411,
"line_max": 120,
"alpha_frac": 0.599775365,
"autogenerated": false,
"ratio": 4.2942122186495... |
__author__ = 'leif'
import os
from game import Game
from streetfactory import StreetFactory
from game import PlayerState
def main():
# this is the basic game process
# while the day or game is not over,
# display the current state of the game,
# then check what the player wants to do
g = Game(... | {
"repo_name": "leifos/wad",
"path": "projects/game/engine/main.py",
"copies": "1",
"size": "3627",
"license": "mit",
"hash": 6048345346216108000,
"line_mean": 26.6946564885,
"line_max": 89,
"alpha_frac": 0.5376344086,
"autogenerated": false,
"ratio": 3.2912885662431943,
"config_test": false,
... |
__author__ = 'leif'
import random
from asg_generator import YieldGenerator, CueGenerator
class ABSGame(object):
def __init__(self, yield_generator, cue_generator, tokens=30, cq=2, ca=1, points=0, round_len = 10, id=0):
self.ygen = yield_generator
self.cgen = cue_generator
self.tokens = t... | {
"repo_name": "leifos/boxes",
"path": "asg_project/asg/abstract_search_game.py",
"copies": "1",
"size": "3568",
"license": "mit",
"hash": 8901875697903033000,
"line_mean": 24.6690647482,
"line_max": 110,
"alpha_frac": 0.5302690583,
"autogenerated": false,
"ratio": 3.816042780748663,
"config_tes... |
__author__ = 'leif'
import random
from random import randint
class YieldGenerator(object):
# creates a patch and the payoffs in the patch
def __init__(self, max_yield=3):
self.max_yield = max_yield
def get_yields(self, size=10):
"""
returns a list of integers that denote the numb... | {
"repo_name": "leifos/boxes",
"path": "treasure-houses/asg/asg_generator.py",
"copies": "1",
"size": "9414",
"license": "mit",
"hash": 4135919503272684000,
"line_mean": 27.3554216867,
"line_max": 86,
"alpha_frac": 0.5049925643,
"autogenerated": false,
"ratio": 3.351370594517622,
"config_test": ... |
__author__ = 'leif'
import random
class YieldGenerator(object):
# creates a patch and the payoffs in the patch
def __init__(self, max_yield=3):
self.max_yield = max_yield
def get_yields(self, size=10):
"""
returns a list of integers that denote the number of points in each doc
... | {
"repo_name": "leifos/boxes",
"path": "asg_project/asg/asg_generator.py",
"copies": "1",
"size": "8592",
"license": "mit",
"hash": -3119836370371859500,
"line_mean": 25.769470405,
"line_max": 86,
"alpha_frac": 0.5272346369,
"autogenerated": false,
"ratio": 3.364134690681284,
"config_test": fals... |
__author__ = 'leif'
class RotationOrdering(object):
""" creates ordering for lists with an attribute id
"""
def __init__(self):
pass
def number_of_orderings(self, slist=None):
return 1
def get_ordering(self, slist, i=0):
""" given a list (i.e. of pages, cats), return the... | {
"repo_name": "leifos/ifind",
"path": "ifind/common/rotation_ordering.py",
"copies": "1",
"size": "1294",
"license": "mit",
"hash": -3288328845669608400,
"line_mean": 22.1071428571,
"line_max": 73,
"alpha_frac": 0.5386398764,
"autogenerated": false,
"ratio": 3.6246498599439776,
"config_test": f... |
__author__ = 'leif'
from abstract_search_game import ABSGame
from asg_generator import RandomYieldGenerator, CueGenerator, ConstantLinearYieldGenerator, TestYieldGenerator
import unittest
import logging
import sys
class TestABSMatch(unittest.TestCase):
def setUp(self):
self.logger = logging.getLogger("T... | {
"repo_name": "leifos/boxes",
"path": "treasure-houses/asg/test_abstract_search_game.py",
"copies": "2",
"size": "4291",
"license": "mit",
"hash": -4766673902940221000,
"line_mean": 28.5931034483,
"line_max": 110,
"alpha_frac": 0.637380564,
"autogenerated": false,
"ratio": 3.658141517476556,
"c... |
__author__ = 'leif'
from game_models import PlayerAchievement, Achievement
import logging
class GameAchievement(object):
def __init__(self, userprofile, highscores, currentgame=None):
"""
:param userprofile: ifind.models.game_models.UserProfile
:param highscores: list of highscores for ... | {
"repo_name": "leifos/pagefetch",
"path": "pagefetch_project/pagefetch/game_achievements.py",
"copies": "1",
"size": "5964",
"license": "mit",
"hash": -415120474823927600,
"line_mean": 32.3184357542,
"line_max": 143,
"alpha_frac": 0.6286049631,
"autogenerated": false,
"ratio": 4,
"config_test":... |
__author__ = 'leif'
#from ifind.common.autocomplete_trie import AutocompleteTrie
from ifind.search.engines.whooshtrec import Whooshtrec
from ifind.search import Query
import nltk
from bs4 import BeautifulSoup
# http://benjamindalton.com/extracting-nouns-with-python/
def extract_entity_names(t):
entity_names ... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/data/test_search.py",
"copies": "1",
"size": "3387",
"license": "mit",
"hash": 2376697866880818700,
"line_mean": 23.0212765957,
"line_max": 111,
"alpha_frac": 0.6005314438,
"autogenerated": false,
"ratio": 3.641935483870968,
"conf... |
__author__ = 'leif'
from ifind.search.engines.bing import Bing
from ifind.search.query import Query
class Sitebing(Bing):
def __init__(self, api_key='', site='gla.ac.uk', **kwargs):
"""
Bing engine constructor.
Kwargs:
api_key (str): string representation of api key needed t... | {
"repo_name": "leifos/ifind",
"path": "ifind/search/engines/sitebing.py",
"copies": "1",
"size": "1365",
"license": "mit",
"hash": 2881610166651811300,
"line_mean": 25.25,
"line_max": 95,
"alpha_frac": 0.5963369963,
"autogenerated": false,
"ratio": 4.475409836065574,
"config_test": false,
"ha... |
__author__ = 'leif'
import abc
from random import Random
from simiir.text_classifiers.base_informed_trec_classifier import BaseInformedTrecTextClassifier
from ifind.seeker.trec_qrel_handler import TrecQrelHandler
class StochasticInformedTrecTextClassifier(BaseInformedTrecTextClassifier):
"""
Takes the TREC Q... | {
"repo_name": "leifos/simiir",
"path": "simiir/text_classifiers/stochastic_informed_trec_classifier.py",
"copies": "1",
"size": "2094",
"license": "mit",
"hash": 5026716422014179000,
"line_mean": 29.8088235294,
"line_max": 122,
"alpha_frac": 0.6069723018,
"autogenerated": false,
"ratio": 3.842201... |
__author__ = 'leif'
#
import os
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tango_with_django_project_17.settings')
def populate():
python_cat = add_cat('Python',128, 64)
add_page(cat=python_cat,
title="Official Python Tutorial",
url="http://docs.python.org/2/tutorial/")... | {
"repo_name": "leifos/tango_with_django_17",
"path": "populate.py",
"copies": "2",
"size": "1908",
"license": "mit",
"hash": -1486468174586221800,
"line_mean": 25.5138888889,
"line_max": 88,
"alpha_frac": 0.6221174004,
"autogenerated": false,
"ratio": 3.2393887945670627,
"config_test": false,
... |
__author__ = 'leifos'
from ifind.seeker.common_helpers import file_exists
from ifind.seeker.common_helpers import AutoVivification
from ifind.seeker.topic_document_file_handler import TopicDocumentFileHandler
class TrecQrelHandler(TopicDocumentFileHandler):
def __init__(self, filename=None):
super(TrecQ... | {
"repo_name": "leifos/ifind",
"path": "ifind/seeker/trec_qrel_handler.py",
"copies": "1",
"size": "1134",
"license": "mit",
"hash": -2325277758312791600,
"line_mean": 32.3529411765,
"line_max": 101,
"alpha_frac": 0.626984127,
"autogenerated": false,
"ratio": 3.718032786885246,
"config_test": fa... |
__author__ = 'leifos'
from ifind.seeker.common_helpers import file_exists
from ifind.seeker.common_helpers import AutoVivification
class TopicDocumentFileHandler(object):
def __init__(self, filename=None):
self.data = AutoVivification()
if filename:
self.read_file(filename)
def... | {
"repo_name": "leifos/ifind",
"path": "ifind/seeker/topic_document_file_handler.py",
"copies": "1",
"size": "3121",
"license": "mit",
"hash": 8157225785258011000,
"line_mean": 27.1261261261,
"line_max": 96,
"alpha_frac": 0.5200256328,
"autogenerated": false,
"ratio": 3.8818407960199006,
"config... |
__author__ = 'leifos'
from seeker.common_helpers import file_exists
from seeker.common_helpers import AutoVivification
class TopicDocumentFileHandler(object):
def __init__(self, filename=None):
self.data = AutoVivification()
if filename:
self.read_file(filename)
def _put_in_lin... | {
"repo_name": "leifos/tar",
"path": "scripts/seeker/topic_document_file_handler.py",
"copies": "1",
"size": "2728",
"license": "mit",
"hash": -6176878767004916000,
"line_mean": 26.5555555556,
"line_max": 92,
"alpha_frac": 0.525659824,
"autogenerated": false,
"ratio": 3.8585572842998586,
"config... |
from __future__ import print_function
import locale
import numpy as np
import numba
from pynndescent.utils import norm, tau_rand
from pynndescent.distances import kantorovich
locale.setlocale(locale.LC_NUMERIC, "C")
FLOAT32_EPS = np.finfo(np.float32).eps
FLOAT32_MAX = np.finfo(np.float32).max
# Just reproduce a sim... | {
"repo_name": "lmcinnes/pynndescent",
"path": "pynndescent/sparse.py",
"copies": "1",
"size": "25441",
"license": "bsd-2-clause",
"hash": 99387826915094500,
"line_mean": 27.7794117647,
"line_max": 87,
"alpha_frac": 0.5803624071,
"autogenerated": false,
"ratio": 2.956880520688052,
"config_test":... |
from __future__ import print_function
import locale
import numpy as np
import numba
from pynndescent.utils import (
tau_rand_int,
make_heap,
new_build_candidates,
deheap_sort,
checked_flagged_heap_push,
apply_graph_updates_high_memory,
apply_graph_updates_low_memory,
)
from pynndescent.spa... | {
"repo_name": "lmcinnes/pynndescent",
"path": "pynndescent/sparse_nndescent.py",
"copies": "1",
"size": "10341",
"license": "bsd-2-clause",
"hash": 6411833044376420000,
"line_mean": 28.6303724928,
"line_max": 88,
"alpha_frac": 0.520355865,
"autogenerated": false,
"ratio": 3.492401215805471,
"co... |
from __future__ import print_function
import numpy as np
import numba
from utils import (
tau_rand_int,
tau_rand,
norm,
make_heap,
heap_push,
rejection_sample,
build_candidates,
deheap_sort,
)
import locale
locale.setlocale(locale.LC_NUMERIC, "C")
# Just reproduce a simpler version o... | {
"repo_name": "nsalomonis/AltAnalyze",
"path": "visualization_scripts/umap_learn_single/sparse.py",
"copies": "1",
"size": "17473",
"license": "apache-2.0",
"hash": -1399409496310548000,
"line_mean": 27.6912972085,
"line_max": 87,
"alpha_frac": 0.5444972243,
"autogenerated": false,
"ratio": 3.101... |
from __future__ import print_function
import locale
import numba
import numpy as np
from umap.utils import norm
locale.setlocale(locale.LC_NUMERIC, "C")
# Just reproduce a simpler version of numpy unique (not numba supported yet)
@numba.njit()
def arr_unique(arr):
aux = np.sort(arr)
flag = np.concatenate((... | {
"repo_name": "lmcinnes/umap",
"path": "umap/sparse.py",
"copies": "1",
"size": "16711",
"license": "bsd-3-clause",
"hash": 7042203368052964000,
"line_mean": 25.823434992,
"line_max": 163,
"alpha_frac": 0.5617856502,
"autogenerated": false,
"ratio": 2.7381615598885793,
"config_test": false,
"... |
from warnings import warn
import locale
import numpy as np
import numba
import scipy.sparse
from pynndescent.sparse import sparse_mul, sparse_diff, sparse_sum, arr_intersect
from pynndescent.utils import tau_rand_int, norm
import joblib
from collections import namedtuple
locale.setlocale(locale.LC_NUMERIC, "C")
# ... | {
"repo_name": "lmcinnes/pynndescent",
"path": "pynndescent/rp_trees.py",
"copies": "1",
"size": "38378",
"license": "bsd-2-clause",
"hash": 7960273991405806000,
"line_mean": 29.507154213,
"line_max": 90,
"alpha_frac": 0.5847360467,
"autogenerated": false,
"ratio": 3.5209174311926605,
"config_te... |
from warnings import warn
import numba
import numpy as np
from sklearn.utils import check_random_state, check_array
from sklearn.preprocessing import normalize
from sklearn.base import BaseEstimator, TransformerMixin
from scipy.sparse import csr_matrix, coo_matrix, isspmatrix_csr, vstack as sparse_vstack
import heap... | {
"repo_name": "lmcinnes/pynndescent",
"path": "pynndescent/pynndescent_.py",
"copies": "1",
"size": "70934",
"license": "bsd-2-clause",
"hash": -5319762138558904000,
"line_mean": 35.117107943,
"line_max": 89,
"alpha_frac": 0.5434347422,
"autogenerated": false,
"ratio": 4.179472071647419,
"confi... |
import time
import numba
from numba.core import types
import numba.experimental.structref as structref
import numpy as np
@numba.njit("void(i8[:], i8)", cache=True)
def seed(rng_state, seed):
"""Seed the random number generator with a given seed."""
rng_state.fill(seed + 0xFFFF)
@numba.njit("i4(i8[:])", c... | {
"repo_name": "lmcinnes/pynndescent",
"path": "pynndescent/utils.py",
"copies": "1",
"size": "26112",
"license": "bsd-2-clause",
"hash": -6190717142399839000,
"line_mean": 25.6177370031,
"line_max": 89,
"alpha_frac": 0.5291436887,
"autogenerated": false,
"ratio": 3.5696514012303484,
"config_tes... |
from __future__ import print_function
from collections import deque, namedtuple
from warnings import warn
import numpy as np
import numba
from sparse import sparse_mul, sparse_diff, sparse_sum
from utils import tau_rand_int, norm
import scipy.sparse
import locale
locale.setlocale(locale.LC_NUMERIC, "C")
RandomPro... | {
"repo_name": "nsalomonis/AltAnalyze",
"path": "visualization_scripts/umap_learn/rp_tree.py",
"copies": "2",
"size": "25901",
"license": "apache-2.0",
"hash": 1247695039048144400,
"line_mean": 33.3970783533,
"line_max": 99,
"alpha_frac": 0.6186247635,
"autogenerated": false,
"ratio": 3.7499638048... |
from __future__ import print_function
from warnings import warn
from scipy.optimize import curve_fit
from sklearn.base import BaseEstimator
from sklearn.utils import check_random_state, check_array
from sklearn.metrics import pairwise_distances
from sklearn.preprocessing import normalize
from sklearn.neighbors import ... | {
"repo_name": "nsalomonis/AltAnalyze",
"path": "visualization_scripts/umap_learn_single/umap.py",
"copies": "1",
"size": "60085",
"license": "apache-2.0",
"hash": -6011594142158555000,
"line_mean": 34.6587537092,
"line_max": 101,
"alpha_frac": 0.5926936839,
"autogenerated": false,
"ratio": 4.2241... |
from __future__ import print_function
import locale
from warnings import warn
import time
from scipy.optimize import curve_fit
from sklearn.base import BaseEstimator
from sklearn.utils import check_random_state, check_array
from sklearn.utils.validation import check_is_fitted
from sklearn.metrics import pairwise_dist... | {
"repo_name": "lmcinnes/umap",
"path": "umap/umap_.py",
"copies": "1",
"size": "122740",
"license": "bsd-3-clause",
"hash": -6130575249760982000,
"line_mean": 36.5696357515,
"line_max": 119,
"alpha_frac": 0.569936451,
"autogenerated": false,
"ratio": 4.2793389582316435,
"config_test": false,
... |
from __future__ import print_function
import numpy as np
import numba
import os
from utils import (
tau_rand,
make_heap,
heap_push,
unchecked_heap_push,
smallest_flagged,
rejection_sample,
build_candidates,
new_build_candidates,
deheap_sort,
)
from rp_tree import search_flat_tree
... | {
"repo_name": "nsalomonis/AltAnalyze",
"path": "visualization_scripts/umap_learn_single/nndescent.py",
"copies": "1",
"size": "6541",
"license": "apache-2.0",
"hash": 1640031068484686000,
"line_mean": 32.0353535354,
"line_max": 88,
"alpha_frac": 0.5100137594,
"autogenerated": false,
"ratio": 4.08... |
from __future__ import print_function
import numpy as np
import numba
from utils import (
tau_rand,
make_heap,
heap_push,
unchecked_heap_push,
smallest_flagged,
rejection_sample,
build_candidates,
new_build_candidates,
deheap_sort,
)
from rp_tree import search_flat_tree
def make... | {
"repo_name": "nsalomonis/AltAnalyze",
"path": "visualization_scripts/umap_learn/nndescent.py",
"copies": "1",
"size": "6584",
"license": "apache-2.0",
"hash": 2809182335390182400,
"line_mean": 32.2525252525,
"line_max": 88,
"alpha_frac": 0.5127582017,
"autogenerated": false,
"ratio": 4.074257425... |
import numba
import numpy as np
import scipy.stats
from sklearn.metrics import pairwise_distances
_mock_identity = np.eye(2, dtype=np.float64)
_mock_cost = 1.0 - _mock_identity
_mock_ones = np.ones(2, dtype=np.float64)
@numba.njit()
def sign(a):
if a < 0:
return -1
else:
return 1
@numba.nji... | {
"repo_name": "lmcinnes/umap",
"path": "umap/distances.py",
"copies": "1",
"size": "34710",
"license": "bsd-3-clause",
"hash": 1070194330399386500,
"line_mean": 25.7,
"line_max": 117,
"alpha_frac": 0.5248631518,
"autogenerated": false,
"ratio": 2.6353352061346897,
"config_test": false,
"has_n... |
import numpy as np
import numba
from pynndescent.optimal_transport import (
allocate_graph_structures,
initialize_graph_structures,
initialize_supply,
initialize_cost,
network_simplex_core,
total_cost,
ProblemStatus,
sinkhorn_transport_plan,
)
_mock_identity = np.eye(2, dtype=np.float3... | {
"repo_name": "lmcinnes/pynndescent",
"path": "pynndescent/distances.py",
"copies": "1",
"size": "22266",
"license": "bsd-2-clause",
"hash": 7661509058829166000,
"line_mean": 24.8906976744,
"line_max": 88,
"alpha_frac": 0.562876134,
"autogenerated": false,
"ratio": 2.8046353445018264,
"config_t... |
import numpy as np
import numba
_mock_identity = np.eye(2, dtype=np.float64)
_mock_ones = np.ones(2, dtype=np.float64)
@numba.njit(fastmath=True)
def euclidean(x, y):
"""Standard euclidean distance.
..math::
D(x, y) = \sqrt{\sum_i (x_i - y_i)^2}
"""
result = 0.0
for i in range(x.shape[0]... | {
"repo_name": "nsalomonis/AltAnalyze",
"path": "visualization_scripts/umap_learn_single/distances.py",
"copies": "2",
"size": "9227",
"license": "apache-2.0",
"hash": -7291906459930233000,
"line_mean": 22.9662337662,
"line_max": 82,
"alpha_frac": 0.5405874065,
"autogenerated": false,
"ratio": 2.6... |
import numpy as np
import numba
import os
@numba.njit("i4(i8[:])")
def tau_rand_int(state):
"""A fast (pseudo)-random number generator.
Parameters
----------
state: array of int64, shape (3,)
The internal state of the rng
Returns
-------
A (pseudo)-random int32 value
"""
... | {
"repo_name": "nsalomonis/AltAnalyze",
"path": "visualization_scripts/umap_learn_single/utils.py",
"copies": "1",
"size": "15021",
"license": "apache-2.0",
"hash": -4453322015475643000,
"line_mean": 27.341509434,
"line_max": 88,
"alpha_frac": 0.5788562679,
"autogenerated": false,
"ratio": 3.80086... |
import numpy as np
import numba
@numba.njit("i4(i8[:])")
def tau_rand_int(state):
"""A fast (pseudo)-random number generator.
Parameters
----------
state: array of int64, shape (3,)
The internal state of the rng
Returns
-------
A (pseudo)-random int32 value
"""
state[0] ... | {
"repo_name": "nsalomonis/AltAnalyze",
"path": "visualization_scripts/umap_learn/utils.py",
"copies": "1",
"size": "15036",
"license": "apache-2.0",
"hash": -31823476490458188,
"line_mean": 27.4234404537,
"line_max": 88,
"alpha_frac": 0.5795424315,
"autogenerated": false,
"ratio": 3.8036933974196... |
import time
from warnings import warn
import numpy as np
import numba
from sklearn.utils.validation import check_is_fitted
import scipy.sparse
@numba.njit(parallel=True)
def fast_knn_indices(X, n_neighbors):
"""A fast computation of knn indices.
Parameters
----------
X: array of shape (n_samples, n... | {
"repo_name": "lmcinnes/umap",
"path": "umap/utils.py",
"copies": "1",
"size": "6664",
"license": "bsd-3-clause",
"hash": 741292904563885700,
"line_mean": 29.2954545455,
"line_max": 117,
"alpha_frac": 0.6383553421,
"autogenerated": false,
"ratio": 3.739618406285073,
"config_test": false,
"has... |
__author__ = 'lemontree'
from model.contact import Contacts
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of contacts", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = "da... | {
"repo_name": "lemontree-testing/python_training",
"path": "generator/contact.py",
"copies": "1",
"size": "1376",
"license": "apache-2.0",
"hash": -1113756245671404800,
"line_mean": 34.3076923077,
"line_max": 140,
"alpha_frac": 0.6279069767,
"autogenerated": false,
"ratio": 3.3891625615763545,
... |
__author__ = 'lemontree'
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox()
... | {
"repo_name": "lemontree-testing/python_training",
"path": "fixture/application.py",
"copies": "1",
"size": "1113",
"license": "apache-2.0",
"hash": -1955706920198926800,
"line_mean": 29.9444444444,
"line_max": 83,
"alpha_frac": 0.6082659479,
"autogenerated": false,
"ratio": 4.122222222222222,
... |
__author__ = 'lemontree'
import mysql.connector
from model.group import Group
from model.contact import Contacts
class DbFixture:
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.password = password
self.connection = my... | {
"repo_name": "lemontree-testing/python_training",
"path": "fixture/db.py",
"copies": "1",
"size": "1764",
"license": "apache-2.0",
"hash": -6175389397362057000,
"line_mean": 41,
"line_max": 201,
"alpha_frac": 0.6162131519,
"autogenerated": false,
"ratio": 3.9551569506726456,
"config_test": fal... |
__author__ = 'lemontree'
import re
from model.contact import Contacts
def test_information_on_homepage(app):
contact_from_homepage = app.contact.get_contact_list()[0]
contact_from_editpage = app.contact.get_contact_info_from_editpage(0)
assert contact_from_homepage.all_phones_from_homepage == merge_phones_... | {
"repo_name": "lemontree-testing/python_training",
"path": "test/test_contact_info.py",
"copies": "1",
"size": "2404",
"license": "apache-2.0",
"hash": -9157000777519978000,
"line_mean": 54.9302325581,
"line_max": 151,
"alpha_frac": 0.6896838602,
"autogenerated": false,
"ratio": 3.55096011816839,... |
__author__ = 'lemontree'
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
self.app.open_homepage(wd)
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element... | {
"repo_name": "lemontree-testing/python_training",
"path": "fixture/session.py",
"copies": "1",
"size": "1429",
"license": "apache-2.0",
"hash": -7543387706897415000,
"line_mean": 30.0869565217,
"line_max": 73,
"alpha_frac": 0.5675297411,
"autogenerated": false,
"ratio": 3.3702830188679247,
"co... |
__author__ = 'lemontree'
from model.contact import Contacts
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def change_field_value(self, field_name, text):
wd = self.app.wd
if text is not None:
wd.find_element_by_name(field_name).click()
... | {
"repo_name": "lemontree-testing/python_training",
"path": "fixture/contact.py",
"copies": "1",
"size": "7784",
"license": "apache-2.0",
"hash": 3167348850445189000,
"line_mean": 41.5409836066,
"line_max": 127,
"alpha_frac": 0.6117677287,
"autogenerated": false,
"ratio": 3.526959673765292,
"con... |
__author__ = 'lemontree'
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
if not(wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new"))>0):
wd.find_element_by_link_... | {
"repo_name": "lemontree-testing/python_training",
"path": "fixture/group.py",
"copies": "1",
"size": "4055",
"license": "apache-2.0",
"hash": 1512119655989079600,
"line_mean": 32.7916666667,
"line_max": 97,
"alpha_frac": 0.5948212084,
"autogenerated": false,
"ratio": 3.4956896551724137,
"confi... |
__author__ = 'lemontree'
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.contact import Contacts
from pymysql.converters import decoders
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(int, colu... | {
"repo_name": "lemontree-testing/python_training",
"path": "fixture/orm.py",
"copies": "1",
"size": "2686",
"license": "apache-2.0",
"hash": -4173523865867591700,
"line_mean": 39.1044776119,
"line_max": 150,
"alpha_frac": 0.6675353686,
"autogenerated": false,
"ratio": 3.7099447513812156,
"confi... |
__author__ = 'lemontree'
from sys import maxsize
class Contacts:
def __init__(self, name = None, lastname = None, nickname = None, address = None, company = None, homephone = None,
workphone = None, mobilephone = None, secondaryphone = None, email = None, email_2 = None, email_3 = None,
... | {
"repo_name": "lemontree-testing/python_training",
"path": "model/contact.py",
"copies": "1",
"size": "1540",
"license": "apache-2.0",
"hash": -4800153233505488000,
"line_mean": 40.6486486486,
"line_max": 177,
"alpha_frac": 0.6090909091,
"autogenerated": false,
"ratio": 3.657957244655582,
"conf... |
__author__ = 'Lene Preuss <lene.preuss@gmail.com>'
from recordclass import recordclass
from tests.test_base import TestBase
from train import TrainingRunner
class Args(
recordclass( # type: ignore
'Args', [
'verbose', 'image_size', 'min_valid_tag', 'likes_only', 'category', 'batch_size', 'de... | {
"repo_name": "lene/style-scout",
"path": "tests/training_runner_test.py",
"copies": "1",
"size": "1617",
"license": "bsd-3-clause",
"hash": -8108493253297803000,
"line_mean": 37.5,
"line_max": 104,
"alpha_frac": 0.6054421769,
"autogenerated": false,
"ratio": 3.641891891891892,
"config_test": t... |
import json
from header import comm_key,comm_val
from myexception import ServerNotFound, HttpLibError
import requests
class net:
commHeader = \
{
comm_key.USER_AGENT:comm_val.USER_AGENT,
comm_key.ACCEPT_ENCODING:comm_val.ACCEPT_ENCODING,
comm_key.CONNECTION:comm_val.CONNECTION,
... | {
"repo_name": "kyrie-wan/orderTest",
"path": "network.py",
"copies": "1",
"size": "2741",
"license": "apache-2.0",
"hash": 7221101098498220000,
"line_mean": 30.5057471264,
"line_max": 143,
"alpha_frac": 0.6213060927,
"autogenerated": false,
"ratio": 4.153030303030303,
"config_test": false,
"h... |
import Queue
import time
import re
import json
from PyQt4 import QtCore
# below is self-def pack
import util
from header import *
from network import net
from data import *
from myexception import *
Store = [ 'R388', 'R448', 'R320'] # xd,wfj,slt
Product = ['ME458CH/A', 'ME455CH/A', 'ME452CH/A']
CaptchaUrl = 'h... | {
"repo_name": "kyrie-wan/orderTest",
"path": "workthread.py",
"copies": "1",
"size": "10178",
"license": "apache-2.0",
"hash": -4387729308515325400,
"line_mean": 36.2164179104,
"line_max": 113,
"alpha_frac": 0.5319831562,
"autogenerated": false,
"ratio": 3.604625948680882,
"config_test": false,... |
import sys
import Queue
from PyQt4 import QtCore, QtGui
import workthread
from order import orderInfo
from myexception import HttpLibError
from dialog import LoginDialog
WIN_WIDTH = 1066
WIN_HEIGHT = 500
THREAD_NUM = 10
TIME_SLOT = [u'10:00 上午 - 11:00 上午',u'11:00 上午 - 12:00 下午',u'12:00 下午 - 1:00 下午',u'1:00 下午 - 2... | {
"repo_name": "kyrie-wan/orderTest",
"path": "mainForm.py",
"copies": "1",
"size": "9051",
"license": "apache-2.0",
"hash": -7189936641610364000,
"line_mean": 35.9045643154,
"line_max": 229,
"alpha_frac": 0.6324075115,
"autogenerated": false,
"ratio": 3.527568425228084,
"config_test": false,
... |
import sys
import Queue
from PyQt4 import QtCore, QtGui
import workthread
import order
from myexception import HttpLibError
from dialog import LoginDialog
WIN_WIDTH = 1366
WIN_HEIGHT = 700
THREAD_NUM = 10
TIMESLOT = [u'10:00 上午 - 11:00 上午',u'11:00 上午 - 12:00 下午',u'12:00 下午 - 1:00 下午',u'1:00 下午 - 2:00 下午',u'2:00 下午... | {
"repo_name": "dading/iphone_order",
"path": "mainForm.py",
"copies": "1",
"size": "8973",
"license": "apache-2.0",
"hash": -2199960708716239600,
"line_mean": 35.2821576763,
"line_max": 228,
"alpha_frac": 0.6307903466,
"autogenerated": false,
"ratio": 3.4353634577603143,
"config_test": false,
... |
class comm_key:
ACCEPT_ENCODING = 'Accept-Encoding'
ACCEPT_LANG = 'Accept-Language'
CONNECTION = 'Connection'
HOST = 'Host'
USER_AGENT = 'User-Agent'
CACHE = 'Cache-Control'
class comm_val:
USER_AGENT = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.... | {
"repo_name": "dading/iphone_order",
"path": "header.py",
"copies": "2",
"size": "1359",
"license": "apache-2.0",
"hash": -2538509698971587000,
"line_mean": 27.914893617,
"line_max": 170,
"alpha_frac": 0.6600441501,
"autogenerated": false,
"ratio": 2.849056603773585,
"config_test": false,
"ha... |
__author__ = 'LeoDong'
import cPickle as pickle
import os
import shutil
from sklearn import tree
from SAECrawlers.items import UrlItem
from util import tool
from util import config
from util.logger import log
from FeatueExtract import FeatureExtract
class SAEJudge:
def __init__(self, dtreefile, dtree_param):
... | {
"repo_name": "iLeoDo/SAExtractor",
"path": "SAEFun/judge/SAEJudge.py",
"copies": "1",
"size": "6651",
"license": "apache-2.0",
"hash": 8984642118717682000,
"line_mean": 36.5762711864,
"line_max": 117,
"alpha_frac": 0.5651781687,
"autogenerated": false,
"ratio": 3.7407199100112485,
"config_test... |
__author__ = 'LeoDong'
import re
import os
from bs4 import BeautifulSoup
from util import config
class FeatureExtract:
def __init__(self, featurespace):
file = open(featurespace)
self.__featurespace = BeautifulSoup(file.read(),'xml')
self.__file_map = {}
pass
def extract_ite... | {
"repo_name": "iLeoDo/SAExtractor",
"path": "SAEFun/judge/FeatueExtract.py",
"copies": "1",
"size": "4088",
"license": "apache-2.0",
"hash": 7732699974539870000,
"line_mean": 28.4100719424,
"line_max": 83,
"alpha_frac": 0.5056262231,
"autogenerated": false,
"ratio": 3.8638941398865785,
"config_... |
__author__ = 'LeoDong'
from scrapy.utils.httpobj import urlparse_cached
from scrapy.exceptions import IgnoreRequest
from items import UrlItem
from util import config, tool, db
import logging
class CustomDownloaderMiddleware(object):
def process_response(self, request, response, spider):
# url length
... | {
"repo_name": "iLeoDo/SAExtractor",
"path": "SAEFun/SAECrawlers/middlewares.py",
"copies": "1",
"size": "2323",
"license": "apache-2.0",
"hash": -4969066169306073000,
"line_mean": 41.2363636364,
"line_max": 109,
"alpha_frac": 0.5975032286,
"autogenerated": false,
"ratio": 4.0120898100172715,
"c... |
__author__ = 'LeoDong'
import logging
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors.lxmlhtml import LxmlLinkExtractor
from util import tool, config
import logging
from SAECrawlers.items import UrlItem
class PagesCrawler(CrawlSpider):
name = "retriever"
allowed_domains = config.retr... | {
"repo_name": "iLeoDo/SAExtractor",
"path": "SAEFun/SAECrawlers/spiders/PagesCrawler.py",
"copies": "1",
"size": "1246",
"license": "apache-2.0",
"hash": -4050340928220546000,
"line_mean": 31.7894736842,
"line_max": 80,
"alpha_frac": 0.606741573,
"autogenerated": false,
"ratio": 4.085245901639344... |
__author__ = 'LeoDong'
import os
import logging
# db
db_host = "localhost"
db_name = "sae"
db_user = "sae"
db_pass = "sae"
# logger
logger_level = logging.INFO
# const
const_IS_TARGET_SIGNLE = 1
const_IS_TARGET_MULTIPLE = 2
const_IS_TARGET_UNKNOW = 0
const_IS_TARGET_NO = -1
const_RULE_UNKNOW = [-1]
const_CONFIDEN... | {
"repo_name": "iLeoDo/SAExtractor",
"path": "SAEFun/util/config.py",
"copies": "1",
"size": "4319",
"license": "apache-2.0",
"hash": -3158790980359699500,
"line_mean": 26.6923076923,
"line_max": 117,
"alpha_frac": 0.5667978699,
"autogenerated": false,
"ratio": 2.6415902140672785,
"config_test":... |
__author__ = 'LeoDong'
import re
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
from bs4 import BeautifulSoup
import dateparser
class InfoExtractor:
def __init__(self, extract_space_file_path, rule_files_path):
soup = BeautifulSoup(open(extract_space_file_path).read(), 'xml')
attrlist = so... | {
"repo_name": "iLeoDo/SAExtractor",
"path": "SAEFun/extractor/InfoExtractor.py",
"copies": "1",
"size": "9432",
"license": "apache-2.0",
"hash": -7415075793841220000,
"line_mean": 29.0382165605,
"line_max": 91,
"alpha_frac": 0.4819762511,
"autogenerated": false,
"ratio": 4.039400428265525,
"con... |
__author__ = 'leonmi'
import argparse
import csv
import io
import itertools
import os
import time
import StringIO
import re
from django.core.management.base import BaseCommand, CommandError
from django.core.mail import EmailMessage
from django.core import mail
from odm2admin.models import Timeseriesresultvaluesext
fro... | {
"repo_name": "miguelcleon/ODM2-Admin",
"path": "odm2admin/management/commands/export_timeseriesresultvaluesextwannotations.py",
"copies": "2",
"size": "3773",
"license": "mit",
"hash": -4346801758932907500,
"line_mean": 40.0108695652,
"line_max": 120,
"alpha_frac": 0.6413994169,
"autogenerated": f... |
__author__ = 'lerker'
import random
import numpy as np
import cupydle.dnn.fileio as fileio
class LabeledDataSet(object):
def __init__(self, path, delimiter=';'):
self.data = fileio.load_file(path, separador=delimiter)
def split_data(self, labelRow=-1):
entrada = np.array(self.data[:, 0:labelR... | {
"repo_name": "lerker/cupydle",
"path": "cupydle/dnn/viejo/data.py",
"copies": "1",
"size": "4395",
"license": "apache-2.0",
"hash": -5397853457534040000,
"line_mean": 31.7985074627,
"line_max": 112,
"alpha_frac": 0.6056882821,
"autogenerated": false,
"ratio": 3.3755760368663594,
"config_test":... |
__author__ = 'lerker'
# Dependencias externas
#from scipy.io import loadmat, savemat
import numpy as np
text_extensions = ['.dat', '.txt', '.csv']
def parse_point(line):
# TODO dar posibilidad de cambiar separador
values = [float(x) for x in line.split(';')]
return values[-1], values[0:-1]
# Checks
de... | {
"repo_name": "lerker/cupydle",
"path": "cupydle/dnn/viejo/fileio.py",
"copies": "1",
"size": "3182",
"license": "apache-2.0",
"hash": 6743485139266738000,
"line_mean": 30.504950495,
"line_max": 75,
"alpha_frac": 0.5744814582,
"autogenerated": false,
"ratio": 3.653272101033295,
"config_test": f... |
#libraries
from rdkit import Chem
from rdkit.Chem import AllChem
from sklearn.naive_bayes import BernoulliNB
import cPickle
import glob
import os
import sys
import numpy as np
def introMessage():
print '=============================================================================================='
print ' Aut... | {
"repo_name": "lhm30/PIDGIN",
"path": "predict_binary.py",
"copies": "1",
"size": "3324",
"license": "mit",
"hash": 4863536008543163000,
"line_mean": 29.504587156,
"line_max": 108,
"alpha_frac": 0.6046931408,
"autogenerated": false,
"ratio": 3.3746192893401017,
"config_test": false,
"has_no_k... |
#libraries
from rdkit import Chem
from rdkit.Chem import AllChem
from sklearn.naive_bayes import BernoulliNB
import cPickle
import glob
import os
import sys
import numpy as np
def introMessage():
print '=============================================================================================='
print ' Author: L... | {
"repo_name": "lhm30/PIDGIN",
"path": "singlemodel/predict_singlemodel_ranked_number.py",
"copies": "1",
"size": "2536",
"license": "mit",
"hash": 5121917610231360000,
"line_mean": 30.7125,
"line_max": 105,
"alpha_frac": 0.6675867508,
"autogenerated": false,
"ratio": 2.9049255441008017,
"config... |
#libraries
from rdkit import Chem
from rdkit.Chem import AllChem
from sklearn.naive_bayes import BernoulliNB
import cPickle
import glob
import os
import sys
import operator
import numpy as np
def introMessage():
print '=============================================================================================='... | {
"repo_name": "lhm30/PIDGIN",
"path": "predict_enriched_two_libraries.py",
"copies": "1",
"size": "4150",
"license": "mit",
"hash": -8618986361364721000,
"line_mean": 30.4393939394,
"line_max": 156,
"alpha_frac": 0.6457831325,
"autogenerated": false,
"ratio": 3.146322971948446,
"config_test": f... |
#libraries
import pymysql
import random
import time
import getpass
random.seed(2)
from rdkit import Chem
from rdkit.Chem import AllChem
from sklearn.naive_bayes import BernoulliNB
import cPickle
import glob
import gc
from collections import Counter
import os
import sys
import numpy as np
from multiprocessing import Po... | {
"repo_name": "lhm30/PIDGIN",
"path": "predict_enriched.py",
"copies": "1",
"size": "9710",
"license": "mit",
"hash": 1325150728449995800,
"line_mean": 27.5588235294,
"line_max": 160,
"alpha_frac": 0.676930999,
"autogenerated": false,
"ratio": 2.8425058548009368,
"config_test": false,
"has_no... |
#libraries
import pymysql
import random
random.seed(2)
import time
import getpass
from rdkit import Chem
from rdkit.Chem import AllChem
from sklearn.naive_bayes import BernoulliNB
import cPickle
import glob
import gc
from collections import Counter
import os
import sys
import numpy as np
from multiprocessing import Po... | {
"repo_name": "lhm30/PIDGIN",
"path": "predict_fingerprints.py",
"copies": "1",
"size": "6961",
"license": "mit",
"hash": -7922772814232711000,
"line_mean": 26.844,
"line_max": 119,
"alpha_frac": 0.6661399224,
"autogenerated": false,
"ratio": 2.800080450522928,
"config_test": false,
"has_no_k... |
#libraries
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit import DataStructs
import cPickle
import zipfile
import glob
import os
import sys
import math
import numpy as np
from multiprocessing import Pool
import multiprocessing
multiprocessing.freeze_support()
def introMessage():
print '============... | {
"repo_name": "lhm30/PIDGINv2",
"path": "sim_to_train.py",
"copies": "1",
"size": "6260",
"license": "mit",
"hash": 3525289980568648000,
"line_mean": 34.7714285714,
"line_max": 229,
"alpha_frac": 0.6738019169,
"autogenerated": false,
"ratio": 2.807174887892377,
"config_test": false,
"has_no_k... |
#libraries
from rdkit import Chem
from rdkit.Chem import AllChem
import cPickle
import glob
import zipfile
import os
import sys
import math
import numpy as np
from multiprocessing import Pool
import multiprocessing
from scipy.spatial.distance import rogerstanimoto
from scipy.spatial.distance import jaccard
def introM... | {
"repo_name": "lhm30/PIDGINv2",
"path": "predict_binary_similarity_two_libraries.py",
"copies": "1",
"size": "6455",
"license": "mit",
"hash": -5730510707380569000,
"line_mean": 35.061452514,
"line_max": 138,
"alpha_frac": 0.6788536019,
"autogenerated": false,
"ratio": 2.9327578373466605,
"conf... |
#libraries
from rdkit import Chem
from rdkit.Chem import AllChem
import cPickle
import zipfile
import glob
import os
import sys
import math
import numpy as np
from multiprocessing import Pool
import multiprocessing
from collections import Counter
multiprocessing.freeze_support()
def introMessage():
print '==========... | {
"repo_name": "lhm30/PIDGINv2",
"path": "predict_target_fingerprints.py",
"copies": "1",
"size": "6018",
"license": "mit",
"hash": -53320258820617420,
"line_mean": 34.6094674556,
"line_max": 138,
"alpha_frac": 0.6751412429,
"autogenerated": false,
"ratio": 2.9733201581027666,
"config_test": fal... |
__author__ = 'lewuahte'
import unittest
import numpy as np
import kHLL.hash.image
class TestImageHash(unittest.TestCase):
def test_md5_for_vec(self):
vec = np.array([1, 2, 3])
ret = kHLL.hash.image.md5_for_vec(vec, 'hex')
self.assertEqual(ret, 'aa341a15f5ade44faafbe190f98c2587')
def ... | {
"repo_name": "PhysicsEngine/kHLL",
"path": "kHLL/test/test_image_hash.py",
"copies": "1",
"size": "1735",
"license": "mit",
"hash": -3306493972246086700,
"line_mean": 35.914893617,
"line_max": 161,
"alpha_frac": 0.6760806916,
"autogenerated": false,
"ratio": 2.403047091412742,
"config_test": t... |
__author__ = 'lewuathe'
from sklearn import datasets
from sklearn.cluster import KMeans
def main():
print(__doc__)
# Code source: Gaël Varoquaux
# Modified for documentation by Jaques Grobler
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mp... | {
"repo_name": "PhysicsEngine/kHLL",
"path": "kHLL/example/kmeans_example.py",
"copies": "1",
"size": "2368",
"license": "mit",
"hash": -5327061960315053000,
"line_mean": 27.1785714286,
"line_max": 73,
"alpha_frac": 0.5340092945,
"autogenerated": false,
"ratio": 3.220408163265306,
"config_test":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.