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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
83029dfbcfd153132b7af86b01d074ab6eb42a3f | Python | denliehoo/expense-tracker-python | /tsting.py | UTF-8 | 619 | 3.0625 | 3 | [] | no_license | import pandas as pd
# df = pd.read_csv("database/individual_data/testing.csv", index_col="Date" )
# print(df)
# print(df.shape)
# # list_val = list(df.columns.values)
# # list_val = df['Date'].tolist()
# # print(list_val)
# # print(df)
# # initial_amount = (df.iloc[2,1]) #have to convery the numpyin64 object to a f... | true |
667f76efd4c5595f4ff1f65d12f3cf15e6c3ab4a | Python | adriacb/BigChem_LMW | /Filtering/Data_analysis/rotBonds.py | UTF-8 | 1,317 | 2.546875 | 3 | [] | no_license | import os
import sys
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from datetime import datetime
from rdkit import Chem
from rdkit import DataStructs
from rdkit.Chem import rdMolDescriptors
from rdkit.Chem import Descriptors3D
from rdkit.Chem import AllChem
from progress.bar import Increment... | true |
8bfb6881836276c178caaee8943fca30cd120152 | Python | YoungestSalon/Outputs | /Book/Everybody Python/08B-ifelse.py | UTF-8 | 107 | 3.078125 | 3 | [] | no_license | a=3
if a==2:
print ("A")
if a==3:
print ("B")
if a==4:
print ("C")
else:
print ("D")
| true |
ccc7784fb4f2a7c8064fb222eb7973cbf8be39b0 | Python | thorgeirt19/Forritun | /Project 1/voyager1.py | UTF-8 | 1,677 | 3.3125 | 3 | [] | no_license | #Byrja á að stilla upp upphafsgildunum
dist_byrjun_m = 16637000000 #mílur frá sólu
hradi_solarhring = 38241*24 #mílur sem voyager 1 ferðast á sólarhring
#Hér fyrir neðan hefjast útreikningarnir
input = input('Number of days after 9/25/09: ') ... | true |
af5203ee0afe63c3349ef6a0e632313de0d6f1b6 | Python | haple97/Machine-Learning-Models | /Naive Bayes Classifier/5_2.py | UTF-8 | 6,812 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[17]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# In[18]:
'''Discretize continuous values into bins'''
def Discretize (b):
dating = pd.read_csv('./dating.csv')
all_columns = list(dating.columns.values)
continuous_valued_columns ... | true |
ca469ef9577f5f96e66fca915920bdba1889ebb1 | Python | dev-arthur-g20r/how-to-code-together-using-python | /How to Code Together using Python/Python again XD/tribonacci.py | UTF-8 | 298 | 3.578125 | 4 | [] | no_license | import os
def tribonacci(n):
i = 0
first = 0
second = 1
third = 1
while (i < n):
print(first)
nextTerm = first + second + third
first = second
second = third
third = nextTerm
i += 1
terms = int(input("Number of terms in Tribonacci sequence: "))
tribonacci(terms)
os.system("pause") | true |
5809562fdd322d66bb3ffdc9e801f05b58a0775c | Python | skoett/de-assignment | /code/task_4.py | UTF-8 | 1,765 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python3
"""
This module contains the functions for solving task 4.
Task description:
Convert all column names to lowercase
"""
import glob
import csv
from types import SimpleNamespace
from code.utils.utils import get_project_root, time_execution
def header_to_lower(file_path: str, target_path: str... | true |
893ed761c1253a34d9c77dde69bca4b7ec31d979 | Python | DataHubBocconi/Natural-Language-Analysis | /LASSO/01_createdf.py | UTF-8 | 955 | 2.578125 | 3 | [] | no_license | import os, glob
import pandas as pd
from Cleaner import *
from collections import defaultdict
cwd = os.getcwd()
par0 = os.path.abspath(os.path.join(cwd, os.pardir))
par = os.path.abspath(os.path.join(par0, os.pardir))
src = os.path.join(par, 'Sources')
#zero_path = os.path.join(src, 'neutral')
#one_path = os.path.jo... | true |
f1754a292dfb45135995cfc76b962a9be295a1f6 | Python | Sooho-Kim/Python_algorithm | /01.baekjoon/baekjoon_5063.py | UTF-8 | 374 | 3.09375 | 3 | [] | no_license | # 5063 TGN
Case = int(input())
for i in range(Case):
non_ad_income, ad_income, ad_cost = map(int, input().split())
if non_ad_income < (ad_income-ad_cost):
result = "advertise"
elif non_ad_income == (ad_income-ad_cost):
result = "does not matter"
elif non_ad_income > (ad_income-ad_cost):
... | true |
e00d1adee3cb04912c82f9f434d595fc0c83f155 | Python | Zhansayaas/ICTLAB1 | /27.py | UTF-8 | 229 | 3.59375 | 4 | [] | no_license | height = float(input("Please enter a height in metres:"))
weight = float(input("Please enter a weight in kilograms: "))
BMI = (weight) / (height * height)
print("The BMI of this person's height and weight is {}.".format(BMI)) | true |
019a4196fde116ad85a636b6dfac89affcff7e73 | Python | vrrohan/Topcoder | /medium/Day1/SRM292/abacus.py | UTF-8 | 3,689 | 4.3125 | 4 | [] | no_license | """
Problem Statement for Abacus
Problem Statement
An abacus can be used to do arithmetic. The version that we have has 6 horizontal threads, each with nine beads on it. The beads on each thread are always arranged with just one gap, possibly at one of the ends.
However many beads are adjacent and at the righ... | true |
35a64364495f64d8baa25c677e25e7c694aaab7f | Python | sizhuoli/Weighted-Tversky-loss | /Weighted_Tversky_loss.py | UTF-8 | 1,025 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
import tensorflow.keras.backend as K
#weighted_tversky_loss
def tversky(y_true, y_pred, alpha=0.6, beta=0.4):
"""compute the weighted Tversky loss with weight maps"""
#annotation
y_t = y_true[...,0]
y_t = y_t[...... | true |
e0da656b481a6f51c06496d1f2c3d8c76e12c73f | Python | JoseVillagranE/atari-RL | /DQN.py | UTF-8 | 1,642 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 9 02:04:10 2021
@author: josev
"""
import torch
import torch.nn as nn
def conv2d_size_out(size, kernels_size, strides, paddings, dilations):
for kernel_size, stride, padding, dilation in zip(kernels_size, strides, paddings, dilations):
... | true |
aed48e238d4d289af5bcdd884a249a0c2e40f9f1 | Python | RHDZMOTA/lambda_credit | /financial_functions.py | UTF-8 | 2,299 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# future_value
futureValue = lambda capital, interest, periods: capital * (1 + interest) ** periods
# present_value
presetValue = lambda capital, interest, periods: capital * (1 + interest) ** (-periods)
# annual interest rate
annualInterest = lambda initial_capital, end_capital, years: (end... | true |
69921523e140b99a961005a19852c26d6d9045fe | Python | caoshen/leet-code | /python/Maximal Rectangle.py | UTF-8 | 861 | 2.9375 | 3 | [] | no_license | class Solution:
# @param matrix, a list of lists of 1 length string
# @return an integer
def maximalRectangle(self, matrix):
if len(matrix) == 0:
return 0
m, n = len(matrix), len(matrix[0])
H, L, R = [0] * n, [0] * n, [n] * n
result = 0
for i in range(m):
... | true |
2d0dda6fd6a36f9319f75aca4177dd32bdc88878 | Python | martindzida/tkinter | /dialogs.py | UTF-8 | 1,842 | 3.0625 | 3 | [] | no_license | from tkinter import *
class CityDialog:
def __init__(self, parent, shape):
self.shape = shape
top = self.top = Toplevel(parent)
top.title("Počet obyvatel")
top.transient(parent)
# Zablokuje práci v hlavním okně aplikace - modální okno
top.grab_set()
... | true |
da91d7dd7c05373d2b04655a539e808503408046 | Python | JoaoBueno/estudos-python | /fullcontrol-menu/funcoes/isEmail.py | UTF-8 | 525 | 3.4375 | 3 | [] | no_license | import sys
import re
def isEmail(email):
if len(email) > 7:
if re.match(r'^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', email) != None:
return True
return False
if __name__ == '__main__':
if len(sys.argv) < 2:
print("""
isEmail is an e-mail validator... | true |
cca75ac62b3b0b4874a436be0f49f963151c4be0 | Python | heddle317/coding-exercises | /factorial.py | UTF-8 | 631 | 3.171875 | 3 | [] | no_license | """
go-left Software Rotating Header Image
100 Little Programming Exercises
https://go-left.com/blog/programming/100-little-programming-exercises/
A.1 Factorial
Write a program which takes a single argument, computes the factorial and prints the value on the screen.
$ factorial 5
5! = 120
Ext 1: Change the program s... | true |
6c98bd975f2c6da9687771fbfb36bda27fb47ad3 | Python | sabin-thapa/Corona-Update | /scraper.py | UTF-8 | 2,970 | 3.4375 | 3 | [] | no_license | """WEB SCRAPING FOR CORONA UPDATES FROM THE WORLDOMETER WEBSITE USING REQUESTS, BEAUTIFUL SOUP AND PANDAS"""
from bs4 import BeautifulSoup
import pandas as pd
import requests
"""The Worldometer URL for corona updates"""
URL = "https://www.worldometers.info/coronavirus/"
print("Getting page info...")
# sending a GE... | true |
854658cf13f4ecfb539041685c704bf876be67dd | Python | HuangCongQing/Spider | /package/3xpath/05xpath解析基础.py | UTF-8 | 1,018 | 2.765625 | 3 | [
"MIT"
] | permissive | '''
Description:
Author: HCQ
Company(School): UCAS
Email: 1756260160@qq.com
Date: 2021-01-01 13:56:16
LastEditTime: 2021-01-04 10:34:44
FilePath: /Spider/package/3xpath/05xpath解析基础.py
'''
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from lxml import etree
if __name__ == "__main__":
#实例化好了一个etree对象,且将被解析的源码加载到了该对象... | true |
ee84b580ee2524c773a897ef371ac05bd09eb727 | Python | ewintergames/sj-simulator | /competition_manager.py | UTF-8 | 2,816 | 2.765625 | 3 | [
"MIT"
] | permissive | from competition_results import CompetitionResults
from jump_simulator import JumpSimulator
import random
import matplotlib.pyplot as plt
import numpy as np
class CompetitionManager:
def __init__(self, hill, competition_data, jumpers):
self.hill = hill
self.rounds = int(competition_data['rounds'])... | true |
17bfc4b20370c6310ba0adeeee1c4bafb6b377ad | Python | omatveyuk/interview | /Hackbright_whiteboard_hard/josephus.py | UTF-8 | 5,027 | 3.890625 | 4 | [] | no_license | """Given num_item in circle, erase [_every]th person, return survivor.
Imagine a group of 10 in a circle, numbered 1 to 10.
If we started at the first item (#1) and erased every three item
This continues, though, looping around again, starting with where we left of at #10.
etc.
1 2 3 4 5 6 7 8 9 10
x x x... | true |
5ec634fdd3a89ee783ff3e307c49c8b179835590 | Python | rominf/Tatoeba-anki-deckgeneration | /tatoeba_anki.py | UTF-8 | 6,902 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf8 -*-
"""A tool do download taboeba sentences and to put them into Anki
Usage:
Taboeba_anki.py [--audio] [--tags] [--author] [--src-lang <lang>]... [--audio-lang <lang>]... [--target-lang <lang>] [--copy-media] [--anki-media-dir <dir>] [--all] <url>
Options:
--audio ... | true |
99429e852a0a21e21e5d4bfbe6b6782bd184adf1 | Python | zzg-971030/Learn_ML_in_Python | /算法设计基础/LeetCodeBook/test.py | UTF-8 | 653 | 2.78125 | 3 | [] | no_license | # ! /usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
ls = ['a', 'a', 'a', 'b', 'b', 'c']
se = pd.Series(ls)
countDcit = dict(se.value_counts())
proprotitionDcit = dict(se.value_counts(normalize=True))
print(countDcit)
print(proprotitionDcit)
class FenwickTree:
def __init__(self, n):
s... | true |
852a7c70ff7d0e6519b2718eacec7ad94f7ee7a0 | Python | AhmadMamduhh/Data-Mining-Project | /main.py | UTF-8 | 4,956 | 3.640625 | 4 | [] | no_license | import numpy as np
import pandas as pd
from visualizer import Visualizer
# ------------Loading the data-------------------
# 1 = classification, 2 = regression and any other number = clustering
method_identifier = int(input('Enter 1 to choose Classification, 2 to choose Regression' +
' o... | true |
595edd6daa9549db52092be1461b978729d91032 | Python | donboyd5/weighting | /experimental_code/geoweight.py | UTF-8 | 6,780 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
geoweight class.
Created on Sat Aug 29 04:55:45 2020
@author: donbo
"""
import numpy as np
from scipy.optimize import least_squares
from timeit import default_timer as timer
class Geoweight:
"""Class with data and methods for geographic weighting.
Common terms and definition... | true |
65dc5290938f88bb9c70dc6201fa8efec8ac5dc7 | Python | bhanu566/8-puzzle-A-star | /astar.py | UTF-8 | 7,087 | 3.15625 | 3 | [] | no_license | # ;==================================================================
# ; Title: A* Algorithm using manhattan distance and misplaced tiles
# ; Author: Bhanu Prakash Reddy ,Satabdhi Reddy
# ; Date: 10 Feb 2019
# ;==================================================================
import numpy as np
from copy import d... | true |
0760bb59c8c0e66cedb8343197752d1addd25357 | Python | SpicyKong/problems | /BOJ/Q_11967.py | UTF-8 | 1,554 | 3.0625 | 3 | [] | no_license | # https://www.acmicpc.net/problem/11967 문제 제목 : 불켜기 , 언어 : Python, 날짜 : 2020-01-28, 결과 : 성공
# 이 문제는 두번쨰 while문에서 이상한 조건을 넣어버려서 계속 틀렸다..
import sys
from collections import deque
N, M = map(int, sys.stdin.readline().split())
list_map = [[0]*(N+1) for _ in range(N+1)]
list_lights = [[0]*(N+1) for _ in range(N+1)]
count_... | true |
1a0f46ef6f3b3ddf7c27183ce1da53afaef8e80b | Python | rafaelperazzo/programacao-web | /moodledata/vpl_data/117/usersdata/231/26244/submittedfiles/al2.py | UTF-8 | 88 | 2.65625 | 3 | [] | no_license | from __future__ import division
n=float(input('5.8709'))
i=int(n)
r=n-int
print('%.2f'i) | true |
4ae70bd8a919c24e36960d74f7703ef63140c1c8 | Python | jickw/my-project | /python/lnh_learn/201811/1103/test.py | UTF-8 | 328 | 3.28125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""
__title__ = ''
__author__ = 'wux'
__mtime__ = '2018/10/24'
"""
# lit = [1, "花生", "山药"]
# print(type(lit))
# tu = ("字符串",) # 元素少于一个,需要添加一个逗号
# tu = tuple() # 空元组
# tu = (1, )
# print(type(tu))
tu = ('DNF', 'LOL', 'CF', "斗地主", "消消乐") | true |
67bda472259d4ed203b6830078ab80170dc49842 | Python | Lguyogiro/fst-nahuatl | /tools/generate_verb_bases_from_stem.py | UTF-8 | 4,255 | 2.84375 | 3 | [] | no_license | import re
class VerbalStem(object):
def __init__(self, stem, transitive=False, es=False):
self.stem = stem
self.vowels = ["a", "e", "i", "o", "u"]
self.cons = "bcdfghjklmnpqrstvwxz"
self.multi_char_cons = ["ch", "tl", "tz"]
self.numVPattern = re.compile("|".join(self.vowels... | true |
5001e2c0de30e0e6db1705b115fcc6f6d3d754bb | Python | hashin22/pythonProject | /week4/checkEven.py | UTF-8 | 866 | 4.03125 | 4 | [] | no_license | #p.126
def checkEven0dd(n):
if n % 2 ==0: #n을 2로 나눴을때 0이라면
return "짝수" #짝수로 출력을 한다.
else: #그 외의 숫자를 입력받으면
return "홀수" #홀수로 출력을 한다.
while True:
number = int(input("정수를 입력하시오 =")) #number이란 변수에 정수를 입력받는다.
if number != 0000: #0000이 아니라면 함수 checkEven0dd를 실행한다.
print(f... | true |
6047d98bd420e6c390211ed9144e792cc3089036 | Python | BorysekOndrej/bakalarka3 | /app/utils/certificate.py | UTF-8 | 388 | 2.828125 | 3 | [
"MIT"
] | permissive | from OpenSSL import crypto
def certificate_thumbprint(crt_string, digest_type="sha1"):
crt = bytes(crt_string, 'utf-8')
cert = crypto.load_certificate(crypto.FILETYPE_PEM, crt)
# logger.debug(cert.get_subject())
# logger.debug(f"sha256: {cert.digest('sha1')}")
# logger.debug(f"sha256: {cert.diges... | true |
5670c59010af79754f2d4ecbab32c2677bc5c99e | Python | kratenko/HIOB-stale | /hiob/hiob_gui.py | UTF-8 | 11,290 | 2.6875 | 3 | [] | no_license | import logging
import transitions
from PIL import ImageTk, Image
import queue
import threading
import argparse
import collections
from PIL.ImageDraw import Draw
# Set up logging
logging.getLogger().setLevel(logging.INFO)
transitions.logger.setLevel(logging.WARN)
logger = logging.getLogger(__name__)
import tkinter as... | true |
66ed1bf56cba96874ca8a1d76fc606e08fde83d7 | Python | jorgemira/codewars | /katas/4kyu/kata22.py | UTF-8 | 395 | 3.1875 | 3 | [] | no_license | """
Codewars 4 kyu kata: Pyramid Slide Down
URL: https://www.codewars.com/kata/551f23362ff852e2ab000037/python
"""
def longest_slide_down(pyramid):
prev_line = pyramid[-1]
for i in reversed(xrange(len(pyramid)-1)):
line = []
for j in xrange(i+1):
line.append(pyramid[i][j] + max(pr... | true |
82d664fc3cc7da5a069be3e62d1f6d8d9f704074 | Python | dly667/PythonSmallModule | /separationExcel/new.py | UTF-8 | 4,135 | 2.671875 | 3 | [] | no_license | import xlrd
import time
import xlwt
from xlutils.filter import process, XLRDReader, XLWTWriter
import win32com.client
class Transform(object):
def __init__(self):
self.row_col_dict = dict()
pass
def read(self):
workbook = xlrd.open_workbook(u'数据格式表.xlsx',on_demand=True)
sheet_na... | true |
ff9f1b4931f14d4ec693a2985ba2f95ec2b87e7f | Python | JettChenT/realthink | /MidC/board/clock.py | UTF-8 | 4,736 | 2.609375 | 3 | [
"MIT"
] | permissive | import pygame,time,sys,datetime
SCREEN_WIDTH,SCREEN_HEIGHT=136,44
ETLED_WIDTH, ETLED_HEIGHT = 34,44
DOT_R = 3
STROKE_WIDTH,STROKE_HEIGHT = 16,12
DIGITAL_MASK=[0b00111111,0b00000110,0b01011011,0b01001111,0b01100110,0b01101101,0b01111101,0b01111111,\
0b00000111,0b01101111,0b01110111,0b01111100,0b00111001,0b01011110,0... | true |
8090147108307b6b51e2c238eb99c95733ebc444 | Python | RomekRJM/Playground | /assembly/6502/nes/mario_moving/mem_map.py | UTF-8 | 1,682 | 3.078125 | 3 | [] | no_license | import os
class VariableEnumerator():
def __init__(self):
self.counter = 0x10;
def enumerate_variables_in_file(self, file_name):
variables = []
with open(file_name, 'r+') as s:
while True:
line = s.readline()
if line.startswith('.define'):
... | true |
fb7c00a666c61bd71219a9286e1094e41eb10a00 | Python | ayy-em/psd-chatbot | /lots_of_strings.py | UTF-8 | 4,694 | 3.265625 | 3 | [] | no_license | import random
import string
# lots of text here, functions at the bottom
hi_msg = [
"hi",
"hello",
"yo",
"wassup",
"what's up",
"how you doin'?",
"bonjour",
"greetings",
"wassup yoo",
"good morning",
"hey",
"heya",
"sup",
"wazzup",
"yoo",
"yooo"
]
# rep... | true |
7b35a4f75a561be663e57e196e1cd8fb7c7b51b5 | Python | EelcoHoogendoorn/Numpy_arraysetops_EP | /numpy_indexed/semantics.py | UTF-8 | 687 | 2.71875 | 3 | [
"MIT"
] | permissive | """
This toggle switches between preferred or backwards compatible semantics for dealing with key objects.
The behavior of numpy with respect to arguments to functions like np.unique is to flatten any input arrays.
Arguably, a more unified semantics is achieved by interpreting all key arguments as sequences of key obj... | true |
0fc850d94af0d046ec9c307de3d0a7827638f8eb | Python | nats-io/nats.py | /examples/jetstream.py | UTF-8 | 1,887 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import asyncio
import nats
from nats.errors import TimeoutError
async def main():
nc = await nats.connect("localhost")
# Create JetStream context.
js = nc.jetstream()
# Persist messages on 'foo's subject.
await js.add_stream(name="sample-stream", subjects=["foo"])
for i in range(0, 10):
... | true |
69440ed6d5eff5355ec91aa87af7d140d54cd4b0 | Python | nabeen/AtCoder | /abc/abc016/a.py | UTF-8 | 324 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# https://atcoder.jp/contests/abc016/tasks/abc016_1
def main() -> None:
M, D = map(int, input().split())
print(calc(M, D))
def calc(m: int, d: int) -> str:
if m % d == 0:
return "YES"
else:
return "NO"
if __name__ == '__main__':
mai... | true |
7175d070aca9bdcef0de736e6415a61b6005dad6 | Python | stoiver/anuga_core | /anuga/operators/mannings_operator.py | UTF-8 | 2,123 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive |
__author__="steve"
__date__ ="$11/11/2011 1:52:17 PM$"
from anuga.operators.base_operator import Operator
import numpy as num
class Mannings_operator(Operator):
"""
Class for setting up a mannings opeator to apply Mannings fricition
Applying
d/dt uh = -g nu^2 uh sqrt( uh^2 + vh^2 ) / h^{7/3}
... | true |
9b78f4c2b9be157e5481d18c191b077283026f0d | Python | pangyouzhen/data-structure | /contest/findRelativeRanks.py | UTF-8 | 771 | 3.265625 | 3 | [] | no_license | from typing import List
import heapq
class Solution:
def findRelativeRanks(self, score: List[int]) -> List[str]:
negativate_score = [-i for i in score]
# heapq.heapify(negativate_score)
negativate_score.sort()
k = 1
for i in negativate_score:
ind: int... | true |
33386156031f0b0709ca8c19bfce7c0ad95b9b2a | Python | Stingray2020/SphinxAdaptionScript | /lineWriter.py | UTF-8 | 1,701 | 3.109375 | 3 | [] | no_license |
# - add some transcription lines from file
#filename = input("what is the name of the file")
#if filename == "y":
filename = "arctic20.transcription"
# arctic_a0121
# need to find last line and take note of the number
# need to make sure you add the 0 before the output number
# use this number as the start pointer f... | true |
877addc2795a096c2b1108479476949fb3d20b6e | Python | ryhanahmedtamim/pattern_recognition | /lab1/pattern.py | UTF-8 | 1,484 | 3.78125 | 4 | [] | no_license | import math
training_data_list = []
number_of_training_data = int(input("Number of training data :"))
print()
print("Input the training data:")
print("Height(inc) - Weight(kg) - Class")
for i in range(number_of_training_data):
data = input()
height, weight ,class_name = data.split(' ')
data_dictionary = {... | true |
711f20032de4894016647d8c89105551fda29d7a | Python | SebaArn/Ausbildung | /Effizienz Evaluierer/Effizienz_Evaluierer.py | UTF-8 | 9,981 | 2.765625 | 3 | [] | no_license | # import sys
import numpy as np # used to handle numbers, data structures and mathematical functions
import datetime # Used to convert our ascii dates into unix-seconds
import argparse # used to interpret parameters
import math
import sys
# import re
import os
def translate_date_to_sec(ymdhms):
"""
:para... | true |
24a1939c8884d0282cb38f78e837ff9139a16ee3 | Python | mmikol/Simulating-Low-Density-Parity-Check-Codes | /code/decoder.py | UTF-8 | 2,591 | 2.796875 | 3 | [] | no_license | from tanner_graph import TannerGraph
# Decodes a corrupted codeword using belief propagation techniques
class Decoder:
def __init__(self, parity_matrix, decoding_method, max_iterations):
self.TG = TannerGraph(parity_matrix)
self.MAX_ITERATIONS = max_iterations
self.decoding_method = decodin... | true |
a3dc43e6cddfdc7d4318be30926e7b50c4cedb3f | Python | ahartloper/RESSPyLab | /RESSPyLab/uvc_constraints.py | UTF-8 | 8,031 | 3.125 | 3 | [
"MIT"
] | permissive | """@package vcu_constraints
Constraints for the updated Voce-Chaboche model to maintain a positive tangent modulus and positive parameters.
"""
import numpy as np
from numdifftools import nd_algopy as nda
def g_constraint(x, ep):
""" Returns the constraint that the tangent modulus is hardening (g function) in sta... | true |
64deb56abe08b5480466a6083db4b6ba4b47c7a0 | Python | shannonay0103/Unit-4-Lesson-5 | /Lesson 5/problem3.py | UTF-8 | 173 | 3.265625 | 3 | [] | no_license | from turtle import*
toht = Turtle()
toht.color('blue')
toht.pensize(5)
toht.speed(9)
toht.shape('turtle')
for x in range(6):
toht.forward(50)
toht.left(60)
mainloop()
| true |
36e5f7278c129b5c79965d0add6db390f84aad92 | Python | minxuanjun/tensorflow | /tutorial_project/data_generate.py | UTF-8 | 532 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 12 16:49:55 2018
@author: minxuan
"""
import numpy as np
import matplotlib.pyplot as plt
SEED = 2
def generateData():
rng = np.random.RandomState(SEED)
X = rng.randn(300,2)
Y_ = [int(x0*x0 + x1*x1 <2) for (x0, x1) in X]
color = ['red' if y else 'blue' fo... | true |
7d14d45b7045d50997ad4868a1ea85b49c0ded57 | Python | wanwanaa/autoencoder | /AE_cnn.py | UTF-8 | 2,434 | 2.53125 | 3 | [] | no_license | import torch
import torchvision
import torch.nn as nn
import torch.utils.data as Data
import matplotlib.pyplot as plt
# hyper Parameters
EPOCH = 1
BATCH_SIZE = 32
LR = 0.001
DOWNLOAD_MNIST = False
train_data = torchvision.datasets.MNIST(
root='\mnist',
train=True,
transform=torchvision.transforms.ToTensor... | true |
af62072f3dc4dcca99f88346452220310fd7b068 | Python | AaronBitman/TextFormatter | /output_buffer.py | UTF-8 | 3,289 | 3.734375 | 4 | [] | no_license | from justifiable_str import JustifiableStr
class OutputBuffer:
"""Class to hold and write the output"""
def __init__(self, output_file_name):
"""Create the file object and initialize the buffer."""
self.file_object = open(output_file_name, 'w')
self.buffer = ""
def write... | true |
9d067bceb01b03d4ff17afe685058ae5ba088370 | Python | miguel1996/Ambilight | /PC/ColorCollector.py | UTF-8 | 1,527 | 2.96875 | 3 | [] | no_license | from PIL import ImageGrab
class Modes:
screen = 0
keyboard = 1
static = 2
class ColorCollector:
_sampleRes = None
_color = (255, 0, 0)
_counter = 0
_factor = 20
_width = 1920
_height = 1080
def __init__(self, sample_width, sample_height):
self.set_sample(sample_width... | true |
dbb92b37f7ecfca8386c142b87b83fe8613abb42 | Python | shuaib7860/GraphHierarchy | /GraphHierarchy/GraphHierarchy.py | UTF-8 | 26,988 | 3 | 3 | [
"MIT"
] | permissive | from numpy import zeros, ones, ndarray, average
from networkx import adjacency_matrix, Graph
from scipy.sparse import diags, lil_matrix, spmatrix
from scipy.sparse.linalg import lsqr
def forward_hierarchical_levels(graph, weight=None):
"""Returns the forward hierarchical levels of the nodes of a network as an ar... | true |
faf0f161102bd26dd3d8d1b6fc954cc38af07309 | Python | marcelomagri/py-scraper | /py-scraper/py-scraper/my_sql.py | UTF-8 | 544 | 2.6875 | 3 | [] | no_license | import sqlite3
import datetime
def openConn():
conn = sqlite3.connect('data/dados.db')
return conn
def closeConn(conn):
conn.close()
# Grava um item capturado no banco de dados
def WriteItem(conn, descricao, titulo, classificacao, country_code):
cursor = conn.cursor()
cursor.execute("INSERT IN... | true |
ee43c7688d414c53057ffca8832a3548ef6c80b6 | Python | stzvst/HWGeek6 | /1.py | UTF-8 | 655 | 3.703125 | 4 | [] | no_license | #Задание 1
from time import sleep
def in_sleep(time_out):
t = 0
while t < time_out:
t +=1
print(t)
sleep(1)
class Svetofor:
__color = ['RED', 'YELLOW', 'GREEN']
def running(self, times):
j = 0
while j < times:
i = 0
while i < 3:
... | true |
69bf57a9059b5b6961e186f2c490b27f10535843 | Python | KedoKudo/ISAW | /PythonSources/Lib/spectrum2.py | UTF-8 | 2,002 | 2.71875 | 3 | [] | no_license | #--------------------------------------------------------
# function spectrum2
#--------------------------------------------------------
#! Obtain spectral correction from counts vs. time data
#! in a Bankxx_spectrum.asc file.
#! Fortran version: A. J. Schultz, July, 2009
#! Jython version: A.... | true |
51e46f981c7a2ddd28ae1d47df4df18e6f804be9 | Python | LucianaRepetto/pythonbootcamp | /23functions_parametros.py | UTF-8 | 72 | 3.265625 | 3 | [] | no_license | def square(param):
return param**2
print(square(8))
print(square(6)) | true |
682563337990fc2bf81b702068ec5bf41c5f1dec | Python | udhayprakash/PythonMaterial | /python3/19_Concurrency_and_Parallel_Programming/01_MultiThreading/threading/Ch9.py | UTF-8 | 6,059 | 3.40625 | 3 | [] | no_license | import base64
import os
import random
import sys
from functools import reduce
# These examples are not in individual functions in the chapter, but
# to isolate them, they are separated into individual functions here
def lambda_sample():
# use lambda with filter
filter_me = [1, 2, 3, 4, 6, 7, 8, 11, 12, 14, 1... | true |
d0beb1a105c3b1ba12b9117bb93012aa7c6067b0 | Python | Ravi-Seth/Python-Scripts | /OddEven.py | UTF-8 | 582 | 4.21875 | 4 | [] | no_license | # Make a large List
n=int(input("Enter How many numbers :"))
a=[]
for i in range(0,n):
print (i+1)
x=int(input("Enter number : " ))
a.append(x)
EvenList=[]
OddList =[]
for i in a:
if (i%2==0):
EvenList.append(i)
else:
OddList.append(i)
EvenList.sort()
OddLi... | true |
c9a32cfe1c4f1ee68852c07843116a0851b21cbc | Python | nangnh/PhotoScan_Scripts | /PS_get_gcp_checkpoint_errors.py | UTF-8 | 3,655 | 2.578125 | 3 | [
"MIT"
] | permissive | # Script for finding the error at each GCP in a PhotoScan model.
# This script only runs inside Agisoft PhotoScan Pro.
# This script iterates through all enabled markers (with valid coordinates),
# turning off one at a time, optimizing the cameras, and checking the errors.
# The errors are written to a text file in th... | true |
62f137bdd0722fabc8776594717e480a87905098 | Python | billhu422/python_stdlib | /builtin_functions/builtin_functions.py | UTF-8 | 8,779 | 3.875 | 4 | [] | no_license | #encoding:utf-8
'''
Created on 2014年7月22日
@author: Administrator
'''
#encoding:utf-8
'''
Created on 2014年7月21日
@author: Administrator
'''
'''
abs绝对值
abs(x)
Return the absolute value of a number. The argument may be a plain or long integer or a floating point number. If the
argument is a complex... | true |
9efc34a47abb0d540b141fe79f0f118c0c58fc9a | Python | JayanthMouli/fwi-NET | /regression/fwiNET.py | UTF-8 | 1,637 | 2.953125 | 3 | [
"MIT"
] | permissive | #fwiNET multilayer perceptron regressor
#created by Jayanth Mouli 2019
###########################################################################################################################################
import numpy as np
import pandas
from keras.layers import Dense, Activation
from keras.models import Sequent... | true |
dee6a132081b9780a6c8def25f2706b71cdab04e | Python | Aasthaengg/IBMdataset | /Python_codes/p02262/s669334396.py | UTF-8 | 667 | 3.46875 | 3 | [] | no_license | def insertion_sort(A, N, gap):
cnt = 0
for i in range(gap, N):
tmp = A[i]
j = i - gap
while j>=0 and A[j] > tmp:
A[j+gap] = A[j]
j = j - gap
cnt = cnt + 1
A[j+gap] = tmp
return cnt
def shell_sort(A, N):
cnt = 0
gaps = [int((3**item... | true |
4865500160e1b3c27fa19fe29f83a735253fd135 | Python | vandycknick/resume | /infra/deploy.py | UTF-8 | 2,179 | 2.609375 | 3 | [
"MIT"
] | permissive | import os
import sys
import stat
import argparse
from pathlib import Path
from azure.storage.blob import BlobServiceClient, ContentSettings
def is_input_redirected() -> bool:
if os.isatty(sys.stdin.fileno()):
return False
else:
mode = os.fstat(0).st_mode
if stat.S_ISFIFO(mode):
... | true |
bda4370a1c11b63eb3c77396a8e7e691a1820837 | Python | wylkson/TCC-Ci-ncia-de-dados-e-Big-Data | /TCC.py | UTF-8 | 2,920 | 2.828125 | 3 | [] | no_license | from surprise import Dataset, Reader, KNNBasic, KNNWithMeans, accuracy
from surprise.model_selection import train_test_split
from collections import defaultdict
import pandas as pd
import numpy as np
def carregar_filmes(path):
filmes = pd.read_csv(path)
return filmes
def carregar_avaliacoes(path):
avaliac... | true |
544829bb4ccda15c7e895f9b6b39a8791cae77e9 | Python | tackme/exercism | /python/isogram/isogram.py | UTF-8 | 147 | 3.140625 | 3 | [] | no_license | import re
def is_isogram(string):
converted_str = re.sub("[ -]", "", string.lower())
return len(converted_str) == len(set(converted_str))
| true |
591f583acb235cb52af111815ec6b9309e33598b | Python | songkai237/algorithm | /sort/merge_sort.py | UTF-8 | 840 | 3.953125 | 4 | [] | no_license | def mergeSort(alist):
print(alist)
if len(alist) > 1:
mid = len(alist) // 2
leftlist = alist[:mid]
rightlist = alist[mid:]
mergeSort(leftlist)
mergeSort(rightlist)
i, j, k = 0, 0, 0
while i < len(leftlist) and j < len(rightlist):
if leftlis... | true |
d645f8307ab101d884150e6a427ae247b779f389 | Python | orifake/leetcode-python | /src/Check If It Is a Straight Line.py | UTF-8 | 617 | 3.609375 | 4 | [] | no_license | from typing import List
class Solution:
def checkStraightLine(self, coordinates: List[List[int]]) -> bool:
if len(coordinates) <= 2:
return True
for i in range(2,len(coordinates)):
if not self.isLine(coordinates[0],coordinates[1],coordinates[i]):
return Fal... | true |
d602109f1440474cafb12f051f803fb2155d04af | Python | dasfaha/AdjointFashematians | /free-style/drunken_beer_reviewer.py | UTF-8 | 1,309 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
""""
EXAMPLES
--------
Drunken Robo Reviewer 5000 Says...
Review: very light belgian yeasts and green bottled beers. taste either. but primarily grapefruit , and does n't smack taking a smooth experience
Drunken Robo Reviewer 5000 Says...
thick syrupy smells like a slightly buttery malt. i will cont... | true |
44cb02d2777e4872a6e90d1d23d19b85a5d89417 | Python | vevanonarain/Automation | /automation.py | UTF-8 | 911 | 5 | 5 | [] | no_license | def add (x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
return x / y
def modulo(x, y):
return x % y
print("Select Operation: \n 1) Addition \n 2) Subtraction \n 3) Multiplication \n 4) Division \n 5) Modulo")
choice = inpu... | true |
bd7a22e751a48eacbe73b4809eea469134ce7514 | Python | idsc-frazzoli/kartsim | /src/simulator/model/kinematic_mpc_model.py | UTF-8 | 5,373 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created 28.05.19 09:38
@author: mvb
"""
import numpy as np
from simulator.model.dynamic_model_input_converter import MotorFunction, BrakeFunction, SteeringFunction
class KinematicVehicleMPC:
def __init__(self, wheel_base=1.19, dist_cog_rear_axle= 0.46, direct_in... | true |
623de3d97f4de1174221480d55e78397c39b4cdc | Python | silky/bell-ppls | /env/lib/python2.7/site-packages/observations/r/uk_house_of_commons.py | UTF-8 | 2,505 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def uk_house_of_commons(path):
"""1992 United Kingdom electoral returns
... | true |
4fd7132b4549043c78faf0342e00526743cf3b76 | Python | antooa/familyFinanceTracker | /iBudget/income/views.py | UTF-8 | 4,194 | 2.640625 | 3 | [] | no_license | """
This module provides functions for income specifying.
"""
import json
from django.http import HttpResponse, JsonResponse
from django.views.decorators.http import require_http_methods
from group.models import Group
from income_history.models import IncomeHistory
from utils.aws_helper import AwsService
from utils.u... | true |
ab62b17628e6568285b6bd516fd85192037c6eb3 | Python | charleskausihanuni/B2-Group-Project | /Main Program FINAL.py | UTF-8 | 11,861 | 3 | 3 | [] | no_license | #GUI
import Tkinter
from Tkinter import *
import tkMessageBox
class Labels:
def __init__(self, root):
self.root = root
self.label=Label(root, text='Search Criteria ',height=2).grid(row=1,column=1,sticky=W)
self.label=Label(root, text='Location: ').grid(row=2,column=1,sticky=E)
... | true |
c11ea0a1c9d9713cb3ef043aa1e53642c15f6a68 | Python | mrillusi0n/compete | /koba.py | UTF-8 | 158 | 3.515625 | 4 | [
"MIT"
] | permissive | digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
tens_digit = '7'
for digit in digits:
print('{}{}'.format(tens_digit, digit))
print('80')
| true |
784f113ef31a3d352f0093ec476232518f103126 | Python | boonchu/python3lab | /coursera.org/python3/quiz/homework2/quiz9-1.py | UTF-8 | 673 | 4.3125 | 4 | [] | no_license | #! /usr/bin/env python
"""
Create a rectagular grid and iterate through
a subset of its cells in a specified direction
If running this code snippet prints 13 in the console,
what are the non-negative values of row and col?
"""
GRID_WIDTH = 6
GRID_HEIGHT = 4
# Create a rectangular grid using nested list comprehensio... | true |
fb9d54392d38221690c2ea6c1a12ef9fcdabac60 | Python | NordMan10/OptimalMotion3.1-py- | /Model.py | UTF-8 | 29,852 | 3.015625 | 3 | [] | no_license | import copy
from AircraftInputDataGenerator import AircraftInputDataGenerator
from static.ProgramConstants import ProgramConstants
from Runway import Runway
from SpecialPlace import SpecialPlace
from TableRow import TableRow
from TakingOffAircraft import TakingOffAircraft
from Interval import Interval
from static.Comm... | true |
96dcb0551e29e267c82f5cb5d72b6b66e8b8b7e4 | Python | TheSlimvReal/PSE---LA-meets-ML | /modules/test/unittest/view/test_cli_output_service.py | UTF-8 | 2,259 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | from mock import patch, call
from modules.exception.exceptions import IllegalArgumentException
from modules.view.cli_output_service import CLIOutputService
from modules.view.observable import Observable
@patch("modules.view.command_line_interface.CommandLineInterface")
def test_create_observable_to_print_three_value... | true |
3357ef51d96e6844849fa8242905a804c39aea6b | Python | VikasSingh-DS/Mechanisms-of-Action-Prediction-Kaggle | /train.py | UTF-8 | 3,542 | 2.640625 | 3 | [] | no_license |
def run_training(fold, seed):
seed_everything(seed)
train = processed(folds)
test_ = processed(test)
trn_idx = train[train['kfold'] != fold].index
val_idx = train[train['kfold'] == fold].index
train_df = train[train['kfold'] != fold].reset_index(drop=True)
valid_df = tra... | true |
e965a1263d085e18b7979b5da3cd034b42ef8796 | Python | khaleeque-ansari/Online-Coding-Problems-Solutions-Python | /ProjectEulerCode/prob38.py | UTF-8 | 1,555 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | def ispandigital(x):
s = set()
for c in str(x):
s = s.union([int(c)])
if s == set([1,2,3,4,5,6,7,8,9]) :
return True
else:
return False
max_concat_prod = 918273645
for x in range(90,100):
temp = ''
stop = False
i = 0
... | true |
77f8753af2356e7e748d01c09ae626b6e1ab1ee2 | Python | nazaninsbr/Stack | /get_min.py | UTF-8 | 1,003 | 3.890625 | 4 | [] | no_license | class Stack:
def __init__(self):
self.values = []
self.min = ''
def push(self, x):
self.values.append(x)
if self.min=='':
self.min=x
elif self.min > x:
self.min = x
def top(self):
if len(self.values)==0:
return -1
return self.values[-1]
def isEmpty(self):
if len(self.values)==0:
retur... | true |
67e9e440e0fcc86c47758e57f47cce98b2bc651b | Python | EugeneBudzinskiy/Dino_RL | /NN.py | UTF-8 | 3,478 | 2.578125 | 3 | [] | no_license | from config import *
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.python.framework.errors_impl import NotFoundError
from CustomException import LoadNNException
class NeuralNetwork:
def __init__(self, input_size, output_size):
self.input_size = input_size
... | true |
6bd56107666055fd8bdcc34bd857586000d255c8 | Python | z-x-z/rl | /src/environments/GridworldEnv.py | UTF-8 | 5,477 | 2.859375 | 3 | [] | no_license | # coding: utf-8
import numpy as np
import sys
from time import sleep
from gym import utils
from gym.envs.toy_text import discrete
UP = 0
RIGHT = 1
DOWN = 2
LEFT = 3
ACTION_MAP = ["up", "right", "down", "left"]
ARROW_MAP = ["↑", "→", "↓", "←"]
MAPS = {
'5*5': ["OOOOO", "OSOOO", "OOOXO", "OOXGO", "OOOOO"],
'4*... | true |
c33e3859014f0ebb5f176177c35f9ec18b7121ef | Python | afcarl/isa | /code/transforms/radialgaussianization.py | UTF-8 | 4,420 | 2.9375 | 3 | [
"MIT"
] | permissive | __license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>'
__author__ = 'Lucas Theis <lucas@theis.io>'
__docformat__ = 'epytext'
from transform import Transform
from scipy.stats import chi
from scipy.special import gamma, erf, erfinv
from scipy.optimize import bisect
from tools import gammaincinv... | true |
c9d08e23d4cb4c0ec32f63e0b5a93775d03b2435 | Python | Sarthakg91/PythonMiniProjects | /Sentiment Analysis/LIWC Analysis of Comments/LIWCMeta.py | UTF-8 | 1,578 | 2.796875 | 3 | [] | no_license |
"""
Created on Fri Mar 01 13:35:34 2016
@author: Sarthak Ghosh
"""
import re
def getLex(post, liwc_lexicons):
liwc_lexicon_to_count = {}
for liwc_lexicon_name in set(liwc_lexicons.keys()):
liwc_lexicon_to_count[liwc_lexicon_name] = 0
for name, items in liwc_lexicons.iteritems():
for item in items:
patter... | true |
2d84c5dff92041ba4b89ef6415b47e496953378d | Python | Brian-nyabuto12/contacts-app | /contact.py | UTF-8 | 706 | 3.34375 | 3 | [] | no_license | class Contact:
"""
Class that generates new instance of contacts
"""
contact_list =[]
def __init__(self, first_name, last_name, number):
self.first_name= first_name
self.last_name= last_name
self.number= number
def save(self):
self.c... | true |
990de5c4582a84055d0da79e067ccda0ac45fa56 | Python | ImogenHay/Graphs | /Depth-first Search (traversing graph).py | UTF-8 | 1,819 | 4.03125 | 4 | [] | no_license | ### Depth-first Search using Node Class ###
class Node(object):
# Constructor
def __init__(self, name):
print("A Node has been created")
# Attributes
self.name = name
self.children_amount = 0
self.childList = []
# String Method called on print
d... | true |
e98a22f9f6cdc8439e59ccf64533185e69b36dac | Python | YoshimitsuMatsutaIe/car_ctr | /sotsuron/make_figs.py | UTF-8 | 18,986 | 2.59375 | 3 | [
"MIT"
] | permissive | """グラフ作成ツール"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as anm
import matplotlib.patches as patches
import matplotlib.cm as cm
import math
from math import pi, sin, cos, tan
import time
import datetime
#import scipy as sy
import pathlib
from matplotlib.font_manager import FontProp... | true |
634d13b1e5f356d670ed50f6ce3c41b3443904af | Python | pypr-2021/w02-workshop | /fibonacci.py | UTF-8 | 532 | 3.859375 | 4 | [] | no_license | # Task 1: Generalised Fibonacci
# Define your function here:
# Tests
print(p_q_fibo(1, 1, 15))
# Expected result: [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]
print(p_q_fibo(1, 3, 15))
# Expected result: [1, 1, 4, 7, 19, 40, 97, 217, 508, 1159, 2683, 6160, 14209, 32689, 75316]
print(p_q_fibo(2, ... | true |
15a3d9071fb5dae0e0ce26f170034092d564a1cb | Python | Gencid/practice-python | /22 Read From File.py | UTF-8 | 915 | 3.5625 | 4 | [] | no_license | """https://www.practicepython.org/exercise/2014/12/06/22-read-from-file.html"""
import re
dictnames = dict()
textnames = open("nameslist.txt", "r")
for linenames in textnames:
names = linenames.split()
for name in names:
if name not in dictnames:
dictnames[name] = 1
else:
... | true |
83d1c56690f91007533132ef5868e63fc4fea139 | Python | natachabourg/Bluebottles | /observation_data/analysis_observation_data/analysis_sydney_obs.py | UTF-8 | 29,927 | 2.578125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu June 06 12:10:20 2019
@author : Natacha
"""
import datetime
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from matplotlib.lines import Line2D
import pandas as pd
import numpy as np
import math
import glob
from windrose import plot_windrose
class tim... | true |
e0474cc8deaeb1a20bc142d1cacbda49b8db3158 | Python | velagalasailaja/Become_coder_python | /primecount_in_lists.py | UTF-8 | 464 | 3.15625 | 3 | [] | no_license | import math as m
def countprime(n,data):
def isprime(n):
if n==1:
return 0
s=int(m.sqrt(n))
for i in range(2,s+1):
if n%i==0:
return 0
return 1
for i in data:
pc=0
if isprime(i):
pc+=1
return p... | true |
485dcdb73f6c3463f35f83de5f1ded1f2bfa4757 | Python | florisvb/ArduinoStepper | /python/examples/basics.py | UTF-8 | 2,065 | 3.078125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import time
import numpy as np
import arduino_stepper.arduino_stepper as arduino_stepper
if __name__ == '__main__':
# set up variables for serial communication
port = '/dev/ttyACM0'
baudrate = 19200
timeout = 1
# instantiate stepper class
print 'Initia... | true |
90d3937b3f14b3217128e7020ab4155b0a62522f | Python | venkat-oss/SPOJ | /BITPLAY.py | UTF-8 | 303 | 2.65625 | 3 | [] | no_license | T = int(input())
for _ in range(T):
N, K = map(int, input().split())
if K == 0 or N == 1:
print(-1)
continue
result = 1
K -= 1
for i in range(30, -1, -1):
if K > 0 and result + (1 << i) < N:
K -= 1
result += (1 << i)
print(result)
| true |
708ea2057bbcd91ab83d57346e343c41901f4158 | Python | Falmouth-Games-Academy/bsc-course-materials | /COMP110/05/graphs.py | UTF-8 | 3,017 | 3.109375 | 3 | [] | no_license | __author__ = 'Ed'
import matplotlib.pyplot as plt
plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams.update({'font.size': 22})
x = np.linspace(1, 100)
y_const = x*0 + 5
plt.ylim(0, 10)
plt.plot(x, y_const)
plt.xlabel('Students')
plt.ylabel('Time (hours)')
plt.sa... | true |
60c682e0ff926dcfca0727559f5cc78ee033272e | Python | zOOGal/Computer-Vision | /HW6 Image Segmentation/funcs.py | UTF-8 | 4,090 | 2.890625 | 3 | [] | no_license | import numpy as np
import cv2
import copy
def Otsu(ch_info):
'''
:param img: gray-scale input image
:param tag: True: forebackground is class C0, False:background is class C0
:return: black-white image/channel
'''
img_size = len(ch_info)
histRange = (0, 256)
hist, bi... | true |
d3eae88cfb1e39767b7479ea81438d0168e0f0e2 | Python | kevinguy28/Finding-the-Minimum-Spanning-Tree-of-a-graph | /find_mst.py | UTF-8 | 3,378 | 4.375 | 4 | [] | no_license | # Graphs will be input as an list of edges. Each edge will be a tuple of the form (u,v,w)
# Where u and v represent the endpoints of an edge, and w represents the cost of that edge
# The function will also take as input n, the number of vertices in the graph
# The graph is undirected(you can travel from u to v or from ... | true |
9481b349cdf3bb5b283b2b1010787cb0ac6c9618 | Python | ehdgua01/Algorithms | /coding_test/codility/cyclic_rotation/test.py | UTF-8 | 521 | 3.015625 | 3 | [] | no_license | import unittest
from .solution import solution
class TestCase(unittest.TestCase):
def test_case_1(self) -> None:
self.assertEqual(solution([3, 8, 9, 7, 6], 3), [9, 7, 6, 3, 8])
self.assertEqual(solution([0, 0, 0], 1), [0, 0, 0])
self.assertEqual(solution([1, 2, 3, 4], 4), [1, 2, 3, 4])
... | true |