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 |
|---|---|---|---|---|---|---|---|---|---|
sayankae/Python-String | refs/heads/main | #Problem Given
#Convert a string containing only lower case letter to a string with upper case
#It is expected to solve the problem within O(sizeof(str)
#Auxilary Space O(1)
#function to convert string into upper
def to_upper(str):
#temp will store the intger value of 1st letter of the string
temp = ... | Python | 26 | 37.192307 | 85 | /lower_to_upper.py | 0.612903 | 0.602823 |
seancarverphd/sgt | refs/heads/master | import pandas as pd
protein_data=pd.read_csv('../data/protein_classification.csv')
X=protein_data['Sequence']
def split(word):
return [char for char in word]
sequences = [split(x) for x in X]
protein_data=pd.read_csv('../data/protein_classification.csv')
X=protein_data['Sequence']
import string
# import sgtde... | Python | 44 | 29.295454 | 102 | /python/test.py | 0.656907 | 0.653153 |
TrevorTheAmazing/Capstone | refs/heads/master | import datetime
import math
import os
import librosa
from sklearn.model_selection import train_test_split
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D
from keras.utils import to_categorical
import numpy as np
from tqdm import tqdm
import tensorf... | Python | 200 | 32.735001 | 158 | /test/MLClassifier/mLproj.py | 0.633521 | 0.614997 |
katrii/ohsiha | refs/heads/master | from django.apps import AppConfig
class OhjelmaConfig(AppConfig):
name = 'ohjelma'
| Python | 5 | 16.799999 | 33 | /ohjelma/apps.py | 0.752809 | 0.752809 |
katrii/ohsiha | refs/heads/master | # Generated by Django 3.0.2 on 2020-03-15 16:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ohjelma', '0002_song'),
]
operations = [
migrations.AddField(
model_name='song',
name='release_year',
fi... | Python | 18 | 19.888889 | 52 | /ohjelma/migrations/0003_song_release_year.py | 0.579787 | 0.518617 |
katrii/ohsiha | refs/heads/master | from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name = 'home'),
path('songs/', views.SongList.as_view(), name = 'song_list'),
path('view/<int:pk>', views.SongView.as_view(), name = 'song_view'),
path('new', views.SongCreate.as_view(), name = 'song_new'),
path... | Python | 19 | 46.63158 | 79 | /ohjelma/urls.py | 0.630939 | 0.630939 |
katrii/ohsiha | refs/heads/master | # Generated by Django 3.0.2 on 2020-03-13 17:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ohjelma', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Song',
fields=[
('id', mod... | Python | 21 | 26.285715 | 114 | /ohjelma/migrations/0002_song.py | 0.560209 | 0.516579 |
katrii/ohsiha | refs/heads/master | # Generated by Django 3.0.2 on 2020-03-29 10:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ohjelma', '0004_track'),
]
operations = [
migrations.AlterField(
model_name='track',
name='track_duration',
... | Python | 18 | 20.055555 | 49 | /ohjelma/migrations/0005_auto_20200329_1313.py | 0.580475 | 0.527704 |
katrii/ohsiha | refs/heads/master | # Generated by Django 3.0.2 on 2020-04-11 18:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ohjelma', '0006_auto_20200329_1329'),
]
operations = [
migrations.AddField(
model_name='track',
name='track_id',
... | Python | 19 | 21.736841 | 61 | /ohjelma/migrations/0007_track_track_id.py | 0.583333 | 0.50463 |
katrii/ohsiha | refs/heads/master | from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.urls import reverse_lazy
from ohjelma.models import Song
from ohjelma.models import Track
import json
impo... | Python | 240 | 32.212502 | 145 | /ohjelma/views.py | 0.562594 | 0.543276 |
katrii/ohsiha | refs/heads/master | from django.db import models
from django.urls import reverse
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('Date published')
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = mode... | Python | 44 | 35.840908 | 68 | /ohjelma/models.py | 0.714726 | 0.684535 |
katrii/ohsiha | refs/heads/master | # Generated by Django 3.0.2 on 2020-03-29 10:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ohjelma', '0005_auto_20200329_1313'),
]
operations = [
migrations.AlterField(
model_name='track',
name='track_durati... | Python | 18 | 20.833334 | 50 | /ohjelma/migrations/0006_auto_20200329_1329.py | 0.590331 | 0.506361 |
katrii/ohsiha | refs/heads/master | # Generated by Django 3.0.2 on 2020-04-11 19:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ohjelma', '0008_track_track_danceability'),
]
operations = [
migrations.AddField(
model_name='track',
name='track_ac... | Python | 67 | 30.313433 | 63 | /ohjelma/migrations/0009_auto_20200411_2211.py | 0.544328 | 0.522879 |
katrii/ohsiha | refs/heads/master | # Generated by Django 3.0.2 on 2020-03-28 23:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ohjelma', '0003_song_release_year'),
]
operations = [
migrations.CreateModel(
name='Track',
fields=[
... | Python | 23 | 30.782608 | 114 | /ohjelma/migrations/0004_track.py | 0.573187 | 0.526676 |
ewheeler/nomenklatura | refs/heads/master | from setuptools import setup, find_packages
setup(
name='nomenklatura',
version='0.1',
description="Make record linkages on the web.",
long_description='',
classifiers=[
],
keywords='data mapping identity linkage record',
author='Open Knowledge Foundation',
author_email='info@ok... | Python | 24 | 24.208334 | 70 | /setup.py | 0.621488 | 0.618182 |
ewheeler/nomenklatura | refs/heads/master |
from nomenklatura.model.dataset import Dataset
from nomenklatura.model.entity import Entity
from nomenklatura.model.account import Account
from nomenklatura.model.upload import Upload
| Python | 4 | 45 | 46 | /nomenklatura/model/__init__.py | 0.864865 | 0.864865 |
ewheeler/nomenklatura | refs/heads/master | import logging
from logging.handlers import RotatingFileHandler
from flask import Flask
from flask import url_for as _url_for
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.oauth import OAuth
from flask.ext.assets import Environment
import certifi
from kombu import Exchange, Queue
from celery import Celer... | Python | 66 | 30.40909 | 85 | /nomenklatura/core.py | 0.698987 | 0.692716 |
ewheeler/nomenklatura | refs/heads/master | import os
def bool_env(val):
"""Replaces string based environment values with Python booleans"""
return True if os.environ.get(val, 'False').lower() == 'true' else False
#DEBUG = True
SECRET_KEY = os.environ.get('SECRET_KEY')
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL',
... | Python | 25 | 32.400002 | 76 | /contrib/heroku_settings.py | 0.698204 | 0.691018 |
ewheeler/nomenklatura | refs/heads/master | DEBUG = False
APP_NAME = 'nomenklatura'
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'
ALLOWED_EXTENSIONS = set(['csv', 'tsv', 'ods', 'xls', 'xlsx', 'txt'])
SIGNUP_DISABLED = False
| Python | 8 | 23.375 | 69 | /nomenklatura/default_settings.py | 0.661538 | 0.641026 |
ewheeler/nomenklatura | refs/heads/master | import logging
import requests
from flask import url_for, session, Blueprint, redirect
from flask import request
from apikit import jsonify
from werkzeug.exceptions import Forbidden
from nomenklatura import authz
from nomenklatura.core import app, db, github
from nomenklatura.model import Account, Dataset
section = ... | Python | 71 | 28.352112 | 84 | /nomenklatura/views/sessions.py | 0.654031 | 0.654031 |
ewheeler/nomenklatura | refs/heads/master | from flask.ext.assets import Bundle
from nomenklatura.core import assets
deps_assets = Bundle(
'vendor/jquery/dist/jquery.js',
'vendor/bootstrap/js/collapse.js',
'vendor/angular/angular.js',
'vendor/angular-route/angular-route.js',
'vendor/angular-bootstrap/ui-bootstrap-tpls.js',
'vendor/ngUpl... | Python | 44 | 25.818182 | 52 | /nomenklatura/assets.py | 0.680508 | 0.680508 |
ewheeler/nomenklatura | refs/heads/master | # shut up useless SA warning:
import warnings
warnings.filterwarnings('ignore', 'Unicode type received non-unicode bind param value.')
| Python | 3 | 44 | 88 | /nomenklatura/__init__.py | 0.792593 | 0.792593 |
ewheeler/nomenklatura | refs/heads/master | from normality import normalize
from flask.ext.script import Manager
from flask.ext.assets import ManageAssets
from nomenklatura.core import db
from nomenklatura.model import Entity
from nomenklatura.views import app
from nomenklatura.assets import assets
manager = Manager(app)
manager.add_command('assets', ManageAss... | Python | 31 | 23.935484 | 70 | /nomenklatura/manage.py | 0.730919 | 0.730919 |
kgg511/Capstone.py | refs/heads/master | # Where I am currently: function makeOutfitMyself allows user to select an outfit choice from each category, adds it to a list, and returns the complete outfit.
# function computerChooses() has not been designed yet
# I plan on later adding in color options or allowing the user to add their own options
import random
gC... | Python | 56 | 47.785713 | 160 | /capstone1.py | 0.669107 | 0.667643 |
Lchet/TensorFlow_Intro | refs/heads/master | # -*- coding:utf-8 -*-
# @Filename: Tensorflow_flow.py
# Created on: 09/10/21 10:33
# @Author: Luc
import numpy as np
import pandas as pd
import tensorflow as tf
import sys
import matplotlib.pyplot as plt
import datetime
from sklearn.preprocessing import MinMaxScaler, StandardScaler, LabelEncoder
from sklea... | Python | 310 | 37.36129 | 117 | /Tensorflow_flow.py | 0.606374 | 0.591995 |
jaime7981/Arduino_EFI | refs/heads/master | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
rpms = np.array([4000,3500,3000,2500,2000,1500,1000,500])
throttle = np.array([0,0,10,20,40,60,80,100,120])
efi_map = np.array([[17.2, 16.8, 15.5, 14.8, 13.8, 13.0, 12.2],
[17.0, 16.5, 15.0, 14.0, 13.4, 13.0, 12.4],
... | Python | 35 | 30.771429 | 80 | /EFI_map.py | 0.516652 | 0.335734 |
hgarud/Logistic_RF_MNIST | refs/heads/master | import numpy as np
import gzip
from sklearn.preprocessing import OneHotEncoder
class MNIST_Data(object):
def __init__(self, base_dir, img_size):
self.base_dir = base_dir
self.img_size = img_size
def _load_labels(self, file_name):
file_path = self.base_dir + file_name
with gzi... | Python | 34 | 32.941177 | 121 | /codebase/Data.py | 0.636915 | 0.620451 |
hgarud/Logistic_RF_MNIST | refs/heads/master | from Data import MNIST_Data
from sklearn.preprocessing import OneHotEncoder
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
import numpy as np
import csv
mnist_loader = MNIST_Data(base_dir = "/home/hrishi/1Hrishi/ECE542_Neural_Networks/Homeworks/2/Data/", img_si... | Python | 62 | 39.967743 | 141 | /codebase/Main.py | 0.739764 | 0.712598 |
lukasld/Flask-Video-Editor | refs/heads/main | import os
from flask import Flask, request, redirect, \
url_for, session, jsonify, send_from_directory, make_response, send_file
from . import api
from . import utils
from .. import VIDEO_UPLOAD_PATH, FRAMES_UPLOAD_PATH, IMG_EXTENSION, VIDEO_EXTENSION, CACHE
from . VideoProcessing import Frame, Vide... | Python | 103 | 33.233009 | 91 | /app/api/videoApi.py | 0.620533 | 0.615712 |
lukasld/Flask-Video-Editor | refs/heads/main | from flask_swagger_ui import get_swaggerui_blueprint
swagger_ui = get_swaggerui_blueprint(
'/docs',
'/static/swagger.json',
config={
"app_name": "videoApi"
}
)
| Python | 10 | 21.6 | 52 | /app/docs/__init__.py | 0.517699 | 0.517699 |
lukasld/Flask-Video-Editor | refs/heads/main | from flask import Blueprint
api = Blueprint('videoApi', __name__)
from . import videoApi, errors, help
| Python | 5 | 20 | 37 | /app/api/__init__.py | 0.72381 | 0.72381 |
lukasld/Flask-Video-Editor | refs/heads/main | from flask import redirect, url_for, jsonify
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return jsonify(error=str(e)), 404
@main.app_errorhandler(405)
def method_not_allowed(e):
return jsonify(error=str(e)), 405
| Python | 10 | 23.799999 | 44 | /app/main/errors.py | 0.72 | 0.672 |
lukasld/Flask-Video-Editor | refs/heads/main | from flask import request, jsonify
from functools import wraps
from .errors import InvalidAPIUsage, InvalidFilterParams, IncorrectVideoFormat
"""
Almost like an Architect - makes decorations
"""
def decorator_maker(func):
def param_decorator(fn=None, does_return=None, req_c_type=None, req_type=None, arg=Non... | Python | 135 | 27.992592 | 107 | /app/api/decorators.py | 0.599898 | 0.595554 |
lukasld/Flask-Video-Editor | refs/heads/main | import cv2
import math
import string
import random
import numpy as np
import skvideo.io
from PIL import Image
from .. import VIDEO_EXTENSION, VIDEO_UPLOAD_PATH, \
FRAMES_UPLOAD_PATH, IMG_EXTENSION, CACHE
FPS = 23.98
SK_CODEC = 'libx264'
def create_vid_path(name):
return f'{VIDEO_UPLOAD_PATH}/{na... | Python | 59 | 23.932203 | 76 | /app/api/utils.py | 0.650611 | 0.639756 |
lukasld/Flask-Video-Editor | refs/heads/main | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
"""
"""
SECRET_KEY = os.environ.get('SECRET_KEY')
FLASK_CONFIG = os.environ.get('FLASK_CONFIG')
VIDEO_EXTENSION = os.environ.get('VIDEO_EXTENSION')
VIDEO_WIDTH = os.environ.get('VIDEO_WIDTH')
VIDEO_HEIGHT = os.e... | Python | 33 | 17.727272 | 55 | /config.py | 0.624595 | 0.624595 |
lukasld/Flask-Video-Editor | refs/heads/main | from werkzeug.utils import secure_filename
from functools import partial
import subprocess as sp
import time
import skvideo.io
import numpy as np
import threading
import ffmpeg
import shlex
import cv2
import re
from PIL import Image
from werkzeug.datastructures import FileStorage as FStorage
from .. import VIDEO_EXT... | Python | 189 | 30.989418 | 91 | /app/api/VideoProcessing.py | 0.571948 | 0.563844 |
lukasld/Flask-Video-Editor | refs/heads/main | from flask import jsonify, request, send_from_directory
from . decorators import parameter_check
from . import api
from ..import HELP_MSG_PATH
import json
AV_EP = ["upload", "preview", "download", "stats", "filters"]
AV_FILTERS = ["canny", "greyscale", "laplacian", "gauss"]
@api.route('/help/', methods=['GET'])
@api.... | Python | 25 | 34.16 | 61 | /app/api/help.py | 0.67463 | 0.664391 |
lukasld/Flask-Video-Editor | refs/heads/main | from flask import Flask
from config import config
from flask_caching import Cache
from flask_swagger_ui import get_swaggerui_blueprint
VIDEO_EXTENSION=None
VIDEO_WIDTH=None
VIDEO_HEIGHT=None
VIDEO_UPLOAD_PATH=None
FRAMES_UPLOAD_PATH=None
IMG_EXTENSION=None
HELP_MSG_PATH=None
CACHE=None
def create_app(config_nam... | Python | 66 | 22.742424 | 72 | /app/__init__.py | 0.696235 | 0.695597 |
lukasld/Flask-Video-Editor | refs/heads/main | import sys
import traceback
from flask import jsonify, request
from . import api
class InvalidAPIUsage(Exception):
status_code = 400
def __init__(self, message='', status_code=None):
super().__init__()
self.message = message
self.path = request.path
if status_code is None:
... | Python | 52 | 34.884617 | 150 | /app/api/errors.py | 0.61007 | 0.591859 |
ttruty/SmartWatchProcessing | refs/heads/master | #!/usr/bin/env python3
"""Module to calculate reliability of samples of raw accelerometer files."""
import pandas as pd
import matplotlib.pyplot as plt
import datetime
import argparse
import os
def main():
"""
Application entry point responsible for parsing command line requests
"""
parser = argparse... | Python | 68 | 35.235294 | 121 | /ReliabilityScore.py | 0.665314 | 0.660041 |
ttruty/SmartWatchProcessing | refs/heads/master | #!/usr/bin/env python3
"""Module to calculate energy and non-wear time of accelerometer data."""
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import datetime
import argparse
def main():
"""
Application entry point responsible for parsing command line requests
"""
p... | Python | 128 | 44.929688 | 191 | /EnergyCalculation.py | 0.65329 | 0.642068 |
ttruty/SmartWatchProcessing | refs/heads/master | #!/usr/bin/env python3
"""Combine all hours of data into one CSV"""
import pandas as pd
#output combined CSV file
def concat_file(file_list, output_file):
"""concat .csv file according to list of files
:param str file_list: List of CSV from provided dataset
:param str output_file: Output filename ... | Python | 26 | 40.076923 | 107 | /ConcatData.py | 0.69447 | 0.672915 |
CaptainIllidan/yolo | refs/heads/master | import numpy as np
import cv2
import pyyolo
cap = cv2.VideoCapture('gun4_2.mp4')
meta_filepath = "/home/unknown/yolo/darknet.data"
cfg_filepath = "/home/unknown/yolo/darknet-yolov3.cfg"
weights_filepath = "/home/unknown/yolo/yolov3.weights"
meta = pyyolo.load_meta(meta_filepath)
net = pyyolo.load_net(cfg_filepath, w... | Python | 32 | 25.8125 | 103 | /detect.py | 0.664336 | 0.642191 |
androiddevnotesforks/github-scraper | refs/heads/master | """Scrape GitHub data for organizational accounts."""
import argparse
import asyncio
import csv
import json
import sys
import time
from pathlib import Path
from typing import Any, Dict, List, Tuple
import aiohttp
import networkx as nx
class GithubScraper():
"""Scrape information about organizational Github acco... | Python | 541 | 37.693161 | 88 | /github_scraper.py | 0.559882 | 0.559213 |
maxiantian/DownloadTaobaoSearchPicture | refs/heads/master | import urllib.request
import re
import ssl
#全局取消证书验证
ssl._create_default_https_context = ssl._create_unverified_context
#设置淘宝搜索的关键词
keyword = urllib.request.quote("毛衣")
#将爬虫伪装成火狐浏览器
headers=("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:57.0) Gecko/20100101 Firefox/57.0")
#创建一个opener对象
opener = ur... | Python | 42 | 26.166666 | 196 | /DownloadTaobaoSearchPicture.py | 0.675934 | 0.635969 |
vishnuyar/DS-Unit-3-Sprint-2-SQL-and-Databases | refs/heads/master | import pandas as pd
import sqlite3
#Import buddymove dataset by reading csv
buddymove_df = pd.read_csv('buddymove_holidayiq.csv')
#Printing the shape of the dataset and first five rows
print(buddymove_df.shape)
print(buddymove_df.head())
#Printing the number of null values in the dataset
print("The number of null value... | Python | 60 | 35.633335 | 137 | /module1-introduction-to-sql/buddymove_holidayiq.py | 0.702002 | 0.686988 |
vishnuyar/DS-Unit-3-Sprint-2-SQL-and-Databases | refs/heads/master | import pymongo
client = pymongo.MongoClient("mongodb+srv://mongoadmin:2BlYV2t3X4jws3XR@cluster0-uosnx.mongodb.net/test?retryWrites=true&w=majority")
db = client.test
| Python | 5 | 25.4 | 97 | /module3-nosql-and-document-oriented-databases/mongoproject.py | 0.772727 | 0.772727 |
vishnuyar/DS-Unit-3-Sprint-2-SQL-and-Databases | refs/heads/master | import sqlite3
"""Database operations for the NorthWind data """
def data_operations(conn,query):
""" Function which performs database operations and returns results """
try:
#creating a cursor for connection
cursor = conn.cursor()
#executing the query on the database and get the resul... | Python | 159 | 35.00629 | 103 | /sprint/northwind.py | 0.632774 | 0.622467 |
vishnuyar/DS-Unit-3-Sprint-2-SQL-and-Databases | refs/heads/master | import sqlite3
#Creating a connection to the rpg database
conn = sqlite3.connect('rpg_db.sqlite3')
#creating a cursor for rpg database connection
curs = conn.cursor()
#Query for number of characters in the game
query = 'SELECT COUNT(name) FROM charactercreator_character;'
#Executing the query
answer = curs.execute(que... | Python | 67 | 42.985073 | 106 | /module1-introduction-to-sql/rpg_queries.py | 0.742702 | 0.732858 |
vishnuyar/DS-Unit-3-Sprint-2-SQL-and-Databases | refs/heads/master | import psycopg2
from sqlalchemy import create_engine
import pandas as pd
#Reading titanic file to upload into pandas
titanic = pd.read_csv('titanic.csv')
#Print the shape of titanic and print the top 5 rows
print(titanic.shape)
print(titanic.head())
#Pring the columns of the titanics dataframe
print(titanic.columns)
... | Python | 28 | 29.035715 | 84 | /module2-sql-for-analysis/insert_titanic.py | 0.725 | 0.721429 |
vishnuyar/DS-Unit-3-Sprint-2-SQL-and-Databases | refs/heads/master | import psycopg2
import sqlite3
dbname = "rgfajssc"
username = "rgfajssc"
pass_word = "U0W4kG-Um-Pug_wj8ec9OnbkQ70deuZR"
host = "john.db.elephantsql.com"
pg_connect = psycopg2.connect(dbname=dbname, user=username,
password=pass_word, host=host)
cur = pg_connect.cursor()
#Query for Survi... | Python | 23 | 23.782608 | 70 | /module2-sql-for-analysis/titanic_query.py | 0.667838 | 0.662566 |
vishnuyar/DS-Unit-3-Sprint-2-SQL-and-Databases | refs/heads/master | import sqlite3
""" Demo Data Query Using Sqlite 3 """
def data_operations(conn,query):
""" Function which performs database operations and returns results """
try:
#creating a cursor for connection
cursor = conn.cursor()
#executing the query on the database and get the results
... | Python | 97 | 31.804123 | 88 | /sprint/demo_data.py | 0.613329 | 0.60547 |
hanhe333/CS186 | refs/heads/master | #!/usr/bin/env python
import sys
from auction import iround
import math
from gsp import GSP
from util import argmax_index
class HHAWbudget:
"""Balanced bidding agent"""
def __init__(self, id, value, budget):
self.id = id
self.value = value
self.budget = budget
self.TOTAL_CLICKS... | Python | 245 | 33.746941 | 126 | /HW3/hw3-code/hhawbudget.py | 0.547035 | 0.530476 |
aramidetosin/NornirJunos | refs/heads/main | import requests
from datetime import datetime
import time
import argparse
import getpass
import json
from rich import print
import logging
import urllib3
from netmiko import ConnectHandler
from eve_up import get_nodes, get_links
from ipaddress import *
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)... | Python | 75 | 35.653332 | 117 | /working/set_ints.py | 0.534207 | 0.487991 |
swiftcore/ReSQL | refs/heads/master | #!/bin/env python
# the graphical interface of resql compiler client
import wx
import wx.grid
from subprocess import *
import sys
# call the client to connect to the server for rewriting the sql statement
def call_clnt(sql):
try:
# under windows
# p1 = Popen(['echo',sql],stdout=PIPE,shell=True)
... | Python | 180 | 32.416668 | 92 | /showcase.py | 0.59335 | 0.579717 |
swiftcore/ReSQL | refs/heads/master | # the rewrite sql compiler server end
import socket
from subprocess import *
HOST = ''
PORT = 9999
BUFSIZE=1024
ADDR = (HOST,PORT)
# call the resql compiler
# pass in the sql statement
# return the rewriting sql result
def rewrite_sql(sql):
print 'In reswrite_sql: ',sql
p1 = Popen(["echo",sql],stdout=PIPE)
... | Python | 127 | 24.338583 | 61 | /server.py | 0.557005 | 0.546132 |
canada-poll-location-analysis/General-Election-Official-Voting-Results-Scraper | refs/heads/master | import logging
import os
import pandas as pd
import wget as wget
from tqdm import tqdm
from sean_logger import setup_logging
from toolbox import make_directory
def scrape_election_results(prov_id=35, base_url=None, results_format=1):
setup_logging()
if results_format == 1:
results_form... | Python | 69 | 33.492752 | 85 | /GeneralElectionOfficialVotingResultsScraper.py | 0.587995 | 0.576562 |
kaosx5s/OratoricalDecaf | refs/heads/master | import datetime
from google.appengine.ext import db
from google.appengine.api import users
'''
DATASTORE CLASSES
'''
class Articles(db.Model):
link = db.LinkProperty()
text = db.StringProperty()
votes = db.IntegerProperty()
posted = db.DateTimeProperty()
owner = db.StringProperty()
class Votes(db.Model):
artic... | Python | 144 | 25.145834 | 117 | /Project/datastore.py | 0.696865 | 0.694474 |
kaosx5s/OratoricalDecaf | refs/heads/master | '''
Author: Robert Cabral
File Name: Post_Module.py
Purpose: To create an Article Post into the database that has the Article Title and Article URL properties
associated with the Article Post.
Date: 2/16/2013
'''
import datastore
import webapp2
import cgi
from google.appengine.api import users
form = """
... | Python | 49 | 29.55102 | 107 | /Project/articles.py | 0.637701 | 0.626337 |
kaosx5s/OratoricalDecaf | refs/heads/master | import cgi
import datetime
import urllib
import webapp2
import datastore
from google.appengine.ext import db
from google.appengine.api import users
class RequestHandler(webapp2.RequestHandler):
def get(self, article_id):
self.response.out.write('<html><body>')
#article_key = self.request.get('artic... | Python | 51 | 29.215687 | 98 | /Project/comment.py | 0.696104 | 0.692857 |
kaosx5s/OratoricalDecaf | refs/heads/master | # This file contains hardcoded strings and values
main_page="article_list.html"
main_title="Oratorical Decaf"
| Python | 4 | 26.75 | 49 | /Project/config.py | 0.792793 | 0.792793 |
kaosx5s/OratoricalDecaf | refs/heads/master | import webapp2
import os
import datastore
import config
import vote
import articles
import comment
import jinja2
from google.appengine.ext import db
from google.appengine.api import users
# jinja2 file loading copied from
# https://github.com/fRuiApps/cpfthw/blob/master/webapp2/views.py
TEMPLATE_DIR = os.path.join(os... | Python | 33 | 27.848484 | 85 | /Project/main.py | 0.717437 | 0.709034 |
moniker-dns/icinga-cookbook | refs/heads/master | #!/usr/bin/env python
from __future__ import print_function
import argparse
import socket
import sys
parser = argparse.ArgumentParser()
parser.add_argument('--socket', help="Socket to connect to", type=str,
default="/var/run/pdns.controlsocket")
parser.add_argument('--timeout', help="Socket timeo... | Python | 36 | 23.333334 | 76 | /files/default/plugins/check_pdns_socket | 0.670857 | 0.660571 |
jeespinozam/bomberman-ai | refs/heads/master | from tensorforce.agents import PPOAgent
from serpent.utilities import SerpentError
import numpy as np
import os
# This file is borrowed from SerpentAIsaacGameAgentPlugin:
# https://github.com/SerpentAI/SerpentAIsaacGameAgentPlugin/blob/master/files/helpers/ppo.py
class SerpentPPO:
def __init__(self, frame_shape... | Python | 106 | 30.716982 | 127 | /plugins/SerpentBombermanGameAgentPlugin/files/helpers/ppo.py | 0.550863 | 0.542534 |
jeespinozam/bomberman-ai | refs/heads/master | # import time
# import os
# import pickle
# import serpent.cv
#
# import numpy as np
# import collections
#
# from datetime import datetime
#
#
# from serpent.frame_transformer import FrameTransformer
# from serpent.frame_grabber import FrameGrabber
# from serpent.game_agent import GameAgent
# from serpen... | Python | 476 | 36.39706 | 134 | /plugins/SerpentBombermanGameAgentPlugin/files/serpent_Bomberman_game_agent.py | 0.57411 | 0.566614 |
jeespinozam/bomberman-ai | refs/heads/master | import json
import sys
import random
import os
import numpy as np
from collections import deque
from keras.models import Sequential
from keras.layers import *
from keras.optimizers import *
class KerasAgent:
def __init__(self, shape, action_size):
self.weight_backup = "bombergirl_weight.model"
... | Python | 88 | 31.772728 | 72 | /plugins/SerpentBombermanGameAgentPlugin/files/helpers/dqn.py | 0.571429 | 0.555479 |
jeespinozam/bomberman-ai | refs/heads/master | from serpent.game import Game
from .api.api import BombermanAPI
from serpent.utilities import Singleton
from serpent.game_launchers.web_browser_game_launcher import WebBrowser
class SerpentBombermanGame(Game, metaclass=Singleton):
def __init__(self, **kwargs):
kwargs["platform"] = "web_browser"
kwargs["wind... | Python | 118 | 22.372881 | 128 | /plugins/SerpentBombermanGamePlugin/files/serpent_Bomberman_game.py | 0.532995 | 0.485497 |
jeespinozam/bomberman-ai | refs/heads/master | #from .memreader import MemoryReader
import time
class Game:
enemies = [] #{x,y}
bombs = [] #{x,y}
bonus = []
girl = {"x": 0, "y": 0}
start_time = 0
time = 0
game_inputs = {
0: "MoveUp",
1: "MoveDown",
2: "MoveLeft",
3: "MoveRight",
4: "LeaveBomb",
... | Python | 96 | 27.041666 | 86 | /plugins/SerpentBombermanGameAgentPlugin/files/helpers/game_status.py | 0.552749 | 0.539376 |
Jannlk/GLO-2000-TP4 | refs/heads/master | import os.path
import re
from hashlib import sha256
from os.path import getsize
#Méthode qui crée un nouveau compte dans le répertoire du serveur
#id : nom du dossier
#mdp : mot de passe
#return : "0" si un problème est survenu avec le fichier, "1" si le compte a été créé
def creerCompte(id, mdp):
state = "1"
... | Python | 119 | 27.537815 | 116 | /TP4_111126561/utilitaires.py | 0.623969 | 0.612485 |
Jannlk/GLO-2000-TP4 | refs/heads/master | import smtplib, re, socket, optparse, sys
import os.path
import pickle
from email.mime.text import MIMEText
import utilitaires
parser = optparse.OptionParser()
parser.add_option("-a", "--address", action="store", dest="address", default="localhost")
parser.add_option("-p", "--port", action="store", dest="port", type=i... | Python | 166 | 35.379517 | 115 | /TP4_111126561/serveur.py | 0.55539 | 0.537341 |
Jannlk/GLO-2000-TP4 | refs/heads/master | import smtplib, re, socket, optparse, sys
import os.path
from email.mime.text import MIMEText
from hashlib import sha256
import getpass
import pickle
parser = optparse.OptionParser()
parser.add_option("-a", "--address", action="store", dest="address", default="localhost")
parser.add_option("-p", "--port", action="stor... | Python | 152 | 36.157894 | 138 | /client.py | 0.542766 | 0.52311 |
junprog/contrastive-baseline | refs/heads/main | from utils.contrastive_trainer import CoTrainer
from utils.simsiam_trainer import SimSiamTrainer
import argparse
import os
import math
import torch
args = None
def parse_args():
parser = argparse.ArgumentParser(description='Train ')
parser.add_argument('--data-dir', default='/mnt/hdd02/process-ucf',
... | Python | 86 | 44.313953 | 85 | /train.py | 0.56736 | 0.552989 |
junprog/contrastive-baseline | refs/heads/main | from typing import Callable, Optional
import random
from PIL import Image
import numpy as np
import torch
import torchvision
from torchvision import transforms
from torchvision.datasets import CIFAR10
np.random.seed(765)
random.seed(765)
class SupervisedPosNegCifar10(torch.utils.data.Dataset):
def __init__(self... | Python | 183 | 45.284153 | 134 | /datasets/cifar10.py | 0.572086 | 0.524029 |
junprog/contrastive-baseline | refs/heads/main | import torch
import torch.nn as nn
import torch.nn.functional as F
class L2ContrastiveLoss(nn.Module):
"""
Contrastive loss
Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise
Args :
output1 & output2 : [N, dim]
target : [... | Python | 24 | 34.583332 | 119 | /models/l2_contrastive_loss.py | 0.595545 | 0.572098 |
junprog/contrastive-baseline | refs/heads/main | # in : original image
# out : cropped img1 (anchor)
# cropped img2 (compete)
# target (positive img1 - img2 : 1, negative img1 - img2 : 0)
import os
from glob import glob
import random
import numpy as np
from PIL import Image
from PIL import ImageFilter
import torch
import torch.utils.data as data
impor... | Python | 162 | 29.660494 | 92 | /datasets/spatial.py | 0.573701 | 0.53826 |
junprog/contrastive-baseline | refs/heads/main | import torch
import torchvision
from PIL import Image
from matplotlib import pyplot as plt
import random
model = torchvision.models.__dict__['vgg19']()
print(model)
img = torch.rand(1,3,256,256)
out = model.features(img)
print(out.size())
import torchvision.transforms as trans
crop = trans.RandomCrop(224)
img = tor... | Python | 99 | 22.828283 | 81 | /exp.py | 0.612807 | 0.577184 |
junprog/contrastive-baseline | refs/heads/main | import os
from collections import OrderedDict
import torch
import torch.nn as nn
import torchvision.models as models
class LinearEvalModel(nn.Module):
def __init__(self, arch='vgg19', dim=512, num_classes=10):
super().__init__()
if arch == 'vgg19':
self.features = models.vgg19().featu... | Python | 52 | 29.961538 | 84 | /models/create_linear_eval_model.py | 0.545963 | 0.528571 |
junprog/contrastive-baseline | refs/heads/main | import torch
import torch.nn as nn
import torch.nn.functional as F
def D(p, z, version='simplified'): # negative cosine similarity
if version == 'original':
z = z.detach() # stop gradient
p = F.normalize(p, dim=1) # l2-normalize
z = F.normalize(z, dim=1) # l2-normalize
return -(... | Python | 33 | 25.848484 | 66 | /models/cosine_contrastive_loss.py | 0.528217 | 0.496614 |
junprog/contrastive-baseline | refs/heads/main | import os
import numpy as np
import torch
def worker_init_fn(worker_id):
np.random.seed(np.random.get_state()[1][0] + worker_id)
class Save_Handle(object):
"""handle the number of """
def __init__(self, max_num):
self.save_list = []
... | Python | 58 | 25.862068 | 88 | /utils/helper.py | 0.552632 | 0.541078 |
junprog/contrastive-baseline | refs/heads/main | import os
import numpy as np
from PIL import Image
import torch
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
### torch テンソル(バッチ)を受け取って、args.div_numに応じて、描画する
mean = np.array([0.485, 0.456, 0.406])
std = np.array([0.229, 0.224, 0.225])
def invnorm(img, N):
img = img[N,:,:,:].to('c... | Python | 162 | 32.092594 | 96 | /utils/visualizer.py | 0.539552 | 0.508955 |
junprog/contrastive-baseline | refs/heads/main | import os
from glob import glob
import numpy as np
import argparse
def parse_args():
parser = argparse.ArgumentParser(description='Test ')
parser.add_argument('--data-dir', default='/mnt/hdd02/shibuya_scramble',
help='original data directory')
args = parser.parse_args()
return ... | Python | 30 | 30.766666 | 91 | /train_val_split.py | 0.581322 | 0.577125 |
junprog/contrastive-baseline | refs/heads/main | import os
import sys
import time
import logging
import numpy as np
import torch
from torch import optim
from torch.optim import lr_scheduler
from torch.utils.data import DataLoader
import torchvision.models as models
import torchvision.datasets as datasets
from models.simple_siamese_net import SiameseNetwork
from mo... | Python | 157 | 41.21656 | 127 | /utils/simsiam_trainer.py | 0.562698 | 0.550626 |
junprog/contrastive-baseline | refs/heads/main | import torch
import torch.nn as nn
class projection_MLP(nn.Module):
def __init__(self, in_dim=512, hidden_dim=512, out_dim=512): # bottleneck structure
super().__init__()
self.layers = nn.Sequential(
nn.Linear(in_dim, hidden_dim),
nn.ReLU(),
nn.Linear(hi... | Python | 85 | 30.047058 | 100 | /models/simple_siamese_net_tmp.py | 0.538258 | 0.498485 |
junprog/contrastive-baseline | refs/heads/main | import os
import sys
import time
import logging
import numpy as np
import torch
from torch import optim
from torch.optim import lr_scheduler
from torch.utils.data import DataLoader
import torchvision.models as models
import torchvision.datasets as datasets
from models.siamese_net import SiameseNetwork
from models.l2... | Python | 155 | 42.625805 | 127 | /utils/contrastive_trainer.py | 0.573732 | 0.561012 |
junprog/contrastive-baseline | refs/heads/main | import os
import argparse
import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim import lr_scheduler
from torch.utils.data import DataLoader
import torchvision.models as models
from datasets.cifar10 import get_simsiam_dataset
f... | Python | 108 | 36.23148 | 125 | /linear_eval.py | 0.591542 | 0.572886 |
junprog/contrastive-baseline | refs/heads/main | import torch
import torch.nn as nn
class SiameseNetwork(nn.Module):
def __init__(self, model, pretrained=False, simple_model=False):
super(SiameseNetwork, self).__init__()
self.simple_model = simple_model
if simple_model:
self.features = nn.Sequential(nn.Conv2d(3, 32, 5), nn.PRe... | Python | 44 | 38.477272 | 104 | /models/siamese_net.py | 0.474654 | 0.440092 |
andrewjschuang/Turing | refs/heads/master | import time
from datetime import datetime
from flask import (Flask, abort, flash, redirect, render_template, request,
session, url_for)
from sqlalchemy.exc import IntegrityError
from wtforms import (Form, RadioField, StringField, SubmitField, TextAreaField, TextField,
validators)... | Python | 290 | 36.889656 | 95 | /turing.py | 0.516017 | 0.510375 |
andrewjschuang/Turing | refs/heads/master | from flask_testing import TestCase
from models.shared import db
from models.model import User, Task, Project, Question, Response, Questionnaire
from turing import create_app
import unittest
class MyTest(TestCase):
def create_app(self):
config = {
'SQLALCHEMY_DATABASE_URI': 'sqlite:///test.db... | Python | 113 | 26.168142 | 79 | /test.py | 0.596091 | 0.588599 |
andrewjschuang/Turing | refs/heads/master | functionalities = {
'Login': 'Login page',
'Feedback': 'This feedback form',
'Todo': 'To do module',
'Projects': 'Anything related to projects',
'Code': 'Code editor',
'Forum': 'The forum',
'Profile': 'Your profile page',
}
| Python | 9 | 27 | 47 | /functionalities.py | 0.59127 | 0.59127 |
aejontargaryen/conceal-bot | refs/heads/master | import requests
import json
import time
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from poolModels import pool, poolBase
engine = create_engine('sqlite:///poolData.db')
# Bind the engine to the metadata of the Base class so that the
# declaratives can be accessed through a DBSessio... | Python | 41 | 52.731709 | 165 | /poolSetup.py | 0.749093 | 0.739564 |
aejontargaryen/conceal-bot | refs/heads/master | import random
import requests
import sys
import discord
import binascii
import json
from collections import deque
from jsonrpc_requests import Server
from models import Transaction, TipJar
config = json.load(open('config.json'))
class CCXServer(Server):
def dumps(self, data):
data['password'] = config['r... | Python | 152 | 34.835526 | 143 | /utils.py | 0.612264 | 0.603084 |
aejontargaryen/conceal-bot | refs/heads/master | import asyncio
import discord
from discord.ext.commands import Bot, Context
import requests
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from poolModels import pool, poolBase
from models import Wallet, TipJar, Base, Transaction
from utils import config, format_hash, gen_paymentid, rpc... | Python | 550 | 44.098183 | 293 | /bot.py | 0.642961 | 0.632277 |
DyanLi/Design-of-Algorithms | refs/heads/master | #coding=utf-8
'''
use re to
caul the num of the words
alice=ALICE
change:
use these function
1,with open(...) as f:
2,content = f.read()
3,allwords = finditer( ... content ... )
finditer is iter, findall is list
4,all_lower_words = imap(str.lower, allwords)
5,count = Counter(all_lower_words)
much butter than buil... | Python | 57 | 24.456141 | 78 | /HW2015/HW1.py | 0.726207 | 0.702759 |
DyanLi/Design-of-Algorithms | refs/heads/master | #coding: utf-8
'''
huarongdao pass puzzle
ver:3.3
a reconstruction version of ver3.0
draw every state like a tree
by Dyan
Dec 2015
'''
from __future__ import division
import cairo
import colorsys
import copy
import collections
class Block(object):
u'''华容道具有10个块,棋盘左上角坐标(1,1),右下角坐标(4,5)'''
def __init__... | Python | 272 | 26.481617 | 124 | /HW2015/HW3-dy.py | 0.486515 | 0.449132 |
DyanLi/Design-of-Algorithms | refs/heads/master | #coding: utf-8
'''
HW2.py is used to solve eight queens puzzle,
you can change the size number to resize the board.
change:
1,draw pieces with special operator not XOR but SOURCE
2,long string can write like """....""
3,format for str have symbol{} so use %d
'''
import itertools,cairo,math
size=8 #the size of the bo... | Python | 88 | 21.636364 | 71 | /HW2015/HW2.py | 0.63253 | 0.599398 |
DyanLi/Design-of-Algorithms | refs/heads/master | #coding: utf-8
'''
huarongdao pass puzzle
ver:1.0
it is a original version
by HF
Dec 2015
'''
from __future__ import division
import cairo
import colorsys
import copy
#define soldiers
#from IPython import embed
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
class block(object):
def __init... | Python | 207 | 25.705315 | 110 | /HW2015/HW3-hf.py | 0.460954 | 0.423174 |
leopesi/pool_budget | refs/heads/master | from .dimensao import Dimensao | Python | 1 | 30 | 30 | /projeto/dimensoes/customclass/estruturas/__init__.py | 0.866667 | 0.866667 |
leopesi/pool_budget | refs/heads/master | # Generated by Django 3.0.3 on 2020-06-11 22:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dimensoes', '0017_auto_20200611_1859'),
]
operations = [
migrations.RenameField(
model_name='clientemodel',
old_name... | Python | 23 | 30.130434 | 220 | /projeto/dimensoes/migrations/0018_auto_20200611_1905.py | 0.596369 | 0.550279 |
leopesi/pool_budget | refs/heads/master | # Generated by Django 3.0.3 on 2020-03-17 17:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dimensoes', '0004_auto_20200317_0933'),
]
operations = [
migrations.AddField(
model_name='dimensaomodel',
name='data... | Python | 18 | 21.388889 | 62 | /projeto/dimensoes/migrations/0005_dimensaomodel_data.py | 0.598015 | 0.521092 |
leopesi/pool_budget | refs/heads/master | # Generated by Django 3.0.3 on 2020-06-03 22:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dimensoes', '0011_auto_20200516_1518'),
]
operations = [
migrations.AlterField(
model_name='clientemodel',
name='tel... | Python | 18 | 21 | 50 | /projeto/dimensoes/migrations/0012_auto_20200603_1916.py | 0.598485 | 0.520202 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.