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 |
|---|---|---|---|---|---|---|---|---|---|---|
f35eb89e350295aba6610ecc8a13c567433a7206 | freedom357/freedom357.github.io | /data_anonymize.py | UTF-8 | 722 | 2.640625 | 3 | [] | no_license | import csv
from faker import Faker
from collections import defaultdict
def anonymize ():
faker =Faker()
names = defaultdict(faker.name)
emails = defaultdict(faker.email)
citys = defaultdict(faker.city)
with open("original_data.csv", newline='') as Lucky:
with open("anonymized.csv", 'w',newl... | true |
a1a5d3376ac0f4edf6b4c234ca661d0861cc1acc | waws520waws/waws_spider | /selenium_test/selenium_test_13.py | UTF-8 | 532 | 2.640625 | 3 | [
"MIT"
] | permissive | # encoding:utf-8
from selenium import webdriver
import time
"""
前进/后退操作
"""
options = webdriver.ChromeOptions()
options.add_experimental_option("mobileEmulation",{"deviceName":"iPhone X"})
driver = webdriver.Chrome(r"C:\Users\19663\Desktop\chromedriver.exe",chrome_options=options)
# driver.set_window_position(500,100... | true |
37151a8d219f4dff7e8dbf042b318e0bba942897 | montehoover/HW4 | /main.py | UTF-8 | 2,560 | 3.09375 | 3 | [] | no_license | import graphviz
import numpy as np
from sklearn.datasets import load_iris
from sklearn import tree
from scipy import stats
def main():
examples, labels = parse('data_hw4_diabetes/diabetes_train.txt')
tst_examples, tst_labels = parse('data_hw4_diabetes/diabetes_test.txt')
# 1.0 Get accuracies with various... | true |
82c5bcfb02530625f95dcb67841bfe68db2ff43d | ali-pooyan/airasia_assessment | /question3.py | UTF-8 | 269 | 3.171875 | 3 | [] | no_license | def counting (target , input ):
sum = 0
for i in input :
if i == target :
sum=sum+1
print('number count of '+target )
print(sum)
target = 'zero'
input = ['zero','help','zero','real','none','hello']
counting(target,input)
| true |
0cf5ca71001dbf06eef52fd23d9e033b4e24fb71 | jemd321/LeetCode | /206_reverse_linked_list.py | UTF-8 | 984 | 3.96875 | 4 | [] | no_license | class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class ReverseLinkedList:
def reverseList(self, head):
if not head:
return None
if not head.next:
return head
prev = curr = head
curr = curr.next
prev.nex... | true |
7aecaab82a10d664bd9f86e4da6e4c81d099d96d | GaoLF/LeetCode-PY | /Pascal's Triangle.py | UTF-8 | 541 | 3.359375 | 3 | [] | no_license | class Solution:
# @param {integer} numRows
# @return {integer[][]}
def generate(self, numRows):
if not numRows:
return []
res = [[1]]
for i in range(numRows-1):
last = res[i]
to_insert = []
to_insert.append(1)
for j in range... | true |
01a315fabce809047f17ef7f832525ddaa116341 | ltinsitu/EXPs_perception_contours_finaux | /Scripts/create_table_expe.py | UTF-8 | 6,564 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, re, os, csv
#Open input and output file
csvfile = open("/home/lucas/Documents/CloudStation/SDL/PhD/Prosodie/Expés_Prosodie/EXPs_perception_contours_finaux/Expe_perception_verif_methodo_3/Expe_perception_verif_methodo_3_BOTH.csv", 'r')
#parse csvs
reader = cs... | true |
d61e7acc0c4f323740931d68222ceb1320d9a069 | SatishGodaPearl/pynodes | /rewind/env.py | UTF-8 | 885 | 2.59375 | 3 | [] | no_license | import nodes
class RewindEnv(nodes.GraphObject):
"""Environment through which users can set cutoffs
and other variables that affect all Rewind-related
operations in a session.
"""
@nodes.graphMethod(nodes.Settable)
def AsOfTimeCutoff(self):
return # TODO: Now.
@nodes.... | true |
478127039a7c66ae4ae67f6fff70b10facb38707 | Kevin-McGonigle/comet | /src/server/tests/structures/test_inheritance_tree.py | UTF-8 | 4,758 | 2.90625 | 3 | [] | no_license | from unittest import TestCase
from unittest.mock import patch, MagicMock
from metrics.structures.base.graph import Node
from metrics.structures.inheritance_tree import InheritanceTree, Class, KnownClass, UnknownClass
class TestInheritanceTree(TestCase):
"""
Inheritance tree test case.
"""
def test_b... | true |
831c97e6cb0a16f6c45fdeaa553b0e76b8502c39 | Aasthaengg/IBMdataset | /Python_codes/p02829/s027393846.py | UTF-8 | 113 | 3.09375 | 3 | [] | no_license | A = input()
B = input()
candidate = set(('1', '2', '3'))
exclude = set((A, B))
print((candidate - exclude).pop()) | true |
a8032a2bb5f76f977743e1d23c550ea0293a0157 | zachvalenta/grokking-algorithms | /src/recursion.py | UTF-8 | 361 | 3.6875 | 4 | [] | no_license | def countdown(arg):
"""
* pg. 41
"""
print(arg)
return None if arg == 0 else countdown(arg - 1)
def do_sum(arg):
if arg == 0:
return arg
else:
return arg + do_sum(arg - 1)
def do_factorial(arg):
"""
* pg. 45
"""
if arg == 1:
return arg
else:
... | true |
5868111d9c4b553f644a01e299575d51749ae7c7 | allenwhc/Hackerranks | /Algorithm/GridWalking/walk.py | UTF-8 | 334 | 3.21875 | 3 | [] | no_license | def gridWalking(N, M, x, y):
pass
if __name__ == '__main__':
file=open('data.txt','r')
data=[line.strip('\n').split() for line in file]
file.close()
for i in range(1, len(data), 3):
N=int(data[i][0])
M=int(data[i][1])
start_x,start_y=int(data[i+1][0]) - 1,int(data[i+1][1]) - 1
print gridWalking(N, M, sta... | true |
ece8f3f5c7724d4576c94d85b66b5ba1952e4ca8 | kefabean/aws-tools | /stack | UTF-8 | 13,118 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
import sys, getopt, boto3, yaml, base64, re, time, string
from os import listdir
from os.path import isfile
from botocore.exceptions import ClientError
completed_states = [
'CREATE_FAILED',
'CREATE_COMPLETE',
'ROLLBACK_FAILED',
'ROLLBACK_COMPLETE',
'DELETE_FAILED',
'DELETE_CO... | true |
e86a5e6b5eae0e3f404953e08a7c02c9d5f0e42c | maykonlf/TornadoAPI-Curso | /api/persistence/database.py | UTF-8 | 3,770 | 2.9375 | 3 | [] | no_license | import sqlite3
__conn = None
def dict_factory(cursor, row):
d = {}
for index, collumn in enumerate(cursor.description):
d[collumn[0]] = row[index]
return d
def get_conn() -> sqlite3.Connection:
global __conn
if __conn is None:
__conn = sqlite3.connect("database.sqlite")
... | true |
c2b08a358b3d0079e08ae61ad44aab0504cae1f3 | cylinder-lee-cn/LeetCode | /LeetCode/367.py | UTF-8 | 840 | 4.21875 | 4 | [] | no_license | """
367. 有效的完全平方数
给定一个正整数 num,编写一个函数,如果 num 是一个完全平方数,则返回 True,否则返回 False。
说明:不要使用任何内置的库函数,如 sqrt。
示例 1:
输入:16
输出:True
示例 2:
输入:14
输出:False
"""
class Solution:
def isPerfectSquare(self, num):
"""
:type num: int
:rtype: bool
"""
i = 1
wh... | true |
df31c2ddf584ccc0c021b1eb07c0d203de0c9414 | laroccacharly/reinforcement_learning_adventure | /src/utils/memory.py | UTF-8 | 856 | 3.265625 | 3 | [] | no_license | import random
from src.utils.misc import Transition
class ReplayMemory(object):
"""
A mini database to store and then sample batches of data.
"""
def __init__(self, capacity):
self.capacity = capacity
self.memory = []
self.position = 0
def push(self, *args):
"""Sav... | true |
3566b7aadea8c8afea70d845bd0f63c2396c5976 | birune/kosen | /PBL/myfunc.py | UTF-8 | 1,939 | 2.625 | 3 | [] | no_license | import time
import datetime
import smtplib
from email.mime.text import MIMEText
from email.utils import formatdate
import time
import threading
def buzzer():
print("buzzer on")
time.sleep(10)
print("buzzer off")
def mail(from_address, to_address, password, server, port):
f = open("mail.t... | true |
92b5e6254230aaee496f2930bb4665062c944d63 | windard/leeeeee | /split-a-string-in-balanced-strings.py | UTF-8 | 673 | 3.3125 | 3 | [
"MIT"
] | permissive | # coding=utf-8
class Solution(object):
def balancedStringSplit(self, s):
"""
:type s: str
:rtype: int
"""
ln = rn = 0
result = []
current = ''
for n in s:
if n == 'L':
ln += 1
else:
rn += 1
... | true |
13b0c54c73b3a1bd66631b65d10fe2965d85879b | liuw/project-euler | /p12.py | UTF-8 | 1,727 | 3.5625 | 4 | [] | no_license | #!/usr/bin/python
# Algorithm 1: for a given number
# 1. find all prime factors
# 2. combine prime factors to make new factors
# 3. deduplicate all factors
def seq_gen():
counter = 0
val = 0
while True:
counter += 1
val += counter
yield val
import itertools
# Fast prime gen... | true |
b819175a960080421ca41ff33b0eb950e27fcad6 | yanbernardo/exercicios-python-3 | /Exercícios/Desafio 088.py | UTF-8 | 575 | 3.4375 | 3 | [] | no_license | from random import randint
from time import sleep
jogos = list()
print('-+' * 20)
print('{:^40}'.format('MEGA-SENA DA VIRADA'))
print('-+' * 20)
qt = int(input('Deseja quantos jogos?: '))
for cont in range(0, qt):
jogos.append(list())
random = randint(1, 60)
for c in range(0, 6):
while random in jog... | true |
b106d56da95ea5a35b53a40e1b6199300d6f96be | blitzingeagle/VehicleSuperRes | /test.py | UTF-8 | 2,311 | 2.5625 | 3 | [] | no_license | import numpy as np
import cv2
import torch
import torch.nn as nn
device = torch.device("cuda")
model = nn.Sequential(
nn.Conv2d(3, 16, (3, 3), padding=(1, 1)),
nn.LeakyReLU(0.1),
nn.Conv2d(16, 32, (3, 3), padding=(1, 1)),
nn.LeakyReLU(0.1),
nn.Conv2d(32, 64, (3, 3), padding=(1, 1)),
nn.LeakyR... | true |
3a1fa36d6147a9e65eb1e6fe53b93c009e8a68f5 | Thierry-FR/DL-Tools | /dl_tools.py | UTF-8 | 14,194 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
######### DESCRIPTION #########
# dl_tools : Easy forensic tools downloader for Windows
# Usage :
# dl_tools.py [-h] -t TOOL [-p PROXY]
#
# Forensic tools easy downloader
#
# optional arguments:
# -h, --help ... | true |
a3e680578d8d111a31054b0ac2fa0734056168d1 | igortereshchenko/amis_python | /km73/Zviahin_Mykyta/5/task4.py | UTF-8 | 531 | 3.53125 | 4 | [] | no_license | massive = []
N = int(input("Number of skittles: "))
cointer = 0
for i in range(N):
skittle = 'I'
massive.append(skittle)
K = int(input("Number of shots: "))
for j in range(K):
li = int(input("Enter the lowest number of knocked-down skittles: "))
ri = int(input("Enter the highest number of knock... | true |
125378810932afdf3e97765e1711633f4dc952e7 | hlopeth/BachelorLaboratoryWorks | /TravelProblem/Main.py | UTF-8 | 3,029 | 3.265625 | 3 | [] | no_license | import os
from numpy import *
import random
def main():
file = openF('graph.txt')
#graph = loadGraph(file)
graph = randomGraph(2)
tour = TSP(graph)
print("graph = ")
print(graph)
print("TSP tour = ")
print(tour)
tour = Zgadn(graph)
print("Zhadn tour = ")
print(tour)
... | true |
5debb24411bebd9bbbd4b4b68afe6c1f20900938 | analkumar2/Thesis-work | /2019-12-15-pipPackagingtutorial/brute_curvefit/brute_curvefit/brute_curvefit.py | UTF-8 | 4,798 | 2.953125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Anal Kumar"
__copyright__ = "Copyright 2019-, Anal Kumar"
__version__ = "0.0.1"
__maintainer__ = "Anal Kumar"
__email__ = "analkumar2@gmail.com"
import numpy as np
from scipy.optimize import curve_fit
import matplo... | true |
bd2b7a7bf9ec731445288851fd0c044d043d9d7b | Kushagrakmr/learning_python | /polyporphism/magic_methods.py | UTF-8 | 468 | 3.5625 | 4 | [] | no_license | class Human:
def __init__(self, first, last, age):
self.first = first
self.last = last
self.age = age
def __repr__(self):
return f"Human named {self.first} {self.last}"
def __len__(self):
return self.age
def __add__(self, other):
if isinstance(other, Hu... | true |
7126fc53d72ee2008434cde9269e392f5f344b38 | ksrntheja/08-Python-Core | /venv/serialization/02PickleMultipleSender.py | UTF-8 | 1,253 | 2.921875 | 3 | [] | no_license | # Sender is responsible to save Employee objects to the file
from PickleMultipleEmp import *
import pickle
f = open('emp.dat', 'wb')
while True:
eno = int(input('Enter Employee Number:'))
ename = input('Enter Employee Name:')
esal = float(input('Enter Employee Salary:'))
eaddr = input('Enter Employee A... | true |
87e329930ce52b2c754329dec59cc596084ea503 | dfioravanti/opening_hours_python | /test/utils.py | UTF-8 | 1,008 | 2.9375 | 3 | [
"MIT"
] | permissive | import json
from pathlib import Path
from typing import Dict, List, Tuple
def load_data_results(base_filename: str, only_data: bool = False) -> Tuple[List[str], List[Dict[str, str]]]:
"""
Load the data and results for the tests.
Parameters
----------
base_filename : str
the base filename... | true |
c7196246431e230d9973055803f93f462d0ed96a | bwbobbr/pycharm-xx | /图灵学院视频练习/base/part 9/text-09-2 列表函数.py | UTF-8 | 1,731 | 3.84375 | 4 | [] | no_license | #append,在末尾添加一个内容
a = [i for i in range(1,5)]
print(a)
a.append(50)
print(a)
print('*'*50)
# insert(index,data), 在某个位置添加内容
a.insert(3,666)
print(a)
print('--'*20)
#del 删除
#pop,从对位拿出一个元素,即默认是将最后一个元素取出来
b = a.pop(2)
print(a)
print(b)
print('--'*20)
#remove(data)删除指定的元素,仅移除第一个值
a.append(1)
print(a)
print(id(a))
a.remove(1... | true |
80d1011da8146bdd54e8aa2e627dbde064dc12e6 | ssinghaldev/30_days_of_code | /python/Day26/nested_logic.py | UTF-8 | 538 | 3.109375 | 3 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
import sys
rdate = list(map(int, input().split()))
edate = list(map(int, input().split()))
if (rdate[2] < edate[2]) or (rdate[2] == edate[2] and rdate[1] < edate[1]) or (rdate[2] == edate[2] and rdate[1] == edate[1] and rdate[0] <= edate[0]):
p... | true |
13725a22f327f3c7c9859002aa6a2e7ffd200e09 | interestcoding/fluentpython | /2.6.py | UTF-8 | 951 | 3.953125 | 4 | [] | no_license | import dis
import traceback
# 2.6 序列的增量赋值
l = [1, 2, 3]
print(id(l)) # 刚开始时列表的 ID。
l *= 2
print(l)
print(id(l)) # 运用增量乘法后,列表的 ID 没变,新元素追加到列表上。
t = (1, 2, 3)
print(id(t)) # 元组最开始的 ID。
t *= 2
print(id(t)) # 运用增量乘法后,新的元组被创建。
# 示例 2-15 一个谜题,没人料到的结果:t[2] 被改动了,但是也有异常抛出
t = (1, 2, [30, 40])
try:
t[2] += [50, 60]
exc... | true |
565e9cbf556b2962f4945b7692bc8bb3076d9c4f | StudyForCoding/ProgrammersLevel | /Level1/Lessons77884/minari - 77884.py | UTF-8 | 704 | 3.59375 | 4 | [
"MIT"
] | permissive | # 약수의 개수와 덧셈
```python
def solution(left, right):
answer = 0
nums = 0
num = []
lft_rht = []
#2.
for i in range(left,right+1):
lft_rht.append(i)
for j in range(1,i+1):
if i%j == 0:
nums+=1
num.append(nums)
nums = 0 # nums 초기화해서 다름 수의... | true |
163e12d6e22a86bd046ed428203ff01d46652a7a | dpflann/review | /epi/next_largest_bit_string.py | UTF-8 | 535 | 3.671875 | 4 | [] | no_license | ## Algorithm for creating the next largets bit string
def next_largest_bit_string(n):
n_str = [ s for s in n ][2:]
i = len(n_str) - 1
while n_str[i] == "1":
n_str[i] = "0"
i -= 1
n_str[i] = "1"
bin_array = ['0','b'] + n_str
return ''.join(bin_array)
def n_l_b_s(n):
i = 1
while n & i >= 1:
... | true |
79d70b9d07e4162a675e37abfd1345606a17cadb | d3dave/weblog | /weblog.py | UTF-8 | 2,301 | 2.53125 | 3 | [
"MIT"
] | permissive | import logging
import logging.handlers
import http.server
import socketserver
import time
import json
import threading
import random
import string
import queue
import webbrowser
import websocket
class Handler(http.server.SimpleHTTPRequestHandler):
log_queue = queue.Queue()
def __init__(self, request, client... | true |
ea443816b4a62fd1bcd4deaee054d855a7acee3e | donnelly-dII/SudokuSolver | /main.py | UTF-8 | 3,364 | 2.625 | 3 | [] | no_license | import common
import student_code
import time
class bcolors:
RED = "\x1b[31m"
GREEN = "\x1b[32m"
NORMAL = "\x1b[0m"
def check_result(sudoku, show):
result=True
for y in range(9):
v=""
for x in range(9):
value = sudoku[y][x];
sudoku[y][x]=0
if (value!=0 and common.can_yx_be_z(sudo... | true |
8d4972012c3d0da198e01c1913afbe65938f2b08 | youwantsy/DeepLearningPractice | /Basiccodes/Tensor/example2.py | UTF-8 | 371 | 3.34375 | 3 | [] | no_license | import numpy as np
tensor = np.array([-1,2,7,19])
print(tensor)
print("텐서 타입: {}".format(type(tensor)))
print("텐서 형태: {}, {}D".format(tensor.shape, tensor.ndim))
print("텐서 요소 타입: {}".format(tensor.dtype))
print("텐서 전체 요소수: {}".format(tensor.size))
print("텐서 0차원 요소수: {}, {}".format(len(tensor), tensor.shape[0]))
| true |
a645ef30115f2740bf29c2c20efc7af3f0d1fc6c | felker/balsam | /balsam/launcher/mpi_commands.py | UTF-8 | 7,779 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | '''The MPICommand subclasses express a template for system-specfic MPI calls. If
the Launcher detects a specific host type, the appropriate MPICommand class is
automatically used. Otherwise, the DEFAULTMPICommand class is assigned at
module-load time, testing for MPICH or OpenMPI'''
import os
import logging
logger = ... | true |
8d88727ec33d97dd8f168b0b864ec37100468a2c | samysung/algo-and-design-part-1 | /week-5/pg-assign/dijkstra.py | UTF-8 | 2,717 | 3.390625 | 3 | [] | no_license | import math as m
import heapq as hp
from unittest import TestCase
"""
Heap structure
parent(i)
if i even= i/2
elif i odd= [i/2] (i.e round down)
children(i)=2i and 2i+1
"""
"""
def swapWithParent(k):
if k%2==0:
numbers[k/2],numbers[k]=numbers[k],numbers[k/2]
else:
numbers[math.floor(k/2)],numbers[k... | true |
5c7e0918dfb98238a4442f3cf0f883d5ca43e94b | asrini56/MADS-Programming-Language | /src/runtime/runtime.py | UTF-8 | 14,514 | 3.484375 | 3 | [] | no_license | """
@author: Ashwin Srinivasan
@author: MadhuMadhavan Sridhar
@version: 1.0
@since: 20/04/2020
Runtime code for MADS language
"""
import sys
value_map = {}
variable_map = {}
iterator = 0
expr_stack = []
# Function to iterate code till 'end_inst'
def iterate_code(code_list, end_inst):
global iterator
glo... | true |
06b24f3a115a5e144cc2cbf31d043093fab84131 | saifuullah/multiTier_server_with_authenticator_using_tokens | /Palendrome_check_server.py | UTF-8 | 1,191 | 3.15625 | 3 | [] | no_license | import socket
import pickle
import time
addrMainServer = ('127.0.0.1', 5551)
ADDRESS = '127.0.0.1'
PORT = 5578
server = socket.socket()
server.bind((ADDRESS,PORT))
def isPalindrome(s):
my_str = s
# make it suitable for caseless comparison
my_str = my_str.casefold()
# reverse the string
re... | true |
5c52c74f7e761c1832435b46eeb99a8864e66bdc | akentominas/ora-statistics-python | /logparser/log_parser.py | UTF-8 | 786 | 2.9375 | 3 | [
"MIT"
] | permissive | from zipfile import ZipFile
import io
def log_generator():
"""
Creates a Generator of lists with formatted HTTP Responses parsed from the log
instead of keeping all the data in a list
"""
# with open('logs/access_log_Aug95', 'r') as f:
# for line in f:
# yield line.re... | true |
9658c18795e64ac6146899edc59c192747b23727 | megh2493/zendesk-assignment | /app/models.py | UTF-8 | 1,423 | 2.796875 | 3 | [] | no_license | import requests
import requests.compat
# creates a zendesk session for the user
def get_zendesk_session(email, password):
session = requests.Session()
session.auth = (email, password)
return session
# model to store user details
class User:
def __init__(self, domain):
self.domain = domain
... | true |
56746273ca3ae9ac7d6a67e54696bc4b60564b36 | shanekang/Playdata_Algorithm_study_01 | /문자열 다루기 기본.py | UTF-8 | 600 | 3.609375 | 4 | [] | no_license | '''문자열 s의 길이가 4 혹은 6이고, 숫자로만 구성돼있는지 확인해주는 함수, solution을 완성하세요. 예를 들어 s가 a234이면 False를 리턴하고 1234라면 True를 리턴하면 됩니다.
제한 사항
s는 길이 1 이상, 길이 8 이하인 문자열입니다.
입출력 예
s return
a234 false
1234 true
'''
def solution(s):
answer = True
if len(s) == 4 or len(s) == 6:
try:
int(s)
except ValueError... | true |
dba69500355d7a36dee71e9baa75573579815049 | NightRoadIx/Piton | /inin47.py | UTF-8 | 483 | 4 | 4 | [] | no_license | class Helper:
'''
Aquí se puede colocar que es lo que hace esta clase de manera general
'''
def __init__(self):
'''Se incia la clase por medio de su constructor'''
def print_help(self):
'''Regresa la descripción de la ayuda'''
print('Descripción de la ayuda'... | true |
2155473db4f21060a426446a8e0191a6a1ffcdc9 | saad181/CSPP1 | /remedial practice/prac1/prac.py | UTF-8 | 131 | 3.3125 | 3 | [] | no_license | def even(n):
for i in range(n):
if i %2==0:
print(i)
def main():
n=int(input())
even(n)
if __name__ == "__main__":
main()
| true |
12751e202f3a9329cfaa570a8b5ddde31e3e763f | ShriyasnhAgarwl/Hacktoberfest | /LIBRAY_MANAGEMENT/Add_Student.py | UTF-8 | 4,540 | 2.671875 | 3 | [
"MIT"
] | permissive | from tkinter import *
from tkinter import messagebox
from tkinter import filedialog
import sqlite3
from sqlite3 import Error
import os
import sys
py = sys.executable
#creating window
class Add(Tk):
def __init__(self):
super().__init__()
self.iconbitmap(r'libico.ico')
self.maxs... | true |
912ea04bd88a0b31ad93fe0bc33c55b39a99d8ce | leeleoo/learn_py | /playground/index.py | UTF-8 | 229 | 2.796875 | 3 | [] | no_license | # -*- coding:utf-8 –*-
index_list = [1,2,3,8,4,5,5,6,7]
index = 0
def change_data():
global index
index += 1
if(len(index_list) - 1 < index):
print '完毕'
else:
print index_list[index]
change_data()
change_data() | true |
5dfd607685f6eef335abe35c4c7fb09c144f7387 | jonasfsilva/desafio_intmed | /desafio_intmed/management/commands/populate_db.py | UTF-8 | 1,059 | 2.546875 | 3 | [] | no_license | """ Comando para popular o banco """
import os
from django.core.management import BaseCommand, call_command
from django.core.management import CommandParser
from loja.models import Produto
from loja.models import Pedido
from loja.models import CATEGORIAS
from clientes.models import Cliente
class Command(BaseCommand):... | true |
7b9ed33b97c1d62709969b58178c310d480280b9 | joshgiersch/derivpx | /fxoption.py | UTF-8 | 414 | 2.5625 | 3 | [] | no_license | from scipy.stats import norm
import math
def fxoptionprice(s, k, rf, rd, vol, t, iscall):
d1 = (math.log(s/k) + (rd-rf+vol**2/2)*t)/(vol*math.sqrt(t))
d2 = d1-vol*math.sqrt(t)
if iscall:
price = s * math.exp(-rf * t) * norm.cdf(d1) - k * math.exp(-rd * t) * norm.cdf(d2)
else:
price = k... | true |
32418c67d807b365eb0366e6fef3a02f5bb19ad0 | jorgeuliana1/road-generator | /src/roadimage.py | UTF-8 | 7,053 | 2.765625 | 3 | [
"MIT"
] | permissive | from road import Road
from mark_tracker import MarkTracker
from roadgraphics import *
from crosswalk import CrossWalk
import random
import math
import drawings as drw
class RoadImage:
def __init__(self, dimensions, path, background_images, asphalt_textures, templates_collection, seed=0, set_seed=True):
sel... | true |
5864aa821bb7a7e041cc4f486cca4c20c5780d6f | genos/online_problems | /prog_praxis/longest_palindrome_176.py | UTF-8 | 682 | 3.734375 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# Find the longest palindrome in a given text
def is_pal(s):
return s == s[::-1]
def flp(s):
longest, len_longest = 'g', 1
for i in xrange(len(s)):
for j in xrange(1,len(s[i:])):
sub_s = s[i:i+j+1]
if is_pal(sub_s) and len(sub_s) > len_longest:
... | true |
2d571d7064796b5736bc2b45032c578a266f1b5a | hermanblarsen/LFD_Reader | /pythonLoggingScripts/csv_logger_long.py | UTF-8 | 2,813 | 3.3125 | 3 | [] | no_license | #! python3
import serial;
import matplotlib.pyplot as plt
from drawnow import *;
import multiexit;
import string
import csv
from time import strftime, sleep
# Writes incoming semicolon separated values (SCSVs) to CSV file in the directory where this file is placed.
# Will write each SCSV printed to the terminal to CSV... | true |
2c8805326fb869e4e632f7d3cabf97bce0acebdb | EkaterinaVoit/Water-control-bot | /nine hours.py | UTF-8 | 1,570 | 2.625 | 3 | [] | no_license | import telebot
import datetime
import time
import schedule
from datetime import datetime
from telebot import types
import sys
bot = telebot.TeleBot("1506364107:AAHCWzAP0Vov1DH8fuSZom_UXcTy5MvzHUg")
args = sys.argv
user_id_str = args[1]
user_id = int(user_id_str)
print(f"I neeed to send a message to user ... | true |
8bf5a97b1ecf9eae99ce28a399ee1343a68cb3bf | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/bob/f490f7743a1147e09c56279d8c8184e5.py | UTF-8 | 416 | 3.59375 | 4 | [] | no_license | def hey(statement):
#remove unneeded whitespace
statement = statement.strip()
#responses
whatevs = "Whatever."
chills = "Woah, chill out!"
sures = "Sure."
fines = "Fine. Be that way!"
#answer selection
if not statement:
return fines
elif statement.isupper():
ret... | true |
874583a6f34b0ac9aa7ef9bfa0986fe563392672 | ishashankverma/Udacity-DAND-P3-Wrangle-OpenStreetMap-Data-with-SQL | /data_wrangling_project.py | UTF-8 | 12,108 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Importing needed libraries
import xml.etree.cElementTree as ET
from collections import defaultdict
import re
import pprint
import csv
import codecs
import cerberus
import schema
import sqlite3
import string
# Pune India OSM file
osm_file = "pune_india.osm"
#New osm file
osm_... | true |
857b413bc1b1d2a1522f030dad8347a3a93996e4 | 0xbadcoffe/dragonphy2 | /dragonphy/experiment/calc_ffe_coeff.py | UTF-8 | 475 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
dt = 1/16e9
tau = dt
def ch_resp(n):
return (1-np.exp(-(n+1)*dt/tau))*np.heaviside(n+1, 0.5) \
- (1-np.exp(-n*dt/tau))*np.heaviside(n, 0.5)
depth = 5
eqn = np.zeros((depth, depth), dtype=float)
for k in range(depth):
eqn[k, :] = ch_resp(np.array(range(k, k-depth, -1)))
vec = np... | true |
1175a08f94860273c91854f9ada6313baccd99bf | Justin-mario/python_excercises | /java_exercises/CommonElementOfArray.py | UTF-8 | 1,084 | 3.703125 | 4 | [] | no_license | def common_element_of_Array():
list_of_input = ["11, 3, 14, 131, 17", "1, 2, 4, 13, 15"]
first_element = list_of_input[0].split(", ")
second_element = list_of_input[1].split(", ")
new_element = ''
for i in range(len(first_element)):
for j in range(len(second_element)):
if first_... | true |
4c6c100cdb147507e271ac80913369554a8254bf | swapnika-20186045/CSPP1 | /CSPP1-Practice/M6/p3/digit_product.py | UTF-8 | 484 | 3.390625 | 3 | [] | no_license | '''
Author : Swapnika
Created on 4-08-2018
'''
def main():
'''Given a number int_input, find the product of all the digits example:
input: 123
output: 6
'''
nu_m = int(input())
pr_o = 1
n_f = 1
if nu_m == 0:
print(0)
return
if nu_m < 0:
n_f = -1
nu_m ... | true |
46ebc0de96662dd508469420be0f086117391939 | littleghost2016/myPythonExercise | /12.3个数正序排序(2016.11.16)/3个数正序排序.py | UTF-8 | 453 | 4.34375 | 4 | [
"MIT"
] | permissive | '''
【程序5】
题目:输入三个整数x,y,z,请把这三个数由小到大输出。
1.程序分析:我们想办法把最小的数放到x上,先将x与y进行比较,如果x>y则将x与y的值进行交换,
然后再用x与z进行比较,如果x>z则将x与z的值进行交换,这样能使x最小。
2.程序源代码:
'''
L = []
for i in range(3):
x = int(input('integer:\n'))
L.append(x)
L.sort()
print(L)
| true |
f7b39918ce471c12a673a37d65ed60fa1fa1173e | Sapphirelol/Test | /Step1.py | UTF-8 | 468 | 3.140625 | 3 | [] | no_license | import json
step1_in = 'example1.json'
step1_out = ""
def jsonToHtml(step1_in, step1_out):
try:
with open(step1_in, 'r') as x:
data = json.load(x)
for i in range(len(data)):
title = str(data[i]['title'])
body = str(data[i]['body'])
st... | true |
944325f28be81142055fd29581857cf99cb69ee7 | BonsaiAI/ray | /release/tune_tests/scalability_tests/workloads/test_result_buffering.py | UTF-8 | 1,416 | 2.515625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import time
import ray
from ray import tune
from ray.tune.cluster_info import is_ray_cluster
def my_naive_trainable(config):
for i in range(int(config["num_iters"])):
tune.report(score=i + config["score"])
time.sleep(config["sleep_time"])
def main():
ray.init(address="auto")
num_sample... | true |
6a8f76b0bbaee4236f42f1f9fb3c0699cd356b6b | aideyisu/Information-hiding-in-pinture | /src/ccv0.py | UTF-8 | 1,082 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import cv2
import numpy as np
from matplotlib import pyplot as plt
# img_rgb = cv2.imread('12.png')
img_rgb = cv2.imread('result.png')
img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
template = cv2.imread('123.png', 0)
w, h = template.shape[::-1]
res = cv2.matchTemplate... | true |
a870f2eb333171ee9e7d33353bf113327a6b5518 | AbhilashG97/Frozen-Frosted-Bites | /Libraries/Flask/Intermediate/Sample Code/create_fruitdb.py | UTF-8 | 1,031 | 3.75 | 4 | [
"Apache-2.0"
] | permissive | # This python script creates a fruit database that will
# be used by the flask application
import sqlite3
from sqlite3 import Error
def create_connection():
try:
connection = sqlite3.connect('fruits.db')
return connection
except Error:
print(Error)
def create_table(connection):
cu... | true |
c081e3c3a7db85a73a109128fd106d243cc6f292 | mai20-meet/meetyl1201819 | /lab3.py | UTF-8 | 329 | 3.171875 | 3 | [] | no_license | import turtle
# turtle.addshape("nemo.gif")
# turtle.shape("nemo.gif")
# turtle.getshapes()
# turtle.mainloop()
turtle.speed(0)
for i in range(1000):
turtle.forward(200)
turtle.right(60)
turtle.forward(100)
turtle.right(120)
turtle.forward(30)
turtle.penup()
turtle.setposition(0,0)
turtle.pendown()
turtle.r... | true |
b7c59c2aa0512bfebf91b8b408745275498c7058 | kurtportelli/single-word-pig-latin | /single-word-pig-latin.py | UTF-8 | 308 | 2.71875 | 3 | [] | no_license | def pig_latin(s):
import re
s = s.lower()
if not s.isalpha():
return None
if not re.search(r'[aeiou]', s):
return s + 'ay'
if re.match(r'[aeiou]', s):
return s + 'way'
while not re.match(r'[aeiou]', s):
s = s[1:] + s[0]
return s + 'ay'
| true |
8b9c4ed89f387fa6c23997eb4b61548f3b787029 | talissad/TrabalhosPython | /Aula31/aula31.py | UTF-8 | 2,684 | 2.9375 | 3 | [] | no_license | # pip3 install flask_mysql
import MySQLdb
def listar_todos(c):
cursor.execute('SELECT * FROM pessoa')
pessoas = cursor.fetchall()
for p in pessoas:
print(p)
def buscar_por_id(c, id):
c.execute(f'SELECT * FROM pessoa where id = {id}')
pessoa = c.fetchone()
print(pessoa)
def buscar_por... | true |
627666887756a6140aa3aa201f447d1c3b13949f | mala-project/mala | /mala/targets/atomic_force.py | UTF-8 | 1,545 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | """Electronic density calculation class."""
from ase.units import Rydberg, Bohr
from .target import Target
class AtomicForce(Target):
"""Postprocessing / parsing functions for atomic forces.
Parameters
----------
params : mala.common.parameters.Parameters
Parameters used to create this Targe... | true |
81d28106b72959476782b8cd702dceec3d4c4f24 | 0xTiefer-Atem/Python_exercise_demo | /learn_python/learn_python_16/04_object.py | UTF-8 | 1,412 | 4.34375 | 4 | [] | no_license | # p388 面向对象编程思想
"""
面向过程:
核心是"过程"
核心思想就是将程序流程化
过程是"流水线", 用来分步解决问题
面向对象:
核心是"对象"
对象的核心思想就是将程序"整合"
对象是"容器", 用来放数据与功能的
"""
# p389 类与对象的介绍
# p390 类的定义
# 先定义类
# 类是对象相似数据与功能的集合体
# 所以类中最常见的是变量与函数的定义,但是类体中其实是可以包含任意其他代码的
# 注意:类体代码是在类定义阶段就会立即执行,会产生类的名称空间
class Student:
# ... | true |
a9d7d08b3796c4fad616054902c57095a08d5057 | nfzd/simulation | /Simulation/helpers.py | UTF-8 | 3,544 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
from collections import OrderedDict
import datetime
import os
import os.path
from os.path import join
import subprocess
def setup_outdir(name, base=None):
"""
Setup and output directory.
args:
name name of the output directory
base base directory (or ... | true |
3e326bb080ef0ec9eb50852a37ce890e6ac8fcc9 | ale-pavel/infovis-final-project | /dataset/convert_to_json.py | UTF-8 | 888 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import csv
import json
nodes_json = []
edges_json = []
graph_json = {}
with open('graph_nodes.csv') as nodes:
csv_reader = csv.reader(nodes, delimiter=',')
next(csv_reader)
fields_list = ["id", "label", "gender", "gender_description", "chapter", "page"]
for row in csv_reader:
obj = {}
... | true |
9c5221dfc102c0b10c2bdc46a8e7b803f70c2188 | nwootton/CECTester | /CEC_Python/test1.py | UTF-8 | 1,385 | 2.859375 | 3 | [] | no_license | import termios, fcntl, sys, os
def getkey():
fd = sys.stdin.fileno()
old = termios.tcgetattr(fd)
new = termios.tcgetattr(fd)
new[3] = new[3] & ~termios.ICANON & ~termios.ECHO
new[6][termios.VMIN] = 1
new[6][termios.VTIME] = 0
termios.tcsetattr(fd, termios.TCSANOW, new)
key = None
tr... | true |
dedb850ff7abc74fc54c58fcf225d66f723bb64f | shenzhu65/ProjectEuler | /p015.py | UTF-8 | 132 | 3.28125 | 3 | [] | no_license | arr = [[1]*21]*21
for i in range(1,21):
for j in range(1,21):
arr[i][j] = arr[i-1][j] + arr[i][j-1]
print(arr[20][20])
| true |
9fbf47d3b30a0b3cec2b3ad578b5d7072a2b6597 | shivamagarwal1999/my-python-code | /BiggerIsGreater.py | UTF-8 | 615 | 3.46875 | 3 | [] | no_license | #https://www.hackerrank.com/challenges/bigger-is-greater/problem
t = int(input())
for _ in range(t):
word = list(input().strip())
start = -1
for i in range(0, len(word) - 1):
if word[i] < word[i + 1]:
start = i
if start == -1:
print ('no answer')
continue
end = ... | true |
ea41634adcde1df5ef008340eb4e5c28eebe23b0 | EyalAvisar75/ScheduleOptions | /main.py | UTF-8 | 1,926 | 3.546875 | 4 | [] | no_license | unsorted_meeting_ranges = [(3, 5), (0, 1), (4, 8), (10, 12), (9, 10)]
def merge_sorted_arrays(arr1, arr2):
min_arr, max_arr = (arr1, arr2) if len(arr1) < len(arr2) else (arr2, arr1)
min_length = len(min_arr)
max_length = len(max_arr)
merged_array = []
min_index, max_index = 0, 0
while min_index... | true |
a6a841661bffaaf64ce79e667cda87b204649297 | KarrLab/wc_rules | /tests/modeling/test_modeling_pattern.py | UTF-8 | 5,281 | 2.5625 | 3 | [
"MIT"
] | permissive | from wc_rules.schema.attributes import *
from wc_rules.schema.entity import Entity
from wc_rules.graph.collections import GraphContainer
from wc_rules.modeling.pattern import Pattern
from wc_rules.expressions.executable import Constraint
import math
import unittest
class X(Entity):
i = IntegerAttribute()
j = Intege... | true |
1cf7aeb223e23d3917774a09f59f0806a4081e16 | jginsburgn/SQaT | /Selenium/003/signup_and_login.py | UTF-8 | 3,795 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
import subprocess
import random
import string
import json
import time
import sys
from os import path
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webd... | true |
bc9809982e59e8298728312a211d0c7f7c2dfa62 | Eddiechiu/tf_learning | /digitRecog_with_CNN.py | UTF-8 | 2,428 | 2.65625 | 3 | [] | no_license | import tensorflow.examples.tutorials.mnist.input_data as input_data
import tensorflow as tf
mnist = input_data.read_data_sets('MNIST_data/', one_hot=True)
with tf.name_scope('Input'):
x = tf.placeholder(tf.float32, [None, 784], name='input')
y_real = tf.placeholder(tf.float32, [None, 10], name='output')
keep_prob ... | true |
124de6875d8c9a91d5567fcb0d93ffe0e3f6a7b6 | handaeho/lab_python | /lec01_기초,연산자,변수형,리스트,튜플,dict/ex09.py | UTF-8 | 2,021 | 4.625 | 5 | [] | no_license | # 19.11.05 Python Class 09
"""
dict : key와 value의 쌍으로 이루어진 데이터를 저장하는 사전(dictionary)식 데이터 타입. 중괄호{}를 사용.
"""
person = {'name': '대호', 'age': 26, 'height': 500}
print(person) # 결과 {'name': '대호', 'age': 26, 'height': 500}
print(type(person)) # 결과 <class 'dict'>
# key / value는 어떤 타입이던지 사용가능. 중복만 되지 않으면 된다.
# dict의 데이터 참조. ... | true |
0c2ae824f04f382f40c4b07a9b29698ff33dbaba | DeadPixelz01/KpyLogger | /main.py | UTF-8 | 1,802 | 3.8125 | 4 | [] | no_license | # stores a user's keystrokes in a local text file
# imports
from pynput.keyboard import Listener
file_name = 'usr_log.txt'
# appends the user's keystrokes to a local text file
def append_to_log(keystrokes):
# formats keystrokes into a more readable string
keystroke_data = str(keystrokes)
# remove quotati... | true |
dcafe43fb08a5a468c98b578694c2ee33aac7837 | hall593/sem2Robot | /PrintMagValues.py | UTF-8 | 800 | 2.9375 | 3 | [] | no_license | from MPU9250 import MPU9250
import time
import math
import brickpi3
mpu9250 = MPU9250()
BP = brickpi3.BrickPi3()
try:
while True:
mag = mpu9250.readMagnet()
total_mag=math.sqrt(mag['x']*mag['x']+mag['y']*mag['y']+mag['z']*mag['z'])
print("Total magnitude = ", total_mag)
print("x v... | true |
443cc001ed747526ab573643f4e86670568bd1b4 | Blekrv/python_sql_project | /admin.py | UTF-8 | 4,973 | 2.640625 | 3 | [] | no_license | import psycopg2
from settings import *
from connection import Connection, _checkPassword, _checkEmail
import datetime
from validation import Validate, SELECT_TABLE
class SuperAdmin(Connection):
def __init__(self, login: str, password: str):
self.login = _checkEmail(login, 'superAdmin')
self.passw... | true |
d5bae7c81e7698de1703d8b8fe9956a1a06340ba | Steguer/SimpleInject | /simpleinject/service_provider.py | UTF-8 | 2,774 | 2.984375 | 3 | [
"MIT"
] | permissive | import inspect
from typing import *
class ServiceWrapper(object):
def __init__(self, service_type: type, instance: object = None):
self.service_type = service_type
self.instance: object = instance
self.dependencies: List[ServiceWrapper] = []
class Dummy(object):
pass
class Circular... | true |
108853a9dde711340255540e36609047b2828c29 | parkjeongmi/jamie_study | /sort/sort2.py | UTF-8 | 157 | 2.96875 | 3 | [] | no_license | def solution(numbers):
numbers = list(map(str,numbers))
numbers.sort(key=lambda x : x*3, reverse=True)
return str(int(''.join(numbers))) | true |
df30ca3f9ec08189b64bea2cae68eb430ca956f2 | HitlerWang/image | /tensorflow_study/tf_input.py | UTF-8 | 2,410 | 2.96875 | 3 | [] | no_license |
import tensorflow as tf
path_list=['/Users/shanwang/Desktop/data/xia/use/train/small/IMG_20191012_132502.jpg','/Users/shanwang/Desktop/data/xia/use/train/small/IMG_20191012_132524.jpg','/Users/shanwang/Desktop/data/xia/use/train/small/IMG_20191012_132545.jpg']
img_path=tf.convert_to_tensor(path_list,dtype=tf.string)#将... | true |
ff5dd624c4ace0d807ddca6adb2b41ffaf015d59 | Nirperm/Design-Pattern | /Adapter/delegation/printer_banner.py | UTF-8 | 294 | 2.6875 | 3 | [] | no_license | from printer import Printer
from banner import Banner
class PrinterBanner(Printer):
def __init__(self, string):
self.__banner = Banner(string)
def print_weak(self):
self.__banner.show_with_paren()
def print_strong(self):
self.__banner.show_with_aster()
| true |
8c6699cbd8026281992931f886bbf56e6f252b83 | cynikl/mac-scripts | /firstsetup/SetDesktopImages.py | UTF-8 | 1,319 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
'''Based on https://gist.github.com/gregneagle/6957826#file-gistfile1-py
modified to use only one image.
Uses Cocoa classes via PyObjC to set a random desktop picture on all screens.
Tested on Mountain Lion and Mavericks.
See:
https://developer.apple.com/library/mac/documentation/cocoa/reference/a... | true |
62b8814d68b552c477a2a4b1d59fb47a03cfebf8 | IOleksandrSI/scan | /scan.py | UTF-8 | 1,222 | 2.953125 | 3 | [] | no_license | def get_random_ip():
from random import randint
return str(randint(0, 255)) + "." + str(randint(0, 255)) + "." + str(randint(0, 255)) + "." + str(randint(0, 255))
def scam(_ports, _ip):
import socket
import requests
print("|IP|", _ip)
ch = False
for port in _ports:
sock = socket.so... | true |
0f0189693634c5fe76d5225ddc14e04460daeb2e | jeremycryan/GameOff2020 | /src/wormhole.py | UTF-8 | 5,660 | 2.859375 | 3 | [
"MIT"
] | permissive | ##!/usr/bin/env python3
import pygame
import random
import constants as c
from primitives import PhysicsObject, Pose
from planet import Planet
class Wormhole(PhysicsObject):
def __init__(self, game, position1, position2, angle=0, radius=20, gravity_radius=None, mass=None, color=-1):
super().__init__(game... | true |
79e88907bfbf97b9a75966c6c73342dd47039846 | altuntasomer/python_exercise | /math_exercise.py | UTF-8 | 4,371 | 3.640625 | 4 | [] | no_license | #Kodun geri kalanını tamamlayıp kodu güncelleyeceğim ...
#English version is coming.I am completing the code .When finished i will share ...
import random
puan=0
while True:
print("""
Matematik Egzersiz Programına Hoşgeldiniz
Toplama İçin 1
Çıkarma İçin 2
Çarpma İçin 3
Bölme İçin 4
Çıkış q""")... | true |
06a4e11a47ca0907a407140936811bc1a784d56e | Pavan-Kumar122/Resume-Parser | /other Extraction/CountTextandtextLines.py | UTF-8 | 869 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 11 20:19:34 2020
@author: BPAVA
"""
import PyPDF2
import string
# pdf file object
# you can find find the pdf file with complete code in below
pdfFileObj = open('1.pdf', 'rb')
# pdf reader object
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
# number of pages in pdf
pri... | true |
5139bdac4c7f9b42f32264b2af5ce3774829d05a | hefvcjm/HuaNengPV | /lib/algorithm/calc/calculation.py | UTF-8 | 12,088 | 3.25 | 3 | [] | no_license | # coding = utf-8
"""
本python文件将对光伏发电单元管理系统里面用的的计算进行封装
"""
import numpy as np
import pandas as pd
import math
def station_total_generation(meas: float, factor: float):
"""
计算电站总发电量,该结果需要进行库存
:param meas: 上网电线电度表测量的电量数据
:param factor: 计量关口系数
:return: 电站总发电量
"""
return meas * factor
def st... | true |
8406c857d1f21720fc88cd2ee337cb24975005fd | FlorinelPetrean/ActivityBoardGame | /player.py | UTF-8 | 1,484 | 2.90625 | 3 | [] | no_license | import pygame
from constants import player0_trail, player1_trail, player2_trail, player3_trail, avatars_pos
class Pawn:
def __init__(self, player_id, img):
self.index = 0
self.trail = player0_trail
if player_id == 1:
self.trail = player1_trail
if player_id == 2:
... | true |
62af5d29f2e0dd56acab0af32143836ff373069e | Awsthyn/Mean-Variance-Standard-Deviation-Calculator | /mean_var_std.py | UTF-8 | 795 | 3.203125 | 3 | [] | no_license | import numpy as np
def calculate(list):
if len(list) != 9:
raise ValueError("List must contain nine numbers.")
array = np.array(list)
int_array = array.reshape(3,3)
array = int_array / 1.0
calculations = {
"mean": [ array.mean(axis=0).tolist(), array.mean(axis=1).tolist(), array.mean()],
"varian... | true |
50d1777ea226a040556ed966ed5ddfc7addd5386 | vivid-ZLL/tedu | /part_04.4_AI/figures/polar/init_.py | UTF-8 | 300 | 2.765625 | 3 | [] | no_license | """
初始化一个极坐标系
"""
import matplotlib.pyplot as mp
mp.figure("Polar", facecolor='lightgray')
mp.gca(projection='polar')
mp.title('Porlar', fontsize=20)
mp.xlabel(r'$\theta$', fontsize=14)
mp.ylabel(r'$\rho$', fontsize=14)
mp.tick_params(labelsize=10)
mp.grid(linestyle=':')
mp.show() | true |
22c301d7cc7c74ba42c703e5ab619a67914f33c2 | jweinst1/PEACE_CS61A | /Strings/PQ01.py | UTF-8 | 1,895 | 4.53125 | 5 | [] | no_license |
def shortest_len(*strings):
"""Define a function, shortest_len, that takes an arbitrary number of strings and returns the shortest length a string has within
the arguments. >>> shortest_len("here", "there", "gone", "hfhfhfhfhf")
4"""
pass
def shortest_str(*strings):
#Define a function, shortest_s... | true |
bc84e68fc40afbb6e4cddec5d87fd1be3aeeb2d1 | Shitaibin/learn-python | /py3/set.py | UTF-8 | 198 | 3.265625 | 3 | [] | no_license | s1 = set()
s1.add(1)
s1.add(2)
s1.add(3)
s2 = {1,2,3,4,5,6}
s3 = set([1,2,3,4])
m = [ n for n in dir(set) if not n.startswith('_')]
print(m)
print('\n\nu can use this operators: &, |, -, ^')
| true |
63d74a6cb6ba55eb13cf0247768ac041c8ec53e9 | saikiran03/competitive | /TopCoder/TopCoder_Substitute.py | UTF-8 | 219 | 2.515625 | 3 | [] | no_license | class Substitute:
def getValue(self,key,code):
vals = {}
for a in range(10):
vals[key[a]]=(a+1)%10
cost = 0
for a in code:
try:
cost+=vals[a]
cost*=10
except:
pass
return cost | true |
20227a2bae06a2c0a20aa1f8284d639007d25f74 | falecomlara/CursoEmVideo | /ex035.py | UTF-8 | 573 | 4.09375 | 4 | [] | no_license | #ler tres retas e se pode ou não formar um triangulo
"""
Para construir um triângulo é necessário que a medida de qualquer um dos lados
seja menor que a soma das medidas dos outros dois
e maior que o valor absoluto da diferença entre essas medida.
"""
r1 = int(input('Digite um número: '))
r2 = int(input('Digite um núm... | true |
77838e0c6948ddecb74d4c3efedc42a858bd8512 | aa-iakupova/my_python | /9 lesson/dict_cinema_price.py | UTF-8 | 1,435 | 2.921875 | 3 | [] | no_license | from pprint import pprint
dict_cinema = {
'Пятница':
{'day':{'today':{'number of people':{'<20':{'time_price': {12: 250, 16: 350, 20: 450}},'>20':{'time_price': {12: 250*0.8, 16: 350*0.8, 20: 450*0.8}}}},
'tomorrow':{'number of people':{'<20':{'time_price': {12: 250*0.95, 16: 350*0.95, 20: ... | true |
b9beb8f2c66aefe571b86a99c08f2fb232787cfb | giadarol/warp | /scripts/data_dumping/PRpyt.py | UTF-8 | 9,607 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | """
# Copyright (c) 1996, 1997, The Regents of the University of California.
# All rights reserved. See Legal.htm for full text and disclaimer.
HDF basic writer class PR by David Grote, LLNL
Heavily modified from PR.py originally written by Paul Dubois, LLNL, to use
HDF files.
This provides a nice wrapper over the p... | true |