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 |
|---|---|---|---|---|---|---|---|---|---|---|
6cd9d4b64f7e3b88433615d99689b5163bfb45bb | cjacoby6/code_samples | /concurrent_communistfarm/animal_farm.py | UTF-8 | 9,313 | 3.03125 | 3 | [] | no_license | #
# File: animal_farm.py
#
# The main entry point for the program. To start playing the
# game run `python animal_farm.py`
#
#
import farm
from animal import Animal
from stats import Stats
import animal
from printer import printer
import threading
from multiprocessing import Process
import time
INIT_BOARD_SIZE = 8
NU... | true |
6e7388e9a291fd60ab4e3520c2484abb64279876 | DarkstartsUp/SDSIT-2020-HW | /Final_Proj/outlier_det.py | UTF-8 | 2,128 | 3.140625 | 3 | [
"MIT"
] | permissive | # evaluate model performance with outliers removed using isolation forest
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.ensemble import IsolationForest
from sklearn.covariance import EllipticEnvelope
from sklearn.metrics import me... | true |
260506baabc106c8312e56ef6c05e59ade02784a | wegnerce/python_scripting | /metagenomics/filter_megan_kegg_export.py | UTF-8 | 712 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 12 18:27:30 2016
@author: calle
"""
import csv
in_kegg = "/home/calle/Storage/Data/rh_reblast/RHD_trans_gene_kegg.txt"
out_kegg = "/home/calle/Storage/Data/rh_reblast/RHD_trans_gene_kegg_fixed.txt"
to_keep = []
with open(in_kegg, "rB") as infile:
kegg_reader = csv... | true |
e9e065eca00f82f77279d7d2a435d375eecf94c8 | charlesmyu/memory-allocation | /support/linked_list.py | UTF-8 | 574 | 4.21875 | 4 | [] | no_license | # Basic linked list and node objects
class Node:
def __init__(self, val=None, next=None):
self.val = val
self.next = next
class LinkedList:
def __init__(self, head=None):
self.head = head
def fill(self, num: int):
'''
Fills LinkedList with given number of increment... | true |
40fe8c4ade79473c93dd04a95b9542997fad91ca | dubuqingfeng/awesome-code | /python/input.py | UTF-8 | 75 | 2.984375 | 3 | [] | no_license | #-*-coding: utf -*-
s1 = input("input your name:")
print(u"你好.%s"% s1) | true |
bd204c595cac2142fbfd47b1d4637a3f1a966930 | Lexkane/Python | /PythonExercises/List Comprehensions/yieldfromgenerator.py | UTF-8 | 329 | 3.171875 | 3 | [] | no_license | def main():
pass
def subgenerator():
yield '[subgenerator] hello'
yield '[subgenerator] world'
def generator():
yield '[generator] start'
yield from range(10)
yield from (x**3 for x in range(5))
yield from subgenerator()
yield '[generator] hello'
for value in generator():
prin... | true |
8a500956a0e39fa7e06376310bc5098d2493d894 | dhruvilp/440-classification | /nearestNeighbors.py | UTF-8 | 3,974 | 2.953125 | 3 | [] | no_license | import math
import util
import random
import operator
import classificationMethod
PRINT = True
class NNClassifier:
"""
Nearest Neighbors classifier.
"""
def __init__(self, legalLabels):
self.condProb = None
self.legalLabels = legalLabels
self.type = "nearestneighbors"
... | true |
49ac29be96797e05f1cfae9d011bd6193ac63a83 | ryryburge/test-server-prive | /get_cosmetic.py | UTF-8 | 7,115 | 2.53125 | 3 | [
"MIT"
] | permissive | import json
import time
import fortnitepy
import aiofiles
banner_colors = {"Gray" : "DefaultColor1","Red" : "DefaultColor2","Orange" : "DefaultColor3","Orange Yellow" : "DefaultColor4","Yellow" : "DefaultColor5","Green" : "DefaultColor8","Green Blue" : "DefaultColor12","Blue" : "DefaultColor13","Purple" : "DefaultColo... | true |
1fd674f4224c7caddf88f34b8c6ee5067c92e6be | sharath28/leetcode | /prob1221/split_string_in_a_balanced_string.py | UTF-8 | 366 | 3.03125 | 3 | [] | no_license | class Solution(object):
def balancedStringSplit(self, s):
"""
:type s: str
:rtype: int
"""
count = 0
result = 0
for char in s:
if char == 'R':
count += 1
else:
count -= 1
if count == 0:
... | true |
2c86c85e931cf05aea4ce0e8853bbe8d353a927d | yanpaingkyaw/python | /Python/Utilites-script/myip/myip.py | UTF-8 | 145 | 2.65625 | 3 | [] | no_license | from requests import get
ip = get('https://api.my-ip.io/ip').text
print('My IP address is: {}'.format(ip))
input("Press Any Key to stop it.. ") | true |
64ea33f682d8b262affda41ada6d744f39e923be | vaibhavpoddar/Information-Retrieval | /Part2/Assignment2_9_ranker.py | UTF-8 | 10,876 | 2.546875 | 3 | [] | no_license | import numpy as np
from numpy import ma
import pandas as pd
import glob, os
import sys
import nltk
import pickle
import collections
import string
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
nltk.download('punkt')
nltk.download('stopwords')
nltk.do... | true |
666ba9abfac0ff42037bb60db3bb7fde6feaf3a5 | Pedrosan96/python_basicForElectronics | /numeric_representation_int.py | UTF-8 | 560 | 2.90625 | 3 | [] | no_license | import numpy as np
import sys, os, struct
try:
val = sys.argv[1]
frmt = sys.argv[2]
except:
print("Value and format must be provided in format: python ", os.path.basename(__file__), " val format")
print("Val is any negative or positive integer and format can be: int8, uint8, int16, uint16, int32, uint32, int64 an... | true |
16f8ed194750e792ac01d7bbf0af4606fae6c778 | kenyihq/opencv-practice | /contornos/coin_counter.py | UTF-8 | 953 | 2.796875 | 3 | [] | no_license | # Importamos las librerias necesarias
from typing import Container
from cv2 import cv2
import numpy as np
var_gauss = 3
var_kernel = 5
# Capturamos la imagen desde una ubicación relativa
img = cv2.imread('monedas.jpg')
# Pasamos la imagen original a escala de grises
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Dese... | true |
d83ef0da928905b76472dbad192729a9e117c357 | VeraPrinsen/isomorphisms | /tests/integration_test/run_algorithm.py | UTF-8 | 5,696 | 2.890625 | 3 | [] | no_license | # Util imports
from input_output.file_output import load_graph_list_from_filepath
from input_output.sys_output import passed, fail
import sys
import tkinter as tk
from tkinter import filedialog
from time import time
from tests.integration_test.tournament_output import tournament_output
from tests.integration_test.test_... | true |
6b549a86bbd81aa7397940f7d4534e34e7b297a7 | huiwenn/ml_air_quality | /regression/air_regress.py | UTF-8 | 2,723 | 2.6875 | 3 | [] | no_license | import numpy as np
import math
import tensorflow as tf
import random
import air_vecs
if __name__ == "__main__":
av = air_vecs.get_data()
train_X, train_Y = av["train"]
test_X, test_Y = av["test"]
dev_X, dev_Y = av["dev"]
train_X, train_Y = (np.array([0,1,2,4,5])[:, np.newaxis],
np.ar... | true |
750b18aa23e69aef835d36c24e4ac83860954016 | Gerinse24/uv-index | /old/uvindex2.py | UTF-8 | 903 | 3.203125 | 3 | [] | no_license | #! python3
# uvindex.py - used to quickly grab a Cities UV Index.
# Currently only working for Australia.
# Usage from command line: python uvindex.py city
# city must be an acronym such as per for Perth or mel for Melbourne.
"""Please be advised that the data used for this script is provided by ARPANSA
and cannot be... | true |
1eb47919477a4b82b69388af650f0acafdd1feda | glemvik/Knowit_julekalender2017 | /Luke14.py | UTF-8 | 953 | 4.3125 | 4 | [] | no_license | # Hello World program in Python
from time import time
def number_of_ways(steps, moves):
"""
Returns the number of ways of walking up a staircase of 30 steps by taking
1, 2 or 3 steps at a time.
"""
# Prepare table and base case for DP
T = [0 for i in range(steps + 1)]
... | true |
277c0f370ac1e228fab1db790d2fe8704636c07d | naojsoft/g2cam | /scripts/ro_shell | UTF-8 | 6,545 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
#
# ro_shell -- generic remote object client
#
"""This generic remoteObjects client gives a command line interface
that allows you to create proxies to any number of remoteObject servers
and execute commands on them.
Example use:
$ ro_shell.py
names>getNames()
"""
from __future__ import print_fun... | true |
fc14097295f0b9088d261a533f3c66a1c05855d8 | saurabhban/beginner | /codes/binod.py | UTF-8 | 636 | 3.046875 | 3 | [] | no_license | import os
def showfiles(path):
for folders , dirs , file in os.walk(path):
for files in file:
if files.endswith('.txt'):
print(files)
def spammer(path):
for folder ,dirs, file in os.walk(path):
for files in file:
if files.endswith('txt'):
fullpath = open(os.path.join(folder,files),'r')
lines =... | true |
f823c022eac4fac04f591010257ab312fa3ea8ac | MachinaBlack/AI_starthon_2019 | /18_query_siam/feature/feature.py | UTF-8 | 9,920 | 2.59375 | 3 | [] | no_license | from konlpy.tag import Mecab
from utils.data_utils import prepro_text
import math
import pickle
mecab = Mecab()
class Feature:
def __init__(self):
self.idf = {}
feats = self.feat_test()
self.size = len(feats)
def extract_feature(self, q1, q2):
# q1, q2: raw questions
... | true |
373f8cdd95b4a2d2cba08ad61b1815bbba332d79 | michaelwong2/AlphaTetris | /tetris/Ranker.py | UTF-8 | 2,593 | 3.34375 | 3 | [] | no_license | #Ranker
from random import randint
class Ranker:
#calculate height of each column, return array
def column_heights(self, board):
height_list = [0 for i in range(10)]
for x in range(board.get_width()):
ctr = 0
for y in range(board.get_height()):
... | true |
2a6bb2717a49e372f83c689c5701fa1ae9a95a32 | jaytpeters/Dojo | /python_stack/python_fundamentals/functionsIntermediate2.py | UTF-8 | 685 | 3.515625 | 4 | [] | no_license | 1.
x[1][0] = 15
students[0]['last_name'] = 'Bryant'
sports_directory['soccer'][0] = 'Andres'
z[0]['y'] = 30
2.
def iterateDictionary(students):
for student in students:
print(f"first_name - {student['first_name']}, last_name - {student['last_name']}")
3.
def iterateDictionary2(key,list):
for dict i... | true |
659ac378d259e0b1982317d303fdc1f26b50b4f8 | liusy182/tensorflow-trial | /imdb.py | UTF-8 | 5,360 | 2.640625 | 3 | [] | no_license | import tarfile
import re
import bz2
import numpy as np
from utils import *
class ImdbMovieReviews:
DEFAULT_URL = \
'http://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz'
TOKEN_REGEX = re.compile(r'[A-Za-z]+|[!?.:,()]')
def __init__(self, cache_dir, url=None):
self._cache_dir = c... | true |
eabfac8f176bde4012e931cbb8898da9eee23bed | MatiasMingo/cinematica | /webscraping_scripts.py | UTF-8 | 4,042 | 2.578125 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import re
import datetime
def obtain_content(url):
page_response = requests.get(url, timeout=5)
soup = BeautifulSoup(page_response.content, "html.parser")
print(soup)
def obtain_news_culturalfoundation():
url = "https://www.culturalfoundation.eu/news"
... | true |
2dfc43e81953c3da944bf1f555fc11377f0aa900 | AstridCaballero/CS_Python | /oddTuple.py | UTF-8 | 164 | 2.78125 | 3 | [] | no_license | def oddTuples(aTup):
# newTup = ()
# for t in aTup:
# newTup = newTup + (t,)
return aTup[::2]
y = oddTuples(('I', 'am', 'a', 'test', 'tuple'))
| true |
9facc554d99ca341a550bc80f5de65996b694b2a | chaosannals/trial-python | /olddemo/main/kind/datatype.py | UTF-8 | 515 | 3.25 | 3 | [
"MIT"
] | permissive | from dataclasses import dataclass
from typing import Dict, Tuple, TypeVar, List, Generic, get_type_hints
T = TypeVar('T')
class Varchar():
def __init__(self, length):
self.length = length
@dataclass
class A:
v1: str
v2: int
v3: list[int or float]
v4: dict
v5: tuple[int, str] = (12,456... | true |
608272c47766227ecd1034c90139336b714c42c7 | suwonraison900206/pycote | /오픈채팅방/rlatmd0829.py | UTF-8 | 548 | 3.140625 | 3 | [] | no_license | from collections import defaultdict
def solution(record):
answer = []
result = defaultdict(list)
for i in record:
i = i.split()
if i[0] == 'Enter':
result[i[1]] = i[2]
elif i[0] == 'Change':
result[i[1]] = i[2]
for i in record:
i = i.split()
... | true |
5171c6b510ee6a347f0b587dc8eda0a318434a9d | QAlexBall/Python_Module | /Three_Part_Moudule/PIL/pil_test.py | UTF-8 | 72 | 2.578125 | 3 | [
"MIT"
] | permissive | from PIL import Image
im=Image.open('Image/1.jpg')
im.rotate(40).show()
| true |
e586bb784498816cd2c8e1ac6afa4f0e2fdb064f | JennSosa-lpsr/class-samples | /4-2WritingFiles/haikuGenerator.py | UTF-8 | 802 | 4.125 | 4 | [] | no_license | # We ask the user for inputs and convert their response into a string.
print("Welcome to the Haiku Generator!")
print("Provide the first line of your haiku.")
x = str(raw_input())
print("Provide the second line to your haiku.")
y = str(raw_input())
print("Provide the third line to your haiku.")
z = str(raw_input())
pri... | true |
12679f0855ea9a7fddd8ccf6be0445e13a75c5e7 | all1m-algorithm-study/2021-1-Algorithm-Study | /week7/Group10/섬의 개수.권순성.py | UTF-8 | 578 | 2.828125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10000)
w,h = map(int, input(), split())
dx = [-1, 0, 1, 0, 1, -1, -1, 1]
dy = [0, -1, 0, 1, 1, -1, 1, -1]
def dfs(vx, vy):
maps[vx][vy]= 0
for i in range(8):
nx = vx + dx[i]
ny = vy + dy[i]
if 0 <= nx < h and 0 <= ny< w and maps [nx][ny]== 1:
... | true |
2fd324abf2af90702b16c9c964865511f3aecb82 | anishvarsha/LeetCodeQuestions | /src/reverse-vowels-in-a-string.py | UTF-8 | 254 | 3.265625 | 3 | [] | no_license | s = list(raw_input().strip())
vowels = ['a', 'e', 'i', 'o', 'u']
n = len(s)
newList = []
for i in s:
if i in vowels:
newList.append(i)
newList = newList[::-1]
j = 0
for i in range(n):
if s[i] in vowels:
s[i] = newList[j]
j+=1
print ''.join(s) | true |
ce7e7147cdad91c25090771ea737ba7e9e5e49f3 | evan-newman/Integration_Calculator | /integration_calc.py | UTF-8 | 2,750 | 4.0625 | 4 | [] | no_license | def f(mode, x):
if mode == 1:
return (5*(x**4)) + (3*(x**3)) - (10*(x)) + 2
elif mode == 2:
return (x**2) - 10
elif mode == 3:
return (40*x) + 5
elif mode == 4:
return x**3
elif mode == 5:
return (20*(x**2)) + (10*(x)) - 2
else:
quit()
def fprint(modes):
if modes == 1:
print("5x**4... | true |
72e04e0304db201df8b276958bb6242eb7d66bb1 | EPP-Fluid-2021/Fluid-Seminer | /0414/1_2_Sabun2.py | UTF-8 | 894 | 2.984375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import japanize_matplotlib
%matplotlib inline
N = 100
dt = 1/N
y_0 = 0
def func(t,y):
return t+y
t = np.arange(0,1+dt,dt)
y = np.empty(N+1)
y[0] = y_0
for i in range(N):
# オイラー法
y[i+1] = y[i] + dt*func(t[i],y[i])
# 後退オイラー法
""... | true |
7219cc9ec3d7d51e55b923ca2c397dfa74244bed | r9y9/ttslearn | /ttslearn/tacotron/encoder.py | UTF-8 | 2,988 | 2.96875 | 3 | [
"MIT"
] | permissive | # Acknowledgement: some of the code was adapted from ESPnet
# Copyright 2019 Nagoya University (Tomoki Hayashi)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
from torch import nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
def encoder_init(m):
if isinstance(m, nn.Conv1... | true |
6f6c1355bf62887ba67931560acf4f26b12c3319 | mu-duo/tank_war | /world_monitor.py | UTF-8 | 1,621 | 2.875 | 3 | [] | no_license | import threading
from config import *
import pygame
class Monitor(object):
def __init__(self, **kwarg):
self.thread = threading.Thread(target=self.fun, args=(kwarg,))
def run(self):
self.thread.start()
@staticmethod
def reset(obj):
obj.right = True
obj.left = True
... | true |
3ad2899c473f8270dc5c8675e533949d48f594d0 | feiyue2022/nsd2010 | /nsd2021/复习脚本/#随机密码.py | UTF-8 | 634 | 3.859375 | 4 | [] | no_license | #随机密码
import random
import string
# a=string.ascii_letters+string.digits #string.ascii_letters(大小写字母)+string.ascii_digits(数字)
# key=[]
# def getKey():
# key=random.sample(a,8) #random.sample 可以截取指定长度的随机数 8就是8位数
# keys="".join(key) #Python join() 方法用于将序列中的元素以指定的字符连接生成一个新的字符串。
# return keys
# for i in ran... | true |
ef5f84affb135d38f705c68f797839bd13519031 | zoesbook/Python-Course | /03-numpy-scipy/solutions/3_SimplePlotting2.py | UTF-8 | 638 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
import numpy as np
import pylab as plt
t = np.arange(0.0, 1.01, 0.01)
s = np.sin(2*np.pi*t)
plt.subplot(2,1,1)
plt.plot (t, s*np.exp(-5*t), 'b', label= r'$sin (2\pi t) e^{-5 t}$', linewidth=4. )
plt.fill(t, s*np.exp(-5*t), 'r')
plt.xlabel( 'time')
plt.ylabel( 'position')
plt.legend()
plt.grid(Tr... | true |
0fea9cfbb280af3fa554f30c9f6a0e56380251fe | Yaminipatidar20/Python_Scripts | /Rec_circle program/Circle & Retangle Main.py | UTF-8 | 1,212 | 4 | 4 | [] | no_license | import circle as c
import rectangle as r
choice=0
ch='y'
while(ch=='y'):
print("MENU")
print("_____________________________________________")
print("(1) Area of circle")
print("(2) Circumference of a circle")
print("(3) Area of Rectangle")
print("(4) Perimeter of rectangle")
print... | true |
406fe00088090b51d4e1f544068eff0278941e13 | mdevis1/project-share | /Step 0-1 (1).py | UTF-8 | 559 | 3.09375 | 3 | [] | no_license | import pandas as pd
import geopandas
import matplotlib.pyplot as plt
# Read file
df = pd.read_csv("Traffic_Violations.csv")
# Geo plot
g = df.groupby("SubAgency").count()
#
x = g.index.tolist()
print(x)
x1 =[]
for i in range(len(x)):
b = "dist" + str((i+1))
x1.append(b)
y = g["Description"].... | true |
bdb791941f699d8ede4d6704bda50ce9cb0198d6 | 08vishal/Binary-Search-2 | /First_last_position.py | UTF-8 | 935 | 3.40625 | 3 | [] | no_license | #time:O(logn)
#space:O(1)
#LeetCode: no, TimeLimit Exceeded
#Problem Faced:how to apply binary search
class Solution(object):
def searchRange(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
def BinarySearchRight(nums,target):
... | true |
30dafde0323ead094cf0b0c9e02bf887c8110fea | jareddrayton/Advent-of-Code | /advent_of_code_2021/day_05_hydrothermal_venture/day_05.py | UTF-8 | 1,277 | 2.859375 | 3 | [] | no_license | import numpy as np
with open('input.txt', 'r') as f:
vents = [list(map(int, (line.strip().replace(' -> ', ',').split(',')))) for line in f.readlines() if line.strip()]
max_x = max([vent[0] for vent in vents] + [vent[2] for vent in vents])
max_y = max([vent[1] for vent in vents] + [vent[3] for vent in vents])
hor... | true |
10232bde94fc0b9bceeb97a19f62197d9f04d3a2 | mmosko/ccnpy | /ccnpy/ValidationAlg.py | UTF-8 | 6,326 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2019 Marc Mosko
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | true |
00602640be73073ef8382a3e1de1bed970e7bd2f | HenryDaiCode/KaggleDataAnalysis | /museums.py | UTF-8 | 1,344 | 3.5625 | 4 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
#Replace with your filepath
df = pd.read_csv("D:\Documents\Python\Kaggle\museums.csv", low_memory = False, encoding="latin1")
numrows = df.shape[0]
#Removing any museums without revenue or income information
cleandf = df
cleandf = cleandf.dropna(subset=["Income", "R... | true |
21128f651eec66a9134530d8b96e303ddb44c207 | JohnnyMa314/stand-up_identity | /identity_classifier.py | UTF-8 | 9,723 | 2.71875 | 3 | [] | no_license | import pickle
import random
import re
from collections import Counter
import numpy as np
import pandas as pd
import spacy
from scipy.special import gammaln
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.feature_extraction.text import ENGLISH_STOP_WORDS
from sklearn.linear_mod... | true |
9dd937bb209babfd4625cecb721bb6386ec73a8d | bodalbuddy/test_oo | /app3.py | UTF-8 | 2,670 | 2.671875 | 3 | [] | no_license | import os
from flask import Flask, request, redirect, session
app = Flask(__name__, static_folder="static")
app.env = 'development'
app.debug = True
app.secret_key = "anykey" # session 사용할 때
def get_template(filename):
with open(f'./web/{filename}', 'r', encoding='utf8') as f:
content = f.read()... | true |
691960ed98a440bc1a23f4cbeb86dcd65289e99c | MerdLead/test_andriod_app | /app/teacher/homework/test_cases/test005_paper_answer_analysis_detail.py | UTF-8 | 6,629 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# encoding:UTF-8
import unittest
import time
from app.teacher.login.object_page.home_page import ThomePage
from app.teacher.login.object_page.login_page import TloginPage
from app.teacher.homework.object_page.paper_detail_page import PaperDetailPage
from app.teacher.login.test_data.login_failed_t... | true |
4ffef14122f4d118bb0e9037e7b6ecc6b800fb4d | parkeunsoo/algorithm | /DFS/DFSBFS.py | UTF-8 | 735 | 2.84375 | 3 | [] | no_license | N, M, V = map(int,input().split())
matrix = [[0]*(N+1) for _ in range(N+1)]
queue = list()
c=[False for _ in range(N+1)]
for _ in range(M):
link = list(map(int,input().split()))
matrix[link[0]][link[1]]=1
matrix[link[1]][link[0]]=1
def dfs(V):
if c[V] == True:
return True
c[V] = True
p... | true |
8c40afa571684e7a94fd86192677a30d57e5c0b9 | jiajunpa/Operational-Research | /HW4 code.py | UTF-8 | 1,917 | 3.1875 | 3 | [] | no_license | from gurobipy import *
# Code for problem 1 of HW5
model_q1 = Model('Bowls&muds')
x1 = model_q1.addVar(vtype = GRB.CONTINUOUS, name = 'Bowl' )
x2 = model_q1.addVar(vtype = GRB.CONTINUOUS, name = 'Mug')
model_q1.update()
model_q1.setObjective(40*x1 + 50*x2, GRB.MAXIMIZE)
model_q1.addConstr(x1 + 2*x2 <= 40... | true |
031c09a3800ec8d12e5bfb0dc79908d398ecfa41 | imrankhan17/keras-examples | /simple_models/mnist.py | UTF-8 | 1,410 | 2.6875 | 3 | [] | no_license | from keras import layers
from keras import models
from keras.datasets.mnist import load_data
from keras.utils import to_categorical
def prepare_data():
(train_images, train_labels), (test_images, test_labels) = load_data()
train_images = train_images.reshape((60000, 28*28))
train_images = train_images.ast... | true |
77e88bd3937d5a71cde6cd10dd3c8d15181914c3 | psaux0/eulerproject | /pro35.py | UTF-8 | 665 | 3.140625 | 3 | [] | no_license | import time
from collections import deque
time1=time.time()
def allCircular(n):
numberList=deque([int(i) for i in str(n)])
l=list()
k=0
while k<len(numberList):
l.append(makeInt(numberList))
numberList.rotate(1)
k+=1
return set(l)
def makeInt(q):
k=0
for i in xrange(len(q)):
k=k+q[i]*10**(len(q)-i-1)
... | true |
6c4a9185e102a5e90a5fc9c946b3c7afe243ab9d | naoto0804/atcoder_practice | /contests/abc/15/157/e.py | UTF-8 | 646 | 2.75 | 3 | [] | no_license | from bisect import insort_left, bisect_left
n = int(input())
s = list(input())
Q = int(input())
query = [input() for _ in range(Q)]
dic = {chr(i+ord('a')):[] for i in range(26)}
for ind, c in enumerate(s):
dic[c].append(ind)
for q in query:
t, a, b = q.split()
a = int(a)-1
if t=='1':
if s[a]==b... | true |
15a3e8f37428891064f5c3720e94ec69230152a2 | zhanglichao/end2end_rgbt_tracking | /mfDiMP/pytracking/tracker/base/basetracker.py | UTF-8 | 5,200 | 2.71875 | 3 | [
"MIT"
] | permissive | import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import cv2 as cv
import time
import os
import vot
from vot import Rectangle
import numpy as np
class BaseTracker:
"""Base class for all trackers."""
def __init__(self, params):
self.params =... | true |
b4682b5098c332cdf95863045eb8139ba8d4b5f7 | MarcoContreras23/AutomatasProyecto1 | /ventana/AutomataaExpresionRegular.py | UTF-8 | 1,126 | 3.109375 | 3 | [] | no_license | """
Autores: Marco Contreras, Camilo Gomez
Version: 1.5
"""
#Clase que obtiene la expresion regular
class AutomataaExpresionRegular():
def __init__(self,alf,estados,trans,inicial,final):
self.alfabeto = alf
self.estados = estados
self.transiciones = trans
self.inicial = inicial
... | true |
98a65a5d4740f5d6548f5ed10e489887c70ad6ed | kuwanomi0/aizu_online_judge | /ITP1/ITP1_2_D/Main.py | UTF-8 | 241 | 3.046875 | 3 | [] | no_license | # ITP1_2_D
# Circle in a Rectangle
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_2_D
# encode : utf-8
W, H, x, y, r = map(int, input().split())
if r <= x <= (W-r) and r <= y <= (H-r):
print('Yes')
else :
print('No') | true |
c4f2c5ff471dd07d93f282225d87d3b12fda87f4 | vpogrebi/Tic-Tac-Toe | /test/assistant_test.py | UTF-8 | 3,391 | 2.90625 | 3 | [] | no_license | '''
Created on Aug 1, 2011
@author: valeriy
'''
import copy
import enum
import model
import unittest
import assistant
class AssistantTest(unittest.TestCase):
"""Tests assistant.Assistant class"""
def setUp(self):
self.testPlayer = enum.PLAYER_X
self.boardProxy = model.GameBoardProxy(None)
... | true |
59b0906506cef9d39d9bdca84b2df8c6cc79f552 | chenggangschool/CloudTesting | /test_cos/utils.py | UTF-8 | 733 | 2.890625 | 3 | [
"MIT"
] | permissive | #!usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: EarlGrey@codingpy.com
# Copyright: Public Domain
#
import os
import csv
def get_filenames(path):
for root, directories, filenames in os.walk(path):
for filename in filenames:
if '.DS_Store' not in filename:
yield os.path... | true |
6e1275bc78155c6c5d87ad6bfcc96ae12ccf503a | az2181036/campus | /2019/快手/解析加减运算.py | UTF-8 | 254 | 3.015625 | 3 | [] | no_license | s = input().strip()
a = s.split('+')
ans = 0
for val in a:
temp = val.split('-')
if val[0] == '-':
ans -= int(temp[1])
temp = temp[1:]
else:
ans += int(temp[0])
for _ in temp[1:]:
ans -= int(_)
print(ans) | true |
57346b2a5ccc1adabfca96e3ff371d22df9a860d | quen69fr/Catane | /Ancien/2020-04-13-SansFlask/tuile.py | UTF-8 | 2,526 | 2.84375 | 3 | [] | no_license | # coding: utf-8
from outils import *
class Tuile():
def __init__(self, id, x, y):
self.id = id
self.x = x
self.y = y
self.x_affiche = int(self.x - largeur_tuile / 2)
self.ressource = 0
# self.image = None
self.numero = 0
self.listeIdSommets = []
... | true |
9e4f2e2803ea3bcc8021b5c65706874eae462d92 | btjanaka/dance-old | /dance/tests/test_danceprops.py | UTF-8 | 7,995 | 3.234375 | 3 | [
"MIT"
] | permissive | """Tests for functions and classes in danceprops"""
import pytest
from collections import defaultdict
from dance import danceprops
from openeye import oechem
# No tests for DanceProperties class, as it only has data
# No tests for DanceTriNBond class, as it only has data
@pytest.fixture(scope="function")
def ammon... | true |
9b4cd07a75e07e836380f008509a76d6d1936ce5 | Aoshika123/Crawler-Personal-Practice-Code | /第三章:数据解析/7.xpath解析案例-4k图片解析爬取.py | UTF-8 | 1,404 | 2.8125 | 3 | [] | no_license | import requests
import os
from lxml import etree
if __name__ == '__main__':
url = 'https://pic.netbian.com/4kmeishi/index_%d.html'
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.64'
}
#创... | true |
5f566f6e04b3a1f1533f993a891720fd0a57e12f | thanhtungittlu/tung_python | /19KiemTraHangNghinVaHangTram.py | UTF-8 | 245 | 2.515625 | 3 | [] | no_license | import stdio
n=stdio.readInt()
xau=str(n) #Chuyen ve ham ky tu
d=len(xau) #Do dai cua xau
if d==2 or d == 1:
stdio.writeln(00)
else:
if d==3:
stdio.writeln( '0' + xau[2])
else:
stdio.writeln(xau[d-4] + xau[d-3])
| true |
0d924eb2ef565376169bba7bfc9c519a96f3954c | a54lab/yrm | /Cross_correlation.py | UTF-8 | 10,705 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 10 09:36:31 2019
@author: Lolo el amator
"""
import pandas as pd
import numpy as np
import scipy.interpolate as spi
import scipy.stats as sps
import matplotlib.pyplot as plt
###############################################################
#########... | true |
ee77f79050204068f575ee9bca38169759d9cbf1 | Trietptm-on-Security/experiment_icics | /gdl2graph.py | UTF-8 | 12,332 | 2.53125 | 3 | [] | no_license | """
This program convert function call graph (produced by IDA Pro) to graphviz format.
"""
import sys
import json
from graphviz import Digraph
import networkx as nx
import numpy as np
import time
from zerowine_pre_process import load_zerowine_tracefile
G = nx.DiGraph()
num2text = {}
start_func = ["START", "MAIN", "_ST... | true |
01342877b3a0f6533e68397ce5e294c8f28825d7 | LeynilsonThe1st/python | /scratches/tst.py | UTF-8 | 209 | 3.9375 | 4 | [] | no_license | def factorial(n):
f = 1
while n > 0:
f *= n
n -= 1
return f
x = int(input("insira um valor: "))
s = 1
y = 0
while y < x:
y += 1
f = factorial(y)
s += (1/f)
print(s)
| true |
de6a42fa4e2f04afd3826f9ebbc025aeaaf47861 | novayo/LeetCode | /0106_Construct_Binary_Tree_from_Inorder_and_Postorder_Traversal/try_6.py | UTF-8 | 1,004 | 3.359375 | 3 | [] | no_license | # 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 buildTree(self, inorder: List[int], postorder: List[int]) -> Optional[TreeNode]:
index_i... | true |
9dd0cd6f46edd12ad7f247fe1cbfb1963592c622 | szqh97/test | /python/twisted/echoserver.py | UTF-8 | 714 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
from twisted.internet import protocol, reactor
class Echo(protocol.Protocol):
def __init__(self):
pass
def connectionMade(self):
global count
count += 1
print "a connection is made, all is : ", count, ": alive is: ", self.connected, ":"
def dataReceive... | true |
78a9cfdbabb4574448c905e2e69c3d8c9284edfc | aurora314156/leetcode | /Stack/leetcode1544. Make The String Great.py | UTF-8 | 259 | 3.15625 | 3 | [
"MIT"
] | permissive | class Solution:
def makeGood(self, s: str) -> str:
ans = []
for char in s:
if ans and abs(ord(ans[-1]) - ord(char)) == 32:
ans.pop()
else:
ans.append(char)
return "".join(ans) | true |
4496f50f74b8b5fbd0766fe4956fe9e7ca8a8d9c | mrmyothet/ipnd | /ProgrammingBasicWithPython-KCL/Chapter-2/Condition.py | UTF-8 | 474 | 3.890625 | 4 | [
"MIT"
] | permissive | firstnum = input("Enter first number : ")
secondnum = input("Enter second number : ")
try :
firstnum = int(firstnum)
secondnum = int(secondnum)
if secondnum <= 0:
print("Second number must be greater than zero")
elif secondnum < 1 or secondnum > 10:
print("Second number must be between 0... | true |
d647140aab8ce9efdb23d75a9206272247655080 | samwisemj/MusicStreamingWebsite | /music/tests.py | UTF-8 | 648 | 2.609375 | 3 | [] | no_license | from django.test import TestCase
#
# # Create your tests here.
import os.path,os
from .models import Album,Song
a=Album()
s=Song()
dir="C:\\Users\\Samwise\\Desktop\\Music\\Pink Floyd"
for filename in os.listdir(dir):
dirin=dir+"\\"+filename
a.album_title=filename;
a.artist='Pink Floyd'
a.genre='Progres... | true |
6f88a1cd34530cd04b1de3949d317a13c6d0eea5 | mohit266/Python | /3.py | UTF-8 | 134 | 3.0625 | 3 | [] | no_license | def call(n):
if n:
print("true")
else:
print("false")
if __name__ == '__main__':
call(1-1)
call(1-2) | true |
1dd4ee645e475c0a9a65bc8622579a3a98e6acbc | AhmetOsmn/Programlamaya-Giris | /004.6.yol_hiz_problemi.py | UTF-8 | 194 | 3.1875 | 3 | [] | no_license | mesafe = float(input("Mesafe (km): "))
ortalama_hiz = float(input("Ortalama Hiz (km/saat): "))
sure = mesafe / ortalama_hiz
sure = round(sure,2)
print("Varis suresi: {}'saattir.".format(sure))
| true |
abfa0ff75b6c62f22274f713312495abf1a29330 | luizfelipe1914/python4zumbis | /Lista01/Q08.py | UTF-8 | 183 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
#-*- encoding: UTF-8 -*-
def main():
f = float(input("F° : "))
c = (((f-32)*5) / 9)
print("C° = %.2f" % c)
if __name__ == "__main__":
main() | true |
624b218fc7891e6dd5e496d9a5afbd4872067e0b | ProteoWizard/pwiz | /scripts/misc/smartBuildTrigger.py | UTF-8 | 9,582 | 2.515625 | 3 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | permissive | # This script is responsible for triggering most builds on ProteoWizard's TeamCity project.
# It avoids redundant builds (build configs that have nothing to do with a given set of changed files),
# but still reports those untriggered builds to GitHub so they can be required to pass for merging a PR.
#
# The "zSmart bui... | true |
58c64fe42c486139fefeb829323e2d45989fab00 | OrestisRo/sample_pesten | /game.py | UTF-8 | 1,195 | 3.578125 | 4 | [] | no_license | from player import Player
from card import *
class Game:
CONST_PLAYERNAMES = ['Alice', 'Bob', 'Carol', 'Eve']
deck = Deck()
players = []
def __init__(self):
print("---Starting new game.---")
self.deck.deckInit()
print("---A deck of 52 cards has been created.---")
self.players = [Player(name) for name in ... | true |
1f999992bf409d64093417bea525d91a9fc6819e | ZaneWarner/Algorithms-I | /1-ComputingInversions/CountingInversions.py | UTF-8 | 1,329 | 3.828125 | 4 | [] | no_license | #This is the first coding assignment for Algorithms I from Stanford Lagunita
#The task is, given an array of numbers, to count the inversions in nlogn time
#This is accomplished by implementing mergesort,
#and counting how often a number is merged from the right-side array
x = []
with open("IntegerArray.txt", 'r') as... | true |
2fc20446e1e402142b2a1f16e2760982b21c1e35 | cuber-it/aktueller-kurs | /Tag4/uebungen/CsvTable.py | UTF-8 | 1,667 | 3.1875 | 3 | [] | no_license | class CsvTable:
def __init__(self, delim=","):
self._data = []
self._delim = delim
self._header = []
self._table = []
def load(self, fname):
with open(fname) as fd:
raw = [row.split(self._delim) for row in fd.read().splitlines()]
self._header = raw[0]... | true |
e8fb76a762e79504d12a17eb0150ac3400b96829 | xiaoxd16/PicDL | /PicReader.py | UTF-8 | 475 | 2.53125 | 3 | [] | no_license | import cv2
import numpy as np
import os
class PicReader:
def __init__(self):
pass
def Reader(self,path):
try:
img = cv2.imread(path,cv2.IMREAD_GRAYSCALE)
arr = np.array(img)
except Exception as e:
print(e)
tag = path.split("_")[-2].split("\\")... | true |
1289c9c2228a25c3cf3625190f58bbcb1ea7a115 | Aasthaengg/IBMdataset | /Python_codes/p02699/s586092038.py | UTF-8 | 102 | 2.984375 | 3 | [] | no_license | sheep, wolf = map(int, input().split())
if wolf >= sheep:
print("unsafe")
else:
print("safe") | true |
973bd31533a708d1228e70c2ee6453571de47a8c | Alleinx/Widget | /Pbank/src/view.py | UTF-8 | 2,950 | 2.890625 | 3 | [] | no_license | class View(object):
def __init__(self):
# Used to indicate the start position of displaying project.
self.project_iter_counter = 0
# Used to indicate the start position of displaying bill.
self.bill_iter_counter = 0
# Indicate the total amount of characters of promote messa... | true |
97bd2579142d26b15c611c7150caba55b6cde4c4 | Aasthaengg/IBMdataset | /Python_codes/p03805/s608711699.py | UTF-8 | 786 | 2.921875 | 3 | [] | no_license | import itertools
def main():
N, M = map(int, input().split())
node_lst = [x for x in range(N)]
edge_lst = [list(map(int, input().split())) for _ in range(M)]
ans = 0
for route in itertools.permutations(node_lst):
is_visited = [False] * N
is_visited[0] = True
if route[0] !=... | true |
9bab90d5700e75857c4071593bc3a2effed8fcd4 | Blastra/SeAMKPiirturi | /SvgGCODEMuunnin/config.py | UTF-8 | 895 | 2.59375 | 3 | [] | no_license | ''' Configuration file for SVG to GCODE converter
Date: 26 Oct 2016
Author: Peter Scriven
Modified for SeAMK circumstances by: Pekka Heikkilä
'''
'''G-code emitted at the start of processing the SVG file'''
preamble = "F50000\nG90\nM50"
'''G-code emitted at the end of processing the SVG file'''
postamble... | true |
4a9a43ace55927fd022bc9e499077500ca0bb876 | greenkarson/python | /MTCNN/Train.py | UTF-8 | 2,222 | 2.71875 | 3 | [] | no_license | import torch
from torch import nn
from torch import optim
from torch.utils.data import DataLoader
from Data import FaceDataset
import Nets
class Trainer:
def __init__(self, net, dataset_path):
self.net = net
self.dataset_path = dataset_path
self.cls_loss = nn.BCELoss()
self.offset... | true |
72998ff601e414c42815274b1a60c1e997cc0600 | carvey/AdventofCode2020 | /day6/answers.py | UTF-8 | 525 | 3.109375 | 3 | [] | no_license | import sys
from functools import reduce
with open(sys.argv[1]) as answer_fle:
group_answers = answer_fle.read().split('\n\n')
total1 = 0
total2 = 0
for group in group_answers:
all_answers = list(filter(None, group.split("\n")))
# for part one
total1 += len(set(''.join(all_answers)))
# for part ... | true |
3dbaee7a33266012cdafd1158f82e089f0c63a85 | regmeg/modules-eval-app | /backendAPI/recommendations/udacity_data/cleaner.py | UTF-8 | 937 | 2.96875 | 3 | [] | no_license | import json
import urllib2
import html2text
def tranform_html(desc):
return html2text.html2text(desc, '').replace('\n', ' ')
final_array = []
base_url = "https://www.udacity.com"
with open('courses.json') as json_data:
courses = json.load(json_data)
for course in courses['courses']:
url = course['homepage... | true |
638c1ef2ccce0cf37158edd124d203229f456891 | Xiryl/ML-HAR-Project | /src/classifiers/lda.py | UTF-8 | 2,275 | 2.640625 | 3 | [] | no_license | from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.svm import SVC
from matplotlib import pyplot as plt
from sklearn.metrics import accuracy_score, confusion_matrix, precision_recall_fscore_support, ConfusionMatrixDisplay
import seaborn as sns
import numpy as np
from sklearn.model_selectio... | true |
74f1b6f1c1959ea81e0ed6aeb62edf9e988fca2e | shilrobot/ld28 | /gameobjects/player.py | UTF-8 | 5,550 | 2.75 | 3 | [] | no_license | from rect import Rect
from texturemanager import TextureManager
import pygame
from utils import drawRect, debugRect, sweepMovement, debugPoint
from gameobject import GameObject
WALK_SPEED = 300.0
ANIM_STAND = 0
ANIM_WALK = 1
GRAVITY_ACCEL = 1500
TERMINAL_VELOCITY = 1000
JUMP_VEL = 570
WALK_FRAME_TIME = 10/60.0
class... | true |
4a05379b87589d10dd4857017af1eec2112d6f0f | 8vama/YoutuberSearch | /src/googleSheetsAPISample.py | UTF-8 | 1,723 | 3.015625 | 3 | [] | no_license | """
Shows basic usage of the Sheets API. Prints values from a Google Spreadsheet.
"""
from __future__ import print_function
from apiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
# Setup the Sheets API
SCOPES = 'https://www.googleapis.com/auth/drive'
store = file.S... | true |
6177d4b018037122bcea68040ecbfc1e40116bd3 | nwaiting/wolf-ai | /wolf_ml/practice_pandas/pandas_datetime.py | UTF-8 | 1,812 | 4.1875 | 4 | [] | no_license | #coding=utf-8
"""
日期功能扩展了时间序列,在财务数据分析中起主要作用。在处理日期数据的同时,我们经常会遇到以下情况
生成日期序列
将日期序列转换为不同的频率
常用函数:
date_range 自然日
bdate_range 工作日
时间差(Timedelta)是时间上的差异,以不同的单位来表示。例如:日,小时,分钟,秒。它们可以是正值,也可以是负值。可以使用各种参数创建Timedelta对象
pd.Timedelta
"""
import numpy as np
import p... | true |
c3c9a41e41f579ca91c0124758583d07f7daaf6f | SEUNGHYUN-PARK/TIL | /ML&DL/Sample_code/#02_LoadBigdataFile/LoadingBigdataSample.py | UTF-8 | 1,150 | 3.046875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
tf.set_random_seed(777)
xy = np.loadtxt('data-01-test-score.csv',delimiter=',',dtype=np.float32)
x_data=xy[:,0:-1]
y_data=xy[:,[-1]]
print("X : ",x_data.shape,"\n",x_data,"\n","X_data's length : ",len(x_data))
print("Y : ",y_data.shape,"\n",y_data,"\n","Y_data's length : ",l... | true |
984e74e1282ad01644781da13e19b60f4df00f12 | spacearound404/mlm | /paypal/get_payouts.py | UTF-8 | 2,715 | 2.609375 | 3 | [] | no_license | import json
from paypal.paypal_client import PayPalClient
from paypalpayoutssdk.payouts import PayoutsGetRequest
from paypal.create_payouts import CreatePayouts
from paypalhttp.serializers.json_serializer import Json
from paypalhttp.http_error import HttpError
from paypalhttp.encoder import Encoder
class GetPayouts(Pa... | true |
9aeda70a6be9c26d7006711c4fa07f870468adba | nathanshammah/qucat | /src/_utility.py | UTF-8 | 5,391 | 2.90625 | 3 | [
"MIT"
] | permissive | from math import floor
import numpy as np
import functools
from warnings import warn
np.seterr(divide='raise', invalid='raise')
exponent_to_letter = {
-18: 'a',
-15: 'f',
-12: 'p',
-9: 'n',
-6: 'u',
-3: 'm',
0: '',
3: 'k',
6: 'M',
9: 'G',
12: 'T'
}
exponent_to_letter_unicod... | true |
5348991b46e125017f9a9dd396a656dd548457c7 | DSA-CoE/malaya | /malaya/graph/pagerank.py | UTF-8 | 1,006 | 2.609375 | 3 | [
"MIT"
] | permissive | from malaya import gpu_available
from networkx import nx
import numpy as np
import logging
def pagerank(array, retry = 5):
cpu = False
fail = True
if gpu_available():
try:
import cugraph
cpu = True
except Exception as e:
msg = (
'cugraph... | true |
3dec45db0578069a26ca97f708243a156f1cdc37 | correlator/simple_tree | /decision_tree.py | UTF-8 | 4,156 | 3.828125 | 4 | [] | no_license | import collections as ct
import numpy as np
class DecisionTree:
def __init__(self, classifiers, collection):
'''
collection is an array of attributes belonging to an object
each row in the matrix describes an object. Classifiers is
an array of outcomes for each object. If the obje... | true |
b2ca58713707ebc0e5deafa3d00911bf584b4b4c | yangxiangtao/biji | /1-pbase/day16/practice/save_student_infos.py | UTF-8 | 480 | 3.078125 | 3 | [] | no_license | def save_to_file(L):
try:
#1,打开文件
f=open('mynote.txt','w')
for d in L:
f.write(d['name'])
f.write(',')
f.write(str(d["age"]))
f.write(',')
f.write(str(d['score']))
f.write('\n')
f.close()
print('保存成功')
ex... | true |
ac6f39c078403d5e51094d21d72ffc6616e124c0 | grassriver/Zhidao | /tec index.py | UTF-8 | 7,606 | 2.96875 | 3 | [] | no_license |
import pandas as pd
import sqlite3 as sql
import sys
sys.path.append('/Users/yunongwu/Documents/Portfolio_Intelligence/Code/')
conn = sql.connect('/Users/yunongwu/Nustore Files/PI/data/data.db')
c = conn.cursor()
c.execute("select * from stocks_price")
price = pd.DataFrame(c.fetchall())
price.columns =['Date','Open',... | true |
440d8f36825daca595de535bef10410c74f9b1ba | OrlandoTele96/DSP | /pruebaoversample.py | UTF-8 | 486 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 28 14:04:20 2018
@author: Jorge O. Gonzalez
"""
import numpy
def upsample(matrix,fct):
f=numpy.copy(matrix)
for k in range(1,fct*f.shape[0],fct):
f=numpy.insert(f,k,numpy.zeros((fct-1,1),dtype='float32'),axis=0)
for k in range(1,fct*f.shape[1],fct):
... | true |
7371baee0134d0ce58a09853e853ed39f76e4ea2 | polsterc16/bee-mite-detection | /simple_test_codes/cv2_test_contours.py | UTF-8 | 2,255 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 12 15:37:12 2021
@author: Admin
https://www.docs.opencv.org/master/d9/d8b/tutorial_py_contours_hierarchy.html
"""
import numpy as np
import matplotlib.pyplot as plt
import cv2
cv2.destroyAllWindows()
#%%
img = cv2.imread("colorimg_small.png")
img = cv2.resize(img, (20... | true |
81903387f5ffe3cd7b69b977d1e2f70e20767359 | zfxu/Keras-examples | /mnist_mlp.py | UTF-8 | 2,361 | 2.703125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
from keras.datasets import *
from keras.losses import *
from keras.optimizers import *
import keras
import numpy as np
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# print(x_train) # 60000*28*28... | true |
09bca37b0d98c3540a71fad47eef1d6bedf502a1 | bfield74/test | /interface_init.py | UTF-8 | 3,573 | 2.75 | 3 | [] | no_license | from tkinter import *
from PIL import ImageTk, Image
from question_bank import questions, files, description, ask_question
from teacher_comments import comments
from random import randint
from tkinter import scrolledtext
interface = Tk()
interface.title("Welcome to Physics")
#reset question counters
reset = True
ask_... | true |
30c52e6d8826e1a65a78bf0f2cd260849ddb2990 | andresamar/metodos-computacionales | /Plots.py | UTF-8 | 1,268 | 2.53125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.io.wavfile import write
import matplotlib.animation as animation
#import scipy.io.wavfile.write
datos = np.loadtxt("datos1d.txt")
x = np.array(datos[:,0])
fi_initial = np.array(datos[:,1])
fi_present = datos[:,2]
t_2 = datos[:,3]
t_4 = datos[:,4]
t_8 = datos... | true |