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 |
|---|---|---|---|---|---|---|---|---|---|---|
c19c0e6f27dec7abaa514428ebf1ef921555ddd8 | Aasthaengg/IBMdataset | /Python_codes/p03214/s765049342.py | UTF-8 | 157 | 3.15625 | 3 | [] | no_license | n = int(input())
a = list(map(int,input().split()))
m = sum(a)/ n
index = 0
for i in range(1,n):
if abs(m-a[index])>abs(m-a[i]):
index = i
print(index) | true |
9b8189a47f9247c6fa8f6bb8683a189613deea3a | priyankaramachandra/python | /8.py | UTF-8 | 191 | 3.5 | 4 | [] | no_license | #creating a tuple of fruits and vegtables
fruits=['apple','grapee','banna']
vegtable=['potato','tomoto','califlower']
li =list(zip(fruits,vegtable))
for i in range(len(li)):
print(list(li))
| true |
81ace665eb5dc19d83aaf076ce86eea23af89951 | vivekg0126/SSD_Grocery | /compute_mean.py | UTF-8 | 1,407 | 2.90625 | 3 | [] | no_license | import numpy as np
from os import listdir
import os.path as osp
import cv2
import timeit
# number of channels of the dataset image, 3 for color jpg, 1 for grayscale img
# you need to change it to reflect your dataset
CHANNEL_NUM = 3
def cal_dir_stat(root):
cls_dirs = [d for d in listdir(root) ]
pixel_num = 0... | true |
772815301e43fc7c2feb804f43940b9a3a9aa3d7 | lettergram/sync-lists | /sync_lists.py | UTF-8 | 2,476 | 3.328125 | 3 | [
"MIT"
] | permissive | """
Written by Austin Walters
Date: Feb 26, 2019
This script takes in files, identifies the last edited
and syncs the terms across all of them. This could be useful
if you are keeping a blacklist across multiple web apps,
for instance: Terms, IPs, etc.
Takes in a series of lists in the form:
Term 1
Term 2
....... | true |
df778a9bb7a79a8f0ca88ebcc28b427b16154f19 | polinchen98/BLUP_ksitest | /without_numpy/inbreeding_accounted.py | UTF-8 | 2,320 | 2.84375 | 3 | [] | no_license | import math
def get_inversion_matrix_A_accounted_inbreeding(pedigree):
L = [[0 for row in range(len(pedigree) + 1)] for col in range(len(pedigree) + 1)]
D_inv = [[0 for row in range(len(pedigree) + 1)] for col in range(len(pedigree) + 1)]
A_inv = [[0 for row in range(len(pedigree) + 1)] for col in range(l... | true |
24aa4d20d42ed59af0bc636d082499681f73af27 | blainevanitem/cse210-project | /pokemon/game/bikeshop.py | UTF-8 | 679 | 2.671875 | 3 | [] | no_license | from game.point import Point
from game import constants
import arcade
class BikeShop(arcade.Sprite):
def __init__(self):
super().__init__()
self.scale = constants.BUILDING_SCALING
self.textures = []
texture = arcade.load_texture(constants.BIKESHOP)
self.textures.append(te... | true |
4b5579edcf173ff1496dd6d373cc7a8b3924381f | jyu197/comp_sci_101 | /fall15_compsci101_lab09/DataReader.py | UTF-8 | 1,381 | 3.140625 | 3 | [] | no_license | '''
Version 2 on November 1, 2015
Original: Oct 24, 2012
@author: ola
'''
import csv
def readandprocess(name):
csvf = open(name,'rb')
freader = csv.reader(csvf,delimiter=',',quotechar='"')
datad = {}
header = freader.next()
#print "header row labels",header
for row in freader:
#print... | true |
0c8b247ac97eef20cf5a73a89b4f79e4c17117bd | githubtemp5/WTW | /workingmodels/regression/simple-regression.py | UTF-8 | 2,582 | 2.921875 | 3 | [] | no_license | """
REGRESSION MODEL KERAS
NEEDS TO NORMALIZE DATA!!!
"""
from time import time
import os
import numpy
import pandas
import keras
from keras.models import Sequential
from keras import layers, optimizers
# Tell keras to use tensorflow as back-end
os.environ['KERAS_BACKEND'] = 'tensorflow'
import pandas as pd
... | true |
5d9e6bc832f933846acf73ca8a05d248ede37ac7 | AasthaSethia/Leetcode-Solutions-python | /ValidParenthese.py | UTF-8 | 782 | 3.375 | 3 | [] | no_license | class Solution:
def isValid(self, s: str) -> bool:
stack = []
for i in range(len(s)):
if (s[i]=='(' or s[i] =='{'or s[i]== '['):
stack.append(s[i])
continue;
if (len(stack)==0):
return False
if (s[i]==')'):
... | true |
50ab846ec2114c96a293d4171c749820516188b0 | JeremySilverTongue/Euler | /74.py | UTF-8 | 387 | 2.921875 | 3 | [] | no_license | from math import factorial
counter = 0
for x in range(1, 1000000 + 1):
fact = x
chain = []
while fact not in chain:
chain.append(fact)
fact = sum(map(lambda x: factorial(int(x)), str(fact)))
# print x, len(chain), chain
if len(chain) == 60:
counter += 1
print counter
# ... | true |
f646a8561882bc5229c474b8c4130388d3c8970a | morenice/learn-algorithms | /acmicpc/1874/solve.py | UTF-8 | 888 | 3.03125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
def validation(max_input_num, check_sequence):
stack = list()
stack_oper = list()
for i in range(1, max_input_num+1):
stack.append(i)
stack_oper.append('+')
while True:
if len(stack) == 0 or len(check_sequence) == 0:
break
... | true |
31db4668409eaf0ff4370e4e35a5c2227d4a1ba9 | Aasthaengg/IBMdataset | /Python_codes/p04043/s578374161.py | UTF-8 | 120 | 2.96875 | 3 | [] | no_license | data=list(map(int, input().split(" ")))
if (data.count(5)==2) and (data.count(7)==1):
print('YES')
else:
print('NO') | true |
6ba385d3a3bdb3cb5d7db31556b78ae53ff106de | ladderfilter/Musical-Scripts | /serial-1.py | UTF-8 | 2,132 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 28 12:31:11 2020
Serial-1:
Take a MIDI sequence
Perform these operations: transpose, retrograde, inversion, retro_inversion
Play serquence
"""
import numpy as n
import simpleaudio as sa
global a4, sample_rate, channels, duration
a4 = 440
sampl... | true |
abe5c64ddeaa8996788fa30ce5b163e5dcf86a0c | maximusunc/reasoner | /tests/test_cypher.py | UTF-8 | 2,509 | 2.578125 | 3 | [] | no_license | """Test Reasoner->Cypher transpiler."""
import pytest
from reasoner.cypher import get_query, get_match_clause
from initialize_db import initialize_db
def test_complex_query():
"""Test that db get's initialized successfully."""
session = initialize_db()
qgraph = {
"nodes": [
{
... | true |
26e5b5b14e84187e565b2c89f996b3e5a4fab8dc | atranson/multiple-monitors-wallpaper-manager | /setup.py | UTF-8 | 737 | 3.140625 | 3 | [] | no_license | import os
path = ""
isValidPath = False
while(not isValidPath):
print("Please enter the full path to the folder containing your wallpapers\n(e.g. \"D:/Pictures/Wallpapers/\")")
path = input("> ")
path = path.strip() # Trim white spaces
if not path:
print("\nError: you entered an empty path")
elif '\\' in pat... | true |
a994b4ba1030e8f2e0eb7fbebf60ac657b957fcc | illusi0n455/SoftGroup-test | /homework1/3.py | UTF-8 | 495 | 3.578125 | 4 | [] | no_license | def decorator(func):
def func_wrapper(x, y, **kwargs):
try:
result = func(x, y)
except Exception as err:
print('Exception occurred in func: %s' % err)
print('Input args: {0} {1}'.format(x, y))
print('Input kwargs: {0}'.format(kwargs))
... | true |
fc8beef8994674dc11b3ae1db47d8327382ac55f | hehehahaha/2019-code-craft | /code/get.py | UTF-8 | 8,148 | 2.53125 | 3 | [] | no_license | import numpy as np
def getroad(road_path):
with open(road_path,'r') as roadDataFile:
roadData = roadDataFile.read().splitlines()
length = len(roadData)
road_id = []
road_len = []
road_spe = []
road_num = []
node_id1 = []
node_id2 = []
road_flag = []
for... | true |
c3ff8559a2efa24bafbec68595b332eb09848e4e | CrypTools/HashFunctions | /SHA384/py/encrypt.py | UTF-8 | 146 | 2.78125 | 3 | [] | no_license | import hashlib
def encrypt(initial):
initial = initial.encode('utf-8')
output = hashlib.sha384(initial.encode())
return output.hexdigest()
| true |
e43c07b3cee55c3fb0f2512786b1b1e8530bae43 | kinimod23/ANLP_Final_Project | /code/tokenize_articles.py | UTF-8 | 855 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf8 -*-
from nltk.tokenize import word_tokenize
import sys
def read_corpus(input_file):
corpus = []
with open(input_file) as f:
for line in f.readlines():
if line != '\n':
corpus.append(line.strip())
return corpus
def tokenize_corpus(articles):
tokenized_articles = []
f... | true |
80156bee7a14c5a54eae531846e3af3166416054 | verasazonova/makeup | /makeup/utils.py | UTF-8 | 992 | 2.9375 | 3 | [] | no_license | import cv2
import numpy as np
import scipy.interpolate as sc
def get_center(c):
M = cv2.moments(c)
cX = int(M["m10"] / M["m00"])
cY = int(M["m01"] / M["m00"])
return cX, cY
def translate(img, dx, dy):
num_rows, num_cols = img.shape[:2]
translation_matrix = np.float32([[1, 0, dx], [0, 1, dy]]... | true |
a41f4e9a7de1a43c000e8ed21bc2ed79353cc90e | lywc20/daily-programming | /Python/SymmetricBinaryTree.py | UTF-8 | 1,981 | 3.640625 | 4 | [
"MIT"
] | permissive | class Node:
def __init__(self,val):
self.left = None
self.right = None
self.val = None
def insert(self,root,val):
node = Node(val)
curr = root
while curr:
if val > curr.val:
if tmp.right:
tmp = tmp.right
... | true |
8dfda3405180f86036813042397d6b7134bd0465 | MrHamdulay/csc3-capstone | /examples/data/Assignment_3/shmken002/question1.py | UTF-8 | 264 | 3.921875 | 4 | [] | no_license | #Using if, for and while loops to make shapes
#Kenneth Shimabukuro
#19/03/14
height = eval(input("Enter the height of the rectangle:\n"))
width = eval(input("Enter the width of the rectangle:\n"))
def sq():
for i in range(0,height,1):
print("*"*width)
sq() | true |
c02e7a4cfeb026fbb5f7b1dd27a64babc6a5f51f | chanind/tensor-theorem-prover | /tests/normalize/test_find_unbound_variables.py | UTF-8 | 1,544 | 2.921875 | 3 | [
"MIT"
] | permissive | from tensor_theorem_prover.normalize.find_unbound_var_names import (
find_unbound_var_names,
)
from tensor_theorem_prover.types import (
And,
Constant,
Predicate,
Variable,
Or,
All,
Exists,
Function,
Implies,
)
pred1 = Predicate("pred1")
pred2 = Predicate("pred2")
const1 = Cons... | true |
e5a280a0ff4021256165462b6d38e4103ade5350 | kiranchigurupati/movie28 | /entertainment.py | UTF-8 | 1,113 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import media
import fresh_tomatoes
# IT movie:movie title, storyline,poster image and movie trailer
IT = media.Movie("IT", "horror", "it.jpg",
"https://www.youtube.com/watch?v=FnCdOQsX5kc")
# Conjuring movie:movie title, storyline,poster image and movie trailer
CG = media.Movie("... | true |
8364abe36662eba021cc7e2134ddb12f02432f18 | k0pernicus/TP_Licence_Master_Info | /Master/S2/PAC_TP3/PS3/client.py | UTF-8 | 1,967 | 3.234375 | 3 | [] | no_license | import json
import urllib.request
import urllib.parse
import urllib.error
class ServerError(Exception):
def __init__(self, code=None, msg=None):
self.code = code
self.msg = None
class Server:
def __init__(self, base_url):
self.base = base_url
def query(self, url, parameters=None ... | true |
8d9f5554562889a5d800073415f6d27899a77d67 | jupiter91298/Alternating-Tree-algor | /p_graph_gen.py | UTF-8 | 394 | 2.703125 | 3 | [] | no_license | import networkx as nx
from networkx.algorithms import bipartite
import matplotlib.pyplot as plt
K=nx.erdos_renyi_graph(500,0.09)
#fwr = open("t_input.txt","w+")
fwr = open("t_directed.txt","w+")
fwr.write(str(len(K.nodes()))+"\n")
fwr.write(str(len(K.edges()))+"\n")
for edge in K.edges():
fwr.write(str(... | true |
1ce5a7aa4326a97180f4d35ce3ca308cc88e607f | entershei/optimization-methods-labs | /src/methopt/newtons_method.py | UTF-8 | 1,784 | 2.90625 | 3 | [] | no_license | import numpy as np
from methopt.conjugate_direction_method import conjugate_direction_method_for_quadratic
class DivideStepStrategy:
def __init__(self, f, eps=None):
if eps is None:
eps = 1e-7
self.f = f
self.eps = eps
def __call__(self, x, x_wave, step_prev, iteration_n... | true |
d92d8c25493ec1b4e36181f1ace5e9f3ded39012 | arlessweschler/sticker-finder | /stickerfinder/telegram/commands/admin.py | UTF-8 | 7,434 | 2.53125 | 3 | [
"MIT"
] | permissive | """General admin commands."""
import time
import secrets
from telegram.error import BadRequest, Unauthorized
from telegram import ReplyKeyboardRemove
from stickerfinder.config import config
from stickerfinder.models import User, StickerSet
from stickerfinder.session import message_wrapper
@message_wrapper(admin_only... | true |
e0c1dec10edf2d2f50baf4b12f41cc5a4c06a008 | mauricioszabo/learning | /swing_hello_worlds/window.py | UTF-8 | 573 | 3.203125 | 3 | [] | no_license | from javax.swing import *
from java.awt import *
class Window(JFrame):
def __init__(self):
JFrame.__init__(self, "Example")
self.layout = FlowLayout()
self.label = JLabel("Press: ")
self.button = JButton('Press me', actionPerformed=self.press_button)
self.add(self.label)
... | true |
5d587bea650f24efea41d905480118fc929708a0 | hoanvu/assignment | /problem_6_height_classification.py | UTF-8 | 896 | 3.734375 | 4 | [] | no_license | """Classify height class - Orenj assignment."""
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
# Load data
data = pd.read_csv('./orenj_data.csv')
# Convert Gender to number. 'F' = 0, 'M' = 1
# Gender does not play a big role in helping classifying for this task... | true |
5a35cb785dd89f13058ef166b7ca53df6a76bc79 | rossedev/Python | /Lesson01/LeerArchivo.py | UTF-8 | 576 | 3.71875 | 4 | [] | no_license | try:
file = open("prueba.txt", "r")
#lee todo el archivo
#print(file.read())
#lee solamente dos caracteres
#print(file.read(2))
#lee solamente una linea
#print(file.readline())
#itera el archivo
#for line in file:
# print(line)
#lee todas las lienas
#print(file.rea... | true |
b4d780c369293dc38b4307592fc969127c1bb8b4 | rkreml/Python-Course | /Week 2/Assignment 2.7.py | UTF-8 | 1,859 | 3.953125 | 4 | [] | no_license | ## Name: Robert Kreml
## Date: September 11, 2019
## Class: EPSY 5200
## Exercise 7 from LP3TH by Zed Shaw
# The following line prints out the character string 'Mary had a little lamb.' into the terminal.
print("Mary had a little lamb.")
# The following line prints out the character string 'Its fleece was white as' ... | true |
784f33f3f655e5bbf7c9916c09b06baf5f9dc593 | nuralisher/WD | /lab7/pythonIntro/informatics/4B.py | UTF-8 | 92 | 3.0625 | 3 | [] | no_license | import array
input()
ar = input().split()
for i in ar:
if(int(i)%2==0):
print(i) | true |
df16f99de3e96ffc614567f4e32cc03e3cce3f9b | IEEERobotics/high-level | /qwe/localizer/probability.py | UTF-8 | 478 | 2.84375 | 3 | [
"BSD-2-Clause"
] | permissive | from numpy import exp, sqrt, pi
# gaussian normalized a unity area
def gaussian(mu, sigma, x):
var = sigma**2
# calculates the probability of x for 1-dim Gaussian with mean mu and var. sigma
return exp(- ((mu - x) ** 2) / ( 2.0 * var)) / sqrt(2.0 * pi * var)
# gaussian normalized a unity peak
def ngaussian(mu, ... | true |
8f714d99c654d3887986693c4dde6ed8eeae9993 | keiffster/program-y | /test/programytest/dynamic/sets/test_numeric.py | UTF-8 | 624 | 2.578125 | 3 | [
"MIT"
] | permissive | import unittest
from programy.context import ClientContext
from programy.dynamic.sets.numeric import IsNumeric
from programytest.client import TestClient
class IsNumericDynamicSetTests(unittest.TestCase):
def setUp(self):
self._client_context = ClientContext(TestClient(), "testid")
def test_isnumer... | true |
4315d9bced613eddf3e132f320e111fc70c6fd35 | aeter/misc | /tf_idf.py | UTF-8 | 1,069 | 3.4375 | 3 | [] | no_license | """
A prototype of tf-idf.
Copyright 2011 Adrian Nackov
Released under BSD Licence (3 clause):
http://www.opensource.org/licenses/bsd-license.php
"""
from math import log10
def tf_idf(doc, all_docs, term):
'''
Input:
all_docs: a list of docs, such as [["Once", "upon"...], ["There", "was"]]
term: a phrase... | true |
ed7bb1bddf8f1b1bd54409e606d793c1217c4d90 | chaitu143c/Python_chaitu | /housie.py | UTF-8 | 919 | 3.453125 | 3 | [] | no_license | '''
Online Python Compiler.
Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.
'''
#!/usr/bin/python
import random
import copy
list = [];
input1 = 's';
begn = 1;
end = 90;
seq =[];
seq.extend(range(begn,... | true |
cf3679446408f3fa7e4e78ec928a54e646838cf8 | duganc/epidemic | /src/visualize_graph.py | UTF-8 | 1,031 | 2.71875 | 3 | [] | no_license | import argparse
from graph import PartitionGenerator, Graph, Node, DiscreteProbabilitySpace
parser = argparse.ArgumentParser(description='Visualize a graph of an epidemic given inputs')
parser.add_argument('n_nodes', type=int,
help='Number of nodes in the graph')
# parser.add_argument('--sum', dest... | true |
9a685222eab6b7851caa822a4c6645c41768dc99 | ngtrunghuan/50.021-ArtificialIntelligence | /inclass/conv(l07).py | UTF-8 | 3,360 | 2.765625 | 3 | [
"MIT"
] | permissive | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as ff
import torchvision
from torchvision import datasets, transforms
from torch.utils.data import Dataset
from torch.utils.data.sampler import SubsetRandomSampler
# Device configuration
device = torch.device('cuda:0' if torch.cuda.is_ava... | true |
491bbe939f4c859580d0b8cfaaaf3b0d47931545 | caynan/ProgrammingContests | /hackerrank/tutorial_challenge.py | UTF-8 | 432 | 3.5625 | 4 | [] | no_license | def binary_search(ar, v):
first, last = 0, len(ar) - 1
while first <= last:
mid = (first + last) // 2
if ar[mid] == v:
return mid
elif ar[mid] > v:
first = mid + 1
else:
last = mid - 1
if __name__ == '__main__':
v = int(input())
n = i... | true |
78110cbc900e56f9878b13aa58cc02bfc0bb1476 | tigerjython/tjinstall | /tigerjython/TJ4KidsExamples/Tu9a.py | UTF-8 | 267 | 3 | 3 | [] | no_license | from gturtle import *
makeTurtle()
hideTurtle()
openDot(400)
repeat 10000:
setRandomPos(400, 400)
rsquare = getX() * getX() + getY() * getY()
if rsquare < 40000:
setPenColor("red")
dot(4)
else:
setPenColor("gray")
dot(3)
| true |
8cd7895a91312d3123ec4b2e74d15db41d6bc2f2 | IvanWoo/coding-interview-questions | /tests/test_reverse_words_in_a_string_iii.py | UTF-8 | 324 | 3.328125 | 3 | [] | no_license | import pytest
from puzzles.reverse_words_in_a_string_iii import reverse_words
@pytest.mark.parametrize(
"s, expected",
[
("Let's take LeetCode contest", "s'teL ekat edoCteeL tsetnoc"),
("God Ding", "doG gniD"),
],
)
def test_reverse_words(s, expected):
assert reverse_words(s) == expec... | true |
c51ac7a32cc52420f64eb5d20c2010f0e2b0ec35 | DhruvSrivastava-16/CompetitiveCoding | /LC#153.py | UTF-8 | 519 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 23 21:51:22 2021
@author: dhruv
"""
L = [2,3,4,5,1]
l = 0 ;
h = len(L) - 1;
while (l<h):
mid = (l+h)//2;
print(mid)
mins = L[mid]
if L[mid] > L[mid + 1]:
mins = L[mid + 1]
break;
if L[mid - 1] ... | true |
a30055b1a711251bec41793ccf8efbbf6d739895 | csy1204/ecommerce_project | /accounts/forms.py | UTF-8 | 2,013 | 2.625 | 3 | [] | no_license | from .models import User
from django import forms
import re
CHOISES=(
('Buy','Buyer'),
('Sell','Seller')
)
def min_length_8_validator(value):
if len(value) < 8:
raise forms.ValidationError('8글자 이상 입력해주세요')
def need_alpha_and_special(value):
pattern = re.compile('(?=.*\d{1,50})(?=.*[~`!@#$%\^&*(... | true |
e2bd552903a56581cdcfc9b39e7389cf229b49e3 | kelr/practice-stuff | /leetcode/617-merge2binarytrees.py | UTF-8 | 1,363 | 4 | 4 | [] | no_license | class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
# Pre-order DFS through both trees at the same time.
# If t1 and t2 have a node, sum that value into t1.
# If t1 has a node and t2 doesnt, keep going
# If t2 has a n... | true |
b8ec67dc32d404df51ceef55cf5dcd29cc115a34 | joshua-hampton/my-isc-work | /python_work/lists.py | UTF-8 | 476 | 3.40625 | 3 | [] | no_license | #!/usr/bin/python
mylist=[1,2,3,4,5]
print mylist[1]
print mylist[-2]
print mylist[1:4]
one_to_ten=range(1,11)
one_to_ten[0]=10
one_to_ten.append(11)
print one_to_ten
extra=[12,13,14]
one_to_ten.extend(extra)
print one_to_ten
forward=[]
backward=[]
values=['a','b','c']
for value in values:
forward.append(value)
b... | true |
4ed9d6e8caf8d484e2439aa584315b7541726de4 | ch1huizong/study | /lang/py/pylib/03/operator/operator_itemgetter.py | UTF-8 | 375 | 3.203125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from operator import *
l = [ dict(val=-1*i) for i in xrange(4) ]
print'Dictionaries:',l
g = itemgetter('val')
vals = [ g(i) for i in l]
print' values:',vals
print' sorted:',sorted(l,key=g)
print
l = [ (i,i*-2) for i in xrange(4) ]
print'Tuples :',l
g = itemgetter(1)
vals = [ g(i) for i in l ]
... | true |
b2a95efc51e1c7a2363ae669be4d66c109f1f2e1 | chgvictor/tyc_ttl | /db.py | UTF-8 | 556 | 2.828125 | 3 | [] | no_license |
from redis import StrictRedis
class RedisClient(object):
def __init__(self, url):
self.session = StrictRedis.from_url(url)
self.db = 'tianyancha_orc'
def exists(self, key):
'''
'''
return self.session.hexists(self.db, key)
def add(self, key, value):
'''
... | true |
67da5216ce61a156b3e81b816fc3a42328cc67c4 | struuuuggle/NLP100 | /src/ch01/sec03_pi.py | UTF-8 | 287 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def pi_list():
l = []
word = "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.".split()
for w in word:
l.append(len(w.rstrip(',')))
return l
if __name__ == '__main__':
print(pi_list())
| true |
de4ef18db7092ddadfd21cddc294ff3bd0401563 | mpbagot/A-Pi-mirror | /modules/help.py | UTF-8 | 1,530 | 2.875 | 3 | [] | no_license | import pygame
from time import *
import io
import sys
sys.path.append('../')
pygame.init()
# Font type and size
font = pygame.font.Font('resources/font/ocraext.ttf', 10)
# Declares clock
clock = pygame.time.Clock()
# Color palette
BLUE_IO = ( 23, 53, 109)
OUTLINE = (252, 79, 0)
BLUE_F = ( 23, 96, 109)
TEXT_M = ... | true |
5958380c17002b828f11cf9de36e1c23f4581c9b | xiangcao/Leetcode | /python_leetcode_2020/Python_Leetcode_2020/708_insert_into_sorted_circular_list.py | UTF-8 | 2,139 | 4.25 | 4 | [] | no_license | """
Given a node from a Circular Linked List which is sorted in ascending order, write a function to insert a value insertVal into the list such that it remains a sorted circular list. The given node can be a reference to any single node in the list, and may not be necessarily the smallest value in the circular list.
... | true |
f88d5e98a7b20e6cc162330037ed1eba29434c6f | alejandrommingo/elpaisScrap | /elpaisScrap.py | UTF-8 | 2,708 | 3.109375 | 3 | [] | no_license |
def elpaisScrap(year, month, day, gap):
# Libraries
from urllib.request import urlopen
from bs4 import BeautifulSoup
from newspaper import Article
import re
# open html
page = "https://elpais.com/hemeroteca/elpais/" + str(year) + "/" + str(month) + "/" + str(day) + "/" + gap + "/portada.h... | true |
e73d505ea6868bd98ffb2923d05f0965b7e60473 | cbalea/LM-AUTOMATION | /Panda/common/uua_login_page.py | UTF-8 | 1,223 | 2.71875 | 3 | [] | no_license | '''
Created on 10.12.2012
@author: cbalea
'''
from selenium.webdriver.remote.webelement import WebElement
class UuaLoginPage(object):
emailField = WebElement(None, None)
passwordField = WebElement(None, None)
def __init__(self, driver, wait):
self.driver = driver
self.wait = wait... | true |
9751e16731a5647daad9a2d054f962e999ad58f2 | Maxoos/RDS-Aurora-Serverless | /db/models.py | UTF-8 | 607 | 2.65625 | 3 | [] | no_license | import enum
import sys
from sqlalchemy import Column, Integer, VARCHAR, DateTime
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
__tablename__ = "user"
id = Column('id', Integer, primary_key=True)
email = Column('email', VARCHAR(128))
date_joined =... | true |
2de5c0e1df7b8c29ebbf0ff38641b7003a1c51f5 | Zzapy/Rubick-s-Cube | /fct_cube.py | UTF-8 | 4,078 | 3.171875 | 3 | [] | no_license | # coding: utf-8
# Pour l'ensemble des notations, se reporter aux images jointes.
#----------------------------------- Import -----------------------------------
import numpy as np
import os
#------------------------------------ Cube ------------------------------------
# Vue déplié du cube :
# 4
# 0 1 2 3
# ... | true |
57efc182310bcd06bd462f7670d0d9031e8920fc | hlncrg/hackerRank | /python/dataTypes/lists.py | UTF-8 | 2,895 | 4.625 | 5 | [] | no_license | """Problem Statement
When we talk about storing multiple values in a container-like data-structure, the first thing that comes to mind is a list.
You can initialize a list as
>>> arr = list()
or simply
>>> arr = []
or with a few elements as
>>> arr = [1,2,3]
Elements can be accessed easily like you do in most progr... | true |
8c44a2db99e65dbed4710ca8bfe03aa756222d11 | Techwolfy/ieeextreme10 | /full_adder.py | UTF-8 | 1,819 | 3.0625 | 3 | [] | no_license | from math import log, floor
if __name__ == "__main__":
line1, line2, line3, line4, line5 = input(), input(), input(), input(), input()
print(line1)
print(line2)
print(line3)
print(line4)
base, symbols = line1.split()
base = int(base)
value_to_symbol = {}
symbol_to_value = {}
for ... | true |
ee24d5b40b89044341b93dfbed136ce3773b610a | wy0353/airbnb-clone | /custom_calendar.py | UTF-8 | 1,507 | 3.359375 | 3 | [] | no_license | import calendar
from django.utils import timezone
class Day:
def __init__(self, day, month, year, is_past):
self.day = day
self.month = month
self.year = year
self.is_past = is_past
def __str__(self):
return str(self.day)
class Calendar(calendar.Calendar):
def __... | true |
d3c8c7478a080a03e7607b6fed91510e4d518bee | toliko-coding/My-Python-codes | /תרגול/Lab4-20210801/add_sample.py | UTF-8 | 866 | 3.625 | 4 | [] | no_license | # ------------------------------------------------
'''
def f1(x):
return x+y
def f2(y):
return f1(3)+1
print(f2(3))
'''
# ------------------------------------------------
'''
def f2(y):
def f1(x):
return x+y
return f1(3)+1
print(f2(3))
'''
# --------------------------------------... | true |
8fc74c615cbccf65206240d083b1fbc0d114c980 | Sumaito/Python-3 | /python/exercise1.py | UTF-8 | 142 | 3.609375 | 4 | [] | no_license | #programming "Hello World" in Python 3 in two different ways
#first shap
print('Hello World')
#second shape
msg=('Hello World')
print(msg)
| true |
21b96002744a68370cfa14e3e8d830dab49407b5 | onewns/TIL | /algorithm/leetcode/String/0819_MostCommonWord.py | UTF-8 | 558 | 3.015625 | 3 | [] | no_license | # leetcode 819
def mostCommonWord(self, paragraph: str, banned: List[str]) -> str:
# my style 36ms 14.2MB
paragraph = re.sub('[^a-z]', ' ', paragraph.lower())
words = list(paragraph.split())
counter = Counter(words).most_common()
for word, cnt in counter:
if word not in banned:
... | true |
d2543116e08c1b35672ab9430a0d2813cef9c6cb | xhochy/vscode-python | /pythonFiles/datascience/getJupyterVariableValue.py | UTF-8 | 1,736 | 2.578125 | 3 | [
"MIT"
] | permissive | # Query Jupyter server for the value of a variable
import json as _VSCODE_json
_VSCODE_max_len = 200
# In IJupyterVariables.getValue this '_VSCode_JupyterTestValue' will be replaced with the json stringified value of the target variable
# Indexes off of _VSCODE_targetVariable need to index types that are part of IJupyt... | true |
229f4a1657f4c21f24edbc05084361e1cc277d41 | mariomeissner/char_nn | /keras-run.py | UTF-8 | 2,549 | 2.65625 | 3 | [] | no_license | #Currently does not work. The model and weights are not able to loaded in a seperate python instance.
# import matplotlib.pyplot as plt
# import numpy as np
# import time
# import csv
# import re
# import os
# import keras
# from pathlib import Path
# from keras import optimizers
# from keras.models import Sequential... | true |
570a1acb5331896939ad1360e7fe008ee81ac25e | davidtreth/marsglaciers | /plotallHRSC_diss.py | UTF-8 | 1,913 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
""" plots the footprints of the 179 tiles used in dissertation
by reading the geometry from the gdalinfo in the JSON file for da4"""
from readallJSON import HRSC_da4dict
from matplotlib import pyplot as plt
def plotAll(tilenames, polygons, resolutions):
for tn, p, r in zip(tilenames, poly... | true |
dd38a3d7a6c8a97c60c8cc0f9dd203f7f419aa1d | davidkellis/py2rb | /tests/strings/ulcase.py | UTF-8 | 74 | 3.15625 | 3 | [
"MIT"
] | permissive |
s = "aBcddEzUh"
print(s)
s = s.upper()
print(s)
s = s.lower()
print(s)
| true |
199ad53b72479123f59bce74532e57cadc7eb8dc | tsenying/CarND-Advanced-Lane-Lines | /src/perspective_transform_matrix.py | UTF-8 | 2,527 | 3 | 3 | [] | no_license | # Calculate the perspective transform matrix M and inverse Minv
import pickle
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from matplotlib.path import Path
import matplotlib.patches as patches
from image_utils import image_warp
# Read in the saved camera matrix and d... | true |
acd2f479652a0273b8e0c708f9751a134cd092f5 | arvidbt/KattisSolutions | /python/cd.py | UTF-8 | 215 | 3.109375 | 3 | [] | no_license | n, m = map(int, input().split())
jack = set()
jill = set()
for _ in range(n):
jack.add(int(input()))
for _ in range(m):
jill.add(int(input()))
print(jack.intersection(jill))
DOES NOT WORK
| true |
036aac70fc707ed36c81768ebeae2fc43553d368 | Linfang-He/GATNE-dgl | /src/main_pytorch.py | UTF-8 | 17,202 | 2.578125 | 3 | [
"MIT"
] | permissive | import math
import os
import sys
import time
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import tqdm
from numpy import random
from torch.nn.parameter import Parameter
import dgl
import dgl.function as fn
from utils import *
def get_graphs(layers, index2word, neighbors):
... | true |
eae34571a0dc5f6f8855f22aad1ee1efbc4f44f0 | atom-chen/ZombieGame | /tool/py/copyPBToWorkSpace.py | GB18030 | 2,391 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python
#coding=utf-8
# svn նָ http://www.cnblogs.com/netcorner/p/5034006.html
#F:\client\client\DzProjectBranchForAli>"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:F:\clie
#nt\client\DzProjectBranchForAli
import shutil
import re
import os
import time
import sys
import subproces... | true |
38605a8662aab8c37b957ef6f2a12c1cc06505fe | sidmishraw/pdf_processor | /pdf_processing/utils.py | UTF-8 | 916 | 3.34375 | 3 | [] | no_license | # utils.py
# -*- coding: utf-8 -*-
# @Author: Sidharth Mishra
# @Date: 2017-04-03 19:45:31
# @Last Modified by: Sidharth Mishra
# @Last Modified time: 2017-04-03 20:03:43
'''
Some Utilities
'''
# Python standard library imports
def standardize_words(words):
'''
Takes the list of words it needs to stan... | true |
7f02f56f54b9431326f6fb362df33f1ce825216e | Kumar-Tarun/facial-expression-recognition | /fer2013/train.py | UTF-8 | 3,210 | 2.53125 | 3 | [] | no_license | from keras.models import *
from keras.layers import *
from keras.optimizers import *
from keras.callbacks import *
from keras import regularizers
from keras import backend as K
from keras_applications.imagenet_utils import _obtain_input_shape
from keras.utils import to_categorical
import matplotlib.pyplot as plt
import... | true |
8f64b2385d8f77bce456ba7fd39170901d3264c3 | faubes/cogneat-medical-text-learning | /mimic/cogneat.py | UTF-8 | 4,137 | 3 | 3 | [] | no_license | import pandas as pd
import numpy as np
import sys
import time
import pickle
import argparse
import keras
from keras.layers import Flatten, Dense, Input
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.models import Model
from keras.models import Sequentia... | true |
4bec9a607c57f8b5ef1ca8a441f8f1f2d6d7f3f8 | weizhixiaoyi/leetcode | /tree/687.longest-univalue-path.py | UTF-8 | 1,244 | 3.65625 | 4 | [] | no_license | # -*- coding:utf-8 -*-
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def longestUnivaluePath(self, root: TreeNode) -> int:
if root is None: return 0
self.ans = 0
# 针对下面两个节点回归到顶节点可采用后序遍历
def help... | true |
48530aad88046ee3f785e96d17ea9218a5d594f4 | onitonitonito/openCV_TAcademy_reboot | /lecture_02/video_in.py | UTF-8 | 1,843 | 2.640625 | 3 | [] | no_license | """
# simple saved video input test : '/src/vtest.avi'
"""
import sys
import cv2
from _path import (DIR_SRC, get_cut_dir, stop_if_none)
dir_avi = DIR_SRC + 'avi_test/'
# video_name = 'input.avi' # avi, mp4, video_clip
video_name = '201907-03.mp4' # avi, mp4, video_clip
landscape = 0 # 0 = Portra... | true |
55a7a4b106847836818a785261db67a331b00181 | JesseXen/Pythonachievements | /hello you.py | UTF-8 | 91 | 3.140625 | 3 | [] | no_license | print ("hello you, ik ben jesse")
username = input("Whats your name?")
print("hello " + username) | true |
978b8ae2bed021024f8ee0596ee3dc3d4bcf53a8 | mi-kol/settlers_python | /settlers.py | UTF-8 | 50,160 | 3.0625 | 3 | [] | no_license | #Settlers of Catan
import random
import string
class Node:
"""
This is a class that represents all the nodes on the board.
Attributes
----------
id : unique identifier of id. mostly for testing.
resource : resource that the id holds
claimed : if the node is claimed
claimedby : who the... | true |
e11736bc90013c49b6ff1fd88af2115a272a5b04 | LeeGyeongHwan/Algorithm_Student | /Python/acm_4597.py | UTF-8 | 529 | 3.03125 | 3 | [] | no_license | #
# ACMICPC
# 문제 번호 : 4597
# 문제 제목 : 패리티
# 풀이 날짜 : 2020-11-14
# Solved By Reamer
#
while True:
str = input()
if str == "#":
break
cntOne = 0
for i in range(0, len(str)-1):
if str[i] == '1':
cntOne = cntOne + 1
print(str[i],end="")
if str[len(str) - 1] == 'e'... | true |
beebd87011b5e2d96edb19c9cd8f1e679d59e57e | bahniks/Experiment_CZP | /Stuff/demo.py | UTF-8 | 9,065 | 2.53125 | 3 | [] | no_license | #! python3
from tkinter import *
from tkinter import ttk
import os
from common import ExperimentFrame
from gui import GUI
class Demographics(ExperimentFrame):
def __init__(self, root):
super().__init__(root)
self.sex = StringVar()
self.language = StringVar()
self.age = St... | true |
321448c47cfb6bd1efefae599ca8805f1b33caa4 | theAnshulGupta/Tic-Tac-Toe | /Main.py | UTF-8 | 10,245 | 3.265625 | 3 | [] | no_license | import pygame
import random
import time
pygame.init()
gameDisplay=pygame.display.set_mode((600,630))
pygame.display.set_caption("Tic-Tac-Toe")
white=(255,255,255)
black=(0,0,0)
red=(255,0,0)
green=(0,255,0)
blue=(0,0,255)
aquamarine2=(118,238,198)
mousex=0
mousey=0
box1=True
box2=True
box3... | true |
5bec5f431b1a28e37e720680bd4d1628339ea3be | tahmid-sadi/installingpycharm | /real_pyramid.py | UTF-8 | 414 | 3.46875 | 3 | [] | no_license | x = int(input('Enter height = '))
for i in range(1, x + 1):
print('*' * i)
h = x - 1
while h > 0:
print('*' * h)
h -= 1
for j in range(1, x + 1):
for k in range(1, j+1):
print('*', end=' ')
print(end='\n')
for r in range(1, x + 1):
for c in range(1, x + 1):
if c <= (x - r):
... | true |
089ff8f71c7007fb9158e870c202c91f8affa69b | Coldmusic/FEC-in-Underwater-Acoustic-Sensor-Networks-UASNs- | /5km_80pc_ice/FSK_output/0p3SymPerSec/BER.py | UTF-8 | 1,752 | 2.578125 | 3 | [] | no_license | #! python
from sys import argv
import numpy
import re
import scipy
from bitstring import BitArray
numpy.set_printoptions(threshold='nan')
#print "Hello, Python below is your file"
#filename= raw_input('ENTER YOUR FIRST Filename: ')
script, filename1, filename2, correlation = argv
print(filename2)
A1 = scipy.fromfile(o... | true |
7232a807f0b4fbfcc9276b87e67c0c002f7b1bd5 | shaunfg/Computational-Physics | /Neutrinos/scratch/scratch.py | UTF-8 | 558 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 26 16:10:28 2019
@author: sfg17
"""
def Error_Curvature(theta,unoscillated_rates,measured_events):
t = theta
A = np.sin(1.267 * del_mass_square * L / E) **2
P = 1 - np.sin(2*t)**2 * A
P_1 = - 4*np.sin(2*t)*np.cos(2*t) * A
P_2 = - (8(n... | true |
7a949e1d775308df5080f2e3525e84f4c49f4626 | bbjornstad/cta-sonified | /SoundGeneration.py | UTF-8 | 7,781 | 3.1875 | 3 | [] | no_license | # This library creates a SoundGenerator class, which will hold data for each
# wave that we will need to generate in order to produce sound. Borrowed
# heavily from Sid Perida's work available online.
import numpy as np
from scipy.io.wavfile import write
from fractions import gcd
# Note that this SoundGenerator clas... | true |
811215521f24b89fcd39af4cc635a4a9e9f269b5 | shervinbdndev/Second-Degree-Equation-Calculator | /Second Degree Equation Calculator.py | UTF-8 | 2,888 | 2.953125 | 3 | [] | no_license | from tkinter import Tk , Label , Entry , Button , StringVar , RAISED , RIDGE , GROOVE
root = Tk()
root.title("Second Degree Equation (ax2 + bx + c)")
root.resizable(0 , 0)
root.geometry("720x480")
root.configure(background = "#546E7A" , bd = 5+2+2+1)
def calculate(resolver):
if resolver == "second_de... | true |
d968340f239eaea644e29bfbd7454b3f910bca5e | MichaelMMeskhi/openml-python | /openml/flows/functions.py | UTF-8 | 11,797 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | import dateutil.parser
from collections import OrderedDict
import os
import io
import re
import xmltodict
from typing import Union, Dict
from ..exceptions import OpenMLCacheException
import openml._api_calls
from . import OpenMLFlow
import openml.utils
FLOWS_CACHE_DIR_NAME = 'flows'
def _get_cached_flows() -> Orde... | true |
726a8878a7dc83ae7659a58d5ebf189d193507df | baxromov/hackerrank | /Tuples.py | UTF-8 | 349 | 3.875 | 4 | [] | no_license | """
Task
Given an integer, n, and n space-separated integers as input, create a tuple, t,
of those integers. Then compute and print the result of hash(t).
Note: hash() is one of the functions in the __builtins__ module, so it need not be imported.
"""
n = int(input())
integer_list = hash(tuple(map(int, input().spl... | true |
664cf2e6a3b1de38f0a6f5a892ee28683c48dfa8 | rowle1tj/CHBot | /newbeginning.py | UTF-8 | 4,420 | 2.703125 | 3 | [] | no_license | from thebot import CHBot
import time
from datetime import datetime, timedelta
def main():
bot = CHBot()
bot.click_farm_mode()
# Click four times per second for one minute
for i in range(0, 240):
bot.click_the_evil_monster()
time.sleep(0.25)
# Hire the first four
bot.click... | true |
a8b2e889acdafe2dac97cd2640b5ecd6438d87c5 | JalonJia/PythonStudy | /src/Jalon/201812/2181216R2.py | UTF-8 | 551 | 3.71875 | 4 | [] | no_license | '''
Created on 2018年12月16日
@author: KKVV
'''
import math
class Point:
"""
x
y
"""
class Circle:
"""
center
radius
"""
#实例化对象
j = Circle()
j.center = Point()
j.radius = 75
j.center.x = 150
j.center.y = 100
p = Point()
p.x = 150
p.y = 1... | true |
9b0c13b972d02b08fd723d2611d5ef3b7a83c174 | ryan-nanson/learning-machine-learning | /textGeneration/generateSpells.py | UTF-8 | 905 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Ryan Nanson
Generate Harry Potter Spells.
https://github.com/ryan-nanson/learning-machine-learning/tree/master/textGeneration
"""
from textgenrnn import textgenrnn
import csv
# Read Spells.csv and create lists
with open('Spells.csv') as csvfile:
spells = []
spellsreader = csv.reader(... | true |
a8c9459af84e01251cf71d1654133847a628f7e4 | jenxime/Control | /Calculadora/Calculadora.py | UTF-8 | 1,496 | 4.65625 | 5 | [] | no_license | '''print("Hola Mundo")
lista = []
for i in range(10):
print("Hola Mundo")
lista.append(i)
for i in range(10):
print(lista[i])
diccionario = {'Estudiante1' : 'Luis', 'Estudiante2' : 'Isaac', 'Estudiante3' : 'Xime', 'Estudiante4' : 'Andy'}
print(diccionario['Estudiante1']) cambio cambio cambio'''
# Program ... | true |
98df382a7eb76f87ba75a0497d1ce4017b744e93 | jashmehta98/PythonDemo | /calc.py | UTF-8 | 717 | 4.46875 | 4 | [] | no_license | while True:
print('Enter \'add\' for addition')
print('Enter \'sub\' for subtraction')
print('Enter \'mul\' for multiplication')
print('Enter \'div\' for division')
print('Enter \'quit\' to quit')
command = input()
if command == 'quit':
break
num1 = input('Enter first number: '... | true |
3677ddb939233d46a77b211c8c9e65ba8913a709 | brunofms/inf3000_mf-video-recommendation | /poc/recommendations.py | UTF-8 | 4,116 | 2.875 | 3 | [] | no_license | from math import *
from numpy import *
from time import *
import sys
"""
"""
def learn_factors (R, n_features, min_improvement=0.0001, learn_rate=0.0001, regularization=0.02):
n_users=shape(R)[0]
n_movies=shape(R)[1]
#Initialize the weight and feature matrices with random values
W=matrix([[random.random() for f... | true |
a5cc4aa747e74d27e5512fcde8d25be451b8a7ef | zoufengyuan/Forecast-of-visits-amount | /program(程序)/data_utils(数据清洗)/t_meteorological_data_mend.py | UTF-8 | 4,975 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 10:06:14 2020
@author: aid
"""
import pandas as pd
import numpy as np
from py_sql_connect import Sql_df
from scipy.interpolate import lagrange
import gc
data_input = Sql_df('aid-livelihood')
t_meteorological_data = data_input.sql_input_all('select monitor_date,avg_pr... | true |
37e6d9381208a656e2f50335c1a6b1e4dc5c68d5 | Imaccer/JupyterWorkflow | /jupyterworkflow/data.py | UTF-8 | 557 | 2.703125 | 3 | [
"MIT"
] | permissive | import os
from urllib.request import urlretrieve
import pandas as pd
FREEMONT_URL = 'https://data.seattle.gov/api/views/65db-xm6k/rows.csv?accessType=DOWNLOAD'
def get_freemont_data(filename='Freemont.csv',url=FREEMONT_URL,force_download=False):
""" Download and cached the freemont data
"""
if force_downl... | true |
258f372532cb4387795b9f0a50655bf145e585d3 | jarettn18/CIS-211 | /Agenda-master/ThursdayCodeW1.py | UTF-8 | 181 | 3.671875 | 4 | [] | no_license | class Point:
"""A point is a pair x,y of integers
Points are immutable.
"""
def __init__(self,x: int,y: int):
self.x = x
self.y = y
| true |
f2392c83c62fde26e73ba10be4d283185e4ee909 | wjpark11/impratical_python | /palingram/palingram.py | UTF-8 | 1,599 | 3.71875 | 4 | [] | no_license | """find all word-pair palingrams in a dictionary file"""
from load_dictionary import load
# load digital ditionary as a list of words
word_list = load("dictionary.txt")
def find_palingrams():
"""find all word-pair palingrams in a dictionary file"""
# start an empty list to hold palingrams
palingram_list =... | true |
6fd253e957323446b2d71e9def2cae032f13a217 | preritj/SubmitJobs | /submitjobs/jobs.py | UTF-8 | 1,163 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
from subprocess import Popen,PIPE
from parallel import det_Ncores, check_job
from time import sleep
import re
#class for parallel job submissions
class Jobs :
Ncores=0 #Number of processing units to use
Nsub=0 #Number of jobs submitted
Nrem=0 #Number of jobs remaining
Nrun=0 #... | true |
e5acd64624a7356955e6989ae4db411cea36449e | mathause/mplotutils | /mplotutils/map_layout.py | UTF-8 | 2,241 | 2.90625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
from mplotutils._deprecate import _deprecate_positional_args
@_deprecate_positional_args("0.3")
def set_map_layout(axes, width=17.0, *, nrow=None, ncol=None):
"""set figure height, given width, taking axes' aspect ratio into account
Needs to be called after... | true |
d0108891eafe3cbefc89106ec84cfe556aea10aa | romech/max-ent-networks | /fao_analysis/cluster_analysis.py | UTF-8 | 3,127 | 2.53125 | 3 | [] | no_license | from types import SimpleNamespace as ns
import numpy as np
import pandas as pd
import toolz
from sklearn.metrics import silhouette_score
from utils import fallback
@fallback
def try_clustering(model, pairwise_similarity, names=None, verbose=True):
pairwise_distance = pairwise_similarity.max() - pairwise_similar... | true |
e98b0e17762e06da0c5d9754b440b98b9ed685e9 | BanBuDu0/math-model | /t1/greedy.py | UTF-8 | 2,790 | 2.75 | 3 | [] | no_license | import pandas as pd
import numpy as np
import math
import time
'''
D:\Anaconda3\python.exe D:/jupyter_project/math/t1/greedy.py
结果:
531.232814976417
0
10
16
27
12
8
9
20
19
1
2
17
29
5
13
4
21
3
22
23
24
28
15
11
6
7
18
26
25
14
程序的运行时间是:0.0
Process finished with exit code 0
'''
path =... | true |