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 |
|---|---|---|---|---|---|---|---|---|---|
rafunchik/shrimps | refs/heads/master | # coding=utf-8
from __future__ import print_function
import codecs
import os
import re
from gensim import corpora, matutils
from abstract import Abstract
import numpy
__author__ = 'rcastro'
from gensim.models import LdaModel, LsiModel, HdpModel
# model = Word2Vec.load_word2vec_format("/Users/rcastro/nltk_data/word2v... | Python | 310 | 33.645161 | 131 | /docs.py | 0.648138 | 0.635475 |
rafunchik/shrimps | refs/heads/master | # coding=utf-8
import os
import re
import numpy as np
from abstract import Abstract
__author__ = 'rcastro'
from gensim.models import Doc2Vec
from gensim.models.doc2vec import TaggedLineDocument, TaggedDocument
from codecs import open
def remove_numeric_tokens(string):
return re.sub(r'\d+[^\w|-]+', ' ', string)
... | Python | 175 | 36.965714 | 166 | /doc2vec.py | 0.671433 | 0.651565 |
gabilew/Joint-Forecasting-and-Interpolation-of-GS | refs/heads/master | import torch
import torch.nn as nn
import numpy as np
from torch.autograd import Variable
import scipy
from sklearn.metrics.pairwise import rbf_kernel
def complement(S,N):
V = set(np.arange(0,N,1))
return np.array(list(V-set(S)))
class Reconstruction(nn.Module):
def __init__(self,V, sample, freqs, dom... | Python | 256 | 29.402344 | 133 | /pytorch_gsp/utils/gsp.py | 0.561866 | 0.555313 |
gabilew/Joint-Forecasting-and-Interpolation-of-GS | refs/heads/master | import math
import sys
import time
import numpy as np
import pandas as pd
from sklearn.metrics.pairwise import rbf_kernel
def USA_data(directory ):
""""TODO: include the GSOD dataset"""
signals = pd.read_csv( directory + 'Usa_temp.csv')
if "Unnamed: 0" in signals.columns:
signals.drop(columns="... | Python | 52 | 35.01923 | 111 | /data/Load_data.py | 0.657797 | 0.61735 |
gabilew/Joint-Forecasting-and-Interpolation-of-GS | refs/heads/master | import os
import time
import torch
import argparse
import numpy as np
import pandas as pd
import time
from data.Load_data import Seattle_data
from data.Dataloader import *
from pytorch_gsp.train.train_rnn import Evaluate, Train
from pytorch_gsp.utils.gsp import ( greedy_e_opt, spectral_components)
from pytorch_gsp.... | Python | 135 | 40.148148 | 165 | /main/seattle_train_sggru_semisupervised.py | 0.645068 | 0.633009 |
gabilew/Joint-Forecasting-and-Interpolation-of-GS | refs/heads/master |
import time
import numpy as np
import pandas as pd
import torch
import torch.utils.data as utils
from pytorch_gsp.utils.gsp import complement
def PrepareSequence(data, seq_len = 10, pred_len = 1):
time_len = data.shape[0]
sequences, labels = [], []
for i in range(time_len - seq_len - pred_len)... | Python | 154 | 38.006493 | 137 | /data/Dataloader.py | 0.607593 | 0.600298 |
gabilew/Joint-Forecasting-and-Interpolation-of-GS | refs/heads/master | import os
import sys
current_dir = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
sys.path.append(os.path.join(current_dir, 'data'))
print(sys.path) | Python | 6 | 26.5 | 75 | /main/__init.py | 0.72561 | 0.719512 |
gabilew/Joint-Forecasting-and-Interpolation-of-GS | refs/heads/master | from setuptools import setup, find_packages
setup(
name='Joint-Forecasting-and-Interpolation-of-Graph-Signals-Using-Deep-Learning',
version='0.1.0',
author='Gabriela Lewenfus',
author_email='gabriela.lewenfus@gmail.com',
packages=find_packages(),
install_requires = ['scipy>=1.4.1', 'pandas>=0.15', '... | Python | 12 | 35.666668 | 110 | /setup.py | 0.703872 | 0.669704 |
gabilew/Joint-Forecasting-and-Interpolation-of-GS | refs/heads/master | ### training code ####
import sys
import time
import numpy as np
import torch
from torch.autograd import Variable
toolbar_width=20
def Train(model, train_dataloader, valid_dataloader, learning_rate = 1e-5, epochs = 300, patience = 10,
verbose=1, gpu = True, sample = None, optimizer = 'rmsprop'):
if optimize... | Python | 194 | 30.597939 | 125 | /pytorch_gsp/train/train_rnn.py | 0.539077 | 0.526187 |
gabilew/Joint-Forecasting-and-Interpolation-of-GS | refs/heads/master | import torch.utils.data as utils
import torch.nn.functional as F
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn.parameter import Parameter
import numpy as np
import pandas as pd
import time
from pytorch_gsp.utils.gsp import (spectral_components, Reconstruction)
class SpectralGrap... | Python | 242 | 34.884296 | 117 | /pytorch_gsp/models/sggru.py | 0.568747 | 0.553086 |
sciaso/greenpass-covid19-qrcode-decoder | refs/heads/master | from pyzbar.pyzbar import decode
from PIL import Image
from base45 import b45decode
from zlib import decompress
from flynn import decoder as flynn_decoder
from lib.datamapper import DataMapper as data_mapper
class GreenPassDecoder(object):
stream_data = None
def __init__(self, stream_data):
self.stre... | Python | 21 | 32.761906 | 88 | /lib/greenpass.py | 0.693935 | 0.679831 |
sciaso/greenpass-covid19-qrcode-decoder | refs/heads/master | import json
from urllib.request import urlopen
class DataMapperError(Exception):
pass
class DataMapper:
qr_data = None
schema = None
json = ''
new_json = {}
def _save_json(self, data, schema, level=0):
for key, value in data.items():
try:
de... | Python | 61 | 34.229507 | 117 | /lib/datamapper.py | 0.470451 | 0.467194 |
sciaso/greenpass-covid19-qrcode-decoder | refs/heads/master | from flask import Flask, redirect, request, render_template
from os.path import splitext
from flask_sslify import SSLify
from flask_babel import Babel, gettext
import os
from lib.greenpass import GreenPassDecoder as greenpass_decoder
is_prod = os.environ.get('PRODUCTION', None)
ga_id = os.environ.get('GA_ID', None)
sh... | Python | 72 | 33.569443 | 129 | /app.py | 0.6459 | 0.635852 |
kaustavbhattacharjee/labeling | refs/heads/main | # This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
from utils import Tweet
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}... | Python | 23 | 34.217392 | 94 | /main.py | 0.714815 | 0.712346 |
kaustavbhattacharjee/labeling | refs/heads/main | import pandas as pd
import csv
import os
from pandas import ExcelWriter
class Tweet:
def import_data(self, PATH, type):
if type == "xlsx":
xl = pd.ExcelFile(PATH)
data = xl.parse("Sheet1")
if type == "csv":
data = pd.read_csv(PATH)
# if type == "csv":
... | Python | 110 | 28.799999 | 105 | /utils.py | 0.494968 | 0.491613 |
dspearot/Embrittling-Estimator | refs/heads/main | # ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
# This code is a supplement for the journal article titled:
# "Spectrum of Embrittling Potencies and Relation to Properties of
# Symmetric-Tilt Grain Bounda... | Python | 167 | 36.946106 | 127 | /Scripts/Population.py | 0.61147 | 0.6004 |
dspearot/Embrittling-Estimator | refs/heads/main | # ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
# This code is a supplement for the journal article titled:
# "Spectrum of Embrittling Potencies and Relation to Properties of
# Symmetric-Tilt Grain Bounda... | Python | 197 | 38.568527 | 131 | /Scripts/Samples.py | 0.60801 | 0.602503 |
codingconnor112/Max | refs/heads/main | import copy
import pickle
import random
import sys
print(" Max testing intellegence")
print("a simple AI simulation")
print("made with python version "+sys.version)
file = open(r"test.info", mode = "rb")
try:
testdict = pickle.load(file)
except EOFError:
pass
file.close()
global agentnum
agentnum = int(input("a... | Python | 73 | 27.589041 | 100 | /MAX.py | 0.563967 | 0.552947 |
codingconnor112/Max | refs/heads/main | import pickle, random
t = open("test.info", "wb")
t.truncate(0)
dic = {}
for x in range(0, 10):
randomnum = random.randint(0, 100)
print(randomnum)
dic[randomnum] = bool(input("1/0 big "))
pickle.dump(dic, t)
t.close()
| Python | 10 | 21.5 | 42 | /rantest.py | 0.648889 | 0.604444 |
ClaartjeBarkhof/ZoekenSturenBewegen | refs/heads/master | from __future__ import print_function
from copy import deepcopy
import sys
## Helper functions
# Translate a position in chess notation to x,y-coordinates
# Example: c3 corresponds to (2,5)
def to_coordinate(notation):
x = ord(notation[0]) - ord('a')
y = 8 - int(notation[1])
return (x, y)
# Translate a... | Python | 718 | 35.536213 | 100 | /chessgame_herstel.py | 0.498285 | 0.480482 |
ClaartjeBarkhof/ZoekenSturenBewegen | refs/heads/master | Rook, King, Pawn, Queen, Horse = ['r', 'k', 'p', 'q', 'h']
if material == Material.Queen:
moves = self.queen_move(turn, location)
if moves != []:
total_moves.extend(moves)
if material == Material.Horse:
moves = self.horse_move(turn, location)
if move != []:
total_moves.extend(moves)
de... | Python | 125 | 35.119999 | 68 | /test.py | 0.442623 | 0.402082 |
ClaartjeBarkhof/ZoekenSturenBewegen | refs/heads/master | #!python2
from __future__ import division, print_function
from umi_parameters import UMI_parameters
from umi_common import *
import math
import numpy as np
from visual import *
# Specifications of UMI
# Enter the correct details in the corresponding file (umi_parameters.py).
# <<<<<<<<<<-------------------------------... | Python | 231 | 39.935066 | 121 | /week2/umi_student_functions.py | 0.650344 | 0.638075 |
ClaartjeBarkhof/ZoekenSturenBewegen | refs/heads/master | #!python2
from __future__ import division, print_function
################################
# ZSB - Opdracht 2 #
# umi_parameters.py #
# 16/06/2017 #
# #
# Anna Stalknecht - 10792872 #
# Claartje Barkhof - 11035129 #
# Group C #
# ... | Python | 56 | 35.125 | 126 | /week2/umi_parameters.py | 0.522986 | 0.475037 |
ClaartjeBarkhof/ZoekenSturenBewegen | refs/heads/master | # ZSB - Opdracht 2 #
# errorreport.py #
# 16/06/2017 #
# #
# Anna Stalknecht - 10792872 #
# Claartje Barkhof - 11035129 #
# Group C #
# #
################################
'''
error report
We st... | Python | 39 | 47.384617 | 103 | /week2/Errorreport.py | 0.71474 | 0.697243 |
LalithBabu18/python-beautifulsoup | refs/heads/master | import json
import pymongo
from bs4 import BeautifulSoup
client = pymongo.MongoClient("mongodb+srv://localhost")
db = client.test
col = db["resumes"]
documents = col.find({},no_cursor_timeout=True) # if limit not necessary then discard limit
print(type(documents))
new_col = db["resultResumes"]
for i in documents:
d... | Python | 100 | 34.900002 | 92 | /test.py | 0.537883 | 0.537326 |
KartikTalwar/playground | refs/heads/master | import subprocess
def shell(command, stdout=True):
if stdout:
return subprocess.check_output(command, shell=True)
return subprocess.check_call(command, shell=True)
print shell('ls')
| Python | 8 | 23 | 55 | /python/shell.py | 0.755208 | 0.755208 |
KartikTalwar/playground | refs/heads/master | def stringPermutations(string):
rez = []
if len(string) < 2:
rez.append(string)
else:
for position in range(len(string)):
perms = string[:position] + string[position+1:]
for i in stringPermutations(perms):
rez.append(string[position:position+1] + i)
... | Python | 14 | 28.5 | 76 | /random/StringPermutations.py | 0.57385 | 0.566586 |
KartikTalwar/playground | refs/heads/master | def mapper(function, *params):
rez = []
for args in zip(*params):
rez.append(function(*args))
return rez
print mapper(abs, [-3, 5, -1, 42, 23])
print mapper(pow, [1, 2, 3], [2, 3, 4, 5]) | Python | 8 | 23.125 | 42 | /python/ArbitraryMapper.py | 0.604167 | 0.53125 |
KartikTalwar/playground | refs/heads/master | def powerset(array):
ps = [[]]
for i in array:
ps += [x + [array[i]] for x in ps]
return ps
print powerset([0, 1, 2, 3])
| Python | 7 | 19.285715 | 42 | /computation/powerset.py | 0.5 | 0.471831 |
KartikTalwar/playground | refs/heads/master | import functools
def my_check(func):
@functools.wraps(func)
def decorated_view(*args, **kwargs):
if 1 != 2:
return 'failure'
return func(*args, **kwargs)
return decorated_view
if __namae__ == '__main__':
@my_check
def hello():
return 'success'
| Python | 18 | 14.444445 | 38 | /python/decorator.py | 0.604317 | 0.597122 |
KartikTalwar/playground | refs/heads/master | def stringCombinations(string, right = ''):
if not string:
print right
return
stringCombinations(string[1:], string[0] + right)
stringCombinations(string[1:], right)
stringCombinations('abcd')
| Python | 9 | 21.444445 | 50 | /random/StringCombinations.py | 0.732673 | 0.717822 |
KartikTalwar/playground | refs/heads/master | def qsort(list):
return [] if list==[] else qsort([x for x in list[1:] if x < list[0]]) + [list[0]] + qsort([x for x in list[1:] if x >= list[0]])
| Python | 2 | 74.5 | 133 | /random/QuickSort.py | 0.549669 | 0.516556 |
KartikTalwar/playground | refs/heads/master | newlist = sorted(arr, key=lambda k: k['keyName'])
import operator
newlist = sorted(arr, key=operator.itemgetter('keyName'))
| Python | 4 | 30.25 | 57 | /python/Sort Dictionary by Value.py | 0.736 | 0.736 |
KartikTalwar/playground | refs/heads/master | array = ['duck', 'duck', 'goose']
print max(set(array), key=array.count)
| Python | 2 | 35.5 | 38 | /python/Find Most Common Item From List.py | 0.643836 | 0.643836 |
KartikTalwar/playground | refs/heads/master | def multiply(x, y):
if x.bit_length() <= 1536 or y.bit_length() <= 1536:
return x * y;
else:
n = max(x.bit_length(), y.bit_length())
half = (n + 32) / 64 * 32
mask = (1 << half) - 1
xlow = x & mask
ylow = y & mask
xhigh = x >> half
yhigh = ... | Python | 18 | 27.777779 | 56 | /random/KaratsubaMultiplication.py | 0.433269 | 0.402321 |
KartikTalwar/playground | refs/heads/master | class DictObject(dict):
def __getattr__(self, k):
return self[k]
def __setattr__(self, k, v):
return self[k]
obj = DictObject({'key' : 'value'})
print obj.key
| Python | 11 | 15.272727 | 35 | /python/DictionaryToObject.py | 0.581006 | 0.581006 |
KartikTalwar/playground | refs/heads/master | '''
Facebook Hacker Cup 2012 Qualification Round
Alphabet Soup
Alfredo Spaghetti really likes soup, especially when it contains alphabet pasta. Every day he constructs
a sentence from letters, places the letters into a bowl of broth and enjoys delicious alphabet soup.
Today, after constructing the sentence, Alfredo r... | Python | 37 | 47.62162 | 142 | /random/contests/Facebook HackerCup/FBHackerCupAlphabetSoup.py | 0.737632 | 0.70706 |
KartikTalwar/playground | refs/heads/master | """
# Speaking in Tongues
## Problem
We have come up with the best possible language here at Google, called Googlerese. To translate text into
Googlerese, we take any message and replace each English letter with another English letter. This mapping
is one-to-one and onto, which means that the same input letter alwa... | Python | 67 | 38.104477 | 124 | /random/contests/Google CodeJam/Speaking in Tongues.py | 0.746662 | 0.727966 |
KartikTalwar/playground | refs/heads/master | def genPrimes(n):
n, correction = n - n%6 + 6, 2 - (n % 6 > 1)
sieve = [True] * (n/3)
for i in xrange(1, int(n**0.5) / 3 + 1):
if sieve[i]:
k = 3*i+1|1
sieve[k*k/3 ::2*k] = [False] * ((n/6 - k*k/6-1) / k+1)
sieve[k*(k-2*(i&1) + 4)/3 :: 2*k] = [False] * ((n/6 - k*(... | Python | 12 | 36.083332 | 93 | /random/generatePrimes.py | 0.439189 | 0.34009 |
KartikTalwar/playground | refs/heads/master | def fibonacci(n):
if n == 0:
return (0, 1)
else:
a, b = fibonacci(n/2)
c = a*(2*b - a)
d = b*b + a*a
return (c, d) if n%2 == 0 else (d, c+d)
print fibonacci(100000)[0] | Python | 10 | 21.5 | 47 | /computation/FastFibonnaci.py | 0.415179 | 0.352679 |
KartikTalwar/playground | refs/heads/master | print [x % 3/2 * 'Fizz' + x % 5/4 * 'Buzz' or x + 1 for x in range(100)]
| Python | 1 | 72 | 72 | /random/FizzBuzz.py | 0.506849 | 0.39726 |
KartikTalwar/playground | refs/heads/master | # Run this script and enter 3 numbers separated by space
# example input '5 5 5'
a,b,c=map(int,raw_input().split())
for i in range(b+c+1):print(' '*(c-i)+((' /|'[(i>c)+(i>0)]+'_'*4)*(a+1))[:-4]+('|'*(b+c-i))[:b]+'/')[:5*a+c+1]
| Python | 4 | 55.75 | 110 | /random/printCubes.py | 0.524229 | 0.475771 |
KartikTalwar/playground | refs/heads/master | def lengthOfNumber(n):
from math import log10, floor
return int(floor(log10(n)+1))
print lengthOfNumber(12321) # should give 2
| Python | 5 | 26.4 | 44 | /random/LengthOfNumber.py | 0.715328 | 0.635036 |
KartikTalwar/playground | refs/heads/master | def eratosthenes_sieve(n):
candidates = list(range(n+1))
fin = int(n**0.5)
for i in xrange(2, fin+1):
if candidates[i]:
candidates[2*i::i] = [None] * (n//i - 1)
return [i for i in candidates[2:] if i] | Python | 9 | 25.777779 | 52 | /random/EratosthenesSieve.py | 0.533333 | 0.5 |
KartikTalwar/playground | refs/heads/master | def isPrime(n):
import re
return re.match(r'^1?$|^(11+?)\1+$', '1' * n) == None
| Python | 3 | 28.333334 | 57 | /random/IsPrime.py | 0.488636 | 0.431818 |
KartikTalwar/playground | refs/heads/master | """
Beautiful Strings
When John was a little kid he didn't have much to do. There was no internet, no Facebook,
and no programs to hack on. So he did the only thing he could... he evaluated the beauty
of strings in a quest to discover the most beautiful string in the world.
Given a string s, little Johnny defined th... | Python | 61 | 36.590164 | 153 | /random/contests/Facebook HackerCup/BeautifulStrings.py | 0.651264 | 0.617698 |
takeiteasyguy/classes-and-oop | refs/heads/master | NO_STUDENTS = "There is no students for this teacher"
class Person(object):
def __init__(self, name):
self.name = name
def __str__(self):
return "My name is %s" % self.name
class Student(Person):
def __init__(self, name, group):
super(Student, self).__init__(name)
self.g... | Python | 57 | 28.526316 | 94 | /main.py | 0.601307 | 0.59893 |
ralphprogrammeert/Datastructure | refs/heads/master | #int
hoeveelKopjesSuiker = 2
#bool
IsDezePersoonMijnMatch = false
IsDezePersoonMijnMatch = true
#string
spreekwoord = "De kat op het spek binden"
| Python | 9 | 15.444445 | 41 | /The Big Three/BigThree.py | 0.785235 | 0.778524 |
ralphprogrammeert/Datastructure | refs/heads/master | #long ** is speciaal karakter betekend eigenlijk 2 tot de 123
MijnBankRekeningNummer = 2**123
#char
char VoorletterNaam = 'r' | Python | 5 | 25 | 61 | /The Expendables/The Expendables.py | 0.751938 | 0.689922 |
ralphprogrammeert/Datastructure | refs/heads/master | #python heeft alleen float
ditIsEenfloat = 0.2422
#decimal
hoeveelKidsHebJe = decimal('1.31') | Python | 5 | 18 | 34 | /Double Trouble/Double Trouble.py | 0.776596 | 0.691489 |
AntLouiz/DatapathWay | refs/heads/master | # Intruçoes que o programa reconhece
FUNCTIONS = {
'101011': 'sw',
'100011': 'lw',
'100000': 'add',
'100010': 'sub',
'100101': 'or',
'100100': 'and'
}
| Python | 9 | 18.444445 | 36 | /li.py | 0.514286 | 0.308571 |
AntLouiz/DatapathWay | refs/heads/master | def to_integer(binary_number):
if not isinstance(binary_number, str):
raise Exception()
return int(binary_number, 2)
def to_binary(number):
if not isinstance(number, int):
raise Exception()
return "{:0b}".format(number)
def extend_to_bits(binary_number, bits = 32):
if not isins... | Python | 55 | 20.799999 | 50 | /utils.py | 0.601002 | 0.588481 |
AntLouiz/DatapathWay | refs/heads/master | from utils import (
extend_to_bits,
to_binary,
to_integer,
to_binaryC2,
to_decimalC2
)
class ALU:
def makeSum(self, a, b):
result = to_decimalC2(a) + to_decimalC2(b)
if result > (2**31 -1) or result < -(2**31):
print("{}OVERFLOW OCURRENCE{}".format("-" * 20, "-... | Python | 58 | 17.827587 | 69 | /logic.py | 0.498168 | 0.467949 |
AntLouiz/DatapathWay | refs/heads/master | from memory import RegistersBank, Memory
from logic import ALU
from instructions import PC
from control import (
ControlSw,
ControlLw,
ControlAdd,
ControlSub,
ControlAnd,
ControlOr,
)
class CPU:
def __init__(self):
self.alu = ALU()
self.pc = PC()
self.registers = Re... | Python | 33 | 23.666666 | 58 | /core.py | 0.570025 | 0.570025 |
AntLouiz/DatapathWay | refs/heads/master | import abc
from utils import to_integer, to_decimalC2
class BaseControl(abc.ABC):
def __init__(self, cpu):
self.cpu = cpu
@abc.abstractmethod
def execute(self):
pass
class ControlAdd(BaseControl):
def execute(self):
instruction = self.cpu.pc.next_instruction
regist... | Python | 225 | 34.373333 | 98 | /control.py | 0.563513 | 0.541777 |
AntLouiz/DatapathWay | refs/heads/master | from li import FUNCTIONS
from utils import extend_to_bits
class MipsInstruction:
op = None
rs = None
rt = None
rd = None
shamt = None
func = None
offset = None
instruction_type = None
instruction = None
def __init__(self, instruction):
if not (isinstance(instruction, st... | Python | 108 | 24.824074 | 72 | /instructions.py | 0.550018 | 0.532449 |
AntLouiz/DatapathWay | refs/heads/master | import random
from utils import to_binary, extend_to_bits, to_binaryC2
class BaseMemory:
def __init__(self):
self.data = {}
def set_value(self, address, value):
"""
Set a value with a given address
"""
self.data[address] = value
return True
def get_valu... | Python | 79 | 22.632912 | 72 | /memory.py | 0.494111 | 0.48394 |
AntLouiz/DatapathWay | refs/heads/master | from core import CPU
if __name__ == "__main__":
cpu = CPU()
cpu.execute()
| Python | 6 | 13 | 26 | /main.py | 0.511905 | 0.511905 |
alex2060/job1 | refs/heads/main | import requests
r = requests.get('http://127.0.0.1:8080/number?number=1')
#print(r.status_code)
#print(r.text)
if "One" in r.text:
print("Passed Test")
else:
print("Failed Test")
if "Ok" in r.text:
print("Passed Test")
else:
print("Failed Test")
r = requests.get('http://127.0.0.1:8080/number?number=8... | Python | 72 | 18.569445 | 84 | /pyspark/django_form_other_project/mysite/tests.py | 0.645138 | 0.572747 |
alex2060/job1 | refs/heads/main |
#https://www.vocabulary.cl/Basic/Numbers.html
###
"""
This is basic program for converting a string value of number into upto 999,999,999 into english
The program works baised on the number english convertion in the websight https://www.vocabulary.cl/Basic/Numbers.html
it is not object based as in my opinion sim... | Python | 202 | 20.282179 | 132 | /pyspark/django_form_other_project/mysite/number_to_english.py | 0.671306 | 0.651821 |
alex2060/job1 | refs/heads/main | from django.shortcuts import render
from django.http import HttpResponse
import time
from django.core.files import File
# Create your views here.
import lets_convert
from django.shortcuts import render
import mysql_test
def traider(req):
f = open("to_be_frontend_check_make_traid.html", "r")
output= f.r... | Python | 222 | 22.013514 | 138 | /pyspark/django_form_other_project/mysite/numb/views.py | 0.584375 | 0.563867 |
alex2060/job1 | refs/heads/main | from django.urls import path
from . import views
urlpatterns = [
path('traider', views.traider,name='traider'),
path('add_traid', views.add_traid,name='add_traid'),
path('compleat_traid', views.compleat_traid,name='compleat_traid'),
path('get_user_info', views.print_convertion,name='get_user_info'),
... | Python | 15 | 32.200001 | 71 | /pyspark/django_form_other_project/mysite/numb/url.py | 0.691383 | 0.691383 |
zhuliyi10/python_demo | refs/heads/master | from mymodule import sayhello,__version__
sayhello()
print('version:',__version__)
| Python | 4 | 20 | 41 | /models/mymodule_demo.py | 0.714286 | 0.714286 |
zhuliyi10/python_demo | refs/heads/master | def func(a, b=5, c=10):
print('a=', a, ' b=', b, ' c=', c)
func(2, 7)
func(2, c=23)
func(c=23,a=9)
| Python | 7 | 14 | 38 | /function/function_key.py | 0.447619 | 0.342857 |
zhuliyi10/python_demo | refs/heads/master | number = 23
while True:
guess = int(input('请输入一个整数:'))
if guess == number:
print('恭喜,你猜对了。')
break
elif guess < number:
print('你猜小了')
else:
print('你猜大了')
print('end')
| Python | 13 | 15.692307 | 34 | /if.py | 0.509174 | 0.5 |
zhuliyi10/python_demo | refs/heads/master | age = 20
name = 'zhuly'
print('{0} was {1} years old'.format(name, age))
| Python | 3 | 23.333334 | 48 | /base.py | 0.616438 | 0.561644 |
zhuliyi10/python_demo | refs/heads/master |
def reverse(text):
return text[::-1]
def is_palindrome(text):
return text == reverse(text)
something=input('输入文本:')
if is_palindrome(something):
print("是的,这是回文")
else:
print("这不是回文")
| Python | 14 | 13.571428 | 32 | /input_output/user_input.py | 0.639024 | 0.634146 |
zhuliyi10/python_demo | refs/heads/master | def sayHello():
print('hello world,hello python!')
sayHello() | Python | 4 | 15.75 | 38 | /function/function.py | 0.681818 | 0.681818 |
zhuliyi10/python_demo | refs/heads/master | def total(a=5,*numbers,**phonebook):
print('a',a)
#通过元组遍历全部的参数
for item in numbers:
print('num_item',item)
#通过字典遍历全部的参数
for first,second in phonebook.items():
print(first,second)
total(10,1,2,3,Name='zhuly',age=26)
| Python | 12 | 20.5 | 43 | /function/total.py | 0.608527 | 0.577519 |
zhuliyi10/python_demo | refs/heads/master | import pickle
# 我们将要存储对象的文件名
shoplistfile = 'shoplist.data'
# 购物清单
shoplist = ['苹果', '芒果', '胡萝卜']
# 定到文件
f = open(shoplistfile, 'wb')
pickle.dump(shoplist, f)
f.close()
del shoplist # 释放shoplist变量
# 从仓库读回
f = open(shoplistfile, 'rb')
storedlist = pickle.load(f)
f.close()
print(storedlist)
| Python | 21 | 13.142858 | 30 | /input_output/pickling.py | 0.686869 | 0.686869 |
zhuliyi10/python_demo | refs/heads/master | import sys
print('命令行参数是:')
for i in sys.argv:
print(i)
print("python path is in ",sys.path) | Python | 6 | 15.333333 | 36 | /models/using_sys.py | 0.670103 | 0.670103 |
zhuliyi10/python_demo | refs/heads/master |
def sayhello():
print('hello wolrd,hello python!')
__version__='0.1'
| Python | 4 | 17.5 | 38 | /models/mymodule.py | 0.613333 | 0.586667 |
zhuliyi10/python_demo | refs/heads/master | poem = '''\
当工作完成时
编程是有趣的
如果想让你的工作有趣
使用Python!
'''
f = open('poem.txt', 'w')
f.write(poem)
f.close()
f = open('poem.txt', 'r')
while(True):
line = f.readline()
if len(line) == 0:
break
print(line, end='')
f.close()
| Python | 19 | 11.736842 | 25 | /input_output/using_file.py | 0.541322 | 0.53719 |
akkheyy/Python-Challenge | refs/heads/master | import os
import csv
csvpath = os.path.join('election_data.csv')
#Variables
votes = 0
candidate_list = []
candidate_count = []
candidate_percent = []
with open("election_data.csv", "r") as in_file:
csv_reader = csv.reader(in_file)
header = next(csv_reader)
for row in csv_reader:
#Adds total n... | Python | 66 | 37.166668 | 168 | /PyPoll/main.py | 0.598416 | 0.594059 |
JPisaBrony/FFProcServer | refs/heads/master | from flask import Flask, request, jsonify
from subprocess import Popen, PIPE
import uuid
import os
import json
app = Flask("ffserver", static_url_path='')
processing = False
@app.route("/")
def root():
return app.send_static_file("index.html")
@app.route("/ffmpeg", methods=['POST'])
def ffmpeg():
global proc... | Python | 39 | 25.794872 | 70 | /ffserver.py | 0.607656 | 0.600957 |
postincredible/ukbb | refs/heads/master |
import os
import pandas as pd
import numpy as np
pth=os.getcwd()
spliter=pth.split('/')[-1]
rel_var_path=pth.split(spliter)[0]+'disease/'
rel_var_path
def load_data_by_fid(fid):
df_tab1_i0_comp=pd.read_csv('/temp_project/ukbb/data/i0/ukb22598_i0_comp.csv')
if int(fid) in df_tab1_i0_comp.fid.values.tolist()... | Python | 432 | 35.495369 | 239 | /ukbb.py | 0.582547 | 0.574758 |
postincredible/ukbb | refs/heads/master | import os
import pandas as pd
import numpy as np
def load_data_by_fid(fid):
'''
return a dataframe that has the eid and the 'fid' variable
'''
df_tab1_i0_comp=pd.read_csv('/temp_project/ukbb/data/i0/ukb22598_i0_comp.csv')
if int(fid) in df_tab1_i0_comp.fid.values.tolist():
fid_num=fid
... | Python | 46 | 36.97826 | 134 | /ukbb_ldbf.py | 0.602175 | 0.583286 |
moddevices/mod-devel-cli | refs/heads/master | import click
import crayons
from modcli import context, auth, __version__, bundle
_sso_disclaimer = '''SSO login requires you have a valid account in MOD Forum (https://forum.moddevices.com).
If your browser has an active session the credentials will be used for this login. Confirm?'''
@click.group(context_settings... | Python | 196 | 35.591835 | 118 | /modcli/cli.py | 0.659649 | 0.656581 |
moddevices/mod-devel-cli | refs/heads/master | from modcli import config
__version__ = '1.1.3'
context = config.read_context()
| Python | 5 | 15.4 | 31 | /modcli/__init__.py | 0.682927 | 0.646341 |
moddevices/mod-devel-cli | refs/heads/master | import re
import sys
from setuptools import setup
with open('modcli/__init__.py', 'r') as fh:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fh.read(), re.MULTILINE).group(1)
if sys.version_info[0] < 3:
raise Exception("Must be using Python 3")
setup(
name='mod-devel-cli',
python_req... | Python | 41 | 23.512196 | 100 | /setup.py | 0.549254 | 0.534328 |
moddevices/mod-devel-cli | refs/heads/master | import os
CONFIG_DIR = os.path.expanduser('~/.config/modcli')
URLS = {
'labs': ('https://api-labs.moddevices.com/v2', 'https://pipeline-labs.moddevices.com/bundle/'),
'dev': ('https://api-dev.moddevices.com/v2', 'https://pipeline-dev.moddevices.com/bundle/'),
}
DEFAULT_ENV = 'labs'
| Python | 8 | 35.5 | 99 | /modcli/settings.py | 0.664384 | 0.657534 |
moddevices/mod-devel-cli | refs/heads/master | import base64
import json
import os
import stat
import re
from modcli import settings
from modcli.utils import read_json_file
def read_context():
context = CliContext.read(settings.CONFIG_DIR)
if len(context.environments) == 0:
for env_name, urls in settings.URLS.items():
context.add_env... | Python | 158 | 31.493671 | 100 | /modcli/config.py | 0.589794 | 0.587067 |
moddevices/mod-devel-cli | refs/heads/master | import socket
import webbrowser
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib import parse
import click
import requests
from click import Abort
from modcli import __version__
def login(username: str, password: str, api_url: str):
result = requests.post('{0}/users/tokens'.format(api_url)... | Python | 93 | 31.258064 | 103 | /modcli/auth.py | 0.618 | 0.607667 |
moddevices/mod-devel-cli | refs/heads/master | import os
import shutil
import subprocess
import tempfile
from hashlib import md5
import click
import crayons
import requests
from modcli import context
from modcli.utils import read_json_file
def publish(project_file: str, packages_path: str, keep_environment: bool=False, bundles: list=None,
show_resul... | Python | 114 | 43.175438 | 119 | /modcli/bundle.py | 0.636616 | 0.628276 |
moddevices/mod-devel-cli | refs/heads/master | import json
import os
def read_json_file(path: str):
if not os.path.isfile(path):
return {}
with open(path, 'r') as file:
contents = file.read()
return json.loads(contents)
| Python | 10 | 19.299999 | 33 | /modcli/utils.py | 0.615764 | 0.615764 |
sholong/utils_script | refs/heads/master | # -*- coding:utf-8 -*-
from redis import Redis
# Redis列表的边界下标
LEFTMOST = 0
RIGHTMOST = -1
class RedisListSecondPack:
def __init__(self, name, client=Redis()):
self.name = name
self.client = client
def left_append(self, content):
# 从列表最左边追加value
return self.client.lpush(self... | Python | 51 | 26.235294 | 81 | /redis_list_operate.py | 0.636755 | 0.624551 |
Maheerr2707/C-111HW | refs/heads/main | import plotly.figure_factory as ff
import pandas as pd
import csv
import statistics
import random
import plotly.graph_objects as go
df = pd.read_csv("StudentsPerformance.csv")
data = df["mathscore"].tolist()
""" fig = ff.create_distplot([data], ["Math Scores"], show_hist=False)
fig.show() """
P_mean = sta... | Python | 75 | 37.546665 | 125 | /mean.py | 0.677006 | 0.649022 |
yokel72/bof | refs/heads/master | #!/usr/bin/env python
# Windows x86 reverse shell stack buffer overflow
# Saved Return Pointer overwrite exploit.
# Parameters are saved in params.py for persistence.
# Delete params.py and params.pyc to reset them; or simply edit params.py
#
# Written by y0k3L
# Credit to Justin Steven and his 'dostackbufferoverflowg... | Python | 72 | 30.513889 | 172 | /7_reverse_shell.py | 0.669458 | 0.662847 |
yokel72/bof | refs/heads/master | #!/usr/bin/env python
# Used to test bad characters as part of the process in developing a
# Windows x86 reverse shell stack buffer overflow
# Saved Return Pointer overwrite exploit.
# Parameters are saved in params.py for persistence.
# Delete params.py and params.pyc to reset them; or simply edit params.py
#
# Writt... | Python | 80 | 36.400002 | 125 | /4_test_badchars.py | 0.671123 | 0.658088 |
yokel72/bof | refs/heads/master | #!/usr/bin/env python
import socket, argparse
parser = argparse.ArgumentParser()
parser.add_argument("RHOST", help="Remote host IP")
parser.add_argument("RPORT", help="Remote host port", type=int)
parser.add_argument("-l", help="Max buffer length in bytes; default 1024", type=int, default=1024, dest='buf_len')
args ... | Python | 29 | 23.482759 | 114 | /1_trigger_bug.py | 0.673239 | 0.660563 |
yokel72/bof | refs/heads/master | # Functions supporting a Windows x86 reverse shell stack buffer overflow
# Saved Return Pointer overwrite exploit.
# Parameters are saved in params.py for persistence.
# Delete params.py and params.pyc to reset them; or simply edit params.py
#
# Written by y0k3L
# Credit to Justin Steven and his 'dostackbufferoverflowg... | Python | 159 | 28.27673 | 106 | /functions.py | 0.602363 | 0.593126 |
yokel72/bof | refs/heads/master | #!/usr/bin/env python
# Generates and sends a unique pattern to a service as part of the process in
# developing a Windows x86 reverse shell stack buffer overflow
# Saved Return Pointer overwrite exploit.
# Parameters are saved in params.py for persistence.
# Delete params.py and params.pyc to reset them; or simply ed... | Python | 38 | 35.342106 | 114 | /2_discover_offset.py | 0.727009 | 0.723389 |
yokel72/bof | refs/heads/master | #!/usr/bin/env python
# Uses a software interrupt to test the jmp esp functionality as part of the
# process in developing a Windows x86 reverse shell stack buffer overflow
# Saved Return Pointer overwrite exploit.
# Parameters are saved in params.py for persistence.
# Delete params.py and params.pyc to reset them; or... | Python | 36 | 33.027779 | 131 | /5_jmp_esp_interrupt.py | 0.713469 | 0.709388 |
yokel72/bof | refs/heads/master | #!/usr/bin/env python
import socket, argparse, time
parser = argparse.ArgumentParser()
parser.add_argument("RHOST", help="Remote host IP")
parser.add_argument("RPORT", help="Remote host port", type=int)
parser.add_argument("-l", help="Max number of bytes to send; default 1000", type=int, default=1000, dest='max_num_b... | Python | 31 | 27.193548 | 121 | /fuzzer.py | 0.614416 | 0.585812 |
yokel72/bof | refs/heads/master | #!/usr/bin/env python
# Used to confirm that the suspected offset is indeed correct. This is part of
# the process in developing a Windows x86 reverse shell stack buffer overflow
# Saved Return Pointer overwrite exploit.
# Parameters are saved in params.py for persistence.
# Delete params.py and params.pyc to reset th... | Python | 40 | 33.775002 | 97 | /3_confirm_offset.py | 0.692308 | 0.67793 |
qfolkner/RDL-Robot-Code | refs/heads/master | from __future__ import division
import time
import pygame
from adafruit_servokit import ServoKit
pygame.init()
pwm = ServoKit(channels=16)
leftstick = 0.07
rightstick = 0.07
liftUP = 0.00
liftDOWN = 0.00
print('Initialized')
gamepad = pygame.joystick.Joystick(0)
gamepad.init()
while True:
pygame.event.ge... | Python | 58 | 19.241379 | 49 | /servoGOOD.py | 0.602728 | 0.56266 |
FazilovDev/GraduateWork | refs/heads/main | from Algorithms.Winnowing import get_fingerprints, get_text_from_file
from tkinter import *
from tkinter import filedialog as fd
import locale
k = 15
q = 259#259
w = 4
class PlagiarismDetect(Frame):
def __init__(self, parent):
Frame.__init__(self, parent, background="white")
self.parent = parent... | Python | 110 | 37.854546 | 207 | /main.py | 0.575942 | 0.546454 |
FazilovDev/GraduateWork | refs/heads/main | from Preprocessing.cleantext import *
class Gram:
def __init__(self, text, hash_gram, start_pos, end_pos):
self.text = text
self.hash = hash_gram
self.start_pos = start_pos
self.end_pos = end_pos
def get_text_from_file(filename):
with open(filename, 'r') as f:
text = f... | Python | 127 | 26.826771 | 66 | /Algorithms/Winnowing.py | 0.53918 | 0.517397 |
sonir/vsyn_model | refs/heads/master | # if you want to use this library from outside of sonilab folder, should import as follows,
# from sonilab import sl_metro, sl_osc_send, osc_receive, event
# enjoy !!
import random
from sonilab import sl_metro, sl_osc_send, osc_receive, event
import shapes, shape, send_all
metro = sl_metro.Metro(0.016)
metro2 = sl_me... | Python | 125 | 25.808001 | 135 | /_main.py | 0.586691 | 0.549985 |
sonir/vsyn_model | refs/heads/master | import threading
from sonilab import event
import shape
"""
Shapes treats array of shape.
"""
LOCK = threading.Lock()
data = {}
count = 0
def add(name, obj):
global LOCK , count
with LOCK:
data[name]=(count , obj)
count += 1
def get_primitive(name):
tuple_uid_and_obj = data[name]
u... | Python | 70 | 17.371429 | 54 | /shapes.py | 0.565555 | 0.556245 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.