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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f32bdbafe5b92ac05cd6431709e2629617864c42 | Python | jonntd/mayaMetaData | /tests/_testMetaData.py | UTF-8 | 6,138 | 2.6875 | 3 | [] | no_license | '''
class's being used by the test frame work to make sure MetaData is working correctly
It's also a example of how you can write your a sub class of MetaData for your needs.
'''
import pymel.core as pCore
import metaData
class _tMetaSubClass(metaData.MetaData):
def __init__(self, node=None, **kw):
supe... | true |
9da6897e5d8b86ef69630ca08056b73a12489c7f | Python | SebastianoFazzino/Fundamentals-of-Computing-Specialization | /Introduction to Interactive Programming in Python - Part1/Practice Exercises for Functions.py | UTF-8 | 8,565 | 4.25 | 4 | [] | no_license | #Practice Exercises for Functions
#Solve each of the practice exercises below. Each problem includes three CodeSkulptor links: one for a template that you should use as a starting point for your solution, one to our solution to the exercise, and one to a tool that automatically checks your solution.
#Write a ... | true |
a0e2466003fa866444c63c09d6a5121bf0b4d531 | Python | rposadas15/IPC1_Backend_Proyecto2 | /Pedido.py | UTF-8 | 372 | 2.984375 | 3 | [] | no_license | class Pedido:
def __init__(self, paciente, medicamentos):
self.paciente = paciente
self.medicamentos = []
#Get
def getPaciente(self):
return self.paciente
def Agregar_Carrito(self, objeto):
self.medicamentos.append(objeto)
#Set
def setPacient... | true |
a46dc42ea5ec2cabb5dd6dd6f0254e838e0aabdc | Python | qy789955/hello-2 | /python/14类变量和实例变量.py | UTF-8 | 694 | 4.3125 | 4 | [] | no_license | class Student:
gender = "male" # 类变量,类中的变量
heigth = 12
def __init__ (self,name,age):
self.name = name # 实例变量
self.age = age
def learn(self):
print("好好学习,天天向上")
print(self.name)
print(self.gender)
def run(self):
# print的内容如果有多个,可以直接用,隔开
print(self.gender,self.heigth,self.name)
stu1 = Student("tony",... | true |
9d4e7e50f43e77a5614c7684188fe0e0393b67fb | Python | LennardFranz/Computational-Physics | /6_1_lennard_franz.py | UTF-8 | 9,367 | 3.765625 | 4 | [] | no_license | """Quantenmechanik von 1D-Potentialen: Doppelmuldenpotential
Bestimmung und Darstellung der Eigenwerte (Eigenenergien) und
Eigenfunktionen eines asymmetrischen Doppelmuldenpotentials mithilfe der
Ortsraumdiskretisierung.
Dabei wurde folgendes asymerisches Doppelmuldenpotential mit dem
Parameter A = 0.15 verwendet.... | true |
39d7d94b357ace26601f1a574fa099b2dfa8c90b | Python | Aasthaengg/IBMdataset | /Python_codes/p03450/s500923034.py | UTF-8 | 2,913 | 3.4375 | 3 | [] | no_license | """
https://atcoder.jp/contests/abc087/tasks/arc090_b
xR-xL = D
Mこの情報が正しいかどうかの判定
グループを作って、グループ内の拘束条件があっているか確認
重み付きunionfindを使う
https://qiita.com/drken/items/cce6fc5c579051e64fab
http://at274.hatenablog.com/entry/2018/02/03/140504
5 5
1 2 2
2 3 3
4 5 4
2 5 10
3 4 3
"""
from collections import defaultdict
class Union... | true |
446c19e1f055b43f3193f751213985902bc48447 | Python | mikaylaw/IHO_Invoice_Analysis | /analysis.py | UTF-8 | 5,865 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from IHO_event_invoice import *
"""
This is the analysis script for the IHO venue pricing project
"""
# define ordering for some data that will be categorcal
categories = {
member_type: ['NON_MEMBER',
'PART_TIME',
'... | true |
3f989c49cdfa02845f3648df8b66c8a6a95c5489 | Python | hybae430/SWEA | /2068.py | UTF-8 | 139 | 3.296875 | 3 | [] | no_license | T = int(input())
for i in range(1, T + 1):
numlist = map(int, input().split())
biggest = max(numlist)
print(f'#{i} {biggest}') | true |
216b0793329bfc99a8e681c411c21780f5d178db | Python | hotbaby/huawei | /move.py | UTF-8 | 479 | 2.640625 | 3 | [
"MIT"
] | permissive | # encoding: utf8
import os
import re
file_pattern = re.compile(r'\d{8}.+\.md')
source_files = []
for root, dirs, files in os.walk('.'):
for f in files:
if file_pattern.match(f) and root == '.':
print(f)
source_files.append(f)
for f in source_files:
_dir = os.path.join('docs... | true |
2c82e6e86386d60e6525f2f9ff0b6dafe6487470 | Python | sreramk/leastnodes_dfa | /byn_auto/graph_constructor.py | UTF-8 | 7,761 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | from networkx.drawing.nx_agraph import graphviz_layout
from byn_auto.general_index import GeneralIndex
from byn_auto.symbol_node import SymbolNode
import networkx as nx
import matplotlib.pyplot as plt
class Graph:
@staticmethod
def __generate_symbol_subsets(symbol_sequence):
result = []
for... | true |
698855014efad8bfffcea68e8e7288257644c01c | Python | PythonZero/sklearn-dataschool | /09_classification_metrics.py | UTF-8 | 6,372 | 3.46875 | 3 | [] | no_license | import pandas as pd
import sklearn
from matplotlib import pyplot as plt
from sklearn import metrics
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.preprocessing import binarize
def initialise_data(feature_columns):
X = df[feat... | true |
882cd70e5572e6bbd2de1979c5a5c00401d29554 | Python | rounakdatta/aoc-2017 | /d2/d2p2.py | UTF-8 | 352 | 2.84375 | 3 | [] | no_license | import fileinput
s = 0
for line in fileinput.input():
b = 0
line = ((line.split()))
line = [int(i) for i in line]
for i in range(0, len(line)):
for j in range(0, len(line)):
if(((line[i] % line [j]) == 0) and i != j):
b = 1
print(line[i], " and ", line[j])
s += (line[i] // line[j])
break
i... | true |
aea0588b47f188e525e9129eac6a830621b62739 | Python | vagabundoo/boardgameprices | /source/send_email.py | UTF-8 | 530 | 2.640625 | 3 | [] | no_license | import smtplib, ssl
import getpass
port = 465 # For SSL
smtp_server = "smtp.gmail.com"
sender_email = "pythontest1808"
receiver_email = "evillamorm@gmail.com"
password = getpass.getpass("Type your password and press enter: ")
message = """\
Subject: Hi there
This message is sent from Python."""
# Create a secure S... | true |
83dcea010eeee0266d65154908d8cc420cf7b4e7 | Python | Ramziia/UnitTestTeapotAnimation | /scale_file/scale.py | UTF-8 | 826 | 3.125 | 3 | [] | no_license | import numpy as np
# Масштабирование: переводим координаты в отрезок от 0 до 1, затем перевод в координаты m x m,
# с учетом соотношения между координатами
def alt(m, xy):
# Перевожу списки в np.array
xy = np.array(xy)
minx = min(xy[0])
miny = min(xy[1])
maxx = max(xy[0])
maxy = max(xy[1])
... | true |
e4b2703be2a8cc4a80dccd7e4e4367e1c7224674 | Python | AlexKohanim/ICPC | /patuljci.py | UTF-8 | 371 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
l = []
m = []
for _ in range(9):
l.append(int(input()))
tot = sum(l)
t = 0b001111111
s = 0
for i in range(8):
for j in range(i+1,9):
if j == i:
continue
if tot - l[i] - l[j] == 100:
for k, x in enumerate(l):
if k == i or k == j:
... | true |
e790ab7bcc68559fb06e8572c0338cc8530654f7 | Python | mpaloni/screen | /read_image.py | UTF-8 | 457 | 2.9375 | 3 | [] | no_license |
# coding: utf-8
# In[21]:
'''
!pip3 install pytesseract
!sudo apt install tesseract-ocr
!sudo apt install libtesseract-dev
'''
import pytesseract
from PIL import Image
def read_image(img):
text=pytesseract.image_to_string(image)
return text
def read_image_path(path):
image=Image.open(path)
text=p... | true |
9b75537d1231dda6708976b54266c998cbed8f03 | Python | EcchiClone/konachan_downloader | /konachan(old, no gui).py | UTF-8 | 3,968 | 3.125 | 3 | [] | no_license | import urllib.request
import requests
import os
from datetime import datetime
from bs4 import BeautifulSoup
# INPUT(태그, 이미지 갯수)
tag_url = ''
tag = input("태그(tag)를 입력해주세요.(없으면 그대로 엔터) : ") #princess_connect
if(tag!=''):
tag_url = '&tags='+tag
MAX_COUNT=-1
while(True):
input_num = input("몇 개의 이미지를 크롤링할까요?(자연수... | true |
cd01914a428a4c057c1cd8c8353ba1c658e4a1f6 | Python | bubuoreo/CS_PC_PROJET | /quick_sort.py | UTF-8 | 2,531 | 3.421875 | 3 | [] | no_license | # BURLOT ALEXANDRE - ROTH LUCAS
# DATE : 01/06/2021
# -*- coding : utf-8 -*-
# TODO :
# - timer sur les utilisations longues
import multiprocessing as mp
import time
from queue import Empty
from random import randint
def Qsort(Q,Tableau,lock,keep_running):
while keep_running.value:
# condition ... | true |
e81642947dfdbd76116de6b88eb2bf285a77a7a7 | Python | ZivniR/Machine-Learning | /bow2.py | UTF-8 | 1,104 | 2.921875 | 3 | [] | no_license | import json
import collections, re
from pprint import pprint
while 1:
json_data = open("Video_Games_5.json").read()
with open('Video_Games_5.json', 'r') as handle:
json_data = [json.loads(line) for line in handle]
j, i, k= 0, 0, 1
size=10000
mylist=[]
summary = 0
sum1=0
ob=open('bagsofwords.txt','w')
while k < 6:
... | true |
66b3a976b218dcb9f6018283a6a3e0d40fc0996b | Python | royroy21/fix_the_news_be | /fix_the_news/news_items/services/url_service.py | UTF-8 | 2,478 | 2.6875 | 3 | [] | no_license | import logging
import time
import requests
from requests import exceptions as requests_exceptions
logger = logging.getLogger(__name__)
class NewsItemURLService:
PREPEND_HTTP = "http://"
PREPEND_HTTPS = "https://"
MAX_RETRIES = 3
SECONDS_TO_WAIT_BEFORE_RETRY = 2
HEADERS = {
"User-Agent"... | true |
56a5d300f210d333fbc608df7f676676b558fc49 | Python | quintonarnaud/python_projects | /huffman.py | UTF-8 | 3,998 | 4.1875 | 4 | [] | no_license | """
File : huffman.py
Author : Quinton Arnaud
Purpose : Given the preorder and inorder of a tree, recursively create the tree, recursively print
the postorder of the tree, decode a binary encoding of the tree and print
"""
class BinarySearchTree:
def __init__(self, head):
self._value = None
... | true |
26085d3610434d0d320c5a825d1fa544a95f12eb | Python | pldorini/python-exercises | /desafio109/moedas.py | UTF-8 | 514 | 3.171875 | 3 | [] | no_license | def metade(n=0, format=False):
res = n / 2
return res if not format else moeda(res)
def aumento(n=0, taxa=0, format=False):
res = n + (n * (taxa/100))
return res if format is False else moeda(res)
def dobro(n=0, format=False):
res = n * 2
return res if not format else moeda(res)
def diminu... | true |
dc2349781ce14435090c1fa5318a3eaf810e7cad | Python | SAE-HUN/Algorithms | /Greedy/17609.py | UTF-8 | 510 | 3.296875 | 3 | [] | no_license | def skip(l, r):
while l<=r:
if s[l]!=s[r]:
return 2
l += 1
r -= 1
return 1
t = int(input())
for _ in range(t):
s = input()
answer = 0
l = 0
r = len(s)-1
while l<=r:
if s[l]!=s[r]:
if answer:
answer = 2
break
else:
answer = 1
if s[l+1]==s[r] and s[l]==s[r-1]:
answer = min(... | true |
1a9be7111af54e469c011fd6de0eaeada2138afc | Python | melgenek/ml_labs | /clustering/iris.py | UTF-8 | 883 | 2.90625 | 3 | [] | no_license | import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.cluster import KMeans
from MYKMeans import MYKMeans
from util import show_plot
iris = datasets.load_iris()
X = iris.data
y = iris.target
mykmc = MYKMeans(n_clusters=3)
clusters = mykmc.fit_predict(X)
fig, plots = plt.subplots(2, 2, figsize=(1... | true |
a72eb1a88aa911389d7af9dd455e0ed4ac5cce0a | Python | emakryo/typedargparse | /tests/test_positional.py | UTF-8 | 730 | 2.53125 | 3 | [
"MIT"
] | permissive | import unittest
import io
from .utility import CaptureOutput, TestParser
def one_str(text: str):
pass
def two_str(text1: str, text2: str):
pass
class TestPositional(TestParser):
def test_one_str(self):
self.assertParsed(one_str, 'foo', {'text': 'foo'})
def test_one_str_error(self):
... | true |
bdebed684562b1d9d33bfdebf9cc6d3076523fd4 | Python | KillyBOT/AI_Programs | /tensorflow_test.py | UTF-8 | 1,186 | 2.953125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
mnist = tf.keras.datasets.fashion_mnist
(trainImages, trainLabels), (testImages,testLabels) = mnist.load_data()
#print(trainImages.shape, len(trainLabels))
"""plt.figure()
plt.imshow(trainImages[0])
plt.colorbar()
plt.grid(False)
plt.show()""... | true |
0c73ca969fda576752c5b4f6e03a5dc4d18f01e5 | Python | vldmr-d/Script-for-deleting-all-your-messages-from-Telegram-chats- | /teleton_scrypt_delete_message.py | UTF-8 | 2,191 | 3.046875 | 3 | [] | no_license | from telethon import TelegramClient
import asyncio
import sys
# Remember to use your own values from my.telegram.org!
api_id = xxxxxxxxxxx # Без кавычек
api_hash = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # В кавычках
client = TelegramClient('telethon_delete_message', api_id, api_hash)
async def main():
# Getting... | true |
ed46f64808a514e435b588ed67cf470c50ecb9f9 | Python | anettemarjaana/TCP-Chat-System_DISSYS | /server.py | UTF-8 | 8,333 | 3.25 | 3 | [] | no_license | ### DISTRIBUTED SYSTEMS | Assignment 1 ### Anette Sarivuo | 0544022 ###
import threading # for performing multiple tasks at once
import socket # for the network connection
from user import User # for creating user objects
# SERVER FILE
# Defining the connection
HOST = "127.0.0.1" # local host IP address
PORT = 9876
... | true |
c061ed8222be47d64c7d1189a77d07a2fc05a53d | Python | AlgorithmStudy1/Algorithm_Study | /yeonhwa/Greedy 그리디/Baekjoon13305.py | UTF-8 | 344 | 2.921875 | 3 | [] | no_license | '''
**Info**
GitHub name : yhlee0
Subject : Baekjoon 13305 주유소
URL : https://www.acmicpc.net/problem/13305
'''
n = int(input())
d = list(map(int, input().split()))
p = list(map(int, input().split()))
minP = p[0]
total = 0
for i in range(n-1):
if p[i] < minP:
minP = p[i]
total += minP * ... | true |
2069812af6f82bd32c039e721410aa0572c8947d | Python | hira13/WK7Hw | /pcfb/sandbox/debug.py | UTF-8 | 108 | 2.5625 | 3 | [] | no_license | from __future__ import division
def createabug(x):
y = x**4
z = 0.
y = y/z
return y
creatabug(25)
| true |
74b7ba582afd15a8944cbdee354b2b80d62426e5 | Python | chaitanya6629/Data_Wrangling | /improve_house_number.py | UTF-8 | 971 | 3 | 3 | [] | no_license | import xml.etree.cElementTree as ET
from collections import defaultdict
import re
import pprint
house_number_re = re.compile(r'^\d+(-?\d)*$')
def update_house_number(house_number):
street_re = re.compile(r'[a-z]{3}')
# This regex checks if street name is present in house number field
m1 ... | true |
6a3010f40875c15f12b8be7a4ec45d15b7c4ee2a | Python | GMati13/vimgram | /.old/action.py | UTF-8 | 447 | 2.671875 | 3 | [] | no_license | from threading import Thread
import json
def exit_from_app(app, client):
if client.socket != None:
client.disconnect()
app.exit()
def run_socket_connection(client, url=None):
Thread(target=lambda: client.connect(url)).start()
def send_message(client, text, author):
if client.socket != None an... | true |
bfcb0ed99f796d20c11e519c89bfa3bf6c5c30e1 | Python | ptrebert/creepiest | /crplib/auxiliary/file_ops.py | UTF-8 | 4,567 | 2.671875 | 3 | [
"MIT"
] | permissive | # coding=utf-8
"""
Convenience module for file operations
"""
import os as os
import gzip as gz
import bz2 as bz
import tempfile as tempf
import hashlib as hsl
import numpy as np
import pandas as pd
from crplib.auxiliary.constants import LIMIT_SERIALIZATION
def text_file_mode(fpath, read=True):
"""
Naive d... | true |
6b942fb40d95363d0f4336233d0d940c6d805c27 | Python | mkawalec/5thyear | /threaded/project1/report/ranges.py | UTF-8 | 91 | 2.71875 | 3 | [
"MIT"
] | permissive | matching = [x for x in range(729) if x%(3*(x/30) + 1) == 0]
print(matching, len(matching))
| true |
31fca86b3dd3d3005be5ae63d9b7de2a7d47005c | Python | Bernadette321/algorithm012 | /Week_03/77_中等_组合.py | UTF-8 | 2,399 | 3.6875 | 4 | [] | no_license | # https://leetcode-cn.com/problems/combinations/submissions/
'''
法1: 回溯
'''
from typing import List
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
# 先把不符合条件的情况去掉
if n <= 0 or k <= 0 or k > n:
return []
res = []
self.__dfs(1, k, n, [], res)
... | true |
86abd4baa3cad976b6e170241afc35ab91ad073d | Python | hyOzd/ecad-3d-model-generator | /e3dmg/componentmodel.py | UTF-8 | 1,987 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#
# Copyright © 2015 Hasan Yavuz Özderya
#
# This file is part of ecad-3d-model-generator.
#
# ecad-3d-model-generator is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 o... | true |
4854c397527543ac5bd6a0b4c6c02dca2aeb4d40 | Python | ramatulamin/hylia_networkprediction | /hylia/models/LSTM_models/bidirectional_lstm.py | UTF-8 | 5,357 | 2.65625 | 3 | [
"BSD-3-Clause-LBNL"
] | permissive | #stacked 2 LSTMs
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import math
from keras.models import Sequential
from keras.layers import Dense, Flatten
from keras.layers import LSTM
from keras.layers import Activation, Dropout, Bidirectional, TimeDistributed, RepeatVector, Input, GRU, Lambda
#
... | true |
aa022e242a24747a5e8cf91efd8e8f9a88d16621 | Python | itzura/data-structure_algorithms | /Linear_Structures/Stack/simpleparchecker.py | UTF-8 | 486 | 3.265625 | 3 | [] | no_license | from stackimplement import Stack
def parchecker(key):
s= Stack()
balanced = True
index = 0
while index<len(key) and balanced:
symbol = key[index]
if symbol == "(":
s.push(symbol)
elif symbol == ")":
if s.isEmpty():
balanced = False
... | true |
ef80d21785bea78f7fac7a2d7e1e2e961b5122c2 | Python | PandeyAditya14/Network-Application | /remote_info.py | UTF-8 | 279 | 2.84375 | 3 | [
"MIT"
] | permissive | import socket
def remote_info(server):
try:
print("IP for %s is : %s"%(server,socket.gethostbyname(server)))
except socket.error as err_msg:
print("Error Occured %s"%(err_msg))
if __name__ == '__main__':
server="facebook.com"
remote_info(server) | true |
01637dd5bdab700f110d09e4779e1c949b086b53 | Python | JunJunHoshi/Pythongame | /chap8.py | UTF-8 | 6,059 | 2.640625 | 3 | [] | no_license | import tkinter
import time
# 解読関数
def decode_line(event):
global current_line, bgimg, lcharimg, ccharimg, rcharimg, popularity, money, health, motibe, window, count
if current_line >= len(scenario):
return;
# 1行読み込み
line = scenario[current_line]
current_line = current_line + 1
line... | true |
acb76fee5af038bb812f5b1bead4ca64e27171ae | Python | daynor25/python | /MetNewRaphson/ejercicio_2.py | UTF-8 | 968 | 3.625 | 4 | [] | no_license | import sympy
from sympy import Symbol
from scipy.misc import derivative
import math
print("Teniendo en cuenta la funcion: f(x)= x^3-4x^2-2 en \n el intervlo [4,5],con Xo=5")
erroru=float(input('introduce el error:'))
X0=5
x=Symbol('x')
a=0
b=0
c=0
print("\nf'(x)=",sympy.diff(x**3-4*x**2-2,x))
print("\n==== Evaluamos f(... | true |
0729a72276891cd99a68fdd74b7228c61fd0d5c9 | Python | asgeir/old-school-projects | /python/verkefni2/poker.py | UTF-8 | 1,787 | 3.03125 | 3 | [] | no_license | VALUES = '23456789TJQKA'
def all_same(values):
base = values[0]
for i in range(1, len(values)):
if values[i] != base:
return False
return True
def rising_sequence(values):
prev = values[0]
for i in range(1, len(values)):
if values[i] != (prev+1):
return F... | true |
17d486c01f453ec6562ef4b6103250f0869fe3eb | Python | javadotmakeitwork/TehBeephiestoAltehBeeph | /TehBeephiestMafphInAllTehLand.py | UTF-8 | 3,006 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import timeit
start=timeit.default_timer()
teamList=[81,135,234,292,461,9135,9234,1646,4028,1747,1781,2171,2197,9197,3487,3814,3865,3940,4103,4272,9272,4284,4485,9485,4926,5822,6721,6451,9926,6721,868,6956]
matchList=[]
pickList=[]
finalTeamScoresList=[]
def addMatch(individualMatch):
matchL... | true |
237a6fa2937cb6c7fdc25901bfb442c5423ac8a1 | Python | lichao312214129/NeuroRA | /neurora/corr_cal_by_rdm.py | UTF-8 | 2,998 | 2.671875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
' a module for calculating the Similarity/Correlation Cosfficient between RDMs by different modes '
__author__ = 'Zitong Lu'
import numpy as np
import math
from neurora.rsa_corr import rsa_correlation_spearman
from neurora.rsa_corr import rsa_correlation_pearson
from neurora.rsa_corr import r... | true |
09788db1b7f69c4dcbe1cd9e1f52e2acc36b018d | Python | borislavstoychev/Soft_Uni | /soft_uni_basic/Conditional Statements/advanced/exercise/05. Journey.py | UTF-8 | 799 | 3.328125 | 3 | [] | no_license | budget = float (input())
seasons = input()
destination = ''
money_spent = 0
kind_of_holidays = ''
if budget <= 100:
destination = 'Bulgaria'
if seasons == 'summer':
kind_of_holidays = 'Camp'
money_spent = budget * 0.3
elif seasons == 'winter':
kind_of_holidays = 'Hotel'
... | true |
36343b17f7c9c8d0c801a4cd1ae6564d2aa85e22 | Python | shangxiang/graduation-project | /1/evaluation1.py | UTF-8 | 1,723 | 2.578125 | 3 | [] | no_license | from gensim.models import word2vec
import matplotlib.pyplot as plt
import numpy as np
plt.figure(figsize=(30,18))
plt.tick_params(axis='both',which='both',labelsize=40)
x=np.arange(3,128)
y10=[]
y8=[]
y6=[]
y4=[]
for k in range(3,128):
file = open("synset.txt",'r',encoding='utf-8')
content = file.read().spli... | true |
989aa1a79cbd34ab0a086342d0e9249f979705ab | Python | defland/Fastminer | /rock.py | UTF-8 | 1,635 | 2.578125 | 3 | [] | no_license | # coding: utf-8
import hashlib, json, os, requests, uuid, traceback
FILE = '.jixueconfig.py'
DOMAIN = 'http://teamof.codes'
ACTIVE_API = '/activate/'
def enctypt(salt, raw_code):
raw = hashlib.sha256(raw_code.encode('utf-8'))
raw.update(salt.encode('utf-8'))
key = raw.hexdigest()
return key
def validate():
# w... | true |
45801763a4a843fc879274b310335d490555c7f2 | Python | lel-amri/pysemver | /tests.py | UTF-8 | 5,000 | 2.75 | 3 | [
"MIT"
] | permissive | import unittest
from pysemver import Version, VersionError
class TestVersion(unittest.TestCase):
def test_input_simple_1(self):
ver = Version('1')
self.assertEqual(ver.major, 1)
self.assertEqual(ver.minor, 0)
self.assertEqual(ver.patch, 0)
self.assertEqual(ver.pre_release, ... | true |
e16f87435e5e120b5e3a94969c3a185365b8ebe9 | Python | WillyWu0201/DataMining2017Spring | /test2.py | UTF-8 | 5,389 | 2.609375 | 3 | [] | no_license | from pandas import read_csv
from pandas import datetime
from pandas import DataFrame
from pandas import concat
from matplotlib import pyplot
#df = read_csv('daliday.csv', header = 0 )
#print(df[:2])
#dfday = df['監測日期']
#dfSO2 = df['二氧化硫 SO2 (ppb)']
#dfCO = df['一氧化碳 CO (ppm)']
#dfCO2 = df['二氧化碳 CO2 (ppm)']
#dfO3 = df[... | true |
85ef66a1d03b0d659636b076648b4c37e0402a0e | Python | sairaj225/Python | /Regular Expressions/11remove_new_line.py | UTF-8 | 159 | 3.375 | 3 | [] | no_license | import re
str = '''
I haven't had my dinner
I'm peckish
I want something to eat
'''
print(str)
regEx = re.compile("\n")
str = regEx.sub(" ", str)
print(str) | true |
afff284df8b3ffb2c86bd50543688ca69b533510 | Python | SunnyangBoy/flask_web | /checks_recognize_v1/opencv_test.py | UTF-8 | 8,028 | 3 | 3 | [] | no_license | # (基于透视的图像矫正)
import cv2
import math
import numpy as np
def Img_Outline(input_dir):
original_img = cv2.imread(input_dir)
gray_img = cv2.cvtColor(original_img, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray_img, (9, 9), 0) # 高斯模糊去噪(设定卷积核大小影响效果)
_, RedThresh = cv2.threshold(blurred, 250, 255, cv2.... | true |
ace77ef259c9b8692efa3d90f04d2b7c22219188 | Python | SR-Sunny-Raj/Hacktoberfest2021-DSA | /33. Python Programs/swggame.py | UTF-8 | 1,416 | 3.75 | 4 | [
"MIT"
] | permissive | import random
i = 0
j = 0
n = 1
print ("*************WELCOME**********\n ")
while n != 0:
user = input ("Enter your choice \n"+ "s for snake \n"+ "w for water \n"+ "g for gun\n")
opt = ["s" , "w" , "g" ]
comp = random.choice (opt)
if (user == comp ):
print ("Draw ")
elif (user == "s"... | true |
b0171ec1624478ac6db63fed491cd28f85a106f2 | Python | liyanfeng0127/python2_bdrw | /Comprehensive_practice/关联规则/格式转换.py | UTF-8 | 890 | 2.765625 | 3 | [] | no_license | #-*-coding:utf8-*-
import sys
import pandas as pd
reload(sys)
sys.setdefaultencoding('utf-8')
def csv_to_xls(path1 , path2):
readcsv = pd.read_csv(path1).replace(' ' , '\t')
print readcsv
# a = len(readcsv)
# print a
# for i in range(1 , 10):
# if readcsv.iloc[i]
# read = readcsv.... | true |
e11e3cafe0fcfc828dd2c352fe07f8629aa1d729 | Python | JackMcCrack/adventofcode2018 | /day03/input03.py | UTF-8 | 558 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
f=open('input03')
asf=list(f)
f.closed
msize = 1000
matrix=[]
for y in range(msize):
matrix.append([0]*msize)
for a in asf:
b=a.split()
pos = b[2].split(',')
size= b[3].split('x')
# print(pos[0] + " " + pos[1])
# print(size[0] + " " + size[1])
for y in rang... | true |
d1bab4c6ccf71efcde2be4eae7103b70061e29e1 | Python | ctc316/algorithm-python | /OAs/LinkedIn/451. Sort Characters By Frequency.py | UTF-8 | 488 | 3.328125 | 3 | [
"MIT"
] | permissive | class Solution:
def frequencySort(self, s):
"""
:type s: str
:rtype: str
"""
freq = {}
for ch in s:
if ch not in freq:
freq[ch] = 1
else:
freq[ch] += 1
freq_list = sorted([(v, k) for k, v in freq.items()... | true |
9c4b5c698946a69ac9fb90c9e9846b2f7cf96eeb | Python | Natatisha/CarND-Advanced-Lane-Lines | /detection.py | UTF-8 | 6,322 | 3.046875 | 3 | [
"MIT"
] | permissive | import numpy as np
def sliding_window(binary_warped_img, nwindows=11, margin=80, minpix=30):
leftx_base, rightx_base = find_lines_basepoints(binary_warped_img)
window_height = np.int(binary_warped_img.shape[0] // nwindows)
# Identify the x and y positions of all nonzero pixels in the image
nonzero =... | true |
eca00909a8bef502c29d7e41a30cfcb061428f2c | Python | Mimsi72/Python-SoftUni | /01. Stack/Lab/02.Matching Parentheses.py | UTF-8 | 234 | 3.625 | 4 | [] | no_license | expression = input()
stack = []
for idx in range(len(expression)):
if expression[idx] == "(":
stack.append(idx)
elif expression[idx] == ")":
start_idx = stack.pop()
print(expression[start_idx: idx+1])
| true |
a7b0c0ea3e226ed25fc8eab5a860e47ce3053a43 | Python | TakahiroDoi/unipeds | /bubbleMap/Map.py | UTF-8 | 2,475 | 2.734375 | 3 | [] | no_license | '''
Created on Sep 27, 2015
@author: J4ROD2
'''
from brewer2mpl import qualitative
class mapper(object):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
# create a fake data set for testing
def create_latlong_df(self,count):
self.count = count
... | true |
27257820c95d8c9d252df9958ec3e414c0aea1c6 | Python | camilla-synbyote/rdss-pure-adaptor | /pure_adaptor/pure/v59/tests/test_api.py | UTF-8 | 3,142 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import pytest
import urllib
import datetime
from collections import namedtuple
from ..api import PureAPI
PureAPIDatasetResponse = namedtuple(
'PureAPIDatasetResponse', ['json'])
PureHeadResponse = namedtuple(
'PureHeadResponse', ['raise_for_status'])
def format_dataset_json(items, next_link=None):
res... | true |
ee5d481b8310ffcc2d94c7cca660bb7a5f2811cb | Python | uct-cbio/galaxy-tools | /src/tools/ncbi/ncbi_entrez_download_gi_list.py | UTF-8 | 4,037 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# Retrieve a list of GI numbers from NCBI based on an Entrez query.
# The Entrez egquery function are used to retrieve the number of sequences. Using this number the Entrez esearch function are used to retrieve the GI list.
# GI records from the following databases can be retrieved.
# genes
# snp
... | true |
3c5569b0cc9c49b8f182e9e5368bb28821d80c7a | Python | Gomer1800/Senior-Project | /Data_Extractor/labelBox.py | UTF-8 | 6,096 | 2.875 | 3 | [] | no_license | import ast
import csv
import cv2
import os
import Data_Extractor.generic as generic
import numpy as np
from PIL import Image
'''Download the image and mask data from the .csv file.'''
def download_images(flag,
num_outputs,
white_list,
black_list,
... | true |
5ba73f91407b98e746cc8948f821278d35892226 | Python | Ycomer/python-learn | /item_list1/big world.py | UTF-8 | 127 | 3.171875 | 3 | [] | no_license | str1 = input("input a name:")
str2 = input("input a country:")
print("how big this world,{}want to {} see" .format(str1,str2))
| true |
e793ebb921dc64e581817bf80afccb3e84f307ec | Python | mdering/twitterscripts | /jsons_from_status.py | UTF-8 | 731 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
from twython import Twython
import time
import os.path
import json
from tokens import *
#create a tweets.db sqlite file.
#create a table like this:
#CREATE TABLE IF NOT EXISTS jsons (
# id INTEGER PRIMARY KEY AUTOINCREMENT,
# tweet_id VARCHAR (100) NOT NULL,
# json TEXT... | true |
52013b6177f39172e4afc8035f46c570fd5627c2 | Python | IanChen15/Mirror | /UI.py | UTF-8 | 1,524 | 2.734375 | 3 | [] | no_license | from tkinter import *
from Clock import Clock
from GoogleTxt import GoogleTxt
from Weather import Weather, ForcastFrame
date_format = "%b %d, %Y"
large_text_size = 48
small_text_size = 18
class Screen:
def __init__(self):
self.isFullscreen = True
self.tk = Tk()
self.tk.config(background=... | true |
bb980f10573bfe1c812cd002d1f35a21927dabe3 | Python | leanmachines/juliet | /juliet/builder.py | UTF-8 | 3,245 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
import os, logging, shutil
from distutils.dir_util import copy_tree
from jinja2 import Template, FileSystemLoader
from juliet import paths
class Builder:
def __init__(self, jinja_env, build_args, src, dest, noclean):
""" Constructor for class Builder. Takes a jinja Environment and the
... | true |
b7f5f8fb3f905e8d3cdd49b770a2e261546ebe5f | Python | imjoseangel/100-days-of-code | /python/interactive-dictionary/dictionary.py | UTF-8 | 2,289 | 3.890625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Interactive Dictionary in Python"""
from __future__ import (division, absolute_import, print_function,
unicode_literals)
import os
import json
from difflib import get_close_matches
# Get File Directory
WORK_DIR = os.path.dirname((os.path.realpa... | true |
db347d4f2066a851227d145b6d0f0830f2621af1 | Python | 1029091291/StructuralCausalModels | /StructuralCausalModels/test/test_graph_via_edges.py | UTF-8 | 1,671 | 3.234375 | 3 | [
"MIT"
] | permissive | import pytest
from StructuralCausalModels.graph_via_edges import EdgeType, GraphViaEdges
@pytest.fixture
def graph_via_edges_example():
"""Returns an example of GraphViaEdges object.
"""
example = GraphViaEdges(
edges={
(0, 0): EdgeType.NONE,
(0, 1): EdgeType.UNDIRECTED,
... | true |
57751c4fd10a0cd745b6fe9f6f7361e5ec0806fc | Python | Triple-L/SOEN691 | /FeatureSelection.py | UTF-8 | 9,910 | 2.921875 | 3 | [] | no_license | import random
import numpy as np
from pyspark.sql import SparkSession
import matplotlib.pyplot as plt
def init_spark():
spark = SparkSession \
.builder \
.appName("Python Spark SQL basic example") \
.config("spark.some.config.option", "some-value") \
.getOrCreate()
return spark... | true |
bcdb95be1a964b399ca8604bf81fb617892fc1e1 | Python | RobinSatterthwaite/BirdTable | /source/client/pages/recordstable/VisitRecord.py | UTF-8 | 977 | 2.5625 | 3 | [
"MIT"
] | permissive |
from datetime import datetime
from pystache import TemplateSpec
class VisitRecord(TemplateSpec):
template_name = "VisitRecord"
def __init__(self, visit, species, species_set):
self.visit = visit
self.sightingsList = []
for particular_species in species:
species_id = particular_species['pk']
sightin... | true |
c9b850fff42c00f93c13f14e17ece75023aeaca9 | Python | mtoshevska/Emotional-Words-Detection | /valence.py | UTF-8 | 2,961 | 2.703125 | 3 | [] | no_license | import pandas as pd
from nltk.corpus import wordnet
from nltk import edit_distance
def load_lexicon(lexicon_name):
assert lexicon_name in ['afinn', 'nrc-affect', 'nrc-hashtag', 'nrc-vad', 'warriner', 'yelp-sentiment']
if lexicon_name == 'yelp-sentiment':
lexicon = pd.read_table('data/yelp-sentiment.tx... | true |
447c32921cf5908c27282d9944b9c47106b823ab | Python | GongFuXiong/Chinese-Medical-Question-Answering-System | /load_testData.py | UTF-8 | 5,389 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | from collections import defaultdict
import csv as csv
import codecs
import random
import pandas as pd
get_answers = pd.read_csv('F:/answers.csv', encoding='gb18030') # 读取answers的CSV的表格数据
# get_questions = pd.read_csv('F:/questions.csv', encoding='gb18030') # 读取questions的CSV的表格数据
ans_content1 = get_answers['ans_conte... | true |
9c904b774825c0d492183213600ac872a5567179 | Python | why1679158278/python-stu | /python资料/day8.7/day06/exercise05.py | UTF-8 | 690 | 4.28125 | 4 | [
"MIT"
] | permissive | """
以容器思想,完成之前的练习。(赠送)
在终端中获取月份,打印相应的天数.
"""
# month = int(input("请输入月份:"))
# if 1 <= month <= 12:
# if month == 2:
# print("29天")
# # elif month == 4 or month == 6 or month == 9 or month == 11:
# elif month in (4, 6, 9, 11):
# print("30天")
# else:
# print("31天")
# else:
... | true |
c179f864a3657547e89c4bef49846abab9b0908f | Python | Casper-V/Oefening | /name.py | UTF-8 | 680 | 3.984375 | 4 | [] | no_license | # first_name = " bob "
# last_name = " dylan "
# first_name = first_name.strip().title()
# last_name = last_name.strip().title()
# name = f"{first_name} {last_name}"
# message = f"Hi there, {name}!\n\tGood luck!"
# print(message)
# name = "Eric"
# message = f"Hello {name}, would you like to learn some Python?"
# print... | true |
1d8e49ca17704709ac348c62033bca41277df689 | Python | alabugevaaa/iterators-generators-yield | /main.py | UTF-8 | 1,335 | 3.0625 | 3 | [] | no_license | import hashlib
import json
import requests
class CheckWiki:
def __init__(self, path):
self.file = open(path, encoding='utf8')
self.data = json.load(self.file)
self.start = 0
self.session = requests.Session()
def __iter__(self):
return self
def __next__(self):
... | true |
f9fe94ff53aa06a2cdd617178429b1be7dd7b746 | Python | andycavatorta/oratio | /Notes/arduino_test.py | UTF-8 | 392 | 2.8125 | 3 | [
"MIT"
] | permissive | import random
import time
arduino_connection = open("/dev/ttyACM0",'w')
for id in range(47):
id_str = "{}\n".format(5000+id)
rand_int = random.randint(0,1000)
rand_str = "{}\n".format(rand_int)
print repr(id_str), repr(rand_str)
time.sleep(0.05)
arduino_connection.write(id_str)
time.sleep(0... | true |
2373880255c81dbe2107d78fd6bd220218443fa2 | Python | likwoka/old_py_stuffs | /portscan/portscan_mp.py | UTF-8 | 2,576 | 3.484375 | 3 | [] | no_license | """
Thread-based message passing.
High-light:
- No locks!
- each thread cannot access other's data ...
communicate by calling send()
"""
import sys, threading, socket
from Queue import Queue
NUM_OF_WORKERS = 1000
class Base:
def __init__(self):
self._queue = Queue()
self._t = threading... | true |
a157d0f8911f6882f21fc3abf2a51f9c798d0a79 | Python | Lusorede/lr-hr-cr | /ble_test.py | UTF-8 | 6,727 | 2.890625 | 3 | [
"MIT"
] | permissive | # Using Hexiwear with Python
# Script to get the device data and append it to a file
# Usage
# python GetData.py <device>
# e.g. python GetData.py "00:29:40:08:00:01"
import pexpect
import time
import sys
import os
# ---------------------------------------------------------------------
# function to transform... | true |
035370ad539533602339f48dcfb493ec89d10799 | Python | jcg1183/Datamining_Project | /archive/preprocessing/Grocery_Preprocessing.py | UTF-8 | 3,773 | 3.515625 | 4 | [] | no_license | # Grocery Preprocessing
# Takes the Groceries Dataset and combines all transactions that share
# a member number and date and adds transaction ids to all transactions.
import pandas as pd
import os
from subprocess import call
# Load dataset into a Dataframe
df = pd.read_csv("Groceries_dataset.csv")
# Sort the rows b... | true |
0506e017164e18c9d8cfd8f56a97a7d2e8ae31f4 | Python | matisuba/kody1 | /cpp/listy_cw2.py | UTF-8 | 1,696 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# listy_cw2.py
#
# Copyright 2020 nie wiem <nie wiem@DESKTOP-59CJN83>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either v... | true |
92cc16522d431594e3cd82492cf59d89d6e4a052 | Python | opensciencegrid/gracc-request | /src/graccreq/replayer.py | UTF-8 | 2,606 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | import logging
import pika
import json
class Replayer(object):
"""
Base for all replayers. It provides functions for sending messages to the control
channel, creating and sending data to the destination.
"""
def __init__(self, message, parameters):
self.msg = message
self.paramet... | true |
9d833a47230b0db9ebd5ac7f0d47f6c5c4539c66 | Python | s0ap/arpmRes | /functions_legacy/BlowSpinFP.py | UTF-8 | 2,362 | 2.890625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
from numpy import sum as npsum
from numpy import zeros, linspace, cov, mean, exp
from numpy.linalg import solve
plt.style.use('seaborn')
from EffectiveScenarios import EffectiveScenarios
from SpinOutlier import SpinOutlier
def BlowSpinFP(z,b_,s_,blowscale=[.1, 3],spinscale=1,method='... | true |
0edd54f98bb8bf2b09edb7a12bca2345223eb213 | Python | stiven77nj/Python | /4-Modulos.py/Calculadora.py | UTF-8 | 162 | 3.0625 | 3 | [] | no_license | def suma(n1,n2):
return n1 + n2
def resta(n1,n2):
return n1 - n2
def multiplicacion(n1,n2):
return n1 * n2
def division(n1,n2):
return n1 / n2
| true |
1a67dea9965f00b4d47cc259bac0be91243648fd | Python | TomCMM/sib2_reg_lcb | /mailib/toolbox/geo.py | UTF-8 | 5,267 | 2.96875 | 3 | [] | no_license | #===============================================================================
# DESCRIPTION
# This module contain all the function and class that I use to manipulate spatial data
#===============================================================================
import numpy as np
import math
import pandas as pd
#... | true |
2405594abfce1bfac8f764d07b3a22e677c15138 | Python | godtv/oldMovieAPI | /pythonScript/counterPython.py | UTF-8 | 820 | 2.546875 | 3 | [] | no_license | # from collections import Counter
# import sys
# import json
# result = {
# 'array': sys.argv[1],
# }
#
# my_bonsai_trees = result['array']
# count = Counter(my_bonsai_trees)
# print(count)
#
# json = json.dumps(count)
#
# print(str(json))
# sys.stdout.flush()
#
#
# #
# from collections import Counter
# import s... | true |
61abeaefdbf13ba5bba9bd9f80ebb301920c8348 | Python | agb94/wakanda | /python-functions/istri.py | UTF-8 | 384 | 3.40625 | 3 | [] | no_license | def istri(lst):
#Determine whether a triangle can be built from a given set of edges
num = len(lst)
lst.sort()
if num < 3:
return "Need more elements"
else:
for i in range(num-2):
if lst[i] < 0:
continue
else:
if lst[i] + lst[i+... | true |
7a85d6f0583c62e581d51cddd5a74c13cab9ad3d | Python | shelyao/LeetCode2020 | /417. Pacific Atlantic Water Flow.py | UTF-8 | 921 | 2.671875 | 3 | [] | no_license | class Solution:
def pacificAtlantic(self, matrix: List[List[int]]) -> List[List[int]]:
if not matrix or len(matrix) == 0: return []
m, n = len(matrix), len(matrix[0])
set1 = set()
set2 = set()
def dfs(x, y, res):
m, n = len(matrix), len(matrix[0])
res.... | true |
63a54f82433219f2c6d77f3c116b9f1be07d7b5c | Python | bokyungJ/this_is_coding_test | /greedy/3_2_큰수의법칙.py | UTF-8 | 179 | 2.78125 | 3 | [] | no_license | N, M, K = map(int, input().split())
num_list = list(map(int, input().split()))
num_list.sort()
k = M//K
m = M%K
result = ((num_list[N-1]*K)*k)+(num_list[N-2]*m)
print(result) | true |
7aa8e820db60960a450d2ffad5957514808c646c | Python | ryosuzuki/flask-api | /generate-data.py | UTF-8 | 1,099 | 2.734375 | 3 | [] | no_license | # $ pip install -U https://github.com/satomacoto/gensim/archive/doc2vec-mostSimilarWordsAndLabels.zip
# http://satomacoto.blogspot.com/2015/02/doc2vec.html
from gensim.models import word2vec
from gensim.models import doc2vec
import json
import sys
def init():
with open('documents.json') as file:
commits = json.... | true |
b2b9f1c2fd7cb903708e3f3e978265341d460e1b | Python | koeppl/hashbench | /scripts/resize_csv_stats.py | UTF-8 | 888 | 2.625 | 3 | [] | no_license | #/usr/bin/env python3
import json
import sys
import re
columns=['size','bucket_count', 'min_bucket_size', 'average_bucket_size', 'median_bucket_size', 'max_bucket_size', 'overflow_size', 'overflow_capacity']
filematch = re.search('log_(\w+)_(\d+)_([a-zA-Z_0-9.]+)\.json', sys.argv[1])
#filematch = re.search('log_(\w+... | true |
20d9158e00014e0062f161292e9d0f3b0b7d00f9 | Python | tom-wagner/ip | /bfs.py | UTF-8 | 819 | 3.859375 | 4 | [] | no_license | import random
from collections import deque
import binarytree
def bfs(tree, val):
"""return True if the value is found in the tree. utilizes a breadth-first search using a queue"""
q = deque()
q.append(tree)
while q:
curr = q.popleft()
if curr['v'] == val:
return True
... | true |
44a73e6a38b4c73de20bc5975637106d5c8aa9dc | Python | suzaana749/basicpython | /rev.py | UTF-8 | 332 | 3.484375 | 3 | [] | no_license | from __future__ import print_function
x = [1, 2, 5, 8, 9, 6]
print(sorted(x))
print(list(reverse(x))
even = 0
odd = 0
for i in x:
if(i % 2 == 0):
even += i
else:
odd += i
print('sum is', even)
print('odd is', odd)
print(10 is '10)
print(true is not false)
print(10 and 5)
print(10 or 5)
print(10 | 5)
pr... | true |
72d1aafe421739cbd893e7e8fbcd23b7bdc2d8dd | Python | 22fansje/python_cookbook | /csv_write.py | UTF-8 | 320 | 3.296875 | 3 | [] | no_license | import csv
with open('movies.csv', 'w', newline='') as file:
movies = "Monty Python and the Hole Grail",1975,
movies2 = "Cat on a Hot Tin Roof",1958,
movies3 = "On the Waterfront",1954
writer = csv.writer(file)
writer.writerow(movies)
writer.writerow(movies2)
writer.writerow(movies3) | true |
3790584cc111d779499c443eabce8fff6f21331b | Python | emils5/week_02_weekend_hw | /classes/room.py | UTF-8 | 925 | 2.984375 | 3 | [] | no_license | class Room:
def __init__(self, genre, capacity):
self.genre = genre
self.capacity = capacity
self.guests = []
self.playlist = []
self.entry_fee = 10.00
def check_in(self, guest):
self.guests.append(guest)
def check_out(self, guest):
self.gue... | true |
edd4e931cd0b2df044ce4a1fc97b9d8c8ffeb4c5 | Python | himty/eecs106a-final-project | /src/angle_upload_download/src/server_program/receive_angle.py | UTF-8 | 825 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
import socket
from time import ctime
host='0.0.0.0'
port=812 # receive data
bufsize=1024
addr=(host, port)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(addr) # bind socket at port
sock.listen(5)
while True:
print('waiting for connection, ready to receive data from cl... | true |
77919133f9bdbf8e6e9e2658a4f07258d2b98dfd | Python | niwanowa/udemy_python | /基礎/lecture50.py | UTF-8 | 252 | 3.25 | 3 | [] | no_license | def test_func(x, l=None):
if l is None:
l = []
l.append(x)
return l
# y = [1, 2, 3]
# r = test_func(100, y)
# print(r)
#
# y = [1, 2, 3]
# r = test_func(200, y)
# print(r)
r = test_func(100)
print(r)
r = test_func(200)
print(r)
| true |
bf97ebe6f613f62f2bc96a9b347755a435b23df2 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_309/ch149_2020_04_13_20_14_58_335347.py | UTF-8 | 1,112 | 3.21875 | 3 | [] | no_license | salario_bruto = float(input('qual o seu salario: '))
n_dependentes = float(input('quantos dependentes voce tem? '))
contri_INSS = 0
aliquota = 0
deduçao = 0
if salario_bruto <= 1045:
contri_INSS = (salario_bruto/100)*7.5
elif salario_bruto <= 2089.60:
contri_INSS = (salario_bruto/100)*9
elif salario_bruto <= ... | true |
b1bdc3077843f936338a5db93a9da05dc871880c | Python | nkuhta/Python-Web-Data | /1. Regular Expressions/grep.py | UTF-8 | 519 | 3.3125 | 3 | [] | no_license | ########################################################################
##################### grep ############################
########################################################################
# Simulate grep Unix command
# Regular expression library
import re
inp=input('Enter a regular... | true |
3b0e7195b09160b1ba81f0f1571ecf13af3154ef | Python | Thunderpriest/hse_DM_project_group2 | /Main.py | UTF-8 | 3,537 | 3.046875 | 3 | [] | no_license | import Predator
import Prey
import Obstacle
import Interface
import random
import time
interface = Interface.Interface()
field, iter_max = interface.generate()
random.seed()
birth_time = 40
interface.draw(field)
# the main loop
for t in range(0, iter_max):
# for each object
for x in range(0, field.height):... | true |
b35a7966d7c1ffca71c6b619315cb16785cc5f6b | Python | AshivDhondea/AshivD_Masters_Codes_py | /ObservationModels.py | UTF-8 | 1,989 | 3.015625 | 3 | [
"MIT"
] | permissive | ## ObservationModels.py
# ------------------------- #
# Description:
# A collection of functions which implement observation functions.
# ------------------------- #
# Created by: Ashiv Dhondea, RRSG, UCT.
# Date created: 23 June 2016
# Edits:
#
# ------------------------- #
# Theoretical background:
# 1. Tr... | true |
4d8ceb775edbe0607524c93e57bed4215bd85c5e | Python | Angielf/flashcards | /cards/models.py | UTF-8 | 1,424 | 2.828125 | 3 | [] | no_license | from django.db import models
import random
class Deck(models.Model):
title = models.CharField(max_length=64, null=False, blank=False)
description = models.CharField(max_length=255, null=False, blank=True)
is_active = models.BooleanField(default=False)
def __str__(self):
return self.title
... | true |