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 |
|---|---|---|---|---|---|---|---|---|---|
dplusplus/anarchy_golf | refs/heads/master | for i in[501,24,25,77,388,22,0,324,297,376,296]:print format(i,'09b')
| Python | 1 | 69 | 69 | /python/748.Bit_Grid.py | 0.685714 | 0.271429 |
dplusplus/anarchy_golf | refs/heads/master | i=99;s=', %s.\n'
f=lambda i:'%d shinichiro%s of hamaji on the wall'%(i,'es'[:i*2-2])
while i:print f(i)+s%f(i)[:-12]+{1:'Go to the store and buy some more'+s%f(99)}.get(i,'Take one down and pass it around'+s%f(i-1));i-=1
| Python | 3 | 72.666664 | 135 | /python/3.99_shinichiroes_of_hamaji.py | 0.606335 | 0.556561 |
dplusplus/anarchy_golf | refs/heads/master | from itertools import permutations as p
for i in p(raw_input()):print''.join(i)
| Python | 2 | 39 | 39 | /python/7.permutater.py | 0.7375 | 0.7375 |
tanmayuw/ContainerProfiler | refs/heads/main | import argparse
import os
import shutil
import sys
import json
import copy
import configparser
from collections import namedtuple
parser = argparse.ArgumentParser(description='process path and file /or string of metrics.')
parser.add_argument('file_path', action='store', help='stores the filepath to the folder holding... | Python | 108 | 53.074074 | 131 | /Graphing/auto_generated_delta_script.py | 0.729966 | 0.728767 |
tanmayuw/ContainerProfiler | refs/heads/main | import psutil
import json
import argparse
from datetime import datetime
import re
import subprocess
import os.path
from os import path
#add the virtual level.
CORRECTION_MULTIPLIER=100
CORRECTION_MULTIPLIER_MEMORY=(1/1000)
parser = argparse.ArgumentParser(description='process path and file /or string of metrics... | Python | 322 | 32.114906 | 124 | /Profiler_Python/src/rudataall-psutil.py | 0.706869 | 0.694874 |
tanmayuw/ContainerProfiler | refs/heads/main | import argparse
import os
import sys
import json
import copy
#import ConfigParser
import pandas as pd
import time
import csv
import glob
import shutil
import re
#import path
from collections import namedtuple
def read_metrics_file(metrics):
if (len(metrics) == 1): #and path.exists(metrics[0])):
metrics_file= metr... | Python | 97 | 41.340206 | 907 | /Graphing/process_filter.py | 0.541211 | 0.537564 |
tanmayuw/ContainerProfiler | refs/heads/main | #Creates a script based on graph_generation_config.ini to create a delta script to delta certain metrics, and avoids others.
#authors: David Perez and Tanmay Shah
import argparse
import os
import json
import configparser
from collections import namedtuple
generated_script= open("auto_generated_delta_script.py","w")... | Python | 102 | 48.931374 | 167 | /Graphing/delta_json_generation.py | 0.678382 | 0.677008 |
tanmayuw/ContainerProfiler | refs/heads/main | from plotly.subplots import make_subplots
import random
import json
import os, sys
import pandas as pd
import subprocess
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
import argparse
from os import path
import math
graphing_methods=['scatter', 'bar']
FONT_SIZE=26;
MARGIN_SIZE=20
TIC... | Python | 303 | 28.597361 | 184 | /Graphing/plotly_stack_graphs.py | 0.656445 | 0.638715 |
tanmayuw/ContainerProfiler | refs/heads/main | #Authors: David Perez and Tanmay Shah
import json
import os
import pandas as pd
import argparse
#usage: python csv_generation_2.py path_of_folder_with_json sampling_delta metrics(file or space delimited list, if file include --infile, leave blank for all metrics found in the json files.)
def read_metrics_file(metri... | Python | 121 | 38.090908 | 192 | /Graphing/csv_generation_2.py | 0.633904 | 0.631156 |
tanmayuw/ContainerProfiler | refs/heads/main | import argparse
import os
import sys
import json
import copy
import ConfigParser
import pandas as pd
import time
import os
import glob
import pandas as pd
from collections import namedtuple
parser = argparse.ArgumentParser(description='process path and file /or string of metrics.')
parser.add_argument('file_path', ... | Python | 60 | 22.866667 | 92 | /Graphing/process_info_report.py | 0.712195 | 0.710105 |
tanmayuw/ContainerProfiler | refs/heads/main | #author: David Perez
from plotly.subplots import make_subplots
import random
import json
import os, sys
import pandas as pd
import subprocess
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
import argparse
from os import path
import math
import shutil
from os.path import abspath
from s... | Python | 92 | 31.652174 | 184 | /Graphing/graph_all.py | 0.736439 | 0.734443 |
avinash-arjavalingam/262_project | refs/heads/main | from simulator.event_queue import EventQueue
from simulator.resource import *
from simulator.dag import Dag
from simulator.system import System
from workloads.toy.linear_dag import linear_dag_clockwork_data, linear_instance_list, linear_instance_placements
class SimpleSystem(System):
pools: Dict[str, ResourcePool]
... | Python | 86 | 41.290699 | 112 | /workloads/toy/simple_system.py | 0.672717 | 0.661991 |
avinash-arjavalingam/262_project | refs/heads/main | from simulator.dag import Dag, Function
from simulator.resource import ResourceType
from simulator.runtime import ConstantTime
from .constants import *
from random import randint, sample
from bisect import bisect
# linear_first = Function(
# unique_id='linear_first',
# resources= {
# 'STD_CPU' : {
# 'type' : Re... | Python | 322 | 30.667702 | 145 | /workloads/toy/linear_dag.py | 0.654472 | 0.643684 |
davew-msft/MLOps-E2E | refs/heads/master | import json
import numpy
from azureml.core.model import Model
import joblib
def init():
global LGBM_MODEL
# Load the model from file into a global object
model_path = Model.get_model_path(
model_name="driver_model")
LGBM_MODEL = joblib.load(model_path)
def run(raw_data, request... | Python | 44 | 38.93182 | 403 | /Lab12/score.py | 0.610772 | 0.484175 |
davew-msft/MLOps-E2E | refs/heads/master | import argparse
import json
import urllib
import os
import numpy as np
import pandas as pd
import keras
from keras import models
from keras import layers
from keras import optimizers
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.models import Sequent... | Python | 278 | 34.377697 | 132 | /scripts/train.py | 0.622471 | 0.610168 |
StrikerEureka/DLL | refs/heads/master | class Node :
def __init__(self, data) :
self.data = data
self.next = None
self.prev = None
class doublelinkedlist(object) :
def __init__(self) :
self.head = None
self.tail = None
def tambahbelakang(self, data) :
if self.head is None :
new_node = ... | Python | 186 | 31.903225 | 79 | /Double Linked List.py | 0.487908 | 0.484641 |
jDiazPrieto/real_estate_website | refs/heads/master | # A module is basically a file containing a set of functions to include in your application. There are core python modules, modules you can install using the pip package manager (including Django) as well as custom modules
import datetime
import time
import camelcase
import validator
today = datetime.date.today()
pri... | Python | 19 | 27.157894 | 222 | /python_sandbox_starter/modules.py | 0.765918 | 0.765918 |
Mou97/safeSpace | refs/heads/master | import time
import torch
import numpy as np
import matplotlib.pyplot as plt
import torch.optim as optim
import torch.nn as nn
from collections import OrderedDict
from PIL import Image
import seaborn as sns
import numpy as np
import pandas as pd
import json
# %%
import torch.nn as nn
class SentimentRNN(nn.Module):
... | Python | 140 | 28.707144 | 100 | /source/forDeployment/script.py | 0.628606 | 0.620913 |
faraoman/MachineLearning | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Sun May 27 15:06:16 2018
@author: jyoti
"""
import numpy as np
import matplotlib.pyplot as plt
N = 100
D = 2
X = np.random.randn(N, D)
X[:50, :] = X[:50, :] - 2*np.ones((50, D)) #centered at -2
X[50:, :] = X[50:, :] + 2*np.ones((50, D)) #centered at +2
T = np.array([0]*50 + [... | Python | 47 | 19.340425 | 87 | /LogisticRegression/LogisticRegressionWithGradientDescent.py | 0.53822 | 0.474346 |
faraoman/MachineLearning | refs/heads/master |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 9 13:01:51 2018
@author: jyoti
"""
import numpy as np
import matplotlib.pyplot as plt
from util import getData
labels = ['Angry', 'Disgust', 'Fear', 'Happy', 'Sad', 'Surprise', 'Neutral']
def main():
X, Y = getData(balance_ones = False)
while(True):
... | Python | 31 | 21.645161 | 76 | /Projects/FacialExpressionRecognition/show_images.py | 0.482566 | 0.458856 |
faraoman/MachineLearning | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Mon May 28 10:59:55 2018
@author: j.dixit
"""
import numpy as np
import matplotlib.pyplot as plt
N = 100
D = 2
X = np.random.randn(N, D)
X[:50, :] = X[:50, :] - 2*np.ones((50, D)) #centered at -2
X[50:, :] = X[50:, :] + 2*np.ones((50, D)) #centered at +2
T = np.array([0]*50 +... | Python | 54 | 20.314816 | 87 | /LogisticRegression/L2regularisation.py | 0.567708 | 0.511285 |
faraoman/MachineLearning | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Mon May 28 16:22:16 2018
@author: j.dixit
"""
import numpy as np
import matplotlib.pyplot as plt
N = 4
D = 2
X = np.array([
[0, 0],
[0, 1],
[1, 0],
[1, 1]
])
T = np.array([0, 1, 1, 0])
ones = np.array([[1]*N]).T
#plt.scatter(X[:, 0], X... | Python | 64 | 16.109375 | 67 | /LogisticRegression/XOR.py | 0.49589 | 0.444749 |
faraoman/MachineLearning | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Tue May 29 22:07:08 2018
@author: jyoti
"""
import numpy as np #importing the numpy package with alias np
import matplotlib.pyplot as plt #importing the matplotlib.pyplot as plt
N = 50
D = 50
X = (np.random.random((N, D))-0.5)*10
w_... | Python | 60 | 25.6 | 109 | /LinearRegression/L1reg.py | 0.608777 | 0.571787 |
faraoman/MachineLearning | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Sat May 26 19:13:44 2018
@author: jyoti
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
def get_data():
df = pd.read_csv("ecommerce_data.csv")
data = df.as_matrix()
X = data[:, :-1]
Y = data[:, -1]
... | Python | 61 | 19.721312 | 53 | /LogisticRegression/predict_logistic.py | 0.504348 | 0.458498 |
faraoman/MachineLearning | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Sun May 27 13:33:29 2018
@author: jyoti
"""
import numpy as np
import matplotlib.pyplot as plt
N = 100
D = 2
X = np.random.randn(N, D)
X[:50, :] = X[:50, :] - 2*np.ones((50, D)) #centered at -2
X[50:, :] = X[50:, :] + 2*np.ones((50, D)) #centered at +2
T = np.array([0]*50 + [... | Python | 58 | 21.620689 | 87 | /LogisticRegression/CrossEntropyErrorFunction.py | 0.604882 | 0.553013 |
faraoman/MachineLearning | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Sun May 27 15:21:54 2018
@author: jyoti
"""
# -*- coding: utf-8 -*-
"""
Created on Sat May 26 19:13:44 2018
@author: jyoti
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
def get_data():
df = pd.read_csv("ecomm... | Python | 101 | 21.514851 | 95 | /LogisticRegression/EcommerceProject.py | 0.560053 | 0.514298 |
faraoman/MachineLearning | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 10 17:55:24 2018
@author: jyoti
"""
from __future__ import division, print_function
from builtins import range
import numpy as np
import matplotlib.pyplot as plt
class LinearRegression(object):
def __init__(self):
pass
def fit(self, X, Y, eta=10, ep... | Python | 63 | 21.492064 | 85 | /LinearRegression/TemplateCode.py | 0.505563 | 0.488178 |
faraoman/MachineLearning | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Tue May 29 21:54:38 2018
@author: jyoti
"""
from __future__ import print_function, division
from builtins import range
import numpy as np # importing numpy with alias np
import matplotlib.pyplot as plt # importing matplotlib.pyplot with alias plt
No_of_observations = 50
No_of... | Python | 43 | 37.255814 | 149 | /LinearRegression/L1regularisation.py | 0.711679 | 0.681874 |
jananijaan12000/CIP_Batch21 | refs/heads/main | def output_lable(n):
if n == 1:
return "Offensive "
elif n ==0:
return "Not Offensive "
def manual_testing(news):
testing_news = {"text":[news]}
new_def_test = pd.DataFrame(testing_news)
new_def_test["text"] = new_def_test["text"]
new_x_test = new_def_test["text"]
new_xv_test = tfidf_v... | Python | 26 | 20.807692 | 48 | /Chat_App/chat/jjj.py | 0.598662 | 0.586957 |
ddward/ansible | refs/heads/master | from db import insert, exists, select_one, update
from werkzeug.security import check_password_hash, generate_password_hash
import logging
import traceback
def create_user(username,password):
try:
formattedUsername = format_username(username)
hashedPassword = generate_password_hash(password)
... | Python | 62 | 32.854839 | 87 | /user.py | 0.654909 | 0.65205 |
ddward/ansible | refs/heads/master | import re
def sanitize(path):
# escape nasty double-dots
path = re.sub(r'\.\.', '', path)
# then remove any duplicate slashes
path = re.sub(r'(/)\1+', r'\1', path)
# then remove any leading slashes and dots
while(path and (path[0] == '/' or path[0] == '.')):
path = path[1:]
return p... | Python | 11 | 28.454546 | 55 | /sanitize_path.py | 0.560372 | 0.544892 |
ddward/ansible | refs/heads/master | from bs4 import BeautifulSoup
import getpass
import requests
import os
def pTest(attack_string, attack_url, password):
payload = {'password': password}
with requests.Session() as s:
p = s.post(attack_url + 'login', data=payload)
r = requests.Request('GET', attack_url)
prepared = s.prepa... | Python | 58 | 30.017241 | 92 | /penetrationTesting.py | 0.560311 | 0.54975 |
ddward/ansible | refs/heads/master | # build_dir.py
import os
def build_dir(curPath):
directoryDict = {}
with os.scandir(curPath) as directory:
for entry in directory:
#dont include shortcuts and hidden files
if not entry.name.startswith('.'):
#stat dict reference:
#https://docs.pyt... | Python | 16 | 33.875 | 71 | /build_dir.py | 0.540395 | 0.5386 |
ddward/ansible | refs/heads/master | from getpass import getpass
import os
import sqlite3
from werkzeug.security import generate_password_hash
from flask import g
import traceback
import logging
path = os.getcwd()
DATABASE = os.path.join(path, 'ansible.db')
def init_db():
with app.app_context():
db = sqlite3.connect(DATABASE)
with ap... | Python | 86 | 30.023256 | 111 | /db.py | 0.590109 | 0.584489 |
ddward/ansible | refs/heads/master | from cryptography.fernet import Fernet
import datetime
from flask import (flash, Flask, g, Markup, redirect, render_template, request,
send_from_directory, session, url_for)
import functools
import logging
import os
from secrets import token_urlsafe
import sqlite3
import sys
from werkzeug.utils import secure_filena... | Python | 155 | 30.148388 | 150 | /app.py | 0.651625 | 0.649762 |
Lucasgb7/Simulacao_Discreta | refs/heads/main | import numpy as np
from random import randrange, uniform
class Material():
Type = 0
Time = 0
Weight = 0
TimeStamp = 0
def __init__(self, Type):
self.Type = Type
def materialValues(self):
if self.Type == 0: # Material A
self.Weight = 200 ... | Python | 90 | 40.900002 | 100 | /AV1/elevador.py | 0.448011 | 0.430504 |
Lucasgb7/Simulacao_Discreta | refs/heads/main | import numpy as np
from random import randrange
# gera o numero de clientes com base na probabilidade
def numberCustomers(value):
if value > 65:
return 8
elif value > 35 and value < 65:
return 10
elif value > 10 and value < 35:
return 12
else:
return 14
# gera o numero ... | Python | 47 | 28.319149 | 63 | /AV1/padaria.py | 0.616558 | 0.584604 |
Lucasgb7/Simulacao_Discreta | refs/heads/main | import numpy as np
from random import randrange
def draw(value, probability):
return int(np.random.choice(value, 1, replace=False, p=probability))
if __name__ == "__main__":
# Criando os vetores de valores e suas probabilidades
bearingLifeExpect = np.arange(1000, 2000, 100)
probabilityLifeExpect = np... | Python | 101 | 47.58416 | 134 | /AV1/maquina.py | 0.498166 | 0.47289 |
Lucasgb7/Simulacao_Discreta | refs/heads/main | import matplotlib.pyplot as plt
import time
import qi2
# left XOR entre o cara do centro e da direita
def rule(array):
return array[0] ^ (array[1] or array[2])
# primeira linha do mosaico
def init(largura):
array = [0] * largura # inicio do mosaico, no começa inicializa com 1
# se for impar, coloca 1... | Python | 78 | 26.5 | 94 | /RNGs/role30_RNG.py | 0.588619 | 0.565765 |
Lucasgb7/Simulacao_Discreta | refs/heads/main | import qi2
def fbn(option, array, mod, k, j):
if option == 0:
result = (array[j-1] + array[k-1]) % mod
elif option == 1:
result = (array[j-1] - array[k-1]) % mod
elif option == 2:
result = (array[j-1] * array[k-1]) % mod
else:
result = (array[j-1] ^ array[k-1]) % mod
... | Python | 45 | 22.51111 | 55 | /RNGs/fibonacci_RNG.py | 0.550615 | 0.511826 |
Lucasgb7/Simulacao_Discreta | refs/heads/main | import time
import numpy as np
import math
import matplotlib.pyplot as plt
from matplotlib.colors import NoNorm
import qi2
def squares(ctr, key):
y = x = ctr * key
z = y + key
two5 = np.uint64(32)
x = x * x + y; x = (x >> two5) | (x << two5)
x = x * x + z; x = (x >> two5) | (x << two5)
x = x *... | Python | 83 | 25.771084 | 99 | /Fast Counter-Based RNG/counterBasedRNG.py | 0.515083 | 0.484466 |
Lucasgb7/Simulacao_Discreta | refs/heads/main | import time
import numpy as np
import qi2
def xorShift(y):
y ^= np.uint32(y << 13)
y ^= np.uint32(y >> 17)
y ^= np.uint32(y << 15)
return y
if __name__ == "__main__":
np.seterr(all='ignore')
seed = 2463534242
y = np.uint32(seed)
#a, b, c = 13, 17, 15
#iteracoes = 1000
n = np.... | Python | 40 | 25.924999 | 59 | /RNGs/xorShift_RNG.py | 0.519517 | 0.464684 |
Lucasgb7/Simulacao_Discreta | refs/heads/main | import numpy as np
import time
import qi2
def wichmann(x, y, z):
x = 171 * (x % 177) - 2 * (x / 177)
y = 172 * (y % 177) - 35 * (y / 176)
z = 170 * (z % 178) - 63 * (z / 178)
if x < 0:
x = x + 30269
elif y < 0:
y = y + 30307
elif z < 0:
z + z + 30323
result = x/30... | Python | 51 | 23.058823 | 59 | /RNGs/wichmann_RNG.py | 0.477161 | 0.402121 |
Lucasgb7/Simulacao_Discreta | refs/heads/main | import time
# John von Neumann's Generator
def JVN(x):
x = x ** 2
x = x / 100
x = x % 10000
return int(x)
# Linear Congruential Generator
def LCG(x):
return (a * x + c) % m
if __name__ == "__main__":
# seed = 322
simulationTime = 20
# x = int(input("Valor inicial [X0]: "))
x = 3
... | Python | 34 | 21.264706 | 52 | /RNGs/jvn_RNG.py | 0.478318 | 0.448095 |
MatheusLealAquino/meuCanal | refs/heads/master | from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.shortcuts import render, redirect, get_object_or_404
from conteudo.models import Video, Categoria
def exibir_catalogo(request):
categorias = Categoria.objects.all()
return render(request, 'conteudo/catalogo_videos.html', {'ca... | Python | 38 | 34.052631 | 106 | /conteudo/views.py | 0.708709 | 0.701952 |
MatheusLealAquino/meuCanal | refs/heads/master | from django.urls import path
from conteudo import views
app_name = 'conteudo'
urlpatterns = [
path('', views.exibir_catalogo, name='catalogo'),
path('cadastro_video/', views.cadastro_video, name='cadastro_video'),
path('editar_video/<int:id>/', views.editar_video, name='editar_video'),
path('<int:id>/... | Python | 14 | 36.642857 | 79 | /conteudo/urls.py | 0.690114 | 0.690114 |
MatheusLealAquino/meuCanal | refs/heads/master | from django import forms
from conteudo.models import Video, Categoria
class VideoForm(forms.ModelForm):
error_messages = {
'campo invalido' : "Campo inválido"
}
class Meta:
model = Video
fields = ('video_id','categoria', 'nome', 'url', 'capa', 'visualizacao', 'nota', 'sinopse')
... | Python | 29 | 31.068966 | 100 | /conteudo/forms.py | 0.629431 | 0.626208 |
MatheusLealAquino/meuCanal | refs/heads/master | from django.db import models
class Categoria(models.Model):
nome = models.CharField(max_length=255, db_index=True)
slug = models.SlugField(max_length=200)
class Meta:
ordering = ('nome',)
verbose_name = 'categoria'
verbose_name_plural = 'categorias'
def __str__(self):
... | Python | 33 | 31.272728 | 83 | /conteudo/models.py | 0.650376 | 0.632519 |
MatheusLealAquino/meuCanal | refs/heads/master | from django.shortcuts import render
def pagina_inicial(request):
return render(request, 'index.html') | Python | 4 | 25.75 | 40 | /projeto/views.py | 0.773585 | 0.773585 |
MatheusLealAquino/meuCanal | refs/heads/master | from django.urls import path
from login import views
app_name = 'login'
urlpatterns = [
path('', views.pagina_login, name='pagina_login'),
] | Python | 8 | 17.375 | 54 | /login/urls.py | 0.69863 | 0.69863 |
MatheusLealAquino/meuCanal | refs/heads/master | from django.shortcuts import render
def pagina_login(request):
return render(request, 'login/pagina_login.html')
| Python | 4 | 28.5 | 53 | /login/views.py | 0.771186 | 0.771186 |
maryumraza/Walmart-Sales-Predictor | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 19:57:28 2020
@author: uni tech
"""
import pandas as pd
import numpy as np
from sklearn import preprocessing
from sklearn.metrics import r2_score
from sklearn.impute import SimpleImputer
from sklearn.model_selection import train_test_split
from sklearn.... | Python | 103 | 24.009708 | 183 | /walmart_sales.py | 0.671736 | 0.656899 |
lakerrenhu/reinforcement-learning-project | refs/heads/main | # valueIterationAgents.py
# -----------------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to ht... | Python | 203 | 36.172413 | 95 | /valueIterationAgents.py | 0.549828 | 0.542274 |
lakerrenhu/reinforcement-learning-project | refs/heads/main | # analysis.py
# -----------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
# ... | Python | 90 | 36.955555 | 83 | /analysis.py | 0.70082 | 0.678279 |
lakerrenhu/reinforcement-learning-project | refs/heads/main | # qlearningAgents.py
# ------------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.be... | Python | 276 | 32.405796 | 93 | /qlearningAgents.py | 0.572994 | 0.56692 |
kanak3699/Visualizing-a-Decision-Tree | refs/heads/master |
# coding: utf-8
# In[1]:
from sklearn.datasets import load_iris
# In[2]:
iris = load_iris()
# In[4]:
print(iris.feature_names)
# In[5]:
print(iris.target_names)
# In[7]:
print(iris.data[0])
# In[8]:
print(iris.target[0])
# In[13]:
for i in range(len(iris.target)):
print("Example %d: labe... | Python | 168 | 7.910714 | 82 | /Visualizing a Decision Tree.py | 0.57038 | 0.533022 |
TishkoffLab/TF_Binding_scores | refs/heads/master | import sys
from pandas import *
import numpy as np
import matplotlib
from matplotlib import pyplot
import random
from scipy.stats import norm
import os
from argparse import ArgumentParser
import pybedtools
import pdb
import math
import time
parser = ArgumentParser()
# parser.add_argument("-i", "--input_genes", dest="i... | Python | 212 | 40.745281 | 207 | /generate_backgroundH_forTFs.py | 0.598533 | 0.589955 |
TishkoffLab/TF_Binding_scores | refs/heads/master | import sys
from pandas import *
import numpy as np
import matplotlib
from matplotlib import pyplot
import random
from scipy.stats import norm
import os
from argparse import ArgumentParser
import pybedtools
import pdb
import math
import time
parser = ArgumentParser()
parser.add_argument("-i", "--input_genes", dest="inp... | Python | 510 | 52.752941 | 324 | /get_PWMscores.py | 0.603121 | 0.598381 |
NQ31/scrapy_project | refs/heads/master | import scrapy
from qiubaipro.items import QiubaiproItem
class Test2Spider(scrapy.Spider):
name = 'test2'
# allowed_domains = ['https://www.qiushibaike.com/']
start_urls = ['https://www.qiushibaike.com/']
def parse(self, response):
li_list = response.xpath('//*[@id="content"]/div/div[2]/div/ul/... | Python | 24 | 32.125 | 75 | /qiubaipro/qiubaipro/spiders/test2.py | 0.496863 | 0.49059 |
NQ31/scrapy_project | refs/heads/master | import scrapy
from mzitu.items import MzituItem
class MziSpider(scrapy.Spider):
name = 'mzi'
# allowed_domains = ['www.xxx.com']
start_urls = ['https://www.mzitu.com/']
#第几页
def parse(self, response):
page_num=response.xpath('/html/body/div[2]/div[1]/div[3]/div/a[4]/text()').extract_first()... | Python | 51 | 40.450981 | 137 | /mzitu/mzitu/spiders/mzi.py | 0.55881 | 0.546528 |
NQ31/scrapy_project | refs/heads/master | import scrapy
from pian.items import PianItem
class BizhiSpider(scrapy.Spider):
name = 'bizhi'
# allowed_domains = ['www.xxx.com']
start_urls = ['http://www.netbian.com/meinv/']
def parse(self,response):
page_num=response.xpath('//*[@id="main"]/div[4]/a[8]/text()').extract_first()
#获取各... | Python | 37 | 35.567566 | 94 | /pian/pian/spiders/bizhi.py | 0.553585 | 0.548411 |
NQ31/scrapy_project | refs/heads/master | # Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single interface
from itemadapter import ItemAdapter
#导入相应的模块
from scrapy.pipelines.images import I... | Python | 50 | 29.76 | 66 | /pian/pian/pipelines.py | 0.657775 | 0.657124 |
NQ31/scrapy_project | refs/heads/master | # Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single interface
from itemadapter import ItemAdapter
from scrapy.pipelines.images import ImagesPipe... | Python | 39 | 31.641026 | 105 | /mzitu/mzitu/pipelines.py | 0.658019 | 0.657233 |
tagplay/django-uuid-pk | refs/heads/master | import os
SITE_ID = 1
STATIC_URL = '/static/'
SECRET_KEY =';pkj;lkj;lkjh;lkj;oi'
db = os.environ.get('DBENGINE', None)
if db == 'pg':
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django_uuid_pk',
'HOST': '127.0.0.1',
... | Python | 59 | 26.288136 | 99 | /django_uuid_pk/tests/settings.py | 0.452174 | 0.434161 |
tagplay/django-uuid-pk | refs/heads/master | import os
import sys
from django.conf import settings
def pytest_configure(config):
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_uuid_pk.tests.settings'
def runtests(args=None):
import pytest
if not args:
args = []
if not any(a for a in args[1:] if no... | Python | 25 | 17.84 | 78 | /conftest.py | 0.63482 | 0.632696 |
tagplay/django-uuid-pk | refs/heads/master | # from __future__ import absolute_import
# from .tests import *
# from .models import *
| Python | 3 | 28.333334 | 40 | /django_uuid_pk/tests/__init__.py | 0.693182 | 0.693182 |
tagplay/django-uuid-pk | refs/heads/master | import uuid
from django.db import models
from django_uuid_pk.fields import UUIDField
class ModelUUIDField(models.Model):
uuid1 = UUIDField(version=1, auto=True)
uuid3 = UUIDField(namespace=uuid.NAMESPACE_URL, version=3, auto=True)
uuid4 = UUIDField(version=4, auto=True)
uuid5 = UUIDField(namespace=uui... | Python | 37 | 27.81081 | 73 | /django_uuid_pk/tests/models.py | 0.743902 | 0.732645 |
tagplay/django-uuid-pk | refs/heads/master | import json
import uuid
from django.core.serializers import serialize
from django.db import IntegrityError
from django.test import TestCase
import pytest
from django_uuid_pk.fields import StringUUID
from django_uuid_pk.tests.models import (AutoUUIDFieldModel, ManualUUIDFieldModel, NamespaceUUIDFieldModel,
... | Python | 111 | 33.855854 | 107 | /django_uuid_pk/tests/tests.py | 0.669682 | 0.632205 |
paolapilar/juegos | refs/heads/master |
import pygame
import base
class Apple( base.Entity ) :
def __init__( self, i, j, cellSize, canvasWidth, canvasHeight ) :
super( Apple, self ).__init__( i, j, 1, 1, cellSize, canvasWidth, canvasHeight )
self._color = ( 255, 255, 0 )
self._alive = True
def draw( self, canvas ) :
... | Python | 18 | 29.444445 | 88 | /collectables.py | 0.510949 | 0.487226 |
paolapilar/juegos | refs/heads/master |
import pygame
import base
from collections import deque
class SnakePart( base.Entity ) :
def __init__( self, i, j, color, cellSize, canvasWidth, canvasHeight ) :
super( SnakePart, self ).__init__( i, j, 1, 1, cellSize, canvasWidth, canvasHeight )
self.color = color
self.lasti = i
... | Python | 124 | 33.620968 | 100 | /snake.py | 0.496855 | 0.484743 |
paolapilar/juegos | refs/heads/master |
import pygame
import world
class Text( object ) :
def __init__( self, x, y, message, size, color ) :
super( Text, self).__init__()
self._message = message
self._textFont = pygame.font.Font( None, size )
self._textSurface = self._textFont.render( message, True, color )
sel... | Python | 86 | 26.744186 | 84 | /screen.py | 0.55658 | 0.522632 |
paolapilar/juegos | refs/heads/master |
import math
import random
import pygame
from base import Entity
from snake import Snake
from collectables import Apple
class Obstacle( Entity ) :
def __init__( self, i, j, di, dj, cellSize, canvasWidth, canvasHeight ) :
super( Obstacle, self ).__init__( i, j, di, dj, cellSize, canvasWidth, canvasHeight ... | Python | 266 | 33.759399 | 130 | /world.py | 0.465607 | 0.450032 |
paolapilar/juegos | refs/heads/master |
import pygame
import random
import time
from snake import Snake
from collectables import Apple
import screen
class Game :
def __init__( self ) :
pygame.init()
self._canvasWidth = 800
self._canvasHeight = 600
self._canvas = pygame.display.set_mode( ( self._canvasWidth, self._canv... | Python | 97 | 35.257732 | 99 | /main.py | 0.493603 | 0.490759 |
paolapilar/juegos | refs/heads/master |
import math
def grid2screen( i, j, cellSize, canvasWidth, canvasHeight ) :
x = ( i + 0.5 ) * cellSize
y = canvasHeight - ( j + 0.5 ) * cellSize
return x, y
def screen2grid( x, y, cellSize, canvasWidth, canvasHeight ) :
i = math.floor( x / cellSize - 0.5 )
j = math.floor( ( canvasHeight - y ) / ce... | Python | 11 | 30.818182 | 62 | /utils.py | 0.6 | 0.571429 |
paolapilar/juegos | refs/heads/master |
import math
import utils
class Entity( object ) :
def __init__( self, i, j, di, dj, cellSize, canvasWidth, canvasHeight ) :
super( Entity, self ).__init__()
self.i = i
self.j = j
self._cellSize = cellSize
self._canvasWidth = canvasWidth
self._canvasHeight = canva... | Python | 60 | 30.200001 | 121 | /base.py | 0.453526 | 0.433226 |
JoanJaraBosch/web-personal-django | refs/heads/master | # Generated by Django 2.2.4 on 2019-08-22 20:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portafolio', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='project',
name='createdDate',
... | Python | 38 | 29.394737 | 90 | /webpersonal/portafolio/migrations/0002_auto_20190822_2247.py | 0.568831 | 0.549784 |
JoanJaraBosch/web-personal-django | refs/heads/master | from django.db import models
# Create your models here.
class Project(models.Model):
title = models.CharField(max_length=200, verbose_name = 'Títol')
moreinfo = models.URLField(null=True, blank=True,verbose_name = 'Mes Informació')
description = models.TextField(verbose_name = 'Desccripció')
image = mo... | Python | 18 | 40.555557 | 91 | /webpersonal/portafolio/models.py | 0.690763 | 0.686747 |
JoanJaraBosch/web-personal-django | refs/heads/master | # Generated by Django 2.2.4 on 2019-08-22 20:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portafolio', '0004_auto_20190822_2251'),
]
operations = [
migrations.AlterField(
model_name='project',
name='descrip... | Python | 23 | 24.913044 | 82 | /webpersonal/portafolio/migrations/0005_auto_20190822_2252.py | 0.587248 | 0.530201 |
JoanJaraBosch/web-personal-django | refs/heads/master | # Generated by Django 2.2.4 on 2019-08-22 20:50
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('portafolio', '0002_auto_20190822_2247'),
]
operations = [
migrations.AddField(
model_name='project'... | Python | 20 | 24.299999 | 101 | /webpersonal/portafolio/migrations/0003_project_moreinfo.py | 0.626482 | 0.565217 |
JoanJaraBosch/web-personal-django | refs/heads/master | # Generated by Django 2.2.4 on 2019-08-22 20:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portafolio', '0003_project_moreinfo'),
]
operations = [
migrations.AlterField(
model_name='project',
name='descripti... | Python | 18 | 22.444445 | 79 | /webpersonal/portafolio/migrations/0004_auto_20190822_2251.py | 0.609005 | 0.556872 |
birkin/ezb_dbprx | refs/heads/master | # -*- coding: utf-8 -*-
import datetime, json, os
import flask
from ezb_dbprx.config import settings
from ezb_dbprx.utils import logger_setup, db_handler
from flask.ext.basicauth import BasicAuth # http://flask-basicauth.readthedocs.org/en/latest/
## setup
app = flask.Flask(__name__)
log = logger_setup.setup_logger... | Python | 141 | 35.716312 | 152 | /proxy_app.py | 0.630481 | 0.624879 |
birkin/ezb_dbprx | refs/heads/master | # -*- coding: utf-8 -*-
""" Handles db connection and executes sql. """
import datetime, json, os, pprint, random, sys
import MySQLdb
from ezb_dbprx.config import settings
class DB_Handler(object):
def __init__(self, file_logger ):
""" Sets up basics. """
self.db_host = settings.DB_HOST
... | Python | 174 | 45.155174 | 167 | /utils/db_handler.py | 0.588147 | 0.585408 |
birkin/ezb_dbprx | refs/heads/master | # -*- coding: utf-8 -*-
""" Handles log setup. """
import logging, os
import logging.handlers
from ezb_dbprx.config import settings
def setup_logger():
""" Returns a logger to write to a file. """
filename = u'%s/ezb_dbprx.log' % settings.LOG_DIR
formatter = logging.Formatter( u'[%(asctime)s] %(levelnam... | Python | 20 | 35.75 | 106 | /utils/logger_setup.py | 0.680272 | 0.665306 |
birkin/ezb_dbprx | refs/heads/master | # -*- coding: utf-8 -*-
import json, os
## db access
DB_HOST = unicode( os.environ.get(u'ezb_dbprx__DB_HOST') )
DB_PORT = int( unicode(os.environ.get(u'ezb_dbprx__DB_PORT')) )
DB_USERNAME = unicode( os.environ.get( u'ezb_dbprx__DB_USERNAME') )
DB_PASSWORD = unicode( os.environ.get(u'ezb_dbprx__DB_PASSWORD') )
DB_NAM... | Python | 31 | 44.161289 | 166 | /config/settings.py | 0.711429 | 0.710714 |
byambaa1982/combine_tables | refs/heads/master | import pandas as pd
import numpy as np
# ------- Read CSV data ----------
# stop=pd.read_csv('Arkiv/stops.txt')
stop_times=pd.read_csv('Arkiv/stop_times.txt')
# calendar=pd.read_csv('Arkiv/calendar.txt')
calendar_dates=pd.read_csv('Arkiv/calendar_dates.txt')
trips=pd.read_csv('Arkiv/trips.txt')
# ----------Conditi... | Python | 75 | 29.719999 | 114 | /main.py | 0.631076 | 0.615017 |
byambaa1982/combine_tables | refs/heads/master | import pandas as pd
import numpy as np
stop=pd.read_csv('Arkiv/stops.txt')
stop_times=pd.read_csv('Arkiv/stop_times.txt')
calendar=pd.read_csv('Arkiv/calendar.txt')
calendar_dates=pd.read_csv('Arkiv/calendar_dates.txt')
trips=pd.read_csv('Arkiv/trips.txt')
print(stop.shape)
print(stop_times.shape)
print(calendar.shap... | Python | 27 | 24.407408 | 98 | /test.py | 0.741606 | 0.713869 |
darshanime/scrapy-tutorials | refs/heads/master | from scrapy import Item, Field
class CardekhoItem(Item):
title = Field()
price = Field()
distance = Field() | Python | 6 | 19.166666 | 30 | /cardekho/cardekho/items.py | 0.658333 | 0.658333 |
darshanime/scrapy-tutorials | refs/heads/master | from housing.items import HousingItemBuy
from scrapy import Spider
from scrapy.http.request import Request
#To parse the JSON received
import json
class HousingSpider(Spider):
name = "housing"
allowed_domains = ["housing.com"]
custom_settings = {'USER_AGENT' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10... | Python | 66 | 49.89394 | 204 | /housing/housing/spiders/housing_spider.py | 0.587254 | 0.566409 |
darshanime/scrapy-tutorials | refs/heads/master | from scrapy import Item, Field
class HousingItemBuy(Item):
ad_id = Field()
ad_title = Field()
ad_price = Field()
ad_area = Field()
ad_url = Field()
ad_date_added = Field()
ad_coordinates = Field()
ad_bedrooms = Field()
ad_toilets = Field()
ad_gas_pipeline = Field()
ad_lift =... | Python | 23 | 26.086956 | 59 | /housing/housing/items.py | 0.559486 | 0.559486 |
darshanime/scrapy-tutorials | refs/heads/master | from cardekho.items import CardekhoItem
from scrapy import Spider
from scrapy.http.request import Request
class CardekhoSpider(Spider):
name = "cardekho"
allowed_domains = ["http://www.cardekho.com"]
start_urls = ["http://www.cardekho.com/used-cars+in+mumbai-all/"]
#This is to not get redirected b... | Python | 24 | 50.958332 | 162 | /cardekho/cardekho/spiders/cardekho_spider.py | 0.62199 | 0.58427 |
darshanime/scrapy-tutorials | refs/heads/master | from scrapy.spiders import BaseSpider
from scrapy101.items import Scrapy101Item
class Scrapy101Spider(BaseSpider):
name = "dmoz"
allowed_domains = ["dmoz.org/"]
start_urls = ["http://www.dmoz.org/"]
def parse(self, response):
for div in response.xpath('/html/body/div[3]/div[3]/div[1]/div')... | Python | 14 | 35.214287 | 73 | /scrapy 101/scrapy101/spiders/dmoz.py | 0.592885 | 0.563241 |
darshanime/scrapy-tutorials | refs/heads/master | from scrapy import Item, Field
class Scrapy101Item(Item):
title = Field() | Python | 4 | 18.25 | 30 | /scrapy 101/scrapy101/items.py | 0.75 | 0.710526 |
prakashpatil1430/Fashionproject | refs/heads/main | # Generated by Django 3.2.6 on 2021-09-25 07:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fashion', '0002_cart_orderplaced_product'),
]
operations = [
migrations.AlterField(
model_name='product',
name='cate... | Python | 18 | 25.444445 | 131 | /fashion/migrations/0003_alter_product_category.py | 0.573529 | 0.531513 |
prakashpatil1430/Fashionproject | refs/heads/main |
from django.urls import path
# from.views import address,add_to_cart,mobile,checkout,orders,ProductView,ProductDetailView,CustomerRegistrationView,ProfileView,show_cart,laptop,fashion_top,fashion_bottom,gym_product,home_decor,plus_cart,minus_cart,remove_cart,payment_done,orders
from django.conf import settings
from dj... | Python | 38 | 64.263161 | 249 | /fashion/urls.py | 0.744458 | 0.744458 |
prakashpatil1430/Fashionproject | refs/heads/main | from django.shortcuts import render
from django.views import View
from .models import Product, Customer, Cart, OrderPlaced
from django.shortcuts import render, redirect, HttpResponse
from .forms import CustomerRegistrationForm, CustomerProfileForm
from django.contrib import messages
from django.db.models import Q
# Cr... | Python | 243 | 37.271606 | 152 | /fashion/views.py | 0.635269 | 0.625484 |
001001matheus001001/Minecraft-python | refs/heads/master | # Conectar ao Minecraft
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
# String para variaveis de 3D
x = input("localização desejada para x ")
y = input("localização desejada para y ")
z = input("localização desejada para z ")
# Mudar a posição do jogador
mc.player.setPos(x, y, z)
print("Fim de locom... | Python | 15 | 21.6 | 41 | /teleportpreciso.py | 0.715976 | 0.713018 |
001001matheus001001/Minecraft-python | refs/heads/master | # Conectar ao Minecraft
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
# String para variaveis de 3D
bloco = input("Numero do bloco desejado:")
x = input("localização desejada para: x ")
y = input("localização desejada para: y ")
z = input("localização desejada para: z ")
mc.setBlock(x, y, z, bloco)
... | Python | 15 | 23.866667 | 51 | /CriaBlocos.py | 0.712366 | 0.706989 |
JiriPapousek/facebook-analysis | refs/heads/master | from os import listdir
import matplotlib.pyplot as plt
import pylab
import operator
import numpy as np
import sys
import calendar
def clear_data(first_tag, last_lag, text):
"""
This function returns string between first_tag and last_tag in text. It also
returns changed text so that it will not include thi... | Python | 466 | 31.633047 | 86 | /analysis.py | 0.5461 | 0.52499 |
sdotson/udacity-machine-learning-nanodegree | refs/heads/master | # third party imports
import argparse
import json
# local imports
from model import predict, load_checkpoint
from utils import determine_device
from validation import validate_predict_args
# CLI defaults
TOP_K_DEFAULT = 1
# configure argument parser
parser = argparse.ArgumentParser(description="Trains model and save... | Python | 42 | 30.095238 | 85 | /classifying-flowers/predict.py | 0.751149 | 0.750383 |
sdotson/udacity-machine-learning-nanodegree | refs/heads/master | from os import path
import torch
from torchvision import models
# validates train.py args
def validate_train_args(args):
# check cuda
if args.gpu and torch.cuda.is_available() == False:
# we don't want to throw sand in the user's face
# but let them know we are falling back to CPU
print... | Python | 44 | 36.06818 | 83 | /classifying-flowers/validation.py | 0.667075 | 0.667075 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.