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 |
|---|---|---|---|---|---|---|---|---|---|---|
e112f6b198b2247d969ab8862169b86d57f73312 | almahmoud/cloudman | /cm/util/nfs_export.py | UTF-8 | 4,952 | 2.6875 | 3 | [
"MIT"
] | permissive | from cm.util.misc import run
from cm.util.misc import flock
import shlex
import logging
log = logging.getLogger('cloudman')
class NFSExport:
nfs_lock_file = '/tmp/nfs.lockfile'
nfs_dirty = False
ee_file = '/etc/exports'
@staticmethod
def add_nfs_share(mount_point, permissions='rw'):
"""
... | true |
f666a5e1b1a94be4ebd9d1812e3bb45b4ae6a5be | hemant5454/Python_For_Hemant | /prime_1.py | UTF-8 | 91 | 2.9375 | 3 | [] | no_license | def prime(n):
return n
#Write code of this function
n=int(input())
print(prime(n))
| true |
73611c317083ded8239486d2fbc487a64be2b552 | gaeta987/ProgettoTesiEmotionClassification | /ServerArduino/Classification.py | UTF-8 | 1,113 | 2.75 | 3 | [] | no_license | import pandas
from keras.engine.saving import model_from_json
import normalizzazione as norm
dataframe = pandas.read_csv("dataset.csv", header=None,sep = ";")
dataset = dataframe.values
X = dataset[:,0:11]
dummy_x = norm.normalize(X)
json_file = open('model.json', 'r')
loaded_model_json = json_file.read... | true |
1a87eb3bf57d33964d1bcb020a88eaca0f0ef05b | mathvolcano/leetcode | /1008_bstFromPreorder.py | UTF-8 | 779 | 3.546875 | 4 | [] | no_license | """
1008. Construct Binary Search Tree from Preorder Traversal
https://leetcode.com/problems/construct-binary-search-tree-from-preorder-traversal/
"""
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# ... | true |
e5e1874127799e70250c19d971fb6bfd57229130 | yhzhang95/LeetCodeDaily | /codes/No_0712.py | UTF-8 | 797 | 3.421875 | 3 | [
"CC-BY-3.0"
] | permissive | #
# @lc app=leetcode.cn id=712 lang=python3
#
# [712] 两个字符串的最小ASCII删除和
#
# @lc code=start
class Solution:
def minimumDeleteSum(self, s1: str, s2: str) -> int:
sumup = sum(ord(char) for char in s1 + s2)
dp = [[0 for _ in range(len(s2) + 1)] for _ in range(len(s1) + 1)]
for i, char1 in enu... | true |
34af1fd7ff8e70928f641170f5d8c4d3fe185207 | JuanVidal/Katas | /more_zeros.py | UTF-8 | 255 | 3.1875 | 3 | [
"MIT"
] | permissive | def more_zeros(s):
s = "".join(dict.fromkeys(s)) # Getting rid of the duplicates in order
s2 = [bin(ord(i))[2:] for i in s]
s2 = [len(i)>2*i.count('1') for i in s2]
return [i for j, i in enumerate(s) if s2[j]]
print(more_zeros("DIGEST"))
| true |
1abce2351440abaa1412ea31739b45dc14a92ea2 | andriitugai/python-morsels | /leetcode/list_is_not_subset_of_other_lists.py | UTF-8 | 2,425 | 3.75 | 4 | [] | no_license | # https://leetcode.com/problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list/
# Given the array favoriteCompanies where favoriteCompanies[i] is the list of favorites
# companies for the ith person (indexed from 0).
#
# Return the indices of people whose list of favorite companies is not a su... | true |
ec5a813fc009a3e9636394b14f3b68aa10d07754 | ShadowElf37/OperationAncilia | /networking/header/level3.py | UTF-8 | 1,732 | 2.703125 | 3 | [] | no_license | import socket
from .data import *
from random import randint
from struct import pack
class IPHeader:
def __init__(self, source, dest, header_length=5, ttl=255, protocol=socket.IPPROTO_TCP):
# 4 4 6 2 16 16 4 12 8 8 16 32 32
self.src = source
self.dst = dest
self.header = [
... | true |
08a0ebccfd394ffb32cf53f5d8b573933769a0cb | ChebukinMatvey/Cryptography | /Gost/python/decr.py | UTF-8 | 1,139 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python3
from random import shuffle
import struct
import random
import sys
import os
from functions import *
ENCRYPTED_FILE = "encrypted"
DECRYPTED_FILE = "decrypted"
if __name__ =='__main__':
inp = open(ENCRYPTED_FILE,"rb")
out = open(DECRYPTED_FILE,"wb")
keys = read_keys(inp)
... | true |
6dee873b623cdc5f5198cb01f04932be14678c46 | TaiPhillips/concurrency-in-python-with-asyncio | /chapter_14/listing_14_12.py | UTF-8 | 2,472 | 2.59375 | 3 | [] | no_license | import functools
import selectors
from chapter_14.listing_14_8 import CustomFuture
class EventLoop:
def __init__(self):
self.selector = selectors.DefaultSelector()
self._tasks_to_run = []
self.current_result = None
def _register_socket_to_read(self, sock, callback):
future =... | true |
3e2792f0016eee6ed00e9d1073b5841fe6119adc | GaloisLovWind/Python-CoreProgram | /3_basic/1_statement/question.py | UTF-8 | 617 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Author: Galois
# @Date: 2019/10/22 1:13
# @File: question.py
# @Software: Program
# @Desc: question
"""
cmd: python app.py --file_name=3_basic
enter keyboard : 1
"""
from typing import List, Tuple, Dict, TextIO, TypeVar
StrAndInt = TypeVar('StrAndInt', str, int,... | true |
bc272f0ee7f1852f6927c57265e2eee47c55d903 | Audumusa/Musa | /CMP 104 assignment.py | UTF-8 | 2,683 | 4 | 4 | [] | no_license | # Area of a square
L = int(input("Enter the value of the Length here: "))
A = L*L
print ("The answer is = ",A)
# Area of a rectangle
L = int(input("Enter the value of the Length here: "))
B = int(input("Enter the value of the Breadth here: "))
A = B*L
print("the answer is = ",A)
# Area of a triangle
b = i... | true |
d8edcbab11a5e6eafe654b60c5d2761aaee4414f | redwallhp/discordbot | /plugins/wolframalpha.py | UTF-8 | 1,513 | 2.765625 | 3 | [] | no_license | import discord
from discord.ext import commands
import asyncio, aiohttp
import re
import xml.etree.ElementTree as ET
from lib import configurator
class WolframAlpha:
def __init__(self, bot):
self.bot = bot
self.apikey = configurator.getString('wolfram_key', None)
@commands.command()
async... | true |
329d0d24132fdcfe0714704cb43e3bc83237556e | Manikanta-cs/Calculator-using-Tkinter | /calculator.py | UTF-8 | 3,609 | 2.984375 | 3 | [] | no_license | from tkinter import *
expr = ''
def numpressed(num):
global expr
expr += str(num)
txt.set(expr)
def clear():
global expr
expr = ''
txt.set(expr)
def result():
global expr
try:
txt.set(eval(expr))
except:
txt.set('Error')
finally:
... | true |
fcf6a5c9b33895140bde37aea21350d85b296dcf | definelicht/Applied-Statistics-Tjaereborg | /extract_data.py | UTF-8 | 821 | 2.609375 | 3 | [] | no_license | import sys, numpy as np, read_csv
# Usage: python extract_data.py folder=/jesus/applied_statistics/data/
folder = "/users/johannes/Dropbox/Applied Statistics/Project 2/Data/"
for arg in sys.argv:
if arg[0:5] == "folder=":
folder = arg[5:]
filename = folder + "all.data"
data = read_csv.ReadCsv(filename)
lines =... | true |
a36bb0c375a0ba94827e02c8555fa61c8d5498f2 | zanyeshishuxuejia/Artificial-Intelligence-Final-Assignment | /SANET/depth_info.py | UTF-8 | 1,377 | 3.109375 | 3 | [] | no_license | import torch
import numpy as np
from PIL import Image
from matplotlib import pyplot as plt
# Load model
def load_model(model_path):
print('Loading model...')
model = torch.load(model_path)
return model
def my_DepthNorm(x, maxDepth):
return maxDepth / x
def my_predict(model, images... | true |
5a99ee2ba9ededd93f4d8ba88c46f2cb8c7690a8 | vandanavk/text2collage_old | /src/processText.py | UTF-8 | 7,133 | 2.9375 | 3 | [] | no_license | import re
import string
from time import time
import os
import nltk
from pattern.en import singularize, pluralize
from rake_nltk import Rake
import codecs
import generatePhotoLayout
import retrieveImageFromURL
import imageEmphasis
class Agent:
"""
The class 'Agent' is responsible for executing keyword extrac... | true |
86cabab0d75d4d1d22f03a9fb0380b72a45c8ad0 | faisal07m/testing_breaker | /9/build/encryption.py | UTF-8 | 1,619 | 3.640625 | 4 | [] | no_license | import base64
import os
from Crypto import Random
from Crypto.Cipher import AES
def create_random_key(number_of_bytes=32):
return os.urandom(number_of_bytes)
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s: s[:-ord(s[len(s) - 1:])]
class AESCipher:
def __init__(sel... | true |
a0471bd560d0d3878c8f6fded731e0bc22788a5a | maq-622674/python | /DJ/多线程/3.一次性启动多个线程.py | UTF-8 | 398 | 3.234375 | 3 | [] | no_license | import threading
import time
def run(n):
print("task",n)
time.sleep(2)
print("task has done!")
start_time=time.time()
for i in range(50):
t=threading.Thread(target=run,args=("t-%s"%i,))
t.setDaemon(True) #把当前线程设置为守护线程,一定在start前设置
t.start()
print(threading.current_thread(),threading.active_... | true |
1306f8dd70c3f3b2cb5e1e6054f43e5d8ef611a5 | ichisadashioko/learning_repo | /opencv/01_gui_features/04_mouse_event/mouse_event.py | UTF-8 | 470 | 2.734375 | 3 | [] | no_license | import numpy as np
import cv2
def draw_circle(event, x, y, flags, param):
if event == cv2.EVENT_LBUTTONDBLCLK:
cv2.circle(img, (x, y), 100, (255, 0, 0), -1)
if __name__ == "__main__":
img = np.zeros((512, 512, 3), np.uint8)
cv2.namedWindow('image')
cv2.setMouseCallback('image', draw_circle)
... | true |
8522375d039b7b8e2cac8aa5beac7edcf89db80c | cliu0507/CodeForFun | /CodeCheatSheet/BFS.py | UTF-8 | 1,329 | 3.484375 | 3 | [] | no_license | import collections
from queue import Queue
'''
q.qsize(). note:len(q)不存在
'''
def bfs(graph, node, visited):
q = Queue()
q.put(node)
while not q.empty():
node = q.get()
visited.add(node)
# process current node here
print(node)
for next_node in graph[node]:
... | true |
36e2775673208a9e48af8a6217f20c9373a2cd14 | Aasthaengg/IBMdataset | /Python_codes/p03697/s969662165.py | UTF-8 | 91 | 3.171875 | 3 | [] | no_license | A,B=input().split()
A=int(A)
B=int(B)
if A+B<10:
print (A+B)
else:
print ("error")
| true |
9e3b31ef67b5dd0b76d72aa435362ab49349c413 | jan-2018-py1/goulter_python | /MutiplesSumsAverage.py | UTF-8 | 945 | 5 | 5 | [] | no_license | # #Multiples
# 1) Part I - Write code that prints all the odd numbers from 1 to 1000.
# Use the for loop and don't use a list to do this exercise.
# 2) Part II - Create another program that prints all the multiples of 5 from 5 to 1,000,000.
# 3) Sum List
# Create a program that prints the sum of all the value... | true |
94db9a25bd1675f4fda327730638cd3765798691 | zhoujl48/JianzhiOffer-Python | /05_替换空格.py | UTF-8 | 1,234 | 4.0625 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding:utf-8 -*-
#
# Copyright (c) 2019 github.com/zhoujl48, Inc. All Rights Reserved
#
"""
Project JianzhiOffer-Python -- 面试题05: 替换空格
背景:无
要求:实现函数,将字符串中每个空格替换成"%20"。
输入:"We are happy."
输出:"We%20are%20happy."
Usage:
Authors: Zhou Jialiang
Email: zjl_sempre@163.com
Date: 2019-07-03
"""
class S... | true |
67929abbe56d1c50f32602275e59d89e0a899574 | Getobz/GetobzBot | /cogs/cmd.py | UTF-8 | 401 | 2.53125 | 3 | [] | no_license | import discord
from discord.ext import commands
bot = commands.Bot(command_prefix = "!")
class Cmd(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def cmd(self, ctx):
await ctx.send("Voici les commandes d'aide disponible :\n !help\n !userinfo\... | true |
eb412289899dc020a8941cfe5bc812876a6e50bc | visheshgargavi/arth_networking | /network/server1.py | UTF-8 | 666 | 2.765625 | 3 | [] | no_license | import socket
import os
import time
import threading
s = socket.socket(socket.AF_INET , socket.SOCK_DGRAM)
ip = "192.168.43.43"
port = 1234
s.bind((ip , port))
def a():
while True:
x = s.recvfrom(1024)
clientip = x[1][0]
data = x[0].decode()
print(clientip + ":" + data)
#t... | true |
6f05ec93fa57629712997dccf7203eb1feaeb910 | StyledSteezy/CSCI420-Networking | /Distributed-Ray-Tracing-Project/raytracer-numpy.py | UTF-8 | 9,498 | 2.59375 | 3 | [] | no_license | import sys
import math
import time
import numpy as np
from collections import namedtuple
from numpy import dot, cross, sqrt
Ray = namedtuple("Ray", "start dir")
Surface = namedtuple("Surface", "diffuse specular reflect roughness")
Camera = namedtuple("Camera", "pos forward up right")
Light = namedtuple("Ligh... | true |
0d8ee56e034e5d3930d5d945b53cb4bbd3732b93 | wikimedia/mediawiki-tools-code-utils | /auditcode.py | UTF-8 | 978 | 3.46875 | 3 | [] | no_license | #!/usr/bin/env python
""" Given a list of files containing class definitions in the order of their
class hierarchy, this program will print the class names and function names
that will actually get executed when you call $this->function() """
import re
import sys
functions = {}
classes = {}
cl = None
for fn in sys.ar... | true |
97ccc9f44eeb8584cb10e98156d7e873f635ec53 | burakbayramli/books | /Intro_Solid_Mechanics_Adeeb/4.3.3.2.py | UTF-8 | 1,081 | 2.671875 | 3 | [] | no_license | from sympy import *
import sympy as sp
theta = sp.symbols("\u03B8")
X1,X2,X3=sp.symbols("X1 X2 X3")
x1,x2,x3=sp.symbols("x1 x2 x3")
Qx = Matrix([[1, 0, 0],
[0, sp.cos(theta),-sp.sin(theta)],
[0, sp.sin(theta),sp.cos(theta)]])
# y rotation matrix
Qy = Matrix([[sp.cos(theta), 0, sp.sin(theta... | true |
f7e9690ca820d92f70fb7f3b0ac588cadfa11dbf | ck10100713/stock-for-ml2021 | /formal stock_ver2.py | UTF-8 | 4,553 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[18]:
import json
import time
import requests
import numpy as np
import pandas as pd
from datetime import datetime
from openpyxl import Workbook
from openpyxl import load_workbook
from openpyxl.utils import get_column_letter
from openpyxl.styles import Font, colors, Alignme... | true |
04914d3d179599ab405ae007362fd1664b11becc | sas695/Python-Training_4 | /flights.py | UTF-8 | 790 | 3.265625 | 3 | [] | no_license | import json
from geopy import distance
with open('airports.json') as j:
airports = json.load(j)
FAA_input = input('Enter FAA code: ')
def find_airport(value,key):
for a in airports:
if value == a[key]:
return a
airport = find_airport(FAA_input,'IATA/FAA')
lat1 = airport["Latitude"... | true |
82c87298f4036dfa3b16e269ad76cb55fb73f4c1 | vibhorgoyal18/ai_training | /control_structures_and_functions/factorial.py | UTF-8 | 453 | 4.125 | 4 | [] | no_license | # Given a number ‘n’, output its factorial using reduce().
# Note: Make sure you handle the edge case of zero. As you know, 0! = 1
#
# P.S.: Finding the factorial without using the reduce() function might lead to deduction of marks.
#
# Examples:
# Input 1:
# 1
# Output 1:
# 1
#
# Input 2:
# 3
# Output 2:
# 6
from fun... | true |
835e107c43600e13de3cf41d696a3a7ffa63ef36 | pluflou/TuneOptimizer | /nmr_matching.py | UTF-8 | 2,342 | 2.890625 | 3 | [] | no_license | import numpy as np
from time import sleep
from epics import caget, caput
from setup import cycleB1B2, nmrRange, set_probe, tlm_reading
from setup import GetMagnet, SetMagnet
import datetime
import matplotlib.pyplot as plt
#start by setting the dipoles to a high current to be a the right edge of the viewer
#check whic... | true |
22f4eb3bd2287000628f6c9e3be22060ca0b7745 | tantale/intranet | /intranet/model/pointage/employee.py | UTF-8 | 7,351 | 2.765625 | 3 | [] | no_license | """
:module: intranet.model.pointage.employee
:date: 2013-07-28
:author: Laurent LAPORTE <sandlol2009@gmail.com>
"""
import datetime
from sqlalchemy.orm import relationship
from sqlalchemy.schema import Column
from sqlalchemy.types import Date, Float, Integer, String
from intranet.accessors.gap_fill import GapFill
fr... | true |
9631543608fa41148b8f0193f2b3fe4de2f1bbf6 | amshapriyaramadass/learnings | /Hackerrank/math/polarcoordniates.py | UTF-8 | 411 | 3.609375 | 4 | [] | no_license | # Sample Input
# 1+2j
# Sample Output
# 2.23606797749979
# 1.1071487177940904
import math
import cmath
if __name__ == '__main__':
polarin = complex(input())
x1 = pow(polarin.real,2)
y1 = pow(polarin.imag,2)
x = math.sqrt(x1+y1)
print(x,math.atan2(polarin.imag, polarin.real),sep ='\n')
... | true |
f055bf9b61964c2ffa58ecca568484a06520b644 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2681/60787/290877.py | UTF-8 | 212 | 3.140625 | 3 | [] | no_license | t=int(input())
for ex in range(0,t):
n=int(input())
re=0
while n>0:
if n%2==1:
n=n-1
re+=1
if n==0:
break
n=n//2
re+=1
print(re) | true |
0f3216d7f9ee1f2c3e1edbe68299b71c7558b91b | xmy7080/leetcode | /subtreeOfAnotherTree.py | UTF-8 | 844 | 3.6875 | 4 | [] | no_license | #https://leetcode.com/articles/subtree-of-another-tree/
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isSubtree(self, s: TreeNode, t: TreeNode) -> boo... | true |
c8123ea8d2de8e79db374650894d69a0a01a9832 | rodumani1012/PythonStudy | /Python/Python09_Method/MTest06_param1.py | UTF-8 | 1,049 | 4.0625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 필수 인자와 선택적 인자를 학습해보자.
def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):
print("-- This parrot wouldn't", action, end=' ')
print("if you put", voltage, "volts through it.")
print("-- Lovely plumage, the", type)
print("-- It's", state, "!")
'''주석을 풀어가며... | true |
eb35caeb41f8932077ccfc0ebc78ebff722d4120 | ashok-bkt22/data_processing | /convert_img_numpy.py | UTF-8 | 997 | 2.828125 | 3 | [] | no_license | # convert image data into numpy array
import cv2
import numpy as np
from random import shuffle
from tqdm import tqdm
import os
TRAIN_DIR = os.path.join(os.path.expanduser('~'),
'dev',
'fabrics',
'loch',
... | true |
8c87ca63887a66cdec5747c7737dd96e61acb23c | mmcheng55/Sqlite3ORM | /__init__.py | UTF-8 | 4,934 | 3.015625 | 3 | [] | no_license | from . import errors, Table
import sqlite3
class Database:
__slots__ = ["database", "c", "save", "strings", "ints", "real", "numeric"]
def __init__(self, name: str):
"""
Connect to a db
:param name: Database root or filename.
"""
self.database = sqlite3.connect(name, c... | true |
af5649509a09a51bab1642dd1fed9d8769ea20fb | br0ns/blog | /posts/0ctf/r0ops/doit.py | UTF-8 | 229 | 2.828125 | 3 | [] | no_license | import gmpy
N = 2**64
xs = [0x1337deadbeef0095]
for _ in range(8):
xs.append((xs[-1] * 0xcafe + 0xbeef) % N)
d = gmpy.invert(13337, 2**63)
for x in xs[1:]:
y = pow(x, d, N)
assert pow(y, 13337, N) == x
print y
| true |
6f8ce2ca6e83b70a3bc47d0552b778bac7d4940e | zielman/Codeforces-solutions | /0_ACMSGURU/533 Dice Tower.py | UTF-8 | 297 | 2.953125 | 3 | [
"MIT"
] | permissive | # https://codeforces.com/problemsets/acmsguru/problem/99999/533
n = int(input())
if n < 30:
if n == 21:
print(1)
else:
print(-1)
else:
for i in range(2, 13):
if ((n-i) / 7) % 2 == 0:
print((n-i) // 14)
break
else:
print(-1) | true |
be8dcfbc8afe37a18cf16c042c59f61652410c0d | enrico-j-yang/dorothy-test-script | /can_sim/speed_p.py | UTF-8 | 2,955 | 2.625 | 3 | [] | no_license | # -- coding: utf-8 --
from can_sim.process import *
class SpeedP(Processer):
"""时速协议数据封装器"""
def __init__(self):
super().__init__(0x25F)
# 第1个字节完整表示当前车速
def set_speed(self, speed):
self.set_data_auto(1, int(speed))
class LimitSpeedP(Processer):
"""燃油协议数据封装器"""
_rpm_invalid_... | true |
46eba28d78cff8b9140740d6e915577923dac70b | masipcat/Informatica | /Q1/s9/EOT/EOT-74.py | UTF-8 | 263 | 2.75 | 3 | [] | no_license | import sys
valors = sys.argv[1:]
length = len(valors)
if length > 0:
valors.sort()
if length % 2 == 0:
mediana = (float(valors[length/2 - 1]) + float(valors[length/2])) / 2
else:
mediana = valors[length / 2]
print mediana
else:
print "No hi ha valors"
| true |
c366b5a0a2d96901523df561dcce45a1c4f4162f | asreedh3/Machine-Learning | /KNN Classifier.py | UTF-8 | 3,154 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 29 21:33:46 2018
@author: Ashlin
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import ListedColormap
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
f... | true |
bd36b582d72df119421d32cf2134ba104e5bd815 | ericmjl/pandas_flavor | /pandas_flavor/register.py | UTF-8 | 7,219 | 3.359375 | 3 | [
"MIT"
] | permissive | """Register functions as methods of Pandas DataFrame and Series."""
from functools import wraps
from pandas.api.extensions import (
register_series_accessor,
register_dataframe_accessor,
)
import inspect
method_call_ctx_factory = None
def handle_pandas_extension_call(method, method_signature, obj, args, kwar... | true |
89f3e00cef92a383a352eab93cf3f0578f5d022b | scls19fr/APC | /apc/outlet.py | UTF-8 | 2,823 | 3.21875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from collections import OrderedDict
import re
APC_OUTLET_STATUS_PATTERN = re.compile(r'(OFF|ON)(\*?)')
APC_OUTLET_ROW_PATTERN = re.compile(r'Outlet (\d) (.*) (OFF\*?|ON\*?)')
APC_OUTLET_ROW_PATTERN2 = re.compile(r'(\d)- (.*) (OFF\*?|ON\*?)')
class OutletStatusParseException(Exception):
pass... | true |
c9aef42b4048d8a750d36c84507f83255aceb23a | captainhook0626/problem_solving_with_algorithms_and_data_structures_using_python | /ch4/ch4_koch1.py | UTF-8 | 818 | 3.421875 | 3 | [] | no_license | from turtle import *
def kochSnowflake(edgeLen,degree, myTurtle):
if degree == 0:
myTurtle.forward(edgeLen)
return None
else:
edgeLen /= 3
kochSnowflake(edgeLen, degree - 1, myTurtle)
myTurtle.left(60)
kochSnowflake(edgeLen, degree - 1, myTurtle)
myTurtle... | true |
604c0e1bfab47dfffb5a61dce065b7d1f1c3b80b | jailukanna/100daysofcodechallenge | /day100/mapp.py | UTF-8 | 2,159 | 2.828125 | 3 | [] | no_license | from flask import Flask,render_template
from flask_sqlalchemy import SQLAlchemy
import sqlite3, random
app = Flask(__name__)
connection = sqlite3.connect('menu.db')
c = connection.cursor()
def get_items(table_name):
items = []
weights = []
items.clear()
weights.clear()
if table_name == "breakfa... | true |
4a8f9677f7d000c83349b1049ba5c7990f25324b | akaptur/connect_four | /checkmatetests.py | UTF-8 | 4,187 | 2.84375 | 3 | [] | no_license | import connectfour as cf
import copy
import cf_strats_redone as scf
import random
b = cf.Board(1,2)
print b.arr
print b.arr[0,0]
#assert False
def createrandomboard(nummoves):
board = cf.Board(1,2)
while board.check_four_alternate(1) == True or board.check_four_alternate(2) == True or len(board.moves) < 2*nummoves:... | true |
3e29d411af119bd8f12d34a02e80fd14027789d3 | Nilesh-Thote/t2021-2-1 | /Program-2.py | UTF-8 | 411 | 4.0625 | 4 | [] | no_license | """Problem-2: With a single integer as the input,
generate the following until a = x"""
a=int(input("Enter the no: ")) #Asking user for input
count=0
i=1
while count!=a: #Loop will run till count is equal to input number
if i%2!=0: #To print odd series
print(i,end=",")
... | true |
c687b07362cbb593fec50861736ae01ec617c418 | JA1221/Racing-Game | /sql.py | UTF-8 | 1,331 | 2.703125 | 3 | [] | no_license | import mysql.connector
con = mysql.connector.connect(
host="35.201.248.77",
user="game",
passwd="game123",
database="game"
)
cursor = con.cursor()
def user_signup(tup):#註冊使用者
try:
cursor.execute("INSERT INTO player(user_id, user_name, password) VALUES(%s,%s,%s)", tup)
return True
... | true |
2c93d4f8099fbc28ff94f5b941ac5fbedcdb160b | ojhermann-ucd/comp10280 | /p19p2.py | UTF-8 | 1,562 | 4.28125 | 4 | [] | no_license | """
Pseudocode
use each digit in the input number as a weight to multiply an appropriate power of the given base
lest significant digit has power of 0, with each power incrementing by one
"""
import sys
def toBaseTen(n, b):
baseTen = 0
count = 0
for i in reversed(n): #use of reversed OK by Khalil on 23 Nov 2016
... | true |
b7840bb0fc4f896a84f785c76b475d56b26f193f | W0ofles/SteamCurator | /venv/Lib/site-packages/eventemitter/__init__.py | UTF-8 | 5,146 | 3.171875 | 3 | [
"CC0-1.0"
] | permissive | __version__ = "2.1"
__author__ = "Rossen Georgiev"
from collections import defaultdict, OrderedDict
import gevent
from gevent.event import AsyncResult
from gevent.queue import Queue
class EventEmitter(object):
"""
Implements event emitter using ``gevent`` module.
Every callback is executed via :meth:`gev... | true |
52cc31a97ea53fa5a4a1330e05f2973a8453d218 | iiharu/NN | /GoogLeNet.py | UTF-8 | 8,639 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow import keras
from datasets import cifar10
from layers import (average_pooling2d, batch_normalization, concat, conv2d,
dense, dropout, flatten, max_pooling2d, relu, softmax)
class GoogLeNet:
"""
GoogLeNet (Inception... | true |
1f515b3421a581b47ce8d39b57aa50920648ce2f | abhayrathod246/Personal-Voice-Assistance | /main.py | UTF-8 | 6,963 | 2.796875 | 3 | [] | no_license | import pyttsx3
import speech_recognition as sr
import datetime
import wikipedia
import webbrowser
import os
import random
import smtplib
import ssl
import requests
import json
MASTER="ABHAY"
engine=pyttsx3.init("sapi5")
voice=engine.getProperty('voices')
engine.setProperty('voice',voice[0].id)
#speak f... | true |
74bb893ce4eb71a74ac879a588d7f97ce55fc686 | wudinaonao/CaoliuDownloads | /Spider/ResultClass/TorrentResultClass.py | UTF-8 | 1,865 | 2.640625 | 3 | [] | no_license |
class TorrentResultClass():
_category = ""
_title = ""
_detailsPageUrl = ""
_downloadPageUrl = ""
_torrentDownloadUrl = ""
_savePath = ""
_resposne = ""
_crawData = ""
_md5 = ""
_magnet = ""
_downloaded = 0
def getCategory(self):
return self._category
... | true |
037617c4cfc8443b332c9f03947b1394c0b12c6c | ZachAnders/Python-to-x86-asm | /compile.py | UTF-8 | 670 | 2.53125 | 3 | [] | no_license | import sys, os
from python_compiler.debug import dbg
from python_compiler.compiler_main.py_compiler import Compiler
"""
Rudimentary main function.
Run like this:
python main.py <testfiletocompile.py>
[Spits out ASM to stdout]
"""
if __name__ == '__main__':
#dbg.log.enable()
test_file = sys.argv[1... | true |
ea1fbdc5eb006cdc1821242c387c80d814e2e17d | rihuaa/project2 | /exp_eval_testcases.py | UTF-8 | 2,485 | 3.046875 | 3 | [] | no_license | import unittest
from exp_eval import infix_to_postfix, postfix_eval, postfix_valid
class MyTest(unittest.TestCase):
def test_reg_exp(self):
exp = '3 * 2 + 5'
post = infix_to_postfix(exp)
self.assertEqual(post, '3 2 * 5 +')
self.assertEqual(postfix_eval(post), 11)
self.asser... | true |
eb645b258bc3c3e4efa00ea63ba0950a3a424c2c | serdarcw/python_notes | /python_exercises/Untitled3.py | UTF-8 | 537 | 3.828125 | 4 | [] | no_license | Given two strings, and ,
that may or may not be of the same length,
determine the minimum number of character deletions required to make and anagrams.
Any characters can be deleted from either of the strings.
a = "Car"
b = "car"
pre_total = len(a)+len(b)
for i in a:
if i in b :
b = b.replace(i,'',1)
... | true |
f855ce0d39bfc53257712c7204dbb86e73164a0c | Gsuryansh/python_selenium | /PythonProgram/Test/even_at_even_place_odd_at_odd_place.py | UTF-8 | 638 | 3.265625 | 3 | [] | no_license | list = [1,2,3,4,6,7,9,9,9,8,8,8]
i = 0
while i< len(list)-1:
j = i+1
if list[i]%2 != 0 and list[j]%2 == 0:
list[i],list[j] = list[j],list[i]
i = j+1
elif list[i]%2 == 0 and list[j]%2 != 0:
i = j + 1
elif list[i]%2 == 0 and list[j]%2 == 0:
for k in range(j+1,len(list)):
... | true |
1445d727923f4c1c498e0590740ebeb4ff2b4e22 | EkaterinaKochergina/algo_club | /onpython/sol_kat/approx/queue.py | UTF-8 | 1,176 | 3.53125 | 4 | [] | no_license | #!/usr/bin/python
import unittest
class Queue(object):
def __init__(self):
self.a = 0
self.b = 0
self.n = 5
self.dat = [0]*self.n
def next(self, p):
return (p+1)%self.n
def push(self, v):
self.dat[self.b] = v
self.b = self.next(self.b)
def ... | true |
0d2d7ef924ae163ad4b659183c67d99d9273f5a7 | jdrestre/Online_courses | /Codigo_Facilito/development_python/professional_course_of_python/python_profesional/ejemplos/strings/secuencia.py | UTF-8 | 110 | 3.234375 | 3 | [] | no_license | curso = "Curso de Python"
curso = "c" + curso[1:] + " " + str(3) + " " + "en código facilito."
print(curso) | true |
215627bd8c825459050fd52bb14cbe1236a99dd3 | vzyknc/cod19grp4 | /thinpad_top.srcs/sim_1/runtime/scripts_router/run_all.py | UTF-8 | 464 | 2.859375 | 3 | [] | no_license | """
执行目录下所有脚本
"""
import sys
import os
if __name__ == '__main__':
# locate this script
directory = os.path.dirname(os.path.abspath(__file__))
for filename in os.listdir(directory):
path = os.path.join(directory, filename)
if os.path.samefile(path, sys.argv[0]):
continue
... | true |
3ec5f60c33b033bf01e54bec4a33965db1f7c47b | MesutCevik/adventcalendarPython | /impl/Competitor.py | UTF-8 | 1,684 | 3.5625 | 4 | [] | no_license | from impl.Driver import Driver
from impl.Vehicle import EngineType, Vehicle
class Competitor:
driver: Driver
vehicle: Vehicle
points = 0
unique_id = 0
def __init__(self, driver: Driver, vehicle: Vehicle, points: int, unique_id: int):
self.driver = driver
self.vehicle = vehicle
... | true |
1acdc0d46422bd83f445b09135ab5c5e69fbd780 | luweizhang/pokegan | /layers.py | UTF-8 | 1,180 | 2.65625 | 3 | [] | no_license | import tensorflow as tf
def linear(x, units, activation=tf.nn.elu, name=None, bn=True):
with tf.variable_scope(name):
w = tf.get_variable("w", [x.get_shape().as_list()[-1], units], dtype=tf.float32,
initializer=tf.glorot_normal_initializer())
b = tf.get_variable("b", [u... | true |
5a07981e63c0074ce1ab4e0aa77f7d95c7ec5026 | sergueik/springboot_study | /basic-thread-queue/test_queue.py | UTF-8 | 833 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3 $@
import threading
import time
import queue
import sys
import random
import asyncio
global num
q = queue.Queue()
# this worker subroutine will be runs 'as a thread'.
def worker():
while True:
item = q.get()
cnt = item + 1
delay = random.randint(0, num)
print(f'Working on {cnt}... | true |
8eaf05c9b537f8d7b67633963b2f53f375044a96 | ViktoriAndr/Pacman | /Ghost.py | UTF-8 | 1,385 | 3.421875 | 3 | [] | no_license | from Map import Map
from Point import *
from Queue import Queue
from Wall import Wall
class Ghost:
def __init__(self, x, y):
self.coord = Point(x, y)
self.end = False
self.wall = Wall()
self.map = Map()
def search_path(self, graph, start, goal):
frontier = Queue()
... | true |
fd4af2b04b907edce817a42746fa978f0d2e23e2 | jmgc/pyston | /test/tests/local_lifetime.py | UTF-8 | 744 | 3.28125 | 3 | [
"Python-2.0",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | from _weakref import ref
# Test to make sure that we clear local variables at the right time:
def f1():
def f():
pass
r = ref(f)
print type(r())
# del f
f = 1
assert not r()
for i in xrange(40):
f1()
def f3():
class MyIter(object):
def __init__(self):
self.n... | true |
95a041055aba8265947e4ca7ce893cfbc73aed91 | heitorchang/learn-code | /battles/arcade/intro/sumUpNumbers.py | UTF-8 | 252 | 3.296875 | 3 | [
"MIT"
] | permissive | def sumUpNumbers(inputString):
p = re.compile('[^\d]+')
nums = p.split(inputString)
nums = filter(lambda s: len(s) > 0, nums)
nums = map(int, nums)
return sum(nums)
def test():
testeql(sumUpNumbers("2 apples, 12 oranges"), 14)
| true |
aa7bcba5d07f50c8f6e483d94b025743a7ac3995 | rafaelperazzo/programacao-web | /moodledata/vpl_data/178/usersdata/352/97131/submittedfiles/contido.py | UTF-8 | 473 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def ocorre (x,lista):
cont=0
for i in range(0, len(lista),1):
if (lissta[i]==x):
cont=cont+1
return (cont)
n=int(input('Quantidade de elementos de a: '))
m=int(input('Quantidade de elementos de b: '))
lista_a=[ ]
lista_b=[ ]
for i in range(0,n,1... | true |
f7cd6643b0e8924c1e90a81d6758f24154e518d5 | himanshu0137/codechef | /NAME2.py | UTF-8 | 482 | 3.078125 | 3 | [] | no_license | def func(x, y):
if x == y:
return True
i = 0
j = 0
while 1:
if i >= len(x):
return False
if j >= len(y):
return True
if x[i] == y[j]:
j += 1
i += 1
def main():
m, w = raw_input().split()
a = False
if len(m) >= len(w)... | true |
bc9be11ac3eacd9bd61f868515e017f6380027e4 | Ekaterina-sol/Python_Basics | /hw3/hw3_2.py | UTF-8 | 292 | 2.6875 | 3 | [] | no_license | def user_data(**kwargs):
return list(kwargs.items())
print(user_data(name = input('Имя: '), surname = input('Фамилия: '), year = input('Год рождения: '), city = input('Город проживания: '), email = input('email: '), phone = input('Телефон: '))) | true |
b0477a9fdb3f6d4f31f2994bccf3bf569675d1b6 | CanSat-2020-kimura-lab/SensorModuleTest | /Motor/motor-test2.py | UTF-8 | 1,643 | 2.78125 | 3 | [] | no_license | import pigpio
import time
Ena1 = 13
Pha1 = 19
Ena2 = 12
Pha2 = 25
LARGE = 10
MODE = 9
STBY = 11
pi1 = pigpio.pi()
pi1.set_mode(Ena1,pigpio.OUTPUT)
pi1.set_mode(Pha1,pigpio.OUTPUT)
pi1.set_mode(Ena2,pigpio.OUTPUT)
pi1.set_mode(Pha2,pigpio.OUTPUT)
pi1.set_mode(MODE,pigpio.OUTPUT)
pi1.set_mode(LARGE,pigpio.OUTPUT)
pi1.s... | true |
d06646e55f06f717a703d4275ce4b2aa48ffbece | ChrisTelles152/data-testing | /Dicts/my_dict_py/word_processing/letter_counting_map.py | UTF-8 | 379 | 3.828125 | 4 | [] | no_license | #list of letter counts using mapping
def kay():
num = int(input("How many words? "))
print("Please enter %s words: " % (num))
letters = [""] * num
this = list(map(stringappender,letters))
print (this)
def stringappender(string):
string = []
total = []
new = input()
string.append(new... | true |
d1c1f1a31478580e90c1650925c714fc91b54c0a | Aasthaengg/IBMdataset | /Python_codes/p03032/s451853458.py | UTF-8 | 884 | 2.75 | 3 | [] | no_license | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N, K = map(int, readline().split())
V = list(map(int, readline().split()))
max_value = 0
for L in range(N+... | true |
9cf0bed336b94a54e2aa5e267b2b304325129ec6 | zhlzhl/aug_cola | /run_augment_STS-B.py | UTF-8 | 5,018 | 3.203125 | 3 | [] | no_license | # augment cola dataset
from data_augmentation import *
import spacy
from pycontractions import Contractions
def augment_sentence(sentence, method, pos=None, num_sr_words=0, num_aug_sentences=9, distance=1):
# create a list for augmented_sentences and add the original sentence
augmented_sentences = [sentence]... | true |
cd336f4c7aea5d537e7d4ffbd1728b2ac7ab4557 | ropnop/CrackMapExec | /cme/protocols/http/database.py | UTF-8 | 3,185 | 3.1875 | 3 | [
"BSD-2-Clause"
] | permissive | class database:
def __init__(self, conn):
self.conn = conn
@staticmethod
def db_schema(db_conn):
db_conn.execute('''CREATE TABLE "credentials" (
"id" integer PRIMARY KEY,
"username" text,
"password" text
)''')
db_conn.execute('''CREA... | true |
e939554c7d87d3afa4f61cd33e7f16b24c36c372 | VinBots/MyAlphaZero | /src/main.py | UTF-8 | 1,806 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
######################################################
#
# AlphaZero algorithm applied to Tic-Tac-Toe
# written by Vincent Manier (vmanier2020@gmail.com)
# inspired by a case study provided by Udacity
#
######################################################
import time
import config as config
im... | true |
1ab4d9407ce1ebd2771fa47e9a15a8a574df69a7 | RobertPastor/AircraftTrajectoryPredictionNG | /Home/Tests/xTest_Aircraft_Fuel_Flow.py | UTF-8 | 2,607 | 2.703125 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
'''
Created on 28 déc. 2014
@author: PASTOR Robert
'''
import time
from Home.Environment.Atmosphere import Atmosphere
from Home.Environment.Earth import Earth
from Home.BadaAircraftPerformance.BadaAircraftDatabaseFile import BadaAircraftDatabase
from Home.BadaAircraftPerformance.BadaAircraftF... | true |
5067d2003414853be55460030003e7505d302ff7 | amartya-dev/medjargonbuster-api | /app/rouge_scorer.py | UTF-8 | 1,863 | 2.859375 | 3 | [
"MIT"
] | permissive | import app
import logging
from spacy.language import Language
from spacy.tokens import Doc
from rouge_score import rouge_scorer
log = logging.getLogger(__name__)
from app.models import PIPELINE_STAGES as STAGE
class RougeScorer(object):
"""
Calculates the ROUGE scores of the summary.
Ignored if no summ... | true |
2b89813a1c2101f277f6b05c1f2af604221d2d14 | mlko53/psych209_finalproj | /rand_mdots.py | UTF-8 | 1,875 | 3.375 | 3 | [] | no_license | import numpy as np
import random
import math
def rand_mdots(true, coherence, num=300, speed = 5, time=1000, radius = 128):
'''
args:
num: number of moving dots
coherence: percentage of nonrandom motion
true: true direction
directions: (array) possible directions of moving dot
output:
mdots: array of dire... | true |
905ed8139160624586742503fbcb7ae7be249b6a | carlotta-93/Exercises-from-Structural-Bioinformatic-Course | /biopAssignment.py | UTF-8 | 1,251 | 3.4375 | 3 | [] | no_license | import Bio.PDB as PDB
parser = PDB.PDBParser(QUIET=True)
structure = parser.get_structure("2PTC", "2PTC.pdb")
def centroid(residue):
"""calculates the centroid of the residue given as parameter """
# Bio.PDB.Vector to calculate center-of-mass
center_of_mass = PDB.Vector(0, 0, 0)
# counter for number ... | true |
26910d67c374c8920f8e174dda7b5502d7d13982 | kilyig/api | /app/scraper/sources/adapters/architecture.py | UTF-8 | 1,405 | 2.71875 | 3 | [
"MIT"
] | permissive | from .adapter import Adapter
class Architecture(Adapter):
def scrape_path(self, department, path):
people = []
page = 1
profile_urls = []
while True:
people_page_soup = self.get_soup(department['url'] + path, params={'page': page})
links_page = people_page... | true |
977d6cd62af480221065f765fefa1a2579b620f7 | Krejnerw/WizDanych | /L7_cw/zad2.py | UTF-8 | 264 | 3.34375 | 3 | [] | no_license | import numpy as np
a= np.array([np.arange(3),np.arange(1,4),np.arange(2,5)])
b= np.array([np.arange(4),np.arange(1,5),np.arange(2,6),np.arange(3,7)])
print(a,"3x3")
print(b,"4x4")
print(a.min(axis=1))
print(a.min(axis=0))
print(b.min(axis=1))
print(b.min(axis=0)) | true |
ff9911cde94d1b1a77ef494b4047ab6694d6f158 | Fei-WL/Leetcode | /220 存在重复元素3.py | UTF-8 | 224 | 2.546875 | 3 | [] | no_license | from typing import List
class Solution:
def containsNearbyAlmostDuplicate(self, nums: List[int], k: int, t: int) -> bool:
for index in range(len(nums) - k):
for index in range(1, k):
| true |
b8c3ca5ff987f35cc4571d8c83fd3f717a43eab4 | webclinic017/thorvaldsson-trading-co | /alerts/high_of_low_bar.py | UTF-8 | 1,137 | 2.796875 | 3 | [
"MIT"
] | permissive | class HighOfLowBar:
def __init__(
self, ticker, interval, candle_fetcher, candle_notifier, signal_listener
):
self.ticker = ticker
self.interval = interval
self.candle_fetcher = candle_fetcher
self.candle_notifier = candle_notifier
self.signal_listener = signal_li... | true |
7b3ddd7e1036fc74aee5b212d7059073f837046f | jadyrod124/nyu_homeworks | /Homework_7.py | UTF-8 | 818 | 2.84375 | 3 | [] | no_license | import requests
import jinja2
import urllib.request
from bs4 import BeautifulSoup
url = 'https://www.nytimes.com/2017/10/29/business/virtual-reality-driverless-cars.html'
def scrape_times_article(url):
response = requests.get(url)
pg_text = response.text
soup = BeautifulSoup(pg_text, 'html.parser')
t... | true |
3503da87ce777c831ce13892c906a2f33d46c862 | oJacker/_python | /numpy_code/04/headortail.py | UTF-8 | 1,359 | 4.1875 | 4 | [] | no_license | '''
随机数在蒙特卡罗方法(Monto Carlo method)、随机积分等很多方面都有应用。真随机数的
产生很困难,因此在实际应用中我们通常使用伪随机数。
设想你来到了一个17世纪的赌场,正在对一个硬币赌博游戏下8份赌注。每一轮抛9枚硬币,
如果少于5枚硬币正面朝上,你将损失8份赌注中的1份;否则,你将赢得1份赌注。我们来模拟
一下赌博的过程,初始资本为1000份赌注。为此,我们需要使用random模块中的binomial
函数。
'''
import numpy as np
from matplotlib.pyplot import plot, show
# (1) 初始化一个全0的数组来存放剩余资本。以参数10000调用b... | true |
02cebc76ae9f60b5cfdd4cbf8271b8168afb8929 | Adlaneb10/Python | /Lab6/q3.py | UTF-8 | 79 | 3.34375 | 3 | [] | no_license | for i in range(0,10+1):
sum = i * 9
print(i," * 9 = ",sum)
sum = 0
| true |
1f7a7256806ddda6cffb20005b4e48924dba6f5f | bitnahian/info1110_s2_2019 | /week05/average.py | UTF-8 | 1,746 | 4.78125 | 5 | [] | no_license | """
Function that prints the mean of the numbers in list nums and returns a tuple
- The tuple's first element is the index of the number furthest from the mean
- The tuple's second element is the number furthest from the mean
"""
def average(ls):
# Check for errors in your variables before you use them
if type... | true |
7096d6fba4f329ad3fa88f6146e82c775e7a744c | grmaple/algorithm | /剑指offer/19.py | UTF-8 | 749 | 3.21875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
class Solution:
# matrix类型为二维列表,需要返回列表
def printMatrix(self, matrix):
# write code here
ret = []
if not matrix or not matrix[0]:
return ret
n = len(matrix)
m = len(matrix[0])
state = [[0 for i in range(m)] for j in range(n)]
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
x = 0
y =... | true |
5e58a25afe6e555c1639a3fe397f53e4e556a6fa | denmoff/Mount-AD-Share | /Mount_AD_Share.py | UTF-8 | 3,309 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
############ Mount_AD_Share.py ########################################
#
# Created by Dennis Moffett
# May, 6 2015
# Rutgers University
# Version 1.0.0
# Purpose: Mount user's AD share automatically. First checks to make
# sure the Mac is on Rutgers private ip space. Then it checks
# ... | true |
96349a4ece5de5acdba817f08b66d5ec9ae2c6c8 | pitat1984/VisualStudioDemo | /crypto/vigenere.py | UTF-8 | 653 | 3.859375 | 4 | [] | no_license | from helpers import alphabet_position, rotate_character
def encrypt(text,key):
encrypted_word = ""
rot = 0
i = 0
for char in text:
if char.isalpha() == True:
rot = alphabet_position(key[i])
letter = rotate_character(char,rot)
encrypted_word = encrypted... | true |
1dd6a9a1c5d3bf068f90ae055f6fea638e8ab171 | RieLCho/PS_Practice | /Baekjoon/baekjoon/1541.py | UTF-8 | 323 | 3.390625 | 3 | [] | no_license | input_string = input().split('-')
list_numbers = []
for i in input_string:
sum_value = 0
input_split = i.split('+')
for j in input_split:
sum_value += int(j)
list_numbers.append(sum_value)
result = list_numbers[0]
for i in range(1, len(list_numbers)):
result -= list_numbers[i]
print(result... | true |
1d126aaf998aa77c8d8f48f49159230354d54af7 | Mcful123/volume-detect-v1.2 | /finished_modelV1.py | UTF-8 | 3,357 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 10 15:39:27 2021
@author: chomi
"""
import tensorflow.keras
from PIL import Image, ImageOps
from detecto import core
import numpy as np
import os
np.set_printoptions(suppress=True)
np.set_printoptions(precision =3)
#importing tranined moddels
model = t... | true |
9fcc98165e12b9d9e232efdc7736588313968b86 | twcbe/known_face_detector | /fps.py | UTF-8 | 837 | 3.28125 | 3 | [] | no_license | import time
class Fps():
def __init__(self, average_over_frames=50):
self.average_over_frames = average_over_frames
def start(self):
self.global_start_time = time.time()
self.frame_times = [self.global_start_time]
self.frame = 0
def update(self):
self.frame = self.... | true |
48393e0d7ba035ef904190a4f46ef0ba2002eb9b | Baboskence/snippet-tool | /getSnippet.py | UTF-8 | 1,590 | 2.875 | 3 | [] | no_license | import json
import glob
import re
#load settings
f = open("settings.json", "r")
settings=json.loads(f.read())
start=settings['start']
end=settings['end']
class Snippet:
def __init__(self,str,justAttr):
attrStr=""
if not justAttr:
#content
self.content=str[str.find('\n'):]
#process attributes
attrStr=s... | true |
5de03d1c2c200ab5203b1b7e2b4cc7c574a57d88 | Marinagansi/PythonLabPractice | /practiceq/pythonProject1/fucntion/fuvtion2.py | UTF-8 | 188 | 3 | 3 | [] | no_license | ''' no parameter na d no return type'''
def add():
a=int(input("enter the num:"))
b=int(input("enter the num:"))
add=a+b
print(f'the sum of{a} and{b} is {add}')
add()
| true |
6a18e570e5e52aa0816996ef3b71e6c8d41c9721 | flaviovdf/granger-busca | /gb/tests/test_stamps.py | UTF-8 | 1,884 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf8
from gb.stamps import Timestamps
from numpy.testing import assert_equal
from numpy.testing import assert_array_equal
def test_gets():
d = {}
d[0] = [1, 2, 3]
d[1] = [4, 5]
d[2] = [6, 7, 8, 9, 10]
d[3] = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
d[4] = [21]
stamps = Time... | true |