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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b8604dd0374921ac5c8591f7b6e8de0ddbe84279 | Python | juanjoneri/Bazaar | /Interview/Practice/CTCI/Trees-Graphs/pond_sizes.py | UTF-8 | 1,706 | 4 | 4 | [] | no_license | """
You have an integer matrix representing a plot of land, where the values at that
location represents the height above the sea level. Avalue of zero indicates water.
A pond is a region of water connected horizontally, or diagonally. The size is
the number of connected water cells. Find the sizes of all ponds.
"""
c... | true |
c1839f2c5089234ed493301d937e7a0538c2517c | Python | paigexx/email_validation | /flask_app/models/user.py | UTF-8 | 1,748 | 2.9375 | 3 | [] | no_license | from flask_app.config.mysqlconnection import connectToMySQL
import re
from flask import flash
email_regex = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
class User:
def __init__(self, data):
self.usernme = data["username"]
self.email = data["email"]
self.created_at = data... | true |
fc28df1e1fcf0fd1a74956d89a6771c51424cd2c | Python | Ekupka1/Python-Code | /EstPiOfDartsThrown.py | UTF-8 | 1,459 | 4.375 | 4 | [] | no_license | # Programming Assignment 1, Circle "Area"
# Ethan Kupka
# Sept 27th, 2019
# Programming Assignment 1, Circle "Area"
# Ethan Kupka
# Sept 27th, 2019
import random
import math
dart = int(input("How many darts are you throwing?"))
numdarts = dart
insideCount = 0
for i in range(numdarts):
randx = 2 * random.random(... | true |
c9afb62504e2cfb40a2841eb8b08cf9354cbdc2b | Python | zihuilee/test | /hashlib_test.py | UTF-8 | 123 | 2.5625 | 3 | [] | no_license | import hashlib
md5 = hashlib.md5(b'c8b388b4459e13f978d7c846f4')
md5.update('1234'.encode('utf-8'))
print(md5.hexdigest())
| true |
d9b99c3a539b5d586d8430602190e7e567f2356e | Python | RickyL-2000/python-learning | /business/方方/作业5/p1.py | UTF-8 | 605 | 3.078125 | 3 | [] | no_license | """
方方:
2.作业2: 鸡兔同笼问题
已知在同一个笼子里有n只正常的鸡和兔,鸡和兔的总脚数为m只,其中n和m由用户输入。问鸡和兔各有几只?如果无解也请说明。要求利用列表解析式来编程实现。
提示,两个分支的条件语句格式为:
if condition :
branch1
else:
branch2
编写代码,保存成.py格式,作为作业附件上传
下面给出了参考的运行示例:
"""
all_num = input("请输入鸡和兔共几只: ")
all_feet_num = input("请输入鸡和兔共几只脚: ")
chicken_num = 0
rabbit_num = 0
| true |
361c4c13c2fa394ed7e3063b35a182c3acd96311 | Python | wjj800712/python-11 | /chengxiangzheng/week5/Q2.py | UTF-8 | 495 | 3.765625 | 4 | [] | no_license | #要求随机返回一种商品,要求商品被返回的概率与其库存成正比。
import random
wazi=['wazi'] * 100
xiezi=['xiezi'] * 200
tuoxie=['tuoxie'] * 300
xianglian=['xianglian'] * 400
s1= wazi+xiezi+tuoxie+xianglian
s2 = random.sample(s1,100)
#print(s1)
#print(s2)
print(s2.count('wazi'),end=" ") #count()方法用于统计某个元素在列表中出现的次数。
print(s2.count('xiez... | true |
2b882c5e3d81d3952a079ecf8b796fc36997851b | Python | NigrumAquila/py_checkio | /electronic_station/digits_multiplications.py | UTF-8 | 151 | 2.828125 | 3 | [
"MIT"
] | permissive | import functools
def checkio(number: int) -> int:
return functools.reduce(lambda x,y:x*y, [int(char) for char in str(number) if not char == '0']) | true |
04cfd4dfcd2b5fe1c3b69258dce16488f428d4d7 | Python | mukundajmera/competitiveprogramming | /Sorting/Count possible triangles.py | UTF-8 | 1,387 | 3.640625 | 4 | [] | no_license | # User function Template for python3
class Solution:
def findNumberOfTriangles(ob, arr, n):
arr.sort()
count = 0
# traversing through the array elements
for i in range(n - 2):
k = i + 2
for j in range(i + 1, n):
while (k < n and arr[i] + arr... | true |
27d232e757d53f5c12a484c267c4817325449d14 | Python | DipanwitaManna16/Image_Processing | /app1_basics.py | UTF-8 | 1,525 | 3.15625 | 3 | [] | no_license | import cv2
import numpy as np
img = cv2.imread("Images\WhatsApp Image 2020-09-06 at 10.46.51 AM.jpeg")
print(type(img))
print(img.shape)
#----------------------------gray_image---------------------
#img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#---------------------------Resize the image-------------... | true |
2d9c12e09ff90491664a3c8d3d90a9344e80deb5 | Python | AzureAD/microsoft-authentication-library-for-python | /sample/migrate_rt.py | UTF-8 | 2,851 | 2.859375 | 3 | [
"MIT"
] | permissive | """
The configuration file would look like this:
{
"authority": "https://login.microsoftonline.com/organizations",
"client_id": "your_client_id",
"scope": ["User.ReadBasic.All"],
// You can find the other permission names from this document
// https://docs.microsoft.com/en-us/graph/permissi... | true |
45f439afdfc56af018f733ecbbd66f7590b3a297 | Python | huchangchun/spider | /01-spider/practice/01-wangyi-music.py | UTF-8 | 9,215 | 3.046875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""
1.抓取所有的分类的id,然后拼接出对应的分类的链接
2.访问分类的链接,抓取所有歌单(专辑)的详细页面的链接
3.访问详细页面的链接,抓取所有歌曲的详细页面的链接
4.抓取歌曲的信息(歌名,歌手名,分类信息),存储到文本csv或者txt等)或数据库里
5.将歌曲名传递给download_music实现,下载对应音乐文件(这个操作可以只下载一首)
"""
"""
分析:
1、入口:http://music.163.com/discover/playlist/
2、每页每个播放列表入口:"baseurl+ //div[@class='u-cover ... | true |
e310762d0e05b9ecc078827a00b6389ea87e10d9 | Python | JakobKallestad/Python-Kattis | /src/VideoSpeedup.py | UTF-8 | 328 | 3.0625 | 3 | [] | no_license | n, p, k = map(int, input().split())
p /= 100
speedups = list(map(int, input().split()))
speedups.append(k)
original_time = 0
prev_time = 0
current_increase = 1
for inc in speedups:
duration = inc - prev_time
original_time += duration*current_increase
current_increase += p
prev_time = inc
print(original_... | true |
641ba6e7707e7127ca943bd5b14f3c2d37c8a44b | Python | Why-are-we-doing-this/SuperSmashBrars-Discord- | /People/emily.py | UTF-8 | 938 | 2.71875 | 3 | [] | no_license | import random
from Character import Character
import discord
from discord.ext import commands
class Emily(Character):
def __init__(self):
super().__init__("Emily", title="2-Dimensional", hp=1300, attack=220, dodge=20, crit=20, defense=20,
gender=1, critValue=2, srec = 6)
async... | true |
b08c181de465201b6540a67eeae3a37c1292b695 | Python | Aasthaengg/IBMdataset | /Python_codes/p02612/s529001506.py | UTF-8 | 85 | 3.265625 | 3 | [] | no_license | n = int(input())
chk = n % 1000
if chk != 0:
print(1000-chk)
else:
print(0)
| true |
69bda0bd5a57dc292d7f8006ffe42b2017564867 | Python | Maelstrom6/MachineLearning3 | /Regression/Simple Linear Regression/Simple Linear Regression.py | UTF-8 | 1,159 | 3.15625 | 3 | [
"MIT"
] | permissive | from builtins import print
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
# Import the data set
dataset = pd.read_csv("Salary_Data.csv")
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 1]... | true |
21f8998c1c0149ffaf54444c6b46310205a10a51 | Python | antogeo/scikit-learn | /examples/model_selection/plot_roc_crossval.py | UTF-8 | 4,236 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | """
=============================================================
Receiver Operating Characteristic (ROC) with cross validation
=============================================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality using cross-validation.
ROC curv... | true |
fc215557c19142926c4a899d365230ed9d270aaa | Python | dielhennr/datavis_project | /data_exploration.py | UTF-8 | 4,217 | 2.96875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.path as path
import matplotlib.cbook as cbook
import pandas as pd
def top_consumers_2014():
ifile = open('energy.csv', 'r')
states = {}
for i in range(2755):
ifile.readline()
for line in ifile:
line = ... | true |
5d30d42b0d01da78dbd3efb4c7bee7e3590dd5cb | Python | etwit/LearnPy | /Day3/ex13.py | UTF-8 | 813 | 3.703125 | 4 | [] | no_license | #!/usr/bin/env python
#_*_coding:utf-8_*_
'''
Created on 2017年7月24日
@author: Ethan Wong
'''
def function(arg):
print arg
function('alxe')
#也可以通过 apply执行函数
#print apply(function('aaa'))
def foo(arg):
return arg + 100
li = [11,22,33]
temp = []
for item in li:
temp.append(foo(item))
print temp
#map可以替换以上函数... | true |
bb5aa3eabc830d69e1583236b848d286556fa4d1 | Python | ankitaggarwal011/s-index | /code/reach.py | UTF-8 | 541 | 2.8125 | 3 | [
"MIT"
] | permissive | def dp(n, cutoff):
memo = [[None] * cutoff for _ in range(n)]
dp()
def reach(p, h, adj, visited, cutoff):
if p is in visited:
return None
if h > cutoff:
return None
visited.add(p)
if dp.memo[p][h] is not None:
return dp.memo[p][h]
rp = len(adj[p]) * (2 ^ h)
np = 1
hp = h
for q in adj[p]:
reach_tu... | true |
d78033f4ed657062c0e9f0a8b4c3f17510ee45eb | Python | ayesha-omarali/cs170proj | /solutions.py | UTF-8 | 1,880 | 3.1875 | 3 | [] | no_license | # rough pseudo code because it's late and I don't
# really quite know python well enough to write this correctly
import sys
class solutions:
def __init__(self, instances, sol_file_object):
#given zip file of instances
self.instances = instances
#no clue if this is right
for instance in self.instances:
... | true |
4810d4e925a53396fffbe42a5ee5dae88e6cfc7e | Python | liupy525/LeetCode-OJ | /36_Valid-Sudoku.py | UTF-8 | 1,611 | 3.734375 | 4 | [] | no_license | #!/usr/local/env python
# -*- coding: utf-8 -*-
'''
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
A partially filled sudoku which is valid.
'''
class Solution:
# @param board, a 9x9 2D a... | true |
eb493c4794cc70300013b44d7af4e755411bdf06 | Python | UIUCLibrary/DCC_MigrationTools | /MigrationTools/Finders.py | UTF-8 | 2,143 | 3.046875 | 3 | [] | no_license | import os
import re
import pickle
def check_valid_path(func):
def call_func(*args, **kwargs):
path = args[1]
if not os.path.exists(path):
raise FileNotFoundError("Path \"{}\" not found.".format(path))
return func(*args, **kwargs)
return call_func
@check_valid_path
def fin... | true |
0357e731dc07d7d4ca63986da3e623c53d1835b2 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_206/730.py | UTF-8 | 1,119 | 3.5625 | 4 | [] | no_license | from decimal import *
getcontext.prec=(10)
class horse:
def __init__(self,startPos,speed):
self.startPos=startPos
self.speed=speed
def GetMaxSpeed(D,horses):
maxSpeed=None
#For each horse, reduce our max speed so we won't get a violation
for h in horses:
#We want to finish at ... | true |
008eebf9c395e9f5d909c40b175d11bfff13ee39 | Python | andresberejnoi/CPU_simulation | /CPU16/asm_parser_v0.4.py | UTF-8 | 9,766 | 3.203125 | 3 | [
"MIT"
] | permissive | #Parse assembly code and generate the appropriate machine language for the program
import sys
#===============================================================================
DIC_COMMANDS = {#First, deal with normal instructions
'load': 0x44000000,
'loadi': 0x48000000,
... | true |
229ab288d5f39bb850efa1ab8dd330d8174324d0 | Python | vlasovskikh/obraz | /test/data/plugins/src/_plugins/plugin1.py | UTF-8 | 977 | 2.578125 | 3 | [
"MIT"
] | permissive | from __future__ import unicode_literals
import csv
import os
import obraz
@obraz.loader
def load_capitals(path, config):
test1_site = config.get("test1", {})
capitals_filename = test1_site.get("capitals_filename", "capitals.csv")
if path != capitals_filename:
return None
with open(os.path.join... | true |
167c3cca99444587c5c61454830e01ccc52a61d3 | Python | daveb-dev/glimslib | /glimslib/simulation_helpers/math_reaction_diffusion.py | UTF-8 | 135 | 2.515625 | 3 | [
"MIT"
] | permissive | # -- logistic growth
def compute_growth_logistic(conc, prolif_rate, conc_max):
return prolif_rate * conc * ( 1 - conc / conc_max)
| true |
a46bf9e6236a197d7c482a638d834112dea45463 | Python | airone-cenerino/atcoder | /B問題/ABC116B.py | UTF-8 | 192 | 3.234375 | 3 | [] | no_license | a = int(input())
l = [a]
b = a
c = 1
while True:
if b % 2 == 0:
b = int(b/2)
else:
b = 3 * b + 1
c += 1
if b in l:
break
l.append(b)
print(c)
| true |
513f5901b898f4da35aa87a31a7896c6339ab999 | Python | Pravin2796/python-practice- | /chapter 3/2.slicing.py | UTF-8 | 106 | 3.390625 | 3 | [] | no_license | #greeting = "good morning,"
name = "pravin"
#c= greeting + name #concatinating two strngs
print(name[:-1]) | true |
429763f57af8404b0fa4d2220480f2c4b16f151a | Python | shafiul-haque-johny/MonteCarloArea | /Problem2(Ass-02).py | UTF-8 | 1,683 | 3.125 | 3 | [] | no_license | import math
import random
import numpy as np
import matplotlib.pyplot as plt
# plt.plot([0, 1], [0, 1], color='Blue')
# plt.plot([4, 3], [0, 1], color='Blue')
rectangle = plt.Rectangle((0, 0), 4, 2, fc='none', ec="Blue")
plt.gca().add_patch(rectangle)
plt.xlim(left=-0.2, right=4.2)
plt.ylim(bottom=-0.2, ... | true |
c1fb1389821042cc41c148d726f4a54a3da631c4 | Python | markmuetz/cfg | /bin/tex_git_summary.py | UTF-8 | 5,486 | 2.734375 | 3 | [] | no_license | import os
from pathlib import Path
import subprocess as sp
import re
import datetime as dt
import pickle
from collections import defaultdict
import hashlib
import matplotlib
import matplotlib.pyplot as plt
def run(cmd):
return sp.run(cmd, check=True, shell=True, stdout=sp.PIPE, stderr=sp.DEVNULL, encoding='utf8'... | true |
3949ecd3930699f1d6010217e679e5510fe3cf9d | Python | Lawriegan/leetcode | /17 Letter Combinations of a Phone Number.py | UTF-8 | 628 | 3.328125 | 3 | [] | no_license | class Solution:
def letterCombinations(self, digits):
"""
:type digits: str
:rtype: List[str]
"""
map_list = ['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']
if len(digits) == 0:
return []
def map2num(button1, button2):
... | true |
1da412f6c5343dfa5f83e4d214503a73c903f6a1 | Python | byklo/mit-python | /algorithms/sorting/mergeSort.py | UTF-8 | 623 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python
import sys
def merge(a1, a2):
i1, i2 = 0, 0
a3 = []
while not (len(a1) == 0 and len(a2) == 0):
if len(a2) == 0:
a3.append(a1[0])
del a1[0]
elif len(a1) == 0:
a3.append(a2[0])
del a2[0]
elif a1[0] <= a2[0]:
a3.append(a1[0])
del a1[0]
else:
a3.append(a2[0])
del a2[0]... | true |
f7e74826255430e657e5893f6755005df34bbb1b | Python | google-code/0xic-zex | /Python/BL2SAVEFILE/savefile.py | UTF-8 | 22,904 | 2.640625 | 3 | [] | no_license |
#! /usr/bin/env python
import binascii
from bisect import insort
from cStringIO import StringIO
import hashlib
import json
import math
import optparse
import struct
import sys
class BL2Error(Exception): pass
class ReadBitstream(object):
def __init__(self, s):
self.s = s
s... | true |
d7857e25f26cccbc57156d1a39669ac1d322da9a | Python | AlbertUlysses/Coursera-Data-Structures-and-Algorithms | /algorithmic toolbox/week2/lcm.py | UTF-8 | 258 | 3.25 | 3 | [] | no_license | # Uses python3
import sys
def lcm_naive(a, b):
c = a
d = b
while d:
c, d = d, c%d
lcm = (a*b)//c
return lcm
if __name__ == '__main__':
input = sys.stdin.read()
a, b = map(int, input.split())
print(lcm_naive(a, b))
| true |
500dcc6130bf698f200cd238b71d3a55d3a211db | Python | wyaadarsh/LeetCode-Solutions | /Python3/0119-Pascals-Triangle-II/soln.py | UTF-8 | 333 | 2.875 | 3 | [
"MIT"
] | permissive | class Solution:
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
def pascal(row):
return [1] + [row[i] + row[i + 1] for i in range(len(row) - 1)] + [1]
row = [1]
for _ in range(rowIndex):
row = pascal(row)
... | true |
ab0b1f1dc038e932e591d0dbfd377cc508094936 | Python | afcarl/omscs-ml4t | /mc3_h1/gen_data.py | UTF-8 | 583 | 3.078125 | 3 | [] | no_license | """
template for generating data to fool learners (c) 2016 Tucker Balch
"""
import numpy as np
# this function should return a dataset (X and Y) that will work
# better for linear regresstion than random trees
def best4LinReg():
X = np.random.normal(size=(100, 20), loc=0)
return X, X[:, 19]
def best4RT():
... | true |
a46643a5f4a0377a20dfac36b7b20c899a173ff5 | Python | jschnab/data-structures-algos-python | /membership/bloom.py | UTF-8 | 425 | 3.296875 | 3 | [] | no_license | SIZE = 1000 * 1000
N_HASH = 7
class BloomFilter:
def __init__(self, size=SIZE, n_hash=N_HASH):
self.array = [0] * SIZE
def insert(self, item):
for i in range(N_HASH):
self.array[hash(item + str(i)) % SIZE] = 1
def __contains__(self, item):
for i in range(N_HASH):
... | true |
fff828826885cca885403c7e53bf3f01fffe856c | Python | lukasrandom/socket-dev | /src/network/server.py | UTF-8 | 4,800 | 2.78125 | 3 | [] | no_license | import threading
import json
import struct
import socket
import language.analyse
import pkg_resources
from utils import utils
class Requests(object):
ACTIONS_FROM_TEXT = "actions_from_text"
class Server(object):
def __init__(self):
super(Server, self).__init__()
self._text_analyser = languag... | true |
99201b95819a83ecbc5653feeb660375c6711f9d | Python | raabrp/rellipsoid | /rellipsoid/test_rellipsoid.py | UTF-8 | 6,978 | 2.828125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from pytest import approx
import numpy as np
from .rellipsoid import _rotmat, Planet, earth
def test_rotmat():
'''
unit test our axis-angle representation for rotations, since we use it
throughout
'''
x = np.array([1, 0, 0])
y = np.array([0, 1, 0])
z = np.array([0, 0, 1])
def r(a, b,... | true |
5f44ac62881492fc28c1fa129b7a9c6a34c473c5 | Python | chenchonghz/medical-backend | /app/Models/pe-data-mining/codes/data.py | UTF-8 | 11,131 | 2.53125 | 3 | [
"MIT"
] | permissive | import numpy as np
import os
import pandas as pd
def is_nan(a):
return str(a) == 'nan'
class Data:
def _config(self):
self.basic1 = "basic2016.csv"
self.basic2 = "basic2017.csv"
self.examine1 = "examine2016.csv"
self.examine2 = "examine2017.csv"
self.diagnosis1 = "diag... | true |
2b377163179f086df7f11a2102f795b815309d49 | Python | anolsa/listenandrepeat-praat | /GUItesti.py | UTF-8 | 1,659 | 2.75 | 3 | [
"MIT"
] | permissive | from GUI import RadioButton, RadioGroup, Label, Font, Window, TextField, Button, application
win_num = 0
tiedot = []
class TestWindow(Window):
def key_down(self, event):
c = event.char
if c == '\r':
print "Default"
elif c == '\x1b':
print "Cancel"
... | true |
f0ad278814775cfb75328cbd0dc78b1d55292e48 | Python | keithwang5/Anti-Stress-Tracker | /fitbitWrapper.py | UTF-8 | 3,330 | 2.671875 | 3 | [
"MIT"
] | permissive | import ConfigParser
import fitbit
from RecordClasses import Record
import datetime as dt
import time
config_filename = 'config.ini'
# start_time and end_time should both be empty or both set
# returns heartrate stats for a dayrange with start_date included, end_date excluded
def get_heartrate_series(base_date, detai... | true |
672519ec779403a12a8554f088b1fd66aaec710b | Python | TJCarpenter/Library-System | /scripts/main.py | UTF-8 | 4,755 | 3.328125 | 3 | [] | no_license | from bs4 import BeautifulSoup as bs
import requests
from random import randint, choice
import names
import csv
import time
for i in range(1, 10000):
time.sleep(3)
# URL
url = 'https://booktitlegenerator.com/'
# Request the URL
r = requests.get(url)
# Process the data
... | true |
3602693a45d5bdbda9172a6e47150bf06d134bcf | Python | haibaokesheng/study | /leetcode/104.二叉树的最大深度.py | UTF-8 | 2,039 | 3.234375 | 3 | [] | no_license | '''
@Author: your name
@Date: 2020-04-12 11:13:18
@LastEditTime: 2020-04-12 11:19:18
@LastEditors: Please set LastEditors
@Description: In User Settings Edi
@FilePath: \刷题人生\leetcode\104.二叉树的最大深度.py
'''
#
# @lc app=leetcode.cn id=104 lang=python3
#
# [104] 二叉树的最大深度
#
# https://leetcode-cn.com/problems/maximum-depth-of-... | true |
b040fa56b598dbf6bb94fe3a6f4ccc3ee47324ac | Python | GitNotifyTestUser/TestForGitNotify | /Mitsuru's Games/tron.py | UTF-8 | 9,005 | 3.265625 | 3 | [] | no_license | import pygame
import sys
from time import sleep
from pygame.locals import *
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
BLUE = (0, 0, 255)
SILVER = (192, 192, 192)
GOLD = (255, 215, 0)
#INFORMATION
"""
Important Info!!!!
grid is 50x50
each grid is 10x10 pixels
start player at [3][3] a... | true |
b0abd25c4e0874bdada61a5401179bcbea849aff | Python | HERoLab/FirstRobot | /pygameControlUI.py | UTF-8 | 6,471 | 3.0625 | 3 | [] | no_license | import sys, time
import socket
import json
import pygame
from pygame.locals import *
#Variable Setup.
originSpeed = 47
maxSpeed = 74
minSpeed = 20
turnSpeed = 10
brakeSpeed = 1 #The speed at which to brake per "loop"
stabilizeSpeed = 3 #The speed at which to "stabilize" turns.
leftSpeed = originSpeed
rightSpeed = or... | true |
238a68f854d62d14c41d63d9b2d8eac26080b971 | Python | tianchuntian/beauty_shop | /page/addrpage.py | UTF-8 | 3,967 | 2.6875 | 3 | [] | no_license | import time
from common.base import Base,open_browser
from page.accountpage import Account
from page.buynow import BuyNow
from page.goodspage import GoodsPage
from page.housepage import HousePage
from page.loginpage import LoginPage, url
class AddrPage(Base):
"封装第一次购买商品时要求填写收货信息页面"
# 国家定位器
country_loc=("... | true |
69aac504090b8ed60ea504dfde4abb8f56c7a57f | Python | LucasMaiale/Libro1-python | /Cap4/Ejemplo 4_2.py | UTF-8 | 832 | 4.09375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: guardati
Ejemplo 4_2
Solución del problema 4.1 sin usar ciclo.
En este caso se emplea una variable por cada sueldo.
"""
sueldo1 = float(input('Ingrese el sueldo 1: $'))
sueldo2 = float(input('Ingrese el sueldo 2: $'))
sueldo3 = float(input('Ingrese el sueldo 3: $'))
suel... | true |
6947afb77550a3f9ebf0f822bbb96e17ba93c713 | Python | BelitK/CHIRP | /chirp/plugins/registry/scan.py | UTF-8 | 3,135 | 2.625 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain"
] | permissive | """Main method for the Windows registry plugin."""
# Standard Python Libraries
import json
import logging
import os
from typing import Dict, List, Tuple, Union
# cisagov Libraries
from chirp.common import OUTPUT_DIR, REGISTRY, build_report
from chirp.plugins import operators
from chirp.plugins.registry.registry impor... | true |
a208f452c6f82bea40b4e78ca7a616d06904b841 | Python | JimBae/pythonForMachineLearning | /ch01/pythonic_code/lambda_function.py | UTF-8 | 299 | 3.234375 | 3 | [] | no_license | # ref
# https://github.com/TEAMLAB-Lecture/AI-python-connect/blob/master/codes/ch_1/pythonic_code/lambda_function.py
def f(x, y):
return x + y
print (f(1,4))
f = lambda x, y: x + y
print (f(1,4))
f = lambda x: x ** 2
print (f(3))
f = lambda x: x/2
print (f(3))
print ((lambda x: x+1)(5))
| true |
77144575b97ba92cd4a0628d544cce3ef854f0ed | Python | 981377660LMT/algorithm-study | /20_杂题/atc競プロ/競プロ典型 90 問/082 - Counting Numbers(★3.py | UTF-8 | 720 | 3.234375 | 3 | [] | no_license | # 1<=L,R<=1e18
# 每个数num在 黑板上写num次 求最终的长度
# !前缀和相减 按照位数分类计算
import sys
sys.setrecursionlimit(int(1e9))
input = sys.stdin.readline
MOD = int(1e9 + 7)
L, R = map(int, input().split())
def cal(upper: int) -> int:
"""[1, upper]内的答案"""
res = 0
for i in range(20):
left, right = 10 *... | true |
574a1d3404aba0cd7099ee288799899c33facdd1 | Python | NoMod-Programming/py-utility | /tests/test_utility.py | UTF-8 | 1,914 | 3.125 | 3 | [
"MIT"
] | permissive | from unittest import TestCase
from pyutility import limit_resource, measureit
def func1a(x):
x = [i for i in range(x)]
return -1
def func1b(x):
# recursive function to find xth fibonacci number
if x < 3:
return 1
return func1b(x-1) + func1b(x-2)
def func2():
# error function
re... | true |
18192d993694962e3932e3d9bf674c897311d454 | Python | sainihimanshu1999/FB-List | /MinimumWindowSubstring.py | UTF-8 | 744 | 3.65625 | 4 | [] | no_license | '''
we use simple two pointer approach in this question
'''
from collections import Counter
def window(s,t):
target_counter = Counter(t)
target_len = len(t)
start,end =0,0
minWindow = ''
for end in range(len(s)):
if target_counter[s[end]]>0:
target_len -=1
target_counte... | true |
29f39ddc016a183154ae3ce77e19f1875413df47 | Python | innovationcode/searching-problems | /search_using_binary/count_rotation.py | UTF-8 | 495 | 4.3125 | 4 | [] | no_license | #Find the Rotation Count in Rotated Sorted array
def count_rotation(arr):
low = 0
high = len(arr) - 1
while(low <= high):
mid = (low + high) // 2
if(arr[mid - 1] > arr[mid] and arr[mid] < arr[mid + 1]):
return mid
elif arr[mid] < arr[high]:
high = mid - 1
... | true |
b54f9e4a64ae10e0f33ed5469a5058ff7a3fa52f | Python | Deep455/Python-programs-ITW1 | /python_assignment_2/py14.py | UTF-8 | 380 | 3.9375 | 4 | [] | no_license | n=int(input("enter size of list : "))
lst = []
print("enter elements : ")
for i in range(n):
element = int(input())
lst.append(element)
print("initially list : ")
print(lst)
for i in range(n-1):
for j in range(n-1-i):
if lst[j] > lst[j+1]:
temp = lst[j]
lst[j] = lst[j+1]
... | true |
6396a6b5b83b03bc72e1709884ace5e58af05d4c | Python | NLeSC/spreading_dye_sampler | /spreading_dye_sampler/dye_blot.py | UTF-8 | 3,797 | 3.640625 | 4 | [
"Apache-2.0"
] | permissive | import numpy as np
class DyeBlot:
def __init__(self, grid_dims, cell_dims):
self._grid_dims = grid_dims
"""Width and height of the grid in a 2-element list."""
self._cell_dims = cell_dims
"""Width and height of the cells in a 2-element list."""
self._cells = []
"""A ... | true |
7b57c6275d080416adc388abd48b4840bd795b71 | Python | robsontpm/scrum-roman | /roman.py | UTF-8 | 766 | 3.5 | 4 | [
"BSD-2-Clause"
] | permissive | import pytest
from scr1 import code, decode
# Acceptance tests:
def fib(n):
return 1 if n < 2 else fib(n-1) + fib(n-2)
def test_fib_0_1():
assert fib(0) == 1
assert fib(1) == 1
def test_fib_up_to_10():
assert fib(2) == 2
assert fib(3) == 3
assert fib(4) == 5
assert fib(5) == 8
assert fib(6) == 13
assert f... | true |
d09e57f7aa83e1573c5a89d060f389e93c737844 | Python | HerosJiyugaoka/Twitter | /twitterShooting.py | UTF-8 | 3,610 | 2.578125 | 3 | [] | no_license | import csv
import os
import sys
import requests
import numpy as np
import slackweb
import pandas as pd
from bs4 import BeautifulSoup
import tweepy
#タイトルをスクレイピングして抽出
def scraping_tit():
url = 'url'
r = requests.get(url)
soup = BeautifulSoup(r.text, 'html.parser')
result = []
for top_news in soup.find_all(cl... | true |
2ccde932e8fe6c3759cbb951df0c0fee5b9f359c | Python | shackspace/body-scanner | /dustbin/StepperDriver.py | UTF-8 | 2,285 | 2.640625 | 3 | [] | no_license | import glob, sys, time, os
if not os.getegid() == 0: sys.exit("Run as root for serial port access.")
from pyA20.gpio import gpio
from pyA20.gpio import port
class StepperDriver:
def doStep(self, steps=200):
self.endSleep()
if steps > 50:
self.doRamp(steps=50)
for i in range(0, steps-50):
gpio.output(sel... | true |
14da9f538bc95fe05c2b773056b174581e9b999a | Python | DmitryMedovschikov/Programming_on_Python.Bioinformatics_Institute | /1. Итого по разделу/1.FinalTasks.py | UTF-8 | 6,639 | 4.09375 | 4 | [] | no_license | # Напишите программу, вычисляющую площадь треугольника по переданным длинам
# трёх его сторон по формуле Герона: S = sqrt(p(p−a)(p−b)(p−c)),
# где p=(a+b+c)/2 - полупериметр треугольника. На вход программе подаются
# целые числа, выводом программы должно являться вещественное число,
# соответствующее площади треугольни... | true |
8953753046a1081d6a33683778e0165f7305899e | Python | pharick/python-coursera | /week5/20-more-than-siblings.py | UTF-8 | 192 | 3.421875 | 3 | [] | no_license | numbers = list(map(int, input().split()))
count = 0
for i in range(1, len(numbers) - 1):
if numbers[i] > numbers[i - 1] and numbers[i] > numbers[i + 1]:
count += 1
print(count)
| true |
aca60845c457c1ab42771bb28a929bba08f24b19 | Python | mmmvdb/pythonPractice | /os/folderRegex/folderRegex.py | UTF-8 | 1,512 | 3.890625 | 4 | [] | no_license | #folderRegex
# Takes a folder and regex expression supplied by argument to the script, and searches all txt files with that folder with the
# regex, displaying any matches in the console
# folderRegex.py - Search a folder for all .txt files and search them with the regex
# Usage: folderRegex.py <path> <regex expre... | true |
075fa3421b6c41b4e18086a8a35f332032957f5d | Python | allensummer/Tensorflow-Examples | /examples/1.Introduction/example2.py | UTF-8 | 430 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
create on Tue Nov 7 2017
@autor:allen
function:Addiction with two constans using tensorflow
"""
import tensorflow as tf
a = tf.constant(2)#定义一个常量
b = tf.constant(3)
sess = tf.Session()#连接session
print "a=2, b=3"
print "两个常量相加:%i"% sess.run(a + b)#启动图
print "两个常量相乘: %i" % sess.run(a * b)#启动... | true |
7c681a91ca7a99bef9a4b01b292641200a2cc0d0 | Python | maryonella02/Codeforces-Laboratory | /10A.py | UTF-8 | 2,053 | 3.84375 | 4 | [] | no_license | """Power Consumption Calculation
We have n periods of time when someones work at the laptop from start time and end time.
And p1 power consumption fo active mode, p2 power consumption for eco mode, p3 power consumption for sleep mode.
And t1 is time after someone left laptop but it is still active.
and t2 time is tim... | true |
6f1278010ed41704a0a5efde1bd80cea1ae16be5 | Python | stevenhorsman/advent-of-code-2017 | /day-12/digital_plumber.py | UTF-8 | 690 | 3.453125 | 3 | [] | no_license | import re
import networkx as nx
input_file = 'day-12/input.txt'
def create_graph(input):
graph = nx.Graph()
for line in input.splitlines():
program, neighbours = line.split(' <-> ')
graph.add_node(program)
for neighbour in [prog.strip() for prog in neighbours.split(",")]:
graph.add_edge(program,... | true |
1111968353a7b48594cde712641f953d43173367 | Python | tealen/TeaTasks | /teatasks/db_api.py | UTF-8 | 624 | 2.65625 | 3 | [
"MIT"
] | permissive | from sqlalchemy import Column, ForeignKey, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine("sqlite:///data/test.db", echo=True)
Base = declarative_base()
class Lists(Base): # type: ignore
__tablename__ = "lists"
list_id = Column(Integer, primary_... | true |
45986ea9d7efffc415890a9349fc574bf74f9bfb | Python | ncantrell/keras-progan-inference | /progan_layers.py | UTF-8 | 1,658 | 2.53125 | 3 | [] | no_license |
import tensorflow as tf
from keras.layers import Layer
import keras.backend as kb
def _pixel_norm(x, epsilon=1e-8, channel_axis=-1):
with tf.variable_scope('PixelNorm'):
return x * tf.rsqrt(tf.reduce_mean(tf.square(x), axis=channel_axis, keepdims=True) + epsilon)
class PixelNorm(Layer):
def __init__(self, ch... | true |
f1dd5d850ea61c49cc3b09f76266b79b53a76287 | Python | kitsmart/pythonbooklet | /Chapter 6/Practice Exercise 6/9 Sum list.py | UTF-8 | 259 | 3.640625 | 4 | [] | no_license | def sum_list(list):
lst = 0
for i in list:
lst += i
return lst
def list_of_deviation(list)
mean = sum_list(list) / float(len(list))
i = 0
for i.list in list:
print(mean - i)
i = i + 1
list_of_deviation(1, 2, 3, 4, 5, 6, 7, 8) | true |
8a9d7951d7ad6239d35778a0d304584d115c65be | Python | TheShubhamJindal/movie-recommender | /Recomend.py | UTF-8 | 1,658 | 3.40625 | 3 | [] | no_license | import pandas as pd
import numpy as nm
from collections import OrderedDict
print ("Lets do this")
movies_df = pd.read_csv('/home/prafful/Desktop/ml-latest-small/movies.csv', header=None, names=['movie_id', 'movie_title', 'movie_genre'])
movies_df = pd.concat([movies_df, movies_df.movie_genre.str.get_dummies(sep='|')]... | true |
d32dfb78aab4cd5d0f4d346adf889bf199e1362d | Python | jforty11/BE107Group1repo | /lab5/detect_flies.py | UTF-8 | 2,999 | 3 | 3 | [] | no_license | #!/usr/bin/python
import numpy as np # Presumably something to do with numbers
import cv2 # Image processing
from matplotlib import pyplot as plt # Plotting function or something
directory = "/home/lev/Documents/College/Be107/Week5/videos_for_tracking/larvae_stills/"
prefix = "frame000"
suffix = ".jpg"
infix... | true |
ea387a142facc7771d3b5b9e7466c32718fcc18e | Python | finkeler/BqFieldSizeAnalyzer | /TableMetadata.py | UTF-8 | 1,347 | 3.140625 | 3 | [] | no_license | import datetime
from collections import OrderedDict
class TableMetadata(object):
def __init__(self, table_name, json_schema, creation_time, last_modified_time, num_rows, num_bytes):
self._name=table_name
self._json_schema = json_schema
self._creation_time=creation_time
self._last_... | true |
55ea2505de7eb3e224a61b253c788b15fa4f29b5 | Python | psarz/python-lpthw_practice_exercises- | /ex15.py | UTF-8 | 736 | 3.90625 | 4 | [] | no_license | from sys import argv
#import for using argument variable librery
script, filename = argv
# defined to argument variables script and filename
txt = open(filename)
#we called a function to read file content
print "here's your file %r:" % filename
#we are printing the content of the file.
print txt.read()
#in this l... | true |
fb0b10e84c1b2019deb874beead39fcd57d5e3d8 | Python | hakataramen/trial | /cp2.py | UTF-8 | 195 | 2.921875 | 3 | [] | no_license | import sys
print(len(sys.argv))
print(sys.argv[1])
print(sys.argv[2])
f=sys.argv[1]
t=sys.argv[2]
cp = open(t, "w")
for line in open(f):
print(line, end=" ")
cp.write(line)
cp.close
| true |
4286401d0d750fec4fdb4b9ae74659864a0e17b6 | Python | vivekmahajan/phrase-based-decoder | /decoder.py | UTF-8 | 8,853 | 2.640625 | 3 | [] | no_license | from heap import Heap
import sys
from math import log
import copy
'''
kenlm_swig_wrapper = "/cs/natlang-sw/Linux-x86_64/NL/LM/NGRAM-SWIG-KENLM"
print "wrapper!!!!",kenlm_swig_wrapper
if ( kenlm_swig_wrapper is None ):
sys.stderr.write("Error: Environment variable NGRAM_SWIG_KENLM is not set. Exiting!!\n")
... | true |
929ba3170f72363612087881490594282104fcfa | Python | sghosh1991/InterviewPrepPython | /LeetCodeProblemsMedium/162_peak_finding.py | UTF-8 | 900 | 3.484375 | 3 | [] | no_license | """
"""
class Solution(object):
def findPeakElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
lo = 0
hi = len(nums) - 1
numElements = len(nums)
if hi < 0:
return -1
while lo <= hi:
mid = lo + (hi - lo)/2
... | true |
bac5c6bd93c199640e9cdcf5488b36ca55fd034c | Python | zer0tonin/Ulfenkarn | /ulfenkarn/util.py | UTF-8 | 240 | 3.171875 | 3 | [
"MIT"
] | permissive | import re
mention_regex = re.compile("<@!([0-9]+)>")
def mention_to_id(mention):
match = mention_regex.findall(mention)
if len(match) == 1:
return match[0]
raise ValueError("Invalid user mention: {}".format(mention))
| true |
2b3a51a0910d7224418ec45f185fcccdf757a467 | Python | wglass/rotterdam | /rotterdam/team.py | UTF-8 | 2,379 | 2.78125 | 3 | [
"MIT"
] | permissive | import errno
import os
import signal
import sys
class Team(object):
def __init__(self, master, worker_class):
self.master = master
self.worker_class = worker_class
self.workers = {}
@property
def size(self):
return len(self.workers)
def set_size(self, new_size):
... | true |
2e7b0be488687ab05b790892b03c90480ea8af1e | Python | thomas-vl/airbyte | /airbyte-integrations/connectors/destination-cumulio/destination_cumulio/destination.py | UTF-8 | 5,455 | 2.734375 | 3 | [
"MIT",
"LicenseRef-scancode-free-unknown",
"Elastic-2.0"
] | permissive | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from logging import Logger, getLogger
from typing import Any, Iterable, Mapping
from airbyte_cdk.destinations import Destination
from airbyte_cdk.models import AirbyteConnectionStatus, AirbyteMessage, ConfiguredAirbyteCatalog, DestinationSyncMode, Status, ... | true |
9d335e78678663016f636f47c9db749ce067f5a5 | Python | kariln/Machine-Learning | /Linear Regression/logistic_regression_gradient_descent.py | UTF-8 | 544 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 4 16:55:37 2020
@author: Kari Ness
"""
"""
Logistic regression with gradient descent
"""
import pandas as pd
#Loads 1D dataset
train = pd.read_csv('dataset/regression/train_1d_reg_data.csv')
test = pd.read_csv('dataset/regression/test_1d_reg_data.csv')
class logisticR... | true |
635a1e96b113238b6718998020710c9a9ff19c1c | Python | wonjoonSeol/ScienceScape | /bibliotools3/scripts/merging_corpus.py | UTF-8 | 6,398 | 2.765625 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | import os
import datetime
'''
File: merging_corpus.py
This script merges all the data files found in 'data-wos' and writes
all parseable lines to a single file, Result/one_file_corpus.txt
'''
CONFIG = {}
"""
Writes year distributions for all spans into a CSV file.
"""
def write_year_distribution(reports_directory, ... | true |
5dda6d92baca823a1406f2c5ff6071498b36a63c | Python | GearL/landlord | /landlord/common/time_table.py | UTF-8 | 3,608 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
the strategies for choosing the time_table
'''
import copy
from datetime import time
from django.utils.dateformat import time_format
from landlord.custom.table_util import generate_date_list
from landlord.custom.table_util import get_application_this_week
def generate_time_choices():... | true |
bb33581a8f6a967394db9e41418743feff866cf7 | Python | allwak/algorithms | /Sprint12/Theme1/1h.py | UTF-8 | 180 | 3.25 | 3 | [] | no_license | with open('input.txt', "r") as f:
phrase = f.readline().rstrip()
phrase = [i.lower() for i in phrase if i.isalpha()]
new_str = ''.join(phrase)
print(new_str == new_str[::-1])
| true |
a336d8cd261f2c772f7e609f34276f6b4524054c | Python | YichaoOU/HemTools | /bin/merge_bed.py | UTF-8 | 2,327 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import os
import pandas as pd
import datetime
import getpass
import uuid
import argparse
import glob
"""
Every python wrapper is supposed to be similar, since they are using the same convention.
The only thing need to be changed is the guess_input function and the argparser function.
... | true |
b7f9f25595213346f8b9d3884422498fa0223fd7 | Python | DavidMStraub/ckmutil | /ckmutil/ckm.py | UTF-8 | 4,267 | 3.15625 | 3 | [
"MIT"
] | permissive | """Functions needed for the CKM quark mixing matrix."""
from math import cos,sin
from cmath import exp, sqrt
import numpy as np
def ckm_standard(t12, t13, t23, delta):
r"""CKM matrix in the standard parametrization and standard phase
convention.
Parameters
----------
- `t12`: CKM angle $\theta_{... | true |
89fe8f1b7daa5dc78b07ce25f150a56a0aa837f3 | Python | QGtiger/justforfun | /Sign_Scan/Scan_Sign.py | UTF-8 | 1,457 | 2.59375 | 3 | [] | no_license | """
author:lightfish
Time:2018.11.28
note:扫码签到
"""
from tornado import web, httpserver, ioloop
from create_qr_code import get_code_by_str
import time
class IndexPageHandler(web.RequestHandler):
def get(self, *args, **kwargs):
# self.write('Hello Tornado...')
self.render('index.html')
class Code... | true |
64502e228a3002aa941ae224e1ecfaddfa605e7a | Python | dariauzun/test-06-03-21 | /bot.py | UTF-8 | 8,908 | 2.71875 | 3 | [] | no_license | """
имеем проект развития образовательной платформы GAZ Campus - многоформатной площадки образования клиентов с лекциями, МК и встречами с экспертами
создадим чат-бот в Телеграм для отправки напоминаний клиентам и приглашений к участию
импортируем библиотеку c помощью функции import и подключаем Телеграм-бот на pyth... | true |
6beb0706a1b053add0f035326a667efac7129361 | Python | cuthbertLab/daseki | /daseki/retro/pitch.py | UTF-8 | 1,710 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Name: pitch.py
# Purpose: a single pitch event in a retrosheet eventfile event
#
# Authors: Michael Scott Cuthbert
#
# Copyright: Copyright © 2015 Michael Scott Cuthbert / cuthbertLab
# License... | true |
6dd03f9dd9238313f7e83110836cd1b0318ded52 | Python | DingGuodong/LinuxBashShellScriptForOps | /projects/LinuxSystemOps/AutoDevOps/pythonSelf/pyShutitOps.py | UTF-8 | 1,926 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
# encoding: utf-8
# -*- coding: utf8 -*-
"""
Created by PyCharm.
File: LinuxBashShellScriptForOps:pyShutitOps.py
User: Guodong
Create Date: 2017/6/29
Create Time: 16:12
shutit: An programmable automation tool designed for complex builds
An programmabl... | true |
52c3c3a39894f0580b9693ab7c50d3b4d25e6a28 | Python | EthanZeigler/Bobby-Tables | /backend/BobbyTables/src/main/python/disaster_dump.py | UTF-8 | 1,196 | 2.625 | 3 | [
"MIT"
] | permissive | import psycopg2
import csv
import sys
conn = psycopg2.connect(database="sample_db", user = "ethanzeigler", host = "127.0.0.1", port = "5432")
cur = conn.cursor()
filename = "/Users/ethanzeigler/Downloads/Disasters_final_date_nocomma.csv"
with open(filename, 'rt') as csvfile:
rdr = csv.reader(csvfile, delimiter='... | true |
891e2854b62afd0e735ab20688d2278fff7d27ad | Python | danlarsson/WiFi-tools | /ssid-strength-meter.py | UTF-8 | 1,960 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python
'''
Messure the signal strength of a specific BSSID and present the MIN, MAX and AVERAGE values.
SA3ARK, 2017-11-06
'''
import pyshark
#sudo tcpdump -I -i enX -p
#sudo killall airportd
# ToDo: Set channel to capture on
# CHANNEL = 1
BSSID = '30:85:a9:6a:0a:df'
NR_OF_MESSUREMENTS = 200
SHOW_EVERY =... | true |
3a7c5107c1064933c97a51c39931cad0bfcc66ae | Python | blowekamp/SimpleITK-Notebook-Answers | /Utilities/Hooks/RemoveIpythonNotebookOutputs.py | UTF-8 | 1,862 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
## This script was from a stack-overflow recommendation hosted on a github gist
"""strip outputs from an IPython Notebook
Opens a notebook, strips its output, and writes the outputless version to the original file.
Useful mainly as a git pre-commit hook for users who don't want to track output i... | true |
172f976e91235166ed95fd6af9646174a4d51b36 | Python | vvspearlvvs/CodingTest | /2.프로그래머스lv1/카카오_다트게임/solution.py | UTF-8 | 643 | 3.3125 | 3 | [] | no_license | def solution(dartResult):
answer = 0
score=[]
for i,num in enumerate(dartResult,1):
if num =="S":
score[-1] **=1
elif num =="D":
score[-1] **=2
elif num =="T":
score[-1] **=3
elif num =="*":
score[-1] *=2
if len(scor... | true |
b7a1be63a69e0eb45fc3382636d2f75b893e7911 | Python | daniel-reich/ubiquitous-fiesta | /ZrAnDiPTbmrJMHWHD_5.py | UTF-8 | 85 | 3.03125 | 3 | [] | no_license |
def is_central(txt):
return len(txt)%2 and txt[len(txt)//2:len(txt)//2+1] != " "
| true |
054ebdd06335d410235ca29c91c677304023f660 | Python | tiidadavena/cracking-the-coding-interview | /chapter-1/implementations/arraylist.py | UTF-8 | 2,433 | 3.4375 | 3 | [] | no_license | import timeit
import ctypes
class ArrayList:
def __init__(self, capacity=2):
self.index = 0
self.capacity = capacity
self.array_list = [None for _ in range(self.capacity)]
def append(self, value):
if self.index >= self.capacity:
self._resize()
self.array_l... | true |
290f6b8259a68324b8ae9057d5c1f64d4d8ee29d | Python | maiff/shit-game | /util.py | UTF-8 | 318 | 2.6875 | 3 | [] | no_license | import pygame
from pygame.locals import *
def cropimg(image, region):
x1,y1,x2,y2 = region
buttonStates = pygame.image.load(image).convert_alpha()
print(region[2:])
cropped = pygame.Surface((x2-x1, y2-y1), flags=SRCALPHA)
cropped.blit(buttonStates, (0, 0), (x1,y1,x2-x1, y2-y1))
return cropped | true |
af9feb473a68775ec2fae9e06d7cbfd04c3b3a6b | Python | chihaoui-dev/Arcade-CS-Games | /minigames/its_raining_beer/beer_manager.py | UTF-8 | 1,198 | 3.203125 | 3 | [] | no_license | import random
from beer import Beer
class BeerManager():
def __init__(self, max_beers, default_speed, game_size):
self.max_beers = max_beers
self.default_speed = default_speed
self.width, self.height = game_size
self.beers = []
self.ticks = 0
def update(self):
... | true |
1e72c2bd94951ca304f86615b0c298ee92c250cf | Python | amirrouh/genepy | /parse.py | UTF-8 | 4,132 | 2.90625 | 3 | [
"MIT"
] | permissive | def read(link, data_dim):
"""
This module downloads gene expression profile from NCBI GEO FTP website and parses it
Parameters
----------
link : str
This is the link to GEO soft_full.gz file on NCBI website
data_dim : int
This gets number of genes needed to be considered ( data_dim = 1... | true |
7a46fd0f0767f7180cef288e40c0f97fcec305ae | Python | zabcdefghijklmnopqrstuvwxy/AI-Study | /1.numpy/topic84/topic84.py | UTF-8 | 273 | 2.75 | 3 | [] | no_license | import numpy as np
N=3
S=10
Z=np.zeros(shape=(3,3))
arr=np.random.randint(0,100,size=(S,S))
print(arr)
for j in range(S):
if(j < S - (N -1)):
for i in range(S):
if(i < S - (N - 1)):
Z=arr[j:j+N,i:i+N]
print(Z)
| true |
61e3be001b4644ea40846cd2e5d95ac2af11d676 | Python | nitin-gupta/Python_Apps | /TestCode_3_GlobalFunc_Vars/TestCode.py | UTF-8 | 2,511 | 3.375 | 3 | [] | no_license | # This is the test code which performs the following
# a) Detects the Python interpreter version at runtime
# b) Depending upon the Python version, calls the main function
import sys
import threading
import time, datetime
from threading import Event, Thread
import GlobalFunc
import GlobalVars
l_welcome = "Welcome to ... | true |
f2bbfaa510af6ed37384a0af86330126fcc8be82 | Python | luckyzhangqian/Rumor_indentify | /Evaluation_index.py | UTF-8 | 859 | 3.296875 | 3 | [] | no_license | import numpy as np
def evalution_rate(predict_label, real_label):
length = len(predict_label)
addition_label = predict_label + real_label
subtraction_label = predict_label - real_label
tp = np.sum(addition_label == 2) # 预测谣言,实际谣言
fp = np.sum(subtraction_label == 2) # 预测谣言,实际非谣言
fn = np.sum(s... | true |