repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/stats.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # # TITLE : coordinates initialization file # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ----------------------------------------------------------------------------- # Docstring and Metadata """Statist...
1,456
19.236111
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/units_decorators.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : unit decorator # AUTHOR : Nathaniel Starkman # PROJECT : Adapted for AST1501 from astronat # # ---------------------------------------------------------------------------- # Docstring and Metadata """...
28,317
34.133995
111
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/isochrone.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : isochrone # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """isochrone.""" __author__ = "Na...
4,288
24.081871
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/table_utils.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : Table utilities # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """Table utilities. Routine...
5,958
20.131206
83
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/util.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : util # AUTHOR : Nathaniel Starkman # PROJECT : AST15r01 # # ---------------------------------------------------------------------------- # Docstring and Metadata """util. Routine Listings -----------...
5,076
23.17619
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/MegaCamGen1_from_PS1.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : MegaCamGen1_from_PS1 # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """MegaCamGen1_from_PS1...
17,792
20.966667
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/__init__.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : util initialization # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """util. Routine Listin...
1,295
18.343284
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/paths/__init__.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : paths initialization file # AUTHOR : Nathaniel Starkman # PROJECT : starkython # # ---------------------------------------------------------------------------- # Docstring and Metadata """initializati...
1,125
18.754386
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/coordinates/CustomCoords.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : Custom Coordinates # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """Custom Coordinates. T...
9,412
25.515493
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/coordinates/frameattrs.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # # TITLE : frameattrs # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ----------------------------------------------------------------------------- # Docstring and Metadata """Frame ...
17,748
32.551985
81
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/coordinates/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # # TITLE : coordinates initialization file # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ----------------------------------------------------------------------------- # Docstring a...
625
22.185185
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/progenitors/load_progenitor.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : load_progenitor # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """Load Progenitors.""" __a...
5,287
23.943396
89
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/progenitors/__init__.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : progenitors initialization # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """progenitors: i...
724
21.65625
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/progenitors/Palomar5.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # # TITLE : Palomar5 # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ----------------------------------------------------------------------------- # Docstring and Metadata """Palomar 5 Information.""" __a...
2,418
28.144578
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/orbit/exceptions.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : exceptions # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """Exceptions.""" __author__ = "...
867
20.7
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/orbit/_indexdict.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : indexdict # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """IndexDict.""" __author__ = "Na...
7,639
21.339181
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/orbit/OrbitKeeper.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : OrbitKeeper # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """OrbitKeeper.""" __author__ =...
11,370
25.692488
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/orbit/__init__.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : orbit initialization # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """orbit initialization...
609
22.461538
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/orbit/_sequentialorbits.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : Sequential Orbits # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """SequentialOrbits.""" _...
30,641
26.31016
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/scripts/imports.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : Standard Import File # AUTHOR : Nathaniel Starkman # PROJECT : Pal-5-in-Gaia-DR2 # # ---------------------------------------------------------------------------- # Docstring and MetaData """Standard I...
2,738
26.118812
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/scripts/make_ibata16_modified/make_ibata16_modified.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : make Ibata 2016 CFHT table # AUTHOR : Nathaniel Starkman # PROJECT : Palomar 5 in Gaia DR2 # # ---------------------------------------------------------------------------- ### Do...
2,535
24.877551
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/scripts/get_gaia_window/make_gaia_query.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : make gaia query # AUTHOR : Nathaniel Starkman # PROJECT : Palomar 5 in Gaia DR2 # # ---------------------------------------------------------------------------- ### Docstring and...
13,824
31.151163
89
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/scripts/get_gaia_window/2019-6-11/do_query_script.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : make gaia query # AUTHOR : Nathaniel Starkman # PROJECT : Palomar 5 in Gaia DR2 # # ---------------------------------------------------------------------------- ### Docstring and...
5,170
28.890173
78
py
irbl
irbl-master/src/main.py
import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import LabelEncoder from sklearn import datasets from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt import os from sklearn.calib...
67,075
35.673592
199
py
mooc_knowledge_gain
mooc_knowledge_gain-main/weka_evaluation/average_result.py
import argparse import os import pandas as pd import glob import re import numpy as np import matplotlib.pyplot as plt from os.path import basename required_columns = ['Key_Dataset', 'Percent_correct', 'Kappa_statistic', 'Mean_absolute_error', 'Root_mean_squared_error', 'Relative_absolute_error',...
9,251
38.370213
132
py
mooc_knowledge_gain
mooc_knowledge_gain-main/dataset_processing/merge_files.py
import sys import argparse import csv import pandas as pd def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument('-f', '--folder', type=str, required=False, default='all', help='set the foldername of the dataset') parser.add_argument('-k', '--k_fold', type=int, required=False, defau...
6,274
67.956044
217
py
mooc_knowledge_gain
mooc_knowledge_gain-main/dataset_processing/feature_selection.py
import os import argparse from math import ceil import pandas as pd import csv import numpy as np import random import scipy from sklearn.model_selection import KFold, RepeatedKFold, StratifiedKFold from sklearn.preprocessing import MinMaxScaler from rfpimp import permutation_importances, dropcol_importances, oob_class...
38,354
51.903448
139
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/embedding.py
from sentence_transformers import SentenceTransformer, util from numpy import add from torch import Tensor from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler def get_model(name): """ Loads the SentenceTransformer for the specific model. If the model is not stored it will be dow...
5,370
42.314516
125
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/main.py
import os import files import sys import pre_processor import client def start_nlp(): """" Start stanza and corenlp server to have a preload. """ try: sta = pre_processor.start_stanza('en', 'tokenize,mwt,pos,lemma,ner') cli = client.init_client() client.start_client(cli) re...
1,693
29.25
117
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/SortedCollection.py
from bisect import bisect_left, bisect_right # This file was suggested in https://github.com/pymupdf/PyMuPDF/wiki/How-to-extract-text-in-natural-reading-order-(up2down,-left2right) # Downloaded from https://code.activestate.com/recipes/577197-sortedcollection/ class SortedCollection(object): '''Sequence sorted by ...
11,327
35.076433
135
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/pre_processor.py
import stanza import srt import re def init_stanza(): """ Initialise stanza for the first time (downloads the important data) """ stanza.download('en') def start_stanza(lang, processors): """ Starts stanza to use it later :param lang: The language which stanza should process :param processor...
7,480
37.761658
120
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/tenses.py
class Tenses: """ Class that calculate time tense specific features """ def __init__(self): """ Initialise class-object with default values """ # Present self.sim_pres = 0 # Simple Present self.pres_prog = 0 # Present Progressive (includes going-to future because ...
29,322
44.74571
120
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/readability.py
import math def flesch_reading_ease(total_words, total_sentences, total_syllables): """ Calculates the value of the flesch reading ease index :param total_words: amount of words in the text :param total_sentences: amount of sentences in the text :param total_syllables: amount of syllables in the text ...
5,523
37.096552
106
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/client.py
import os from stanza import install_corenlp from stanza.server import CoreNLPClient def install(): """ Installs the files for corenlp if they do not exist """ if not(os.path.isdir("./corenlp")): install_corenlp(dir="./corenlp/") def init_client(): """ Initialise the client :return: clie...
1,322
25.46
91
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/processor.py
import re import syllapy import CompoundWordSplitter import pre_processor import readability import tenses import csv def count_syllables(csv_file, word): """ Counts syllables from a word. The algorithm checks a list if it contains the word or not. If it contains the word then the amount of syllables is ...
53,380
46.789615
121
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/files.py
import os import sys import csv import fitz import processor import client import embedding import re import scipy import numpy import torch from operator import itemgetter from SortedCollection import SortedCollection def load_stop_words(path): """ Loads stopwords of the stopwords.txt file to use them later ...
34,651
50.642325
119
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/CompoundWordSplitter.py
# from Github : https://github.com/GokulVSD/FOGIndex import enchant,sys # requires PyEnchant library # to be able to support Python 2 & 3 if sys.version_info[0] > 2: unicode = str def __concat(object1, object2): if isinstance(object1, str) or isinstance(object1, unicode): object1 = [object1] if...
1,256
18.338462
77
py
GoogleScraper
GoogleScraper-master/setup.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import re from setuptools import setup version = re.search( "^__version__\s*=\s*'(.*)'", open('GoogleScraper/version.py').read(), re.M).group(1) requirements = [r for r in open('requirements.txt', 'r').read().split('\n') if r] # https://dustingram.com/artic...
1,016
32.9
154
py
GoogleScraper
GoogleScraper-master/run.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Convenience wrapper for running GoogleScrapper directly from source tree.""" from GoogleScraper.core import main if __name__ == '__main__': main()
204
19.5
79
py
GoogleScraper
GoogleScraper-master/conf.py
from recommonmark.parser import CommonMarkParser source_parsers = { '.md': CommonMarkParser, } source_suffix = ['.rst', '.md']
133
15.75
48
py
GoogleScraper
GoogleScraper-master/GoogleScraper/search_engine_parameters.py
""" Contains all parameters and sources/information about the parameters of the supported search engines. All values set to None, are NOT INCLUDED in the GET request! Everything else (also the empty string), is included in the request """ """Google search params Some good stuff: http://www.blueglass.com/blog/goo...
19,628
48.195489
128
py
GoogleScraper
GoogleScraper-master/GoogleScraper/__main__.py
# -*- coding: utf-8 -*- from .core import main """ This file is executed by the toolchain and used as a entry point. """ # Call the main function of GoogleScraper. main(return_results=False)
195
15.333333
65
py
GoogleScraper
GoogleScraper-master/GoogleScraper/output_converter.py
# -*- coding: utf-8 -*- import csv import sys import json import pprint import logging from GoogleScraper.database import Link, SERP """Stores SERP results in the appropriate output format. Streamline process, one serp object at the time, because GoogleScraper works incrementally. Furthermore we cannot accumulate al...
4,293
29.239437
123
py
GoogleScraper
GoogleScraper-master/GoogleScraper/core.py
# -*- coding: utf-8 -*- from __future__ import print_function import threading import datetime import sys import hashlib import os import queue from GoogleScraper.log import setup_logger from GoogleScraper.commandline import get_command_line from GoogleScraper.database import ScraperSearch, SERP, Link, get_session, fi...
18,163
37
155
py
GoogleScraper
GoogleScraper-master/GoogleScraper/scraping.py
# -*- coding: utf-8 -*- import datetime import random import time import os import abc import math from GoogleScraper.proxies import Proxy from GoogleScraper.database import db_Proxy from GoogleScraper.output_converter import store_serp_result from GoogleScraper.parsing import get_parser_by_search_engine, parse_serp ...
17,276
33.211881
128
py
GoogleScraper
GoogleScraper-master/GoogleScraper/proxies.py
# -*- coding: utf-8 -*- from collections import namedtuple import os import pymysql import re from GoogleScraper import database import logging Proxy = namedtuple('Proxy', 'proto, host, port, username, password') logger = logging.getLogger(__name__) def parse_proxy_file(fname): """Parses a proxy file The f...
4,396
33.351563
120
py
GoogleScraper
GoogleScraper-master/GoogleScraper/socks.py
""" SocksiPy - Python SOCKS module. Version 1.5.0 Copyright 2006 Dan-Haim. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this ...
26,802
38.071429
109
py
GoogleScraper
GoogleScraper-master/GoogleScraper/utils.py
# -*- coding: utf-8 -*- from itertools import zip_longest import re import requests import os def grouper(iterable, n, fillvalue=None): """Collect data into fixed-length chunks or blocks. >>> grouper('ABCDEFG', 3, 'x') [['A', 'B', 'C'], ['D', 'E', 'F'], ['G', 'x', 'x']] Args: iterable: An i...
2,442
24.715789
108
py
GoogleScraper
GoogleScraper-master/GoogleScraper/user_agents.py
# -*- coding: utf-8 -*- import random # Several different User-Agents to diversify the requests. # Keep the User-Agents updated. Last update: 13th November 2014 # Get them here: http://techblog.willshouse.com/2012/01/03/most-common-user-agents/ user_agents = ['Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/53...
8,746
89.175258
147
py
GoogleScraper
GoogleScraper-master/GoogleScraper/parsing-new-version.py
# -*- coding: utf-8 -*- import sys import os import re import lxml.html from lxml.html.clean import Cleaner from urllib.parse import unquote import pprint import logging from cssselect import HTMLTranslator logger = logging.getLogger(__name__) class InvalidSearchTypeException(Exception): pass class UnknowUrlE...
38,678
34.355576
151
py
GoogleScraper
GoogleScraper-master/GoogleScraper/log.py
# -*- coding: utf-8 -*- import sys import logging """ Loggers are created at the top of modules. Therefore each code may access a logger. But there is a fundamental problem to this approach: The configuration that determines the state of GoogleScraper may come from various sources and is parsed only at runtime in th...
1,202
30.657895
112
py
GoogleScraper
GoogleScraper-master/GoogleScraper/config.py
# -*- coding: utf-8 -*- import GoogleScraper.scrape_config import inspect import os try: # SourceFileLoader is the recommended way in 3.3+ from importlib.machinery import SourceFileLoader def load_source(name, path): return SourceFileLoader(name, path).load_module() except ImportError: # but ...
2,194
33.84127
104
py
GoogleScraper
GoogleScraper-master/GoogleScraper/version.py
__version__ = '0.2.5'
22
10.5
21
py
GoogleScraper
GoogleScraper-master/GoogleScraper/http_mode.py
# -*- coding: utf-8 -*- import threading import json import datetime import socket from urllib.parse import urlencode import GoogleScraper.socks as socks from GoogleScraper.scraping import SearchEngineScrape, get_base_search_url_by_search_engine from GoogleScraper.parsing import get_parser_by_search_engine from Googl...
10,723
33.931596
125
py
GoogleScraper
GoogleScraper-master/GoogleScraper/scrape_jobs.py
# -*- coding: utf-8 -*- import logging logger = logging.getLogger(__name__) """ The core logic of GoogleScraper is handled here. By default, every keyword is scraped on all given search engines for the supplied number of pages. Example: keywords = ('one', 'two') search_eninges = ('google, 'yandex') num_pages = 5 ...
2,205
26.924051
94
py
GoogleScraper
GoogleScraper-master/GoogleScraper/commandline.py
# -*- coding: utf-8 -*- import argparse from GoogleScraper.version import __version__ def get_command_line(only_print_help=False): """ Parse command line arguments when GoogleScraper is used as a CLI application. Returns: The configuration as a dictionary that determines the behaviour of the app...
8,247
57.914286
138
py
GoogleScraper
GoogleScraper-master/GoogleScraper/database.py
# -*- coding: utf-8 -*- """ The database schema of GoogleScraper. There are four entities: ScraperSearch: Represents a call to GoogleScraper. A search job. SearchEngineResultsPage: Represents a SERP result page of a search_engine Link: Represents a LINK on a SERP Proxy: Stores all proxies and their s...
9,479
31.027027
138
py
GoogleScraper
GoogleScraper-master/GoogleScraper/parsing.py
# -*- coding: utf-8 -*- import sys import os import re import lxml.html from lxml.html.clean import Cleaner from urllib.parse import unquote import pprint from GoogleScraper.database import SearchEngineResultsPage import logging from cssselect import HTMLTranslator logger = logging.getLogger(__name__) class Invalid...
39,004
34.203069
153
py
GoogleScraper
GoogleScraper-master/GoogleScraper/__init__.py
# -*- coding: utf-8 -*- """ I switched my motto; instead of saying "fuck tomorrow" That buck that bought a bottle could've struck the lotto. """ __author__ = 'Nikolai Tschacher' __updated__ = '18.08.2018' # day.month.year __home__ = 'incolumitas.com' from GoogleScraper.proxies import Proxy from GoogleScraper.config...
595
23.833333
78
py
GoogleScraper
GoogleScraper-master/GoogleScraper/async_mode.py
import asyncio import aiohttp import datetime from urllib.parse import urlencode from GoogleScraper.parsing import get_parser_by_search_engine, parse_serp from GoogleScraper.http_mode import get_GET_params_for_search_engine, headers from GoogleScraper.scraping import get_base_search_url_by_search_engine from GoogleScra...
5,254
33.123377
134
py
GoogleScraper
GoogleScraper-master/GoogleScraper/scrape_config.py
# -*- coding: utf-8 -*- """ This is the basic GoogleScraper configuration file. All options are basic Python data types. You may use all of Python's language capabilities to specify settings in this file. """ """ [OUTPUT] Settings which control how GoogleScraper represents it's results and handles output. """ # How...
12,119
30.480519
117
py
GoogleScraper
GoogleScraper-master/GoogleScraper/selenium_mode.py
# -*- coding: utf-8 -*- import tempfile import threading from urllib.parse import quote import json import datetime import time import math import random import re import sys import os try: from selenium import webdriver from selenium.common.exceptions import TimeoutException, WebDriverException from sele...
36,591
37.845011
147
py
GoogleScraper
GoogleScraper-master/GoogleScraper/caching.py
# -*- coding: utf-8 -*- import os import time import hashlib import gzip import bz2 import re from sqlalchemy.orm.exc import NoResultFound from GoogleScraper.database import SearchEngineResultsPage from GoogleScraper.parsing import parse_serp from GoogleScraper.output_converter import store_serp_result import logging ...
20,538
37.035185
138
py
GoogleScraper
GoogleScraper-master/Tests/integration_tests.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os import unittest from GoogleScraper import scrape_with_config from GoogleScraper.parsing import get_parser_by_search_engine from GoogleScraper.config import get_config from collections import Counter config = get_config() base = os.path.dirname(os.path.realpath(__fi...
17,647
42.900498
174
py
GoogleScraper
GoogleScraper-master/Tests/testing_utils.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- import random from GoogleScraper.utils import get_some_words def assert_atleast_delta_percent_of_items(data, attr_name, delta=0.9): """Checks that at least delta percent of the results are not None. """ n=k=0 for obj in data: n+=1 if not getattr(ob...
714
20.666667
70
py
GoogleScraper
GoogleScraper-master/Tests/functional_tests.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ These functional tests cannot cover the whole functionality of GoogleScraper. But it is tried to cover at least the most common use cases with GoogleScraper, such that a basic functionality is shown to be correct. The functional tests are run on git hook pre-push time, s...
29,467
44.196319
131
py
GoogleScraper
GoogleScraper-master/docs/source/conf.py
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
5,975
29.181818
79
py
GoogleScraper
GoogleScraper-master/Examples/headlesschrome.py
from selenium import webdriver chromedriver = '/usr/bin/chromedriver' options = webdriver.ChromeOptions() options.add_argument('headless') options.add_argument('window-size=1200x600') # optional #browser = webdriver.Chrome(executable_path=chromedriver, chrome_options=options) browser = webdriver.Chrome(chrome_option...
469
26.647059
81
py
GoogleScraper
GoogleScraper-master/Examples/image_search.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from GoogleScraper import scrape_with_config, GoogleSearchError # simulating a image search for all search engines that support image search. # Then download all found images :) target_directory = 'images/' # See in the config.cfg file for possible values config = { ...
2,278
23.771739
87
py
GoogleScraper
GoogleScraper-master/Examples/keywords.py
""" GoogleScraper will scrape the jobs according to the dictionaries below. Passing the scrape_jobs to GoogleScraper is simple: GoogleScraper --keyword-file keywords.py """ scrape_jobs = [ { 'query': 'hello world', 'search_engine': 'google', # on which search engines this keyword should be searc...
836
24.363636
94
py
GoogleScraper
GoogleScraper-master/Examples/http_mode_example.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from GoogleScraper import scrape_with_config, GoogleSearchError keywords = [ 'one ', 'two', 'three' ] # See in the config.cfg file for possible values config = { 'use_own_ip': 'True', 'keywords': keywords, 'search_engines': ['bing',], 'num_pa...
577
18.266667
63
py
GoogleScraper
GoogleScraper-master/Examples/finding_plagiarized_content.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from GoogleScraper import scrape_with_config, GoogleSearchError text = """ Python is a multi-paradigm programming language: object-oriented programming and structured programming are fully supported, and there are a number of language features which support functional p...
4,894
52.791209
489
py
GoogleScraper
GoogleScraper-master/Examples/async_mode_example.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from GoogleScraper import scrape_with_config, GoogleSearchError from GoogleScraper.utils import get_some_words keywords = get_some_words(10) with open('keywords.txt', 'wt') as f: for word in keywords: f.write(word + '\n') # See in the config.cfg file for pos...
808
23.515152
63
py
GoogleScraper
GoogleScraper-master/Examples/headless-firefox.py
from selenium import webdriver from selenium.webdriver.firefox.options import Options from selenium.webdriver.firefox.firefox_binary import FirefoxBinary binary = FirefoxBinary('/home/nikolai/ff/firefox/firefox') options = Options() options.set_headless(headless=True) driver = webdriver.Firefox(firefox_binary=binary,...
478
33.214286
70
py
GoogleScraper
GoogleScraper-master/Examples/basic.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from GoogleScraper import scrape_with_config, GoogleSearchError # See in the config.cfg file for possible values config = { 'use_own_ip': True, 'keyword': 'Let\'s go bubbles!', 'search_engines': ['yandex', 'bing'], 'num_pages_for_keyword': 1, 'scrape_...
786
22.147059
63
py
GoogleScraper
GoogleScraper-master/Examples/basic_2_pages.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from GoogleScraper import scrape_with_config, GoogleSearchError # See in the config.cfg file for possible values config = { 'use_own_ip': True, 'keyword': 'reddit', 'search_engines': ['bing',], 'num_pages_for_keyword': 2, 'scrape_method': 'selenium', ...
741
21.484848
63
py
GoogleScraper
GoogleScraper-master/Examples/selenium_mode_example.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from GoogleScraper import scrape_with_config, GoogleSearchError keywords = [ 'alpha ', 'beta', 'yankee' ] # See in the config.cfg file for possible values config = { 'use_own_ip': True, 'keywords': keywords, 'search_engines': ['baidu', 'duckduckg...
601
19.066667
63
py
GoogleScraper
GoogleScraper-master/Examples/normal-chrome.py
import time from selenium import webdriver from selenium.common.exceptions import TimeoutException, WebDriverException, ElementNotVisibleException, NoSuchElementException from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait f...
2,227
33.8125
127
py
crnn-pytorch
crnn-pytorch-master/alphabets.py
alphabet = """的 是 不 我 一 有 大 在 人 了 中 到 資 要 可 以 這 個 你 會 好 為 上 來 就 學 交 也 用 能 如 文 時 沒 說 他 看 提 那 問 生 過 下 請 天 們 所 多 麼 小 想 得 之 還 電 出 工 對 都 機 自 後 子 而 訊 站 去 心 只 家 知 國 台 很 信 成 章 何 同 道 地 發 法 無 然 但 嗎 當 於 本 現 年 前 真 最 和 新 因 果 定 意 情 點 題 其 事 方 清 科 樣 些 吧 三 此 位 理 行 作 經 者 什 謝 名 日 正 華 話 開 實 再 城 愛 與 二 動 比 高 面 又 車 力 或 種 像 應 女 教 分 手 打 已 次 長 ...
2,017
1.015984
15
py
crnn-pytorch
crnn-pytorch-master/utils.py
#!/usr/bin/python # encoding: utf-8 import torch import torch.nn as nn from torch.autograd import Variable import collections class strLabelConverter(object): """Convert between str and label. NOTE: Insert `blank` to the alphabet for CTC. Args: alphabet (str): set of the possible charac...
4,860
28.107784
136
py
crnn-pytorch
crnn-pytorch-master/dataset.py
#!/usr/bin/python # encoding: utf-8 import random import torch from torch.utils.data import Dataset from torch.utils.data import sampler import torchvision.transforms as transforms import lmdb import six import sys from PIL import Image import numpy as np class lmdbDataset(Dataset): def __init__(self, root=None...
4,008
28.262774
78
py
crnn-pytorch
crnn-pytorch-master/demo.py
import torch from torch.autograd import Variable import utils import dataset from PIL import Image import models.crnn as crnn import params import argparse parser = argparse.ArgumentParser() parser.add_argument('-m', '--model_path', type = str, required = True, help = 'crnn model path') parser.add_argument('-i', '--i...
1,455
27.54902
96
py
crnn-pytorch
crnn-pytorch-master/params.py
import alphabets # about data and net alphabet = alphabets.alphabet keep_ratio = False # whether to keep ratio for image resize manualSeed = 1234 # reproduce experiemnt random_sample = True # whether to sample the dataset with random sampler imgH = 32 # the height of the input image to network imgW = 100 # the width o...
1,368
38.114286
78
py
crnn-pytorch
crnn-pytorch-master/train.py
from __future__ import print_function from __future__ import division import argparse import random import torch import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data from torch.autograd import Variable import numpy as np # from warpctc_pytorch import CTCLoss from torch.nn import CTC...
8,227
29.587361
133
py
crnn-pytorch
crnn-pytorch-master/models/crnn.py
import torch.nn as nn import params import torch.nn.functional as F class BidirectionalLSTM(nn.Module): def __init__(self, nIn, nHidden, nOut): super(BidirectionalLSTM, self).__init__() self.rnn = nn.LSTM(nIn, nHidden, bidirectional=True) self.embedding = nn.Linear(nHidden * 2, nOut) ...
2,865
30.494505
78
py
crnn-pytorch
crnn-pytorch-master/models/__init__.py
0
0
0
py
crnn-pytorch
crnn-pytorch-master/tool/convert_t7.py
import torchfile import argparse import torch from torch.nn.parameter import Parameter import numpy as np import models.crnn as crnn layer_map = { 'SpatialConvolution': 'Conv2d', 'SpatialBatchNormalization': 'BatchNorm2d', 'ReLU': 'ReLU', 'SpatialMaxPooling': 'MaxPool2d', 'SpatialAveragePooling': ...
5,075
29.214286
76
py
crnn-pytorch
crnn-pytorch-master/tool/create_dataset.py
import os import lmdb import cv2 import numpy as np import argparse import shutil import sys def checkImageIsValid(imageBin): if imageBin is None: return False try: imageBuf = np.fromstring(imageBin, dtype=np.uint8) img = cv2.imdecode(imageBuf, cv2.IMREAD_GRAYSCALE) imgH, i...
4,645
32.185714
108
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/parser.py
import os import torch import argparse def parse_arguments(): parser = argparse.ArgumentParser(description="Benchmarking Visual Geolocalization", formatter_class=argparse.ArgumentDefaultsHelpFormatter) # Training parameters parser.add_argument("--train_batch_size", ty...
9,823
70.188406
142
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/test.py
import faiss import torch import logging import numpy as np from tqdm import tqdm from torch.utils.data import DataLoader from torch.utils.data.dataset import Subset def test_efficient_ram_usage(args, eval_ds, model, test_method="hard_resize"): """This function gives the same output as test(), but uses much less...
14,018
53.761719
121
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/commons.py
""" This file contains some functions and classes which can be useful in very diverse projects. """ import os import sys import torch import random import logging import traceback import numpy as np from os.path import join def make_deterministic(seed=0): """Make results deterministic. If seed == -1, do not mak...
2,811
36.493333
91
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/util.py
import re import torch import shutil import logging import torchscan import numpy as np from collections import OrderedDict from os.path import join from sklearn.decomposition import PCA import datasets_ws def get_flops(model, input_shape=(480, 640)): """Return the FLOPs as a string, such as '22.33 GFLOPs'""" ...
3,201
40.584416
102
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/datasets_ws.py
import os import torch import faiss import logging import numpy as np from glob import glob from tqdm import tqdm from PIL import Image from os.path import join import torch.utils.data as data import torchvision.transforms as T from torch.utils.data.dataset import Subset from sklearn.neighbors import NearestNeighbors ...
23,388
56.750617
138
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/eval.py
""" With this script you can evaluate checkpoints or test models from two popular landmark retrieval github repos. The first is https://github.com/naver/deep-image-retrieval from Naver labs, provides ResNet-50 and ResNet-101 trained with AP on Google Landmarks 18 clean. $ python eval.py --off_the_shelf=naver --l2=none...
5,209
46.363636
146
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/train.py
import math import torch import logging import numpy as np from tqdm import tqdm import torch.nn as nn import multiprocessing from os.path import join from datetime import datetime import torchvision.transforms as transforms from torch.utils.data.dataloader import DataLoader import util import test import parser impo...
10,186
45.729358
133
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/aggregation.py
import math import torch import faiss import logging import numpy as np from tqdm import tqdm import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.utils.data import DataLoader, SubsetRandomSampler import model.functional as LF import model.normalization as normaliz...
10,963
41.007663
132
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/network.py
import os import torch import logging import torchvision from torch import nn from os.path import join from transformers import ViTModel from google_drive_downloader import GoogleDriveDownloader as gdd from model.cct import cct_14_7x2_384 from model.aggregation import Flatten from model.normalization import L2Norm im...
9,160
43.687805
137
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/functional.py
import math import torch import torch.nn.functional as F def sare_ind(query, positive, negative): '''all 3 inputs are supposed to be shape 1xn_features''' dist_pos = ((query - positive)**2).sum(1) dist_neg = ((query - negative)**2).sum(1) dist = - torch.cat((dist_pos, dist_neg)) dist = F.log_...
3,170
36.305882
105
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/__init__.py
0
0
0
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/normalization.py
import torch.nn as nn import torch.nn.functional as F class L2Norm(nn.Module): def __init__(self, dim=1): super().__init__() self.dim = dim def forward(self, x): return F.normalize(x, p=2, dim=self.dim)
238
18.916667
48
py