repo_name stringclasses 400
values | branch_name stringclasses 4
values | file_content stringlengths 16 72.5k | language stringclasses 1
value | num_lines int64 1 1.66k | avg_line_length float64 6 85 | max_line_length int64 9 949 | path stringlengths 5 103 | alphanum_fraction float64 0.29 0.89 | alpha_fraction float64 0.27 0.89 |
|---|---|---|---|---|---|---|---|---|---|
olof98johansson/SentimentAnalysisNLP | refs/heads/main | import torch
import torch.nn as nn
import preprocessing
import os
import numpy as np
class ModelUtils:
'''
A utility class to save and load model weights
'''
def save_model(save_path, model):
root, ext = os.path.splitext(save_path)
if not ext:
save_path = root + '.pth'
... | Python | 119 | 36.705883 | 113 | /models.py | 0.58196 | 0.578396 |
olof98johansson/SentimentAnalysisNLP | refs/heads/main | import data_cleaning
import twint_scraping
import os
from collections import Counter
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from torch.utils.data import Dataset, DataLoader
import torch
class config:
'''
Configuration class to store and tune globa... | Python | 197 | 34.411167 | 125 | /preprocessing.py | 0.61566 | 0.606069 |
olof98johansson/SentimentAnalysisNLP | refs/heads/main | import models
import train
import preprocessing
import data_cleaning
import os
import torch
import twint_scraping
import numpy as np
from torch.utils.data import Dataset, DataLoader
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
sns.set_style('darkgrid')
import pandas_alive
class Config:
... | Python | 410 | 46.358536 | 170 | /predict.py | 0.629879 | 0.611803 |
olof98johansson/SentimentAnalysisNLP | refs/heads/main |
import json
import csv
import re
def load_json(path):
'''
Loads collected data in json format, checks it and then converts to csv format
Input: path - path and file name to the collected json data (type: string)
Output: keys - list of features/keys of the dataframe (type: list of strings)
... | Python | 162 | 35.339508 | 122 | /data_cleaning.py | 0.598675 | 0.596807 |
Guilherme99/flask-react-session-authenticaton-tutorial | refs/heads/master | from dotenv import load_dotenv
import os
import redis
load_dotenv()
class ApplicationConfig:
SECRET_KEY = os.environ["SECRET_KEY"]
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ECHO = True
SQLALCHEMY_DATABASE_URI = r"sqlite:///./db.sqlite"
SESSION_TYPE = "redis"
SESSION_PERMANENT = False... | Python | 17 | 23.235294 | 60 | /server/config.py | 0.698297 | 0.673966 |
Guilherme99/flask-react-session-authenticaton-tutorial | refs/heads/master | from flask import Flask, request, jsonify, session
from flask_bcrypt import Bcrypt
from flask_cors import CORS, cross_origin
from flask_session import Session
from config import ApplicationConfig
from models import db, User
app = Flask(__name__)
app.config.from_object(ApplicationConfig)
bcrypt = Bcrypt(app)
CORS(app,... | Python | 80 | 23.875 | 71 | /server/app.py | 0.639015 | 0.631473 |
Guilherme99/flask-react-session-authenticaton-tutorial | refs/heads/master | from flask_sqlalchemy import SQLAlchemy
from uuid import uuid4
db = SQLAlchemy()
def get_uuid():
return uuid4().hex
class User(db.Model):
__tablename__ = "users"
id = db.Column(db.String(32), primary_key=True, unique=True, default=get_uuid)
email = db.Column(db.String(345), unique=True)
password ... | Python | 13 | 26.461538 | 82 | /server/models.py | 0.691877 | 0.672269 |
EricHughesABC/T2EPGviewer | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 3 11:30:41 2018
@author: ERIC
"""
import numpy as np
import lmfit
from epg import cpmg_epg_b1 as cpmg_epg_b1_c
from scipy import integrate
mxyz90 = np.fromfile( 'epg/mxyz90.txt', sep=' ' )
mxyz180 = np.fromfile('epg/mxyz180.txt', sep=' ')
mxyz90 = mxyz9... | Python | 166 | 30.728916 | 155 | /t2fit.py | 0.573375 | 0.539311 |
EricHughesABC/T2EPGviewer | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 28 13:11:07 2018
@author: neh69
"""
import sys
import numpy as np
#import matplotlib
import pandas as pd
#import mplcursors
from uncertainties import ufloat
import t2fit
import lmfit as lm
from matplotlib import pyplot as plt
#import seaborn as sns
f... | Python | 703 | 31.364153 | 171 | /visionplot_widgets.py | 0.566313 | 0.543463 |
EricHughesABC/T2EPGviewer | refs/heads/master | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'epg_fit_parameters_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
import lmfit as lm
from PyQt5 import QtCore, QtGui, QtWidgets
class EpgT2paramsDialog(object):
... | Python | 346 | 47.427746 | 158 | /epgT2paramsDialog.py | 0.631373 | 0.606525 |
EricHughesABC/T2EPGviewer | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 17 14:34:43 2019
@author: neh69
"""
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
#import seaborn as sns
from matplotlib.backends.qt_compat import QtCore, QtWidgets, is_pyqt5
#import seaborn as sns
if is_pyqt5():
print("... | Python | 303 | 33.709572 | 124 | /mriplotwidget.py | 0.581578 | 0.572616 |
EricHughesABC/T2EPGviewer | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 20 10:29:38 2017
@author: neh69
"""
import os
import sys
import numpy as np
import pandas as pd
import lmfit as lm
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
from PyQt5 import QtCore, QtWidgets
import visionplot_widgets
... | Python | 212 | 32.594341 | 161 | /simple_pandas_plot.py | 0.633006 | 0.603025 |
EricHughesABC/T2EPGviewer | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 6 14:55:05 2018
@author: ERIC
"""
import os
import numpy as np
import pandas as pd
import nibabel
class T2imageData():
def __init__(self):
self.currentSlice = None
self.currentEcho = None
self.T2imagesDirpath = None
... | Python | 375 | 35.482666 | 124 | /ImageData.py | 0.570474 | 0.557531 |
EricHughesABC/T2EPGviewer | refs/heads/master | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'azz_fit_parameters_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class AzzT2paramsDialog(object):
def __init__(... | Python | 302 | 47.052979 | 106 | /azzT2paramsDialog.py | 0.634854 | 0.604279 |
mgh35/lab-grpc | refs/heads/master | from concurrent import futures
from generated import summer_pb2, summer_pb2_grpc
import grpc
import logging
class SummerServicer(summer_pb2_grpc.SummerServicer):
def Sum(self, request: summer_pb2.ToSum, context):
logging.info("SummerServicer.Sum(%s)", request)
s = sum(request.values)
retu... | Python | 26 | 25.807692 | 68 | /summer-grpc/server.py | 0.691535 | 0.672884 |
mgh35/lab-grpc | refs/heads/master | from generated.summer_pb2 import ToSum
import pytest
@pytest.mark.parametrize(["values", "expected"], [
([], 0),
([1.0], 1.0),
([1.0, 1.0], 2.0),
])
def test_some(grpc_stub, values, expected):
response = grpc_stub.Sum(ToSum(values=values))
assert response.sum == pytest.approx(expected)
| Python | 12 | 24.75 | 50 | /summer-grpc/test_server.py | 0.63754 | 0.598706 |
mgh35/lab-grpc | refs/heads/master | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from generated import summer_pb2 as generated_dot_summer__pb2
class SummerStub(object):
"""Missing associated documentation comment in .proto file"""
def __init__(self, channel):
"""Constructor.
Args:
... | Python | 64 | 34.203125 | 91 | /summer-grpc/generated/summer_pb2_grpc.py | 0.633822 | 0.630271 |
mgh35/lab-grpc | refs/heads/master | from generated import summer_pb2, summer_pb2_grpc
import grpc
import sys
import typing
def run(values: typing.List[int]):
with grpc.insecure_channel('localhost:50051') as channel:
stub = summer_pb2_grpc.SummerStub(channel)
summed = stub.Sum(summer_pb2.ToSum(values=values))
print(summed)
... | Python | 17 | 23.117647 | 61 | /summer-grpc/client.py | 0.658537 | 0.634146 |
mgh35/lab-grpc | refs/heads/master | import pytest
@pytest.fixture(scope='module')
def grpc_add_to_server():
from generated.summer_pb2_grpc import add_SummerServicer_to_server
return add_SummerServicer_to_server
@pytest.fixture(scope='module')
def grpc_servicer():
from server import SummerServicer
return SummerServicer()
@pytest.fixt... | Python | 19 | 22.578947 | 70 | /summer-grpc/conftest.py | 0.754464 | 0.75 |
yukojima424/deliverable | refs/heads/master | # AttentionおよびGRU搭載型Seq2Seqの構築
# 概要
# Seq2SeqにAttention層を加え、さらに通常のRNNやLSTMではなくGRUを搭載したものを構築
import sys
sys.path.append('../kojimayu')
import numpy as np
import matplotlib.pyplot as plt
import time
import pickle
import os
import os.path
# データをIDに、IDをデータにするものの枠を作る。
id_to_char = {}
char_to_id = {}
def _update_vocab(tx... | Python | 862 | 29.783062 | 143 | /train_seq2seq_gru_attention.py | 0.529188 | 0.519465 |
cheenwe/mm | refs/heads/master | # encoding=utf-8
import re
import os
import utils
import urllib2
from sqlhelper import SqlHelper
from bs4 import BeautifulSoup as bs
class Crawler(object):
def __init__(self):
super(Crawler, self).__init__()
self.album_prefix = 'https://mm.taobao.com/self/album/open_album_list.htm?_charset=utf-8&u... | Python | 121 | 40.206612 | 126 | /mm.py | 0.519655 | 0.508624 |
cheenwe/mm | refs/heads/master | # coding=utf-8
import utils
import logging
import config
import pymysql
class SqlHelper(object):
def __init__(self):
self.conn = pymysql.connect(**config.database_config)
self.cursor = self.conn.cursor()
try:
self.conn.select_db(config.database)
except:
sel... | Python | 111 | 32.441441 | 154 | /sqlhelper.py | 0.554418 | 0.550647 |
cheenwe/mm | refs/heads/master | # encoding=utf-8
import logging
import os
import config
import traceback
import datetime
# 自定义的日志输出
def log(msg, level = logging.DEBUG):
if not os.path.exists('log'):
os.makedirs('log')
logging.basicConfig(
filename = 'log/run.log',
format = '%(asctime)s: %(message)s',
leve... | Python | 36 | 21.444445 | 98 | /utils.py | 0.595297 | 0.594059 |
cheenwe/mm | refs/heads/master | # encoding=utf-8
from sqlhelper import SqlHelper
sql = SqlHelper()
def insert_data_to_users():
command = ("INSERT IGNORE INTO users "
"(id, name, created_at, remark)"
"VALUES(%s, %s, %s, %s)")
return command
command = insert_data_to_users()
msg = (None, "112", "", "",)
sql.insert_data(command, msg, ... | Python | 19 | 18.210526 | 44 | /mm_test.py | 0.641096 | 0.630137 |
ravisharma607/Faulty-Calculator | refs/heads/master | """ Q->) design a calculator which will correctly solve all the problem except the following one
45*3 = 123, 85+2 = 546, 33-23 = 582 | your program should take operator and two numbers as input from the user and then return the result """
try:
num1 = int(input("enter first number:"))
num2 = int(input("enter se... | Python | 24 | 37.291668 | 142 | /faultyCalcy.py | 0.518519 | 0.459695 |
dabercro/Xbb | refs/heads/master | #!/usr/bin/env python
from __future__ import print_function
import ROOT
from BranchTools import Collection
from BranchTools import AddCollectionsModule
import array
import os
import math
import numpy as np
# MET X/Y correction
class METXY(AddCollectionsModule):
def __init__(self, year):
super(METXY, self... | Python | 91 | 49.813187 | 577 | /python/myutils/METXY.py | 0.60441 | 0.597925 |
dabercro/Xbb | refs/heads/master | #!/usr/bin/env python
from __future__ import print_function
import ROOT
from BranchTools import Collection
from BranchTools import AddCollectionsModule
import array
import os
import math
import numpy as np
# applies the smearing to MC jet resolution and modifies the Jet_PtReg* branches of the tree
class JetSmearer(Add... | Python | 130 | 51.453846 | 177 | /python/myutils/JetSmearer.py | 0.584225 | 0.557836 |
dabercro/Xbb | refs/heads/master | #! /usr/bin/env python
import os
import sys
import glob
from optparse import OptionParser
from myutils.BetterConfigParser import BetterConfigParser
from myutils.FileList import FileList
from myutils.FileLocator import FileLocator
from myutils.copytreePSI import filelist
from myutils.sample_parser import ParseInfo
... | Python | 124 | 32.080647 | 157 | /python/submitMIT.py | 0.618723 | 0.614822 |
dabercro/Xbb | refs/heads/master | #!/usr/bin/env python
import ROOT
import numpy as np
import array
import os
from BranchTools import Collection
from BranchTools import AddCollectionsModule
from XbbTools import XbbTools
class isBoosted(AddCollectionsModule):
def __init__(self, branchName='isBoosted', cutName='all_BOOST'):
super(isBoosted,... | Python | 64 | 40.546875 | 139 | /python/myutils/isBoosted.py | 0.624343 | 0.620962 |
iJuanPablo/tools | refs/heads/master | """
ip_reader
---------
Reads the Machine IP and emails if it has changed
Mac - Linux
crontab
Windows:
Command line as follows:
schtasks /Create /SC HOURLY /TN PythonTask /TR "PATH_TO_PYTHON_EXE PATH_TO_PYTHON_SCRIPT"
That will create an hourly task called 'PythonTask'. You can replace HOURLY with DAILY, WEEKL... | Python | 123 | 26.975609 | 99 | /ip_reader.py | 0.604705 | 0.592797 |
DiegoArcelli/BlocksWorld | refs/heads/main | import numpy as np
import matplotlib.pyplot as plt
from keras.datasets import mnist
from keras.layers import Conv2D
from keras.layers import MaxPool2D
from keras.layers import Flatten
from keras.layers import Dense
from keras.layers import Dropout
from keras import Sequential
# file per allenare e salvare la rete neur... | Python | 72 | 28.333334 | 109 | /cnn.py | 0.725852 | 0.705492 |
DiegoArcelli/BlocksWorld | refs/heads/main | import tkinter as tk
from tkinter.filedialog import askopenfilename
from PIL import Image, ImageTk
from load_state import prepare_image
from utils import draw_state
from blocks_world import BlocksWorld
from search_algs import *
# file che contiene l'implementazione dell'interfaccia grafica per utilizzare il programma
... | Python | 110 | 36.536366 | 139 | /launch.py | 0.619186 | 0.604167 |
DiegoArcelli/BlocksWorld | refs/heads/main | import heapq
import functools
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
class PriorityQueue:
"""A Queue in which the minimum (or maximum) element (as determined by f and
order) is returned first.
If order is 'min', the item with minimum f(x) is
returned first; if order is 'max... | Python | 127 | 33.3937 | 80 | /utils.py | 0.555301 | 0.522098 |
DiegoArcelli/BlocksWorld | refs/heads/main | from aima3.search import *
from utils import *
from collections import deque
from blocks_world import BlocksWorld
import sys
# file che contiene le implementazioni degli algoritmi di ricerca
node_expanded = 0 # numero di nodi espansi durante la ricerca
max_node = 0 # massimo numero di nodi presenti nella frontiera ... | Python | 228 | 28.666666 | 81 | /search_algs.py | 0.57371 | 0.568091 |
DiegoArcelli/BlocksWorld | refs/heads/main | from aima3.search import *
from utils import *
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
# file che contine l'implementazione del problema basata con AIMA
class BlocksWorld(Problem):
def __init__(self, initial, goal):
super().__init__(initial, goal)
# restituisce il numero... | Python | 154 | 30.805195 | 88 | /blocks_world.py | 0.502348 | 0.48009 |
DiegoArcelli/BlocksWorld | refs/heads/main | from PIL import Image, ImageTk
from load_state import prepare_image
from utils import draw_state
from blocks_world import BlocksWorld
from search_algs import *
import argparse
from inspect import getfullargspec
# file che definisce lo script da linea di comando per utilizzare il programma
if __name__ == "__main__":
... | Python | 53 | 37.792454 | 140 | /main.py | 0.671533 | 0.671046 |
DiegoArcelli/BlocksWorld | refs/heads/main | import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
import glob
from tensorflow import keras
from math import ceil
deteced = [np.array([]) for x in range(6)] # lista che contiene le immagini delle cifre
poisitions = [None for x in range(6)] # lista che contiene la posizione delle cifre nell'immagine
de... | Python | 308 | 29.344156 | 101 | /load_state.py | 0.561845 | 0.535202 |
otar/python-weworkremotely-bot | refs/heads/master |
import sys, datetime, requests
from bs4 import BeautifulSoup
from pymongo import MongoClient
# Fetch website HTML and parse jobs data out of it
def fetch(keyword):
SEARCH_URL = 'https://weworkremotely.com/jobs/search?term=%s'
CSS_QUERY = '#category-2 > article > ul > li a'
response = requests.get(SEARCH... | Python | 102 | 24.441177 | 90 | /bot.py | 0.529276 | 0.511556 |
jlstack/Online-Marketplace | refs/heads/master | from application import db
class Product(db.Model):
id = db.Column('id', db.Integer, primary_key=True)
name = db.Column('name', db.String(128), nullable=False)
description = db.Column('description', db.TEXT, nullable=False)
image_path = db.Column('image_path', db.String(128), nullable=True)
quantit... | Python | 45 | 39.288887 | 149 | /application/models.py | 0.644236 | 0.630998 |
jlstack/Online-Marketplace | refs/heads/master | from flask import Flask, Response, session, flash, request, redirect, render_template, g
import sys
import os
import base64
from flask_login import LoginManager, UserMixin, current_user, login_required, login_user, logout_user
import hashlib
from flask_openid import OpenID
errors = []
try:
from application import... | Python | 147 | 30.612246 | 102 | /application.py | 0.614805 | 0.60835 |
jlstack/Online-Marketplace | refs/heads/master | from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
import os
def get_config():
config = {}
if 'RDS_HOSTNAME' in os.environ:
env = {
'NAME': os.environ['RDS_DB_NAME'],
'USER': os.environ['RDS_USERNAME'],
'PASSWORD': os.environ['RDS_PASSWORD'],
'HOST': os.environ['RDS... | Python | 30 | 29.4 | 160 | /application/__init__.py | 0.588816 | 0.58443 |
viaacode/status | refs/heads/master | from locust import HttpLocust, TaskSet, task
class WebsiteTasks(TaskSet):
@task
def index(self):
self.client.get("/")
@task
def status(self):
self.client.get("/status")
@task
def hetarchief(self):
self.client.get("/status/hetarchief.png")
@task
def ftp... | Python | 23 | 19.52174 | 49 | /locustfile.py | 0.605932 | 0.586864 |
viaacode/status | refs/heads/master | import requests
import json
import functools
import logging
# from collections import defaultdict
# from xml.etree import ElementTree
# ref: https://stackoverflow.com/questions/7684333/converting-xml-to-dictionary-using-elementtree
# def etree_to_dict(t):
# d = {t.tag: {} if t.attrib else None}
# children = l... | Python | 108 | 28.666666 | 106 | /src/viaastatus/prtg/api.py | 0.575663 | 0.570671 |
viaacode/status | refs/heads/master | from argparse import ArgumentParser
from viaastatus.server import wsgi
import logging
def argparser():
"""
Get the help and arguments specific to this module
"""
parser = ArgumentParser(prog='status', description='A service that supplies status information about our platforms')
parser.add_argumen... | Python | 34 | 32.088234 | 120 | /src/viaastatus/server/cli.py | 0.616889 | 0.613333 |
viaacode/status | refs/heads/master | from setuptools import setup, find_packages
with open('README.md') as f:
long_description = f.read()
with open('requirements.txt') as f:
requirements = list(map(str.rstrip, f.readlines()))
setup(
name='viaastatus',
url='https://github.com/viaacode/status/',
version='0.0.3',
author='VIAA',
... | Python | 45 | 23.48889 | 55 | /setup.py | 0.534483 | 0.512704 |
viaacode/status | refs/heads/master | from flask import Flask, abort, Response, send_file, request, flash, session, render_template
from flask import url_for, redirect
from viaastatus.prtg import api
from viaastatus.decorators import cacher, templated
from os import environ
import logging
from configparser import ConfigParser
import re
import hmac
from has... | Python | 308 | 30.733767 | 115 | /src/viaastatus/server/wsgi.py | 0.534015 | 0.528389 |
viaacode/status | refs/heads/master | from functools import wraps, partial
from flask import request, render_template
def cached(key='view/%s', cache=None, **extra_cache_kwargs):
def decorator(f):
@wraps(f)
def decorated(*args, **kwargs):
cache_key = key % request.path
rv = cache.get(cache_key)
if r... | Python | 39 | 28.641026 | 60 | /src/viaastatus/decorators.py | 0.536332 | 0.536332 |
viaacode/status | refs/heads/master | import os
from flask import jsonify, Response
import flask
class FileResponse(Response):
default_mimetype = 'application/octet-stream'
def __init__(self, filename, **kwargs):
if not os.path.isabs(filename):
filename = os.path.join(flask.current_app.root_path, filename)
with open... | Python | 53 | 22.981133 | 90 | /src/viaastatus/server/response.py | 0.581432 | 0.581432 |
esyr/trac-hacks | refs/heads/master | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# if you want to test this script, set this True:
# then it won't send any mails, just it'll print out the produced html and text
#test = False
test = False
#which kind of db is Trac using?
mysql = False
pgsql = False
sqlite = True
# for mysql/pgsql:
dbhost="localhos... | Python | 198 | 28.641415 | 180 | /mail_report.py | 0.64304 | 0.637076 |
rajashekarvarma/RIPGEO | refs/heads/master | import GEOparse # Python package to upload a geo data
import pandas as pd
import numpy as np
from scipy import stats
from statsmodels.stats import multitest
import seaborn as sns
import matplotlib.pyplot as plt
############### Fetch Agilent data ###############
print('\n\n',"******...Hi Welcome to RIPGEO...... | Python | 200 | 38.439999 | 185 | /RIPGEO.py | 0.608529 | 0.599011 |
ramimanna/Email-Secret-Santa | refs/heads/master | import os
import random
import smtplib # Email
from dotenv import load_dotenv # For getting stored password
#import getpass # For dynamically enter password
load_dotenv()
username = input("E-mail: ") # e.g. "your_gmail_to_send_from@gmail.com"
password = os.getenv("PASSWORD") # alternatively: getpass.getpass()
def sa... | Python | 51 | 26.078432 | 67 | /send_email.py | 0.674385 | 0.670767 |
arvinwiyono/gmap-places | refs/heads/master | import requests
import json
import pandas as pd
url = "https://maps.googleapis.com/maps/api/place/textsearch/json"
key = "change_this"
cities = [
'jakarta',
'surabaya',
'malang',
'semarang'
]
cols = ['street_address', 'lat', 'long']
df = pd.DataFrame(columns=cols)
for city in cities:
querystring = ... | Python | 24 | 31.125 | 85 | /get_locations.py | 0.640726 | 0.640726 |
digital-sustainability/swiss-procurement-classifier | refs/heads/master | from train import ModelTrainer
from collection import Collection
import pandas as pd
import logging
import traceback
import os
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
# === THESIS ===
anbieter_config = {
'Construction': [
'Alpiq AG',
'Swisscom',
... | Python | 206 | 34.378639 | 134 | /runOldIterations.py | 0.628293 | 0.619512 |
digital-sustainability/swiss-procurement-classifier | refs/heads/master | import pandas as pd
import math
from datetime import datetime
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics impor... | Python | 305 | 45.27869 | 131 | /train.py | 0.599164 | 0.593569 |
digital-sustainability/swiss-procurement-classifier | refs/heads/master | import pandas as pd
import numpy as np
import math
import re
from datetime import datetime
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.tree import DecisionTreeClassifi... | Python | 426 | 39.953053 | 134 | /learn.py | 0.57549 | 0.567695 |
digital-sustainability/swiss-procurement-classifier | refs/heads/master | from db import connection, engine
import math
import pandas as pd
import numpy as np
from sklearn import tree
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, accuracy_score, roc_curve, auc
# =====================
# SQL SELECT STATEMENTS
# =====================
# @pa... | Python | 246 | 41.13821 | 124 | /helpers.py | 0.682511 | 0.658214 |
digital-sustainability/swiss-procurement-classifier | refs/heads/master | import json
import pandas as pd
import warnings
class Collection():
algorithms = ['gradient_boost', 'decision_tree', 'random_forest']
def __init__(self):
self.list = []
def append(self, item):
self.list.append(item)
def __iter__(self):
return iter(self.list)
def get_al... | Python | 59 | 34.423729 | 102 | /collection.py | 0.567464 | 0.56555 |
digital-sustainability/swiss-procurement-classifier | refs/heads/master | import configparser
import sqlalchemy
# git update-index --skip-worktree config.ini
config = configparser.ConfigParser()
config.read("config.ini")
connection_string = 'mysql+' + config['database']['connector'] + '://' + config['database']['user'] + ':' + config['database']['password'] + '@' + config['database']['... | Python | 20 | 29.75 | 212 | /db.py | 0.645528 | 0.645528 |
digital-sustainability/swiss-procurement-classifier | refs/heads/master | from learn import ModelTrainer
from collection import Collection
import pandas as pd
import logging
import traceback
import os
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
# === THESIS ===
anbieter_config = {
'Construction': [
'Alpiq AG',
'KIBAG',
... | Python | 185 | 31.459459 | 152 | /runIterations.py | 0.604996 | 0.59567 |
RomaGeyXD/XSS | refs/heads/main | #!/usr/bin/python3
import argparse
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import parse_qs
from requests import *
ip = get('https://api.ipify.org').text
parser = argparse.ArgumentParser(description='creates xss payloads and starts http server to capture response... | Python | 69 | 33.724636 | 303 | /XSS.py | 0.581744 | 0.56998 |
TAI-REx/DDOSFree | refs/heads/main | #-------------------------------------------------#
# Obfuscate By Mr.GamingThanks To Black Coder Crush
# github : https://github.com/clayhacker-max
# from Linux
# localhost : aarch64
# key : Asep-fA6bC2eA6tB8lX8
# date : Fri Jul 16 13:54:16 2021
#-------------------------------------------------#
#Compile By DNMODZ
#... | Python | 12 | 31.75 | 51 | /Proddos_enc.py | 0.545918 | 0.482143 |
kratikagupta-developer/NewsLetter-SignupApp | refs/heads/master | # your code goes here
import collections
T = int(input())
print (T)
while T>0:
n,g,m = map(int,input().split())
print (n,g,m)
dict = collections.defaultdict(set)
c = 1 ### guest no.
t = 1
li = [-1]
while c <=g:
h,direction = input().split()
print (h,direction)
h = ... | Python | 55 | 22.709091 | 45 | /Untitled-1.py | 0.409509 | 0.388037 |
mendedsiren63/2020_Sans_Holiday_Hack_Challenge | refs/heads/main | #!/usr/bin/python3
import os
main_nonce="nonce"
obj_file_new_nonce="obj_new_nonce_624"
cmd_cut='cat nonce | tail -312 > obj_nonce_312'
nonce_combined_list=[]
def split_nonce():
os.system(cmd_cut) #This block will cut 312 nonce from main file and put in last nonce_312
file_nonce="obj_nonce_312"
with open(file_non... | Python | 43 | 34.279068 | 127 | /Bitcoin-Investigation/process_nonce_obj_11a.py | 0.664915 | 0.622208 |
remiljw/Python-Script | refs/heads/master | import requests
import jenkins
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import datetime
Base = declarative_base()
def connectToJenkins(url, username, password):
server = jenkins.Jenkins(url,
username=username, password=passw... | Python | 94 | 29.404255 | 129 | /jenkins_jobs.py | 0.662351 | 0.658502 |
badgerlordy/smash-bros-reader | refs/heads/master | import argparse
import cv2
import difflib
import json
import matplotlib.pyplot as plt
import mss
import numpy as np
import os
import re
import requests
import select
import smash_game
import smash_utility as ut
import socket
import struct
import threading
from queue import Empty, Queue
#from matplotlib import pyplot ... | Python | 440 | 25.661364 | 108 | /smash_reader/tests.py | 0.590913 | 0.570199 |
badgerlordy/smash-bros-reader | refs/heads/master | import cv2
from datetime import datetime
import json
from logger import log_exception
import matplotlib.pyplot as plt
import mss
import numpy as np
from PIL import Image, ImageChops, ImageDraw
import pytesseract
import random
import requests
from skimage.measure import compare_ssim
import string
import subproce... | Python | 554 | 28.64621 | 97 | /smash_reader/smash_utility.py | 0.513699 | 0.467791 |
badgerlordy/smash-bros-reader | refs/heads/master | import copy
import difflib
import json
from logger import log_exception
import numpy as np
import os
from PIL import Image
import re
import smash_utility as ut
import sys
import threading
import time
sys.excepthook = log_exception
character_name_debugging_enabled = False
output = True
def _print(*args, **kwargs... | Python | 419 | 35.646778 | 106 | /smash_reader/smash_game.py | 0.530772 | 0.523217 |
badgerlordy/smash-bros-reader | refs/heads/master | import cv2
import datetime
import numpy as np
import os
#import pytesseract as pyt
import time
from datetime import datetime
from PIL import Image, ImageGrab, ImageDraw, ImageChops
COORDS = {
'lobby-flag-screen-id': (379, 281, 1534, 445),
'lobby-flag-screen-player-markers': (70, 820, 1800, 821),
'flag-ar... | Python | 203 | 29.054188 | 99 | /smash_reader/flags.py | 0.476971 | 0.439272 |
badgerlordy/smash-bros-reader | refs/heads/master | from datetime import datetime
import json
from logger import log_exception
import numpy as np
import os
from PIL import Image, ImageTk
import platform
from queue import Queue, Empty
import requests
import smash_game
import smash_utility as ut
import smash_watcher
from sys import argv, excepthook
import time
i... | Python | 384 | 35.171875 | 138 | /smash_reader/smash.py | 0.596544 | 0.581281 |
badgerlordy/smash-bros-reader | refs/heads/master | from datetime import datetime
import os
from sys import __excepthook__
from time import time
from traceback import format_exception
BASE_DIR = os.path.realpath(os.path.dirname(__file__))
def log_exception(type, value, tb):
error = format_exception(type, value, tb)
filepath = os.path.join(BASE_DIR, 'e... | Python | 23 | 30.956522 | 76 | /smash_reader/logger.py | 0.635374 | 0.635374 |
badgerlordy/smash-bros-reader | refs/heads/master | import json
from logger import log_exception
import os
from queue import Empty
import re
import requests
import smash_game
import smash_utility as ut
import sys
import threading
import time
sys.excepthook = log_exception
output = True
def _print(*args, **kwargs):
if output:
args = list(args)
... | Python | 290 | 34.265518 | 108 | /smash_reader/smash_watcher.py | 0.505427 | 0.499169 |
radrumond/hidra | refs/heads/master | # ADAPTED BY Rafael Rego Drumond and Lukas Brinkmeyer
# THIS IMPLEMENTATION USES THE CODE FROM: https://github.com/dragen1860/MAML-TensorFlow
import os
import numpy as np
import tensorflow as tf
from archs.maml import MAML
class Model(MAML):
def __init__(self,train_lr,meta_lr,image_shape,isMIN, label_size=2):
... | Python | 87 | 57.298851 | 112 | /archs/fcn.py | 0.591994 | 0.559061 |
radrumond/hidra | refs/heads/master | import numpy as np
import tensorflow as tf
from data_gen.omni_gen import unison_shuffled_copies,OmniChar_Gen, MiniImgNet_Gen
import time
def train( m, mt, # m is the model foir training, mt is the model for testing
data_sampler, # Creates the data generator for training and testing
min_classe... | Python | 108 | 50.009258 | 162 | /train.py | 0.451988 | 0.439281 |
radrumond/hidra | refs/heads/master | # ADAPTED BY Rafael Rego Drumond and Lukas Brinkmeyer
# THIS IMPLEMENTATION USES THE CODE FROM: https://github.com/dragen1860/MAML-TensorFlow
import os
import numpy as np
import tensorflow as tf
class MAML:
def __init__(self,train_lr,meta_lr,image_shape, isMIN, label_size=2):
self.train_lr = train_lr
... | Python | 136 | 44.830883 | 140 | /archs/maml.py | 0.579429 | 0.571406 |
radrumond/hidra | refs/heads/master | # ADAPTED BY Rafael Rego Drumond and Lukas Brinkmeyer
# THIS IMPLEMENTATION USES THE CODE FROM: https://github.com/dragen1860/MAML-TensorFlow
import numpy as np
import tensorflow as tf
from archs.maml2 import MAML
def getBin(l=10):
x_ = 2
n = 1
while x_ < l:
x_ = x_* 2
n += 1
numbe... | Python | 102 | 41.862743 | 126 | /archs/hydra.py | 0.566102 | 0.533166 |
radrumond/hidra | refs/heads/master | import numpy as np
import os
import cv2
import pickle
class MiniImgNet_Gen:
def __init__(self,path="/tmp/data/miniimagenet",data_path=None):
if data_path is None:
self.path = path
self.train_paths = ["train/"+x for x in os.listdir(path+"/train")]
... | Python | 275 | 35.080002 | 166 | /data_gen/omni_gen.py | 0.499195 | 0.490342 |
radrumond/hidra | refs/heads/master | """
Command-line argument parsing.
"""
import argparse
#from functools import partial
import time
import tensorflow as tf
import json
import os
def boolean_string(s):
if s not in {'False', 'True'}:
raise ValueError('Not a valid boolean string')
return s == 'True'
def argument_parser():
"""
G... | Python | 97 | 50.051548 | 124 | /args.py | 0.616845 | 0.60715 |
radrumond/hidra | refs/heads/master | import numpy as np
import tensorflow as tf
from data_gen.omni_gen import unison_shuffled_copies,OmniChar_Gen, MiniImgNet_Gen
def test(m, data_sampler,
eval_step,
min_classes,
max_classes,
train_shots,
test_shots,
meta_batch,
meta_iters,
na... | Python | 54 | 39.222221 | 184 | /test.py | 0.481822 | 0.469397 |
radrumond/hidra | refs/heads/master | ## Created by Rafael Rego Drumond and Lukas Brinkmeyer
# THIS IMPLEMENTATION USES THE CODE FROM: https://github.com/dragen1860/MAML-TensorFlow
from data_gen.omni_gen import unison_shuffled_copies,OmniChar_Gen, MiniImgNet_Gen
from archs.fcn import Model as mfcn
from archs.hydra import Model as mhyd
from train import ... | Python | 61 | 41.098362 | 133 | /main.py | 0.647975 | 0.641745 |
Rhaptos/Products.Lensmaker | refs/heads/master | from Products.Archetypes.public import StringWidget
from Products.Archetypes.Registry import registerWidget
class ColorWidget(StringWidget):
_properties = StringWidget._properties.copy()
_properties.update({
'macro' : "colorchooser",
})
registerWidget(ColorWidget,
title='Color',
... | Python | 21 | 34.333332 | 95 | /widgets.py | 0.685061 | 0.681023 |
tiwarim/PlagiarismCheck | refs/heads/master | # importing libraries
from sys_utils import *
# Resource Detect
"""
Resource Detect takes input on a POST protocol and returns similarity ratio
Parameters:
namepassimg: contains username, password of the user and two string documents <JSON>
Returns:
retJson: contains status code and message... | Python | 69 | 31.072464 | 120 | /src/Backend/web/Detect.py | 0.554903 | 0.539539 |
tiwarim/PlagiarismCheck | refs/heads/master | # importing libraries
from sys_utils import *
# Resource refill
"""
Resource Refill takes input on a POST protocol and adds to the existing tokens
Parameters:
namepassref: contains username, admin password and refill amount <JSON>
Returns:
retJson: contains status code and message <JSON>
"... | Python | 51 | 26.647058 | 83 | /src/Backend/web/Refill.py | 0.534752 | 0.528369 |
tiwarim/PlagiarismCheck | refs/heads/master | # importing libraries
from sys_utils import *
# Resource Register
"""
Resource Register takes input on a POST protocol and creates new accounts
Parameters:
namepass: contains username and password of the user <JSON>
Returns:
retJson: contains status code and message <JSON>
"""
class Regist... | Python | 36 | 28.916666 | 78 | /src/Backend/web/Register.py | 0.566388 | 0.55896 |
tiwarim/PlagiarismCheck | refs/heads/master | import requests
import json
from time import process_time
def test_FR1_1():
response = requests.post('http://ec2-3-134-112-214.us-east-2.compute.amazonaws.com:8000/register', json={
"username" : "ghtdsss",
"password" : "12356"
})
json_response = response.json()
assert json_response['statuscode'] ==... | Python | 205 | 30.790243 | 109 | /src/Testing/Unit_Test.py | 0.616754 | 0.537435 |
sebastianden/alpaca | refs/heads/master | from alpaca import Alpaca
from utils import to_time_series_dataset, to_dataset, split_df, TimeSeriesResampler
import time
import numpy as np
import pandas as pd
from sklearn.pipeline import Pipeline
max_sample = 20
for dataset in ['uc2']:
if dataset == 'uc1':
X, y = split_df(pd.read_pickle('..\\data\\df_... | Python | 70 | 37.357143 | 84 | /src/test_time.py | 0.540721 | 0.519896 |
sebastianden/alpaca | refs/heads/master | from alpaca import Alpaca
from utils import to_time_series_dataset, split_df, TimeSeriesResampler, confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
from sklearn.pipeline import Pipeline
import time
import numpy as np
import pandas as pd
# Variables
repetitions = 2... | Python | 124 | 41.919353 | 123 | /src/test_use_case.py | 0.484695 | 0.476432 |
sebastianden/alpaca | refs/heads/master | import numpy as np
import pandas as pd
from utils import split_df, TimeSeriesResampler, plot_confusion_matrix, Differentiator
from alpaca import Alpaca
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
import matplotlib.pyplot as plt
if __name__ == "__main__":
"""
... | Python | 46 | 43.152172 | 113 | /src/main.py | 0.607776 | 0.604823 |
sebastianden/alpaca | refs/heads/master | import warnings
warnings.simplefilter(action='ignore')
import pickle
import pandas as pd
import numpy as np
from utils import TimeSeriesScalerMeanVariance, Flattener, Featuriser, plot_dtc
from sklearn.pipeline import Pipeline
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import Grid... | Python | 411 | 36.114357 | 114 | /src/alpaca.py | 0.585945 | 0.575062 |
sebastianden/alpaca | refs/heads/master | import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
from sklearn.utils.multiclass import unique_labels
from scipy.stats import kurtosis, skew
import numpy as np
import pandas as pd
from sklearn.base import TransformerMixin, BaseEstimator
from sklearn import tree
import graphviz
# Load the tes... | Python | 444 | 30.774775 | 111 | /src/utils.py | 0.548341 | 0.540261 |
sebastianden/alpaca | refs/heads/master | from alpaca import Alpaca
from utils import load_test, split_df, TimeSeriesResampler,confusion_matrix
import time
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
from sklearn.pipeline import Pipeline
import numpy as np
import pandas as pd
if __name__ == '__main__':
X, y = l... | Python | 87 | 35.793102 | 108 | /src/test_voting.py | 0.561037 | 0.548236 |
sebastianden/alpaca | refs/heads/master | import pandas as pd
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
def univariant(df, param, quantity='mean_test_score'):
unique = df[param].unique()
scores = []
for i in unique:
scores.append(df[df[param] == i][quantity].mean()... | Python | 39 | 28.410257 | 102 | /src/gridsearch_results.py | 0.657068 | 0.631763 |
sebastianden/alpaca | refs/heads/master | import tensorflow.keras.backend as K
import tensorflow.keras
from tensorflow.keras.layers import Lambda
from tensorflow.keras.models import Model, load_model
tensorflow.compat.v1.disable_eager_execution()
import tensorflow as tf
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from utils import ... | Python | 152 | 38.144737 | 126 | /src/cam.py | 0.637372 | 0.623257 |
siguangzong/Web_Log_Tool | refs/heads/master | # -*- coding:utf-8 -*-
import os
import re
import json
import time
import traceback
import datetime
from collections import Counter
from numpy import var, average, percentile
from bin.util import get_dir_files
from bin.config import config
from bin.report import generate_web_log_parser_report
from bin.report import ge... | Python | 399 | 40.107769 | 139 | /web-log-parser/bin/start.py | 0.561639 | 0.541519 |
siguangzong/Web_Log_Tool | refs/heads/master | # -*- coding:utf-8 -*-
import configparser
class Config:
"""get config from the ini file"""
def __init__(self, config_file):
all_config = configparser.RawConfigParser()
with open(config_file, 'r',encoding="UTF-8") as cfg_file:
all_config.readfp(cfg_file)
self.log_format =... | Python | 53 | 49.754719 | 99 | /web-log-parser/bin/config.py | 0.617472 | 0.615613 |
siguangzong/Web_Log_Tool | refs/heads/master | # -*- coding:utf-8 -*-
import json
import requests
from util import get_dir_files
from config import config
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('./templates'))
report_template = env.get_template('report.html')
index_template = env.get_template('index.html')
url_t... | Python | 118 | 43.110168 | 107 | /web-log-parser/bin/report.py | 0.578482 | 0.564842 |
Nimunex/TFG | refs/heads/master |
from bluepy import btle
from bluepy.btle import Peripheral, DefaultDelegate
import Services
from Services import EnvironmentService, BatterySensor, UserInterfaceService, MotionService, DeviceDelegate
## Thingy52 Definition
class Device(Peripheral):
##Thingy:52 module. Instance the class and enable to get acces... | Python | 22 | 40.31818 | 107 | /Device.py | 0.69255 | 0.686254 |
Nimunex/TFG | refs/heads/master | #####################################################################
# BLE devices handler #
# A new subprocess is created for each preregistered device in: #
# ./devices.mac #
########################################... | Python | 18 | 40 | 85 | /call.py | 0.451219 | 0.418699 |
Nimunex/TFG | refs/heads/master |
from bluepy import btle
from bluepy.btle import UUID,Peripheral, DefaultDelegate
import os.path
import struct
import sys
import binascii
from urllib.request import urlopen
import bitstring
import fxpmath
from bitstring import BitArray
from fxpmath import Fxp
#Useful functions
def write_uint16(data, value, index):... | Python | 1,125 | 37.344891 | 213 | /Services.py | 0.537547 | 0.500116 |
Nimunex/TFG | refs/heads/master | ##Main
from bluepy import btle
from bluepy.btle import Peripheral, DefaultDelegate
import os.path
import struct
import binascii
import sys
import datetime
import time
from time import time,sleep
import Services
from Services import EnvironmentService, BatterySensor, UserInterfaceService, MotionService, DeviceDelegate
... | Python | 94 | 23.521276 | 107 | /mainMotion.py | 0.649892 | 0.624295 |
rafunchik/shrimps | refs/heads/master | # coding=utf-8
import codecs
import re
from abstract import Abstract
__author__ = 'rcastro'
from gensim.models import Word2Vec
from codecs import open
import nltk
#nltk.download() # Download text data sets, including stop words
from nltk.corpus import stopwords # Import the stop word list
import numpy as np
#model ... | Python | 117 | 35.53846 | 130 | /word2vec.py | 0.66963 | 0.656762 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.