blob_id
large_string
language
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
b51a512fbedf8c77713ef1c4495ae74f2758aee4
Python
joakimstenhammar/subgrid
/python/dqTools/ncdx.py
UTF-8
14,609
2.6875
3
[ "MIT" ]
permissive
"""A simpler interface to netCDF files. """ from pycdf import * import numpy as N import os.path CREATE = NC.CREATE|NC.WRITE|NC.BIT64_OFFSET def get_or_def_dim(ncf, name, length): try: len = ncf.dimensions()[name] dim = ncf.inq_dimid(name) except KeyError: dim = ncf.def_dim(name, lengt...
true
9663d65220d0b84273dbf253afa0beb526818101
Python
wilsonify/ThinkBayes2
/tests/test_examples/test_voting_soln.py
UTF-8
2,042
3.109375
3
[ "CC-BY-NC-SA-4.0" ]
permissive
""" Think Bayes This notebook presents example code and exercise solutions for Think Bayes. Copyright 2018 Allen B. Downey MIT License: https://opensource.org/licenses/MIT """ from thinkbayes import Pmf def test_vote(): # def add(pmf1, pmf2): res = Pmf() for v1, p1 in pmf1.items(): ...
true
6187454388b9f934f723daff52026a44eac80c98
Python
abuzarmahmood/blech_pi_codes
/pi_licking.py
UTF-8
1,961
2.71875
3
[]
no_license
# Import things for running pi codes import time import sys import Adafruit_MPR121.MPR121 as MPR121 from math import floor import random import RPi.GPIO as GPIO # Import other things for video from subprocess import Popen import easygui import numpy as np import os # Setup pi board GPIO.setwarnings(False) GPIO.cleanu...
true
76a624f00f94214fd301606c0e6a7ff88553db8d
Python
Chao-Xi/JacobTechBlog
/interview/riot/log-percentile/Get_log_percentil2.py
UTF-8
689
3.1875
3
[]
no_license
import os import glob import numpy as np def lines_to_list(dir): os.chdir(dir) for filename in glob.iglob("*.log"): with open(filename) as f: for line in f: line = line.strip() rtime = int(line.split(' ')[-1]) yield rtime # Two nested loop and allocation of "rtime" inside the loops, so the time&spac...
true
fbcf63cf916dc08cedc108b7526d132b25a65d0f
Python
hariharanRadhakrishnan/Python_Exercises
/read_nsd_file_1/1.py
UTF-8
1,762
3.03125
3
[]
no_license
import re import sys import os def openFile(fileName, fileMode): try: file = open(fileName, fileMode) except: return None else: return file def changeDir(path): try: print("..... Changing directory to", path) os.chdir(path) except: print("FAILED,",path, "does not exist") return def createOutDir():...
true
4894a5a23c0bb5999042ce7507280cba7261d912
Python
Navid-Fkh/TaxiTransportOptimization
/src/Phase3.py
UTF-8
1,670
2.8125
3
[]
no_license
from Phase2 import Phase2 from Phase1 import Phase1 inf = 1000000000000 dataset_path = "dataset/General-Dataset-1.txt" matrixd_path = "dataset/MarixD_dataset1_General.txt" # Version 1 solver = Phase2(dataset_path, matrixd_path) print("The result for Phase3 (V.1):") flowCost, flowDict = solver.solve(bypass_weight=-1)...
true
05c64a56075557d8fdf301a340651431d4c9bbc5
Python
kafire/web_log_parse
/nginx_log_sqlite.py
UTF-8
2,165
2.8125
3
[]
no_license
#!/usr/bin/env python # -*- encoding: utf-8 -*- import re import glob import time import sqlite3 import linecache class DB(object): def __init__(self, db_file): self.db_file = db_file self.db = sqlite3.connect(self.db_file, check_same_thread=False) self.db.text_factory = str self.cu...
true
1bd9093ab5c829e9b164af201cf03a30342061d2
Python
itkasumy/PythonGrammer
/day09/04-文件读写.py
UTF-8
141
2.71875
3
[]
no_license
file = open("./a.txt", 'w') file.write('Hello Ksm') file.close() fileR = open('./a.txt', 'r') cont = fileR.read() print(cont) fileR.close()
true
2bbb9bedb2a746090bbae839c926ab66fe6e1316
Python
faaduprogrammer/Math-Solving-Utility
/MathUtility.py
UTF-8
13,704
3.625
4
[]
no_license
import re class Frac: def __init__(self,numenator,denominator): pass def multiputive_inverse(self): pass def additive_inverse(self): pass def is_mixed_fraction(self): pass def convert_into_mix_fraction(self): pass class Algebra: def make_readable(self): ...
true
9398644fc8363bce914353f27777a052b33f1512
Python
qcl/ntu-homeworks
/2012-spring-FinancialComputing/hw1/b97501046_hw1.py
UTF-8
576
3.59375
4
[]
no_license
# -*- coding:utf-8 -*- # Principles of Financial Computing # Homework 01 # # Qing-Cheng Li # B97501046 import sys def main(): print 'Please input n:' n = sys.stdin.readline() n = int(n.split()[0]) if n <= 0: return p = [] for i in range(n): print 'prices',i+1,'=' t...
true
dbc0fec8f0e0fbdfecd8b3d7b70dbe58869881a2
Python
L-Lang-Of-LTHC/LTHC-PIYN-Lang
/utils/linker.py
UTF-8
1,041
2.75
3
[]
no_license
# -*- coding: utf-8 -*- # ./utils/linker.py => contains file linking system ############ # IMPORTS ############ import libs.readline as rl def link(file, mode, param=None): if mode == 0: #FCALL et NE, LT, GT, EQ run(file) if mode == 1: #LOOP for i in range(param): run(file) def...
true
47943cd2cf095a1bbe38e7fc2a1d5d40d09378d2
Python
amazingchow/seaweedfs-tools
/tools/time-server/app/utils/time_utils.py
UTF-8
578
2.796875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import datetime import faker __TimeFake = faker.Faker() def time_utils_random_rfc3339_time(passed_days:int): fake_time = __TimeFake.date_time_between(start_date="-{}d".format(passed_days), end_date="now") fake_timestamp = datetime.datetime.timestamp(fake_time) return datetime.datet...
true
21ed08043c58f4e6a62e8360b2cf7906085d6fa4
Python
krenevych/algo
/labs/L19/task1/main.py
UTF-8
556
3.6875
4
[]
no_license
class Heap: def __init__(self, max_heap_size): pass def insert(self, key): print(f"insert {key}") def extract(self): print("extract: ", end="") return None if __name__ == '__main__': with open("input.txt") as f: N = int(f.readline()) heap = Heap(N + 1)...
true
507362924ddf7b995f6b17b0edd1a7299c8e5a4f
Python
maxcd/bandmat_compiled
/test_core.py
UTF-8
24,338
2.859375
3
[]
no_license
"""Tests for core banded matrix definitions and functions.""" # Copyright 2013, 2014, 2015, 2016, 2017 Matt Shannon # This file is part of bandmat. # See `License` for details of license and warranty. import unittest import doctest import numpy as np import random from numpy.random import randn, randint ...
true
8e00e71bb1bcd5cb29680dc62f7cb0a94743af61
Python
Vivekg95/Python-Tutorial
/Structuredqurylang/skl.py
UTF-8
251
2.53125
3
[]
no_license
import mysql.connector mydb=mysql.connector.connect(host="localhost",user="root",passwd="708312@vk",database="College") mycursor=mydb.cursor() #mycursor.execute("show databases") mycursor.execute("select * from Base") for i in mycursor: print(i)
true
21ba1412a2934a627f377066bee65ef7d8214f07
Python
Sassa-nf/pi
/math_art/c.py
UTF-8
3,093
3.59375
4
[]
no_license
# Given a list of drawing instructions, count how many crosses are drawn. # # Drawing instructions consist of pen movement direction (LURD) and integer # offset of that movement. # # Number of lines: 2 <= N <= 2M # Offsets: 1 <= L <= 1G # Directions: D_i in 'LURD' # # --- # # Let's collect all vertical lines and all ho...
true
6d3aa5c52800379d4ad1fdcf66ba435dc324ca4f
Python
grt192/2015recycle-rush
/py/record_controller.py
UTF-8
6,083
2.75
3
[]
no_license
import threading import time from collections import OrderedDict from grt.core import GRTMacro try: import wpilib except ImportError: from pyfrc import wpilib class RecordMacro(GRTMacro): def __init__(self, obj_list, timeout=None): super().__init__(timeout) self.obj_list = obj_list #list o...
true
4a1e4b6bd54ce961c4930014653f2e81e745c2f1
Python
Jane42070/TianYue
/get_book.py
UTF-8
3,463
2.84375
3
[]
no_license
#!/usr/local/bin/python3.8 # -*- coding: utf-8 -*- '''规范 bname, bout, bauthor, bdate, bpic, bintro, bcontent, bprice''' from users.models import BookInfo import requests import lxml import time import random def spawn_book(): '''产生书''' a1 = (1976, 1, 1, 0, 0, 0, 0, 0, 0) a2 = (2017, 12, 31, 23, 59, 59, 0,...
true
7b144538679eedc44f81154aa49c00e7e6415f36
Python
ankitgupta123445/python
/day.py
UTF-8
1,272
3.15625
3
[]
no_license
date=int(input("enter the date")) month=int(input("enter the month")) t=365 if month==1: rem=(31-date)+(t-31) print("no. of remaining days=",rem) elif month==2: rem=(28-date)+(t-31-28) print("no. of remaining days=",rem) elif month==3: rem=(31-date)+(t-31-28-31) print("no. of remainin...
true
664da3c83adbaac3bc0df17bb1f6e745bbf01436
Python
funnydog/AoC2016
/day7/day7.py
UTF-8
1,522
3.34375
3
[]
no_license
#!/usr/bin/env python3 import re import sys pat = re.compile(r"([a-z]+)|\[([a-z]+)\]") def is_abba(sub): for i in range(len(sub)-3): if sub[i] == sub[i+3] and sub[i+1] == sub[i+2] \ and sub[i] != sub[i+1]: return True return False def supports_tls(sequence): found = False...
true
0e8470192e3e168e5499dc808f073359c9da2d37
Python
Edward-Sekula/OS-GCSE-computing-course
/python/phonebook.py
UTF-8
248
3.25
3
[]
no_license
phone_book = {} print('1.Add to phone_book\n2.Delete from phone_book\n3.Search\n4.Show all\n5.quit\n') choice = int(input()) def add(): x = input('input name of person') y = input('input number') phone_book[x] = y add() print(phone_book)
true
4d33574022ae63d1c820872e04e281a0985bed3e
Python
facup94/AoC2018
/6/day6.py
UTF-8
1,628
3.265625
3
[]
no_license
def print_grid(grid, bool_print=False): grid_string = '' for row in grid: grid_string += ' '.join(str(x).rjust(3, '0') for x in row) + '\n' grid_string += '--------------------' if bool_print: print(grid_string) return grid_string # Creating grids grid_side_size = 400 distance_grid = [[{'areas':[],...
true
f6ea4945dd36ea5a9953f227b9b559421d13df8a
Python
rovinapinto/radiative_forcing
/codes/forcing_tools/plot.py
UTF-8
5,551
2.90625
3
[ "MIT" ]
permissive
import numpy as np from netCDF4 import Dataset import xarray as xr import dask as ds import matplotlib.pyplot as plt import matplotlib.colors as mcolors from matplotlib.colors import from_levels_and_colors from pylab import * import cartopy.crs as ccrs from cartopy.util import add_cyclic_point def plot_data(dataset, d...
true
579f208b9bb7d812ca52d3ba1afecc420d9c5e80
Python
ErikValle/controllable_image_synthesis
/utils/visualization.py
UTF-8
7,408
2.6875
3
[ "MIT" ]
permissive
import numpy as np import torch import collections from utils.depth_map_visualization import color_depth_map from matplotlib import cm def color_depth_maps(depth, depth_max=None, rescale=True): depth = depth.detach().cpu().numpy() depth = depth / 2.0 + 0.5 depth_max = 1.0 #if depth_max is None: # depth_...
true
49fa2c702664a66effcb96d66491ef07b9476743
Python
han963xiao/machine_learning_scripts
/entropogram/keras_vgg16.py
UTF-8
3,277
2.703125
3
[]
no_license
#!/usr/bin/env python """ Use VGG16 to extract features from entropogram """ from load_data import get_coherence, get_spectrogram from keras.applications.vgg16 import VGG16 from keras.preprocessing import image from keras.models import Model from keras.applications.vgg16 import preprocess_input import numpy as np impo...
true
bd2e0a83ac858a3f0ffb54a55a8d6093f68879da
Python
timebusker/timebusker.github.io
/img/top-photo/0python.py
UTF-8
712
2.609375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # @Author: HUAWEI # @Date: 2022-04-24 20:37:53 # @Last Modified by: HUAWEI # @Last Modified time: 2022-06-02 17:55:42 import os import random path='E:\\timebusker\\timebusker.github.io\\img\\top-photo' #获取该目录下所有文件,存入列表中 lists=os.listdir(path) for file in lists: if file.endswith('...
true
f58aff95e393f988f727816cd426d82a0c758aba
Python
RobertFriebe/dsnd_disaster_response_app
/models/train_classifier.py
UTF-8
7,752
3.21875
3
[ "CC-BY-4.0" ]
permissive
import sys import pandas as pd import numpy as np from sqlalchemy import create_engine import re import time import pickle import nltk nltk.download(['punkt', 'wordnet', 'averaged_perceptron_tagger', 'stopwords']) from nltk.tokenize import word_tokenize from nltk.stem.wordnet import WordNetLemmatizer from nltk.corpus...
true
e9376bf6f55c3ece3e2918598001d7d96d83f6b9
Python
shashidhar0508/python-training
/set2/regular-exp/functions-re.py
UTF-8
827
3.46875
3
[]
no_license
import re # match() m = re.match("abc", "abcabdefg") if m != None: print("Match is available at the beginning of the String") print("Start Index:", m.start(), "and End Index:", m.end()) else: print("not available") # fullmatch() fm = re.fullmatch('abcabdefg', "abcabdefg") print("Full string matched" if fm...
true
5ba0b4f647f2c64032240f9047a71bf30b161955
Python
swarnabarathik/Python
/Practice/pass.py
UTF-8
100
3.21875
3
[]
no_license
x="John" if x=="John": print("Name:",x) elif x=="Joy": pass else: print("Im else")
true
8101b96ac162bbc8a57d8198311f4ce88e775db4
Python
VinceMaes123/Thesis-algorithms
/HMC/alanine-dipeptide/HMC_userDefinedExpressionsAlanineDipeptide.py
UTF-8
5,025
2.78125
3
[]
no_license
#This file contains all distributions, potentials, gradients... that the user of the HMC method should provide #Alanine-dipeptide (united atom description without hydrogen, oxygen molecules and the central subgroup with a carbon) #has 13 degrees of freedom: 4 C-N bond lengths, 2 C-C bond lengths, 2 torsion angles, 2 ...
true
c14397601c9d476107cc5a7cc044813ba2e037af
Python
ArelyL/Sorts
/WordCocktailSort.py
UTF-8
704
3.265625
3
[]
no_license
#!/env/bin/python import random def BubbleSortWords(Lista): k=0 m=0 n=len(Lista) q=0 for i in range(0,n): for j in range(i, n-i-1): if Lista[j+1]<Lista[j]: Lista[j+1],Lista[j]=Lista[j],Lista[j+1] m=1 k+=1 ...
true
d3f5fafbf34b9e5ce2f73686bd245460190d2dc5
Python
JennyIkaMaharani/Python-Projects-Protek
/Praktikum08/pythonProject8.py
UTF-8
269
3.625
4
[]
no_license
#membuat program menghitung rata-rata harga buah buah = {'apel' : 5000, 'jeruk' : 8500, 'mangga' : 7800, 'duku' : 6500} harga = list(buah.values()) #ini membuat list harga dari value #menghitung rata rata rataRata= sum(harga) / len(harga) print(rataRata)
true
01a60f42e7739682347c1e3681032cbbc85c3c11
Python
GuangyuZheng/leet_code_python
/82_Remove_Duplicates_from_Sorted_List_II.py
UTF-8
1,761
3.5625
4
[]
no_license
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: if head is None or head.next is None: return head dummy = ListNode(0) dummy.nex...
true
4b0b534a96a470b7cba693ad1bb6d6e0b205ae8f
Python
leanbarrios/ptrFog
/grafos.py
UTF-8
2,246
3.4375
3
[]
no_license
class Grafo(object): def __init__(self): self.relaciones = {} def __str__(self): return str(self.relaciones) def agregar(grafo, elemento): grafo.relaciones.update({elemento:[]}) def relacionar(grafo, elemento1, elemento2): relacionarUnilateral(grafo, elemento1, elemento2) relacion...
true
6a885c428aa2330b54192e695122c7c65d23378c
Python
davidxbuck/adventofcode
/2016/src/Advent2016_10.py
UTF-8
3,114
3.25
3
[ "MIT" ]
permissive
# Advent of Code 2016 # # From https://adventofcode.com/2016/day/10 import re from collections import defaultdict from math import prod debug = False data = [list(map(int, re.findall(r'\d+', row.strip()))) for row in open('../inputs/Advent2016_10.txt', 'r')] botput = [re.findall(r'(bot|output)', row.strip()) for row i...
true
c549ff21c00af61aab8134b8a8af30fc3dba9548
Python
raubana/Pancake_Script_Tests
/V6/pancake/compiler/op_finder.py
UTF-8
2,072
3.265625
3
[]
no_license
""" The purpose of the op finder is to go through each token and find tokens of type TYPE_OTHER and attempt to find a matching operator. If one of that symbol doesn't exist, an error is raised. """ import ops from tokenizer import Token from constants import * from error_format import error_format OPERATORS = ops.OP...
true
e852a3f1a7863aa6b9da5cf8377aa0239187ffaf
Python
cloudmesh-community/book
/examples/python/kmeans-mapreduce/parallel_kmeans.py
UTF-8
13,939
3.078125
3
[]
no_license
'''This file has code to perform kmeans in a parallel fashion. If the Parallelism parameters is set = 2 it k-means is parallelized If it is set to 1 it is not. Here Parallelism is set to 2''' from scipy.cluster.vq import vq import numpy as np import matplotlib.pyplot as plt def kmeans_gcf(obs, NumClust, iter=20, t...
true
b384483c67a6289ca1313376a309ef7be5a5391d
Python
minhthe/practice-algorithms-and-data-structures
/Heap/max-probability.py
UTF-8
961
3.203125
3
[]
no_license
''' https://leetcode.com/problems/path-with-maximum-probability/ ''' import heapq import collections class Solution: def maxProbability(self, n: int, edges: List[List[int]], succProb: List[float], start: int, end: int) -> float: graph = collections.defaultdict(list) k = 0 for u,v i...
true
9c0bd50d298ed6af62235ae70eb23fedb3c5232d
Python
sbtries/class_pandaaaa
/Code/SarahBeth/function_prac.py
UTF-8
1,150
4.59375
5
[]
no_license
# REPL: # Read-Evaluate-Print # Function anatomy: # def: the def keyword, telling Python we’re about to start a function definition # a name for the function # (: opening parenthesis # (optional) the names of one or more arguments, separated with , # (optional) the names and values of one or more default arguments, se...
true
cdee539feb025e2a50c8dae238292a5d3c573783
Python
dennis2030/leetcodeStudyGroup
/662-maximum-width-of-binary-tree/Sony.py
UTF-8
860
3.40625
3
[]
no_license
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def widthOfBinaryTree(self, root): """ :type root: TreeNode :rtype: int """ if ro...
true
4c60ac68e31a90fcc8e95535bf1c7e9934600cd6
Python
CMunozMontoya/t3-cripto
/t3.py
UTF-8
1,699
3.125
3
[]
no_license
import blowfish import base64 from os import urandom from yattag import Doc def rellenar (text): while len(text) < 8: text = text+"0" return text doc, tag, text = Doc().tagtext() archivo = open("codigo.html","w") #datos---------------- #key = b"abcd1234" #Llave #texto = "hola" while True: tex...
true
93e6af56fd248efa2ea8bdbb87e6144f9025754f
Python
ekck/SQLAlchemy_relationships
/one_to_one.py
UTF-8
514
2.53125
3
[]
no_license
from flask import Flask from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///121rel.db' db = SQLAlchemy(app) class Parent(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(500)) child = db.relationship('Child', ...
true
ce79216bdcc0a670a8c35ed4d4b3e5273e1fa638
Python
suipnice/Moodle_to_ScenariChain
/convert_XML.py
UTF-8
35,774
2.796875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Connvertisseur Moodle XML --> XML Opale ScenariChain""" import xml.etree.ElementTree as ET import re import os from random import shuffle import HTMLParser h = HTMLParser.HTMLParser() def cleanhtml(raw_html): cleantext = raw_html if raw_html is not None: ...
true
096465bd7c7798f47c67ecd6b4e6aa6f5c549aca
Python
ManojDwarsala/AutomationRTA
/timeconfig.py
UTF-8
1,833
3.203125
3
[]
no_license
import pycurl#pycurl is used to access and modify the web page content import sys #sys is used to retrieve the command line arguments import cStringIO #This is used to create a buffer for storing the web page contents import time #this is used to get the localtime localtime = time.l...
true
a5c02e6975e2b1eae157acf9fb345a9bd766df47
Python
GwenIves/Exercises
/rgpwp/chapter3_stack.py
UTF-8
1,129
3.796875
4
[ "MIT" ]
permissive
#!/bin/env python3 class Stack(object): class EmptyStackError(Exception): pass def __init__(self, items=None): if items is None: self.list = [] else: self.list = list(items) def pop(self): try: return self.list.pop() except Index...
true
4563c8fff3893b37130374d8b433cc6153bf6260
Python
FelixTornqvist/DeepCoder-device-management
/protocol_adapter/main.py
UTF-8
1,778
2.5625
3
[]
no_license
import mqtt_adapter as mqtt import coap_adapter as coap import adapter_list import paho.mqtt.client as paho import time connected_adapters = {} ada_useage = adapter_list.adapter_list([]) ada_useage.add(coap.coap_adapter) ada_useage.add(coap.coap_adapter) ada_useage.add(mqtt.mqtt_adapter) def try_all_protocols(ip): ...
true
ab894106f05470604d1fc9a66f9c8f879db42758
Python
aihill/meetup2
/util.py
UTF-8
2,434
2.671875
3
[ "Apache-2.0" ]
permissive
""" Utility functions for pattern recognition examples """ import os import glob import numpy as np import matplotlib matplotlib.use('agg') from matplotlib import pyplot as plt def create_index_files(source_path, train_percent=90, pattern='*'): assert os.path.exists(source_path) train_idx = os.path.join(sour...
true
747f55e1da2c1f3c6204bcb4ebf15a55f89be7c3
Python
mpl-makers-club/bootcamp29Jun21
/testPython.py
UTF-8
87
3.640625
4
[]
no_license
print("hello") for i in range(1, 13): print(str(i) + " times 5 = " + str(i * 5))
true
63fdcceccfe583d4d3ffdb64b0d343c2d42ffd3a
Python
sligocki/busy-beaver
/Code/test_Halting_Lib.py
UTF-8
1,132
2.5625
3
[]
no_license
#! /usr/bin/env python3 import Halting_Lib import unittest import io_pb2 def set_get_big_int(value): big = io_pb2.BigInt() Halting_Lib.set_big_int(big, value) return Halting_Lib.get_big_int(big) class SystemTest(unittest.TestCase): def test_big_int_success(self): self.assertEqual(set_get_big_int(0), 0...
true
00b7812eaa2b4a44e4ad863235210ecb7279c638
Python
Excellentc/HILLEL_LES
/Lesson 7/DZ_18_season.py
UTF-8
720
4.6875
5
[]
no_license
""" Написать функцию season, принимающую 1 аргумент — номер месяца (от 1 до 12), и возвращающую время года, которому этот месяц принадлежит (зима, весна, лето или осень). """ def season(x1): if 0 < x1 <= 2 or x1 == 12: return "Зима" elif 2 < x1 <= 5: return "Весна" elif 5 < x1 <= 8: ...
true
6ae64c4173aaa88aea80f63e0f0d778e1635d82a
Python
fly8764/LeetCode
/Bit Manipulation/268 missingNumber.py
UTF-8
1,431
4.03125
4
[]
no_license
''' 方法一:位运算 0到n一共n+1个数字,取其中的n个数字,给定的索引0到n-1, 异或操作,每个数字和自身异或结果为0,零与其他值异或还等于其他值 所以,补充一个索引,使得索引从0到n完整,然后和数组中的值累积异或, 剩下的值就是缺失元素。 T(n) = n O(n) = o(l) 方法二: 类似于上面的位运算,不过使用的数值求和 做差, 思路源自于 等差数列求和,正常的和为0-n,实际数组缺失一个元素, 两者逐项做差 并求和即可。主要防止 整型溢出。 T(n) = n O(n) = o(l) 方法三: 哈希表 T(n) = n O(n) = o(n) 方法四: 排序 T(n) = nlogn O(n) = o...
true
1a6a6b8457d281f845c444abd23d2fef5434e27b
Python
onkgp/Projects
/Jump To Python/While_170306.py
UTF-8
2,739
4.125
4
[]
no_license
# pylint: disable=C0103 # pylint: disable=C0301 # pylint: disable=C0321 # 반복해서 문장을 수행해야 할 경우 While문을 사용한다. 그래서 While문을 반복문이라고도 부른다. '''기본구조 while <조건문>: <수행할 문장1> <수행할 문장2> <수행할 문장3> while문은 조건문이 참인 동안에 while문 아래에 속하는 문장들이 반복해서 수행된다. ''' # Ex) "열 번 찍어 안 넘어 가는 나무 없다"라는 속담을 만들면 다음과 같다. treeHit = 0 while tr...
true
3c9e651d6a402b24c50770acf69eed3a6fe84756
Python
snapbuy/dialogpt-chat
/dialogpt_chat/dialogpt.py
UTF-8
5,825
3.1875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import torch from transformers import AutoTokenizer, AutoModelForCausalLM class DialoGPT(object): def __init__(self, size, device, max_context_length=48): """ Modeling class for Dialo GPT Args: size (str): model size. must be one...
true
85828d29fc36afd1167485de8bb3b332b8b4ece5
Python
JoeLittell/dockertest
/app.py
UTF-8
1,137
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Feb 1 22:33:57 2020 @author: josep """ import pandas as pd import plotly.express as px import dash import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output terror = pd.read_csv('./terrorism.csv') col_options = [dict...
true
6c5fd9e56e6325d59ccfcaa464b2e3c99d076c0d
Python
rindhaf/praxis-academy
/novice/01-01/latihan/lists.py
UTF-8
122
2.84375
3
[]
no_license
rindha = [1, 2, 5, 6, 8] print (rindha) print (rindha[-3]) print (rindha[4:]) rindha + [10, 18, 19, 20, 21] print (rindha)
true
ded8bd53cda307eca838f6d17050c12f843767a1
Python
takiyu/gtrans-web-gui
/gtransweb_gui/callable_buffer.py
UTF-8
1,328
2.6875
3
[]
no_license
# -*- coding: utf-8 -*- from collections import deque from threading import Timer import time from PyQt5 import QtCore # logging from logging import getLogger, NullHandler logger = getLogger(__name__) logger.addHandler(NullHandler()) class CallableBuffer: def __init__(self): self._query = None # Only n...
true
d8dcf7a99450a214ad586309da0e4393d23a90ad
Python
hugomaiavieira/trabalhos_uenf
/introducao_comp_graf/curvas/teste.py
UTF-8
648
3.046875
3
[]
no_license
# -*- coding: UTF-8 -*- # Autor: Hugo Henriques Maia Vieira import unittest from curvas import Curva from numpy import array, allclose X=0 Y=1 class TesteCurvas(unittest.TestCase): def teste_adicionar_ponto(self): curva = Curva() ponto = array([2,2]) curva.adicionar_ponto(ponto) ...
true
00c7f0fe86ddaa3e1d854c96053a634d6bb3a60b
Python
sbarenfe/AY190
/ws4/ws4.py
UTF-8
983
3.578125
4
[]
no_license
import numpy as np def find_root(guess,omega,t,e): Enew=guess ratio=1. step=0 #expression I am finding the root of: f=lambda x:x-omega*t-e*np.sin(x) #and it's derivative fprime=lambda x:1-e*np.cos(x) #implement Newton's method until convergence while np.abs(ratio) >= 10**(-10): Eold=Enew Enew=Eold-f(Eold)/fp...
true
448c5adb03fe1d5e2f405c354de8cb5519fa67ca
Python
Harvard-University-iCommons/lti_emailer
/mailgun/exceptions.py
UTF-8
748
3
3
[]
no_license
from django.http import HttpResponse class HttpResponseException(RuntimeError): '''Encapsulates a django.http.HttpResponse. Intended to be caught at the top level of a view (or by a view decorator) to allow code within a view to immediately return a response.''' def __init__(self, response): ...
true
85832fc52828557fcfc5596be205506e43b0e431
Python
ornlneutronimaging/IPTS_14382
/image_processing.py
UTF-8
1,188
3.109375
3
[]
no_license
import numpy as np from scipy.ndimage import convolve def gamma_filtering(data_array, threshold=0.1): final_data_array = [] for _data in data_array: _data_filtered = single_gamma_filtering(_data) final_data_array.append(_data_filtered) return final_data_array def single_ga...
true
7eb3969443b1eb83233f8da220a028cdd000871c
Python
yashAgarwal41/Awesome-Projects-Collection
/Amazing Python Projects_Scripts/PomodoroTimer/Pomodoro.py
UTF-8
1,658
3.3125
3
[]
no_license
import time import datetime as dt import tkinter from tkinter import messagebox import winsound tnow=dt.datetime.now() #Current time for reference tpom=25*60 #pomodoro time tdelta=dt.timedelta(0,tpom) #time delta in mins tfur=tnow+tdelta ...
true
855039efa9e1e6f2f938363c5067f8d7b77a2fb3
Python
507-w20-instructors/week10-moredb
/count_unique_limit.py
UTF-8
695
3.578125
4
[]
no_license
''' Write and test queries to get the following data: - Return the number of customers in the North America Region - Return the number of unique Titles held by Customers - Return only the top 3 most heavily stocked Products (those with the largest UnitsInStock values) ''' import sqlite3 conn = sqlite3.connect('North...
true
a9a2e98454353ffbadea5c6d0e368d1ffb6c8b37
Python
rubenvds/SecurLogin
/show_database.py
UTF-8
157
2.71875
3
[]
no_license
import sqlite3 conn = sqlite3.connect('test.db') cursor = conn.execute("SELECT * from `users`") for row in cursor: print(row) conn.commit() conn.close()
true
e64095ba2ec85705540f3ab2f68041a5d08a0e47
Python
odys-z/hello
/hellopy/nlp/try-worldfreq.py
UTF-8
1,299
3.3125
3
[ "MIT" ]
permissive
''' https://pypi.org/project/wordfreq/#description ''' from wordfreq import zipf_frequency, get_frequency_dict ''' f = zipf_frequency('frequency', 'en') print('word: "{0}"\tfrequency: {1}'.format('frequency', f)) ''' d = get_frequency_dict('en', wordlist='best') ''' f = open('e-5 4e-6_.word', 'w') # frequency > 0.0...
true
a7bdcecaf2629bafde5b1eaaf84a9dbc04057ea7
Python
klaus2015/py_base
/爬虫1905/day08/民政部.py
UTF-8
3,759
2.8125
3
[]
no_license
from selenium import webdriver import pymysql class GovSpider: def __init__(self): self.one_url = 'http://www.mca.gov.cn/article/sj/xzqh/2019/' # 无界面模式 options = webdriver.ChromeOptions() options.add_argument('--headless') self.browser = webdriver.Chrome(options=options) ...
true
1939787cfe53bdc5a498bf117232a265d17ebd52
Python
guiwitz/microfilm
/microfilm/tests/test_colorify.py
UTF-8
5,622
2.625
3
[ "BSD-3-Clause" ]
permissive
import matplotlib import numpy as np from microfilm import colorify image = 100*np.ones((3,3), dtype=np.uint8) image[0,0] = 200 image2 = 100*np.ones((3,3), dtype=np.uint8) image2[0,0] = 180 image3 = np.zeros((2,2), dtype=np.int16) image3[0,0] = -10 image3[0,1] = 280 image3[1,0] = 10 image3[1,1] = 100 rgb1 = np.zero...
true
08205190f84ef542bd7c4a36fe1ffee2757e46ff
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2717/60723/246789.py
UTF-8
863
3.171875
3
[]
no_license
def input_manage(temp): temp=temp[2:len(temp)-2] array=temp.split('","') table=[['' for _ in range(3)] for _ in range(len(array))] for i in range(len(array)): table[i][0]=array[i][0] table[i][1]=array[i][1:3] table[i][2]=array[i][3] return table temp=input() array=input_manag...
true
e7e561b3755442c57665a3677f09ef1828db3ea9
Python
sency90/allCode
/coci/2015:2016/contest4_solutions/yoda.py
UTF-8
395
3.375
3
[]
no_license
a = input() b = input() a = str(a) b = str(b) while len(a) < len(b): a = "0" + a while len(b) < len(a): b = "0" + b na = [] nb = [] for i in range(len(a)): na.append(a[i]) nb.append(b[i]) if a[i] < b[i]: na.pop() if b[i] < a[i]: nb.pop() if len(na) == 0: print "YODA" else: print int(""....
true
5b0a85470786edc7aaa8804ab62ff258d973a6a8
Python
WILDCHAP/python_study_std
/python_project_01/九九乘法表.py
UTF-8
342
3.546875
4
[]
no_license
def f1(): ''' 打印九九乘法表 ''' for i in range(1, 10): # i: 1-9 for j in range(1, i + 1): # j: 1-i+1 print("%d * %d = %d " % (j, i, i * j), end='\t') print("\n") f1() def f2(a, b): temp = a a = b b = temp print(a, b) a = 5 b = 6 f2(a, b) print(a, b) name = "...
true
281a2b9d2e92ca3a18506256da0e8ac6b6b218c7
Python
Charles-Wu-Chen/python
/web_scraping/chap2_parsing.py
UTF-8
1,134
2.984375
3
[]
no_license
__author__ = 'charlesw' from urllib.request import urlopen from bs4 import BeautifulSoup from bs4 import re html = urlopen("http://www.pythonscraping.com/pages/warandpeace.html") bsObj = BeautifulSoup(html, "html.parser") nameList = bsObj.findAll("span", {"class":"green"}) #print(bsObj.findAll(id="text")) # this skip...
true
ea8f2c7d5933c330ea38754d5a3bd94c836e1226
Python
AnisTigrini/Python-Snake-Game
/snake.py
UTF-8
7,542
3.828125
4
[]
no_license
# 1) Making the necessary imports. import random import pygame # 2) Gameplay object creation. class Gameplay(): # 3) Constructor for snake and board. def __init__(self): # 3.1) Defining a board of 20 per 20. self.board = [] for x in range(20): myArray = [] ...
true
369a7919e3b7355de503b186bc439578d8c95dc0
Python
tekulvw/Squid-Plugins
/tickets/tickets.py
UTF-8
6,513
2.6875
3
[ "MIT" ]
permissive
from discord.ext import commands from cogs.utils.dataIO import fileIO from cogs.utils import checks from __main__ import send_cmd_help import os class Tickets: def __init__(self, bot): self.bot = bot self.tickets = fileIO("data/tickets/tickets.json", "load") self.settings = fileIO("data/ti...
true
6dbdcfa323a7b702c5cc26d3f62c06104567ffab
Python
hussainmehdi63i/Game-Programing
/Class 1/Problem 4.py
UTF-8
66
2.828125
3
[]
no_license
name= "Mehdi Hussain" print("Mehdi hussain is %s %s" % (name),(Surname))
true
021dc4f05a9e5bc06b8ed61581ad85a1f93263ab
Python
hammer/confluence-observer
/scripts/confluence_observer.py
UTF-8
3,377
2.515625
3
[]
no_license
#! /usr/bin/env python3 import argparse import logging import os from lxml import html import requests LOGIN_URL = "https://hammerlab.atlassian.net/login" STATUS_REPORTS_URL = "https://hammerlab.atlassian.net/wiki/display/MSL/Status+Reports" CONFLUENCE_USERNAME = os.environ.get("CONFLUENCE_USERNAME") CONFLUENCE_PASS...
true
baf025bae20a1c5b61b990d9aa6f5250c40f12ac
Python
VlaKriVia/GeekBrain_HomeWork
/6.py
UTF-8
543
3.8125
4
[]
no_license
starting_num = int(input("Введите начальное количество километров: ")) final_num = int(input("Введите конечное количество километров: ")) count = 1 print(f"{count}-й день: {starting_num:.2f}") while(starting_num <= final_num): count += 1 starting_num *= 1.1 print(f"{count}-й день: {starting_num:.2f...
true
470b40a1c223152c5d2e8fcf1514fc58769b7185
Python
ld-amaya/bluecollar
/album.py
UTF-8
2,918
2.546875
3
[]
no_license
import os import uuid import boto3 from models import db, Album from flask import g from PIL import Image, UnidentifiedImageError from decouple import config BUCKET = config('AWS_BUCKET') BUCKET_URL = config('AWS_OBJECT_URL') ACCESS_KEY = config('AWS_ACCESS_KEY') SECRET_KEY = config('AWS_API_SECRET') s3 = boto3.clien...
true
ed991a916f239998c50727a14120e0bf291f26a8
Python
oReshetitskij/RTOS
/lab3/active_records/entities.py
UTF-8
14,505
2.875
3
[]
no_license
from abc import ABC, abstractmethod class ActiveRecordBase(ABC): @staticmethod @abstractmethod def set_provider(provider): """ set db provider """ @abstractmethod def load_one(self, where): """ load first record from db and assign to self ""...
true
76d5d62d544ca309c7e05057bc4afbb9283f2787
Python
YJSYJSYJS/BJ_Algo
/함수/4673(old).py
UTF-8
678
3.3125
3
[]
no_license
self_list = [False] + [True] *10000 def f(num): temp = str(num) std = len(temp) if std == 1: return 2*num if std == 2: return 11*temp[0] + 2*temp[1] if std == 3: return 101*temp[0] + 11*temp[1] + 2*temp[2] if std == 4: return 1001*temp[0] + 101*temp[1] + 11*temp[2...
true
a8fb1b9f2248ca180825c59044ab4242362418e3
Python
nehamehta2110/Dynamic-Programming
/subset_sum.py
UTF-8
565
3.453125
3
[]
no_license
def subset_sum(arr, n, sum): if sum == 0: return True if n == 0: return False dp = [[False for i in range(sum + 1)] for i in range(n + 1)] if arr[n - 1] <= sum: dp[n][sum] = subset_sum(arr, n - 1, sum - arr[n - 1]) or subset_sum(arr, n - 1, sum) return dp[n][sum] e...
true
8af2454ec207349849b0bc53cfbebc3ee1285a5a
Python
bd5105625/DataScience_Hw4
/dsai_hw4.py
UTF-8
12,715
2.828125
3
[]
no_license
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) # Input data files are available in the read-only "../input/" directory # For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory import os # You can w...
true
a378e9c2c74c53d7085137fdd29d5d976f3cbdcb
Python
asch/python-course
/03/d_occurrences.py
UTF-8
313
3.671875
4
[]
no_license
#!/usr/bin/env python3 """ Occurrences. """ import sys def usage(): """ Usage. """ print(f"Usage: {sys.argv[0]} <STRING>") if __name__ == "__main__": if len(sys.argv) != 2: usage() exit() WORD = sys.argv[1] for x in {c for c in WORD}: print(WORD.count(x))
true
e581373cce1ddd5166fa1622567c2a287f41d596
Python
wljave/subentry
/test/randoms.py
UTF-8
1,523
4.4375
4
[]
no_license
import random # 调用random模块 a = random.random() # 随机从0-1之间抽取一个小数 print(a) a = random.randint(0, 100) # 随机从0-100之间抽取一个数字 print(a) a = random.choice('abcdefg') # 随机从字符串/列表/字典等对象中抽取一个元素(可能会重复) print(a) a = random.sample('abcdefg', 3) # 随机从字符串/列表/字典等对象中抽取多个不重复的元素 print(a) items = [1, 2, 3, 4, 5, 6] ...
true
b68dcb504b61464c435d10663af8c19201da5d80
Python
jonasracine/small_homework
/solution2.py
UTF-8
251
3.171875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt pi = 3.141592653589793 x=np.linspace(-pi, pi, 100) p1 =plt.plot(x,np.sin(x),'r-')#red line p2 =plt.plot(x,np.cos(x),'b-') plt.legend((p1[0], p2[0]), ('sin(x)', 'cos(x)')) plt.xlabel('x') plt.show()
true
8ebdbfbd7e903c95f31caa2f2f952ca6e2e83a4c
Python
meethu/LeetCode
/solutions/0191.number-of-1-bits/number-of-1-bits.py
UTF-8
627
3.75
4
[]
no_license
# 除 K 取余数 # class Solution(object): # def hammingweight(self, n): # """ # :type n: int # :rtype: int # """ # result = 0 # while(n): # result += n % 2 # n = n >> 1 # return result # 位运算 class Solution(object): def hammingweight(self...
true
e0386decfc0c1f83c1b4bf3c11a3752605adb147
Python
Fondamenti18/fondamenti-di-programmazione
/students/1795982/homework03/program03.py
UTF-8
7,352
3.546875
4
[]
no_license
''' Definiamo adiacenti di un pixel p di un immagine i pixel adiacenti a p in orizzontale o in verticale. Se un pixel e' sul bordo dell'immagine il suo vicinato non comprende i pixel non contenuti nell'immagine. Il pixel dell'immagine con coordinate(x,y) ha dunque come adiacenti i pixel con coordinate (x-1,y...
true
0a7ab806b0877ad9c65b7c66103953ea567f431a
Python
abuyck98/cssi
/random-numbers.py
UTF-8
345
4.03125
4
[]
no_license
import random print(random.randint(1,10)) #random refers to the library random di_thing_1 = random.randint(1, 6) di_thing_2 + random.randint(1, 6) if(di_thing_1 == di_thing_2): print('Doubles! Move {0} spaces and roll again'.format(di_thing_1 * 2)) else: print('Move {0} spaces. Next player\'s turn!'.format(d...
true
027d5c1c0eda5fe86d1c4f1332346dcdff6e5b7d
Python
nikhilk/nbcli
/nbcli/__init__.py
UTF-8
1,328
2.828125
3
[ "Apache-2.0" ]
permissive
# __init__.py # Declaration of the nbcli module. from _cli import CommandLineInterface def create(name, modules, description=None): """A helper function to create a CommandLineInterface along with its commands. This registers a kernel '%magic' handler, using the specified name that supports both single line an...
true
71d94498e4a1d369f76f3cbc943e2460c5bda3ea
Python
Amit05/python
/dht_verify.py
UTF-8
362
2.515625
3
[]
no_license
#!/usr/bin/python #Get the hash value of a file. import ctypes import sys glusterfs = ctypes.cdll.LoadLibrary("libglusterfs.so.0") def gf_dm_hashfn(filename): return ctypes.c_uint32(glusterfs.gf_dm_hashfn( filename, len(filename))) def if __name__ == "__main__": hash_val=hex(gf_dm_hash...
true
c29fb3091fb659d72c34708d721570aa6df04e6b
Python
Aasthaengg/IBMdataset
/Python_codes/p03854/s978558633.py
UTF-8
106
2.984375
3
[]
no_license
import re s = input() if re.match("(dreamer|dream|eraser|erase)+$",s): print("YES") else: print("NO")
true
3210f988c6a4027187c7e04723befe772eab20ec
Python
ysk1026/AI-laerning
/2일차/dictExam01.py
UTF-8
1,309
4.375
4
[]
no_license
# dictExam01.py # 사전(dict) : 키와 값으로 구성되어 있는 데이터 구조 # 중괄호를 사용합니다. # 키와 값은 콜론으로 구분하고, 항목들은 콤마로 구분한다. # 예시: {키1:값1, 키2:값2, 키3:값3, ...} # 순서를 따지지 않는 자료 구조 # 관련 함수 : dict() # 함수 : get(키, 기본값), clear(), del() mydict = {'name':'홍길동', 'phone':'01011112222', 'birth':'12/25'} # 읽기 : 사전 이름에 '키'를 넣어 주면 '값'을 구할수 있습니다. p...
true
a49723db08ad771031cc5e41de61e564b2db652e
Python
theoctober19th/tn-python-django-bootcamp-5
/day2/csv_classwork.py
UTF-8
200
3.015625
3
[]
no_license
import csv with open('email.csv') as file: reader = csv.DictReader(file, delimiter=';') for row in reader: if row['Last name'][0].lower() == 'j': print(row['Login email'])
true
56cc6a1b3553730377adf8eac76d343b2ca15106
Python
gama79530/DesignPattern
/CommandPattern/python/Receiver.py
UTF-8
1,756
3.625
4
[ "MIT" ]
permissive
import abc class Receiver(metaclass=abc.ABCMeta): @abc.abstractmethod def on(self) -> bool: return NotImplemented def off(self) -> bool: return NotImplemented class Fan(Receiver): _MAX_SPEED:int = 5 def __init__(self) -> None: super().__init__() s...
true
e3b8e077337692eead00f504ab92f00d7adac482
Python
ivoryli/myproject
/class/phase1/day09/code02.py
UTF-8
309
3.34375
3
[]
no_license
class Wife: def __init__(self,name,age): self.name = name #缺点:缺乏对象数据的封装,外界可以随意赋值 self.age = age class Wife: def __init__(self,name,age): self.name = name self.__age = age w01 = Wife("芳芳",26) w01 = Wife("铁锤",74)
true
5ac2f2236c12fa4aa5986c6a1793de9416801342
Python
manornot/HomeWorks
/Third.py
UTF-8
116
2.78125
3
[]
no_license
# HW nr 3 # your task is to print txt in normal order txt = "?em daer uoy dluoc ,txet detrever si siht" print(txt)
true
02845a38efe241fa6f1cfdc14e6c6ba84065da39
Python
ApoorvaSaxena1/Python-Distributed-Web-server
/Level 2/src/servernew.py
UTF-8
17,903
2.515625
3
[]
no_license
#=============================================================================== # # Contributors: # Prabhat Bhatt # Apoorva Saxena #=============================================================================== import time import threading import socket from thread import * from Queue import Queue ThreadLock ...
true
46a23a770161b93cc23f215ae17b5e9b0b987319
Python
packtaamira/Learn-Discrete-Mathematics
/Chapter 3/Hexadecimal_BinaryConversionExample.py
UTF-8
395
4.875
5
[ "MIT" ]
permissive
# TypeConversion from decimal with base 10 # to hexadecimal form with base 16 # to binary form with the base 2 # Taking input from user an integer with base 10 number = int(input("Enter a number with base 10\n")) print("Hexadecimal form of " + str(number) + " is " + hex(number).lstrip("0x").rstrip("L")) print("Binar...
true
84120150ebd173881246eb39d10bf69e14a2e6bc
Python
smcl/raytrace
/test/test_dot.py
UTF-8
314
2.875
3
[]
no_license
import pytest from rt import Vec3 def test_dot_one(): v = Vec3(3, 0, 2) w = Vec3(-1, 4, 2) assert 1 == v.dot(w) def test_dot_two(): v = Vec3(1, 3, -5) w = Vec3(4, -2, -1) assert 3 == v.dot(w) def test_dot_three(): v = Vec3(0, 3, -7) w = Vec3(2, 3, 1) assert 2 == v.dot(w)
true
23f0a22d2556d9926a95b3e7305f53c7da550fad
Python
akshayrajp/Competitive-Programming
/Xtreme14/hamm.py
UTF-8
527
2.953125
3
[]
no_license
def hamdist(str1, str2,prevMin=None): diffs = 0 if len(str1) != len(str2): return max(len(str1),len(str2)) for ch1, ch2 in zip(str1, str2): if ch1 != ch2: diffs += 1 if prevMin is not None and diffs>prevMin: return None return diffs dmin=len(tran...
true
811fc092195903a54bc3dd1c0688df2ee06ed274
Python
elicaciocdefarias/estruturas-de-dados
/tests/test_single_linked_list.py
UTF-8
2,776
3.703125
4
[]
no_license
from single_linked_list import SingleLinkedList def test_should_have_property_called_head(): sll = SingleLinkedList() assert hasattr(sll, "head") def test_should_sets_head_node_when_equal_none(): value = "head node" sll = SingleLinkedList() sll.add(value) assert sll.head.value == value d...
true
bb59a6ebbfbc2554954d46af62bc09ac7ae6b6df
Python
andremtsilva/dissertacao
/src/sim/basicExampleTest/aco_test01.py
UTF-8
1,150
3.234375
3
[ "MIT" ]
permissive
import networkx as nx import numpy as np import acopy import random RANDOM_SEED = 1 def main(): """ Topology """ # Fix position of nodes for drawing random.seed(RANDOM_SEED) np.random.seed(RANDOM_SEED) size = 10 G = nx.complete_graph(size) for (u, v) in G.edges():...
true