blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
d3dbf44348d93cce4b4220c85f84e722392ae3c8 | xiang-daode/Python3_codes | /1_range`list`下标_04.py | UTF-8 | 226 | 3.625 | 4 | [] | no_license | #列表与下标:
a=["cat","fox","pig","dog","bee","ant","cow"]
print(a[0])
print(a[-1])
print(a[0:3])
print(a[-1:-5:-1])
print(a[3:])
print(a[:3])
print(a[::2])
print(a[::-2])
print(a[::-1])
a="12345abcdef"
print(a[::-1])
| true |
789f71fc61ee02a2548d959340101c02607d5592 | kajiawei/PythonUtils | /ContentsToText.py | UTF-8 | 1,490 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import os
def list_dir_contents(contents, relative_path):
#raw_input('paused')
abs_path = rootdir_path + '\\' + relative_path
print 'looking in ' + abs_path
print 'relative path: ' + relative_path
child_dirs = [ d for d in os.listdir(abs_path) i... | true |
9667e9bd8bc2f97497f90db00a2c10186a0d4d13 | BigEggStudy/LeetCode-Py | /LeetCode/_0051_0100/_055_JumpGame.py | UTF-8 | 473 | 2.921875 | 3 | [
"MIT"
] | permissive | #-----------------------------------------------------------------------------
# Runtime: 32ms
# Memory Usage:
# Link:
#-----------------------------------------------------------------------------
class Solution:
def canJump(self, nums: [int]) -> bool:
max_right = 0
for i, num in enumerate(nums... | true |
3c318e3a11e38d89dbf0f6c6e58d2eb59d4a5d49 | viosgithub/rebook | /rebook.py | UTF-8 | 12,028 | 2.734375 | 3 | [] | no_license | #coding:utf-8
import wx
import os
import glob,shutil
import zipfile
import dragdrop
class MainWindow(wx.Frame):
def __init__(self, parent, title):
global fileList,startStr,endStr
self.dirname=''
# A "-1" in the size parameter instructs wxWidgets to use the default size.
# In this ... | true |
10d3ee72560bc2fb0bde6d4400d6fa76778ba34f | nickiovino/eyecode | /plot/_plot.py | UTF-8 | 40,705 | 2.546875 | 3 | [] | no_license | import operator, itertools as it
import numpy as np
import scipy, pandas
import matplotlib
from matplotlib import pyplot, cm
from matplotlib.ticker import MultipleLocator, FuncFormatter, FixedFormatter
from matplotlib.colors import LinearSegmentedColormap
from PIL import Image, ImageDraw, ImageEnhance
from StringIO im... | true |
84aa31396f8bae771b29432e175e3c852151fb17 | kangshwan/LearnOpenCV | /video_cam_resize.py | UTF-8 | 1,170 | 2.90625 | 3 | [] | no_license | import cv2
# cap = cv2.VideoCapture(0) #카메라 0번 장치 연결
# 카메라가 아닌 동영상 파일에 프레임 크기를 재지정하는 것은 적용이 안된다고 한다...
cap = cv2.VideoCapture(0)
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH) #프레임 폭 값
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT) #프레임 높이 값
print("Original width: %d, height: %d" %(width, height))
c... | true |
2d9cfe62f3e87ad3c06307aea0fe07d2b7aceca6 | frclasso/turma1_Python3_2018 | /cap08/exercicio-8-2.py | UTF-8 | 517 | 4.40625 | 4 | [] | no_license | '''Exercício 8.2 - Escreva uma função que receba dois números e retorne
True se o primeiro número for múltiplo do segundo.
Valores esperados:
múltiplo(8,4) == True
múltiplo(7,3) == False
múltiplo(5,5) == True'''
def multiplos(a, b):
return a % b == 0
def main():
print(f'Múltiplo(8,4) == True, obti... | true |
0f747e55b2756a763ba94a3f2cc5b33c6bb9259e | xiaoxue11/Statistical_learning_method | /EM/EM.py | UTF-8 | 1,366 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 30 23:14:41 2019
@author: 29132
"""
import numpy as np
class EM:
def __init__(self,prob,max_iter):
self.pro_A,self.pro_B,self.pro_C=prob
self.max_iter=max_iter
#E_step
def calculate_mean(self,label):
pro_1=self.pro_A*np.power(sel... | true |
ec9da739db1c229522fa16237fcda5936028367e | zhyshkevich/ml | /zhyshkevich_858341_ml_labs/lab5/lab 5_2.py | UTF-8 | 14,003 | 3.015625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import scipy.io
from sklearn import svm
import nltk
from IPython.display import clear_output, display
import os
import email
# 13. Загрузите данные spamTrain.mat из файла.
data1 = scipy.io.loadmat('spamTrain.mat')
X1 = data1['X']
y1 = data1['y']
print... | true |
b34dde816d46e93cca50787a100f54d30d98fc69 | FHU-yezi/simulation-system-of-FHU | /初心不变运营模拟系统.py | UTF-8 | 22,987 | 2.921875 | 3 | [] | no_license | print("初心不变运营模拟系统\n初心不变 超级管理员 叶子\n保留所有权利")
class 初始化失败错误(Exception):
pass
class 单元测试错误(Exception):
pass
class 成员不存在错误(Exception):
pass
"""
自定义错误类
具体细节请查看用户手册
"""
print("加载模块......")
try:
from random import random,randint,choice
from time import time,sleep
from pickle import ... | true |
63bec27ba1077541594593a4da8e83d9967db01d | yue123161/IOTAnomaly | /classifying_testing_anom_detect.py | UTF-8 | 9,994 | 2.84375 | 3 | [] | no_license | # ******************************************************************************
# classifying_testing_anom_detect.py
#
# Date Name Description
# ======== ========= ========================================================
# 7/29/19 Muncy Initial version,
# ********************************************... | true |
abace4c40c973724c497de2003913a527b7e7d29 | tylerbrowndev/aoc2020 | /10.py | UTF-8 | 1,062 | 3 | 3 | [] | no_license | f = open("input/10.txt", "r")
lines = f.readlines()
nums = [int(x.strip()) for x in lines]
nums = sorted(nums)
# part 1
one_diffs = 1
three_diffs = 1
for i in range(len(nums) - 1):
diff = nums[i + 1] - nums[i]
if diff == 1:
one_diffs += 1
elif diff == 3:
three_diffs += 1
print(one_diffs * three_diffs)
... | true |
39d42962ae7892d3aa901d585131639426dce91d | thorn-oss/perception | /perception/hashers/image/dhash.py | UTF-8 | 869 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | import cv2
from ..hasher import ImageHasher
class DHash(ImageHasher):
"""A hash based on the differences between adjacent pixels.
Implementation based on that of
`ImageHash <https://github.com/JohannesBuchner/imagehash>`_.
"""
dtype = "bool"
distance_metric = "hamming"
def __init__(self... | true |
633f1a3edd7ed39844d9dc0d92b913a996f4f7e5 | cczhong11/Leetcode-contest-code-downloader | /Questiondir/637.average-of-levels-in-binary-tree/637.average-of-levels-in-binary-tree_108877730.py | UTF-8 | 886 | 3.484375 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def averageOfLevels(self, root):
"""
:type root: TreeNode
:rtype: List[float]
"""
... | true |
3a31dc763b058c71c0c33cc727d6efe5a81bdfc8 | Wjonke/Algorithms | /notes.py | UTF-8 | 1,601 | 3.578125 | 4 | [] | no_license | """
# [0, 1, 1, 2, 3, 5, 8, 13, 21]
cache = {0: 1, 1: 1}
def rec_fib(n):
# base cases
# if n == 0:
# return 1
# if n == 1:
# return 1
if n in cache:
return cache[n]
# if it's not in the cache, we must
n_minus_1 = rec_fib(n-1)
n_minus_2 = rec_fib(n-2)
cache[n... | true |
ff2395d513c849548b3f45ac0addaa2c1bcc9350 | kmbutterfield/Programming-for-Spatial-Analysts-Core-Skills-Assessment-1 | /agentframework.py | UTF-8 | 3,191 | 3.5625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Oct 31 13:44:33 2017
@author: ed12k3b
Programming for Geographical Information Analysts: Core Skills
Module taught for MA Social Research Methods (Interdisciplinary)
Module taught by Dr. Andy Evans, University of Leeds.
This file contains the code for the Agent class.
"""
# ... | true |
3edd77fa87264194e71090730d51ddb46e94b646 | ting-python/Python0709 | /try/Def try2.py | UTF-8 | 170 | 3.3125 | 3 | [] | no_license |
def a(n,h):
k = n + h
return k # print(k)結果不一樣
ans = a(8,6)
print(ans)
ans = a(99,24)
print(ans)
ans = a(75,21)
print(ans)
ans = a(34,7)
print(ans)
| true |
f5dcdd34835ea22a34121fde23d6f1051d11ff1c | sunowYang/DigitalSignature | /bin/log.py | UTF-8 | 1,091 | 2.8125 | 3 | [] | no_license | #! coding=utf8
import os
import logging
class MyLog:
def __init__(self, log_path, log_name, name='YGX'):
self.name = name
if not os.path.exists(log_path):
os.makedirs(log_path)
self.log_dir = os.path.join(log_path, log_name)
if not os.path.exists(self.log_dir):
... | true |
4ac4849473285afec3e82839d99c16efb1289d09 | ayushpatidar/Automatic_predictive_modeling | /TIME_SERIES/stationary_transformation/transformation.py | UTF-8 | 1,407 | 3.1875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import pickle
def transformation_stationary(df, Y):
#1.. MAKING LOG TRANSFORM to reduce trend
is_log_transform = False
try:
lis = df[Y]
min1 = min(lis)
if min1 <= 0:
for i in df.index:
if df[i][Y] < 0:
... | true |
3c19dec5884658ee9e6204d7ec84b726de25fed8 | imgomez0127/daily-programming | /interview-questions/dip14.py | UTF-8 | 455 | 3.46875 | 3 | [] | no_license | def distance(s1, s2):
if s1 == "":
return len(s2)
if s2 == "":
return len(s1)
if s1[0] == s2[0]:
return distance(s1[1:],s2[1:])
insertion = distance(s1[1:],s2) + 1
deletion = distance(s1,s2[1:]) + 1
replacement = distance(s1[1:],s2[1:]) + 1
return min(insertion,deleti... | true |
db5de26cebd1e9f6c1acae25afe5a40e32c14492 | anduril47/Python_ileri_seviye | /Python_ozel_fonksiyonlar/python_lambda_fonksiyonu.py | UTF-8 | 340 | 4.25 | 4 | [] | no_license | #normal bir fonksiyonun yazılışı
"""
def kare(x):
# y = x**2
return x**2 #y
print(kare(2))
"""
# lambda ile yukarıdaki fonksiyonun yazılışı
k = lambda x: x**2
print(k)
print(k(2))
bk = lambda x,y: x if x>y else y
print(bk(5,8))
"""
def bk(x,y):
if x>y:
return x
else:
return y
print(b... | true |
b26e9fa60ba2f60857cb52a11f113f976f7b1a61 | brandonio21/servertrak | /proxies/ssh.py | UTF-8 | 441 | 2.5625 | 3 | [] | no_license | from subprocess import Popen, PIPE
class SSHProxy:
def execute_command_and_get_output(self, user, hostname, command):
p = Popen(['ssh', '{}@{}'.format(user.username, hostname), command],
stdout=PIPE, stderr=PIPE)
stdoutdata, stderrdata = p.communicate()
if p.returncode =... | true |
4f58decededee1425e904934eb809fa0c1804c49 | Aasthaengg/IBMdataset | /Python_codes/p03137/s474288799.py | UTF-8 | 237 | 2.8125 | 3 | [] | no_license | n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
x_diff = []
for i in range(m-1):
x_diff.append(x[i+1] - x[i])
x_diff.sort()
ans = 0
for i in range(len(x_diff) - (n-1)):
ans += x_diff[i]
print(ans) | true |
12a248fc3dc4fed517f1f3db805b8609358ea54f | baxter101/baxter_demos | /scripts/ee_position_keyboard.py | UTF-8 | 7,180 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""Baxter End Effector Controller Demo by Jackie Kay
Based on the Baxter RSDK Joint Position Example
Command the (x, y, z) position of the end effector using the keyboard. Uses
Jacobian kinematics to determine required joint angles.
"""
# TODO:
# figure out coordinate frame and rotational frame... | true |
8f98e8198a883b321d047102ae3f392f5b8d17f6 | aniketmate/Python-Django-All | /Employee_Excel/app_classes.py | UTF-8 | 912 | 3.296875 | 3 | [] | no_license | class Common:
def __str__(self):
return f"\n{self.__dict__}"
def __repr__(self):
return str(self)
class Employee(Common):
def __init__(self,eid,ename,eage,esal,eadr):
self.EmpID = eid
self.EmpName = ename
self.EmpAge = eage
self.E... | true |
544fddabf6d064cb37fec1226b68cf442b304c8b | Mltsum/Python_Advanced | /面向对象/14_类中的描述器使用.py | UTF-8 | 2,052 | 3.46875 | 3 | [] | no_license | import os
import sys
from abc import ABCMeta, abstractmethod # 抽象类 abstract
from time import sleep # 休眠
import numpy as np
import pydoc
import collections.abc
print('------------------------------------')
"""
python之面向对象
类的内建函数 - 描述器 : 指的是属性指向了一个描述器对象,描述器对象实现了三个方法: __set__, __get__, __delete__
... | true |
a157c1af81e5cc1cf40cc3109087ce73874cc9b6 | shivamb/cyberoamCliClient | /loginClient.py | UTF-8 | 1,539 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import datetime
import requests # Install with 'pip install requests'
import os # For reading env vars
import xml.etree.ElementTree as ET
cr_login_url='http://192.168.0.1:8090/login.xml'
cr_keep_alive_url='http://192.168.0.1:8090/live'
cr_logout_url='http://192.168.0.1:8090/logout.xml'
cr_username=... | true |
ed3b366d34b95864e5bdbeb8de281bbb6a1cd5d9 | dcho6/IPRO497-Analytics-Team | /coding/twitter-fire-scraper/util.py | UTF-8 | 2,992 | 3.46875 | 3 | [] | no_license | import colorama
from tweepy import Status
from typing import Dict, Set
from models import Point
def status_to_url(status):
# type: (Status) -> str
"""Given a Status, return that status' url."""
return "https://www.twitter.com/statuses/{id}".format(id=status.id)
def flatten_status_dict(status_dict):
... | true |
6f9cfe48eeda17320835e37672258c3a1bb28a6c | leen19-meet/meet2017y1lab6 | /funturtle.py | UTF-8 | 1,766 | 3.4375 | 3 | [
"MIT"
] | permissive | def up():
global direction
direction = UP
print("you pressed UP")
old_pos= turtle.pos()
x= old_pos[0]
y= old_pos[1]
turtle.goto(x, y+10)
print(turtle.pos())
def down():
global direction
direction = DOWN
print("you pressed down")
old_pos= turtle.pos()
x= old_pos[0]
... | true |
e13373de66e5ff0678cda8b1ca71d6dcf8190317 | tanvee09/discord-bot | /get_from_reddit.py | UTF-8 | 706 | 2.875 | 3 | [] | no_license | import praw
import random
reddit = praw.Reddit(client_id = '<INSERT CLIENT ID HERE>',
client_secret = '<INSERT CLIENT SECRET HERE>',
user_agent = '<INSERT USER AGENT HERE>')
def get_posts(subreddit = 'meme') :
posts = []
for post in reddit.subreddit(subreddit).hot(l... | true |
db9e9f1f7c81312c76381cbab245250519839ffa | msu-ml/17spr_lingg_langford_lucero | /Code/Development/NeuralNet/src/python/HousingData.py | UTF-8 | 11,404 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 10 12:24:58 2017
@author: Michael Austin Langford
"""
import csv
import numpy as np
import os
class SubstitutionMethod(object):
NONE = 0
MEAN = 1
CLOSEST_VALUE = 2
CLOSEST_MEAN = 3
class HousingData(object):
def __init__(self,
filep... | true |
1d8057fc4b41958931be94176f2a969001419059 | one356/spyder2020 | /database/sqlitedb/20201228.py | UTF-8 | 816 | 2.734375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
@author:Administrator
@file:20201228.py
@time:2020/12/28
"""
# 读取excel文件保存到sqlite3中
import sqlite3
import os
import pandas as pd
current_address = os.path.dirname(os.path.dirname(__file__))
db_address = os.path.join(current_address,"test1.sqlite")
excel_address... | true |
1bef3d70a2bac024363f6a076ca45aaaaca0579a | saluk/pywright | /tools/text_checker.py | UTF-8 | 1,269 | 2.609375 | 3 | [] | no_license | import pygame
pygame.display.set_mode([5,5])
import os
os.chdir("..")
import sys
sys.path.append("core")
import core,libengine
def check_text(game):
core.assets.game = game
core.assets.stack = [libengine.Script()]
core.assets.cur_script.init()
def play_sound(*args,**kwargs):
pass... | true |
4d7f915a544e3d1a549d4662dc569ae17ee9cc06 | sarbani04/Line-Detection-Using-OpenCV | /displayGUI.py | UTF-8 | 1,796 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 15 20:31:08 2019
@author: Asus
"""
from tkinter import *
from tkinter import ttk
import tkinter as tk
import tkinter.messagebox
import csv
import os
def Display(file_path):
sroot = Tk()
sroot.title("CAMERA DETAILS")
width = 700
height = 400
screen_width = sroot.w... | true |
070ab8fb788a8bdd432f9fabd24d5063806a1cc6 | fallcreek/open-edx | /solutions/Week8/p4.py | UTF-8 | 895 | 3.3125 | 3 | [] | no_license | import random
def answer(seed):
random.seed(seed)
# random variables (no need to import random library)
k = 0.0+random.randrange(1,2,1);
r = 0.0+random.randrange(1,2,1);
a = 0.0+random.randrange(800,1200,100);
select = 0.0+random.randrange(8,15,1);
s = (1.*a)/10;
j = 0.0+random.randrange(1,3,1);
... | true |
681024caa76fa2239b94bc16f31e61a8d356a6e2 | chenjingtongxue/python | /5-3-5-write/5-3-5-write.py | UTF-8 | 546 | 2.515625 | 3 | [] | no_license | f = open("score.txt")
a=f.read()
L=a.split()
for i in range(0,len(L)):
L[i]=int(L[i])
c=[0,0,0,0,0,0]
for x in L:
if x>=90:
c[0]+=1
elif x>=80:
c[1]+=1
elif x>=70:
c[2]+=1
elif x>=60:
c[3]+=1
elif x>=50:
c[4]+=1
else:
c[5]+=1
f.close()#读取完毕
fw=op... | true |
622ff0bb6fa3dd1ff1787257db03bdd718716524 | michelle-xia/hospital-merge | /Encode.py | UTF-8 | 1,123 | 2.765625 | 3 | [] | no_license | import pandas as pd
from numpy import array
from numpy import argmax
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
from sklearn import linear_model
from sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression
from sklearn.model_sel... | true |
f86843b6623452f9dc14135c7445b3e162d6910d | SR2k/leetcode | /4/309.最佳买卖股票时机含冷冻期.py | UTF-8 | 1,603 | 3.515625 | 4 | [] | no_license | #
# @lc app=leetcode.cn id=309 lang=python3
#
# [309] 最佳买卖股票时机含冷冻期
#
# https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/description/
#
# algorithms
# Medium (62.62%)
# Likes: 1165
# Dislikes: 0
# Total Accepted: 164K
# Total Submissions: 261.7K
# Testcase Example: '[1,2,3,0,2]'
#
# ... | true |
fa2fa26ad5e2daba6bd117d8fac75cf51556ed5b | wblxyxolbkhv/beethon | /beethon/management/config.py | UTF-8 | 1,129 | 2.65625 | 3 | [
"MIT"
] | permissive | from typing import List, Type, Optional
from beethon.handlers.base import Handler
from beethon.handlers.dummy import DummyHandler
from beethon.services.base import Service
from beethon.utils.singleton import MetaSingleton
class BeethonConfig(metaclass=MetaSingleton):
def __init__(self):
self.__handlers =... | true |
0803de612ba5176b8f1ecc9b1971ab332b9d7b0c | mengluoc/InterAutoTest | /utils/ExcelUtil.py | UTF-8 | 1,946 | 3.71875 | 4 | [] | no_license | import os
import xlrd
# 自定义异常
class SheetTypeError:
pass
class ExcelReader:
# 1、验证文件是否存在,存在读取,不存在报错
def __init__(self, excel_file, sheet_by):
if os.path.exists(excel_file):
self.excel_file = excel_file
self.sheet_by = sheet_by
self._data = list()
else:... | true |
284222e678dfcf994bc45dfe105894a39d551e8c | project-rubick/master | /PositionData.py | UTF-8 | 7,759 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from math import floor
from TradeData import tradeData
#a collection of trades
class positionData:
__tickerList = list()
__realizedPnl = 0
__MTM = 0
__dailyPnl = 0
__riskExposure = 0
__singleRiskLimit = 0.3 # any single position can't exceed 30% of total Risklimit
__... | true |
e79c6da610eb221656fc64dd287f9662c9c4b00f | 10258392511/ImageAnalysis | /SparseModel/Mid_Project_Python_course_1/project1_all.py | UTF-8 | 5,738 | 3.25 | 3 | [] | no_license | # In this project we demonstrate the OMP and BP algorithms, by running them
# on a set of signals and checking whether they provide the desired outcome
import numpy as np
from omp import omp
from lp import lp
import matplotlib.pyplot as plt
#%% Parameters
# TODO: Set the length of the signal
# Write your code here... | true |
58420a930ec419cc7555f3e1a101209d60354df8 | Leonardo767/Abmarl | /abmarl/sim/wrappers/flatten_wrapper.py | UTF-8 | 7,662 | 3.203125 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | import copy
from gym.spaces import Box, Discrete, Tuple, Dict, MultiDiscrete, MultiBinary
import numpy as np
from .sar_wrapper import SARWrapper
def flatdim(space):
"""Return the number of dimensions a flattened equivalent of this space
would have.
Accepts a space and returns an integer. Raises TypeErr... | true |
f327c6632b6f58e9c45ebb58dd0336e6cd2075cb | jaelyangChoi/CodingTest | /dynamic_programming/N-Rook 2.py | UTF-8 | 1,140 | 3.28125 | 3 | [] | no_license | # https://www.acmicpc.net/problem/1767
n = int(input())
m = int(input())
k = int(input())
""" 핵심 skill
DP - 문제의 크기를 줄인다.
중복 회피를 위한 case 쪼개기
"""
# 현재 = 이전 * 현재를 만드는 경우의 수
# 변하는 것: n,m,k
# nxm 크기의 체스판에 룩 k를 놓을 수 있는 경우의 수
d = [[[-1] * (k + 1) for _ in range(m + 1)] for _ in range(n + 1)]
# nxm 크기의 체스판에 룩 k를 놓을 수 있는 경우... | true |
d263ab0f1bd5172aeef42852f102b4319df81d7f | roadev/MITx-6.00.1x_8 | /l3problem2C.py | UTF-8 | 225 | 3.328125 | 3 | [] | no_license | # REVIEW THIS CODE
end = raw_input("Enter and integer value: ")
i = 1
j = 0
int(end)
while i <= end:
j += i
i += 1
print(j)
# For edx's problem
# i = 1
# j = 0
# while i <= end:
# j += i
# i += 1
# print(j)
| true |
af9892ac82099f6b5f59fbd375db29ab87056ba3 | NiMusah/learning_python | /how_to_import.py | UTF-8 | 206 | 3.484375 | 3 | [] | no_license | #import math module
import math
#mathematical functions
#pow()
print(math.pow(30,2))
#pi
print(math.pi)
#import os module
import os
files= os.listdir()
for file in files:
print(file) | true |
8ebf5808015f0545055a576b49602580efbcb4b7 | HaoHuynh0301/Drunk-Analysis | /fit_setup.py | UTF-8 | 3,328 | 2.640625 | 3 | [] | no_license | import keras
import pandas as pd
import numpy as np
import matplotlib as mpl
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense
from keras import backend as K
from load_da... | true |
d61887e0fe0e88eb393a979260f7373c938c617e | ra1993/banking_terminal2 | /view.py | UTF-8 | 731 | 3.65625 | 4 | [] | no_license | import model
def show_mainmenu(): #first user prompt
print("Hello. Please choose an option:")
print("1. Create an account")
print("2. Login")
print("3. Exit Terminal")
option = input()
while option not in ['1', '2', '3']:
option = input("Sorry, invalid input. Try again.")
... | true |
e2b81754677ebe04824aa9729af983c250a517da | aryansarkar13/Tata-Global-Forcasting | /LinearRegression.py | UTF-8 | 1,845 | 2.96875 | 3 | [] | no_license | # Import Modules
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
scaler = MinMaxScaler(feature_range=(0, 1))
# Input Data
df = pd.read_csv('NSE-TATAGLOBAL.csv')
df['Date'] = pd.to_datetime(df.Date... | true |
b027f0eb19ad37d7a3aa7ed25d91ac383c30d624 | melbshark/bowser | /wrapper.py | UTF-8 | 3,405 | 2.53125 | 3 | [] | no_license |
import datetime as datetime
import zipfile
# Configure path
import sys
sys.path.append("/Users/rotlogix/Tools/mobile/android/androguard")
# Configure terminal colors
from blessings import Terminal
t = Terminal()
# Attempt Androguard import
try:
from androguard.core.analysis import analysis
from androguard.c... | true |
3141854b9229226a9e3c33d2359a1fdcc4d2d6ae | binjiezhang0626/Summer-project | /pendulum/double/load_double_pendulum.py | UTF-8 | 4,047 | 2.890625 | 3 | [] | no_license | import random
import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
from math import sin
from math import cos
from math import acos
from scipy.integrate import odeint
class DoublePendulum(object):
def __init__(self, m1, m2, l1, l2):
self.m1, self.m2, self.l1, self.l2 = m1, m... | true |
746b1bcbfa36b5dadc5cfcb00a096b97b9196618 | ZLEternity/Elasticsearch_Demo | /util/twitter_util.py | UTF-8 | 1,909 | 2.640625 | 3 | [] | no_license | import random
import string
from util.commands import *
import datetime
from elasticsearch import Elasticsearch
from elasticsearch.helpers import scan, bulk
_name_prefix_list = ['James', 'Arthur', 'Smith', 'Jinks', 'Marvel', 'DC', 'Dr.', 'Sr.']
_date_range = [str(datetime.datetime.today() - datetime.timedelta(days=x))... | true |
54b4cd41f0e1622a15364eca943eb16c172a9e1d | tenmilliondollars/PythonHW | /hw3.py | UTF-8 | 315 | 3.515625 | 4 | [] | no_license | a=input("Введите строку\n")
a=a.lower()
a = a.split(" ")
b = {}
for i in a:
if i in b:
b[i] += 1
else:
b[i]=1
maxi = 0
for key,value in b.items():
if value > maxi:
maxi= value
for key,value in b.items():
if value == maxi:
print(value , '-' , key) | true |
c5e00605600f8567021e8defd35d42b0561f0439 | TobiasNorlund/LIS-Images | /classification_base.py | UTF-8 | 1,449 | 2.625 | 3 | [] | no_license | # For reading and writing csv files
import csv
import sklearn.linear_model as sklin
import sklearn.metrics as skmet
import sklearn.cross_validation as skcv
import sklearn
import sys
import h5py
import numpy as np
def get_features(row):
return np.array([row]).astype(np.float)
# Define score function
def score(gtr... | true |
0ba304c8b717832d8668401384e6041e3be08551 | tkchris93/ACME | /One/Plotting/mysolutions.py | UTF-8 | 1,739 | 3.875 | 4 | [] | no_license | # name this file 'solutions.py'
"""Volume I Lab 3: Plotting with matplotlib
Tanner Christensen
Sept 18, 2015
"""
# Add your import statements here.
from matplotlib import pyplot as plt
import numpy as np
from mayavi import mlab
# Problem 1
def curve():
"""Plot the curve 1/(x-1) on [-2,6]. Plot the tw... | true |
3499ab40cf4ca8f6c67c2fec0be9911ca8e60190 | luyanfei/algorithm016 | /Week_02/offer40.least-k-numbers.py | UTF-8 | 387 | 3.0625 | 3 | [] | no_license | class Solution:
def getLeastNumbers(self, arr: List[int], k: int) -> List[int]:
heap = []
for x in arr:
if (len(heap) < k):
heapq.heappush(heap, -x)
else:
if (len(heap) > 0 and -heap[0] > x):
heapq.heappop(heap)
... | true |
9e8c5e1a67089b5362a0e2c3cf9ad69031c47fa1 | Choewonyeong/Standard_Project2 | /method/dbList.py | UTF-8 | 344 | 2.765625 | 3 | [] | no_license | from os import listdir
import setting
def checkDirectory(year):
if f"{str(year)}.db" in listdir(setting.dirDatabase):
return False
else:
return True
def returnMainList():
fileNames = []
for fileName in listdir(setting.databaseMain):
fileNames.append(fileName.replace('.db', ''... | true |
764b7be04836e0c78af30c6de70a1318295319d2 | WilliamGalindezArias/Computer-Vision-Finding-Lane-Lines-for-Autonomus-Vehicles | /helper_functions_2.py | UTF-8 | 18,924 | 2.515625 | 3 | [] | no_license |
# coding: utf-8
# #### Libraries
# In[6]:
import cv2
import numpy as np
import pickle
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import glob
class Line():
def __init__(self):
self.detected = False
self.recent_x_fitted = []
self.bestx = None
self.best_fit ... | true |
511f3439278f481c6d71279b2e033c440d62c229 | y4lp/leets-easy | /929 - Unique Email Addressed.py | UTF-8 | 511 | 2.953125 | 3 | [] | no_license | import re
class Solution:
def numUniqueEmails(self, emails: "list[str]") -> int:
e = set()
for email in emails:
at = email.find('@')
local = email[:at]
domain = email[at:]
local = re.sub(r'\.', '', local)
local = re.sub(r'\+.*', '', local... | true |
c27216123898365011e48190bae66a7ddc9ed8a7 | DidiMilikina/DataCamp | /Data Engineer with Python/03. Software Engineering for Data Scientists in Python/02. Writing a Python Module/07. Listing requirements in setup.py | UTF-8 | 841 | 3 | 3 | [] | no_license | '''
Listing requirements in setup.py
We created a setup.py file earlier, but we forgot to list our dependency on matplotlib in the install_requires argument. In this exercise you will practice listing your version specific dependencies by correcting the setup.py you previously wrote for your text_analyzer package.
Ins... | true |
c2fb84d60a5130a1c2670ab7a9742217874ce8c1 | abom/pyparsec | /pyparsec/pyparsec.py | UTF-8 | 5,023 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | from functools import reduce
import string
flatten = lambda l: [item for sublist in l for item in sublist]
class Maybe:
pass
class Just(Maybe):
def __init__(self, val):
self.val = val
def __str__(self):
return "<Just %s>"%str(self.val)
class Nothing(Maybe):
def __str__(self):
... | true |
a833e2f7e8f70a1db27d0378dda784e2cbe10d8e | basicAlgo/algo | /python/yhs/완전탐색/백준6064.py | UTF-8 | 1,594 | 3.21875 | 3 | [] | no_license |
# 최종정답
from math import gcd
n = int(input())
sol = []
for i in range(n):
a, b, c, d = map(int, input().split(' '))
e = (a*b) // gcd(a,b)
f = 0
start = c
if b==d:
d = 0
while start <= e:
if start%b == d:
f = 3
sol.append(start)
star... | true |
4ac9560ad5a3b5bb93b20bf93991927c35f2d122 | darcy-amadio/Lab1 | /main.py | UTF-8 | 1,871 | 3.953125 | 4 | [] | no_license | #question 1 # my codes are commented out.
# print('What is your first name?')
# first_name = input() #first name is typed
# print('What is your last name?')
# last_name = input() #last name is typed
# print('Hi', last_name, first_name) #prints name out
#question 2
# print('What is your number?')
# given_... | true |
94952419965a460c018089b2d2afcaacb4501269 | AlisonRosenzweig/python_practice | /largestprimefactor.py | UTF-8 | 293 | 3.078125 | 3 | [] | no_license | number = 600851475143
def is_prime(x):
for y in range(2,int(x**.5+1)):
if x % y == 0 :
return False
return True
sqrt = int(number**.5 + 1)
print sqrt
for x in range(3, sqrt) :
if number % x == 0 :
if is_prime(x):
print x
elif is_prime(number/x) :
print number/x
| true |
348d731ca3db38126a7a8dc6c9d9b95cf8e4a1ab | TungstenRain/Random-Python-Challenges | /list_comprehensions.py | UTF-8 | 1,980 | 4.59375 | 5 | [] | no_license | """
Author: Frank Olson
Let's learn about list comprehensions!
You are given three integers x, y, and z representing the dimensions of a cuboid along with an integer n.
Print a list of all possible coordinates given by (i, j, k) on a 3D grid where the sum of i + j + k is not equal to n.
H... | true |
a910b4d56394f91657a426f79a41d05b2e34b7e1 | its-rose/Python_3.8_Homework | /Chapter 1.3.py | UTF-8 | 4,616 | 3.6875 | 4 | [] | no_license | # Задание 1. Выведите все элементы списка которые меньше 5.
# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
# for i in a:
# if i < 5:
# print(i)
# Задание 2. Нужно вернуть список который состоит из элементов, общих для этих двух списков.
# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
# b = [1, 2, 3, 4, 5, 6, 7,... | true |
1fd5bb403970068640564d5aad922198f69fca8c | agis09/Kaggle_past | /ToxicCommentClassification/random_forest.py | UTF-8 | 2,382 | 2.71875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer,CountVectorizer
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_val_score
from scipy.sparse import hstack
from scipy.special import logit, expit
class_names = ['tox... | true |
4d142467f834ed5f4da76e35806b8f1e89b47cde | universal-intelligence-laboratory/dead_lock | /dead_op.py | UTF-8 | 3,258 | 2.90625 | 3 | [] | no_license | import torch
import torch.nn.functional as F
from torch import nn, cuda
from torch.autograd import Variable
class DeadConv2d(nn.Conv2d):
def __init__(self, *args, **kwargs):
super(PartialConv2d, self).__init__(*args, **kwargs)
self.dead_lock = Variable(torch.ones([self.out_channels], requires_grad... | true |
107495616cf83880860527aaff1b65de1ab368ae | Edgaras12345/mokslai | /pamoka_1/2_mathematics.py | UTF-8 | 134 | 2.875 | 3 | [] | no_license | print(2+2)
print(3*3)
print(5/3)
print((100*2)+(200*2))
sure=(2*100)
simtas=70+30
print('=======================')
print(sure/100) | true |
0a9af9d568c50f3f0c6d09cdbad2c3b8bb10e2ae | Mechami/slo_scraper | /tests/checkData.py | UTF-8 | 5,322 | 2.75 | 3 | [] | no_license | ####
# This file contains expected data for a selection of programs to check against during unit tests
####
as_in_comp = {
'pid': '714',
'super_program': 'Computer Science',
'program': 'Computer Programming',
'plos': ['Design and implement basic software solutions using the building blocks of modern com... | true |
4c24766a6f9c71adb81efc3884ca9bdc7e221d99 | MJLMills/rhorix | /ParseTopology.py | UTF-8 | 8,304 | 2.96875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause-LBNL"
] | permissive | # ParseTopology Python 3 Module
# Rhorix: An interface between quantum chemical topology and the 3D graphics program Blender
# Rhorix uses the ElementTree API, a simple and lightweight XML parser included in Python 3.
# Please be aware of XML vulnerabilities! https://docs.python.org/3/library/xml.html#xml-vulnerabilit... | true |
92e3b37c8e835ca1afd043cdf47a22e8405d5815 | jiadaizhao/LeetCode | /1001-1100/1034-Coloring A Border/1034-Coloring A Border.py | UTF-8 | 815 | 2.671875 | 3 | [
"MIT"
] | permissive | class Solution:
def colorBorder(self, grid: List[List[int]], r0: int, c0: int, color: int) -> List[List[int]]:
def dfs(r, c, color):
grid[r][c] = -color
for nr, nc in (r-1, c), (r+1, c), (r, c-1), (r, c+1):
if 0 <= nr < len(grid) and 0 <= nc < len(grid[0]) and grid[nr... | true |
a693eab4dbfc09da5742553c42f0c286bc1c3428 | makkrnic/ppj_lab_g14 | /lab2_GSA/GSA.py | UTF-8 | 2,313 | 3.078125 | 3 | [] | no_license | #generator sintaksnog analizatora
import sys
from napraviEnka import napraviEnka
from pretvoriuDka import pretvoriuDka
from izradiLRtablicu import izradiLRtablicu
#ucitavanje ulazne datoteke
#ulaz = [redak[:-1] for redak in sys.stdin.readlines()]
ulaznaDatoteka = open(r"test.san", 'r')
ulaz = [redak[:-1] fo... | true |
03a48ea7bf56dd2572da9ba4665d96a705a07eb0 | mannickutd/project_euler | /src/questions/question_2.py | UTF-8 | 531 | 3.46875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Description of question 2
Nicholas Staples
2014-04-14
"""
from utils.include_decorator import include_decorator
description = '''
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 1... | true |
4135376cbc10a47b024685c013accc4df9090b72 | Yozi47/Data-Structure-and-Algorithms-Class | /Homework 6/Queues.py | UTF-8 | 2,231 | 4.0625 | 4 | [] | no_license | # Abstract Data Type : Queue
# Queue Q supports
# Q.enqueue(e) : add element e to the "back" of the queue Q
# Q.dequeue() : removes and returns the first element of the queue Q
# Q.first() : Return a reference to the first element of the queue Q
# Q.is_empty() : return true if Q does not contain any elements
# len(Q) :... | true |
be9f2f7995e11bc0956d6bacf67b612a4f00eb58 | acmfi/AdventCode | /2016/day04/rock/rooms.py | UTF-8 | 784 | 3.1875 | 3 | [] | no_license | import re
from collections import Counter
import itertools
roomreg = re.compile("(([a-z]+-)+)([0-9]+)\[([a-z]+)\]")
def extract_data(line):
grs = roomreg.search(line).groups()
return "".join(grs[0].split("-")), int(grs[2]), grs[3]
def get_hash(d):
c = Counter(d).most_common()
return "".join([''.join... | true |
9198666f46f12575007d3b47dab3efd2823e8f9f | junior08/Competitive-Programming-CodeChef | /peripali.py | UTF-8 | 258 | 2.984375 | 3 | [] | no_license | for i in range(int(input())):
n,p=[int(x) for x in input().split()]
if p==1 or (n==2 and p==2) or p==2 or n%p!=0:
print('impossible')
elif n==p:
print('a'+'b'*(n-2)+'a')
else:
print(('a'+'b'*(p-2)+'a')*(n//p))
| true |
28df5d5c8b9074a1634966b185a0763259f24a09 | williamgriffiths/Competitive-Programming | /Codeforces/281A. Capitalization.py | UTF-8 | 105 | 3.796875 | 4 | [] | no_license | word = input("")
chars = [char for char in word]
chars[0] = chars[0].upper()
print("".join(chars))
| true |
9b780270e330f65c6b6ce3fa563772d266d2052d | rafal-mizera/ALX_programowanie_w_pythonie | /zjazd_online_19.04.2020/zadanie_znaki.py | UTF-8 | 902 | 3.5625 | 4 | [] | no_license | #wiecej_niz('ala ma kota a kot ma ale',3 )
# {"a"," "}
def wiecej_niz(napis,liczba):
zbior = set()
for znak in set(napis):
if napis.count(znak) > liczba:
zbior.add(znak)
return zbior
# def wiecej_niz(napis,liczba):
# zbior = set()
# zbior2 = set()
# for znak in set(napis):... | true |
92dbdadc8e3fc4323ed1f5ebb28a8f7689d988f7 | jfkocher/Python_Code | /Data Request/Batch_v3/main.py | UTF-8 | 1,989 | 3.265625 | 3 | [] | no_license | '''
The purpose of this python script is to produce a program, that when run, will provide two input options:
1. File path
2. Type of directory
One inputted, the program will create a directory with sub folders for data requests.
The best package to use may be Tkinter.
'''
from tkinter import *
from tkinter.ttk import... | true |
7bb3e20613f0826fecca5c360614b3a97fb89acd | maam6073/Python_tutorial | /_07_class.py | UTF-8 | 2,002 | 4.15625 | 4 | [] | no_license | # 1) class란?
# 함수 => 기능,계산,절차
# 기능들이 여러 개가 생겼다
# 기능들을 비슷한 종류로 묶고싶다
# 한번에 묶어서 관리하면 더 좋겠다
# => 클래스
#
# 변수가 여러개
# 공통분모가 있다
# 마치 사람의 이름, 나이, 주소...
# 묶어서 관리하면 좋겠다
# => 클래스
#
# 사람의 이름,나이,주소 (변수)
# 행동, 정보보여주기 (함수)
# 공통분모(같은 종류)
# =>클래스
# a) 필드(변수) + 메서드(함수)들의 집합
# b) 시대가 흐르면서 함수보다 큰 단위가 프로그래밍 환경... | true |
52642d449a1eb2b308d34540553c3919f77505be | viiicky/mit6.006 | /lecture6_code/avl_test.py | UTF-8 | 10,084 | 3.421875 | 3 | [] | no_license | import unittest
from avl import *
class AVLTest(unittest.TestCase):
def setUp(self):
self.tree1 = AVL()
self.tree1.insert(23)
self.tree1.insert(8)
self.tree1.insert(4)
self.tree1.insert(16)
self.tree1.insert(15)
self.tree1.insert(42)
def testInsert(self... | true |
aeb48d79975f24fe60d16ba3c5482c53e68ce814 | kerlomz/captcha_trainer | /utils/category_frequency_statistics.py | UTF-8 | 2,702 | 2.515625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: kerlomz <kerlomz@gmail.com>
import re
import os
import json
from config import ModelConfig, LabelFrom, DatasetType
ignore_list = ["Thumbs.db", ".DS_Store"]
PATH_SPLIT = "/"
def extract_labels_from_filename(filename: str, extract_regex):
if filename.split("/... | true |
ab2b2c1849a263052bfbbcb1be4235bd8a920aab | ukwksk/orreilly-deep-learning | /chapter03/section3_4_three_layer_NN.py | UTF-8 | 1,787 | 3.234375 | 3 | [] | no_license | import numpy as np
from chapter03.sectino3_2_activating_function import np_sigmoid
def layer(A, W, b):
z = np.dot(A, W) + b
return z
def identity_function(x):
return x
def middle_layer(A, W, b):
return np_sigmoid(layer(A, W, b))
def last_layer(A, W, b):
print(Y)
return identity_function... | true |
ff505541fed49eb7e23420aea04092fe4cf16df3 | bwbobbr/AI | /机器学习/day_05/picture读取案例_类似csv文件读取.py | UTF-8 | 1,996 | 3.015625 | 3 | [] | no_license | import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
def picture_read(file_list):
'''
图片文件的读取案例
:param file_list: 文件路径 + 文件名
:return: 图片的内容
'''
# 1 构建图片列队
file_queue = tf.train.string_input_producer(file_list)
# 2 构建图片阅读器(默认一次读取一张图片)
readers = tf.WholeFile... | true |
15f5d5494967109362c7bf7b32854dab6423e8a6 | Whenning42/GameHarness | /src/time_writer.py | UTF-8 | 1,473 | 2.8125 | 3 | [
"MIT"
] | permissive | # Call SetSpeedup() to change the time acceleration multiple for client programs listening on
# the given channel.
import subprocess
import time
import struct
import posix
FIFO = "/tmp/time_control"
f = None
def SetSpeedup(speedup, channel = ""):
global f
speedup = float(speedup)
# Opening the file for r... | true |
3f4595410b4b871a5ffb640077bbb703974c41a3 | studio-design/distributed-load-testing-using-kubernetes-locust | /locust/spike_load.py | UTF-8 | 3,160 | 2.515625 | 3 | [] | no_license | from collections import namedtuple
# Generate a lock to wait until all users are created.
from gevent.lock import Semaphore
from locust import TaskSet, task, events, LoadTestShape, FastHttpUser
# All users lock
all_users_spawned = Semaphore()
all_users_spawned.acquire()
#
# User Amount
#
user_amount = 20000
# Hold... | true |
873c2833fdf3f5ffc9df8a13fa721e422651b238 | jmoh3/signll_demos | /yelp_demo/logistic_regression_pytorch.py | UTF-8 | 2,831 | 3.421875 | 3 | [] | no_license | import torch
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer
# load csv
df = pd.read_csv('yelp_reviews.csv')
# split up our dataset into train and test sets using a handy sklearn function
X_train, X_test, y_train, y_test = train_test... | true |
46d96592cabe4c4818ba9cb0c901579ae4f625be | KarolCee/Gender-Recognition-HPS | /recognizer.py | UTF-8 | 2,050 | 3.078125 | 3 | [] | no_license | from numpy import *
from scipy import *
import numpy as np
import scipy.io.wavfile
from scipy import signal as sig
import warnings
import sys
warnings.filterwarnings("ignore")
def funkcja(nazwa_pliku):
#czytamy plik i wyciagamy czestotliwosc probkowania
w, signal = scipy.io.wavfile.read(nazwa_pliku)
#je... | true |
26fa350930e6c7287a61fccc7c7a64a2f3bd3815 | rapidsai/cuspatial | /python/cuspatial/benchmarks/api/bench_api.py | UTF-8 | 8,853 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2022, NVIDIA CORPORATION.
import cupy
import geopandas
import cudf
import cuspatial
def bench_io_from_geopandas(benchmark, host_dataframe):
benchmark(cuspatial.from_geopandas, host_dataframe)
def bench_io_to_geopandas(benchmark, gpu_dataframe):
benchmark(
gpu_dataframe.to_geopanda... | true |
6c92dd55ee6cd7ba5bba0f254c4ba1d628ce97c4 | beproud/beproudbot | /src/haro/plugins/uranai.py | UTF-8 | 1,156 | 2.671875 | 3 | [
"MIT"
] | permissive | import datetime
import requests
from slackbot.bot import respond_to
from haro.botmessage import botsend
from haro.decorators import call_when_sls_haro_not_installed
def star(n):
return '★' * n + '☆' * (5 - n)
def uranai(birthday):
today = datetime.date.today().strftime('%Y/%m/%d')
r = requests.get('htt... | true |
0bc623ba686d303d08a590e040b4ce7c1714aff6 | MikeTheFyke/Python | /lists.py | UTF-8 | 1,083 | 4.625 | 5 | [] | no_license | # An array of people
people = [
"Ricky",
"Julian",
"Bubbles",
"Mr.Lahey",
"Randy",
]
# First Access Method
print("\n")
print(people[0])
print(people[2])
print(people[4])
print("\n")
print("Last Position Is " + str(people[-1]))
# Second Access Method
print("Julian is #" + str(people.index("Julian")... | true |
66e14a7aa255020679a43e07e85a326ca25b809a | av3006/722f | /pyhop2/blocks_limited_stacks_actions.py | UTF-8 | 3,070 | 3.34375 | 3 | [
"BSD-3-Clause"
] | permissive | import pyhop2
"""Helper Functions"""
def get_block_above(state, block):
"""
return the block above the block passed into the func.
"""
if state.clear[block]: return None
for stack in state.stacks:
if block in stack:
return stack[stack.index(block)+1]
def get_stack_of_block(s... | true |
4b41992762ea337472a11fa7634c0a8b6f1e2b42 | sheilambadi/data-analysis-python | /kcse.py | UTF-8 | 1,745 | 3.5625 | 4 | [] | no_license | import csv
import numpy as np
import operator
def countAs():
# reading the kcse exam sheet
with open('KCSE_Exam_Results_2006_to_2010.csv', 'rt') as f:
rows = csv.DictReader(f)
schools_array = []
for row in rows:
grade_column_data = row['Grade attained']
school_n... | true |
2d649f994ced44f6a035c3386d4379da20573044 | mercurium/proj_euler | /refactor.py | UTF-8 | 398 | 2.75 | 3 | [] | no_license | import string, math
for i in range(1,500):
fileString = "old" + '0' * (2 - int(math.log(i,10)))+ str(i) + ".py"
try:
fileRead = open(fileString, "r")
except IOError:
continue
data = string.split(fileRead.read()," ")
fileRead.close()
data = string.join(data," ")
fileRead =... | true |
b634790842ae3849034928cd9b4dbfb2b3694fbe | gravyboat/python-exercises | /tests/ex22_tests.py | UTF-8 | 534 | 2.9375 | 3 | [
"MIT"
] | permissive | from nose.tools import *
from exercises import ex22
def test_caesar_cipher_decoder():
'''
Make sure our caesar cipher decodes the right string
'''
decoded_cipher_output = ex22.caesar_cipher_decoder('Pnrfne pvcure?')
assert_equal(decoded_cipher_output, 'Caesar cipher?')
def test_caesar_cipher_en... | true |
2912894f3e777beb3e4001790e8d4936db8975e7 | xiaodanhu/MUSE | /code/generator.py | UTF-8 | 4,180 | 2.765625 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
class Generator(nn.Module):
def __init__(self, n_channels, n_classes, weight, bilinear=True):
super(Generator, self).__init__()
self.n_channels = n_channels
self.n_classes = n_classes
self.bilinear = bilinear
... | true |
527f43e879ab86fc1c34cca46afa4326be8137a0 | nikonst/filesPythonCourse | /Section7Archiving/2-two.py | UTF-8 | 275 | 2.84375 | 3 | [] | no_license | import zipfile
with zipfile.ZipFile('newzip.zip', 'r') as zipobj:
#print(zipobj.namelist())
zipfilelist = zipobj.namelist()
for el in zipfilelist:
print(el)
zipExtract = zipfile.ZipFile('newzip.zip', 'r')
zipExtract.extractall('extractDir')
zipExtract.close()
| true |
8e5990321b4b56d1a3b3027260463399e8821b87 | james-hadoop/JamesPython | /james_util/date_util.py | UTF-8 | 1,444 | 2.984375 | 3 | [] | no_license | from datetime import datetime, timedelta
def make_stat_week_day_list(stat_date, plus_minus, offset, count):
statWeekDayList = []
sevenDayTimeOffset = timedelta(days=offset)
statDateTime = datetime.strptime(str(stat_date), '%Y%m%d')
for i in range(0, count):
dayOffset = sevenDayTimeOffset * i
... | true |
0c09ec94e6647100ceaaed1960bd2c0c7934dd67 | sarmishtaVelury/WTProject | /scraping/scrape.py | UTF-8 | 1,247 | 2.859375 | 3 | [] | no_license | from bs4 import BeautifulSoup
from urllib.request import urlopen
import csv
def scraper(domain,pageNumber):
html = urlopen("https://www.coursera.org/browse/data-science/"+domain+"?languages=en&page="+pageNumber)
soup = BeautifulSoup(html,'lxml')
soup = soup.find_all("a",attrs={"class": "rc-OfferingCard"})
title ... | true |