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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
14d78c9bceab38af97aaceff8679c704b5bc1538 | Python | mdallow97/Machine-Learning-Practice | /linalg.py | UTF-8 | 6,837 | 3.78125 | 4 | [] | no_license | # linalg.py
"""
This file contains functions commonly seen in linear algebra, and are building blocks to functions used in Machine Learning.
This file was solely for practicing Linear Algebra and making sure I understand the main concepts. It may not scale correctly.
Finally, it does not contain some of the most impor... | true |
a15af4a9de3c2c5205891a1e25dc8ec7a258bc43 | Python | PoolBRad/GIT-Python | /stockloss.py | UTF-8 | 295 | 3.921875 | 4 | [] | no_license | print('This is a quick script that will calculate a % loss or gain.')
buy_price = float(input('What is your buy price? '))
sell_price = float(input('What is the sell/current price? '))
gain_loss = ((sell_price - buy_price) / buy_price) * 100
print('Your gain/loss is {}%.'.format(gain_loss))
| true |
b1fcd52bb5682eb716a0c0a710cd9da853e438bb | Python | danielegrattarola/spektral | /spektral/layers/pooling/dmon_pool.py | UTF-8 | 7,195 | 2.640625 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
from tensorflow.keras import Sequential
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Dense
from spektral.layers import ops
from spektral.layers.pooling.src import SRCPool
class DMoNPool(SRCPool):
r"""
The DMoN pooling layer from the paper
... | true |
26a1de0083f159e63deb2da450f7e314108e82c6 | Python | safpla/autoLoss | /sep_train_gan.py | UTF-8 | 3,377 | 2.625 | 3 | [] | no_license | """ Traditional GAN """
# __Author__ == "Haowen Xu"
# __Data__ == "04-29-2018"
import tensorflow as tf
import numpy as np
import logging
import os
import sys
from models import cls
import utils
logger = utils.get_logger()
def train(config):
g = tf.Graph()
gpu_options = tf.GPUOptions(allow_growth=True)
co... | true |
9c2b61ea2505ddadab31309c3aa51de8929aa086 | Python | amazingguni/codevisualizer | /CodeVisualizerView/CodeVisualizer/doc/python 코드.py | UTF-8 | 318 | 2.6875 | 3 | [] | no_license | import sys
import bdb
def spam():
print 'in spam'
a=3
b=4
c=6
d=A()
e=4
class A:
def __init__(self):
self.a = 10
self.b = 3
self.c = 3
self.d = None
if __name__ == '__main__':
a=5
b=6
c=3
spam()
print "->end"
| true |
8c4aa1d79ade6c637e68abd3b8515e665d838fe1 | Python | Jitendrap1702/Coding_Ninjas_Intro_to_Python | /Conditions And Loops Python/armstrong.py | UTF-8 | 250 | 3.515625 | 4 | [] | no_license | m=int(input("enter number1"))
n=int(input("enter number2"))
for num in range(m,n+1):
sum=0
temp=num
while temp>0:
rem=temp%10
sum+=rem**3
temp=temp/10
if num==sum:
print(num)
else:
continue
| true |
f0ff49ed770f7c8b1a356b6ef1705ef60d6c2db1 | Python | sobolewskidamian/python_project_game | /src/main.py | UTF-8 | 4,657 | 2.640625 | 3 | [] | no_license | import sys
import pygame
from pygame.locals import QUIT, KEYDOWN, K_RETURN, K_KP_ENTER
from objects.inputBox import InputBox
from objects.submitBox import SubmitBox
from game import Game
FPS = 70
SCREENWIDTH = 288
SCREENHEIGHT = 512
def main():
global SCREEN, FPSCLOCK
pygame.init()
FPSCLOCK = pygame.tim... | true |
32d18b192727be2849d1c8fdd9f074616d268610 | Python | benyhh/FYS2160 | /Oblig/oblig1/1.py | UTF-8 | 1,322 | 2.953125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from scipy.special import comb
from scipy.misc import derivative
f = open('termokopper.txt', 'r')
lines = f.readlines()
time = np.zeros(len(lines))
temp1 = np.zeros(len(lines))
temp2 = np.zeros(len(lines))
for i in range(len(lines)):
split = lines[i].split()
... | true |
d8d1788f92b34df42210fc76e9035369d1a51d5d | Python | saltstack/salt | /salt/beacons/inotify.py | UTF-8 | 12,276 | 2.59375 | 3 | [
"Apache-2.0",
"MIT",
"BSD-2-Clause"
] | permissive | """
Watch files and translate the changes into salt events
:depends: - pyinotify Python module >= 0.9.5
:Caution: Using generic mask options like open, access, ignored, and
closed_nowrite with reactors can easily cause the reactor
to loop on itself. To mitigate this behavior, consider
... | true |
e02d0038e4dfe718d74a61ab9209f25fc71bfa51 | Python | zhexxian/SUTD-The-Digital-World | /Homework/coding_week3/Ex 1.py | UTF-8 | 89 | 2.890625 | 3 | [] | no_license | def mayIgnore(x):
if type(x) == int:
return x+1
else:
return None | true |
fff4755484c7a0e9ae8f92fdfa507b0d09534ad6 | Python | Malvi-M/Python-Projects | /Automatic Wifi Connector Bot.py | UTF-8 | 1,185 | 2.984375 | 3 | [] | no_license | ### Automatic Wifi Connector Bot
import os
import sys
saved_profiles = os.popen('netsh wlan show profiles').read() # To get the saved profiles
print(saved_profiles)
available_profiles = os.popen('netsh wlan show networks').read() # To get the available profiles
print(available_profiles)
preferred_ss... | true |
a2baaaf7fd8a543c5622ead44da7592be6165759 | Python | m32/endesive | /endesive/pdf/PyPDF2_annotate/annotations/rect.py | UTF-8 | 5,699 | 3.03125 | 3 | [
"MIT",
"LGPL-3.0-only",
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Rectangular Annotations
~~~~~~~~~~~~~~~~~~~~~~~
Annotations defined by a width and a height: Square, Circle
:copyright: Copyright 2019 Autodesk, Inc.
:license: MIT, see LICENSE for details.
"""
from .base import Annotation
from .base import make_border_dict
from ..pdfrw ... | true |
c6c5ae8c5a59295e44d036f02f95e1a4ff367b1e | Python | strattonbrazil/parts | /python/minigame.py | UTF-8 | 1,488 | 2.859375 | 3 | [] | no_license | import sys
def pointContainsRect(mousePos, rect):
mouseX, mouseY = mousePos
rectX, rectY = rect["position"]
rectWidth, rectHeight = rect["size"]
return rectX < mouseX and rectY < mouseY and mouseX < rectX + rectWidth and mouseY < rectY + rectHeight
def scaleColor(color, scale):
return tuple(map(la... | true |
0359a70928c8a530c82173829c54ca70a3674fc5 | Python | oudream/hello-fastai | /courses-py/deeplearning2/seq2seq-translation.py | UTF-8 | 21,695 | 3.0625 | 3 | [] | no_license |
# coding: utf-8
# # Requirements
# In[6]:
import unicodedata, string, re, random, time, math, torch, torch.nn as nn
from torch.autograd import Variable
from torch import optim
import torch.nn.functional as F
import keras, numpy as np
# In[7]:
from keras.preprocessing import sequence
# ## Loading data files
#... | true |
81d132714ff38f33492314dd6ea80c92b610d5c5 | Python | Dysio/PrjCodeWars | /ZadaniaDodatkoweSDA/deep_reverse.py | UTF-8 | 1,783 | 3.8125 | 4 | [] | no_license | def deep_reverse(L):
""" assumes L is a list of lists whose elements are ints
Mutates L such that it reverses its elements and also
reverses the order of the int elements in every element of L.
It does not return anything.
"""
# resultL = []
# for elem in L:
# resultL.append(L[-1-ele... | true |
739d40c5aa508388cffe9fe7dbc529011feada94 | Python | nware49/PythonExploration | /MultiThreadDataSimulator.py | UTF-8 | 3,129 | 3.171875 | 3 | [] | no_license | import serial
import math
import time
import threading
import random
from datetime import datetime
Port1 = "COM3" #This is which port the data will be sent from
Port2 = "COM4"
#Attempts to open and assign a serial port
#If it cannot open the port, it will print an error message
try:
ser1 = serial.Seria... | true |
d7aa3e1a5f0de6c37553d2cf021f3c761afc3829 | Python | Dmitrii-Geek/Homework | /lesson3.1.py | UTF-8 | 577 | 3.46875 | 3 | [] | no_license | def div(*arg):
try:
arg1 = int(input("Введите числитель"))
arg2 = int(input("Введите знаменатель"))
res = arg1 / arg2
except ValueError:
return 'Value error'
except ZeroDivisionError:
return "Вы не можете использовать ноль как делитель!"
return res
... | true |
15576e0d7a798897492000a0710960810291dc40 | Python | leonhx/leetcode-practice | /60.permutation-sequence.py | UTF-8 | 469 | 3.015625 | 3 | [
"MIT"
] | permissive | #
# @lc app=leetcode id=60 lang=python3
#
# [60] Permutation Sequence
#
class Solution:
def getPermutation(self, n: int, k: int) -> str:
n_combs = 1
for i in range(2, n + 1):
n_combs *= i
k -= 1
digits = list(range(1, n + 1))
result = []
for i in range(n):... | true |
d94a108c055ca4abd740753742372535ef4258b2 | Python | oway13/Schoolwork | /15Fall/1133 Intro to Programming Concepts/Python Labs/Lab 11/l11 st.py | UTF-8 | 912 | 3.796875 | 4 | [
"MIT"
] | permissive | #Lab 11 Stretch
class measure:
def __init__(self, ft=0,inch=0):
self.feet = 0
if ft == 0:
self.feet += inch//12
self.inches = inch % 12
else:
self.feet = ft
self.inches = inch
def __str__(self):
retstr = ''
if s... | true |
84b15928fa24ed359908cc44b961c06523906a08 | Python | Wendelstein7/DiscordUnitCorrector | /unitbot.py | UTF-8 | 7,863 | 2.9375 | 3 | [
"MIT"
] | permissive | # Discord Unit Corrector Bot
#
# This bot is licenced under the MIT License [Copyright (c) 2018 Wendelstein7]
#
# This is a Discord bot running python3 using the Discord.py library
# This bot will listen for any messages in Discord that contain non-SI units and when detected, reply with the message converted to SI-Unit... | true |
2abdbd77bbac72408af24e5d0e476d679c04289f | Python | jinaur/codeup | /1420.py | UTF-8 | 220 | 3.046875 | 3 | [] | no_license | n = int(input())
ln = []
l = []
for i in range(0, n) :
a, b = input().split()
ln.append(a)
l.append(int(b))
ll = sorted(l)
ll.reverse()
for i in range(0, n) :
if ll[2] == l[i] :
print(ln[i])
| true |
c9d61e0d40829db81afb606956bf8a0ca8744cc4 | Python | 33Peng33/named | /layer.py | UTF-8 | 2,226 | 2.875 | 3 | [] | no_license | import tensorflow as tf
class FeedForwardNetwork(tf.keras.models.Model):
def __init__(self, hidden_dim: int, dropout_rate: float, *args,**kwargs) ->None:
super().__init__(*args,**kwargs)
self.hidden_dim = hidden_dim
self.dropout_rate = dropout_rate
self.filter_dense_layer = tf.kera... | true |
7f1f3ee66f54c73175c2bd120d0fd85d8f28ff32 | Python | liuxushengxian/Python001-class01 | /week04/pd_to_sql.py | UTF-8 | 1,295 | 3.296875 | 3 | [] | no_license | import pandas as pd
import numpy as np
df = pd.DataFrame({
"id":np.random.randint(1001, 1020, 20),
"age":np.random.randint(25, 55, 20),
"salary":np.random.randint(3000, 20000, 20)
})
df1 = pd.DataFrame({
"id":np.random.randint(1001, 1006, 10),
"sales":np.random.randint(5000, 20000, 10),
... | true |
d98fa2bf85c33cc1932e513cc7e8b7353cd96dc1 | Python | soldierloko/PIM_IV | /Main.py | UTF-8 | 1,350 | 2.84375 | 3 | [] | no_license | #Importa as Bibliotecas necessárias
import Funcoes as fc
from time import sleep
from Classes import Aluno_Professor
import os
#Faça Até que eu mande Sair do Sistema
while True:
#Apaga a tela
os.system('cls') or None
#Chama o Menu Principal
fc.exibir_menu()
#Aguarda o user entrar com uma opção
o... | true |
8e44e0bc00e216b34cc8326637779ccf3f702ba7 | Python | 1284753334/learning2 | /datastract/Myproject/插入排序.py | UTF-8 | 2,299 | 3.34375 | 3 | [] | no_license | # 插入排序
# 复杂度 0(n)2次方
# def insert_sort(li):
# for i in range(1,len(li)):
# tmp = li[i]
# j = i-1
# # while j>=0 and li[j] > tmp:
# # li[j+1] = li[j]
# # j -= 1
# # li[j+1] = tmp
# # li=[1,3,4,5,2,7,9,8]
# # insert_sort(li)
# # print(li)
#
#
#
# def insert_sor... | true |
39f52d3270af03eb6207f7154d1fc994557f0f7f | Python | otsuka-pocari/nlp100 | /ch02/16.py | UTF-8 | 419 | 2.890625 | 3 | [] | no_license | f = open("popular-names.txt", "r")
lines = f.readlines()
N = int(input("N => "))
g = [open("16-python-%2d.txt" % i, "w") for i in range(N)]
number_of_lines_per_a_file = len(lines) // N
index = 0
for i in range(N):
for j in range(number_of_lines_per_a_file):
g[i].write(lines[index])
index += 1
while index <... | true |
8c8a26abc92254f83d013d990b82c6a693db07d1 | Python | open-mmlab/mmdeploy | /mmdeploy/backend/tvm/quantize.py | UTF-8 | 2,182 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Any, Dict, Sequence, Union
import numpy as np
import tvm
from tvm.runtime.ndarray import array
class HDF5Dataset:
"""HDF5 dataset.
Args:
calib_file (str | h5py.File): Input calibration file.
input_shapes (Dict[str, Sequence[... | true |
5463b71a389d1edeef1085c6599f3ca481e9d500 | Python | xydinesh/jamming | /cf/16/C.py | UTF-8 | 180 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
import sys
import fractions
(a,b,x,y) = map(int, sys.stdin.next().strip().split (" "))
p = fractions.gcd(x, y);
x /= p
y /= p
q = min([a/x, b/y])
print q*x, q*y
| true |
93a8646d50d937b1e9623c8bab32f02fe92b3972 | Python | append-knowledge/pythondjango | /1/collection/set/operations.py | UTF-8 | 327 | 3.71875 | 4 | [] | no_license | s1={1,2,3,4,88,5,9,7}
s2={1,2,3,85,95,65,}
print("s1 is ",s1)
print("s2 is ",s2)
#union ie total
print("union is ",s1.union(s2))
#intersection ie common
print("intersection of set is ",s1.intersection(s2))
#difference
print("difference of s1 in s2 is ",s1.difference(s2))
print("difference of s2 in s1 is ",s2.differen... | true |
c76455c3940e3ab840f9b283e9fb6eea3da1e8fd | Python | 3deep0019/python | /List Data structure/important fuction of list/2_Manipulating_Element_of_list/2_insert().py | UTF-8 | 787 | 4.4375 | 4 | [] | no_license | # 2) insert() Function:
# ----> To insert item at specified index position
n=[1,2,3,4,5]
n.insert(1,888)
print(n)
#D:\Python_classes>py test.py
n=[1, 888, 2, 3, 4, 5]
n=[1,2,3,4,5]
n.insert(10,777)
n.insert(-10,)
print(n)
''' Note: If the specified index is greater than max index then element ... | true |
5ea88b24d135f322cfd153ca40ec36030fdea55a | Python | BolajiOlajide/python_learning | /beginner/iterator.py | UTF-8 | 1,541 | 4.21875 | 4 | [] | no_license | iterable = ['Spring', 'Summer', 'Autumn', 'Winter']
iterator = iter(iterable)
try:
print(next(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator))
except StopIteration:
print('Items finished in the iterable!')
def gen123():
yield 1
yield ... | true |
a1d35d4c3110c34487eb6c050d947119a3d61247 | Python | buchanae/split-and-convert | /run.py | UTF-8 | 1,979 | 2.6875 | 3 | [] | no_license | from __future__ import print_function
import argparse
import itertools
import gzip
import logging
import multiprocessing
import os
import subprocess
import time
log = multiprocessing.log_to_stderr()
log.setLevel(logging.INFO)
parser = argparse.ArgumentParser()
parser.add_argument('fastq', nargs='+')
parser.add_arg... | true |
fc47c2777b28cf13add17157530c641d4068fd53 | Python | wildan12-alwi/tugas-5 | /tugas5.py | UTF-8 | 4,082 | 3.59375 | 4 | [] | no_license | print("Program Input Data mahasiswa")
print("____________________________")
print("=== Data Nilai Mahasiswa ===")
print("============================")
data = {}
def input_data():
nama = input("Nama: ")
nim = input("NIM: ")
tugas = int(input ("Nilai Tugas : "))
uas = int(input("Nilai UAS : "))
uts... | true |
0e394e8e7092fdd400edfb76338617d1c9385c04 | Python | Autumn-Chrysanthemum/Coursera | /Chapter_9/Chapter_9_p5.py | UTF-8 | 481 | 3.046875 | 3 | [] | no_license | fname = raw_input("Please enter file name: \n")
if len(fname) < 1: fname = "romeo.txt"
try:
fhandle = open(fname)
except:
print "File:", fname,"does not exist"
quit()
text = fhandle.read()
text = text.rstrip()
text = text.split()
text_dict = dict()
test_value = 0
for word in text:
text_dict[word] = ... | true |
aedf30a306419bd9bf40b7c16696eb423fb1052c | Python | sammyjmoseley/CS6820Project | /graphs.py | UTF-8 | 2,273 | 2.71875 | 3 | [] | no_license | import numpy as np
import networkx as nx
from networkx.algorithms.bipartite import generators
from treeApproximation import TreeApproximator, ComTreeNode, create_tree_from_laminar_family
import matplotlib.pyplot as plt
import sys
def random_graph(n):
m = np.random.rand(n,n) > 0.5
return nx.from_numpy_matrix(m... | true |
1f869d44da588bd462da61ad05da1b8e28152a09 | Python | rsamit26/InterviewBit | /Python/DynamicProgramming/GreedyOrDP/Tushar's Birthday Bomb.py | UTF-8 | 2,152 | 4.375 | 4 | [
"MIT"
] | permissive | """
It’s Tushar’s birthday today and he has N friends. Friends are numbered
[0, 1, 2, …., N-1] and i-th friend have a positive strength S(i). Today
being his birthday, his friends have planned to give him birthday bombs
(kicks :P). Tushar’s friends know Tushar’s pain bearing limit and would
hit accordingly.
If Tushar’s... | true |
9a883d31c2deb75470158c01119613d3ace5d7c7 | Python | hyun-minLee/20200209 | /st01.Python기초/py08반복문/py08_32_무한구구단.py | UTF-8 | 630 | 4.03125 | 4 | [] | no_license | while True:
try :
x = int(input("숫자를 입력하시오"))
y = int(input("숫자를 입력하시오"))
except ValueError:
print("정수를 입력하시오")
break
if x <0 or y <0:
print("양수값을 입력하시오.")
break
if x > y:
temp = x
x = y
y = temp
for x... | true |
6713051862d9894b03d7486233ac834df2000ee6 | Python | alaypatel07/cd | /left_factoring.py | UTF-8 | 2,903 | 3.296875 | 3 | [] | no_license | # A->aiB/ae
# B->c
# exit
# Answer
# A->aA'/aA'
# A'->iB/e
# B->c
from itertools import groupby
from functools import reduce
def get_key(element):
if len(element) >= 1:
return element[0]
else:
return ""
def left_factor(non_terminal, production):
grouped_data = groupby(production, get_k... | true |
4c00900f4ca98a1def2eaecb5183f95f45045c78 | Python | boulund/proteotyping-in-silico | /mutate_fasta.py | UTF-8 | 4,999 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python2.7
# Fredrik Boulund 2015
# Sample sequences from a FASTA file
from read_fasta import read_fasta
from sys import argv, exit, maxint
import argparse
from random import sample, choice as pychoice
from numpy.random import binomial, choice
def parse_args(argv):
"""Parse commandline arguments.
... | true |
529bc35fe78ca32f5567841c5917bdd7f7331a30 | Python | iCodeIN/Problem-Solving | /PYTHON/Newstart/Basic/Exception_Handling/exception.3.py | UTF-8 | 277 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python
import os
class Networkerror(RuntimeError):
def __init__(self, arg):
self.args = arg
###So once you defined above class, you can raise the exception as follows###
try:
raise Networkerror("Bad hostname")
except Networkerror,e:
print e.args
| true |
503f9d20f1dd6e2289f6a5c317cf187591db1911 | Python | varesa/mustikkaBot | /src/eventmanager.py | UTF-8 | 3,414 | 2.9375 | 3 | [] | no_license | import re
import logging
class EventManager:
log = logging.getLogger("mustikkabot.eventmanager")
message_registered = []
special_registered = []
def __init__(self):
self.message_registered = list()
self.special_registered = list()
def register_message(self, module):
"""... | true |
dffcc6610d3c252485748cd92ac1617e77768973 | Python | Arkhean/pyfit-ultime | /tests/test_kmeans.py | UTF-8 | 881 | 2.78125 | 3 | [] | no_license | from pyfit.kmeans import KMeans
from sklearn.cluster import KMeans as sk_KMeans
from sklearn.datasets import make_blobs
from sklearn.metrics import accuracy_score
import numpy as np
def test_kmeans():
X, y_true = make_blobs(n_samples=300, centers=4, cluster_std=0.60, random_state=0)
my_kmeans = KMeans(n_clust... | true |
37fb5c521201160a6f69449a8a74609490ecf949 | Python | jetaehyun/CS-4342-Final-Project | /SVM.py | UTF-8 | 540 | 2.734375 | 3 | [] | no_license | import pandas
import sklearn.svm
if __name__ == "__main__":
d_train = pandas.read_csv("train.csv")
y_train = d_train.label.to_numpy()
X_train = d_train.values[:,1:]
d_test = pandas.read_csv("test.csv")
ID = d_test.id.to_numpy()
X_test = d_test.values[:,1:]
svm = sklearn.svm.SVC(kernel='rb... | true |
379fceb396e24ee82d214918516aaa3abff86f03 | Python | PancakeAssassin/Portfolio | /Python/CountFiles.py | UTF-8 | 479 | 4 | 4 | [] | no_license | #finds and counts all files in a specified directory
import os
def getNumFiles(path):
size= 0
if not os.path.isfile(path):
lst= os.listdir(path)
for sub in lst:
size+= getNumFiles(path + "\\" + sub)
else:
size+= 1
return size
if __name__ == '__main__':
path= i... | true |
7bfb47584ff9383cc80a06ea2b81c7df0ddb7e0b | Python | msainTesting/TwitterAnalysis | /StreamingDataAnalysis/data/cleanData.py | UTF-8 | 283 | 2.625 | 3 | [] | no_license | import re
import emoji
#Making use of functiosn to clean Data
def removeURLS(data):
text = re.sub(r'https?:\/\/\S*', '', str(data), flags=re.MULTILINE)
return text
def removeEmojis(data):
text = emoji.get_emoji_regexp().sub("", data)
return text
| true |
de0fcd18eaa226c3dc4a3d48c80e30b5fa2d1a31 | Python | volpatto/PVGeo | /PVGeo/model_build/grids.py | UTF-8 | 12,163 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | __all__ = [
'CreateEvenRectilinearGrid',
'CreateUniformGrid',
'CreateTensorMesh',
]
__displayname__ = 'Grids'
import vtk
import numpy as np
from vtk.numpy_interface import dataset_adapter as dsa
# Import Helpers:
from ..base import AlgorithmBase
from .. import _helpers
from .. import interface
def _make... | true |
dcf8b39509ac660ae4af5d9cecdc084796db19b5 | Python | jlgerber/swinstall_stack_python | /swinstall_stack/schemas/base/file_metadata.py | UTF-8 | 1,409 | 2.8125 | 3 | [] | no_license | """
file_metadata.py
FileMetadata base class
"""
__all__ = ("FileMetadataBase",)
class FileMetadataBase(object):
"""Base class for FileMetadata, defining required
methods and properties which need to be implemented.
"""
def element(self):
"""construct an element from self
:returns: xm... | true |
377dabd3c3056acd9e2a893c44fd0f2154991b21 | Python | a-doom/address-converter | /address_converter/address_objects.py | UTF-8 | 1,453 | 3.140625 | 3 | [
"MIT"
] | permissive | LETTER = "литера"
class AddrObject(object):
def __init__(self, aoguid, name, type_obj, postalcode):
self.aoguid = aoguid
self.name = name
self.type_obj = type_obj
self.postalcode = postalcode
def __str__(self):
return "{0} - {1}".format(self.aoguid, self.name)
def... | true |
29e1c012b8e5d794a452711bd6d1204c3ccd8b18 | Python | HalShaw/Leetcode | /Single Number.py | UTF-8 | 418 | 2.6875 | 3 | [
"MIT"
] | permissive | class Solution(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
a=nums[0]
for i in range(1,len(nums)):
a^=nums[i]#所有元素异或,相同的异或后为0,0与任何数异或都为它本身
return a
'''不使用异或,使用set
s1 = set(nums)
a2 = sum(s1)*2... | true |
64f6b45c4dbec2a22728685061bfbbd26fd592a7 | Python | mohitleo9/interviewPractice | /Linked_Lists/LinkedLists.py | UTF-8 | 1,849 | 3.734375 | 4 | [] | no_license | class Node:
def __init__(self, data=0, next=None):
self.data = data
self.next = next
def __str__(self):
return str(self.data)
class LinkedList:
def __init__(self):
self.head = None
def insert_last(self, node):
if not node:
return
if not sel... | true |
c3180bbcdc0da1d7b6284883252e4d76ea90099a | Python | firesnow1234/histogram | /histogram0517.py | UTF-8 | 27,146 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri May 17 09:52:39 2019
@author: Yuki
"""
import numpy as np
import cv2
import time
import copy
from math import isnan, isinf
from PIL import Image
import matplotlib.pyplot as plt
from myRansac import *
import math
import scipy.io as io
from scipy.io import loadm... | true |
eed8e39f146e59f05fbcc8f15b242c3636ce6a1a | Python | AathmanT/netty-performace-tuning | /netty_opy_custom.py | UTF-8 | 5,060 | 2.53125 | 3 | [] | no_license | import sklearn.gaussian_process as gp
import numpy as np
import random
from scipy.stats import norm
from skopt.acquisition import gaussian_ei
import time
import requests
import sys
import csv
from hyperopt import hp
from hyperopt import tpe
from hyperopt import Trials
from hyperopt import fmin
def dummy_model(x):
... | true |
1394fb98c45531da8962eb1dd578a66150db31ec | Python | Alexamith23/conversor | /app/Http/Controllers/verifyParser.py | UTF-8 | 441 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import json
import sys
# sanitize the argument
def main(argv = sys.argv[1:]):
var = ""
it = 1
for i in argv:
var += i
if(it != len(argv)):
var += " "
it += 1
pass
return var
arguments = main()
#args = json.dumps(arguments) # doubtful ... | true |
c32b5d5208d36581c8ca1f5685dd7e29f996ae99 | Python | ziamajr/CS5590PythonLabAssignment | /InClass 6/ICE6.py | UTF-8 | 452 | 3.4375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
x = np.array([0,1,2,3,4,5,6,7,8,9])
y = np.array([1,3,2,5,7,8,8,9,10,12])
np.mean(x)
np.mean(y)
x1=np.mean(x)
y1=np.mean(y)
print (x1)
print (y1)
np.sum((x-x1)*(y-y1))
s1=np.sum((x-x1)*(y-y1))
np.sum((x-y1)*(x-y1))
s2=np.sum((x-y1)*(x-y1))
pri... | true |
c669e840ccf120cb2cea4d31a5efdd4500b955ee | Python | Wjun0/python- | /day07/12-文件的拷贝-扩展大文件的拷贝.py | UTF-8 | 1,385 | 3.734375 | 4 | [] | no_license | # 原文件的名字
src_file_name = "test.txt"
# 根据原文件名字生成拷贝后的文件名: test[复件].txt
# 1. 切片
# 2. split
# 3. partition 使用这种方式
file_name, point_str, end_str = src_file_name.partition(".")
dst_file_name = file_name + "[复件]" + point_str + end_str
print(dst_file_name)
# 1. 打开目标文件(拷贝后的文件),目的就是创建一个空的文件
# 指定wb模式可以兼容文本文件和其他类型的文件(图片,视频,音频等等)... | true |
5e14670fc1e565eb901566daa1c1cfae29ad45f7 | Python | Sidd-UCD/UCDPA_Siddhesh | /Data Set 1.py | UTF-8 | 3,189 | 3.453125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df_1 = pd.read_csv('/Users/siddheshkotian/Documents/Certification Data Analytics/Project Rubric/Data_Set A.csv')
print(df_1)
# Exploring Dataframe(df_1)
print(df_1.head())
print(df_1.info())
print(df_1.shape)
print(df_1.values)
print(df_1.... | true |
19ea3a1913b3cf6753abe614f20ff3db5d13ccba | Python | Kawser-nerd/CLCDSA | /Source Codes/CodeJamData/16/12/9.py | UTF-8 | 679 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# $File: solve.py
# $Date: Sat Apr 16 09:23:24 2016 +0800
# $Author: jiakai <jia.kai66@gmail.com>
import collections
def solve(rows):
cnt = collections.Counter()
for i in rows:
cnt.update(i)
rst = []
for k, v in cnt.items():
if v % 2:
... | true |
b332dbf7a6ab5c820ee23b0a63829f07cb61a6bc | Python | kennycaiguo/Heima-Python-2018 | /15期/21 数据分析/10-数据的合并和分组聚合/test2.py | UTF-8 | 374 | 2.734375 | 3 | [] | no_license | # coding:utf-8
# File Name: test2
# Description :
# Author : huxiaoyi
# Date: 2019-05-14
import pandas as pd
from matplotlib import pyplot as plt
file_path = "./directory.csv"
df = pd.read_csv(file_path)
# 使用matplotlib 呈现出店铺总数排名前10的国家
data = df.groupby(by="Country").count()['Brand'].sort_values(asc... | true |
993a9d1f59a701a3918873c009b6f26d0f9bbb8b | Python | JohnnySunkel/BlueSky | /Keras/keras_Inception.py | UTF-8 | 1,150 | 3.171875 | 3 | [] | no_license | from keras import layers
# This example assumes the existence of a 4D input tensor 'x'
# Every branch has the same stride value (2),
# which is necessary to keep all branch outputs
# the same size so you can concatenate them.
branch_a = layers.Conv2D(128, 1,
activation = 'relu',
... | true |
356740d9c6b3511e6d3598a5f49059d3d174f9dc | Python | dicomgrid/sdk-python | /tests/api/test_rate_limits.py | UTF-8 | 1,090 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | """Test rate limits."""
from ambra_sdk.api.base_api import RateLimit, RateLimits
class TestRateLimits:
"""Test rate limits."""
def test_default_call_period(self):
"""Test default call period."""
rls = RateLimits(
default=RateLimit(3, 2),
get_limit=None,
sp... | true |
5a33c59e56f7fd0fc76ac4674c842dd053a056fb | Python | chipx86/djblets | /djblets/webapi/auth/backends/__init__.py | UTF-8 | 3,208 | 2.828125 | 3 | [] | no_license | """Base support for managing API authentication backends.
These functions allow for fetching the list of available API authentication
backend classes, and using them to perform an authentication based on an HTTP
request.
"""
from __future__ import annotations
from importlib import import_module
from typing import Li... | true |
51da5610104c1838d925ab013ca74fdfc5a901fa | Python | glentner/CmdKit | /cmdkit/service/service.py | UTF-8 | 1,628 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # SPDX-FileCopyrightText: 2021 CmdKit Developers
# SPDX-License-Identifier: Apache-2.0
"""Service class implementation."""
# internal libs
from .daemon import Daemon
class Service(Daemon):
"""
A Service can be run directly and _optionally_ daemonized.
Like `cmdkit.service.daemon.Daemon`, a `run` method... | true |
236129c8b2969b16ffccd5cee1f5eb482de0ff07 | Python | lattaro/manipulacao-dados-estudo-pandas | /Manipulação_dados_Pandas.py | UTF-8 | 1,239 | 3.875 | 4 | [] | no_license | import pandas as pd
notas = pd.Series ([2,7,5,10,6], index=["Alex", "João", "Pedro", "Zé", "Abel"])
print (notas)
print ("A nota do Alex é:",notas["Alex"]) #é possível trazer uma nota referenciada pelo seu index, no caso "Alex"
print("Média:", notas.mean()) #notas.mean calcula a média aritmética para o veto... | true |
9043a1522e5f37f1fb1e1c98b80acfa45fc4fe87 | Python | DiyaWadhwani/SL-Lab | /partA/pythonProgs/(4)Age.py | UTF-8 | 252 | 3.484375 | 3 | [] | no_license | from datetime import date,datetime
def ageConvert(d,m,y):
dob=date(y,m,d)
today=date.today()
return today-dob
d=int(input("Enter day: "))
m=int(input("Enter month: "))
y=int(input("Enter year: "))
print("Age: ",ageConvert(d,m,y).days//365)
| true |
b46fbb32ecd5ddf41fdfc086d383b6463d3412e1 | Python | anelshaer/Python100DaysOfCode | /day-33-API-quotes-and-space-station/iss-location/main.py | UTF-8 | 2,231 | 2.734375 | 3 | [
"MIT"
] | permissive | from types import DynamicClassAttribute
import requests
from datetime import datetime
import time
import smtplib
import sys
LATITUDE = 52.520008
LONGITUDE = 13.404954
MARGIN = 5
SENDER_MAIL = "test@gmail.com"
PASSWORD = "TESTP@SSWORD"
TO_MAIL = "test2@gmail.com"
def is_iss_above():
response = requests.get(url="... | true |
7d4c1a54836b31bde26e9164f7204a6240d32f45 | Python | dakotajunkman/Janggi | /main.py | UTF-8 | 705 | 3.71875 | 4 | [] | no_license | from JanggiGame import JanggiGame
def play_game():
"""
Creates a game loop to play the game.
"""
game = JanggiGame()
game.get_board().update_visual_board()
game.get_board().display_board()
while game.get_game_state() == 'UNFINISHED':
print(game.get_player_turn(), 'turn')
mo... | true |
92060d47d178515db3c40c69143ff51ae7eb3537 | Python | dreadatour/pdigest | /pdigest.py | UTF-8 | 10,118 | 2.515625 | 3 | [] | no_license | # coding: utf-8
import datetime
import re
import time
import requests
from flask import Flask, render_template, request
app = Flask(__name__)
app.config.from_object('config')
url_re = re.compile(
r'(\bhttps?:\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|])',
re.UNICODE | re.I
)
youtube_re = re.compile(... | true |
aa9185098d6d57154124951e3d6493f3482006c7 | Python | JoshuaShin/A01056181_1510_assignments | /A4/test_delete_student.py | UTF-8 | 688 | 2.65625 | 3 | [] | no_license | import io
from unittest.mock import patch
from unittest import TestCase
import crud
class TestDeleteStudent(TestCase):
@patch('builtins.input', side_effect=["test", "test", "t12345678", "True", "", "t12345678"])
def test_delete_student(self, mock_input):
crud.file_write([])
crud.add_student()
... | true |
0fbbbc4dba693c1c73b0c8d10571fc157c816a80 | Python | jy02sung/PythonPractice | /공튕기기.py | UTF-8 | 1,436 | 3.625 | 4 | [] | no_license | from tkinter import *
import time
import random
class Ball:
def __init__(self,canvas,color,size,x,y,xspeed,yspeed):
self.canvas=canvas
self.color=color
self.size=size
self.x=x
self.y=y
self.xspeed=xspeed
self.yspeed=yspeed
self.id=canvas.create_oval(x... | true |
cd6fa581d0f10713c07c085c9dbc37f086054354 | Python | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/abc005/B/4901671.py | UTF-8 | 71 | 3.03125 | 3 | [] | no_license | n=int(input())
t=[int(input()) for i in range(n)]
print(sorted(t)[0]) | true |
9e00bcda142983cda565b9de438576cdccb34f3f | Python | zahra-alizadeh/Naive-Bayes | /project.py | UTF-8 | 3,561 | 3 | 3 | [] | no_license | import csv
import requests
from bs4 import BeautifulSoup
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import accuracy_score
from nltk.tokenize impo... | true |
fbe46246ba0440b6c063b0970d6bbe01c9cc45f6 | Python | psranga/jpp | /jpp | UTF-8 | 929 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
# supports #include
#
# reads from stdin and writes to stdout
import sys, re
def copy_file(fn, ofh):
try:
fh = open(fn, 'r')
except IOError:
ofh.write('// Error opening: ' + fn)
sys.stderr.write('Error opening: ' + fn + '\n')
for line in fh:
ofh.write(line)
if not line.endsw... | true |
3cc2ba21f3c0d83b00cba18ec8886ccfe2b98da1 | Python | jpn--/popgen | /popgen/config.py | UTF-8 | 2,139 | 3.4375 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import print_function
import yaml
class ConfigError(Exception):
pass
def wrap_config_value(value):
"""The method is used to wrap YAML elements as Config objects. So the
YAML properties can be accessed using attribute access.
E.g. If config object - x for is specificed as the followin... | true |
e1ef3b2f23651d7ed731c5092d5d100c555e25d8 | Python | kolibril13/tricks_for_python | /style_dynamic_typing_with_typehints.py | UTF-8 | 514 | 3.515625 | 4 | [] | no_license | from typing import Callable,List,Dict, Any
def factorial(i:int) -> int:
if i < 0:
return None
if i==0:
return 1
if i >0:
return i*factorial(i-1)
def map_my_list(func:Callable,l:List[int])-> List[int]:
l2= [func(i) for i in l]
return l2
def map_my_dict(func:Callable,dic:Dict... | true |
65807d196e00b57f937569027a2a0f6a300ef5a4 | Python | changjinhan/Algorithm-study | /ch7/array_partition_1.py | UTF-8 | 515 | 3.15625 | 3 | [] | no_license | import collections
import heapq
import functools
import itertools
import re
import sys
import math
import bisect
from typing import *
def arrayPairSum(nums: List[int]) -> int:
return sum(sorted(nums)[::2]) # 한 줄로 pythonic 하게 풀이
if __name__ == "__main__":
with open("../input/array_partition_1.txt", "r") as f:
... | true |
cce8a8014fba44ed330dbe542cf593f155936ebf | Python | OCHA-DAP/hdx-python-country | /src/hdx/location/currency.py | UTF-8 | 17,159 | 2.578125 | 3 | [
"MIT"
] | permissive | """Currency conversion"""
import logging
from datetime import datetime, timezone
from typing import Dict, Optional, Union
from hdx.utilities.dateparse import (
get_timestamp_from_datetime,
now_utc,
parse_date,
)
from hdx.utilities.dictandlist import dict_of_dicts_add
from hdx.utilities.downloader import Do... | true |
781f394770d1945c00cde95c301ec1b58922b8b8 | Python | K4CZP3R/minecraft-server-status | /common_modules/status_repo.py | UTF-8 | 1,804 | 2.796875 | 3 | [] | no_license | import pymongo
class StatusRepo:
def __init__(self, url):
self.url = url
self.client = None
self.collection = None
self.database = None
def connect(self):
self.client = pymongo.MongoClient(
self.url
)
self.database = self.client["xyz_k4czp3r... | true |
505e1444f7bff8eb4f7d4b69319e1b0ffc7edb90 | Python | milim328/python-study | /모두의 파이썬 프로젝트2.py | UTF-8 | 1,471 | 3.765625 | 4 | [] | no_license | #타자게임
#게임이 시작되면 동물 이름으로 된 영어 단어가 화면에 표시됩니다.----리스트사용/랜덤함
#사용자는 그 단어를 최대한 빠르고 정확하게 입력해야 합니다. 바르게 입력했으면 다음 문제로 넘어가고,
#오타가 있으면 같은 단어가 한 번 더 나옵니다.
#틀린 문제를 다시 입력하는 동안에도 시간은 계속 흐르기 때문에 속도뿐만 아니라
#정확도도 중요한 게임입니다.
#사전준비 - 게임에 필요한 모듈을 임포트
#메인프로그램 :타자게임을 처리하는 부분 -- 사용자에게 문제 보여주고 타자 입력을
#받아 반복 -- 오타가 나면 계속해야하므로 while 사용
#결과 계산해... | true |
0f92f873c0c913afb6dccf36fce2be2780a4bfd9 | Python | qoire/INCDS | /dev/GUI/GUI/main.py | UTF-8 | 2,883 | 2.5625 | 3 | [] | no_license | import sys
import mainwindow #our mainwindow containing definitions for GUI
import multiprocessing
import retrieverthread
import numpy as np
from PyQt4 import QtCore, QtGui, uic
form_class = uic.loadUiType("mainwindow.ui")[0]
class MainWindowClass(QtGui.QMainWindow, form_class):
def __init__(self, parent=None):
... | true |
c6c245a15c54f6bc04060af013c4d77464cda4d8 | Python | suchetsapre/CodeBlocks | /main.py | UTF-8 | 738 | 3.59375 | 4 | [] | no_license | #example of how one conditional structure would work
import conditionstruc as cs
import whilestruc as ws
import conditionblock as cb
arg = 0
action1 = 'print(\'action1\')'
action2 = 'print(\'action2\')'
action3 = 'print(\'action3\')\narg+=1'
block1 = cb.ConditionBlock("IF", action1)
block2 = cb.ConditionBlock("ELSE", a... | true |
b548a26e6d7d490c146a96f10b9683c189d5d4ff | Python | chzp471025707/001 | /001/03_02.py | UTF-8 | 2,691 | 3.390625 | 3 | [] | no_license | import tensorflow as tf
#通过numpy工具包生成模拟数据集
from numpy.random import RandomState
# 1. 定义神经网络的参数,输入和输出节点
#训练数据batch的大小(一次训练模型,投入的样例数,本该一次性投入所有样例,为了防止内存泄漏设定batch)
batch_size = 16
#产生随机变量,2行3列,方差为1,种子为1
w1= tf.Variable(tf.random_normal([2, 3], stddev=1, seed=1))
w2= tf.Variable(tf.random_normal([3, 1], stddev=1, seed=1))
... | true |
1ddec391482d0a3f668c90c86b8f9958baa620e0 | Python | frankbryce/First | /Cryptology/Cyphers/Cyphers/Shared/StrUtil.py | UTF-8 | 583 | 2.828125 | 3 | [] | no_license | import re
import LtrUtil as lu
from collections import OrderedDict as od
puncRegEx = re.compile("[,. ]+")
def StripStr(str):
return puncRegEx.sub("",str.upper())
def GenerateKeyedAlphabet(key,alph):
return list(od.fromkeys(key+alph))
def ReformatStr(str,format):
i=0
outstr = '';
for c in format:
... | true |
4505920b5a2fde5965707523914877c857b8bc52 | Python | kameltigh/deep-cluster-tf | /deep_cluster/clustering/kmeans.py | UTF-8 | 3,024 | 3.046875 | 3 | [
"MIT"
] | permissive | import logging
import tensorflow as tf
class Kmeans:
EPSILON = 1e-07
def __init__(self, k):
self.centroids = None
self.k = k
@staticmethod
def __get_clusters(data, centroids):
clusters = []
for sample in data:
distances = tf.norm(tf.expand_dims(sample, ax... | true |
d437132e1e39cd56f96626996a23b371748efc40 | Python | GaganDureja/Algorithm-practice | /Stuttering Function.py | UTF-8 | 170 | 3.09375 | 3 | [] | no_license | #Link: https://edabit.com/challenge/gt9LLufDCMHKMioh2
def stutter(word):
repeat = word[:2] + '... '
return repeat*2 + word + '?'
print(stutter('incredible')) | true |
7c707be75006dda0ec66b69f00d0ae98c6dcc318 | Python | rizkyyz/pertemuan7 | /labpy03/latihan2.py | UTF-8 | 307 | 3.375 | 3 | [] | no_license | #Muhammd Rizky Abdillah
#no ambil source code
print("---Latihan 2----")
print("menampilkan bilangan berhenti ketika bilangan 0 dan menampilkan bilangan terbesar")
max=0
while True:
a=int(input("masukan bilangan : "))
if max < a :
max = a
if a==0:
break
print("bilangan terbesar adalah = ",ma... | true |
3d13974c91607a3d4e2954a89255919dd96b6760 | Python | yuryanliang/Python-Leetcoode | /2019/0607/169_majority_element.py | UTF-8 | 132 | 2.921875 | 3 | [] | no_license | def majority_element(nums):
nums_set=set(nums)
for i in nums_set:
if nums.count(i)>len(nums)/2:
return i | true |
d35f692449403d2fe2e13b0dfc37be1eb1e5088e | Python | koralmxxx/python | /toplam2.py | UTF-8 | 163 | 3.421875 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: UTF-8 -*-
sayi1 = input("Birinci sayiyi girin: ")
sayi2 = input("İkinci sayiyi girin: ")
toplam = sayi1 + sayi2
print toplam
| true |
5021143582d7926e731a2877b16b3f635f4eff15 | Python | AV272/Programming | /Machine learning/Other/rashid_4.py | UTF-8 | 5,309 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 4 12:37:29 2021
@author: lkst
"""
import numpy as np
import scipy.special as sp
import matplotlib.pyplot as plt
import imageio
import glob # helps work with filepath
# definition of neural network class
class neuralNetwork:
# initializa... | true |
fa2bed788ec74722d634e5130b470b9c707d2093 | Python | jrmsdev/pysadm | /tlib/_sadmtest/mock/utils/path.py | UTF-8 | 3,098 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright (c) Jeremías Casteglione <jrmsdev@gmail.com>
# See LICENSE file.
import os.path
from collections import deque
from unittest.mock import Mock
class MockPath(object):
_mock = None
_expect = None
_return = None
_default = None
sep = '/'
def __init__(self, cfg):
self._expect = []
self._return = {}... | true |
7be3ca47e7c11df97a406aaaf18ce86f48577647 | Python | astrotutor9/Neopixels-Microbit-and-Python | /chase_functions.py | UTF-8 | 571 | 3.359375 | 3 | [] | no_license | from microbit import *
import neopixel
ring = neopixel.NeoPixel(pin0, 16)
# set some variables for colours
red = (75, 0, 0)
green = (0, 75, 0)
blue = (0, 0, 75)
off = (0, 0, 0)
# define (def) a function and give it a clear, simple name.
# Here the colours are sent from the call at the bottom
# and renamed as use_thi... | true |
3a7c407594a7576a28330b834881ea2d96885b3f | Python | publiccoding/prog_ln | /my_practice/logical_iq/project/multiprocessingexample.py | UTF-8 | 1,544 | 2.96875 | 3 | [] | no_license | from multiprocessing import Pool, Process,Pipe, queues
from random import random
from math import pi, sqrt
import time
import os
def compute_pi(n):
i, index = 0, 0
while i < n:
#time.sleep(0.001)
x = random()
y = random()
if sqrt(x*x + y*y) <= 1:
inde... | true |
06f07e087afd2ca486892e44b392054de657bc14 | Python | PlatformOfTrust/standards | /tools/ontology-validator/validators/file_content/objects_defined.py | UTF-8 | 2,140 | 3.25 | 3 | [] | no_license | """This module has a class that validates that every class and property from
the file is defined in the ontology file.
"""
from utils.constants import _ID
from utils.ontology import Ontology
from utils.validation import is_class, is_property
from validators.file_content.file_content import FileContentValidator
def v... | true |
528eb1a0e011ac79d2625adb782bff6b90189244 | Python | pradhanmanva/PracticalList | /pr12.py | UTF-8 | 233 | 3.796875 | 4 | [] | no_license | # wap to find the largest number of the three numbers
a = 103
b = 121
c = 93
if (a > b and a > c):
print("%s is greatest" % (a))
elif (b > a and b > c):
print("%s is greatest" % (b))
else:
print("%s is greatest" % (c))
| true |
25994ac190ee30ca08ff4444809f983a58d54e90 | Python | chopley/opticalPointing | /extractPositions/starPosition.py | UTF-8 | 6,132 | 2.796875 | 3 | [] | no_license | #Script that will do the following:
#1) Read in positions of stars from images in pixels
#2) Use a catalog to calculate the expected positions of the stars
#3) Calculate the az,el position of the centre of the image
#Written by Charles Copley,AVN Science
#Rev 1.0 06/08/2015
import pandas,numpy,ephem,sys,cv2,datet... | true |
45d853c2decbc71918d56725260fad871ed4420e | Python | giselemanuel/programming-challenges | /100DaysOfDays/Dia02/ex08.py | UTF-8 | 368 | 4.65625 | 5 | [
"MIT"
] | permissive | """
Exercício Python 8:
Escreva um programa que leia um valor em metros e o exiba convertido em centímetros e milímetros.
"""
print("-" * 40)
print(f'{"Converte metros em centimetros":^40}')
print("-" * 40)
metro = float(input("Digite o valor em metros: "))
centimetros = metro * 100
print(f"{metro:.0f} metr(s) é equi... | true |
ea999e54c2fd148db4840e990b1ea723ec25f895 | Python | wangyifeibeijing/newtype_sbm | /data_system/mnist/read_mnist.py | UTF-8 | 1,540 | 2.796875 | 3 | [] | no_license | import os
import struct
import numpy as np
import scipy.io as scio
def load_mnist(path, kind='t10k'):
"""Load MNIST data from `path`"""
labels_path = os.path.join(path,
'%s-labels.idx1-ubyte'
% kind)
images_path = os.path.join(path,
... | true |
9f715a16adc9a47e5361c682b1827f963a8a9e07 | Python | NC-Elbow/PackagesForGeneralConsumption | /blockmatrix.py | UTF-8 | 3,983 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 26 10:26:50 2020
@author: clark
"""
import numpy as np
import pandas as pd
from math import nan
from numpy import matmul as mm
class blockmm:
def __init__(self, A, B, partition_shape = 10):
# A and B are large matrices to be multiplied... | true |
3b8ef7220abbf7013590d95123ca541d7330ca81 | Python | AlexandrSech/Z49-TMS | /students/Titov/6/task_6_4.py | UTF-8 | 275 | 3.484375 | 3 | [] | no_license | """Найти сумму всех элементов матрицы."""
import random
sum = 0
matr = []
for i in range(5):
matr.append([])
for j in range(5):
a = random.randint(1, 30)
matr[i].append(a)
sum += a
print(matr[i])
print(sum) | true |
5058b9265da455110f041cc25e2b1a1842fb34d8 | Python | ozgurfiratcelebi/UdacityWeatherTrends | /WeatherTrends.py | UTF-8 | 958 | 3.15625 | 3 | [] | no_license | """
istanbul verilerini al
Dünyanın sıcaklık değerlerini al
csv leri python ile açgrafiği dök
Şehriniz, küresel ortalamaya kıyasla ortalama olarak daha sıcak mı yoksa daha soğuk mu? Fark zaman içinde tutarlı oldu mu?
Şehrinizin sıcaklıklarındaki zaman içindeki değişimler, küresel ortalamadaki değişikliklerle karşıla... | true |
430ae27d8636101e066d402846bc92c9089a385f | Python | Cythes/My-Firsts | /m8ball.py | UTF-8 | 1,066 | 3.921875 | 4 | [] | no_license | #!/usr/bin/env python3.2
"""
m8ball.py
name:Cythes
Problem:Get the system to print a fortune based on 1-6 number generation
Target Users: Myself and those poor souls who stumble upon
Target System: GNU/LINUX
Functional Requirements:
-User enters text to be decided
-Program uses a dice roll to determine a numbe... | true |