max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
tests/__init__.py | bio2bel/famplex | 0 | 11800 | <reponame>bio2bel/famplex<filename>tests/__init__.py
# -*- coding: utf-8 -*-
"""Tests for Bio2BEL FamPlex."""
| 0.847656 | 1 |
dfainductor/algorithms/searchers.py | ctlab/DFA-Inductor-py | 2 | 11801 | <gh_stars>1-10
from typing import List
from pysat.solvers import Solver
from ..variables import VarPool
from .reductions import ClauseGenerator
from ..examples import BaseExamplesProvider
from ..logging_utils import *
from ..statistics import STATISTICS
from ..structures import APTA, DFA, InconsistencyGraph
class L... | 2.1875 | 2 |
lc_sqlalchemy_dbutils/manager.py | libcommon/sqlalchemy-dbutils-py | 0 | 11802 | <reponame>libcommon/sqlalchemy-dbutils-py
## -*- coding: UTF8 -*-
## manager.py
## Copyright (c) 2020 libcommon
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, inc... | 1.648438 | 2 |
mazeexperiment/__main__.py | NickAnderegg/rpacr-mazeexperiment | 0 | 11803 | <gh_stars>0
# -*- coding: utf-8 -*-
"""mazeexperiment.__main__: executed when mazeexperiment directory is called as script."""
from .mazeexperiment import main
main()
| 1.203125 | 1 |
kafka_demo_1/producer.py | Aguinore/udemy_kafka_demo | 0 | 11804 | from tweepy import StreamListener, OAuthHandler, Stream
from configs import Configs
import sys
class StdOutListener(StreamListener):
def __init__(self, kafka_producer, topic):
super().__init__()
self.kafka_producer = kafka_producer
self.topic = topic
""" A listener handles tweets tha... | 2.625 | 3 |
demo/examples/stability/advection_d2q4.py | bgraille/pylbm | 106 | 11805 |
"""
Stability analysis of the
D2Q4 solver for the advection equation
d_t(u) + c_x d_x(u) + c_y d_y(u) = 0
"""
import sympy as sp
import pylbm
# pylint: disable=invalid-name
# symbolic variables
U, X, Y = sp.symbols('U, X, Y')
# symbolic parameters
LA, CX, CY = sp.symbols('lambda, cx, cy', constants=True)
S_... | 2.421875 | 2 |
glimix_core/_util/_array.py | Horta/limix-inference | 7 | 11806 | from numpy import reshape
def vec(x):
return reshape(x, (-1,) + x.shape[2:], order="F")
def unvec(x, shape):
return reshape(x, shape, order="F")
| 3.421875 | 3 |
src/tests/component/test_engine_manager.py | carbonblack/cbc-binary-toolkit | 8 | 11807 | # -*- coding: utf-8 -*-
# *******************************************************
# Copyright (c) VMware, Inc. 2020-2021. All Rights Reserved.
# SPDX-License-Identifier: MIT
# *******************************************************
# *
# * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
# * WARRANTIES OR C... | 1.9375 | 2 |
funolympics/apps.py | codeema/Yokiyo | 0 | 11808 | <filename>funolympics/apps.py
from django.apps import AppConfig
class FunolympicsConfig(AppConfig):
name = 'funolympics'
| 1.210938 | 1 |
src/gt4sd/algorithms/generation/polymer_blocks/core.py | hhhsu0825/gt4sd-core | 0 | 11809 | <filename>src/gt4sd/algorithms/generation/polymer_blocks/core.py
"""PaccMann vanilla generator trained on polymer building blocks (catalysts/monomers)."""
import logging
import os
from dataclasses import field
from typing import ClassVar, Dict, Optional, TypeVar
from ....domains.materials import SmallMolecule, valida... | 2.359375 | 2 |
src/form/panel/MultiPanel.py | kaorin/vmd_sizing | 32 | 11810 | <gh_stars>10-100
# -*- coding: utf-8 -*-
#
import wx
import wx.lib.newevent
from form.panel.BasePanel import BasePanel
from form.parts.SizingFileSet import SizingFileSet
from module.MMath import MRect, MVector3D, MVector4D, MQuaternion, MMatrix4x4 # noqa
from utils import MFileUtils # noqa
from utils.MLogger import ML... | 2.078125 | 2 |
androgui.py | nawfling/androguard | 1 | 11811 | <gh_stars>1-10
#!/usr/bin/env python
"""Androguard Gui"""
import argparse
import os
import sys
from androguard.core import androconf
from androguard.gui.mainwindow import MainWindow
from PyQt5 import QtWidgets, QtGui
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Androguard GUI")
p... | 2.140625 | 2 |
python-trunk/sfapi2/sflib/ZSI/wstools/XMLname.py | raychorn/svn_molten-magma | 0 | 11812 | <gh_stars>0
"""Translate strings to and from SOAP 1.2 XML name encoding
Implements rules for mapping application defined name to XML names
specified by the w3 SOAP working group for SOAP version 1.2 in
Appendix A of "SOAP Version 1.2 Part 2: Adjuncts", W3C Working Draft
17, December 2001, <http://www.w3.org/TR/so... | 2.765625 | 3 |
mmtbx/validation/regression/tst_restraints.py | dperl-sol/cctbx_project | 155 | 11813 | <reponame>dperl-sol/cctbx_project<gh_stars>100-1000
from __future__ import absolute_import, division, print_function
from libtbx.utils import null_out
from libtbx import easy_pickle
from six.moves import cStringIO as StringIO
def run_validation(pdb_file, ignore_hd=True):
from mmtbx.validation import restraints
im... | 1.773438 | 2 |
Python/repeated-dna-sequences.py | sm2774us/leetcode_interview_prep_2021 | 0 | 11814 | <reponame>sm2774us/leetcode_interview_prep_2021
# Time: O(n)
# Space: O(n)
import collections
class Solution(object):
def findRepeatedDnaSequences(self, s):
"""
:type s: str
:rtype: List[str]
"""
dict, rolling_hash, res = {}, 0, []
for i in range(len(s)):
... | 3.296875 | 3 |
recipe/app.py | Udayan-Coding/examples | 1 | 11815 | from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def hello():
return render_template("index.html", name="WORLD!")
@app.route("/about")
def about():
return render_template("about.html")
| 2.859375 | 3 |
step2.py | mosheliv/tfcollab1 | 0 | 11816 | <reponame>mosheliv/tfcollab1<gh_stars>0
"""
Usage:
# From tensorflow/models/
# Create train data:
python generate_tfrecord.py --csv_input=data/train_labels.csv --output_path=train.record
# Create test data:
python generate_tfrecord.py --csv_input=data/test_labels.csv --output_path=test.record
"""
from __fu... | 2.4375 | 2 |
lh_lib/sensors/esp32/touch.py | lh70/s-connect-python | 0 | 11817 | <gh_stars>0
from machine import Pin
from lh_lib.sensors.sensor import AbstractSensor
class Touch(AbstractSensor):
"""
This represents a touch sensor with integrated Logic, where there is only one output pin,
which digitally represents the touched state.
pin:integer can be one of all available GPIO ... | 3.4375 | 3 |
algorithms/python/118.py | viing937/leetcode | 3 | 11818 | <filename>algorithms/python/118.py
class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
if numRows == 0: return []
rls = [[1]]
for i in range(2, numRows+1):
row = [1] * i
for j in range(1, i-1)... | 3.609375 | 4 |
squeeze_and_excitation_networks/datasets/data_loader.py | younnggsuk/CV-Paper-Implementation | 4 | 11819 | import os
import cv2
import albumentations as A
from albumentations.pytorch import ToTensorV2
from torch.utils.data import Dataset, DataLoader
from sklearn.model_selection import train_test_split
__all__ = ['CatDogDataset', 'fetch_dataloader']
class CatDogDataset(Dataset):
def __init__(self, file_paths, ... | 2.546875 | 3 |
seq2seq_utils.py | mumbihere/summarizer | 0 | 11820 | <reponame>mumbihere/summarizer
from keras.preprocessing.text import text_to_word_sequence
from keras.models import Sequential
from keras.layers import Activation, TimeDistributed, Dense, RepeatVector, recurrent, Embedding
from keras.layers.recurrent import LSTM
from keras.optimizers import Adam, RMSprop
from nltk impor... | 2.765625 | 3 |
SAMAE/data/__init__.py | Lisa-pa/SAMAE | 0 | 11821 | <reponame>Lisa-pa/SAMAE
"""Standard test images.
"""
import os
from skimage.io import imread
data_dir = os.path.abspath(os.path.dirname(__file__))
__all__ = ['data_dir', 'circle', 'skmuscimg']
def _load(f, as_gray=False):
"""Load an image file located in the data directory.
Parameters
----------
... | 2.8125 | 3 |
pandas_support/test_pandas_support.py | quanbingDG/sharper | 0 | 11822 | <filename>pandas_support/test_pandas_support.py<gh_stars>0
# -*- coding: utf-8 -*-
# @Time : 2020/11/9 9:13 下午
# @Author : quanbing
# @Email : <EMAIL>
import pandas as pd
import numpy as np
from unittest import TestCase
from pandas_support import PandasSupport as PS
# @File : test_pandas_support.py
class TestPandasSu... | 2.640625 | 3 |
08-About_scrapy/douban/main.py | jiaxiaochu/spider | 0 | 11823 | <reponame>jiaxiaochu/spider
# !/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
# -*- coding:utf-8 -*-
# @Author : Jiazhixiang
# 导入cmdline模块,可以实现控制终端命令行。
from scrapy import cmdline
# 用execute()方法,输入运行scrapy的命令。
cmdline.execute(['scrapy', 'crawl', 'douban'])
| 1.421875 | 1 |
DynamicProgramming/longestIncreasingSubsequence.py | suyash248/data_structures | 7 | 11824 | <reponame>suyash248/data_structures
from Array import empty_1d_array
"""
input array : [10, 22, 9, 33, 21, 50, 41, 60]
# Element at each index `i` is representing length of longest LIS from index 0 to i in input array.
output array: [1, 2, 1, 3, 2, 4, 4, 5]
"""
# Time complexity: O(n^2)
# Space complexity... | 3.71875 | 4 |
venv/Lib/site-packages/gevent/backdoor.py | Kiiwi/Syssel | 0 | 11825 | <reponame>Kiiwi/Syssel
# Copyright (c) 2009-2014, gevent contributors
# Based on eventlet.backdoor Copyright (c) 2005-2006, <NAME>
from __future__ import print_function
import sys
from code import InteractiveConsole
from gevent import socket
from gevent.greenlet import Greenlet
from gevent.hub import PY3, PYPY, getcu... | 2.3125 | 2 |
spark/par_decompress_audio.py | droyston/spectralize | 0 | 11826 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 17 16:12:56 2020
@author: dylanroyston
"""
# import/configure packages
import numpy as np
import pandas as pd
#import pyarrow as pa
import librosa
import librosa.display
from pathlib import Path
#import Ipython.display as ipd
#import matplotlib.pyp... | 2.09375 | 2 |
get_ip_list_ru_gov.py | gil9red/SimplePyScripts | 117 | 11827 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""
Скрипт выводит список ip государственных организаций.
"""
import ipaddress
import sys
import requests
rs = requests.get('https://jarib.github.io/anon-history/RuGovEdits/ru/latest/ranges.json')
# Проверка удачного запроса и полученных д... | 2.796875 | 3 |
test_collection.py | Rodrun/weatherguess | 0 | 11828 | <gh_stars>0
import unittest
import requests
from collection import Collection
class TestCollection(unittest.TestCase):
def setUp(self):
# Get the sample JSON data
self.data = requests.get("http://samples.openweathermap.org/data/2.5/weather?zip=94040,us&appid=b6907d289e10d714a6e88b30761fae22").jso... | 3.46875 | 3 |
tests/bitwiseOperations/__init__.py | mgorzkowski/abn | 4 | 11829 | from . import nand_tests
from . import and_tests
from . import nor_tests
from . import not_tests
from . import or_tests
from . import xor_tests
from . import rotate_left_tests
from . import rotate_right_tests
from . import shift_left_tests
from . import shift_right_tests
| 1.085938 | 1 |
exot/util/misc.py | ETHZ-TEC/exot_eengine | 0 | 11830 | # Copyright (c) 2015-2020, Swiss Federal Institute of Technology (ETH Zurich)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright... | 1.257813 | 1 |
70_question/dynamic_programming/max_profit_with_k_transactions.py | alvinctk/google-tech-dev-guide | 26 | 11831 | <reponame>alvinctk/google-tech-dev-guide
def maxProfitWithKTransactions(prices, k):
n = len(prices)
profit = [[0]*n for _ in range(k+1)]
"""
t := number of transactions
d := day at which either buy/sell stock
profit[t][d] = max ( previous day profit = profit[t][d-1] ,
... | 3.625 | 4 |
main.py | rdmaulana/flask-smart-xls-clean | 0 | 11832 | <filename>main.py
import pandas as pd
import numpy as np
import io
import time
import uuid
from flask import Flask, render_template, request, redirect, url_for, Response, session, send_file, make_response, send_from_directory
from os.path import join, dirname, realpath
from werkzeug.wsgi import FileWrapper
app = Flas... | 2.46875 | 2 |
2_UNIXCommands/Exercise11.py | takeyoshinitta/NLP-100-Exercise | 3 | 11833 | # 11. Replace tabs into spaces
# Replace every occurrence of a tab character into a space. Confirm the result by using sed, tr, or expand command.
with open('popular-names.txt') as f:
for line in f:
print(line.strip().replace("\t", " "))
| 3.28125 | 3 |
scripts/wapo/wapo_link_graph_from_mongo.py | feup-infolab/army-ant | 5 | 11834 | <filename>scripts/wapo/wapo_link_graph_from_mongo.py
#!/usr/bin/env python
#
# wapo_link_graph_from_mongo.py
# <NAME> <<EMAIL>>
# 2019-02-05
import logging
import sys
import warnings
import networkx as nx
from bs4 import BeautifulSoup
from pymongo import MongoClient
logging.basicConfig(
format='%(asctime)s wapo... | 2.65625 | 3 |
designScripts/vernierMask.py | smartalecH/BYUqot | 5 | 11835 | <gh_stars>1-10
# ------------------------------------------------------------------ #
# vernierMask.py
# ------------------------------------------------------------------ #
#
# A mask design used to align the 3D printer to a silicon photonic chip
#
# ------------------------------------------------------------------ #... | 1.929688 | 2 |
src/core/serializers.py | pradipta/back-end | 17 | 11836 | from django.contrib.auth import get_user_model
from rest_auth.registration.serializers import (
RegisterSerializer as BaseRegisterSerializer,
)
from rest_auth.registration.serializers import (
SocialLoginSerializer as BaseSocialLoginSerializer,
)
from rest_auth.serializers import LoginSerializer as BaseLoginSer... | 2.15625 | 2 |
src/programy/brainfactory.py | motazsaad/fit-bot-fb-clt | 0 | 11837 | <filename>src/programy/brainfactory.py
"""
Copyright (c) 2016-2019 <NAME> http://www.keithsterling.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limita... | 2.09375 | 2 |
tools/docs/generate_api_rst.py | dcillera/envoy | 17,703 | 11838 | import os
import shutil
import sys
import tarfile
def include_package(envoy_api_protos, rst_file_path, prefix):
# `envoy_api_rst_files` is a list of file paths for .proto.rst files
# generated by protodoc
#
# we are only interested in the proto files generated for envoy protos,
# not for non-envoy... | 2.171875 | 2 |
src/wa_parser.py | ifly6/NS-WA-Authorboards | 0 | 11839 | <reponame>ifly6/NS-WA-Authorboards
# Copyright (c) 2020 ifly6
import html
import io
import re
from datetime import datetime
from functools import cache
from typing import Tuple
import numpy as np
import pandas as pd
import requests
from bs4 import BeautifulSoup
from lxml import etree
from pytz import timezone
from rat... | 2.75 | 3 |
conans/search/binary_html_table.py | matthiasng/conan | 2 | 11840 | import os
from collections import OrderedDict, defaultdict
from conans.model.ref import PackageReference
from conans.util.files import save
class RowResult(object):
def __init__(self, remote, reference, data):
self.remote = remote
self.reference = reference
self._data = data
@propert... | 2.40625 | 2 |
irancovid-19.py | AmiiirCom/irancovid-19 | 0 | 11841 | <reponame>AmiiirCom/irancovid-19
from covid import Covid
import json
covid = Covid(source="worldometers")
covid.get_data()
iran_casses = covid.get_status_by_country_name("iran")
confirmed = iran_casses['confirmed']
new_cases = iran_casses['new_cases']
deaths = iran_casses['deaths']
recovered = iran_casses['recovered... | 2.703125 | 3 |
models/__init__.py | esentino/literate-doodle | 0 | 11842 | <reponame>esentino/literate-doodle<gh_stars>0
# models/__init__.py
from clcrypto import password_hash
from psycopg2 import connect
def make_connection(db_name='w3'):
cnx = connect(user='postgres', password='<PASSWORD>', database=db_name, host='localhost')
cnx.autocommit = True
return cnx
class User:
... | 3.078125 | 3 |
crys3d/command_line/model_viewer.py | rimmartin/cctbx_project | 0 | 11843 | from __future__ import division
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export PHENIX_GUI_ENVIRONMENT=1
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export BOOST_ADAPTBX_FPE_DEFAULT=1
import cStringIO
from crys3d.wx_selection_editor import selection_editor_mixin
import wx
import libtbx.load_env
import sys, os, time
################... | 1.78125 | 2 |
Crypto/py3compat.py | eddiejessup/transcrypt | 14 | 11844 | <reponame>eddiejessup/transcrypt
__revision__ = "$Id$"
def b(s):
return s.encode("latin-1")
def bchr(s):
return bytes([s])
def bstr(s):
if isinstance(s, str):
return bytes(s, "latin-1")
else:
return bytes(s)
def bord(s):
return s
def tobytes(s):
if isinstance(s, bytes):... | 2.484375 | 2 |
verres/optim/schedule.py | csxeba/Verres | 0 | 11845 | from typing import Dict
import numpy as np
import tensorflow as tf
import verres as V
class ConstantSchedule(tf.keras.optimizers.schedules.LearningRateSchedule):
def __init__(self, learning_rate: float):
super().__init__()
self.learning_rate = float(learning_rate)
def __call__(self, step):... | 2.5625 | 3 |
JIG.py | mmg1/JIG | 28 | 11846 | <reponame>mmg1/JIG
import re
import sys
from itertools import izip as zip
import argparse
import requests
# argparse definitions
parser = argparse.ArgumentParser(description='Jira attack script')
parser.add_argument('URL', type=str , help='the URL of the Jira instance... ex. https://jira.organization.com/')
p... | 3 | 3 |
run.py | SamChatfield/final-year-project | 0 | 11847 | import json
import string
from datetime import datetime
import deap
import numpy as np
import hmm
from discriminator import Discriminator
from ea import EA
import random_search
DEFAULT_PARAMS = {
# Discriminator CNN model
"model": "CNNModel3",
# Algorithm Parameters
"states": 5,
"symbols": 5,
... | 2.53125 | 3 |
rrc_example_package/benchmark_rrc/tools/plot/exp_align_obj.py | wq13552463699/TriFinger_Research | 12 | 11848 | #!/usr/bin/env python3
'''
This code traverses a directories of evaluation log files and
record evaluation scores as well as plotting the results.
'''
import os
import argparse
import json
import copy
from shutil import copyfile
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from utils import... | 2.640625 | 3 |
test cases/common/64 custom header generator/makeheader.py | objectx/meson | 0 | 11849 | #!/usr/bin/env python3
# NOTE: this file does not have the executable bit set. This tests that
# Meson can automatically parse shebang lines.
import sys
template = '#define RET_VAL %s\n'
output = template % (open(sys.argv[1]).readline().strip())
open(sys.argv[2], 'w').write(output)
| 2.0625 | 2 |
studio_ghibli/movies/test_data.py | hbansal0122/studio_ghibli_project | 0 | 11850 | <filename>studio_ghibli/movies/test_data.py
""" Test data"""
stub_films = [{
"id": "12345",
"title": "This is film one",
},{
"id": "23456",
"title": "This is film two",
}]
stub_poeple = [{
"name": "<NAME>",
"films": ["url/12345", "url/23456"]
},{
"name": "<NAME>",
"films": ["url/23456... | 1.601563 | 2 |
data_converters/fsdbripper/create_new_db.py | osvaldolove/amiberry-api | 0 | 11851 | <reponame>osvaldolove/amiberry-api<gh_stars>0
import sqlite3
from constants import DESTINATION_DB
destination_connection = sqlite3.connect(DESTINATION_DB)
destination_cursor = destination_connection.cursor()
destination_cursor.execute('CREATE TABLE game(uuid, payload)')
| 1.75 | 2 |
upvote/gae/shared/common/json_utils_test.py | cclauss/upvote | 0 | 11852 | <reponame>cclauss/upvote<filename>upvote/gae/shared/common/json_utils_test.py
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://... | 2.015625 | 2 |
app.py | YukiNagat0/Blog | 1 | 11853 | from os import path
from typing import Union
from datetime import datetime
from flask import Flask, request, redirect, render_template
from flask_wtf import CSRFProtect
from werkzeug.utils import secure_filename
from data import db_session
from data.posts import Posts
from forms.edit_post_form import EditPostForm
... | 2.25 | 2 |
neon/backends/gpu.py | kashif/neon | 1 | 11854 | # ----------------------------------------------------------------------------
# Copyright 2014 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | 1.914063 | 2 |
test/test_automl/test_automl.py | ihounie/auto-sklearn | 0 | 11855 | # -*- encoding: utf-8 -*-
import os
import pickle
import sys
import time
import glob
import unittest
import unittest.mock
import numpy as np
import pandas as pd
import sklearn.datasets
from smac.scenario.scenario import Scenario
from smac.facade.roar_facade import ROAR
from autosklearn.util.backend import Backend
fro... | 2.015625 | 2 |
algopy/base_type.py | arthus701/algopy | 54 | 11856 | """
This implements an abstrace base class Ring .
Rationale:
Goal is to separate the datatype specification from the algorithms and containers for the following reasons:
1) It allows to directly use the algorithms *without* overhead. E.g. calling mul(z.data, x.data, y.data)
has much le... | 3.578125 | 4 |
estrutura-repeticao-while/ex062.py | TacilioRodriguez/Python | 0 | 11857 | <filename>estrutura-repeticao-while/ex062.py<gh_stars>0
"""
Melhore o Desafio 061, perguntando para o usuário se ele quer mostrar mais alguns termos.
O programa encerra quando ele disser que quer mostrar 0 termos.
"""
primeiro = int(input('Digite o termo: '))
razao = int(input('Digite a razão: '))
termo = primeiro
con... | 3.703125 | 4 |
Udemy_PythonBootcamp/Sec15_WebScraping.py | gonzalosc2/LearningPython | 0 | 11858 | ####################################
# author: <NAME>
# course: 2020 Complete Python Bootcamps: From Zero to Hero in Python
# purpose: lecture notes
# description: Section 15 - Web Scraping
# other: N/A
####################################
# RULES
# 1. always try to get permission before scraping, otherwise I might be... | 4.125 | 4 |
anchore_engine/analyzers/modules/33_binary_packages.py | dspalmer99/anchore-engine | 0 | 11859 | #!/usr/bin/env python3
import sys
import os
import re
import json
import traceback
import pkg_resources
import tarfile
from collections import OrderedDict
import anchore_engine.analyzers.utils, anchore_engine.utils
def get_python_evidence(tfl, member, memberhash, evidence):
global binary_package_el
full... | 2.125 | 2 |
SF-home-price-prediction/src/preparation.py | apthomas/SF-home-price-prediction | 0 | 11860 | import pandas as pd
import numpy as np
import csv
import urllib.request
import json
from datetime import datetime
from datetime import timedelta
from sklearn.preprocessing import MinMaxScaler
import web_scrapers
import os
def load_real_estate_data(filename, state_attr, state):
df = pd.read_csv(filename, encoding... | 2.96875 | 3 |
src/python/director/builtin/plugins/measurement_tool/plugin.py | afdaniele/director | 0 | 11861 | from director.devel.plugin import GenericPlugin
from director.fieldcontainer import FieldContainer
from .lib import measurementpanel
from PythonQt import QtCore
class Plugin(GenericPlugin):
ID = 'measurement_tool'
NAME = 'MeasurementTool'
DEPENDENCIES = ['MainWindow']
def __init__(self, app, view):
sup... | 1.945313 | 2 |
jupyter_book/yaml.py | akhmerov/jupyter-book | 1 | 11862 | <gh_stars>1-10
"""A small sphinx extension to let you configure a site with YAML metadata."""
from pathlib import Path
# Transform a "Jupyter Book" YAML configuration file into a Sphinx configuration file.
# This is so that we can choose more user-friendly words for things than Sphinx uses.
# e.g., 'logo' instead of ... | 2.609375 | 3 |
ScriptedAgent.py | RaphaelRoyerRivard/Supervised-End-to-end-Weight-sharing-for-StarCraft-II | 0 | 11863 | __author__ = '<NAME> - www.tonybeltramelli.com'
# scripted agents taken from PySC2, credits to DeepMind
# https://github.com/deepmind/pysc2/blob/master/pysc2/agents/scripted_agent.py
import numpy as np
import uuid
from pysc2.agents import base_agent
from pysc2.lib import actions
from pysc2.lib import features
_SCREE... | 2.46875 | 2 |
benchmark/test_tpch.py | serverless-analytics/dask-distributed-vanilla | 0 | 11864 | import time
import sys
import dask
from dask.distributed import (
wait,
futures_of,
Client,
)
from tpch import loaddata, queries
#from benchmarks import utils
# Paths or URLs to the TPC-H tables.
#table_paths = {
# 'CUSTOMER': 'hdfs://bu-23-115:9000/tpch/customer.tbl',
# 'LINEITEM': 'hdfs://bu-... | 2.046875 | 2 |
pika/adapters/tornado_connection.py | hugovk/pika | 1 | 11865 | """Use pika with the Tornado IOLoop
"""
import logging
from tornado import ioloop
from pika.adapters.utils import nbio_interface, selector_ioloop_adapter
from pika.adapters import base_connection
LOGGER = logging.getLogger(__name__)
class TornadoConnection(base_connection.BaseConnection):
"""The TornadoConne... | 2.484375 | 2 |
tests/library/test_ceph_volume_simple_activate.py | u-kosmonaft-u/ceph-ansible | 1,570 | 11866 | from mock.mock import patch
import os
import pytest
import ca_test_common
import ceph_volume_simple_activate
fake_cluster = 'ceph'
fake_container_binary = 'podman'
fake_container_image = 'quay.ceph.io/ceph/daemon:latest'
fake_id = '42'
fake_uuid = '0c4a7eca-0c2a-4c12-beff-08a80f064c52'
fake_path = '/etc/ceph/osd/{}-{}... | 1.945313 | 2 |
setup.py | Minterious/minter-monitoring | 2 | 11867 | import setuptools
setuptools.setup(
name='mintermonitoring',
version='1.0.0',
packages=setuptools.find_packages(include=['mintermonitoring'])
)
| 1.171875 | 1 |
Python/Back_solve_python/back_joon/StringArray/P10808.py | skyriv213/Studyriv | 0 | 11868 | <reponame>skyriv213/Studyriv
s = input()
num = [0] * 26
for i in range(len(s)):
num[ord(s[i])-97] += 1
for i in num:
print(i, end = " ")
if i == len(num)-1:
print(i)
| 3.328125 | 3 |
src/reliefcpp/utils.py | ferrocactus/reliefcpp | 0 | 11869 | <gh_stars>0
from enum import Enum
from numpy import isin
class Metric(Enum):
EUCLIDEAN = 0
MANHATTAN = 1
HAMMING = 2
L2 = 3
L1 = 4
metric_names = [
"euclidean",
"manhattan",
"hamming",
"l2",
"l1"
]
def _validate_metric(metric_name):
if isinstance(metric_name, Metric):
... | 3.140625 | 3 |
utilityFiles/createValidationDatasetFromXYTrainWithCandidates.py | jmfinelli/JavaNeuralDecompiler | 1 | 11870 | import pandas as pd
import os.path
length_switch = True
max_body_length = 50
process_candidates = os.path.exists('./datasets/candidates.output')
x_train = open('./datasets/x_train').readlines()
x_train = [x.rstrip('\n') for x in x_train]
y_train = open('./datasets/y_train').readlines()
y_train = [x.rstrip('\n') for x... | 2.375 | 2 |
py/Utility.GetData.py | mathematicalmichael/SpringNodes | 51 | 11871 | import System
dataKey, _ = IN
OUT = System.AppDomain.CurrentDomain.GetData("_Dyn_Wireless_%s" % dataKey) | 1.289063 | 1 |
codes_/1189_Maximum_Number_of_Balloons.py | SaitoTsutomu/leetcode | 0 | 11872 | <reponame>SaitoTsutomu/leetcode
# %% [1189. *Maximum Number of Balloons](https://leetcode.com/problems/maximum-number-of-balloons/)
# 問題:textから'ballon'を構成できる数を返せ
# 解法:collections.Counterを用いる
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
c = collections.Counter(text)
return min(c[s... | 3.578125 | 4 |
src/Quiet.X.Tests/i2c_test.py | callwyat/Quiet-Firmware | 0 | 11873 | from quiet_coms import find_quiet_ports
from quiet import Quiet
import time
if 'EXIT_ON_FAIL' not in locals():
VERBOSE = True
EXIT_ON_FAIL = True
class QuietI2C(Quiet):
def __init__(self, coms, **kargs) -> None:
Quiet.__init__(self, coms, **kargs)
def raw_write(self, addr: int, data: bytearra... | 2.40625 | 2 |
WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/Overflow/_Data-Structures/binary-tree/binary-tree-tilt.py | webdevhub42/Lambda | 5 | 11874 | <reponame>webdevhub42/Lambda<gh_stars>1-10
# Source : https://leetcode.com/problems/binary-tree-tilt/description/
# Date : 2017-12-26
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
... | 3.53125 | 4 |
kerastuner/engine/tuner_utils.py | krantirk/keras-tuner | 1 | 11875 | # Copyright 2019 The Keras Tuner Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 2.09375 | 2 |
plotter.py | ZiegHailo/SMUVI | 0 | 11876 | <reponame>ZiegHailo/SMUVI
__author__ = 'zieghailo'
import matplotlib.pyplot as plt
# plt.ion()
def show():
plt.show()
plt.get_current_fig_manager().full_screen_toggle()
def plot_graph(graph):
# plt.ion()
x = [p.x for p in graph.points]
y = [p.y for p in graph.points]
plt.plot(x, y, 'b*')
... | 2.9375 | 3 |
fannypack/utils/_deprecation.py | brentyi/hfdsajk | 5 | 11877 | import warnings
from typing import Callable, Optional, TypeVar, cast
CallableType = TypeVar("CallableType", bound=Callable)
def deprecation_wrapper(message: str, function_or_class: CallableType) -> CallableType:
"""Creates a wrapper for a deprecated function or class. Prints a warning
the first time a functi... | 3.203125 | 3 |
write/5_json_writer.py | pavlovprojects/python_qa_test_data | 0 | 11878 | import json
data = {
"users": [
{"Name": "Dominator", "skill": 100, "gold": 99999, "weapons": ['Sword', 'Atomic Laser']},
{"Name": "Looser", "skill": 1, "gold": -100000, "weapons": [None, None, None]},
]
}
with open("example.json", "w") as f:
s = json.dumps(data, indent=4)
f.write(s)
| 2.765625 | 3 |
src/utils.py | sequoia-tree/cs370 | 1 | 11879 | <filename>src/utils.py<gh_stars>1-10
from md_utils import *
from py_utils import *
| 1.234375 | 1 |
practice/ai/machine-learning/digital-camera-day-or-night/digital-camera-day-or-night.py | zeyuanxy/HackerRank | 4 | 11880 | <reponame>zeyuanxy/HackerRank
if __name__ == "__main__":
data = raw_input().strip(',\n').split(' ')
count = 0
total = 0
for pxl in data:
pxl = pxl.split(',')
mean = 0
for i in pxl:
mean += int(i)
mean /= 3
if mean < 70:
count += 1
t... | 3.40625 | 3 |
Mini Projects/RockPaperScissors/RPS.py | Snowystar122/Python-Projects | 0 | 11881 | import random as r
# Sets up required variables
running = True
user_wins = 0
comp_wins = 0
answers = ["R", "P", "S"]
win_combos = ["PR", "RS", "SP"]
# Welcome message
print("Welcome to Rock-Paper-Scissors. Please input one of the following:"
"\n'R' - rock\n'P' - paper\n'S' - scissors\nto get started.")
whil... | 4.09375 | 4 |
pybullet-gym/pybulletgym/agents/agents_baselines.py | SmaleZ/vcl_diayn | 2 | 11882 | from baselines import deepq
def add_opts(parser):
pass
class BaselinesDQNAgent(object):
'''
classdocs
'''
def __init__(self, opts):
self.metadata = {
'discrete_actions': True,
}
self.opts = opts
self.agent = None
def configure(self, observation_space_shape, nb_actions):
pass
def train(self, ... | 2.34375 | 2 |
exploit.py | hexcowboy/CVE-2020-8813 | 0 | 11883 | #!/usr/bin/python3
import requests
import click
from rich import inspect
from rich.console import Console
from url_normalize import url_normalize
from urllib.parse import quote
console = Console()
def shell_encode(string):
return string.replace(" ", "${IFS}")
@click.command()
@click.option("-u", "--url", prompt... | 2.734375 | 3 |
common/src/stack/command/stack/commands/set/firmware/model/imp/__init__.py | kmcm0/stacki | 123 | 11884 | # @copyright@
# Copyright (c) 2006 - 2019 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the University of California
# All rights reserved. Rocks(r) v5.4 www.rocksclusters.org
# ... | 2.171875 | 2 |
torch/jit/_fuser.py | ljhOfGithub/pytorch | 1 | 11885 | <reponame>ljhOfGithub/pytorch
import contextlib
import torch
from typing import List, Tuple
@contextlib.contextmanager
def optimized_execution(should_optimize):
"""
A context manager that controls whether the JIT's executor will run
optimizations before executing a function.
"""
stored_flag = torc... | 2.265625 | 2 |
modlit/db/postgres.py | patdaburu/modlit | 0 | 11886 | <reponame>patdaburu/modlit<filename>modlit/db/postgres.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by pat on 5/8/18
"""
.. currentmodule:: modlit.db.postgres
.. moduleauthor:: <NAME> <<EMAIL>>
This module contains utilities for working directly with PostgreSQL.
"""
import json
from pathlib i... | 2.609375 | 3 |
estradaspt_legacy/__init__.py | dpjrodrigues/home-assistant-custom-components | 0 | 11887 | import logging
import async_timeout
import urllib.request
import time
import re
from datetime import datetime, timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity import Entity
from homea... | 2.0625 | 2 |
parser.py | boshijingang/PyLuaCompiler | 0 | 11888 | <filename>parser.py<gh_stars>0
import lexer
import ast
class Parser:
block_end_tokens = [lexer.TokenKind.KW_RETURN, lexer.TokenKind.EOF,
lexer.TokenKind.KW_END, lexer.TokenKind.KW_ELSE,
lexer.TokenKind.KW_ELSEIF, lexer.TokenKind.KW_UNTIL]
priority_table = {
... | 2.453125 | 2 |
python/terra_proto/terra/treasury/v1beta1/__init__.py | Vritra4/terra.proto | 0 | 11889 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: terra/treasury/v1beta1/genesis.proto, terra/treasury/v1beta1/query.proto, terra/treasury/v1beta1/treasury.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import Dict, List
import betterproto
from betterproto.grpc.grp... | 1.609375 | 2 |
usbservo/usbservogui.py | ppfenninger/screwball | 0 | 11890 | <reponame>ppfenninger/screwball
#
## Copyright (c) 2018, <NAME>
## 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 copyr... | 1.851563 | 2 |
GasBotty/models/utils.py | GreenCUBIC/GasBotty | 353 | 11891 | <reponame>GreenCUBIC/GasBotty
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url
| 1.53125 | 2 |
pyzayo/svcinv_mixin.py | jeremyschulman/pyzayo | 1 | 11892 | <filename>pyzayo/svcinv_mixin.py
"""
This file contains the Zayo Service Inventory related API endpoints.
References
----------
Docs
http://172.16.17.32/wp-content/uploads/2020/02/Service-Inventory-Wiki.pdf
"""
# -----------------------------------------------------------------------------
# System Imports
# ... | 1.445313 | 1 |
pychron/core/helpers/logger_setup.py | aelamspychron/pychron | 1 | 11893 | <reponame>aelamspychron/pychron<gh_stars>1-10
# ===============================================================================
# Copyright 2011 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Li... | 1.796875 | 2 |
picmodels/models/care_advisors/case_management_models/sequence_models/services/create_update_delete.py | bbcawodu/careadvisors-backend | 0 | 11894 | <filename>picmodels/models/care_advisors/case_management_models/sequence_models/services/create_update_delete.py
import picmodels
def create_row_w_validated_params(cls, validated_params, rqst_errors):
if 'name' not in validated_params:
rqst_errors.append("'name' is a required key in the validated_params a... | 2.109375 | 2 |
elegy/optimizer_test.py | sooheon/elegy | 0 | 11895 | import jax
import elegy
import unittest
import numpy as np
import jax.numpy as jnp
import optax
class MLP(elegy.Module):
"""Standard LeNet-300-100 MLP network."""
n1: int
n2: int
def __init__(self, n1: int = 3, n2: int = 4):
super().__init__()
self.n1 = n1
self.n2 = n2
... | 2.484375 | 2 |
scripts/version.py | nfnty/docker | 54 | 11896 | <filename>scripts/version.py
#!/usr/bin/python3
''' Check image package versions '''
import argparse
import distutils.version
import re
import subprocess
from typing import Any, Dict, Sequence, Tuple
import lxml.html # type: ignore
import requests
from termcolor import cprint
from utils.image import IMAGES, path_do... | 2.421875 | 2 |
nazrul.py | rakesh0703/Content_Parser_of_works_of_kazi_nazrul | 0 | 11897 | # -- coding: UTF-8 --
"""
Spyder Editor
This is a temporary script file.
"""
from bs4 import BeautifulSoup
import sys
import os
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
import urllib.parse,urllib.request,urllib.error
base="https://nazrul-rachanabali.nltr.org/"
page=urllib.request.... | 2.828125 | 3 |
algoplex/api/order.py | dmitryaleks/algo-plex | 0 | 11898 | <reponame>dmitryaleks/algo-plex
class Order():
def __init__(self, side, pair, size, price, stop_loss_price, id):
self.side = side
self.pair = pair
self.size = size
self.price = price
self.stop_loss_price = stop_loss_price
self.id = id
self.fills = []
def... | 2.765625 | 3 |
core/handler.py | mh4x0f/kinproxy | 5 | 11899 | try:
from mitmproxy import controller, proxy
from mitmproxy.proxy.server import ProxyServer
except:
from libmproxy import controller, proxy
from libmproxy.proxy.server import ProxyServer
from plugins import *
from threading import Thread
from core.config.settings import SettingsINI
# MIT License
#
# Co... | 1.882813 | 2 |