blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
797a419a87d47d61a08d610a97ecec200a732124 | Python | ivanistheone/cs231n | /assignment1/cs231n/classifiers/softmax.py | UTF-8 | 3,551 | 3.25 | 3 | [
"MIT"
] | permissive | from builtins import range
import numpy as np
from random import shuffle
from past.builtins import xrange
def softmax_loss_naive(W, X, y, reg):
"""
Softmax loss function, naive implementation (with loops)
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
I... | true |
a9396e80d2eaa6594ddbb69fe36f6da7a3cefaa1 | Python | DuttaSejuti/HackerRank-Python | /mutation.py | UTF-8 | 124 | 2.734375 | 3 | [] | no_license | if __name__ == '__main__':
s=input()
n,c=input().split()
n=int(n)
c=str(c)
print(s[:n]+c+s[n+1:])
| true |
246756226d7639c17e7f5ecf37002a6fabf011ed | Python | coder5492/WineQualityPrediction | /wineQualityDataset.py | UTF-8 | 1,911 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
Created on Tue Dec 11 09:43:03 2018
"""
@author: sangeeth
"""
import pandas as pd
from sklearn import preprocessing
from sklearn.decomposition import PCA
import pylab as pl
from sklearn.naive_bayes import GaussianNB
from sklearn import preprocessing
url = "http://archiv... | true |
ad2018deab75f496911bb3599eab481de8d925f3 | Python | Thalisson01/Python | /Exercício Python #092 - Cadastro de Trabalhador em Python.py | UTF-8 | 693 | 3.515625 | 4 | [] | no_license | from datetime import date
dataatual = date.today().year
dados = dict()
dados['nome'] = str(input('Digite seu nome: '))
dados['idade'] = dataatual - int(input('Digite a sua data de nascimento: '))
cdt = int(input('Digite a sua carteira de trabalho. [0] caso não tenha: '))
if (cdt != 0):
dados['CTPS'] = cdt
da... | true |
86d3e7f84cfd2a9e7af722876e6a2c88c80320e3 | Python | franklintra/template-project | /main.py | UTF-8 | 827 | 2.9375 | 3 | [] | no_license | import math as m
import numpy as np
import sympy as sp
import statistics as s
import sys
import os
import argparse
import random as r
import pprint
def loop_list(n: int, f: callable, *args) -> object:
"""
:rtype: list
:param n: int
:param f: callable
:param kwargs: args
"""
return [f(*args)... | true |
63a890d056ac84054eaf3c1c1b7c057ccd96e269 | Python | Dflybird/PlotDemo | /ocean_physics_exp/speed/speed_airboat.py | UTF-8 | 1,200 | 2.640625 | 3 | [] | no_license | # coding:utf-8
import matplotlib.pyplot as plt
import numpy
import json
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
if __name__ == "__main__":
plt.subplots(1, 1, figsize=(8, 4), frameon=True)
plt.xlim((0, 14))
plt.ylim((0, 0.8))
plt.grid(True, linestyle='--'... | true |
daa23629d033c9c0e3e9c0ead97f361faf9f238d | Python | mengqingmeng/gcft_ant | /test_ant/ant/export_excel_test.py | UTF-8 | 2,555 | 2.578125 | 3 | [] | no_license | #coding=utf-8
'''
Created on 2016年8月18日
@author: MQM
'''
from openpyxl import Workbook
from openpyxl import load_workbook
import json
wb = Workbook() #新建文档
ws = wb.active
#workSheet = wb.create_sheet("sheet2") #新建一页,名字“sheet2”
#workSheet.title = "new sheet2" #更改sheet 名字
#ws3 = wb["New Title"] ... | true |
3c952aec77460288fc4ef9537dd62dccc0bb9cef | Python | MenaceDenis/DojoWork | /Python/average.py | UTF-8 | 96 | 3.140625 | 3 | [] | no_license | a = [1, 2, 5, 10, 255, 3]
sum = 0
for num in a:
sum += num
avg = sum / len(a)
print avg
| true |
aec58eff5161dbfcdb012f94039fa95a2cbbf2fe | Python | misskaseyann/candy-slayer | /candy_slayer/game_state/NeighborhoodScreen.py | UTF-8 | 4,425 | 3.0625 | 3 | [] | no_license | import os
import pygame
from candy_slayer.game_state.GameState import GameState
class NeighborhoodScreen(GameState):
"""
Neighborhood game state object.
Music credit: Visager @ https://soundcloud.com/visagermusic
Font credit: Alagard @ https://www.dafont.com/alagard.font
"""
def __init__(sel... | true |
def86977940f03af17c8e91505b5763e6a81113d | Python | Vchenhailong/my-notes-on-python | /basic_rules/chapter_9/__init__.py | UTF-8 | 1,444 | 3.671875 | 4 | [] | no_license | #! /usr/bin/python
# coding:utf-8
"""
contractor, property, iterator & generator:
—— To create objects what can act as a sequence or mapping. For activating the objs,
should implement the following contractors:
__len__(self),
__getitem__(self, key),
__setitem__(self, key, value),
__delitem__(s... | true |
1dbca8ddc241452d7c31fa58d253a891828a9325 | Python | kh4r00n/Pet-Shop-Boys | /petshopboys_final.py | UTF-8 | 14,842 | 3.484375 | 3 | [] | no_license | # FUNÇÃO VALOR DO PRODUTOS:
def val_prod(s, n):
if s == 'ração' or s == 'R':
return 199.90 * n
elif s == 'ração_premium' or s == 'RP':
return 259.90 * n
elif s == 'brinquedo' or s == 'BR':
return 39.90 * n
elif s == 'remédio' or s == 'RM':
return 59.90 * n
return 'Er... | true |
ad72d5193218779432833d444fd5fa0a1749e037 | Python | ScottLangridge/Shutdown-Command-Generator | /VirtualKeyboard.py | UTF-8 | 2,858 | 3.109375 | 3 | [] | no_license | from time import sleep
from code_dict import CODE_DICT
from code_dict import CUSTOM_CODES
import ctypes
class VirtualKeyboard:
#Set custom codes to matching definitions for user defined quick codes
def __init__(self):
self.user32 = ctypes.windll.user32
#Returns code from key
def decode(self,... | true |
fda77059f91015439cbfddc96e2473ffecaf27f6 | Python | straga/micropython_littlefs_test | /data_esp/core/rpc/jsonrpc.py | UTF-8 | 2,606 | 2.53125 | 3 | [] | no_license | try:
import ujson as json
except Exception:
import json
pass
from core import logging
log = logging.getLogger("JSONRPC")
class JsonRpc:
def __init__(self, core, mbus):
self.core = core
self.mbus = mbus
@staticmethod
def isgenerator(iterable):
return hasattr(iterable,... | true |
6921c5494947346bf1d1b0fad9276610224b9166 | Python | karimmakynch/PYTHON | /Encryption[py]/bak/c.py | UTF-8 | 455 | 2.578125 | 3 | [] | no_license | # Variables
key = 200
def encode(msg):
tx = ''
for l in msg:
if ord(l) in range(0,0xff):
pos = ord(l)
pos += key
if pos >= 0xff:
pos -= 0xff
if pos < 0:
pos += 0xff
tx += chr(pos)
else:
tx += l
return tx
def decode(msg):
tx = ''
for l in msg:
if ord(l) in range(0,0xff):
pos = ... | true |
5ff597fb6d6375c577c80afdb57d950e7f66a985 | Python | nitinverma99/Codeforces---800 | /Two_Arrays_and_Swaps.py | UTF-8 | 416 | 2.703125 | 3 | [] | no_license | for i in range(int(input())):
n, k = list(map(int, input().split()))
lst = list(map(int, input().split()))
gst = list(map(int, input().split()))
while(k>0):
if max(gst)>min(lst):
maxx = max(gst)
minn = min(lst)
lst.append(maxx)
lst.remove(minn)
... | true |
5160a5d6f5580ad0b42f3e831af7c3642ac3c38a | Python | jerry73204/ms-agv-car | /tf_openvino_source/movidius_video.py | UTF-8 | 4,671 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
#
# 本程式檔據隨附於套件的的「LICENSE.txt」檔案內容授權,感謝你遵守協議。
import argparse
import time
import cv2
import numpy as np
from openvino.inference_engine import IENetwork, IEPlugin
def m... | true |
b491ab1931f7f936e8f71e186daf2e4f57af5490 | Python | akatkar/PythonLesson | /ThreadDemo.py | UTF-8 | 493 | 3.359375 | 3 | [] | no_license | from threading import *
from time import sleep
class MyThread(Thread):
def __init__(self, name, delay=0.5):
Thread.__init__(self, name=name)
self.delay = delay
def run(self):
i = 0
while i<5:
sleep(self.delay)
i +=1
print(f"{self.n... | true |
c413e55be7bf623a80bef6b0b897b4360be5d1f3 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_116/1221.py | UTF-8 | 1,169 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
import os
import time
import itertools
import collections
xs = range(4)
ys = range(4)
def solv(s, c):
if any([all([s[i][j]==c or s[i][j]=='T' for j in ys]) for i in xs]):
return True
if any([all([s[i][j]==c or s[i][j]=='T' for i in xs... | true |
949f35a84828a28cfe65c20a561df2aea6a5209e | Python | jmnel/dromedary-welcome | /src/help_browser.py | UTF-8 | 3,187 | 3.046875 | 3 | [
"MIT"
] | permissive | import os
from PySide2.QtWidgets import (QWidget, QPushButton, QTextBrowser, QHBoxLayout, QVBoxLayout,
QDialog)
from PySide2.QtCore import Qt, Slot
class HelpBrowser(QWidget):
instance = None # Class variable instance of help browser
documentation_path = '' # Documentation path
def __init... | true |
7c8a1408c8e623011af7e781790890eac990ba0e | Python | COHRINT/cops-and-robots-2.0 | /main.py | UTF-8 | 7,890 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
'''
Cops and Robots launchig file. Contains the main update loop in the __init__ function
'''
__author__ = ["LT"]
__copyright__ = "Copyright 2017, Cohrint"
__credits__ = ["Ian Loefgren","Sierra Williams","Matt Aiken","Nick Sweet"]
__license__ = "GPL"
__version__ = "2.2" # for CnR 2.0
__maintaine... | true |
9281eb55ef79475f37a1cb2fcf721f5203021385 | Python | rajesh95cs/assignments | /1/substringmatchtuple.py | UTF-8 | 516 | 3.171875 | 3 | [] | no_license | import string
def countsubstringmatch(target, key):
i=0
b = 0
c = 0
alist[:]
alist[0:len(target)]=0
count = 0
while b != -1:
b = string.find(target, key, c)
if b == -1:
break
else:
count = count+1
print "Position at ", b
alist... | true |
29468acd8f1a3cb76cabb1fbb0f62bad76bae661 | Python | Klowner/8cic-encode | /8cic_encode.py | UTF-8 | 4,278 | 3 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
Anything-That-PIL-Can-Read to Lightwall 8cic converter
Mark "Klowner" Riedesel (mark@klowner.com) / QCCoLab
------------------------------------------------------
version 2
Reads a series of image files (or a single animated GIF)
and converts them into lightwall ready format!
You can use a t... | true |
11bcc3080344a710d50e26e9f4196ac7379391fc | Python | stanfordnlp/color-describer | /third-party/stanza/stanza/text/vocab.py | UTF-8 | 13,262 | 3.8125 | 4 | [
"Apache-2.0"
] | permissive | """
Vocabulary module for conversion between word tokens and numerical indices.
"""
__author__ = 'victor'
from collections import Counter, namedtuple, OrderedDict
from itertools import izip
import numpy as np
from copy import deepcopy
import zipfile
from ..util.resource import get_data_or_download
class Vocab(object)... | true |
828a8c41783e8ea8b98c4c15d3a7f252288b4698 | Python | xiaoxiaomeng0/python_projects | /Day39_flight-deals-start/flight_search.py | UTF-8 | 5,492 | 2.671875 | 3 | [] | no_license | # from datetime import datetime, timedelta
# import requests
# import data_manager
# from dotenv import load_dotenv
# import os
#
# load_dotenv()
#
# flight_search_endpoint = "https://tequila-api.kiwi.com/v2/search"
#
# class FlightSearch:
# #This class is responsible for talking to the Flight Search API.
# def... | true |
8e910d9e8666850dbe6805b6b5bfa58b58c35fa8 | Python | nayankshingnapure/Nayank-Shingnapure | /Model 1 (1).py | UTF-8 | 3,183 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
# In[2]:
stock=pd.read_csv('c:\\Nifty50.csv')
# In[3]:
print(stock)
# In[4]:
stock.head()
# In[5]:
stock.tail()
# In[6]:
stock.describe()
# In[7]:
stock.tail(90)
# In[8]:
stock.tail(90).min(axis=0)
# I... | true |
30c28fbb7c5875a089b520bef2f9c21cf7ac52c3 | Python | JitenKumar/Data-Science-Practice-With-Python | /Cleaning Data in Python/duplicates.py | UTF-8 | 781 | 3.515625 | 4 | [] | no_license | # Create the new DataFrame: tracks
tracks = billboard[['year', 'artist', 'track','time']]
# Print info of tracks
print(tracks.info())
# Drop the duplicates: tracks_no_duplicates
tracks_no_duplicates = tracks.drop_duplicates()
# Print info of tracks
print(tracks_no_duplicates.info())
#-----------------------------
# ... | true |
a235af6ed810cccb07ef2a0a7eaee8980a1e984d | Python | scanner/tesla-powerwall-play | /tesla-api-play.py | UTF-8 | 8,614 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#
# File: $Id$
#
"""
Try using the tesla-api instead of talking to the powerwall directly
"""
# system imports
#
import os
import asyncio
import pprint
import time
from pathlib import Path
from collections import defaultdict
from datetime import datetime, date, timedelta
import matplotlib.pyplot... | true |
bc6f92dee367b78b68847d32706a70bfc28bb2af | Python | mmangione/open | /open/core/betterself/fixtures/demo_constants.py | UTF-8 | 5,804 | 2.796875 | 3 | [
"MIT"
] | permissive | ACTIVITY_NAMES = [
"Run",
"Job",
"Eat",
"Jumping Jacks",
"Drinking Tea",
"Playing Video Games",
"Juggling",
"Hug Dog",
"Hug Spouse",
"Call Parents",
"Meditate",
"Poop",
"Exercise",
"Got A Period",
"Online Shopping",
"Play Guitar",
"Sex",
"Listened ... | true |
67d2e9141b5b3e80fa76f3c0bc4b0993df28cfdc | Python | leonmbauer/Advent-Of-Code-2020 | /day12/day12part2.py | UTF-8 | 1,661 | 3.59375 | 4 | [] | no_license | # Puzzle link: https://adventofcode.com/2020/day/12
inputfile = open("D:\coding\Advent of Code 2020\day12\day12input.txt", "r")
lines = inputfile.readlines()
directions = []
for value in lines:
directions.append(value.strip("\n"))
def day12(directions):
x = 0
y = 0
wx = 10
wy = 1
for direction... | true |
880fb5f5569d86dd71d6988ad0464ad1be022130 | Python | weed478/asd1 | /offline/zad3.py | UTF-8 | 1,485 | 3.109375 | 3 | [] | no_license | from random import randint, shuffle, seed
def partition(A, p, r):
i = p - 1
for j in range(p, r):
if A[j] <= A[r - 1]:
i += 1
A[i], A[j] = A[j], A[i]
return i
def insertion_sort(A, p, r):
for i in range(p + 1, r):
for j in range(i, p, -1):
if A[j... | true |
d8af9ff3d9d0e1a5d9911979d397a75c05ec9d09 | Python | versigtig/code | /python/pygame_basically.py | UTF-8 | 915 | 3.25 | 3 | [] | no_license | # Import
import pygame
# Initialize game engine
pygame.init()
# Open window
window_size = (640, 480)
screen = pygame.display.set_mode(window_size)
pygame.display.set_caption("The Quest")
WHITE = (255, 255, 255)
RED = (255, 0, 0)
done = False
clock = pygame.time.Clock()
# MAIN GAME LOOP
whil... | true |
0f580bf33aa4471a83d6aa68387ead34c46e990d | Python | BUEC500C1/twitter-summarizer-rest-service-lqi25 | /queue_mul.py | UTF-8 | 1,463 | 2.53125 | 3 | [] | no_license | import Twitter2Video
import queue
import threading
import multiprocessing
import os
q = queue.Queue()
threads = []
def Mul_Threads(item_list,num):
if item_list == []:
return "No twitter names entered"
if num == 0:
return "The num should be bigger than 0"
#nn = num.copy()
def Thread():
... | true |
065d5a27bd08c429bb639bce66c8bb6ff8da3380 | Python | Navid2zp/django-challenge | /volleyball/matches/api/serializers.py | UTF-8 | 3,377 | 2.890625 | 3 | [] | no_license | from rest_framework.exceptions import ValidationError
from rest_framework.fields import IntegerField, SerializerMethodField
from rest_framework.serializers import ModelSerializer, Serializer
from matches.models import Match, MatchSeat
from stadiums.api.serializers import StadiumSerializer
from stadiums.models import S... | true |
492001d64a03a80a34111d769b8d29fae113f310 | Python | Kunal-Kumar-Sahoo/Hand-Gesture-Based-Painting | /e-Paint.py | UTF-8 | 2,882 | 2.671875 | 3 | [
"MIT"
] | permissive | import cv2
import mediapipe as mp
import os
import numpy as np
import HandTrackingModule as htm
################################################
#Configurable variables
brushThickness = 15
eraserThickness = 100
################################################
folderPath = "Header Files"
myList = os.listdir(folderPat... | true |
84e3c7833958a923cf3c3aea9c576da037abb83f | Python | Liahm/CS-265 | /Labs/Lab 4/s1.py | UTF-8 | 566 | 3.3125 | 3 | [] | no_license | import sys
import math
if len( sys.argv ) < 2 : # no file name
print 'ERROR:'
sys.exit()
else :
fName = "students"
f = open (fName, "r") #open file for reading
l = f.readline()
while l :
l = l.strip (' \t\n' ) #Remove whitespaces
s = l.split() #split strings into "chars"
length = len(s[1:])
i = 1
... | true |
136e0ee1d344a340d81a78fa2df0eb379455fa51 | Python | memicq/ProgrammingContestAnswers | /aizu/lectures/computational_geometry/segments_lines/parallel_orthogonal.py | UTF-8 | 841 | 3.6875 | 4 | [] | no_license | #! python3
# parallel_orthogonal.py
class Point():
def __init__(self, x, y):
self.x = x
self.y = y
class Line():
def __init__(self, x1, y1, x2, y2):
self.p1 = Point(x1, y1)
self.p2 = Point(x2, y2)
def get_slope(self):
if self.p1.x == self.p2.x:
return f... | true |
e6cdc91d6a85e778af9e03ad70d475526d8af64d | Python | gone2808/IACV_background_subtractor | /optical_flow.py | UTF-8 | 2,311 | 2.53125 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
FLOW_MAG_THRESHOLD = 0.7
CONSECUTIVE_FLOW_FRAMES = 6
# FLOW_ANGLE_THRESHOLD = 0.3
cap = cv2.VideoCapture('dataset/Jackson_Hole_Wyoming/out0.mov')
ret, frame1 = cap.read()
prvs = cv2.cvtColor(frame1,cv2.COLOR_BGR2GRAY)
hsv = np.zeros_like(frame1)
hsv[...,1] = 255
hsv[...,2] = 255
# avg_f... | true |
1da4ae51674a11c93391583262a73ee86f69ca95 | Python | lapotolo/Smart_ELF | /SmartApp.GNLP/acronyms.py | UTF-8 | 828 | 2.765625 | 3 | [] | no_license | import json
import spacy
import en_core_web_sm
with open('all_lectures.json') as f:
all_lectures = json.load(f)
# Days of the week
days = {
"Mon" : "Monday",
"Tue" : "Tuesday",
"Wed" : "Wednesday",
"Thu" : "Thursday",
"Fri" : "Friday",
"Sat" : "Saturday",
"Sun" : "Sunday"
}
# Lecture... | true |
2b4266bf96f1ac79e91be13b7d41d77b738eace6 | Python | parksjsj9368/TIL | /ALGORITHM/BAEKJOON/SOURCE/07. Sort(정렬)/15. 시리얼 번호.py | UTF-8 | 337 | 3.453125 | 3 | [] | no_license | n = int(input())
data = []
for _ in range(n) :
data.append(list(input()))
def data_sum(x) :
sum = 0
for i in x :
if i.isnumeric() :
sum += int(i)
return sum
answer = sorted(data, key = lambda x : (len(x), data_sum(x), x))
for i in range(len(answer)) :
print(''... | true |
22c04f7c9842e43421bc465545b05c654090fc33 | Python | tderensis/digital_control | /inverted_pendulum.py | UTF-8 | 3,157 | 2.8125 | 3 | [
"MIT"
] | permissive | """
Design of a state space controller for an inverted pendulum driven by stepper motor.
"""
import control_plot, control_sim, control_design, control_optimize, control_eval, control_poles
from scipy import signal
import numpy as np
import math
# System Clasification Results
# motor position low pass filt... | true |
7144f8d25e213d5df479984d2e8af851082379a7 | Python | asihacker/python3_bookmark | /python笔记/aaa基础内置/类相关/多父类调用顺序.py | UTF-8 | 1,259 | 3.546875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/11/21 16:01
# @Author : AsiHacker
# @File : 多父类调用顺序.py
# @Software: PyCharm
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/11/16 16:08
# @Author : AsiHacker
# @Site :
# @File : 自定义异常.py
# @Software: PyCharm
class Displayer():
... | true |
1d88678bcd96a394ad346e4759efcbb62a8e0006 | Python | rabramley/advent_of_code_2015 | /4a/solution.py | UTF-8 | 254 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import hashlib
import itertools
for i in itertools.count(1):
tohash = 'yzbqklnj' + str(i)
m = hashlib.md5(tohash.encode('utf-8'))
hash = m.hexdigest()
if hash[0:5] == "00000":
print(i, hash)
break | true |
e04ff3fffa38274d486fc2e7b35b5a2eec87969b | Python | TaeYeon-kim-ai/Pytorch | /object_detection/YOLOv3/train.py | UTF-8 | 2,427 | 2.515625 | 3 | [] | no_license | import config
import torch
import torch.optim as optim
from model import YOLOv3
from tqdm import tqdm
from utils import (
mean_average_precision,
cells_to_bboxes, # 이미지에 대한 상대적 경계상자
get_evaluation_bboxes,
save_checkpoint,
load_checkpoint,
check_class_accuracy,
get_loaders,
plot_couple_... | true |
bb0859718d03b418127e834c096304b265388641 | Python | Kmmanki/bit_seoul | /AE/a07_nosie2_CAE.py | UTF-8 | 2,369 | 2.578125 | 3 | [] | no_license | import numpy as np
from tensorflow.keras.datasets import mnist
(x_train, _), (x_test, _) = mnist.load_data()
x_train = x_train.reshape(60000,28,28,1).astype('float32')/255.
x_test = x_test.reshape(10000,28,28,1).astype('float32')/255.
x_train_noised = x_train + np.random.normal(0, 0.1, size=x_train.shape)
x_test_nois... | true |
a83d5ec8c70b75269545900f7b447a5e14c61fd5 | Python | SemyonSinchenko/RandomGraphModels | /utils/plot_report.py | UTF-8 | 5,117 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import Counter
import logging
from pathlib import Path
from random import choice, random
import igraph as ig
import matplotlib.pylab as plt
import numpy as np
def plot_all_distributions(g: ig.Graph, path_prefix: Path) -> None:
path_prefix.mkdir(pare... | true |
56d9008d3653b886f4a7c0489242ea1484408e85 | Python | jonnylee719/actividad_practica_iic2233_2 | /AC10-201516_2-metaclase/trial_2.py | UTF-8 | 1,409 | 3.671875 | 4 | [] | no_license |
def create_property(name):
def setter(self, val):
if self.__dict__.get(name) is None:
self.__dict__[name] = val
else:
raise AttributeError
def getter(self):
return self.__dict__.get(name)
return property(getter, setter)
class RestrictedAccess(type):
d... | true |
5139240eb2aa77a26b14075b198ad54fbc71737a | Python | RagnvaldArnulfson/TIPE-Game-Of-War | /BacktrackPredeterminedWeight.py | UTF-8 | 3,565 | 3.09375 | 3 | [] | no_license | # -*- coding: cp1252 -*-
import random as rd
jeu52Cartes = [(i%13)+1 for i in range(13*4)]
#poids du jeu : 364
#poids minimal d'un paquet (26 cartes tirées dedans) : 98
#poids maximal : 266 (=364-98)
jeu32Cartes = [(i%8)+1 for i in range(8*4)]
#poids du jeu : 144
#poids minimal d'un paquet (16 cartes tirées dedans)... | true |
15b73ffb7feea81118dff6e36d68d185b88087d0 | Python | arielsl/LynBot | /urlhelper.py | UTF-8 | 4,699 | 2.984375 | 3 | [] | no_license | """
A simple class that will handle URL requests
"""
from urllib.request import Request, urlopen
import urllib.error
import re
import help_messages
from bs4 import *
"""
Checks if the given url exists by reading the response code
"""
def url_exits(url):
code = 0
try:
req = Request(url, headers={'User-... | true |
b60dcbf78326fdc9809d7278780485fda6820088 | Python | Dhaval2110/Python | /Regex_Parser/main_method.py | UTF-8 | 8,359 | 2.953125 | 3 | [] | no_license |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 19 00:10:40 2022
@author: Dhaval
"""
# global imports
import os
import re
import logging
import warnings
#local imports
from argparser import argParsing
# global/local variables
l=[]
#===========================================================... | true |
dbca189b795c5dff81afc83652af2bc2837d06da | Python | JancisWang/-offer_python | /剪绳子.py | UTF-8 | 853 | 3.40625 | 3 | [] | no_license | '''
给你一根长度为n的绳子,请把绳子剪成整数长的m段(m、n都是整数,n>1并且m>1),每段绳子的长度记为k[0],k[1],...,k[m]。请问k[0]xk[1]x...xk[m]可能的最大乘积是多少?例如,当绳子的长度是8时,我们把它剪成长度分别为2、3、3的三段,此时得到的最大乘积是18。
输入描述:
输入一个数n,意义见题面。(2 <= n <= 60)
输出描述:
输出答案。
示例1
输入
复制
8
输出
复制
18
'''
# -*- coding:utf-8 -*-
class Solution:
def cutRope(self, number):
# write code here... | true |
8971a16b298c6c344a97d8ec8a060d16d15e314b | Python | SnapshotSerengetiScienceTeam/Scripts | /metadatadb-scripts/import_clean_season_metadata_into_database.py | UTF-8 | 9,830 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
import MySQLdb
import sys
import snapshotDB
import datetime
import csv
# format of the authentication file should be three lines:
# MSI user name
# database password
# full name
# format of the season file should be one or more comma-separated line(s)
# with fields:
# season: integer
# start date: ... | true |
4dce3bb4972b7a9f8759f8ebaf3fc0571a40fb54 | Python | pmirallesr/Abeona | /transfer/mod_problems/direct_pl2pl_mod.py | UTF-8 | 8,925 | 2.515625 | 3 | [] | no_license | from pykep.trajopt._direct import _direct_base
import pykep as pk
import numpy as np
from utils.pow_to_mass import pow_to_mass as pw2m
from utils.pow_to_mass import min_panel_mass
import time
defaults = {
"w_mass": 0.5, "w_tof":0.5,
"prop_eff": 0.5}
class direct_pl2pl_mod(_direct_base):
"""Represents a dire... | true |
d299e332ce29e79ae0f5bb5817701dd2db7e1fed | Python | weecology/retriever | /retriever/engines/jsonengine.py | UTF-8 | 5,520 | 2.640625 | 3 | [
"MIT"
] | permissive | """Engine for writing data to a JSON file"""
import json
import os
from collections import OrderedDict
from retriever.lib.defaults import DATA_DIR
from retriever.lib.dummy import DummyConnection
from retriever.lib.models import Engine
from retriever.lib.tools import open_fr, open_fw
from retriever.lib.engine_tools imp... | true |
d7cfc0c6b9a94503d675faf62da8f3b59d0466ef | Python | ashirwadsangwan/Python | /OOPs/classMethods.py | UTF-8 | 1,140 | 4.03125 | 4 | [
"MIT"
] | permissive | class Employee:
number_of_employees = 0
raise_amount = 1.04
def __init__(self, first, last, pay): ## self is the instance here
self.first = first
self.last = last
self.pay = pay
self.email = first + "." + last + "@company.com"
Employee.number_of_employees += 1
... | true |
bf207a48790bd22e1b41c59eb129bf3181410938 | Python | gl-coding/OpenBaseCode | /NlpBase/utils.py | UTF-8 | 764 | 3.484375 | 3 | [] | no_license | import time
def print_help(res):
if isinstance(res, list):
for item in res[:min(10,len(res))]:
print item
elif isinstance(res, dict):
for k, v in res:
print k, v
else:
print res
def deco(f):
def wrapper(*args, **kwargs):
start_time = time.time()
... | true |
821ce992b6ad817c97407d49095f9768705c0cf2 | Python | lesteve/markdown-it-py | /markdown_it/common/entities.py | UTF-8 | 450 | 2.921875 | 3 | [
"MIT"
] | permissive | """HTML5 entities map: { name -> characters }."""
import html
class _Entities:
def __getattr__(self, name):
try:
return DATA[name]
except KeyError:
raise AttributeError(name)
def __getitem__(self, name):
return DATA[name]
def __contains__(self, name):
... | true |
36222ece45752befa30ccd7f342645775a3f258e | Python | zhengminhui/leetcode-python | /src/convertToTitle.py | UTF-8 | 205 | 3.640625 | 4 | [] | no_license | def convertToTitle(n):
"""
:type n: int
:rtype: str
"""
s = ''
while n > 0:
n -= 1
s = chr(n%26 + 65) + s
n /= 26
return s
print convertToTitle(27)
| true |
45a4c0c19fdf58be842f86c0914d48b33626b1d0 | Python | mlbudda/Checkio | /o_reilly/remove_all_after.py | UTF-8 | 685 | 3.734375 | 4 | [] | no_license | # Remove all after
from typing import Iterable
def remove_all_after(items: list, border: int) -> Iterable:
""" Removes all of the elements after the given one from list """
try:
return items[:(items.index(border)+1)]
except ValueError:
return items
# Running some tests...
print(list(rem... | true |
a6b796b00215f3417c1520862d774d13f347742d | Python | murex971/cryptopals | /Set-1/Solution-2.py | UTF-8 | 228 | 3.140625 | 3 | [] | no_license | from binascii import unhexlify,hexlify
def XORfunc(str1, str2):
a = unhexlify(str1)
b = unhexlify(str2)
output = ""
for x in range(0,len(a)):
output+= (chr(ord(a[x])^ord(b[x])))
print hexlify(output) | true |
afca42f40349f960a28a981e7e8c04e08c9c1fa3 | Python | shanti-uva/mms_image_import | /file-import.py | UTF-8 | 544 | 2.765625 | 3 | [] | no_license | import sys
import subprocess
import os
if len(sys.argv) > 1:
fpath = sys.argv[1]
print("File path is: {}".format(fpath))
with open(fpath, 'r') as inf:
for ln in inf:
print(ln)
try:
mid = int(ln.strip())
cmd = "python import.py -coll 346 -i {}"... | true |
65ea14706e29e771c91514560afddb5c2642fd9e | Python | ching-yi-hsu/practice_python | /8_Rock_Paper_Scissors/rock_paper_scissors.py | UTF-8 | 911 | 3.6875 | 4 | [] | no_license |
def RPS_game():
rock = 1
paper = 2
scissors = 3
player_1 = int((input("you are play1 , rock = 1, paper = 2, scissors = 3, please enter a number : ")))
player_2 = int((input("you are play2 , rock = 1, paper = 2, scissors = 3, please enter a number : ")))
if player_1 == player_2 :
print... | true |
b614d30d3186c88376489272c35db5aabb86b102 | Python | kids-first/kf-lib-data-ingest | /kf_lib_data_ingest/validation/hierarchy.py | UTF-8 | 1,648 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from math import inf
from graph import Graph # https://github.com/root-11/graph-theory
from kf_lib_data_ingest.validation.default_hierarchy import DEFAULT_HIERARCHY
def get_full_hierarchy(H=None):
HIERARCHY = H if H is not None else DEFAULT_HIERARCHY
# Make a faster lookup than HIERARCHY.nodes()
ANCEST... | true |
44756735423df33703d4d7bff915bb2270e80541 | Python | MarianDanaila/Competitive-Programming | /LeetCode_30days_challenge/2020/June/Power of Two.py | UTF-8 | 187 | 3.296875 | 3 | [] | no_license | def isPowerOfTwo(n):
while n % 2 == 0:
n //= 2
if n == 1:
return 1
else:
return 0
"""
# with bit manipulation
return n > 0 and (n & (n-1) == 0)
""" | true |
c6e6c39e05e1919ff8baf104a83bf0b12dd2fcac | Python | phamous2day/rpg_PythonExercises | /bubblesort.py | UTF-8 | 486 | 3.578125 | 4 | [] | no_license | def bubbleSort(my_array):
for pass_number in range(len(my_array)-1,0,-1):
print "This is pass_number, round: %r" % pass_number
for i in range(pass_number):
if my_array[i]>my_array[i+1]:
temp = my_array[i]
my_array[i] = my_array[i+1]
print ... | true |
4175c3e5992bef93a800da4b0546b73c74d1ab47 | Python | lunkaleung/HackerRank | /Practice/Python/Arithmetic Operators/arithmetic_operators.py | UTF-8 | 194 | 3.59375 | 4 | [
"MIT"
] | permissive | if __name__ == '__main__':
a = int(input())
b = int(input())
if(a >= 1 and a <= 10**10) and (b >= 1 and b <= 10**10):
print(a + b)
print(a - b)
print(a * b) | true |
e6568f0dd0820e6faac88113d925e30ed7ba7bdc | Python | AWildDevAppears/Porcupine | /constants/config.py | UTF-8 | 548 | 2.609375 | 3 | [] | no_license | from tkinter import filedialog
from yaml import load
class Config:
CONFIG_ROOT_PATH = './Dataset'
CONFIG_OUT_PATH = './out'
@staticmethod
def load_config():
filename = filedialog.askopenfile(filetypes=('Config file', '*.yml'))
if filename:
config = load(open(filename, 'r'... | true |
7664d3a5141dd1804e63a583e9cd6f31ab420a64 | Python | jlopez1423/python-crash-course-tutorials | /chapter-4-exercises/animals.py | UTF-8 | 302 | 4.6875 | 5 | [] | no_license | # Animals think of three animals that have a common characteristics.
# Use a for loop to print them out
animals = ['wolves', 'foxes', 'dogs']
for animal in animals:
print("A " + animal + " would make a great pet.")
print("Any of these animals would make a great pet")
print("I think, maybe not.") | true |
35869cfd0a88c49baf8cd8ace010564daad9a52f | Python | talhaHavadar/ProjectChelonoidis | /sensorkit/motorcontrol_test.py | UTF-8 | 1,359 | 2.6875 | 3 | [
"MIT"
] | permissive | from RPi import GPIO as io
from sensorkit.UltrasonicHCSR04 import UltrasonicHCSR04
from sensorkit.MotorControl_L298N import MotorControl_L298N
mcontrol = MotorControl_L298N(input_pin0=17, input_pin1=27, enable_pin=22)
while(True):
command = raw_input("Give a command(up, down, stop, forward, backward): ")
if ... | true |
79abb3ac17b67272d36723bf3139c2972f78b1ee | Python | RensZ/thesis2 | /Python/SEPPartialUnitTest.py | UTF-8 | 4,902 | 2.75 | 3 | [] | no_license |
def CentralGravity(mu, position):
return -mu * position / (np.linalg.norm(position)**Decimal(3.0))
def SEPcorrection(mu, r_1, r_2, dr):
r_1_c = r_1 + dr
r_12 = r_2 - r_1
r_12_c = r_2 - r_1_c
a = CentralGravity(mu, r_12)
a_c = CentralGravity(mu, r_12_c)
# print("a_c: ", a_c)
# prin... | true |
8d09a4f09ed64fab80ca676606caab3914f1b3fa | Python | shakyasaijal/Google-Foobar-Challenge | /re-id.py | UTF-8 | 316 | 3.203125 | 3 | [] | no_license | def solution(n):
if n < 0 or n > 10000:
return 0
prime_numbers = ""
for x in range(1, n+100):
if x > 1:
for i in range(2, x):
if(x % i == 0):
break
else:
prime_numbers += str(x)
return prime_numbers[n:n+5]
| true |
d2771a78f19f1519e906b8e00897f4316c67d0a0 | Python | Torlinski/football-modelling | /soccermatics/tracking/lecture4_5.py | UTF-8 | 1,387 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import Metrica_IO as mio
import Metrica_Viz as mviz
import Metrica_Velocities as mvel
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
# In[2]:
# set up initial path to data
WORKING_DIR = os.getcwd()
BASE_DIR = os.path.dirname(os.path... | true |
24e4e957f336cb5ade09877013db83792dcdafbf | Python | MirandaKoubi/School_Projects | /A_Star_Project/mrk3865_astar_project.py | UTF-8 | 9,929 | 3.9375 | 4 | [] | no_license | #Name: Miranda Koubi
#CLID: mrk3865
#Class: CMPS 420 Spring 2015
#Due Date: February 20, 2015 at 10:00 am
#Project: #1 8-Puzzle Solver using A* Algorithm
#Assignment:
#Implement a program that solves an 8-puzzle using the A* shortest path algorithm.
import heapq
import time
startInput = " "
goalInput = " "
c... | true |
179e0f43caceff1928c95f82a21534568e1d92c3 | Python | nv-jeff/pytorch | /torch/utils/data/webdataset/bench.py | UTF-8 | 3,102 | 2.765625 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause",
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | import argparse
import time
from collections import Counter
import itertools as itt
from . import dataset, loader, filters
description = """Check validity of dataset and measure I/O speed.
This command lets you quickly check whether a WebDataset is valid (i.e., has no
repeated keys, which happens if you accidentally... | true |
753c58d288e7e7af809ee50b07f428ec106df23c | Python | marmute360/Python-Exercises | /calculando lanches.py | UTF-8 | 522 | 3.390625 | 3 | [] | no_license | print("==============================================")
print("=== Calculando lanches ===")
print("==============================================")
Cod100 = float(input("PRODUTO CÓD. 100 (Preço Unitário: R$ 5,30), informe a quantidade: "))
Cod101 = float(input("PRODUTO CÓD. 101 (Preço Unitário: R$ ... | true |
17448f77bdf640daf166670dda0ebe83c0ee2f6c | Python | gzgdouru/python_study | /python3_cookbook/chapter06/demo09.py | UTF-8 | 261 | 3.203125 | 3 | [] | no_license | '''
编码和解码十六进制数
'''
import binascii
import base64
if __name__ == "__main__":
s = b"hello"
h = binascii.b2a_hex(s)
print(h)
print(binascii.a2b_hex(h))
h = base64.b16encode(s)
print(h)
print(base64.b16decode(h))
| true |
f72d148b55fce2aad537160681650a40aec6d7d5 | Python | softmaxhuanchen/optimal-double-execution | /src/data/gbm.py | UTF-8 | 1,045 | 2.890625 | 3 | [
"MIT"
] | permissive | import numpy as np
from .base import Price
class GBM(Price):
"""Brownian motion."""
def __init__(self, T=1., sigma1=0.02, sigma2=0.01, s1=1., s2=1.,
drift1=0., drift2=0., n=100):
self.sigma1 = sigma1
self.sigma2 = sigma2
self.drift1 = drift1
self.drift2 = drift... | true |
188e8b1f947bd45afa4564af5dffbc3f575bf165 | Python | raywiis/advent-of-code-2020 | /src/day-17.py | UTF-8 | 2,975 | 3.171875 | 3 | [] | no_license | from itertools import product
from collections import defaultdict
f = open('./day-17-problem.txt')
start = [list(line) for line in f.read().splitlines()]
def count_activated_around(a, pos, directions):
x, y, z = pos
return sum([
1 for d in directions
if a[(x + d[0], y + d[1], z + d[2])] == '... | true |
d8bf2d28d4e731fd1af23e40cdfd27fee2740480 | Python | lizenghui1121/DS_algorithms | /剑指offer/09.链表中倒数第k个节点.py | UTF-8 | 798 | 3.3125 | 3 | [] | no_license | """
输出链表中倒数第K个节点
@Author: Li Zenghui
@Date: 2020-03-03 16:06
"""
class Solution:
def FindKthToTail(self, head, k):
# write code here
if head is None or k==0:
return None
length = 0
r = head
while r:
r = r.next
length += 1
if k > l... | true |
135122eef70e3b207a1f2799128447ead6103565 | Python | smachage2019/edoc-stuff | /time-freq.py | UTF-8 | 8,270 | 3.4375 | 3 | [] | no_license | # # Analysis of harmonics
#
# The idea behind this script is to explore the data series for seasonal trends, using a
# fourier decomposition of the time series, aggregated by climatic seasons (resampled and sliced
# every 3 months).
#
# The analysis goes as follows:
#
# - Loading the data
# - Filling the ... | true |
d42822f15489a3931726cf50f055ea095e0654bd | Python | one3chens/cloudpunch | /cloudpunch/slave/ping.py | UTF-8 | 2,813 | 2.546875 | 3 | [
"GPL-2.0-only",
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | import re
import subprocess
import logging
import collections
import time
from threading import Thread
class CloudPunchTest(Thread):
def __init__(self, config):
self.config = config
self.final_results = []
super(CloudPunchTest, self).__init__()
def run(self):
try:
... | true |
4fbfc79d1b48d651282d6a6d513ec28182620be3 | Python | KotR9001/sqlalchemy-challenge | /Python Files/app.py | UTF-8 | 13,184 | 3.03125 | 3 | [] | no_license | #########Climate App
#####Re-Enter Code From Jupyter Notebook
from matplotlib import style
style.use('fivethirtyeight')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import datetime as dt
import time
###Reflect Tables into SQLAlchemy ORM
# Python SQL toolkit and Object Relational Mapper
im... | true |
227c59bb246cb920265502f866e52e1c4669e290 | Python | xiongmi39/leetcode | /py/stack/503nextGreaterElements.py | UTF-8 | 650 | 3.171875 | 3 | [] | no_license | from typing import List
class Solution:
def nextGreaterElements(self, nums: List[int]) -> List[int]:
db_nums = nums*2
ans = [-1]*len(nums)
stack = [0]
len_db = len(db_nums)-1
for i in range(len_db,-1,-1):
while len(stack) >1 and db_nums[i] >= nums[stack[-1]]:
... | true |
c2e8680c9bdbada014005d0277d3ea7aee04c406 | Python | eduardopds/Programming-Lab1 | /mediafinal/mediafinal.py | UTF-8 | 253 | 3.453125 | 3 | [] | no_license | # coding: utf-8
# media final
# Eduardo Pereira / Programação 1
nota_1 = float(raw_input())
nota_2 = float(raw_input())
peso_1 = 60
peso_2 = 40
media_final = ((nota_1 * peso_1) + (nota_2 * peso_2)) / (peso_1 + peso_2)
print 'Média final: %.1f' % media_final
| true |
00949fd7089d26747f4e1fea3ec301898957f3a3 | Python | evgenykurbatov/kb21-hotjup-migration-adv | /config_xray_min.py | UTF-8 | 2,260 | 2.59375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
##
## Photoevaporation model
##
import numpy as np
from numpy import pi, sqrt, exp, sin, cos, tan, log, log10
import scipy as sp
import scipy.integrate
import const
from aux import *
path = 'xray'
##
## The X-ray luminosity evolution based on two papers:
## i) Louden T, Wheatley P J, Bri... | true |
ed83ff4e611549d97bc8b2a50ce2bbef7b530cd1 | Python | dewhurstwill/simulate_coin_flip_python | /main.py | UTF-8 | 1,542 | 4.46875 | 4 | [
"MIT"
] | permissive | ######################################################
# #
# A simple program to simulate the flipping a coin #
# multiple times. #
# #
#############################################... | true |
fe129fdfc319851bf95852a862d9bb1a07fbd578 | Python | PribhuPatel/python-training-programs | /day6/6-2.py | UTF-8 | 778 | 2.953125 | 3 | [] | no_license | """Try serializing file handler object."""
import io
import json
try:
file = open("6-1.json", "r")
except FileNotFoundError:
print("File not Found")
exit(1)
file_json = {
'name': file.name,
'data': file.read()
}
file.close()
with open("6-2.json", "w") as f:
json.dump(file_json, f)
with open... | true |
f171d65781b92fef5e4e6ec97e6aa92937d9dd95 | Python | CandyTt20/Notes | /algorithm/add2.py | UTF-8 | 1,549 | 3.625 | 4 | [] | no_license | class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
p1 = []
p2 = []
while l1 != None:... | true |
3b38b2ea189b27d480b41ea5261259b123ae7dda | Python | brent-harrison/CS660Assignment1 | /bandits/controller.py | UTF-8 | 1,914 | 2.75 | 3 | [] | no_license | import numpy as np
import sys
import copy
import time
import random
from randAgent import randomAgent
from epsGreedyAgent import epsGreedyAgent
from UCBAgent import UCBAgent
from thompsonAgent import thompsonAgent
import argparse
######################################################
AGENTS_MAP = {'randomAgent' : rando... | true |
8de5996d4c8a20644e70d03956bf5d49331d979a | Python | VVeremjova/physiopsychotest | /admin/saveInDB.py | UTF-8 | 1,553 | 2.9375 | 3 | [] | no_license | import sqlite3
class SaveInDB() :
def __init__(self,filename = 'example.db'):
db_file = filename
self.conn = sqlite3.connect(filename)
def createDB(self):
# Create table
c = self.conn.cursor()
c.execute('''CREATE TABLE Users
(id_ text, name text, ge... | true |
3f28514c3fbf693ac85c3a8ad3a661da6605580d | Python | JustasJJ/D16-Hangman | /main.py | UTF-8 | 5,338 | 2.5625 | 3 | [
"MIT"
] | permissive | import os
import random
from flask import (
Flask,
session,
render_template,
redirect,
url_for,
request
)
app = Flask(__name__)
app.config['SECRET_KEY'] = 'vavavava'
@app.route('/', methods=['GET', 'POST'])
def index():
session.clear()
return render_template("Hangman.html", score=0... | true |
b5b4c7d2a0e719279f2d3cd706e2f3a26b838bf8 | Python | Voljega/BestArcade | /conf.py | UTF-8 | 416 | 3.046875 | 3 | [] | no_license |
def cleanString(string):
return string.rstrip('\n\r ').lstrip()
def loadConf(confFile):
conf = dict()
file = open(confFile, 'r', encoding="utf-8")
for line in file.readlines():
if not line.startswith('#'):
confLine = line.split("=")
if len(confLine) == 2:
... | true |
de4438e5df82fff40baacf0ea8b16ad2c207bacc | Python | manojgudi/yelp | /function_testing/regexp.py | UTF-8 | 1,195 | 3.1875 | 3 | [] | no_license | #script for detecting functions defined but not used in scilab
import re
file_name = 'C:\Users\kushal\Documents\python programs\scilab.txt'
file_obj = open(file_name, 'r')
file_data = file_obj.read()
file_obj.close()
def useless(file_data):
ret = []
functionline = 'function [^(]*' # detects function declarati... | true |
a14903aa0d29f522f160f5139e5015403fa3a396 | Python | 2014arki/Assignments | /untitled/Lesson_18_02_16.py | UTF-8 | 873 | 2.84375 | 3 | [] | no_license | #! /usr/bin/env python
"""
"""
from __future__ import division, print_function
def fasta_reader(fp):
"""
:param fp:
:return:
"""
pass
def hamming(seq1, seq2):
"""
:type seq1: str
:param seq1:
:type seq2: str
:param seq2:
:return:
"""
if len(seq1) != len(seq2):
... | true |
02bcecef95303dab9509cd37fd935dd3bcaca57f | Python | ixxra/projecteuler | /problem040/problem40.py | UTF-8 | 333 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python2
def seq():
a = 1
while True:
digits = map(int, str(a))
for d in digits:
yield d
a += 1
prod = 1
for i, s in enumerate(seq()):
if i in (0, 9, 99, 999, 9999, 99999):
prod *= s
if i == 999999:
prod *= s
break
... | true |
32c3fc8607a234c9327d3daa036684461d034807 | Python | 80pctsols/breaker | /breaker/test_breaker.py | UTF-8 | 2,774 | 3.15625 | 3 | [] | no_license | from .breaker import (
CircuitBreaker,
CircuitBreakerException
)
import datetime
import time
# Functions used in tests
def func(x1, x2, x3=10):
return x1 + x2 + x3
def error_func():
bad_list = []
return bad_list[10]
def error2_func():
raise Exception
# Class used to test cb use with class
c... | true |
32b8e29b705f724b702ee4a1139637e4d676f1c9 | Python | kevinhaube/LoLDataVisualizer | /Evaluation.py | UTF-8 | 1,680 | 3.421875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def clear_false_index(*data_frames):
"""Clears the false indexing created by Pandas when saved as a CSV.
WARNING: ONLY USE ONCE PER DATA FRAME.
:param data_frames: Data Frames
:return: None
"""
for df in data_frames:
... | true |
4b5c377a7553581dace3792912de3de252a98911 | Python | arifwc/JDIH_JABAR | /scraping_py/pandangarankab_scraping.py | UTF-8 | 815 | 2.53125 | 3 | [] | no_license | import json
import requests
import re
urls=['https://web.pangandarankab.go.id/public/jdih/dokumen/list/1/peraturan-daerah?_=1583154735707',
'https://web.pangandarankab.go.id/public/jdih/dokumen/list/4/keputusan-bupati?_=1583154402551',
'https://web.pangandarankab.go.id/public/jdih/dokumen/list/3/peraturan-... | true |
c8e68e4929b56a5ba5e1d25091b01e4ee442926c | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_116/688.py | UTF-8 | 3,211 | 3.015625 | 3 | [] | no_license | '''
Created on 13/04/13
Code Jam 2013 Qualification Round A
@author: manolo
'''
import sys
ifile = sys.stdin
def r():
return ifile.readline()[:-1]
ofile = open('./a-large.out', 'w')
def w(what):
ofile.write(what + '\n')
def check_line(l):
# print "checking line " + str(l)
x_wins = True
o_wins = T... | true |
80a8a4e39cd502a519deb60fb2fd705048089f68 | Python | wagllgaw/Email | /flask_app/app.py | UTF-8 | 4,879 | 2.546875 | 3 | [] | no_license | import json
import requests
import socket
import time
import cPickle as pickle
import pandas as pd
import re
import StringIO
from HTMLParser import HTMLParser
from flask import Flask, request, render_template
from processor import Processor
app = Flask(__name__)
## Welcome to the Email Rank flask app. This runs a per... | true |
e64cda17aab916d64ef21aceb64a49479422fd9a | Python | mashago/study | /python/print.py | UTF-8 | 50 | 2.640625 | 3 | [] | no_license |
a = 100;
if (a >= 0): print a
else: print -a
| true |