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 |
|---|---|---|---|---|---|---|---|---|---|---|
efbb58b52e5e1f3e136966b4b19910bfc2e98bad | catherinelee274/postalbox | /backend/hardware/bridge.py | UTF-8 | 432 | 2.703125 | 3 | [] | no_license | import serial
import requests
from time import sleep
device = "/dev/cu.usbmodem142301"
ser = serial.Serial(device, 9600)
sleep(1)
def send(cmd: str, bin: int):
ser.write(cmd)
sleep(1)
ser.readline()
ser.write(bin)
def sort(bin: int):
send("sort", bin)
def open(bin: int):
send("open", bi... | true |
bb6f274d288194352137c7d4a211f8f93fc13ac0 | ilkaxd/Yandex-Practicum-Python-Developer | /4. Блок алгоритмов/1. Введение в алгоритмы/task_10.py | UTF-8 | 1,311 | 3.640625 | 4 | [] | no_license | def is_prime(n):
if n == 1:
return False
i = 2
while i * i <= n:
if n % i == 0:
return False
i = i + 1
return True
def get_least_primes(n):
lp = [0] * (n + 1)
primes = []
for i in range(2, n + 1):
if lp[i] == 0:
lp[i] = i
... | true |
e683ba9e3a539f8e26f6e20bd5800cb5e5df5e1d | geoprism/Predicting-RainFall-Kaggle-Competition | /final_run.py | UTF-8 | 2,017 | 2.71875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import mltools as ml
from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import StandardScaler
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier
... | true |
dbfaf73f7731f1379d514bd67110c146054904d1 | yasheymateen/holbertonschool-machine_learning | /supervised_learning/0x03-optimization/14-batch_norm.py | UTF-8 | 892 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
""" Batch Normalization Upgraded """
import tensorflow as tf
def create_batch_norm_layer(prev, n, activation):
""" creates batch normalization layer for neural network """
init = tf.contrib.layers.variance_scaling_initializer(mode="FAN_AVG")
layer = tf.layers.Dense(units=n, kernel_i... | true |
413033c45191f2c8915ae7e81bac4be18e1df8a0 | hiphan/n-puzzle-ai | /iterative_dfs.py | UTF-8 | 6,100 | 3.21875 | 3 | [] | no_license | import sys
import math
import copy
class State:
def __init__(self, puzzle, depth):
self.puzzle = puzzle
self.parent = None
self.depth = depth
file = open(sys.argv[1], 'r')
init_numbers = file.read().split()
file.close()
# print(init_numbers)
side = (int)(math.sqrt(len(init_numbers)))... | true |
95928582823ebe6fca99c11ea23e5c4fadf255d9 | csy1993/PythonQt | /Chapter02/py203str2.py | UTF-8 | 1,049 | 3.671875 | 4 | [
"Apache-2.0"
] | permissive | '''
* @Author: csy
* @Date: 2019-05-09 15:26:19
* @Last Modified by: csy
* @Last Modified time: 2019-05-09 15:26:19
'''
# -*- coding: utf-8 -*-
# 1
dss = ' hello pyqt5,,'
print('\n#1,去空格及特殊符号')
s1 = dss.strip().lstrip().rstrip(',')
print('s1,', s1)
# 2
print('\n#2,字符串连接')
s2 = dss.join(['a', '.', 'c'])
print('... | true |
63266ba3d12b5b768f23ef9a38830ddddfa7365f | goliatone/minions | /scaffolder/core/exceptions.py | UTF-8 | 1,920 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. module:: scaffolder.core.exceptions
:synopsis: Custom Minion exception classes
"""
import sys
from clint.textui import indent, puts
from clint.textui.colored import red
class MinionException(Exception):
"""
Base exception class. All Minion-specific ex... | true |
da8c0a3b60a21ad3dea36235df860159f2ab2cd0 | wellqin/USTC | /PythonBasic/base_pkg/python-06-stdlib-review/chapter-04-DatesAndTimes/4.3-calendar/py_02_calendarWorkWithDates.py | UTF-8 | 1,357 | 3.09375 | 3 | [] | no_license | import calendar, sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
from pkg.breaker import addBreaker
@addBreaker
def calendar_textcalendar():
c = calendar.TextCalendar(calendar.SUNDAY)
c.prmonth(2020, 8)
@addBreaker
def calendar_yeardays2calendar():
import pprint
ca... | true |
22923daf07f86f1ee98e8285213e65847ed39df6 | zacjohnston/nucleosynth | /nucleosynth/models/model.py | UTF-8 | 9,379 | 2.734375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import time
# nucleosynth
from nucleosynth import tracers
from nucleosynth import paths, tools, plotting, printing, network
"""
Class representing a CCSN model, composed of multiple mass tracers
"""
class Model:
"""Object representing a CCSN model, composed of multiple mas... | true |
6f671a08394b7999d932f0ccb51f13f147b21c8e | TetianaSob/Python-Projects | /Ex-55_functions.py | UTF-8 | 1,361 | 4.875 | 5 | [] | no_license | # Ex-55_functions.py
'''intersection'''
''' Write a function called intersection. This function should accept two lists
and return an list with the values that are bothe input lists. '''
# flesh out intersection pleaseeeee
# Manual Looping Solution
# Here's one potential solution:
# Define an empty lis... | true |
2985847f2f40297aaa7e9f8292ba0633583841b6 | vmolostvov/business_optimization | /test2.py | UTF-8 | 2,130 | 2.921875 | 3 | [] | no_license | import re
import shutil
import os
import pandas as pd
from datetime import date
file_list = os.listdir('files')
df = pd.read_excel('Задание.xlsx')
folder = 'Папка{}'
date_start = date(2020, 6, 20)
date_end = date(2020, 7, 10)
codes_ca = df['Код_КА'].tolist() # список всех кодов КА
def main():
for i in range(4)[... | true |
1e0ef2af949b5aae5d4728d15fc37b0acbb701db | florian-juniat/Math | /305construction.py | UTF-8 | 4,282 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
##
## EPITECH PROJECT, 2018
## 304pacman.py
## File description:
## pacman
##
import math
import sys
from sys import argv, exit
import os.path
tab = [];
ac = 0;
for arg in sys.argv:
if (ac != 0):
tab.append(arg);
ac = ac + 1;
if (ac != 2):
exit(84)
try:
f = open(argv[... | true |
8fd9ce0d04c28fb82a0ccc3f28e4cd8b0008eafe | NaiveteYaYa/data-structrue | /数据结构/循环队列.py | UTF-8 | 1,887 | 4.125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/6/20 18:50
# @Author : WuxieYaYa
class MyCircularQueue:
def __init__(self, k: int):
"""
Initialize your data structure here. Set the size of the queue to be k.
"""
self.k = k
self.queue = []
self.count = 0
def enQueue(... | true |
3299990e39d9ba2d3723d23507d76d0b76ced40f | NickMilsonPhysics/Miscellaneous_Astrophysics_Routines | /LS_bisect.py | UTF-8 | 1,006 | 3.421875 | 3 | [] | no_license | import numpy as np
def lsq_bisect(x,y,wx,wy):
"""
Parameters
----------
x : x points
y : y points
wx : x weights
wy : y weights
Returns
-------
cov: coefficient vector of the bisector fit line
"""
cof1= np.polyfit( x, y, 1, w = wy)
cof2= np.polyfit( y, x, 1... | true |
d7ad5177c9197259714e3b655c53a3826a3d3633 | sweetcczhang/docker-dashboard | /logs/kube_logs.py | UTF-8 | 2,613 | 2.734375 | 3 | [] | no_license | #!/usr/local/miniconda2/bin/python
# _*_ coding:utf-8 _*_
"""
# @Project : docker-dashboard
# @Time : 2018/10/17 下午8:57
# @Author : zhangchengcheng
# @FileName: kube_logs.py
# @Github : https://github.com/sweetcczhang
"""
from influxdb import InfluxDBClient
from datetime import datetime, timedelta
class KubeLog... | true |
b1bda7ef4f2233ee8fc4b807bef73f0b663888d3 | stanleyhung/Helping | /views.py | UTF-8 | 608 | 2.609375 | 3 | [] | no_license | """File to keep track of all views"""
import useModifiedData, setup, psycopg2
VIEWSFILE = setup.DIR + 'views.sql'
buff = []
db = useModifiedData.reinitialize()
fd = open(VIEWSFILE, 'r')
seenComment = False
for line in fd:
if "\"\"\"" in line:
seenComment = not seenComment
else:
if not seenComment... | true |
863c4b944db0ad4ce57cabb4f4de2d56546164f8 | jian6/jiancmd | /jiancmd/main.py | UTF-8 | 1,436 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
""" a command line tool to do simple everyday tasks for developers
Usage:
jiancmd currency convert FROM TO [-a AMOUNT]
jiancmd currency list
jiancmd currency -h | --help
Options:
-h --help display help screen
-a --amount==AMOUNT specify the amount to be conv... | true |
2461d8948bea6597af323feddcd237e1bbd51d0a | hseifu/Algorithms | /Quick_Sort.py | UTF-8 | 4,000 | 3.140625 | 3 | [] | no_license | #! /usr/bin/env python3
# Done by Henok_S
import random
import timeit
import pylab
import matplotlib.pyplot as plt
import numpy as np
def double_pivot_quick_sort(A,p,r):
if p < r:
q,t = double_pivot_partition(A,p,r)
double_pivot_quick_sort(A,p,q-1)
double_pivot_quick_sort(A,q+1,t-1)
... | true |
a4651cb6c56c469d0e54d5ffd7c572b495d231dc | btindol178/Python-Development | /ListComprehension.py | UTF-8 | 1,856 | 3.890625 | 4 | [] | no_license | temps = [221,234,340,230,235] # temperatures stored like this and leave out the 23.4 (leave out period)
# Loop way iterate over the temps and divide by 10 and append then print
new_temps = []
# to get temperature in proper format
for temp in temps:
new_temps.append(temp/10)
print(new_temps)
# or use li... | true |
d6634b193188e8e2febae1517f83a13de6c13122 | inkyu0103/BOJ | /Dynamic Programming/2156.py | UTF-8 | 438 | 3.21875 | 3 | [] | no_license | # 2156 포도주 시식
'''
1. 어떻게 연속 3잔인걸 아니?
인덱스를 보고 옆에있으면 depth+1 하다가
depth가 3이되면 return 0을 해줄까?
'''
num = int(input())
wei = [0]
dp =[0]
for i in range(num):
wei.append(int(input()))
dp.append(wei[1])
if num >1 :
dp.append(wei[1]+wei[2])
for i in range(3,num+1):
dp.append(max(dp[i-1],dp[i-3]+wei[i-1... | true |
192044763267f47bb87f51f4866d8c28117f45ea | geeeeeeeeew/Speech-To-Steve | /Command.py | UTF-8 | 6,962 | 2.984375 | 3 | [] | no_license | import spacy
import neuralcoref
#installing neuralcoref:
#pip install neuralcoref
#pip install spacy==2.1.0
#for medium:
#python -m spacy download en_core_web_md
#for large:
#python -m spacy download en_core_web_lg
nlp = spacy.load('en_core_web_lg') #use medium sized english model
#nlp.Defaults.stop_word... | true |
8e83e8ae558de8926f983575a5babfcf0b9f9754 | NyaliaLui/RepS-Web | /reps/replay.py | UTF-8 | 5,264 | 2.796875 | 3 | [] | no_license | from s2protocol import versions
import mpyq
import sys
from os.path import isfile
from copy import deepcopy
#is_replay
# @params - relative path to the replay file
# @return - returns true if file is a replay
# @purpose - determine if a file is a SC2 replay
def is_replay(replay_path):
ret = (isfile(replay_path) an... | true |
8ab6f65360713fad1d466ed86493d9ecd4218f8d | google-code/asmeg | /Trunk/Board.py | UTF-8 | 690 | 2.609375 | 3 | [] | no_license | import gtk, pygtk, math
pygtk.require('2.0')
import Point, DrawingController
class Board(gtk.DrawingArea):
def __init__(self):
gtk.DrawingArea.__init__(self)
self.set_size_request(400,300)
self.set_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.POINTER_MOTION_MASK |gtk.gdk.POINTER_MOTION_HINT_MASK)
drawing_s... | true |
5fa663fa47ade98bda7efbfc22390e4ad8dd5c97 | kiranp11/ctr | /src/main.py | UTF-8 | 1,319 | 2.6875 | 3 | [] | no_license | import logging
from IOUtility import IOUtility
from Preprocessor import Preprocessor
from Classifier import Classifier
class Main:
def __init__(self):
self.io_utils = IOUtility()
self.profile = self.io_utils.get_profile()
self.__configure_logging()
def __configure_logging(self):
... | true |
f4ed6462ac08813bb9c517bd67a99edc9350b50e | llpghn/HTMLoWS | /server/WS/ws_rec_msg.py | UTF-8 | 7,256 | 3.03125 | 3 | [] | no_license | """
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | ... | true |
9842673e1c18352b51157ed3aa4a9e706874966d | wiput1999/Python101 | /7 Extra 4/P.55 Part IV/9.py | UTF-8 | 100 | 3.53125 | 4 | [] | no_license | def leadingdigit(n):
t = str(n)
return t[0]
a = int(input("num : "))
print(leadingdigit(a)) | true |
bf45594e49df2b45aebf76e9a409a5ff0741f668 | OuroborosD/estudospython | /11_mascara_cpf.py | UTF-8 | 715 | 3.1875 | 3 | [
"MIT"
] | permissive | numero = '12345678912'
def formatar_cpf(cpf):
"""gera uma mascara, usando as mascaras, ou a função format.
#os %s são são conversores servem para converter tudo que está lá em String
#o % são flags, marca onde termina os conversores e onde é para ser colocado os numeros para formatar
Args:
... | true |
9e4ad4bfc9995fe177c28c9373756bfb3cf2ef36 | Chiva-Zhao/pproject | /cookbook/netweb/CIDR.py | UTF-8 | 1,512 | 3.6875 | 4 | [] | no_license | # 通过 CIDR 地址生成对应的 IP 地址集
# 有一个 CIDR 网络地址比如“123.45.67.89/27”,想将其转换成它所代表的所
# 有 IP (比如,“123.45.67.64” , “123.45.67.65” , …, “123.45.67.95” ))
# 可以使用 ipaddress 模块很容易的实现这样的计算
import ipaddress
net = ipaddress.ip_network('123.45.67.64/27')
print(net)
# for a in net:
# print(a)
net6 = ipaddress.ip_network('12:3456:78:90ab... | true |
62c81bdb58799156935b87d72b0526e3e27ec6ad | feng409/u-bbs | /app/utils.py | UTF-8 | 1,564 | 3.234375 | 3 | [] | no_license | # coding: utf-8
import time
import re
import os
def log(*args, **kwargs):
"""
代替print,自定义打印
[2018/05/12 21:16:58] ...
"""
format_date = format_time(time.time())
# print('[{}]'.format(format_date), *args, **kwargs)
if not os.path.exists('logs'):
os.mkdir('logs')
path = os.path.... | true |
2c5fa8f1e064953e6843806098a75f6add3a9e7d | zakarya23/leet_code_questions | /Easy/shuffle.py | UTF-8 | 273 | 3.34375 | 3 | [] | no_license | class Solution:
def shuffle(self, nums: List[int], n: int) -> List[int]:
x = 0
y = n
out = []
for i in range(n):
out.append(nums[x])
out.append(nums[y])
x += 1
y += 1
return out | true |
df951f7958947f4e731d97b976f5dda5902aa450 | Fieoner/http-boy | /main.py | UTF-8 | 3,445 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
from emulator import Emulator
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import json
from urlparse import urlparse, parse_qs
import base64
import cStringIO
import traceback
emulator = Emulator()
def htmlguarro(texto):
return "<title>test</title><h3>"+texto+"</h3>"
class... | true |
4a68c0d070b9ea62b08ab2e687a4c2ae9d02c048 | zlz2013/zlz | /base/week01/day02.py | UTF-8 | 3,379 | 3.53125 | 4 | [] | no_license | # month=int(input("请输入月份:"))
# year=int(input("请输入年份:"))
# if 1<month or month>12:
# print("输入有误!")
# elif month==2:
# if year%4==0 and year%100!=0 or year%400 ==0 :
# print("29天")
# else:
# print("28天")
# elif month==4 or month==6 or month==9 or month==11:
# print("30天")
# else:
# p... | true |
d6e8da1d36d8488b3b44e61f4cbff88186279c22 | nddsg/HDTM | /scripts/category_tree.py | UTF-8 | 1,213 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import random
if len(sys.argv) is not 4:
print(" input_graph output_graph start_node\n")
exit()
input_file = sys.argv[1]
output_file = sys.argv[2]
start_node = int(sys.argv[3])
g = dict()
with open(input_file) as f:
for line in f:
raw_data = [int(x) for x in li... | true |
49a43ae6ae551bc36a5b61ad719018f233bcef55 | Motor-taxi-master-rider/Comics | /app.py | UTF-8 | 4,763 | 2.921875 | 3 | [] | no_license | from __future__ import print_function
"""This file contains mian project definitions for:
"""
import sys
import pandas as pd
from exceptions import Exception
def run_sracpy():
'''Initialize the scrapy spider and start crawl all comics info
'''
from Comics import spiders
from scrapy.crawler import... | true |
5a9386108375828e829e96865542555a79cc9dd8 | ArtDor2/agi | /agi.py | UTF-8 | 1,100 | 2.875 | 3 | [] | no_license | import time
envText = open("met_ch1.txt", "r").read().lower() # all-text environment
envTime = 0
senText = "" # envText sensor for
senTextRange = 10 # diameter for the sensor "eye", useful as a foundation for later sensors
# open agi mind from file
compTime = time.time() + 60 * 0.5 # for 30 seconds
... | true |
48bb0a12d2c890c91660d9371fd0fcca6994d714 | zabaras/rans-uncertainty | /invar-nn/fluid/invariant.py | UTF-8 | 3,999 | 3.078125 | 3 | [
"MIT"
] | permissive | """
Used for calculating tensor invariants and tensor basis functions.
===
Distributed by: Notre Dame CICS (MIT Liscense)
- Associated publication:
url: https://www.sciencedirect.com/science/article/pii/S0021999119300464
doi: https://doi.org/10.1016/j.jcp.2019.01.021
github: https://github.com/cics-nd/rans-uncertainty
... | true |
8a3f6a46917cae9025b40250d48248fb3ed5c69a | feddelegrand7/wave | /py/examples/background_progress.py | UTF-8 | 1,817 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | # Background Tasks / Progress
# Execute background functions while incrementing a progress bar
# ---
import time
import asyncio
import concurrent.futures
from h2o_wave import main, app, Q, ui
# A long-running that performs a blocking operation, in this case time.sleep()
def blocking_function(secs) -> str:
time.sl... | true |
007ad995835ddc5cdcd39cd026e18608d1c562c9 | Rajesh16702/autonomous-learning-library | /all/presets/atari/rainbow.py | UTF-8 | 4,445 | 2.625 | 3 | [
"MIT"
] | permissive | from torch.optim import Adam
from torch.optim.lr_scheduler import CosineAnnealingLR
from all.approximation import QDist, FixedTarget
from all.agents import Rainbow
from all.bodies import DeepmindAtariBody
from all.logging import DummyWriter
from all.memory import PrioritizedReplayBuffer, NStepReplayBuffer
from all.opti... | true |
b94af41bdcf79d3faa3547e597d1cedc465991d5 | ameeli/calculator-2 | /calculator.py | UTF-8 | 1,525 | 3.921875 | 4 | [] | no_license | """A prefix-notation calculator.
Using the arithmetic.py file from Calculator Part 1, create the
calculator program yourself in this file.
"""
from arithmetic import *
# Your code goes here
def run_calculator_2():
run_function = True
while run_function:
user_input = raw_input('>')
if user_... | true |
f5632d0474cf042df3e93efcc8ec6772115dfc24 | CoralieHelm/Python_Functions_Files_Dictionaries_University_of_Michigan | /reading_from_a_csv_file.py | UTF-8 | 366 | 3.359375 | 3 | [] | no_license | #May 28 2020
#Python Functions, Files, and Dictionaries - University of Michigan
#Week 1
#Reading from a csv file
with open("ABIO.csv", "r") as file_csv:
lines = file_csv.readlines()
header = lines[0]
field_names = header.strip().split(" , ")
print(field_names)
for row in lines[1:]:
vals =... | true |
9966264d583b9f6c69cdb6c19f345ffbb2be9b4f | kimaril/networksch | /notebooks/solver.py | UTF-8 | 6,619 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python
import numpy as np
import pandas as pd
from csv import reader
from csv import writer
from scipy.integrate import solve_ivp
from scipy.optimize import minimize
import matplotlib.pyplot as plt
from tqdm import tqdm
from datetime import timedelta, datetime
import sys
import json
import ssl
import urllib.... | true |
004fcbc715921ab8c90bb7667f018a4413dff8ad | chickensouple/experiments | /rnn_language_model/rnn_models.py | UTF-8 | 9,643 | 2.859375 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from tqdm import tqdm
import argparse
import os
from nlp_dataset import *
# gpu setup copied from https://www.tensorflow.org/guide/gpu
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
# Currently, memor... | true |
168c8f37cf91f1eda8dc3d4ac921277eff5eec8a | sustainablecomputinglab/waitinggame | /model_analyzer/ajw.py | UTF-8 | 2,131 | 2.828125 | 3 | [
"MIT"
] | permissive | """
Copyright (c) 2020 <Sustainable Computing Lab>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish... | true |
6f8d25834fd329ef41de89e0850afb891edacb94 | leon1peng/alg_t | /交作业/Week06/回文子串.py | UTF-8 | 1,993 | 3.84375 | 4 | [] | no_license | """
回文子串
DP
"""
# 1
# DP
class Solution:
def __init__(self):
self.res = 0
def countSubstrings(self, s: str) -> int:
n, self.res = len(s), 0
def helper(i, j):
while i >= 0 and j < n and s[i] == s[j]:
i, j, self.res = i - 1, j + 1, self.res + 1
for... | true |
4e9750a5396801558a0f52545985ca2a8a0f7201 | dineshkandula/visualizing-and-understanding-cnn | /dmodel.py | UTF-8 | 2,103 | 2.640625 | 3 | [] | no_license | import numpy as np
from tensorflow import keras
import keras.backend as K
def dget_layer(model, layer_name):
'''
get_layer(model, layer_name)
Returns layer in the @p model with layer name @p layer_name.
'''
return model.get_layer(layer_name)
def dget_intermediate_model(model, layer_name):
... | true |
54b86ce85e3c23ff64185b850b731a98fe2a92ec | armenzg/version-control-tools | /autoland/autoland/treestatus.py | UTF-8 | 658 | 2.859375 | 3 | [] | no_license | import config
import requests
TREESTATUS_URL = 'https://treestatus.mozilla.org/'
def tree_is_open(tree):
treestatus_url = TREESTATUS_URL
if config.testing():
treestatus_url = 'http://treestatus/'
try:
r = requests.get(treestatus_url + tree + '?format=json', verify=False)
if r.sta... | true |
04600c8a230d3a8407dad0a65ce2d6d3e461e952 | ivarg/aoc-2020 | /14.py | UTF-8 | 1,784 | 3.296875 | 3 | [] | no_license | # Solution to Day 14
def read_input():
return open("input-14.txt", "r").readlines()
def mask(msk, val):
bval = "{0:b}".format(val).zfill(36)
res = "".join([b if m=="X" else m for (b,m) in zip(bval, msk)])
return int(res,2)
def process1(data):
msk = []
mem = {}
for line in data:
in... | true |
2e20a6286683a63547ecf12479930157af6c965b | helluva/recorder-hero | /PythonGameplay/keyboard.py | UTF-8 | 864 | 2.84375 | 3 | [] | no_license | from tkinter import *
pressed_keys_update_handler = None
pressed_fingers = [0, 0, 0, 0, 0, 0, 0]
def key_pressed(event):
global pressed_keys_update_handler, pressed_fingers
if event.char in ['1', '2', '3', '4', '5', '6', '7']:
index = int(event.char) - 1
pressed_fingers[index] = 1
press... | true |
c8526a9cae710d2ff1438f42876a2d49a8723125 | c-yan/atcoder | /abc/abc126/abc126d.py | UTF-8 | 367 | 2.671875 | 3 | [
"MIT"
] | permissive | N = int(input())
link = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = map(int, input().split())
link[u - 1].append((v - 1, w))
link[v - 1].append((u - 1, w))
d = [-1] * N
d[0] = 0
q = [0]
while q:
p = q.pop()
for n, w in link[p]:
if d[n] == -1:
d[n] = d[p] + w
... | true |
7e568cb7d09e352a9376b6e5e188512dec1c5b12 | sheaconlon/cell_counting2 | /manuscript/preprocess_pinned.py | UTF-8 | 11,358 | 2.6875 | 3 | [] | no_license | """Preprocesses the ``pinned`` dataset.
Does the following:
1. Augments the images.
2. Resizes the images.
3. Normalizes the images.
4. Discretizes the counts.
5. HOG-featurizes the images.
6. Splits the dataset.
Produces the following plots:
1. plates_resized.svg
2. plates_normalized.svg
3. plates_discretized.svg
4.... | true |
ef265c978a50ecb60c18bcbdb13928afa6f31518 | estraviz/IntermediatePythonProgramming | /02_Wordplay_warm-up/words_longest_palindrome.py | UTF-8 | 395 | 3.953125 | 4 | [] | no_license | import scrabble
def is_palindrome(word):
return word == word[::-1]
count_palindromes = 0
longest = ""
for word in scrabble.wordlist:
if is_palindrome(word):
count_palindromes += 1
if len(word) > len(longest):
longest = word
print("\nTotal number of palindromes: {:d}".format(count... | true |
1a640eaae12a253d3fcc1683556aaceeed066098 | kartikeya23/project-euler | /041.py | UTF-8 | 433 | 3.28125 | 3 | [] | no_license | from datetime import datetime
start = datetime.now()
def isPrime(n):
if n % 2 == 0:
return False
for i in range(3, int(n**0.5) + 1, 2):
if n % i == 0:
return False
return True
from itertools import permutations
for n in range(2, 10):
x = [str(i) for i in range(1, n+1)]
for num in list(map(lambda a: int(... | true |
059d71df260c198f1f1d253402dd9c5115512ef9 | KaminskyJ/SubredditPolitics | /HowSimilar.py | UTF-8 | 2,800 | 3.28125 | 3 | [] | no_license | import praw
import collections
reddit = praw.Reddit(client_id = 'os7m34NXJFkr0g',
client_secret = '0oJVizuj3K3XGFEIUPCw_t9D23M',
username = 'justTestingStuffyeah',
password = 'justTestingStuffyeah',
user_agent = 'testBotv1')
#subreddits you would like to test
subreddits = ['politics','the_donal... | true |
2aec2d041d91744e7feafb21190baf3db64903be | kcastillo23116/ModernPythonBootCamp | /user_input.py | UTF-8 | 64 | 2.890625 | 3 | [] | no_license | output = input("how's it going? \n")
print("you said " + output) | true |
3901b014cf013bf5456dbe99c8cb6e7c95dc75ee | minglee68/ProgrammingLanguage | /FWAE/MyVisitor.py | UTF-8 | 4,237 | 2.96875 | 3 | [] | no_license | from FWAEVisitor import FWAEVisitor
from FWAEParser import FWAEParser
class MyVisitor(FWAEVisitor):
def __init__(self):
self.memory = {}
self.withcount = {}
self.funmemory = {}
def visitExpr(self, ctx):
return self.visit(ctx.fwae())
def visitNum(self, ctx):
return ... | true |
044727790d88397749e12ba7a4fd9dda1e8822b5 | mojianhuiGZ/tools | /chrome_bookmarks/extract_title.py | UTF-8 | 1,828 | 2.78125 | 3 | [] | no_license | # coding: utf-8
import argparse
from bs4 import BeautifulSoup
from urllib.request import urlopen
from urllib.error import HTTPError
OUTPUT_FORMAT = """<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-... | true |
377092960f4f9f548dc44f7088d12a53fab10b6c | seoul-ssafy-class-2-studyclub/GaYoung_SSAFY | /programmers/0802_쇠막대기.py | UTF-8 | 1,630 | 3.859375 | 4 | [] | no_license | def solution (arrangement):
answer = 0
cnt = 0
for i in range(len(arrangement)):
if arrangement[i] == '(': # 여는괄호 시작이면 check하기 위해서 넣기
cnt += 1
elif arrangement[i] == ')': # 닫는괄호 나타나면 레이저 or 파이프의 끝
cnt -= 1
if arrangement[i - 1] == '(': # 레이저이면 그 전에있는 (들... | true |
7e73b24a62ae1d82d56807a51720255cbbda0fd2 | LoicGrobol/python-im-2 | /data/fixme.py | UTF-8 | 636 | 3 | 3 | [
"MIT"
] | permissive | import cuisine
assert len(dir(cuisine)) > 5
assert cuisine.pasta_types == [
cuisine.Lasagne,
cuisine.Tagliatelle,
cuisine.Pappardelle,
]
for t in cuisine.pasta_types:
assert issubclass(t, cuisine.Pasta)
main_ingredient = cuisine.Tagliatelle(200)
assert main_ingredient.max_guests <= 2
assert main_ing... | true |
23e8c1c3ee2ac6d077be0aa19440118e1b0fa60d | Tanmoy07tech/DSA | /algorithms/Python/arrays/equalize_the_array.py | UTF-8 | 1,192 | 3.515625 | 4 | [
"MIT"
] | permissive | # Given an array of integers, determine the minimum number of elements to delete to leave only elements of equal value.
# Example
# arr=[1,2,2,3]
# Delete the 2 elements 1 and 3 leaving arr=[2,2]. If both twos plus either the 1 or the 3 are deleted, it takes 3 deletions to leave either [3] or [1]. The minimum numbe... | true |
256a46e9424f4f0fdb7902dc859cb888ef1596ec | gajanlee/leetcode | /python/28. Implement strStr().py | UTF-8 | 728 | 3.484375 | 3 | [] | no_license | #
# [28] Implement strStr()
#
# https://leetcode.com/problems/implement-strstr/description/
#
# algorithms
# Easy (28.93%)
# Total Accepted: 262.7K
# Total Submissions: 907.8K
# Testcase Example: '"hello"\n"ll"'
#
#
# Implement strStr().
#
#
#
# Return the index of the first occurrence of needle in haystack, or... | true |
ab3820ebedd6d4b8782787fd650ce437ee052443 | pinakiprasannadas2000/my_clock | /main.py | UTF-8 | 28,212 | 2.671875 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk, messagebox
from datetime import date
import time
# ---------------------------------------------global variables---------------------------------------------
countdown_timer = None
seconds = 0
prev_second = 0
lap_number = 1
work_count = 1
work_index = 0
work_list = []
# ... | true |
1fe36e0af27a6345e693650aa03400b3bedbb1cf | NathanielSchwartz/evolution-simulator | /evolution_simulator.py | UTF-8 | 21,926 | 3.1875 | 3 | [] | no_license | import random
import math
import csv
map_size = 100 # the width and height of the map
starting_pop = 100 # the starting population of the three species
sim_cycles = 100 # how many generations the simulation runs before ending
food_amount = 600 # the amount of food generated at the start of each generation
sim_... | true |
13bc5aefe0c054eaa3581c492bef59149df1ab19 | girishramnani/compititive_coding | /SPOJ/SPOJ-SPTB.py | UTF-8 | 915 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 21 00:15:45 2014
@author: girish
"""
def mergesort(elist,count):
total=[]
#print(count)
low=0
high=len(elist)
#print(len(elist))
if len(elist)<2:
return elist,count
mid=int((low+high)/2)
enlist=[]
y,count=merg... | true |
4e97b4d56a308c00b4e819a6f5fc749ab6108709 | hsrueda/Tesis-Rayos-X | /Github/Blanco-Quintero metapelita/Programa de Rayos-X.py | UTF-8 | 5,409 | 3.265625 | 3 | [] | no_license |
# coding: utf-8
# Henry Steven Rueda Corredor. Rayos-X
#
# In[1]:
import numpy as np
import numpy.linalg as svd
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from numpy.linalg import matrix_rank
import ternary
# In[2]:
##Carga el archivo fuente, omite el encabezado y coloca los caracteres co... | true |
876e19bd67905bf13bf671dc2060f18736ba1785 | malware-revealer/extractor | /mrextractor/features/base.py | UTF-8 | 5,226 | 3.03125 | 3 | [
"MIT"
] | permissive | """
Base Feature Classes.
Contain feature classes that are common to all executables
"""
import numpy as np
import re
from PIL import Image
from math import sqrt
from mrextractor.features.utils import lief_from_raw
class BaseFeature(object):
"""
Contains methods to all extractors.
All the extractor clas... | true |
2cac2b104a23002efa890c884b46a3b9cce48714 | davidleexyz/leetcode | /334_increasing_triplet_subsequence.py | UTF-8 | 536 | 3.328125 | 3 | [] | no_license | # dp[i] = max(dp[k] + 1, if a[i] > a[k])
def increasing_triplet_subsequence_dp(nums):
dp = [1] * len(nums)
for i in range(1, len(nums)):
j = 0
while j < i:
if nums[i] > nums[j]:
dp[i] = max(dp[j] + 1, dp[i])
j += 1
if max(dp) >= 3:
return True
else:
return False
def increasing_triplet_subseque... | true |
222dc21c9ba9ec6d29878a43d59e4f6d0d872067 | Aasthaengg/IBMdataset | /Python_codes/p03047/s200275008.py | UTF-8 | 131 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 12 14:39:04 2020
@author: shinba
"""
n,k = map(int,input().split())
print(n-k+1)
| true |
eeeef1490a87e5b0648783167d57020ea0bbfd08 | good-data-foundation/Kodiak | /goodata-ml/goodDataML/connection/chain.py | UTF-8 | 6,583 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | """
Communicate with chain
"""
import json
from enum import Enum, unique
from goodDataML.connection.chain_connection_helpers import SmartContract, W3Helper,\
ThreadManager, CHAIN_MAX_TASK_NUM, CHAIN_TASK_NAME_PREFIX, QUEUE_EXIT_SIGNAL
import logging
# const
EVENT_DEFAULT_QUEUE_SIZE = 10
CHAIN_CONTRACT_ADDRESS = '0... | true |
0d191965720108a492dbefe227e484996dad0588 | AyanDutta2011/PythonSeleniumRobot_Framework | /Python-Test/Polymorphism2.py | UTF-8 | 300 | 3.90625 | 4 | [] | no_license | # method overloading
# define a method in such a way that there are multiple ways to call it.
class Human:
def mobile(self,name=None):
if name == "iPhone":
print("ios")
if name == None:
print("Android")
obj = Human()
obj.mobile()
obj.mobile("iPhone")
| true |
c7ef3f33cb5aab1e72599b3515a552dc3ef241c3 | SwapnilSilam/py-open-cv-samples | /samples/7_add_two_images.py | UTF-8 | 671 | 2.8125 | 3 | [] | no_license | import numpy as np
import cv2
img = cv2.imread('messi5.jpg')
img2 = cv2.imread('opencv-logo.png')
print(img.shape)
print(img.size)
print(img.dtype)
b,g,r= cv2.split(img)
img = cv2.merge((b,g,r))
# Region of interest
ball = img[280:340, 330:390]
img[273:333, 100:160] = ball
#Reshaping two images
img = cv2.resize(im... | true |
cc134120adf91b1cf3aba38c021c679073658d49 | tomr-stargazer/correction-factor | /correction_factor/correction_factor_2.py | UTF-8 | 1,411 | 2.953125 | 3 | [] | no_license | """
This is a new attempt at the core Correction Factor code.
I'm working explicitly with the tables that pyradex outputs.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
def correction_factor_given_radex_table(input_table, indice... | true |
393d07d3f4b3b091328f08489cf98f5b2c9fc013 | katran009/django-bugs-bugs-bugs | /BugTracker/models.py | UTF-8 | 1,314 | 2.8125 | 3 | [] | no_license | """
BugTicket:
Title
Time/Date Field
Description
Name of user who filed ticket
Status of Ticket (Choices= New/In Progress/Done/Invalid)
Name of user assigned to ticket
Name of user who completed ticket
"""
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
clas... | true |
51226d3095884567d7d1cc74a396a29996175686 | BenDataAnalyst/Practice-Coding-Questions | /hackerrank/30-days-of-code/day-25.py | UTF-8 | 370 | 3.625 | 4 | [
"Unlicense"
] | permissive | #!/bin/python3
from math import sqrt
num_elements = int(input())
for num in range(num_elements):
n = int(input())
prime = True
if n >= 2:
for i in range(2, int(sqrt(n))+1):
if n % i == 0:
prime = False
break
else: prime = False
if p... | true |
09b8e7e351751ab2bbe3807178150b36f91039b9 | hjlarry/leetcode | /homework/4_4_server.py | UTF-8 | 913 | 3.109375 | 3 | [] | no_license | """
4\. 使用多进程模块写一个使用优先级队列的例子
```
❯ python 4.py
put :7
put :36
put :91
put :10
put :73
put :23
[PRI:7] 7 * 2 = 14
[PRI:10] 10 * 2 = 20
[PRI:23] 23 * 2 = 46
[PRI:36] 36 * 2 = 72
[PRI:73] 73 * 2 = 146
[PRI:91] 91 * 2 = 182
```
提示:用BaseManager共享queue.PriorityQueue
"""
# Server side
from multiprocessing.managers import Bas... | true |
a4705acf4ffe3800b4fac3b50a6040b7bc67402f | shizuguilai/my_final_cnn_all | /read2.py | UTF-8 | 2,924 | 3.0625 | 3 | [] | no_license | import torch
import matplotlib.pyplot as plt
import os
import torch.nn as nn
import torch.autograd.variable as Variable
import numpy as np
os.environ['KMP_DUPLICATE_LIB_OK']='True'
#定义读取文件下的所有文件函数
def find_all_files(path):
files= os.listdir(path) #得到文件夹下的所有文件名称
return files
#定义读取数据函数
def read_datas(path):
... | true |
105bc472053aa5556299da6d80f81676ee2ba0a8 | sarvan80/Python-Mini-Projs | /mySearches.py | UTF-8 | 1,796 | 4.0625 | 4 | [] | no_license |
# Professor I used your bsearch program for the binary search
# Do let me know if I have to code it up on my own
def bisearch(x,nums):
item =0
low = 0
high = len(nums) -1
c = 0
while low <= high: # Still a range to search
#print("Step counter : ",c,item)
mid... | true |
b6b0aae56c7829e1c543dfed82e3803295aa590e | daniel-reich/ubiquitous-fiesta | /EPXH424t2SSjMzms5_10.py | UTF-8 | 179 | 3.015625 | 3 | [] | no_license |
def remix(txt, indexes):
lengh = len(txt)
new = ['' for i in range(lengh)]
for (i, value) in enumerate(indexes):
new[value] = txt[i]
return "".join(new)
| true |
b9ef75d8d160f606dedd6623a2c6b5e894ed1cd6 | mg515/mg_euler | /4.py | UTF-8 | 655 | 3.484375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 27 00:13:47 2015
@author: miha
"""
# EULER PROBLEM #4
import timeit
def ispalindrom(x):
x = str(x)
if int(len(x)) ==1:
return True
else:
for i in range(int(len(x)/2)):
if x[i]!=x[len(x)-i-1]:
return False
retu... | true |
32c481abd1f83dc8f5d6edada47d5ad4463a32e8 | ohnesee/CoderDojo | /page_by_page.py | UTF-8 | 824 | 2.71875 | 3 | [] | no_license | import sys
import struct
import os, platform
from ctypes import windll, create_string_buffer
with open(sys.argv[1], 'r') as text_file:
lines = [line.strip().split('\n') for line in text_file]
pagesize = 20
pages = {}
pageIndex = 0
buffer = []
buffer.append(lines[0][0])
for i in range(1, len(lines)):
buffer... | true |
691dbba4749d0baadd78d55048343d53fb34a833 | watsoncal/Ch.09_Functions | /9.0_Jedi_Training.py | UTF-8 | 1,477 | 4.53125 | 5 | [] | no_license | #Sign your name: Cal Watson
#1.) Correct the following code: (The user's number should be increased by 1 and printed.)
def increase(x):
return x + 1
num = int(input("Enter a number: "))
y = increase(num)
print("Your number has been increased to",y)
#2.) Correct the following code to print 1-10:
def count_to_t... | true |
6413921b28693777a254a4245f1e53a1982a6027 | roslonek/IoT-raspberryPi | /temp.py | UTF-8 | 1,923 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
import os, glob, time
import rrdtool
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
rrdDB="temperature.rrd"
base_dir = '/sys/bus/w1/devices/'
dir1="/sys/bus/w1/devices/28-*/w1_slave"
sensors=dict()
sensors={
"28-00044d0e53ff":"out",
"28-000005936cd3":"dom",
"28-000433480dff":"garaz... | true |
937d8f94d4d2242acd75a75ac91d67253a100a33 | KDiggory/pythondfe | /PYTHON/classes/classes_Dog.py | UTF-8 | 2,981 | 4.59375 | 5 | [] | no_license | # A python class is like a blueprint for something you want to build
# its not used directly but is used to create an object
# the object is then used for the task you weant to perform
#the class itself can be pulled into multiple objects
# and then those slightly different objects can be used within the program
# bui... | true |
c240b447dcfee774d53abc8edbbf6cd4def65288 | goodboy-kr/python-study | /study/stu.py | UTF-8 | 123 | 3.546875 | 4 | [] | no_license | for num in range(2, 10):
if num % 3 == 0:
print("Found", num)
continue
print("not Found", num)
| true |
2f7aad5f98606e10a10eeacb4cd7cc10a164ab6c | interactiveaudiolab/earthquakes | /dataset.py | UTF-8 | 6,318 | 2.59375 | 3 | [] | no_license | from torch.utils.data import Dataset
import os
import obspy
import pickle
import numpy as np
import copy
import random
class SiameseDataset(Dataset):
def __init__(self, dataset):
self.dataset = dataset
def __getitem__(self, i):
item_one = self.dataset[i]
item_two = self.dataset[np.rand... | true |
676e0548d9f43fee1fe7b6f5245bd0e8d512d2cc | iammax/leetcode | /solutions/py/p0504_base_7.py | UTF-8 | 456 | 2.9375 | 3 | [] | no_license | class Solution(object):
def convertToBase7(self, num):
ab = abs(num)
out = ''
if num == 7:
return '10'
if num == -7:
return '-10'
if abs(num) < 7:
return str(num)
while ab > 1:
out += str(ab% 7)
ab /=7
... | true |
116cb2e0bb3e813c7646b879ce4c6377545ae80a | martinvl/MPC-2014 | /rps/check_rps_test.py | UTF-8 | 1,426 | 2.515625 | 3 | [] | no_license | from check_rps import get_third, get_score, IllegalMovesError
# ---- get_third tests ----
if get_third('Rock', 'Paper') != 'Scissors':
raise Exception()
if get_third('Rock', 'Scissors') != 'Paper':
raise Exception()
if get_third('Paper', 'Rock') != 'Scissors':
raise Exception()
if get_third('Paper', 'Sc... | true |
aa8cfddac12a86d1000fe2aee05b3295067886ea | wangyongcong/pixpad | /utf8.py | UTF-8 | 2,130 | 2.9375 | 3 | [
"MIT"
] | permissive | # coding: utf8
# -------------------------------------------------
# Convert all source files to UTF-8 (without BOM)
# -------------------------------------------------
import sys
import os
import os.path
import codecs
class CFileExtFilter(object):
def __init__(self, file_extensions):
if isinstance(file_extensions... | true |
769d5e77bdc41413676a4b9cd60a37dbb905865f | Tauag/edmtrain_scraper | /scraper.py | UTF-8 | 1,344 | 2.5625 | 3 | [] | no_license | from scrapy.crawler import CrawlerRunner
from twisted.internet import reactor, defer
from spiders.all_fests_spider import AllFestivalsSpider
from spiders.location_spider import AllLocationSpider, RecentLocationSpider
import mysql.connector
import time
from sys import exit
# Set up db connection
try:
db_conn = mysq... | true |
7588e724dd991b1cb42eba590dbade914870dcd4 | gaurab123/DataQuest | /05_ProbabilityAndStatistics/02_ProbAndStatsInPython_Intermediate/06_MultiCategoryChiSquaredTests/02_CalculatingExpectedValues.py | UTF-8 | 949 | 3.171875 | 3 | [] | no_license | males_proportion = 0.669
females_proportion = 0.331
earn_over_50k = 0.241
earn_under_50k = 0.759
total_population = 32561
# Calculate the expected value for Males who earn >50k, and assign to males_over50k.
males_over50k = total_population * males_proportion * earn_over_50k
print('males_over50k:', males_over50... | true |
924718636b3368e4d7d83a89abd44e9f1adcf92f | Jafagervik/AlgorithmsAndDataStructures | /AllToAll/floyd_warshall.py | UTF-8 | 407 | 2.765625 | 3 | [] | no_license | from graph import *
def Floyd_Warshall(W):
"""
:param W:
:return:
"""
n = len(W) # n = W.rows
D = [W]
for k in range(1, n):
D[k] = [[0 for i in range(n)] for j in range(n)]
for i in range(1, n):
for j in range(1, n):
d = D[k]
d_k ... | true |
4284b5ac95318c2451e14b1f32d8aadc01bd68ca | FITM-KMUTNB/Brain | /testcentroid/code03.py | UTF-8 | 617 | 3.390625 | 3 | [] | no_license | import networkx as nx
import matplotlib.pyplot as plot
G = nx.Graph()
G.add_edge('man', 'baby', weight=1)
G.add_edge('baby', 'women', weight=0.5)
G.add_edge('man', 'women', weight=0.3)
G.add_edge('women', 'year', weight=1)
G.add_edge('year', 'man', weight=1)
edge_labels = nx.get_edge_attributes(G, 'weight')
print(ed... | true |
a77112854169e332413b43bca223da75b087c0f3 | OskarBreach/advent-of-code-2018 | /day04.py | UTF-8 | 2,712 | 3.3125 | 3 | [
"MIT"
] | permissive | import re
from collections import namedtuple
Guard = namedtuple("Guard", "id minutes_asleep minute_most_asleep times_asleep_at_favourite_minute")
def get_guard_patterns(records):
records.sort()
guard_asleep = {}
current_guard = None
for record in records:
shift_start = re.search(".*Guard #... | true |
96b96b45e1682723c0e645ec77faf4d9768bf51d | khmahmud101/python-practice-code | /duplicate_check_in_list.py | UTF-8 | 181 | 3 | 3 | [] | no_license | li = [2,6,4,2,5,7,4]
unique = []
for i in li:
if i not in unique:
unique.append(i)
print(unique)
unique = sorted(unique)
print(unique)
unique = li.count(2)
print(unique) | true |
e2756b89ee3b96861f30e7102a893ce5efa33288 | mgurkankul/hangman-socket-programming | /client.py | UTF-8 | 1,285 | 2.90625 | 3 | [] | no_license | from socket import * # Mustafa Gürkan Kul
serverName="localhost" # 150150040
serverPort=12000
clientSocket=socket(AF_INET,SOCK_STREAM)
clientSocket.connect(... | true |
d30c0a8233b38ba6e0c1d60a918d1dd76ae05d41 | PedroMarco/Testing2 | /Day 3_bis/LeapYear.py | UTF-8 | 207 | 4.25 | 4 | [] | no_license | # Receive an input
year = eval(input("Enter a year number!: "))
if year %4 == 0 and year %100 !=0:
print('year '+str(year) + ' is a leap year')
else:
print('year ' +str(year) + ' is not a leap year') | true |
6f78f852e6aca7f1c649ae0695b2151e991cabc2 | vicb1/deep-learning | /1-notebook-examples/keras-udemy-course/cnn_class2/use_pretrained_weights_resnet.py | UTF-8 | 4,849 | 2.734375 | 3 | [
"MIT"
] | permissive | # https://deeplearningcourses.com/c/advanced-computer-vision
# https://www.udemy.com/advanced-computer-vision
from __future__ import print_function, division
from builtins import range, input
# Note: you may need to update your version of future
# sudo pip install -U future
from keras.layers import Input, Lambda, Den... | true |
523ac7aa0dcbb1bc930210c3381b4fcb57b6d20f | freshLiver/NCKU109_ToC | /nhlib/nhGallery.py | UTF-8 | 979 | 2.8125 | 3 | [] | no_license | class NhGallery :
def __init__ ( self, title: str, link: str, tags: list ) :
self.title = title
self.link = link
self.tags = tags
self.lang = NhGallery.__extract_lang_from_tags( tags )
@staticmethod
def __extract_lang_from_tags ( tags: list ) -> str :
i... | true |
e00a7090a342481102d222ac537aa92826b6a0d3 | fotinosk/masters_project | /DDPG - Augmented States/trajectory.py | UTF-8 | 2,621 | 3.53125 | 4 | [] | no_license | """
Class that receives as inputs the normal input to the system and outputs a history
to be input in the Reinforcement Learning Model.
In this way the model gets a historic data to infer what is going on in the model
Challenges and Questions:
Give both history of actions and states, or just states?
Maybe give [state,... | true |
c70ab0c3cec5a8e1931ac279197396589fd1a86e | pytutorial/samples | /multiprocess/thread_example.py | UTF-8 | 207 | 3.125 | 3 | [] | no_license | from threading import Thread
a = []
def func(threadId):
a.append(threadId)
print(f'Inside thread {threadId} : a = ', a)
for i in range(5):
thr = Thread(target=func, args=(i,))
thr.start() | true |
b0a5725ae33cc02dd322653e40f801b457a1cd0f | ralterman/playlist.append | /functions.py | UTF-8 | 2,468 | 2.59375 | 3 | [] | no_license | import config
import pickle
import surprise
from spotipy.oauth2 import SpotifyClientCredentials
import spotipy
from surprise import dump
# Separate file of essential functions for purposes of running in terminal and on frontend website
# Spotify authentication for API calls
client_credentials_manager = SpotifyClien... | true |