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 |
|---|---|---|---|---|---|---|---|---|---|---|
f7f2c72d5a05e3831bcac2a2fbd73f3b0cce9c1d | Oscark45/Solar-system-simulator | /Test - Single time.py | UTF-8 | 2,283 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun May 24 10:51:18 2020
@author: Oscar
"""
# -*- coding: utf-8 -*-
# file_name.py
# Python 3.6
"""
Author: Oscar Kaatranen
Created: % 11/08/2019 $
Modified: % (date) $
Description
Make an arbitrary one sun test.
"""
import numpy as np
impor... | true |
c00d6f17f6786097ce4d027a82e97b2d1ae6a9b3 | matomic/cancer_detection | /unet/utils.py | UTF-8 | 5,663 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''Utility functions'''
from __future__ import print_function
from __future__ import division
import collections
import functools
import simplejson as json
import pandas as pd
import numpy as np
# debugging
#from pprint import pprint
#from ipdb import set_trace
# TODO: write a proper pyline ... | true |
b5ead5724223aa75a12f6e8d88c07e3348231d4c | griimick/feature-mlsite | /app/static/hindi-dependency-parser-2.0/hindi-pos-tagger/bin/lemmatiser.py | UTF-8 | 1,258 | 3.140625 | 3 | [
"GPL-1.0-or-later",
"LicenseRef-scancode-proprietary-license",
"MIT"
] | permissive | #!/usr/bin/env python
'''
Usage: python lemmatiser.pl lemmaFile < input > output
The input should have two colums
<html>
word1 tag1
word2 tag2
.
'''
import sys
import re
lemmaDict= {} # word : { pos : lemma}
def loadLemmatiser(file):
for line in open(file):
line=line.strip()
word= line.split('\t... | true |
99ba69ca138b2aea3ae38adf9379fa6f8f42adec | xjhuang1993/PythonExercise | /leetcode/039.Combination Sum/common.py | UTF-8 | 474 | 3.46875 | 3 | [] | no_license | """
Accepted
"""
def func(nums, target):
nums.sort()
result = []
dfs(nums, target, 0, [], result)
return result
def dfs(nums, target, index, path, result):
if target < 0:
return
if target == 0:
result.append(path)
return
for i in range(index, len(nums)):
d... | true |
11cbc5dd7dfe2ee0632ae945d3464b7bc3bdf261 | eam17/anki-deck-generator | /imagefinder.py | UTF-8 | 4,400 | 3.140625 | 3 | [] | no_license | # Using dataframes
import pandas as pd
# Allows to execute system commands
import os
# Find and image matching to a keyword
from google_images_search import GoogleImagesSearch
from google_images_download import google_images_download
from simple_image_download import simple_image_download
# User class for ensuring b... | true |
c60e138a5bc6b9f13bb8dafb9a86482421a903a4 | sullins2/Clean | /LONRGeneral/GridWorld.py | UTF-8 | 11,691 | 2.625 | 3 | [] | no_license |
import numpy as np
from LONRGeneral.LONR import *
class Grid(MDP):
"""Creates GridWorld
Grid is referenced by single index, starting from upper left corner.
Example grid indices:
-------------------------
| 0 | 1 | 2 | 3 |
| | | | |
-----... | true |
461674d60d82137b0b403789872ca7625186df8c | adalee2future/learn-python | /using_tuples_as_keys_in_dictionaries.py | UTF-8 | 220 | 2.828125 | 3 | [] | no_license | directory = dict()
directory[('Ada', 'Lee')] = 15002685885
directory[('Xin', 'Chen')] = 18794810671
directory['Yangshun', 'Lee'] = 13960764457
for last, first in directory:
print first, last, directory[last, first] | true |
f8b3812d64c7cf112bc2c9239718560bbae75b49 | TimHachi/data-agreement | /utils/filter.py | UTF-8 | 623 | 2.796875 | 3 | [
"MIT"
] | permissive | import keywords
import re
def filter_text(text_dict, regular_expression):
result = []
for id,entry in text_dict[keywords.root].items():
if re.search(regular_expression,entry[keywords.text]) is not None:
result.append(id)
return result
def filter_metadata(text_dict, metadata_field, regu... | true |
2b7c053ec9b40328b442fb37a703026a120a4d38 | Luvz2Fly/pyVowels | /backwards.py | UTF-8 | 568 | 4.21875 | 4 | [] | no_license | # Take an input and make it print out backwards
def loop():
# data = input("Type something here and I will print it backwards: ")
# backwards = list(data)
# backwardsOutput = ''.join(backwards[::-1])
# print(backwardsOutput)
# Slim it down...
data = input("Type something here and I will print ... | true |
a21385254ca031fd408c9202a6b9e812e0b0ba0f | chaojunhou/LeetCode | /Algorithm/Python/reverse_linked_list_ii.py | UTF-8 | 979 | 3.515625 | 4 | [] | no_license | class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param {ListNode} head
# @param {integer} m
# @param {integer} n
# @return {ListNode}
def reverseBetween(self, head, m, n):
pre=dummy = ListNode(-1)
dummy.next = head
co... | true |
c7b856adf0a83e56512c9324ea9da568983973d7 | zahedul/python-practice | /hackerrank/incorrect-regex.py | UTF-8 | 200 | 3 | 3 | [] | no_license | import re
t = int(input())
for _ in range(t):
regex_pattern = input()
try:
re.compile(regex_pattern)
except Exception as e:
print('False')
else:
print('True') | true |
790ae3904172197f35c2f96af568887a040d8dcf | makometr/piaa_9383 | /Sosedkov/lab4/Source/lab4_cycle.py | UTF-8 | 824 | 3.34375 | 3 | [] | no_license | import time
import sys
def prefix_function(s):
p = [0]*len(s)
for i in range(1, len(s)):
k = p[i-1]
while k > 0 and s[i] != s[k]:
k = p[k-1]
p[i] = k+1 if s[i] == s[k] else k
return p
def kmp(string, sub_string):
prefix_function_table = prefix_function(string)
sub_string_index = 0
stri... | true |
95b2c2d65133fb6764af74c31bb94d856ac74907 | keimi/CursoRedesNeuronales | /tarea04/genetic_ch_tree.py | UTF-8 | 869 | 2.640625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from genetic import Genetic
from genetic import FitChTree
from chiffres_tree import ChNode
gen_size = 8
pop_size = 100
max_generation = 300
# answer = np.array([random.randint(0, 1) for i in range(vec_size)])
fit_class = FitChTree(347)
ChNode.number_set = [10, 1, 25,... | true |
e128073d427dc1d1311dda795a80d6ac38b82cb6 | xjxafj/Work | /代码/python/xml模块.py | UTF-8 | 2,733 | 3.359375 | 3 | [] | no_license |
#_*_coding:utf-8_*_
# created by fujia on 8/19/18
import xml.etree.cElementTree as ET
'''
root=ET.Element("rootName") :创建根节点
child_node=ET.SubElement(root,"book",{"id":"1","name":"name1"}):创建子节点,并添加属性
child_node.text="text1" :为节点赋值
root.findall("book") :寻找root节点下book节点
--root.findtext("book") :寻... | true |
2dbc9b86e85afacf89e2beadaf3ed2577835d42a | BjornChrisnach/Pinterest_course_GUI | /listwidgetex/listwidgetex.py | UTF-8 | 1,349 | 2.796875 | 3 | [
"MIT"
] | permissive | from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QListWidget, QLabel
import sys
from PyQt5.QtGui import QIcon, QFont
class Window(QWidget):
def __init__(self):
super().__init__()
self.create_ui()
def create_ui(self):
self.setWindowTitle("PyQt5 ListWidget")
self... | true |
286d56a30a116f6744fbcb4a849a50792126af5a | tanbir/miniDLF | /miniDLF/losses/loss.py | UTF-8 | 636 | 2.609375 | 3 | [] | no_license | import numpy as np
from .cce import CCE
from .bce import BCE
from .mse import MSE
class Loss(object):
def __init__(self, type='mse'):
if type == 'mean_squared_error' or type == 'mse':
self.obj = MSE()
elif type == 'categorical_crossentropy' or type == 'cce':
... | true |
98560aebe58e93809bd8ec23ebbe6d15b3061e03 | TobiasRohner/ApproximateReversibleCircuits | /functions/func_6sym.py | UTF-8 | 218 | 2.90625 | 3 | [] | no_license |
class Func6sym:
def __init__(self):
self.input_size = 6
self.output_size = 1
def __call__(self, n):
popcnt = bin(n).count('1')
return int(popcnt==2 or popcnt==3 or popcnt==4)
| true |
efd2ae0fb81bc2aa25a8942eba1e55394dce4be2 | lucasdavid/wikiart | /wikiart/converter.py | UTF-8 | 3,069 | 2.6875 | 3 | [
"MIT"
] | permissive | """WikiArt Metadata Converter.
Author: Lucas David -- <ld492@drexel.edu>
License: MIT License (c) 2016
"""
import json
import os
from . import settings
from .base import Logger
class WikiArtMetadataConverter:
"""WikiArt Metadata Converter.
Converts json files downloaded from WikiArt to a more more friendl... | true |
33ce0259419075f7da02d65dc71ea38b356619e0 | zcx1218029121/CmdMoFish | /src/App.py | UTF-8 | 727 | 2.546875 | 3 | [] | no_license | from Context import Context
from Route import Route
from view.ViewGroup import ViewGroup
class App(ViewGroup):
context = None
run = True
def on_creat(self, param):
route = Route()
context = Context()
route.attach_context(context)
context.set_route(route)
self.conte... | true |
c0fce821f9e6ba0db1bc20b16f5c9472c4c97c6f | Ale1Casta/ProgrammingLab | /Classe.py | UTF-8 | 500 | 2.578125 | 3 | [] | no_license |
# oggetto CSVFile
# - init(filename)
# - name
# - get_data()
# return dati
class CSVFile:
def __init__(self, name):
self.filename = name
def get_data(self):
return [1,2,3,4]
mio_file = CSVFile(name='shampoo_sales.csv')
print(mio_file.name)
print(mio_file.get_data())
<<<... | true |
35ec15abd93f006ea2795838dcbcf30d69167c63 | Cactusson/puzzle | /data/states/transition.py | UTF-8 | 2,967 | 2.578125 | 3 | [] | no_license | import pygame as pg
import random
from .. import prepare, tools
from ..components import colors
from ..components.animation import Animation
from ..components.calc import Calc
class Transition(tools._State):
def __init__(self):
tools._State.__init__(self)
self.animations = pg.sprite.Group()
... | true |
8d5180207c346e717af5edf77ced3134aa3562bf | zhangzibin/dual_learning | /src/data_util.py | UTF-8 | 4,638 | 2.625 | 3 | [
"MIT"
] | permissive | import os
import math
import numpy as np
from random import sample
from collections import Counter
import nltk
def get_vocab_from_file(filename):
with open(filename) as f:
idx2word = ['<pad>', '<unk>']
idx2word += [w.strip() for w in f.readlines()]
word2idx = dict([(w, idx) for idx,w in enu... | true |
06789d8cea6e018cce8de5f5a0d5b4b0778876b4 | 0as1s/leetcode | /1254_number_of_closed_islands.py | UTF-8 | 1,345 | 3 | 3 | [] | no_license | class Solution(object):
def closedIsland(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
nums = 0
visited = set()
from queue import deque
for i in range(len(grid)):
for j in range(len(grid[0])):
if (i,j) not in ... | true |
c527544ee58d9036f41d4d8b0655f06b41fe6958 | Bruck1701/CodingInterview | /Arrays/Codility/countingElements.py | UTF-8 | 675 | 2.875 | 3 | [] | no_license | def solution(N, A):
A = [x-1 for x in A]
# print(A)
dicio = {k: 0 for k in range(N)}
# print(dicio)
largest = 0
startLine = 0
for inst in A:
#print(inst, dicio)
if inst < N:
if dicio[inst] < startLine:
value = 1+startLine
else:
... | true |
a8d405d54013401217157f54f38f6de2ccb0c054 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_97/953.py | UTF-8 | 660 | 3.03125 | 3 | [] | no_license | #python32
#coding = utf-8
def cal0(a,x,y):
ans = []
for i in range(len(a)):
b = int(''.join(a[i:])+''.join(a[:i]));
if b>=x and b<=y:
ans.append(b)
return list(set(ans))
def cal(a,b):
rec = []
ans = 0
for i in range(a,b+1):
if i not in rec:
ns = list(str(i))
t1 = cal0(ns,a,b)
... | true |
c87d116399accfd03a3e2876bb5bd28693897f27 | RobertWW/ProjectEuler | /Desktop/problem6.py | UTF-8 | 280 | 3.484375 | 3 | [] | no_license | triples = [[1,2,3]]
a = 0
b = 1
c = 2
for a in range(1000):
a += 1
print a
for b in range(1000):
b += 1
for c in range(1000):
if (a + b + c == 1000 and (a < b) and (b < c) and (a**2 + b**2 == c**2)):
triples.append([a,b,c])
break
else:
c+= 1
print triples | true |
6dc87a83bbfc396f3ab10a105e739891388d185c | xp-zhao/learn-python | /leetcode/linked/removeNthFromEnd.py | UTF-8 | 659 | 3.359375 | 3 | [] | no_license | from leetcode.linked.Node import Node
class Solution:
def removeNthFromEnd(self, head: Node, n: int) -> Node:
cur = head
result = head
count = 0
while head is not None:
count += 1
head = head.next
if count == n:
return cur.next
wh... | true |
e6fcdf73cb4b7bac5759197f28cbef0a0baac60f | Boya-Z/CS540 | /p1_weather.py | UTF-8 | 2,179 | 3.46875 | 3 | [] | no_license | # import the math module
import math
#return the Euclidean distance between two dictionary data points from the data set.
def euclidean_distance(data_point1, data_point2):
x1 = math.pow(data_point1.get('PRCP') - data_point2.get('PRCP'), 2)
x2 = math.pow(data_point1.get('TMAX') - data_point2.get('TMAX'), 2)
... | true |
6743af60c024527712e2030abb8957bc736f7ac6 | benwei/Learnings | /pySamples/testvars.py | UTF-8 | 204 | 3.03125 | 3 | [] | no_license | #!python
class a(object):
#__dict__ = ['a', 'b']
b = ''
def show():
print 'a'
# pydoc vars
#vars() -- Help on built-in function vars in module __builtin__:
print vars(a)
print dir(a)
| true |
38b4135af0065e2020220567620ad04e91cc3d42 | abelcarreras/WFNSYM | /python/wfnsympy/errors.py | UTF-8 | 800 | 2.984375 | 3 | [
"MIT"
] | permissive | class MultiplicityError(Exception):
def __init__(self, multiplicity, total_electrons):
self._multiplicity = multiplicity
self._electrons = total_electrons
def __str__(self):
return 'Multiplicity {} incompatible with {} electrons'.format(self._multiplicity,
... | true |
e6686ad49284096162d2731f097988f303ef196a | Hyoukjoo/study-algo | /backjoon/1712.py | UTF-8 | 112 | 3.109375 | 3 | [] | no_license | a, b, c = map(int, input().split())
if b >= c:
print(-1)
else:
n = a // (c - b)
n += 1
print(n) | true |
fe8d26e0ccb851a23ceec22d5ed58165d5ed09de | jingmian/PHP-Interview | /爬虫脚本/boss.py | UTF-8 | 2,038 | 2.609375 | 3 | [] | no_license | import requests
from pyquery import PyQuery as pq
headers = {
"x-requested-with":"XMLHttpRequest",
"user-agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"
}
session =requests.session()
def fetch_list(url):
res... | true |
a37758f321df59ffadf8b2b0fb21b386228829d3 | Gwanghun-Im/algorithm_study | /5251_최소이동거리/sol1.py | UTF-8 | 529 | 2.90625 | 3 | [] | no_license | import sys
sys.stdin = open("sample_input.txt")
T = int(input())
for tc in range(1, T+1):
n, e = map(int, input().split())
arr = [[0 for _ in range(n+1)] for _ in range(n+1)]
dis = [float('inf')] * (n+1)
dis[0] = 0
for i in range(e):
a, b, w = map(int, input().split())
arr[a][b] =... | true |
665875c99f0ac83a2b78d4d09d02cc990a8c1092 | anniejw6/art_flask | /app/models.py | UTF-8 | 2,400 | 2.65625 | 3 | [
"MIT"
] | permissive | from app import db
class Art(db.Model):
__tablename__ = 'art'
id = db.Column(db.Integer, primary_key=True)
image_path = db.Column(db.String(300), unique=True)
title = db.Column(db.String(500))
responses = db.relationship('Response', backref = db.backref('art'))
def __init__(self, image_path, title):
self.ima... | true |
5d59a1b4c50407d1538b30355e223453fc14bdca | lucastorress/FUP_UFC2016_1 | /Lista 5 - Matrizes/Lista05-7.py | UTF-8 | 553 | 3.640625 | 4 | [] | no_license | #Author: Lucas Pereira Torres de Araujo
#Lista 5 - FUP's Class - 2016.1
#Item 7
#linhaXcoluna
#l eh linha
#c eh coluna
m = [[int(input("Digite um elemento para posicao "+str(l+1)+"x"+str(c+1)+": ")) for c in range(4)] for l in range(4)]
#m = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
diagonals = []
... | true |
a287af76a5a62a0a0452b3f6dea6b87c1404107d | SKaplanOfficial/Aria | /cmds/site.py | UTF-8 | 510 | 3.171875 | 3 | [
"MIT"
] | permissive | """
Site
Last Updated: March 8, 2021
"""
import subprocess
import webbrowser
class Command:
def __init__(self, *args, **kwargs):
print("Opening website...")
def execute(self, str_in, context):
url = str_in[5:]
if url is None or url == "":
url = "https://www.google.com"
... | true |
8b654658b7238b7f23906a22ca77f472c6f919db | vanechipi/Python-BeautifulSoup-Sqlite-Tkinter | /Practice-with-Python/p1_cadenas.py | UTF-8 | 1,078 | 3.546875 | 4 | [] | no_license | #encoding: utf-8
'''
Created on 19/2/2015
@author: Vanessa
'''
def separar(var, separador):
print separador.join(var)
if __name__ == "__main__":
separar("separacion",",")
def reemplazar(var, separador):
lista = var.split()
print lista
print separador.join(lista)
if __name_... | true |
075b42a07c346f26b6836085f0b58bed320b6138 | GeekHomeInside/mandelbrot-python | /main.py | UTF-8 | 1,789 | 3.515625 | 4 | [] | no_license | from PIL import Image, ImageDraw
class Param:
def __init__(self):
# Max iteration
self.maxit = 1000
# Image size (pixels)
self.width = 800
self.height = 800
# Define Real
self.re_start = -2
self.re_end = 2
# Define Image
self.im_start ... | true |
271fc54837ab023e17cdd98e46feb14add85b774 | MathiasThor/ros_blinkstick_square_driver | /nodes/blinkstick_square_node.py | UTF-8 | 1,007 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function, division
import rospy
from std_msgs.msg import Int16, String, ColorRGBA
from blinkstick import blinkstick
class blinkstickDriver(object):
def __init__(self):
try:
self.bstick = blinkstick.find_first()
except:
r... | true |
6a037fae4814c1ea26728571f676d7802d57868d | lavanya066/python-codes | /good.py | UTF-8 | 944 | 4 | 4 | [] | no_license | # A Dynamic Programming based function
# to count decodings
def countDecodingDP(digits, n):
count = [0] * (n + 1); # A table to store
# results of subproblems
count[0] = 1;
count[1] = 1;
for i in range(2, n + 1):
count[i] = 0;
# If ... | true |
a0fa1fc38d26ff8402fae12753e88a9333c32573 | Remruts/computer-vision | /practica-1/ejercicio1a.py | UTF-8 | 1,036 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import cv2
import numpy as np
## Ejercicio 1a
def sum_images(img1, img2):
return img1 + img2
def subtract_images(img1, img2):
return img1 - img2
def multiply_images(img1, img2):
return img1 * img2
def main(argv):
if (len(argv) < 3 or int(argv[0]) > 2 or ... | true |
639d6cdf159982a58751fa3047e0d732a1a4ca1e | rekabat/Shards-Unnamed | /tools/mm.py | UTF-8 | 36,092 | 2.96875 | 3 | [] | no_license | '''
1 -> select tileset
2 -> set map dimension
ctrl + s -> save map
ctrl + o -> load map
~ctrl + n -> new map
f -> fill
~g -> turn on/off gridlines
~d -> demo mode
~b -> fill borders
left/down -> down z level
right/up -> up z level
ESC -> exit
(on tileset)
left click -> select a tile (unblocked)
right click -> s... | true |
bb9425f9a9f07492aca461bbd3a3c1666fe3b1df | LehighCSE375-AJM/hindsight-experience-replay | /server.py | UTF-8 | 2,481 | 2.71875 | 3 | [
"MIT"
] | permissive | import argparse
import socket
import gym
import pickle
from _thread import *
from communication_consts import BYE_CMD, COMPUTE_REWARD_CMD, GET_ACTION_SPACE_CMD, GET_MAX_EPISODE_STEPS_CMD, MAKE_ENV_CMD, PORT, RENDER_CMD, RESET_ENV_CMD, SEED_CMD, STEP_CMD
ADDR = socket.gethostname()
parser = argparse.ArgumentParser()
p... | true |
6c1a98c4e525365e4bc5d5acb2450834a4fcdf8a | cleancoindev/Qurry | /qurry/kernel/library.py | UTF-8 | 773 | 2.53125 | 3 | [
"MIT"
] | permissive | from importlib import import_module
class Library:
def __init__(self, name):
#module = import_module('.{}'.format(name), 'qurry.libraries')
#print(module)
## load constructs
#self.constructs = module.constructs
print('Loaded ' + name)
self.constructs = import_modul... | true |
f59d19e47ac7b9a941b95da24200a11ab547cf15 | gabriellaec/desoft-analise-exercicios | /backup/user_392/ch67_2019_06_06_22_32_38_644922.py | UTF-8 | 250 | 3.046875 | 3 | [] | no_license | def alunos_impares(lista_alunos):
lista_alunos = []
alunos_impares = []
i = 0
n = len(lista_alunos)
while i < n:
if i%2 != 0:
alunos_impares.append(lista_alunos[i])
i += 1
return alunos_impares
| true |
0e5e6fd4832a6e734efc039da865c450b53302c5 | manoharkakumani/Mano | /dont_know_ip/host.py | UTF-8 | 17,205 | 2.640625 | 3 | [
"MIT"
] | permissive | #copyright © 2019-2021 manoharkakumani
import socket
import sys
import os
import threading
import time
import shutil
import cv2
import pyautogui
import pickle
import struct
import numpy as np
from queue import Queue
THREADS = 2
proc = [1, 2]
queue = Queue()
allconnections = []
alladdress = []
#banner
print("**********... | true |
244cf899d564ea3bf3178f3096d40aa3c5280e19 | kamil-sladowski/tmp-repo | /arduino_grpc.py | UTF-8 | 283 | 3.171875 | 3 | [] | no_license | import serial
from time import sleep
arduinoData = serial.Serial('/dev/ttyS2', 9600, timeout=5)
def ledOn():
arduinoData.write(b'1')
def ledOff():
arduinoData.write(b'0')
i = 0
print("start")
while i < 10:
print(i)
ledOn()
sleep(1)
ledOff()
sleep(1)
i +=1
print("end")
| true |
eca3f3325556bdb864b6676608c7ac128241eec2 | XoulKool/Parallel-Word-Count | /MasterFiles/master.py | UTF-8 | 5,029 | 2.90625 | 3 | [] | no_license | import socket # Import socket module
import time
import sys
from send import Sender
from receive import Receiver
import pickle
import os
import time
from multiprocessing import Process, Pipe
from collections import Counter
#Lucy edited this
NUMPROCESSES = 3
'''
Function which the Process import tar... | true |
908966f6c24803eca21bc7523ee3149523ef6d57 | brinhosa/google-scholar-network-scraping | /ScholarCoauthorWeb.py | UTF-8 | 8,247 | 2.5625 | 3 | [] | no_license |
import requests
import re
import igraph
import cairocffi
import unicodedata
from unidecode import unidecode
from bs4 import BeautifulSoup
def get_article_links(url):
profile_url = url
r = requests.get(profile_url)
soup_profile = BeautifulSoup(r.content, "html.parser")
print(soup_profile)
d... | true |
21cb977c3a8e8353d0646d03d1dc23048bc078d3 | savage12138/YingXao | /YingXao_Embedded/bt_server.py | UTF-8 | 453 | 2.96875 | 3 | [
"MIT"
] | permissive | import bluetooth
server_socket=bluetooth.BluetoothSocket( bluetooth.RFCOMM )
port = 1
server_socket.bind(("",port))
server_socket.listen(1)
client_socket,address = server_socket.accept()
print("Accepted connection from ",address)
while True:
res = self.client_socket.recv(1024)
client_socket.send(res)
if r... | true |
7b60109baa63ce06861a34f2ad278e9656b5fb5f | whuscity/MET | /output/gen_global_city_network.py | UTF-8 | 2,660 | 2.8125 | 3 | [] | no_license | from netUtil.cooccurrence_network import get_cooccurrance_network_v2
from netUtil.add_network_properties import *
from netUtil.network_output import *
import sqlite3
import matplotlib.pyplot as plt
def gen_co_city_network(cursor, start, end):
"""
从energy_city_cooccurrence表中获取给定时间段的数据,
并生成符合Cytoscape/Gephi规... | true |
5141159055af3d1821bbab2b0d0c47aab7ed67c0 | HeptaSean/configuration | /home/bin/checkkerver | UTF-8 | 1,917 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf8 -*-
#
# Script to check running against installed kernel and warn the user to
# restart if they differ
#
# This should be quite self-explanatory and be customised to your needs.
#
# Main points for customisation are the constants at the beginning of the
# script.
# - *_template... | true |
1450fdbd186fbd4776910748218a280993fb9a45 | muskan245verma/Newjob | /infoo.py | UTF-8 | 106 | 3.359375 | 3 | [] | no_license | import os
li=[8,5,2,1,4]
s=0
li.reverse()
print("THE list is ",li)
for i in li:
s=s+i
print("sum = ",i)
| true |
d65b826eb6d8c09406f4c6a74c2d4c79f2f15a4c | gabriellaec/desoft-analise-exercicios | /backup/user_340/ch130_2020_04_01_18_02_40_934177.py | UTF-8 | 164 | 2.5625 | 3 | [] | no_license | lista=[]
nova_list=[]
def monta_mala(lista):
i=0
while list[i] + lista[i+1]<23:
nova_lista.append(lista[i])
i+=1
return nova_lista
| true |
789aa42c86082f4b19dbb5d78f0735360519dd61 | Yberamos/VisualiseurSQLite | /connect_SQLite.py | UTF-8 | 4,405 | 2.671875 | 3 | [] | no_license | import os
import sqlite3
import datetime
import shutil
class SQLiteConnectionError(Exception):
"""Base class for connection execption"""
def __init__(self, message=""):
self.message = 'Connection error: ' + message
class DbNotExist(SQLiteConnectionError):
"""Error class if database does not exi... | true |
34d520d13adfc175f027700787c45c8d1c415311 | MihailMarkovski/Python-OOP-2020 | /Inheritance/mix_it_06E/project/technology/smart_phone.py | UTF-8 | 473 | 2.53125 | 3 | [
"MIT"
] | permissive | # from Inheritance.mix_it_06E.project.technology.technology import Technology
from project.technology.technology import Technology
class SmartPhone(Technology):
def install_apps(self, app, app_memory):
try:
memory_left = self.get_capacity(self.memory, app_memory + self.memory_taken)
... | true |
5bebf566e0109f52b98de9d5b70b3752e665462e | DanielBMeeker/module8 | /test/test_set_membership.py | UTF-8 | 601 | 3.75 | 4 | [] | no_license | """
Program: test_set_membership.py
Author: Daniel Meeker
Date: 6/23/2020
This program defines a function - in_set() to find out
if a value is in a set or not. This file tests the function.
"""
import unittest
from more_fun_with_collections import set_membership as sm
a_set = {1, 2, 3, 4, 5}
value_in_set = 3
value_not... | true |
045e63872fd08ffa330448fb2abb1ed0418ecb65 | javigon/bisp | /bif/sim/test/lookup-line | UTF-8 | 280 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import *
path.append("..")
from fileops import *
if len(argv) != 3:
print argv[0]+" FILENAME LINENUMBER"
exit(1)
filename = argv[1]
linenumber = int(argv[2])
lines = readfile(filename)
print "'"+lines[linenumber]+"'"
| true |
0b9105b4e416c95401fbde9c1ec31c8a7d74a419 | RubenPants/EvolvableRNN | /tests/sensors_test.py | UTF-8 | 9,212 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | """
sensor_test.py
Test of all the sensors.
"""
import os
import unittest
from math import sqrt
from numpy import pi, sqrt
from config import Config
from environment.game import Game
from environment.spawn_functions.simple import SpawnSimple
from utils.dictionary import D_SENSOR_LIST
from utils.vec2d import Vec2d
#... | true |
8421fc940661a34e381230de09855bf7aad86ac9 | robbyvan/- | /木/449_Serialize and Deserialize BST.py | UTF-8 | 917 | 3.59375 | 4 | [] | no_license | # 449_Serialize and Deserialize BST
# 前序根左右生成data
# 解析利用deque, collections.deque(int(val) for val in data.split())
# 按顺序把deque内容依次(根左右)放在合适的位置.(利用build的min, max限制)
# 递归判定vals[0]是否在范围内, 成功 => val = vals.popleft()
class Codec:
def serialize(self, root):
vals = []
def preOrder(node):
if node:
vals... | true |
0bd8459f72be2741336fcdd5bf466942bb89729b | Beasttime/FINAL | /signupmain.py | UTF-8 | 2,220 | 2.765625 | 3 | [] | no_license | ##### LIBARARIES IMPORTED ####
import tkinter as tk
from tkinter.constants import S
# from Tkinter import *
# import Tkinter
from tkinter.messagebox import askyesno
from tkinter.messagebox import *
from tkinter import messagebox
from PIL import Image, ImageTk
import sqlite3
##### LIBARARIES IMPORTED ####
signup... | true |
d6f72c685a649d78e4ebd84f1757da137e391101 | dauren/programming-kbtu | /notes/yermina/fac.py | UTF-8 | 85 | 3.6875 | 4 | [] | no_license | n = int(input())
f = 1
for i in range(1, n + 1):
f = f * i
i = i + 1
print(f) | true |
7a789498c1532b629e4d4f7f1e2425513ae9e19f | idgarrett/data_analysis | /python-forecasting/ETS-A-M-N-Holt-Exponential-Trend.py | UTF-8 | 4,791 | 3.28125 | 3 | [] | no_license |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.optimize as opt
# 1.2. CSV data file import
# Dates must be in format yyyy-mm-dd
data = pd.read_csv('/Users/iangarrett/Apple Daily.csv', index_col='Date',
parse_dates=True)
# Imported data chart
data.pl... | true |
0c5054732704040cdf6e2e7700bc365486d947aa | OTKRyu/deep_learning_practice | /find.py | UTF-8 | 2,041 | 2.59375 | 3 | [] | no_license | import sys
import numpy as np
import matplotlib.pyplot as plt
from book.dataset.mnist import load_mnist
from book.common.multi_layer_net_extend import MultiLayerNetExtend
from book.common.util import shuffle_dataset
from book.common.trainer import Trainer
(x_train, t_train), (x_test, t_test) = load_mnist(normalize=Tru... | true |
b64036b3d06b1a93c04f5d61c2eb0efafd288386 | TomBrov/WorldOfGames | /Games/Game.py | UTF-8 | 781 | 3.1875 | 3 | [] | no_license | from redis import Redis
class Game:
def __init__(self, diff_game, name):
self.diff = diff_game
self.name = name
self.guesses_taken = 0
self.guess = None
self.value = (self.diff * 3) + 5
def get_guess(self):
self.guess = input('Take a guess: ')
if not se... | true |
ffdc894bfd24dac70d941dbb414b36a083d27d30 | NassimOuhenia/MAAIN2020 | /src/titreMatriceLCI.py | UTF-8 | 1,587 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
#encoding=utf8
import xml.etree.ElementTree as ET
from titre import Titre
import re
pref = '{http://www.mediawiki.org/xml/export-0.10/}'
class TitreMatriceLCI(object):
"""docstring for TitreMatriceLCI"""
def __init__(self, nomFichier):
super(TitreMatriceLCI, self).__init__()
self.nomFichie... | true |
f65405f49a9bc5093cb207e74d987bb76774e934 | vishvish66/HangmanWordGuessing | /HangmanWordGuess.py | UTF-8 | 1,088 | 3.96875 | 4 | [] | no_license | # guess secret word
# you will get 10 attemps
# if you guess right latter of the secret word then your attempt will not be counted or else your attempt will reduce one by one if you guess wrong letter
import time
name = input("whats your name?")
print("hello", name, "time to play hangman!")
print("")
time.sleep(1)
... | true |
c51201d8eeca7aea03b9eb9c2c4f925192f1d0c8 | BensonIsabel/cpsmi-python | /exam_objects.py | UTF-8 | 1,340 | 3.921875 | 4 | [] | no_license | class CarType:
def __repr__(self):
return self.__str__()
class SmallCar(CarType):
def __str__(self):
return 'SmallCar'
class Truck(CarType):
def __str__(self):
return 'Truck'
class Car:
cartype = ''
def __str__(self):
return self.cartype.__str__()
def __re... | true |
5de2047318ed3948918735423cd32fc219d91662 | midasvo/nec-bot | /nec_sources/necnijmegen.py | UTF-8 | 706 | 2.75 | 3 | [
"MIT"
] | permissive | from bs4 import BeautifulSoup
import article
import requester
root_url = "http://www.nec-nijmegen.nl/"
source_url = "https://www.nec-nijmegen.nl/nieuws.htm"
def make_request():
html = requester.get_html(source_url)
return html
def get_articles():
print("Getting articles from: " + source_url)
html ... | true |
eb292392e093a85226d23b096e15325167d89a99 | mangalagb/Leetcode | /Medium/NonOverlappingIntervals.py | UTF-8 | 1,502 | 3.890625 | 4 | [] | no_license | # Given a collection of intervals, find the minimum number of intervals
# you need to remove to make the rest of the intervals non-overlapping.
class Solution(object):
def eraseOverlapIntervals(self, intervals):
"""
:type intervals: List[List[int]]
:rtype: int
"""
length_of_... | true |
41b987ae6461cd7002ea8d1128d9c0704e7b0c8c | themason45/traffic-sim | /utils/graph.py | UTF-8 | 3,166 | 2.921875 | 3 | [] | no_license | from dataclasses import dataclass
import numpy as np
from matplotlib import pyplot as plt
from searcher import Searcher
from utils.edges import Edge
from utils.nodes import Node
def split_xy(input_array):
x, y = [], []
for coords in input_array:
x.append(coords[0])
y.append(coords[1])
re... | true |
5a58901cc9cec1382f0ef71794f8b7748163dcc6 | andreyru02/checks_youtube_zen | /utils/youtube.py | UTF-8 | 2,832 | 2.75 | 3 | [] | no_license | from time import sleep
from selenium import webdriver
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from datetime import datetime
import re
from utils import error, message
from database.sql import SQL
bd = SQL('database/bd.db')
pattern = r'^(https:\/\/www.youtube.com\/channel\/)(.+)(\/video... | true |
ec873035c6b84ee690e6e16c386af596d1a86040 | maxprofs-llcio/Team-A-NLP | /TeamJ/Unit8/code/peterRegexbig.py | UTF-8 | 4,598 | 3.03125 | 3 | [] | no_license | import re, os, operator
#try to fit in|at NE
locationPatternString = "((in|at)\s([a-zA-Z]{4,}|[a-zA-Z]{2,}\s[a-zA-Z]{3,}))|\s+[a-zA-Z]{3,},\s[a-zA-Z]{2,}\s[a-zA-Z]{3,}"
timePatternString = "(((on|at)\s((S|s)unday)|((T|t)uesday)|([Mm]onday)([Ww]ednesday)|([Tt]ursday)|([Ff]riday)|([Ss]aturday)),?\s([a-zA-z]*)\s([0-9... | true |
1159a8461bfefc79af9e1e403a52a24d5860d75a | GaganDureja/Algorithm-practice | /sum up 8.py | UTF-8 | 287 | 3.03125 | 3 | [] | no_license | #Link: https://edabit.com/challenge/uWW8cZymSkrREdDpQ
from itertools import combinations as cb
def sums_up(lst):
return {'pairs':sorted([sorted(list(x)) for x in cb(lst,2) if sum(x)==8],key=lambda x: max(lst.index(x[0]),lst.index(x[1])))}
print(sums_up([1, 6, 5, 4, 8, 2, 3, 7])) | true |
d0f16b2fa07fcb227a0e1dfda8ac1ff6be806096 | nbnbhattarai/satin-chatbot | /tokenizer/tokenizer.py | UTF-8 | 2,041 | 3.453125 | 3 | [] | no_license | """
Package Name: tokenizer
Descripton :
"""
import re
import sys
# abbreviations are stored in this file
# when It learns new abbreviations, It insert
# into this file.
abbreviations_filename = "data/language/english/abbreviations"
# symbols of english languagexs
symbols = ['.', '?', ',', '&', '!', ':',... | true |
0f17f93ea0e8420bda25d058d255e8d99919f76d | Asha-N1/internship | /Basics/server1.py | UTF-8 | 780 | 3.15625 | 3 | [] | no_license | # import socket library
import socket
def main():
server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server_socket.bind(('127.0.0.1',12345))
server_socket.listen(5)
while True:
print("server waiting for connection")
client_socket,addr = server_socket.accept()
prin... | true |
4ab6ed036f38b9853a9cc2b526f963165ad327f2 | sydneyjenkins/timedomain-taxonomy | /tdtax/validate.py | UTF-8 | 1,420 | 2.953125 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
"""
small command-line script to validate YAML files
against the schema
"""
import argparse
import json
import glob
from jsonschema import validate, ValidationError
import yaml
from yaml import Loader
from yaml.scanner import ScannerError
CRED = '\033[91m'
CEND = '\033[0m'
CGREEN = '\033[92m'
... | true |
7a5de7780dd20945deb42f38a705252f787119fc | JianiLi/MultiRobotsRendezvous | /centerpoint/utils/PlotUtils.py | UTF-8 | 3,008 | 3.0625 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
def prepare_plot(point_set):
plt.ion()
plt.show()
plt.title('Points')
x_min, x_max = find_x_bounds(point_set)
interval = Interval(x_min - 10, x_max + 10)
y_min, y_max = find_y_bounds(point_set)
prepare_axis(interval.l - 5, interval.r ... | true |
1268f86623be3fd607fe7123464c13e9c0910bf9 | Sytx74/LeetCode-Solution-Python | /05-单链表问题/0138-复制带随机指针的链表.py | UTF-8 | 574 | 3.6875 | 4 | [
"Apache-2.0"
] | permissive |
# 138. 复制带随机指针的链表
# 给定一个链表,每个节点包含一个额外增加的随机指针,该指针可以指向链表中的任何节点或空节点。
# 要求返回这个链表的深度拷贝。
# Definition for singly-linked list with a random pointer.
# class RandomListNode(object):
# def __init__(self, x):
# self.label = x
# self.next = None
# self.random = None
class Solution(object):
def c... | true |
4eb440b9d04fbfccb6e900930f01aef44da383d8 | vsoza/vireya-RAD | /remove_SEEDfastas_wlessthan4reads.py | UTF-8 | 3,362 | 3.046875 | 3 | [] | no_license | import sys
#this program removes nonredundant fasta sequences from SEED output that had less than 4 reads
#need to run program in the directory where you want output to go
#sys.argv[1], first command line argument, should be sample.seed file
#open SEED file with center sequences for each cluster subtended by sequence... | true |
8531d7cf8eadd8f231fdd91781f3a86a809d925f | lamar6332/cti110 | /DiscountCalc.py | UTF-8 | 394 | 3.875 | 4 | [] | no_license | # CTI-110
# Python 2 Excercise
# Anthony Hudson, Jr.
# 20 FEB. 2018
#
#Obtain price of item.
itemPrice = float ( input("Enter the price of the item:"))
#Discount.
discount = itemPrice * .20
#Calculate price of discount and total price.
totalPrice = itemPrice - discount
#Display the total cost of ite... | true |
17e9e6f055417a9fcd1a2e0dcaef4181726f9ad2 | anlanamy/DSA | /陈斌数算/HW3线性结构和栈/【K03】展示后缀表达式计算过程的栈变化.py | UTF-8 | 1,281 | 3.359375 | 3 | [] | no_license | #uuid_share# 4d8c88f1-3904-4a93-a2fd-d545ce276f83 #
class Stack(list):
def __init__(self):
self.items = []
def push(self, item):
self.append(item)
def peek(self):
return self[-1]
def isEmpty(self):
return self == []
def size(self):
return ... | true |
f713cf0987337fc588568b08dc62453038566d45 | TedOnyango/crawler- | /app.py | UTF-8 | 263 | 3 | 3 | [
"Unlicense"
] | permissive | import requests
from bs4 import BeautifulSoup
response = requests.get("http://www.wiseoldsayings.com/addiction-quotes//")
soup = BeautifulSoup(response.text, "html.parser")
quotes = soup.select(".quote")
for quote in quotes:
print(quote.getText())
| true |
44fecb42ae1f4afe262f70513a3bd53e9c2f1045 | bigeyesung/Leetcode | /reorganizeString.py | UTF-8 | 1,243 | 4.03125 | 4 | [] | no_license | '''
The idea is to build a max heap with freq. count
a) At each step, we choose the element with highest freq (a, b) where b is the element, to append to result.
b) Now that b is chosen. We cant choose b for the next loop. So we dont add b with decremented value count immediately into the heap. Rather we store it in pr... | true |
1edf4a2f03dee0b2f68a08a6d12fc3864fe144f9 | jjdblast/Principle-of-Urban-Informatics | /week9/Assignment7/problem3_2.py | UTF-8 | 4,762 | 2.9375 | 3 | [] | no_license | ##############################################
##############################################
# Principle of urban informatics #
# Assignment 7 #
# Dimas Rinarso Putro | drp354@nyu.edu #
# No.3_2 #
###############################... | true |
6e21b0a8515adaa7d462ab846a9adca6f625b8d4 | schovancova/adventOfCode2020 | /6/solution_part_1.py | UTF-8 | 417 | 3.0625 | 3 | [] | no_license |
def main():
with open('input.txt') as f:
lines = f.read().splitlines()
group = set()
res = 0
for line in lines:
if line:
line = list(line)
group.update(line)
else:
res += len(group)
group = set()... | true |
ba305a7e2bc5d047b860a4cbdbed64fc25674f16 | dandani-cs/tiny_python_projects_created_code | /10_telephone/telephone_ex2.py | UTF-8 | 3,022 | 3.546875 | 4 | [] | no_license | #!/usr/bin/env python3
"""
Author : None
Date : 2020-04-15
Purpose: Rock the Casbah
"""
import argparse
import os
import sys
import string
import random
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
descripti... | true |
f9dead8908286f50009a4118fa35688dbd3203a7 | LeonardoJosedaSilveira/test-conditional | /python/src/lv1/fatorial.py | UTF-8 | 420 | 3.796875 | 4 | [] | no_license | '''
Nível 1
Questão 2
Pergunta: Escreva um programa que possa calcular o fatorial de um determinado número.
Os resultados devem ser impressos em uma seqüência separada por vírgulas em uma única linha.
Suponha que a seguinte entrada seja fornecida ao programa: 8 Então, a saída deve ser: 40320
'''
def fatorial(n):
... | true |
96de1fa84ceb859e2bf9056748dde726cdcc5dca | mickymicmouse/Log_Detection | /Elastic_word_embedding_study.py | UTF-8 | 4,703 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 13 17:27:49 2021
@author: seoun
"""
import pandas as pd
import numpy as np
# 데이터 로드
df_acc_log = pd.read_csv(r"C:\Users\seoun\OneDrive\Desktop\Labs\LogData Project\elasticData.csv", encoding= "utf8")
# 변수 선택
col = df_acc_log.columns
remove_cols=['Unnamed: 0', 'src_ip_l... | true |
93a50761f0f98346760b4b4e727d7a609f9cdb93 | nymble/cryptopy | /analysis/permutation.py | UTF-8 | 5,717 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
""" permutation.py
Copyright (c) 2017 by Paul A. Lambert
"""
class permutation(object):
def map_orbits_of_permutation(permutation):
""" Creates a dictionary of permutation orbits indexed by the first element of the cycle/orbit """
gdict = {} # a dictionar... | true |
cc137788a4673ce8e167b26f6e5bd5bf84afd33b | zhang8726/ApiAutoTest | /ZongHe/test_script/conftest.py | UTF-8 | 1,041 | 2.5625 | 3 | [] | no_license | """
脚本层的一些公关方法
"""
import pytest
import sys, os
def get_project_path():
"""
获取工作路径
:return: 当前工作路径
"""
# __file__ 存储着当前文件的路径
path = os.path.realpath(__file__)
# 上一级目录
path = os.path.dirname(path)
# 再上一级目录
path = os.path.dirname(path)
path = os.path.dirname(path)
return ... | true |
de30ab1973dccdc60eafff14bb6d1880f6de130d | Edinburgh-Genome-Foundry/DnaChisel | /dnachisel/Specification/SpecEvaluation/ProblemConstraintsEvaluations.py | UTF-8 | 1,727 | 2.734375 | 3 | [
"MIT"
] | permissive | from .SpecEvaluation import SpecEvaluation
from .SpecEvaluations import SpecEvaluations
class ProblemConstraintsEvaluations(SpecEvaluations):
"""Special multi-evaluation class for all constraints of a same problem.
See submethod ``.from_problem``
"""
specifications_role = "constraint"
@staticm... | true |
0103215f749992fdd58e79fb80b522522b20045a | kirigaikabuto/pythonlessons1400 | /lesson1/1.py | UTF-8 | 278 | 2.625 | 3 | [] | no_license | a = 3 #а - это переменная в которой хранится значение 3
b = 4 #b - это переменная в которой хранится значение 4
# характеристики
# тип данных
# значение
# название | true |
b9ac06e27ba43282719c764aa1efb8eed96e91db | DavidLBick/Single-Cell-RNA-Sequencing | /omp_feature_selection.py | UTF-8 | 2,874 | 2.78125 | 3 | [] | no_license | from log_omp import LogisticOMP
from data import Data
import sys
import math
import numpy as np
# do feature selection for each class separately and take union of the selected features
# usage: python omp_feature_selection.py <data_path> <n_features_to_select> <imputed_features npy filepath> <n_rows (optional)>
# pytho... | true |
4412f5475614bb9fc53e10e5d0a0ebb87e96134d | lukaspestalozzi/Master_Semester_Project | /game/tichu/handcardsnapshot.py | UTF-8 | 2,800 | 3.359375 | 3 | [
"MIT"
] | permissive |
from collections import namedtuple
from .cards import ImmutableCards, Cards
from game.utils import check_all_isinstance, indent
class HandCardSnapshot(namedtuple("HCS", ["handcards0", "handcards1", "handcards2", "handcards3"])):
"""
Contains 4 ImmutableCards instances representing the handcards of the 4 pla... | true |
7e70afcb4fcd8b2c0d23f95bc674102170a2b56a | NitishGadangi/Code-Jungle | /SingleElementinaSortedArray.py | UTF-8 | 402 | 2.828125 | 3 | [] | no_license | #https://leetcode.com/explore/featured/card/may-leetcoding-challenge/535/week-2-may-8th-may-14th/3327/
#12May2020
class Solution:
def singleNonDuplicate(self, nums: List[int]) -> int:
n=len(nums)
if n==1:
return nums[0]
i=0
j=1
while i<n-1:
if nums[i]!=nums... | true |
ede37f8790c86cf944c61ccf0fa2a0c8c8e8e80c | Samridhi-88/nested_list | /nested_q_6.py | UTF-8 | 280 | 3.296875 | 3 | [
"MIT"
] | permissive | element=[23,14,56,12,19,9,15,25,31,42,43]
i=0
#sum1=0
#sum2=0
e=[]
o=[]
while i<len(element):
if element[i]%2==0:
e.append(element[i])
print("even")
else:
o.append(element[i])
print("odd")
i+=1
print(e)
print(o)
#print(even)
#print(odd) | true |
caf93b85d7765d93bec7dcf1f1852d5150bc6079 | bluecube/sound_toy | /wav_file.py | UTF-8 | 1,233 | 2.921875 | 3 | [] | no_license | import wave
import numpy
from .tracks import NumpyTrack
def save(track, filename, samplerate=44100, blocksize=4096):
"""
Save a track to a file.
"""
w = wave.open(filename, 'w')
w.setparams((1, 2, samplerate, 0, 'NONE', 'not compressed'))
maximum = 2**15 - 1
dtype = numpy.dtype('<i2')
... | true |
c1bab9b47ad111bd16c80da2912285627bc9d6f4 | mithi/creative-tech-prototypes | /arm-robot/widgets/section_maker.py | UTF-8 | 1,469 | 3.0625 | 3 | [
"MIT"
] | permissive | """
Used to make html divsions
"""
import dash_html_components as html
def make_section_type3(div1, div2, div3, name1="", name2="", name3=""):
"""
Returns an html div with three columns of equal widths,
one column for each div passed as an argument.
"""
return html.Div(
[
html.... | true |
9dd75b2a378ccfe4f28c72459679b56c550e182c | yifengyou/crazy-python | /官方配套代码/03/3.3/delete_test.py | UTF-8 | 1,900 | 3.515625 | 4 | [
"Unlicense"
] | permissive | # coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee kongyeeku@163.com #
# #
# version 1.0 ... | true |