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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1723020d438cb2ea8cbb207c67c0108025b14b50 | Python | kayanpang/champlain181030 | /week12-1_review_test-exercise/super_2.py | UTF-8 | 298 | 2.953125 | 3 | [] | no_license | class Document:
def __init__(self, id):
self.id = id
class Email(Document):
def __init__(self, id):
self.id = id
def set_parent_id(self, id):
super().id = id
def get_parent_id(self):
return super().id
email = Email(5)
email.set_parent_id(8)
print() | true |
8cc07fe6d174132d7142e3b39fa7ad67b64bff9a | Python | peonyau/SPE10117-Information-System-lab3 | /lab5Q2.py | UTF-8 | 1,219 | 3.21875 | 3 | [] | no_license | loanAmount = int(input('The loan amount is:'))
annualInterestRate = int(input('The annual interest rate is:'))
monthlyPayment = int(input('The monthly payment is:'))
startingBalance = loanAmount
payment = monthlyPayment
middleBalance = startingBalance - payment
interst = loanAmount * annualInterestRate/12/100
... | true |
b7ab7f060c9d33f99e2e1d230088e0295705d562 | Python | mvgjorge/UltraFinance-1 | /data_service/sp500.py | UTF-8 | 4,895 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# sqlalchemy ORM object(SP500_list)
from sqlalchemy import Column, Integer, String, Float
from sqlalchemy.ext.declarative import declarative_base
import urllib
import xlrd
Base = declarative_base()
_SP500_table_name_ = 'SP500_list'
class SP500_list(Base):
"""
C... | true |
e3e0c868df40657dca550f07740eed8833fb0465 | Python | SebastianNachtigall/secret-santa | /utils.py | UTF-8 | 1,133 | 2.8125 | 3 | [
"MIT"
] | permissive | import random
import os
import yaml
from models import Pair
CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'config.yml')
def choose_reciever(giver, recievers):
choice = random.choice(recievers)
if giver.partner == choice.name or giver.name == choice.name:
if len(recievers) is 1:
... | true |
dfb025990c1e30df2284b567c7f60d81b91b8700 | Python | davrad/frustrating-tic-tac-toe | /src/comp_choice.py | UTF-8 | 1,955 | 3.625 | 4 | [
"MIT"
] | permissive | import copy
import random
from typing import Final
from board import Board
PLAYER_CHAR: Final[str] = 'X'
COMPUTER_CHAR: Final[str] = 'O'
def get_comp_turn(board: Board) -> int:
"""Gets the move for the computer player, a random one if its the first turn"""
print("Calculating...")
if first_turn(board):
... | true |
65ed7128c63228bdcd010170f269d437012e61e0 | Python | HimanshuSinghNegi/Intermediate-Python | /lambda_function.py | UTF-8 | 139 | 3.15625 | 3 | [] | no_license | #lambda function :- Anonymous function
l1=[3,2,3,4,5,56,6]
print(list(map(lambda x: x%2==0,l1)))
print(list(filter(lambda x: x%2==0,l1))) | true |
30b4683d900949a2c43baad088198b1c5dadc1b3 | Python | Ericleitonmacedo/Projetos | /MoraisParking - Python/MoraisParking - Python/interacao.py | UTF-8 | 3,869 | 3.359375 | 3 | [] | no_license | class Interacao:
def __init__(self):
self.inicio = "\nMenu Inicial" + "\n" + "O que você deseja?"
self.menu1 = "0 - Sair"
self.menu2 = "1 - Logar"
self.menu3 = "1 - Cadastrar Funcionário"
self.menu5 = "0 - Sair"
self.menu6 = "1 - Cadastrar Veículos"
self.menu7... | true |
b3b15230fbef021002b889b3fd8f686687023b83 | Python | jdiaz-dev/practicing-python | /SECTION 3 variables and data type/10 concatenate.py | UTF-8 | 444 | 4.53125 | 5 | [] | no_license |
name = 'Jonathan'
surname = 'Díaz'
age = '28'
#concating
#only can concat strings
print(name + ' ' + surname + ' has ' + age + ' years.')
#using interpolation
print(f"{name} {surname} has {age} years")
#using format() method
print("Hi mi name is {} {} and have {} years.".format(name, surname, age))
... | true |
c73eaa1a1dad1502e5ce1bdb5c886a2328af3444 | Python | abhiraj963/Codevita-Challenges | /pattern1.py | UTF-8 | 1,028 | 3.109375 | 3 | [] | no_license | try:
flag = 1
while flag:
N = int(input())
if N > 1 or N < 101:
flag = 0
except:
print('enter a number')
gen1 = (x for x in range(1,(N*(N+1)) + 1))
def lst_first(m):
lst_fst = []
for i in range(0,m):
lst_fst.append('*'*2*i)
return lst_fst
... | true |
9069a5541ed077d20c9d8eea724b233e2ec4cac5 | Python | boltlabs-inc/libzkchannels | /tezos-sandbox/smartpy_scripts/useful_examples/Bls12_381_Tests.py | UTF-8 | 3,407 | 3.1875 | 3 | [
"MIT"
] | permissive | import smartpy as sp
class Bls12_381(sp.Contract):
def __init__(self, **params):
self.init(**params)
"""
ADD: Add two curve points or field elements.
:: bls12_381_g1 : bls12_381_g1 : 'S -> bls12_381_g1 : 'S
:: bls12_381_g2 : bls12_381_g2 : 'S -> bls12_381_g2 : 'S
:: bls12_381_fr : bl... | true |
ac9d51477378d3c24d95f59ac3b5e8bb1552ba04 | Python | SynedraAcus/brutality | /listeners.py | UTF-8 | 29,212 | 2.96875 | 3 | [
"CC-BY-3.0",
"MIT"
] | permissive | """
Things that should somehow interact with the events, but are too simple to
merit a complete entity, or to complicated to be limited to one.
"""
from collections import namedtuple
from json import dump, load
from bear_hug.bear_utilities import BearLayoutException, rectangles_collide, \
copy_shape
from bear_hug... | true |
f0408a588feea444380e1a23c602210f4bfbec33 | Python | aless80/pypanda | /pypanda/lioness.py | UTF-8 | 3,717 | 2.640625 | 3 | [] | no_license | from __future__ import print_function
import os, os.path
import numpy as np
from .panda import Panda
from .timer import Timer
class Lioness(Panda):
"""Using LIONESS to infer single-sample gene regulatory networks.
1. Reading in PANDA network and preprocessed middle data
2. Computing coexpression network
... | true |
fba30542ccd6ca857ab9981a79982144d716a487 | Python | lqf96/mltk | /mltk/engine/metrics/generator.py | UTF-8 | 2,124 | 2.5625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | from typing import Any, Callable, Generator, Optional
from mltk.types import Args, Kwargs, T, U
import functools
from .metric import Metric, Triggers
GenMetricFunc = Callable[..., Generator[T, U, None]]
class GeneratorMetric(Metric[T]):
__slots__ = ("f", "src", "args", "kwargs", "_gen", "_value")
def __ini... | true |
fae99d9550c3eeeb6f3677ae2ce0f1b020ddc0ff | Python | agpranjal/algorithms | /subset_sum.py | UTF-8 | 349 | 2.96875 | 3 | [] | no_license | def solve(arr, target, ls=[], SUM=0, index=0):
if SUM == target:
print(ls)
return
if index == len(arr):
return
if SUM+arr[index] <= target:
solve(arr, target, ls+[arr[index]], SUM+arr[index], index+1)
solve(arr, target, ls, SUM, index+1)
arr = [5, 10, 12, 13, 15, 1... | true |
e6e29ec5924a99011023ab496379e1294a85f19b | Python | brokenyouth/AntsWars | /Model_Anthil.py | UTF-8 | 622 | 3.0625 | 3 | [] | no_license | import pygame
class Anthil:
def __init__(self, _x, _y, _size, _color, _id):
self.x = _x
self.y = _y
self.size = _size
self.color = _color
self.id = _id
self.score = 0
self.ants = []
def getId(self):
return self.id
def addAnt(self, _ant):
... | true |
d2beaee3c332f7ff1926c92ee20a9254c1856336 | Python | sidv/Assignments | /LakshmiT assign/Assign/aug_18/circle.py | UTF-8 | 166 | 3.6875 | 4 | [] | no_license | class Circle():
def __init__(self,r):
self.radius = r
def area(self):
return 3.14*(self.radius**2)
circle = Circle(7)
print(circle.area())
| true |
e7fff8d39461c7445af45403403a6fcdb65a69ea | Python | heiscsy/reinforcement_learning_ucl | /MC-TD/RMS/rms.py | UTF-8 | 1,369 | 3.109375 | 3 | [] | no_license | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import numpy as np
kGamma = 1
kAlphaTD = 0.1
kAlphaMC = 0.01
def init():
state = 2
return state
def play(state):
terminate = False
reward = 0
action=np.random.randint(low=0, high=2)
action=-1 if... | true |
65d3041e75c767cd1333a0ab808f13b13b1faa8c | Python | aashurajhassani/OpenCV_basics | /Source_1/08 - Handle Mouse Events in OpenCV.py | UTF-8 | 1,350 | 3.15625 | 3 | [] | no_license | events = [i for i in dir(cv2) if 'EVENT' in i]
# dir is inbuilt method which is going to show all clases functions etc in cv2 package
print(events)
# all the events in cv2 library are shown
# first mouse callback function is created which is called when something is done with the mouse
def click_event(event, x, y, fla... | true |
801b0fe86edd7d75da5f9a49d253391979188578 | Python | Byhako/python | /scripts/mcd.py | UTF-8 | 332 | 3.34375 | 3 | [] | no_license | import time
inicio=time.time()
a=60
b=48
for i in range(min(a,b),1,-1):
if a%i==0 and b%i==0:
print('El maximo comun divisor de %s y %s es %s:' %(a,b,i))
break
else:
print('Los numeros %s y %s son primos entre si.' %(a,b))
fin=time.time()
print('Tiempo de ejecucion: ', ... | true |
aec735daced60d66f1300a602f7a4f1fe2396fc0 | Python | SebastiGarmen/checkout | /map.py | UTF-8 | 167 | 3.203125 | 3 | [] | no_license | #-*- coding: utf-8 -*-
lista = range(11)
def cubo(n):
return n*n*n
print(map(cubo, lista)) #<--primero funcion sin llamar, o sea sin el () , luego la lista0
| true |
9545ca27f11024ddbc8288e50935fa422008249d | Python | arthurredfern/cnn-sentiment | /test_server.py | UTF-8 | 947 | 3.296875 | 3 | [
"MIT"
] | permissive | """A quick script to test a model running in the TensorFlow Model Server.
It sends a request for each raw sentence in the whole dataset. As such,
it shouldn't be used to evaluate model performance but to check that the model
is being served properly.
"""
import requests
import numpy as np
# We assume the ModelServer ... | true |
e0c30a8b8e7290cd1e2b91f3f4692ca3a29d4d06 | Python | 1119group/helloworld | /heisenberg_chain_hamiltonian/block_diagonalized_heisenberg_chain_H.py | UTF-8 | 2,844 | 2.78125 | 3 | [] | no_license | '''
This function generates a block diagonalized Hamiltonian for a
Heisenberg chain model.
'''
from quantum_module import rand_sign,permute_one_zero
import numpy as np
from scipy.sparse import lil_matrix
from scipy.misc import comb
import operator
def get_block_heisenberg_chain_H(Sx,Sy,Sz,N,h,J=1):
random_field =... | true |
85e968b51ec0aa6244fc9226b67c0697afced019 | Python | nichenxingmeng/PythonCode | /蓝桥杯/无标签/饮料换购 .py | UTF-8 | 106 | 3.3125 | 3 | [] | no_license | n = int(input().strip())
count = n
while n >=3:
count += n // 3
n = n // 3 + n % 3
print(count)
| true |
a779baf0ec8fab1302b42a63f313273ed7473a22 | Python | Mirocle007/Reinforcement_Learning | /3Deep_Q_Network/main.py | UTF-8 | 2,746 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | """
Main function of the 2Qtable_2d_env, combind the agent and the environment.
"""
import argparse
from tqdm import tqdm
from maze_env import Maze
from agent import Agent
def str2bool(s):
if s.lower() in "trueyes":
return True
else:
return False
parser = argparse.ArgumentParser()
parser.... | true |
0da9d362e74be76c4ba495d82ef784be018ba0e3 | Python | ANchangwan/Python_Task_Automation | /2._sheet.py | UTF-8 | 573 | 3.265625 | 3 | [] | no_license | from openpyxl import Workbook
wb = Workbook()
ws = wb.create_sheet() # 새로운 Sheet 기본 이름으로 생성
ws.title = "MySheet" # Sheet 이름 변경
ws.sheet_properties.tabColor = "ff66ff" # RGB
# Sheet, MySheet, YourSheet
ws1 = wb.create_sheet("yourSheet") # 주어진 이름으로 Sheet 생성
ws2 = wb.create_sheet("NewSheet",2) # 2번째 index에 shee... | true |
8eee4bba662dc6a7e87e11ad80536f2bdd362880 | Python | yejikk/Algorithm | /01_배열/view.py | UTF-8 | 865 | 3.1875 | 3 | [] | no_license | # max, min method 사용 하지말기!
import sys
sys.stdin = open("view_input.txt")
T = 10
for tc in range(T):
N = int(input())
data = list(map(int, input().split()))
window = 0
for i in range(2, N-2):
if data[i] > data[i-1] and data[i] > data[i-2] and data[i] > data[i+1] and data[i] > data[i+2]:
... | true |
fa1bb0a5f7f9700c534464173c909023654aa2e7 | Python | jfkquality/holbertonschool-higher_level_programming | /0x11-python-network_1/2-post_email.py | UTF-8 | 543 | 2.75 | 3 | [] | no_license | #!/usr/bin/python3
# take in URL and email, send a POST req with email as param, display resp/utf8
from urllib import request
from urllib import parse
from sys import argv
if __name__ == "__main__":
url = argv[1]
email = argv[2]
email = {'email': argv[2]}
email = parse.urlencode(email)
email = data... | true |
d31f1d66a443d8d7d5bfd4e2045bcc17bec6cb09 | Python | howardbz/dotalivescanner | /analysis/update.py | UTF-8 | 4,077 | 2.90625 | 3 | [] | no_license | # Dota Live Scanner
# Howard Wang, Miles Wang
# Created on: 12/20/2018
# Last edited:
# Repository for all update functions called upon by other functions.
import csv
import datetime
import json
import time
import pandas as pd
import numpy as np
import dota2api
# Declares any initial settings
def init():
live... | true |
52cca8cee32c7f7f92b1eab4b8aedc7344518bb8 | Python | 0xb5951/ComPro | /atcoder/ABC_045/b.py | UTF-8 | 792 | 2.953125 | 3 | [] | no_license | # 解けなかった
# SA = str(input())
# SB = str(input())
# SC = str(input())
# value_dict = {
# 'a' : SA,
# 'b' : SB,
# 'c' : SC
# }
# print(value_dict.values())
# ans = ''
# def solve(user, list_dict):
# for j in ['a', 'b', 'c']:
# if len(list_dict[j])-1 <= 0 and user == j:
# return 0
# ... | true |
507de9ae8af62b29e11d2b2c5fa6bd525582c22a | Python | thiejen/python_excercises | /questions/0.first_dup.py | UTF-8 | 452 | 3.328125 | 3 | [] | no_license | #! /usr/local/bin/python
# -*- coding: utf-8 -*-
import string
import random
def check_first_dup(str):
tmp = {}
for i in range(len(str)):
if tmp.has_key(str[i]):
return i
else:
tmp[str[i]] = 1
return None;
templates = string.letters
str = ''.join(random.choice(s... | true |
b442a868b1122b54553b12d4953b8e62bba894b2 | Python | raprocks/hackerrank-practice | /Python/Lists.py | UTF-8 | 960 | 3.359375 | 3 | [] | no_license | if __name__=="__main__":
commands = int(input())
lst = []
for _ in range(commands):
command = input()
commands = command.split(" ")
if len(commands) == 1:
command = commands[0]
if command == "print":
print(lst)
elif command == 'pop'... | true |
074f97a5eab3d2bf5d64e98e410ce00c8a68d8bb | Python | valkharb/lingua_crowdsource | /env/Lib/site-packages/pynlpl/clients/frogclient.py | UTF-8 | 5,384 | 2.640625 | 3 | [] | no_license | ###############################################################
# PyNLPl - Frog Client - Version 1.4.1
# by Maarten van Gompel (proycon)
# http://ilk.uvt.nl/~mvgompel
# Induction for Linguistic Knowledge Research Group
# Universiteit van Tilburg
#
# Derived from code by Rogier Kraf
#
# ... | true |
9c105e9da163940d55a425b597b1909d42c463f7 | Python | Kayma12/NLP-RECOGNITION-ENGINE | /src/cleaning_and_reading/read_in_files.py | UTF-8 | 339 | 2.75 | 3 | [] | no_license | import textract
import sys
# The following function takes a file and/or file path, either with doc or
# docx extension, and returns the text representation of it, i.e. a txt file.
def read_in_doc_docx_file(file):
text_file_repr = textract.process(file)
text_file_repr = text_file_repr.decode('utf-8')
retu... | true |
e6dc7bc68012e893e026a74eda88fe0752709d84 | Python | johnedstone/icloud-snippets | /list_of_albums_idea.py | UTF-8 | 872 | 2.8125 | 3 | [] | no_license | >>> photo_albums_list = [i for i in iter(api.photos.albums.keys())]
>>> photo_albums_list
['All Photos', 'Time-lapse', 'Videos', 'Slo-mo', 'Bursts', 'Favorites', 'Panoramas', 'Screenshots', 'Live', 'Recently Deleted', 'Hidden', 'My movies', 'Third Fourth']
>> for i in photo_albums_list:
... print(i, ": ", len(api.p... | true |
aed3cf5f559ca1ddec2156a2d6bb6b12e8034450 | Python | washington-and-lee-mock-convention/mock-con-2020-word-cloud | /newsapi_courier.py | UTF-8 | 2,485 | 2.953125 | 3 | [] | no_license | import requests
import asyncio
import aiohttp
import logging
from datetime import datetime
from dateutil import parser
from concurrent.futures import ALL_COMPLETED
from model import db, WordCloud
logging.basicConfig(level=logging.INFO)
class NewsAPICourier:
'''
This class will open a requests session and make... | true |
5390f708418c6c2d444817fd7bebf567f5e3bdcd | Python | geopandas/geopandas | /geopandas/tests/test_config.py | UTF-8 | 781 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | import geopandas
import pytest
def test_options():
assert "display_precision: " in repr(geopandas.options)
assert dir(geopandas.options) == ["display_precision", "use_pygeos"]
with pytest.raises(AttributeError):
geopandas.options.non_existing_option
with pytest.raises(AttributeError):
... | true |
adfa98842b75103e01b044da3505cd906610b979 | Python | HRS0986/My-Python-Scripts | /NumberReader.PY | UTF-8 | 2,878 | 3.359375 | 3 | [] | no_license | from math import floor
words1 = [ "","one","two","three","four","five","six","seven","eight","nine" ]
words2 = [ "","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen" ]
words3 = [ ""," ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety" ]
words4 = [ "",... | true |
e9f1ff49aa67274be9cf10fa780f1f418ac0baf5 | Python | xukangmin/MyLeetCode | /Trees/226_Invert_Binary_Tree/s.py | UTF-8 | 1,125 | 3.71875 | 4 | [] | no_license | # Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def invertTree(self, root: TreeNode) -> TreeNode:
def dfs(r: TreeNode) -> TreeNode:
if... | true |
477f9151ae7fd0037c7aecb76bc7ee3880d0ef90 | Python | MustafaHaddara/P0CompilerOpts | /ST.py | UTF-8 | 4,422 | 3.359375 | 3 | [] | no_license | # coding: utf-8
# ## P0 Symbol Table
# #### Original Author: Emil Sekerinski, February 2017
# Declarations of the source program are entered into the symbol table as the source program is parsed. The symbol detects multiple definitions or missing definitions and reports those by calling procedure `mark(msg)` of the sc... | true |
de2dd8f8b2d0cabb2db9f1fd477b98caacd4441e | Python | NareshPS/humpback-whale | /common/execution.py | UTF-8 | 1,394 | 3.328125 | 3 | [] | no_license | #Parallel execution
from multiprocessing import Pool
from functools import partial
#Logging
from common import logging
#Progress bar
from tqdm import tqdm
import time
def _execute_parallel(func, iterator, length, *args):
#Results placeholder
results = None
#Multiprocessing pool and partial function for... | true |
fa21b5251fe70fa59c5802df77b0f87795686d2e | Python | bitnot/hackerrank-solutions | /master/algorithms/bit-manipulation/xoring-ninja/solution.py | UTF-8 | 566 | 3.046875 | 3 | [
"MIT"
] | permissive | #!/bin/python3
import os
import sys
from functools import reduce
from operator import __or__
modulo = 10**9 + 7
def xoringNinja(arr):
n_combinations = 2**(len(arr) - 1)
unique_bits = reduce(__or__, arr)
return unique_bits * n_combinations % modulo
if __name__ == '__main__':
fptr = open(os.environ['... | true |
3611ed9ead1bdec0ba749bf5f1b1fc290f7eb1b9 | Python | theviz/WhatDucksWant | /app/models.py | UTF-8 | 521 | 2.609375 | 3 | [
"MIT"
] | permissive | from mongoengine import Document, StringField, IntField, DateTimeField
import datetime
class FoodType(Document):
name = StringField()
class FoodItem(Document):
item_name = StringField()
food_id = StringField()
class DuckPark(Document):
item_id = StringField(required=True)
name = StringField()
... | true |
d5e2204d1e6cec1f4aeba47d86fd52a5e062b29c | Python | ocean20/Python_Exercises | /fileIO/openClose.py | UTF-8 | 540 | 3.640625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 29 14:35:40 2019
@author: cawang
"""
# open file
fo = open("testFile.txt", "w+")
print("Name of file:", fo.name)
print("Opening mode:", fo.mode)
fo.write("This is a line of text") # this rewrote what was in the file
# ouptputs the number of charac... | true |
14cfa6fc922f1dc216f1e2d9356066616545aa94 | Python | jwalker-depaul/messenger | /client.py | UTF-8 | 2,170 | 3.28125 | 3 | [] | no_license | import socket
import sys
from threading import Thread
LOCAL_HOST = "127.0.0.1"
SERVER_PORT = 1337
BUFF_SIZE = 1024
# Check for input (Need name and port)
if (len(sys.argv) < 3):
print("Please enter username and port")
sys.exit(0)
class Client:
# Client info
clientSocket = socket.socket()
port = "... | true |
1f14a029b901e61652635193807d0e86d10899f5 | Python | octokat/Pareto | /Pareto_part2.py | UTF-8 | 1,900 | 3.59375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 1 14:45:26 2012
@author: kel
"""
import numpy
import random
import pylab
import scipy
#from scipy.stats import pareto
#### Part 2
num_people = 100 #number of people
m = numpy.ones(num_people)*1000 #creates an array (m) with 100 people each with $1000
l = 0.1 # T... | true |
741200c7426bfb8b94f426ba397843783ace9fe3 | Python | brianchiang-tw/leetcode | /No_1450_Number of Students Doing Homework at a Given Time/by_iteration_with_zip_and_sum.py | UTF-8 | 2,835 | 3.953125 | 4 | [
"MIT"
] | permissive | '''
Description:
Given two integer arrays startTime and endTime and given an integer queryTime.
The ith student started doing their homework at the time startTime[i] and finished it at time endTime[i].
Return the number of students doing their homework at time queryTime. More formally, return the number of students... | true |
4feddf92efb4e442bb5629eed548fcd9b8752121 | Python | Helianus/Python-Exercises | /src/SumOfOddCubed.py | UTF-8 | 500 | 4.3125 | 4 | [
"MIT"
] | permissive | # Find the sum of the odd numbers within an array,
# after cubing the initial integers.
# This function will return undefined (NULL in PHP) if any of the values aren't numbers.
def cube_odd(arr):
#your code here - return None if at least a value is not an integer
ans = 0
for i in range(len(arr)):
... | true |
58f46e167ea97e34b2c93ede4f6c04736b08fc84 | Python | caizhimin/Doctor_Otis_API_mongo | /utils/cosmos_db.py | UTF-8 | 5,682 | 2.609375 | 3 | [] | no_license | import azure.cosmos.cosmos_client as cosmos_client
import inspect
environment = 'WHQ dev wap-fftsbh-dev-chn-vegctujtkpkfg web service'
cosmos_url = 'https://cdb-tsbh-dev-chn-vegctujtkpkfg.documents.azure.com:443/'
master_key = 'XP58ILePf6LSpWitpQvYH45HNK0WtisFmWizJLxECnT0VsoTrjmlniCp0tS4vSzOFlHEXTEfa375jIrvXlyr1Q=='
... | true |
927ac87bcc49142c19c92ce3811ea211c978eef8 | Python | namnguyen1911/Python-for-beginners | /1.3-Practice.py | UTF-8 | 816 | 5 | 5 | [] | no_license | #1.3 Data Types Practice
#----------------------------------------
#Question 1
#Declare an integer, a float, and a list of three fruits
#print their values and data types
#Question 2
#Change the integer to float and float to integer
#Print their new values and data types
#-------------------------------... | true |
4e6b5c48ac557256d9336ede8d200bdc5318c6f1 | Python | ama85bd/project1 | /demo1st.py | UTF-8 | 74 | 3.40625 | 3 | [] | no_license | print('Hello')
print('Hi')
nums = [1,2,3,4,5]
for i in nums:
print(i)
| true |
a57fd80570fdcc8ed7336c27592037ab4c8e31d4 | Python | marshallgallatin/cs373-idb | /app/RecipeQueries.py | UTF-8 | 4,023 | 2.859375 | 3 | [] | no_license | from sqlalchemy import orm
from useDatabase import sessionInstance
import models
from enums import Cuisine
import QueryHelpers
def getAllRecipes(limit=10, page=1, **kwargs):
"""Gets all the recipes in the database, limiting the results to up to 'limit' results.
Args:
limit (Optional(int)): The upper-b... | true |
95c7f6a7dc009951e6a1c148986a7550d58d7fb6 | Python | hyde1004/CodingBat | /list-1.py | UTF-8 | 1,288 | 3.34375 | 3 | [] | no_license | import unittest
def first_last6(nums):
return (nums[0] == 6 or nums[-1] == 6)
def same_first_last(nums):
return nums[0] == nums[-1]
def make_pi():
return [3, 1, 4]
def common_end(a, b):
return (a[0] == b[0] or a[-1] == b[-1])
def sum3(nums):
return sum(nums)
def rotate_left3(nums):
return nums[1:] + nums[0... | true |
62536fccca043a5600ea35ecf0813b4d597ac2c1 | Python | dncn123/SudokuSolver | /GeneticAlgorithm.py | UTF-8 | 5,170 | 3.296875 | 3 | [] | no_license | from collections import Counter
import numpy as np
class GeneticAlgorithm(object):
def __init__(self, quiz, pop_size):
self.sqsubset = self.get_sqsubset()
# Use this number of reverse the "error" measure to a "fitness" measure
self.base = 150
self.quizoriginal = quiz
self.po... | true |
e8f7fefe8a35be0204ae2bb89093e2cc2f057613 | Python | adolfoeliazat/Notflix | /scene_histogram.py | UTF-8 | 3,154 | 2.71875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import numpy as np
import cv2
import json
def extract_frame_hsv_histogram(frame):
bins = [32, 32]
hsv_image = cv2.cvtColor(frame, cv2.COLOR_HSV2BGR)
channels = [0, 1] # List of channels to analyze.
ranges = [[0, 180], [0, 256]] # Range per channel.
# We generate a histogram per ch... | true |
7268321986acbcf4b46c7469c07a9c3e6df07399 | Python | peterwatsonnm/python-projects | /Riemann_Sums.py | UTF-8 | 2,368 | 3.890625 | 4 | [] | no_license | """
Author: Peter Watson
estimate area under a curve usng riemann sums
has function mid_rule for the midpoint rule
trap_rule for the trapezoid rule, and
left_riemann_sum for the left riemann sum
"""
import math
def mid_rule(f, a, b, n):
delta_x = ((b-a)/n) #range of integral divided by numbe... | true |
448e8758a84e20145c5ca5c9a94e8aedd22e7bb4 | Python | nycht/homework | /def定义.py | UTF-8 | 292 | 3.828125 | 4 | [] | no_license | #类定义
class people:
name = ''
age = 0
weight = 0
def __init__(self,name,age,weight):
self.name = name
self.age = age
self.weight = weight
def name_agt_weight(self):
print('姓名:',self.name,'年龄:',self.age,'体重:',self.weight)
| true |
2c60203a89e2f52372fd151b0b6ef7aa41877bb6 | Python | amrit2356/Dev-Training-Ray | /Ray_Google_Colab/ray_video_processing/frame_resizer.py | UTF-8 | 2,748 | 2.625 | 3 | [] | no_license | import time
from queue import Queue
from threading import Thread
import ray
from grayscale_converter import GrayscaleConverter
from helper import resize_image
@ray.remote
class FrameResizer:
complete = False
enable_logging = False
def __init__(self, enable_logging=False, queue_size=8):
self.q ... | true |
ce96190af448f84c6d655f2558288ebee68743ca | Python | WuLC/LeetCode | /Algorithm/Python/945. Minimum Increment to Make Array Unique.py | UTF-8 | 699 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Created on Mon Nov 26 2018 21:22:45
# Author: WuLC
# EMail: liangchaowu5@gmail.com
# greedy
# keep idx as current position to hold the next number
from collections import Counter
class Solution(object):
def minIncrementForUnique(self, A):
"""
:type A: List[int]
:rt... | true |
7163f280ce5b7ef81d888434a6d01b6a61b56c22 | Python | choi-tak-bong/Coding-Test-Team-Note | /matrix_rotation_90_degree.py | UTF-8 | 388 | 3.1875 | 3 | [] | no_license | """출처: 이것이 코딩 테스트다 with 파이썬 (나동빈 지음, 한빛미디어 출판)"""
def rotate_a_matrix_by_90degree(a):
row_length = len(a)
column_length = len(a[0])
res = [[0] * row_length for _ in range(column_length)]
for r in range(row_length):
for c in range(column_length):
res[c][row_length - 1 - r] = a[r][c]... | true |
115cabe8a205d43a47e934c89cb360faef5ab681 | Python | SShatun/selenium_demo | /utils.py | UTF-8 | 225 | 3.03125 | 3 | [] | no_license | from time import sleep
def wait_for(bool_expression, delay=1, attempts=3):
for attempt in range(attempts):
if not bool_expression:
sleep(delay)
else:
return True
return False
| true |
6b58f7dc4a646b58eed63819e53e6d14a0f7c85e | Python | dj0wns/D-and-W-Battlesnake | /server.py | UTF-8 | 2,751 | 2.828125 | 3 | [
"MIT"
] | permissive | import os
import random
import time
import cherrypy
from board import Board
import evaluator
"""
This is a simple Battlesnake server written in Python.
For instructions see https://github.com/BattlesnakeOfficial/starter-snake-python/README.md
"""
class Battlesnake(object):
@cherrypy.expose
@cherrypy.tools.... | true |
c25fe4347ecea478212c922c4904b37d543ee0d8 | Python | katrol/algdat | /oving7/kortstokker.py | UTF-8 | 742 | 3.03125 | 3 | [] | no_license | from sys import stdin
from itertools import repeat
def merge(decks):
word = []
done = False
while done == False:
done = True
smallest = None
for deck in xrange(len(decks)):
if (decks[deck] != [] and (smallest == None or decks[deck][0][0] < decks[smallest][0][0])):
... | true |
41a31aca878ada31abcd8a01d044c16771e71f63 | Python | munnellg/ODNB_DIB_Dataset | /odnb/01_scrape/list_dois.py | UTF-8 | 489 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import sys
from bs4 import BeautifulSoup
def main():
for fname in sys.argv[1:]:
soup = BeautifulSoup(open(fname), "html.parser")
docid = os.path.splitext(os.path.basename(fname))[0]
elements = soup.find_all("li", {"class":"doi"})
uri = "NONE"
... | true |
6e87e582a6d6f2158cf5b2ff060c948ef2f0ec21 | Python | spectrtrec/clouds_satellite | /utils/loss.py | UTF-8 | 1,236 | 2.9375 | 3 | [] | no_license | import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import functional as F
eps = 1e-6
class StableBCELoss(nn.Module):
def __init__(self):
super(StableBCELoss, self).__init__()
def forward(self, input: torch.Tensor, target: torch.Tensor):
in... | true |
8b8ff3a6baef2decf43d59c46200badc23a86164 | Python | leonghchan/python-exercises-codingbat | /CodingBat_WarmUp2_array123.py | UTF-8 | 788 | 4.21875 | 4 | [] | no_license | """Given an array of ints, return True if the sequence of
numbers 1, 2, 3 appears in the array somewhere."""
# Notes
# if len(nums) < 3 return False
# for i in len(nums[:-2]):
# if nums[i: i+3] == np.array([1, 2, 3])
# return True
import numpy as np
def array123(nums):
if len(nums) < 3:
return False
... | true |
1dae06f18023e001a14f7a0d9e0682bf9e60c89e | Python | RonRan123/AOC | /2020/Day11/day11.py | UTF-8 | 2,214 | 3.046875 | 3 | [] | no_license | import copy
import numpy as np
def checkArea(row, col):
global data
tmp = []
for x in [-1, 0, 1]:
for y in [-1, 0, 1]:
if 0 <= x+row < len(data) and 0 <= y+col < len(data[0]):
tmp.append((x+row, y+col))
tmp.remove((row, col))
# print(sum([data[r][c]=="#" for r, c... | true |
ef4278e548939a3173805c34a99186b59220c1b0 | Python | Kryptonian92/Algorithms | /PythonAlgos/Basic13/averageArray.py | UTF-8 | 229 | 3.421875 | 3 | [] | no_license | # Finds the average of the array
import math
newArr = [2,4,2];
newAvg = 0;
def avgArray(arr,avg):
for i in range (len(arr)):
avg += arr[i];
print(avg)
print math.floor((avg/len(arr)))
avgArray(newArr,newAvg)
| true |
6b1a0dd59719b502cf0626e6317994075b9dc389 | Python | chokrihamza/advanced-Python- | /class_variables.py | UTF-8 | 495 | 3.34375 | 3 | [] | no_license | class Person:
a=20
def __init__(self,name,age):
self.__name=name
self.__age=age
@property
def name(self):
return self.__name
@name.setter
def name(self,var):
self.__name=var
@name.deleter
def name(self):
print(f'the value of {self.name} has been de... | true |
9e0d519e84049ccb444c4e89402e8db6042977ba | Python | chakravarthiBagula/Project-Euler | /13.py | UTF-8 | 123 | 3.546875 | 4 | [] | no_license | """ Project Euler #13: Large sum """
n = int(input())
res = 0
for i in range(n):
res += int(input())
print(str(res)[:10]) | true |
a4624809152aa5142145faaba7faa43d2ad9aa22 | Python | shahabty/3DSNetwork | /crfseg/meanfield.py | UTF-8 | 15,449 | 2.84375 | 3 | [] | no_license | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
from .utils import unfold, to_np
class MeanFieldCRF(nn.Module):
"""
Class for learning and inference in conditional random field model using mean field approximation and convolutional approxim... | true |
a6697e741b18a4323e8e859c789fa2ba7ddba19e | Python | Jatkas/CS50 | /pset6/cash/cash.py | UTF-8 | 295 | 3.4375 | 3 | [] | no_license | from cs50 import get_float
while True:
cash = get_float("Change owed: ")
if cash > 0:
break
cents = round(cash * 100)
coins = int(cents / 25)
coins = coins + int((cents % 25)/10)
coins = coins + int(((cents % 25)%10)/5)
coins = coins + int((((cents % 25)%10)%5)/1)
print(coins) | true |
b2646104b277226fe96f1841da63cf5c5259ce22 | Python | ellisztamas/faps | /faps/partition_accuracy.py | UTF-8 | 1,880 | 3.1875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
def partition_accuracy(true, proposed, rtype='all'):
"""
Returns the accuracy of a proposed partition with reference to a known true partition.
Pr(A|B) is the probability of inferring relationship of type A between two individuals
given that the true relationship is type B. This... | true |
4fd856b78d2cc4080266d989d98a656982e9ce1d | Python | antony10291029/lxfpyanswer | /45base64.py | UTF-8 | 1,070 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import base64
print(base64.b64encode(b'binary\x00string'))
print(base64.b64decode(b'YmluYXJ5AHN0cmluZw=='))
#这是加密字符串,和解密字符串,前面b'代表Byte,即以byte形式识别字符串
#由于标准的Base64编码后可能出现字符+和/,在URL中就不能直接作为参数,所以又有一种"url safe"的base64编码,其实就是把字符+和/分别变成-和_:
print(base64.b64encode(b'i\xb7\x1d\xfb\xef\xff'))
#转换的内容含有斜杠,... | true |
65378239d50456e3f3a626141c313cafbe161c60 | Python | trofik00777/EgeInformatics | /probn/01.04/25.py | UTF-8 | 482 | 3.09375 | 3 | [] | no_license | def f(n):
k = []
i = 1
while i * i <= n:
if n % i == 0:
k.append(i)
k.append(n // i)
i += 1
k = list(set(k))
k.sort()
return len(k), k
k = []
mk = 0
for i in range(586132, 586430 + 1):
kol, a = f(i)
if kol > mk:
k = []
... | true |
a5f2e4f4013e3764bc147224b7aba3dff0e9fe5b | Python | COMHTVM/Dreem_project_2019_MLC | /models/classifier.py | UTF-8 | 679 | 2.84375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = ['MLPClassifier']
class MLPClassifier(nn.Module):
"""
Simple 2 layers perceptron classifier
"""
def __init__(self, in_features: int, out_features: int, hidden_features: int = 100):
super(MLPClassifier, self).__init__... | true |
964f1ab8a3a4dd7751d22596138f4cc686e40afc | Python | aditya140/PtrNet_TSP_Solver | /parser.py | UTF-8 | 870 | 3 | 3 | [] | no_license | import numpy as np
class FileParser(object):
"""[summary]
Parser to parse the dataset files provided by the author
"""
def __init__(self, numOfNodes, filePath):
self.numOfNodes = numOfNodes
self.filePath = filePath
self.filedata = open(filePath, "r").readlines()
self.pr... | true |
13c31d02c231df816f193f0ae55312ca38fc1a05 | Python | tensorflow/privacy | /tensorflow_privacy/privacy/privacy_tests/secret_sharer/generate_secrets_test.py | UTF-8 | 3,779 | 2.546875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | # Copyright 2021, The TensorFlow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | true |
173420fa07ebe3b86ea97fe67c4c88e1bc98e23d | Python | prsfreal/selenium | /utilities/DataBaseConnection.py | UTF-8 | 437 | 2.546875 | 3 | [] | no_license | import mysql.connector
from decouple import config
class MySQLConnection:
def __init__(self):
self.mydb = mysql.connector.connect(
host=config('MYSQLHost'),
user=config('MYSQLUser'),
password=config('MYSQLPassword'),
database=config('MYSQLDatabase')
)... | true |
102ccdb0f20d3cbdbe006581605b9d9fc9fa3900 | Python | Khamparia1988/indiaCoronaStatsScraper | /webscrape.py | UTF-8 | 1,074 | 3.15625 | 3 | [
"MIT"
] | permissive | from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
import csv, json
my_url = 'https://www.mohfw.gov.in/'
#opening up connection, grabbing the page
uClient = uReq(my_url)
page_html = uClient.read()
uClient.close()
#html parsing
page_soup = soup(page_html, "html.parser")
#grabs each ro... | true |
93effca29199cdb5eff64a195504eb3634834412 | Python | tobiasolof/yesipe | /Backend/nn_utils.py | UTF-8 | 2,119 | 2.515625 | 3 | [] | no_license | import numpy as np
from keras import backend as k
from keras import Model
from keras.layers import Input, Embedding, Lambda, Dense
MAX_SEQUENCE_LENGTH = 20
def chosen_to_ind_array(chosen, ingr2vec):
chosen_ind = [ingr2vec.wv.index2word.index(i) + 1 for i in chosen]
chosen_ind += [0] * (MAX_SEQUENCE_LENGTH -... | true |
2e149a67de49d68771646c0b9f44328e7bd8537e | Python | GitSloth/Project_Bank | /loginsystem/login.py | UTF-8 | 2,896 | 3.28125 | 3 | [] | no_license | import users
while True:
print("please hold your card against the card scanner")
nameInput = input()
for user in users.userTable:
if user[0] == nameInput:
break
# elif user == users.userTable[-1] and user[0] != nameInput:
# print("This user does not exist. Would y... | true |
97ca919f9339d17d645d33ad776ab8f7dbac6af1 | Python | 738654805/landmark-detection | /SAN/lib/utils/image_utils.py | UTF-8 | 3,741 | 2.78125 | 3 | [
"MIT"
] | permissive | import numpy as np
import os
## bbox is a vector has two values
def padHeight(image, padValue, bbox):
assert isinstance(image,np.ndarray), 'incorrect type : {}'.format(type(image))
assert len(image.shape) == 3 and image.shape[2] == 3, 'incorrect shape : {}'.format(image.shape)
height, width = image.shape[0], ima... | true |
55b0e677967d47c62638a355be8a5736ef82558a | Python | wayne315315/lottery_combination_analysis | /deprecated/main.py | UTF-8 | 4,054 | 3.09375 | 3 | [] | no_license | import itertools as iter
import numpy as np
import time
def compare1(a1,a6_dict):
for i in a1:
if a6_dict.get(i) is not None:
return True
return False
def compare2(a1,a2,a6_dict):
for i in a1:
if a6_dict.get(i) is not None:
for j in a2:
if a6_dict.... | true |
2769c999ec50d61cb8124aedb1fdb3db8e5a94a2 | Python | rliffredo/advent-of-code | /aoc_21/08.py | UTF-8 | 2,097 | 3.34375 | 3 | [] | no_license | import itertools
from dataclasses import dataclass
from typing import List
from common import read_data
@dataclass
class DisplayAnalysis:
signals: List[str]
digits: List[str]
def parse_data():
raw_data_lines = read_data("08", True)
raw_signals_and_digits = [line.split("|") for line in raw_data_line... | true |
04bc9b7133be6f3ce5c68db3df992342bd066e90 | Python | navitacion/prostate-cancer-grade-assessment-challenge | /src/utils/qwk.py | UTF-8 | 1,439 | 2.796875 | 3 | [] | no_license | import torch
import torch.nn.functional as F
# Reference https://www.kaggle.com/mawanda/qwk-metric-and-loss-in-pytorch
def quadratic_kappa_coefficient(output, target):
n_classes = target.shape[-1]
weights = torch.arange(0, n_classes, dtype=torch.float32, device=output.device) / (n_classes - 1)
weights = ... | true |
99eb7e14f3dab4fc72fcd85c08b30d7741345455 | Python | rogovskiy/nr_challenge | /ngrams.py | UTF-8 | 1,396 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python
import sys
import fileinput
import nltk
from nltk.tokenize import RegexpTokenizer
from collections import Counter
nltk.download('punkt')
tokenizer = nltk.RegexpTokenizer(r"\w+[’']\w+|\w+")
def tokenize(line):
return tokenizer.tokenize(line.lower())
class NgramCounter:
def __init__(se... | true |
0b79142b3516c3db433db6218ce8e1153a8a3cfc | Python | nikisix/stocks | /python/regression.py | UTF-8 | 1,912 | 2.734375 | 3 | [] | no_license | from __future__ import print_function
import datetime
import numpy as np
import pylab as pl
from matplotlib.finance import quotes_historical_yahoo
from matplotlib.dates import YearLocator, MonthLocator, DateFormatter
import matplotlib.pyplot as plt
#from sklearn.hmm import GaussianHMM
print(__doc__)
################... | true |
a111720a4f62edc27e244ccde7898f8eee6c0937 | Python | RiskIQ/msticpy | /msticpy/analysis/anomalous_sequence/anomalous.py | UTF-8 | 8,183 | 3.125 | 3 | [
"LicenseRef-scancode-generic-cla",
"LGPL-3.0-only",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"ISC",
"LGPL-2.0-or-later",
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"LGPL-2.1-only",
"Unlicense",
"Python-2.0",
"LicenseRef-scancode-python-cwi",
"MIT",
"LGPL-2.1-or-later",
"GPL-2.... | permissive | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""
Wrappe... | true |
652f716204e9b7500edfd440a646e5c9b3def076 | Python | jormeli/rl-pong | /replay_buffer.py | UTF-8 | 5,482 | 3.25 | 3 | [] | no_license | import numpy as np
import random
class ReplayBuffer(object):
"""Experience replay buffer with priority sampling."""
def __init__(self, capacity, state_shape, action_shape, prioritized=True, stack_size=None):
"""Creates a new buffer.
capacity (int): The maximum number of items in the new buff... | true |
19c76b06e3c17035e08d04fd12ce65ce46f4022d | Python | Acang98UP/LeetcodeInPython | /1486-数组异或操作-Simple/xorOperation.py | UTF-8 | 438 | 3.203125 | 3 | [] | no_license | def xorOperation(n: int, start: int) -> int:
def sumXor(x):
if x % 4 == 0:
return x
if x % 4 == 1:
return 1
if x % 4 == 3:
return 0
return x + 1
e = n & start & 1
s = start >> 1
ans = sumXor(s - 1) ^ sumXor(s + n - 1)
return ans <<... | true |
7294f2308afa0d16df46a1ba45c1b995236edbad | Python | baekjonghun/PythonBasic | /py_workspace/06_OBJECT/package01/calculator.py | UTF-8 | 130 | 3.421875 | 3 | [] | no_license | number1 = 7
number2 = 3
def sum():
print('sum: ',number1 + number2)
def sub():
print('sub: ',number1 - number2)
| true |
213463876a08b380534c625288a7f635bcdabc1d | Python | Debugger001/Gomoku_AI | /Best_so_far.py | UTF-8 | 80,740 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
START = "START"
PLACE = "PLACE"
DONE = "DONE"
TURN = "TURN"
BEGIN = "BEGIN"
END = "END"
BOARD_SIZE = 15
EMPTY = 0
ME = 1
OTHER = 2
myvalue_1 = {
"FIVE": 100000000000,
"Lv4": 1000000,
"Dd4a": 520,
"Dd4b/c": 500,
"Lv3": 300,
"Dd3a0": 20,
"Dd3a1": 20,
"Dd3b_safe": 20,
"Dd3b_da... | true |
7820704d072d8747430eda145a2dfebe8328f91c | Python | narinn-star/Python | /Review/Chapter02/2-22.py | UTF-8 | 85 | 3.578125 | 4 | [] | no_license | #2-22
lst = [3, 7, -2, 12]
MAX = max(lst)
MIN = min(lst)
print("범위 : ", MAX-MIN) | true |
1e92c9e0695b19a4a3c116731bc3ac6f58aa251e | Python | oysstu/pyimc | /pyimc/lsf.py | UTF-8 | 21,186 | 2.71875 | 3 | [
"MIT"
] | permissive | """
Functionality related to the DUNE lsf logs.
"""
import io
from io import BytesIO
import os
import logging
import ctypes
import pyimc
import pickle
import heapq
import gzip
import warnings
from typing import List, Dict, Union, Iterable, Type, Tuple
import inspect
try:
import pandas as pd
except ModuleNotFoundE... | true |
4f448cf51d14454781c8d7b977ed5c36e32a6b3a | Python | emrig/w4156-PEAS-Oktave | /tests/test_fail_str.py | UTF-8 | 2,185 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | import sys
import os.path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'code')))
from sp_search import sp_search
import unittest
class SearchTest(unittest.TestCase):
"""This class uses the Spotify Search to test the response
returned by the Spotify API in sp_search.... | true |
c79f016a7cf1d966a37599ac73783fa48dfdc64c | Python | chenstrace/practise | /python/predisio_study/presidio_demo.py | UTF-8 | 645 | 2.796875 | 3 | [] | no_license | from presidio_analyzer import AnalyzerEngine
from presidio_anonymizer import AnonymizerEngine
text="My phone number is 212-555-5555"
# Set up the engine, loads the NLP module (spaCy model by default)
# and other PII recognizers
analyzer = AnalyzerEngine()
# Call analyzer to get results
results = analyzer.analyze(tex... | true |
1c4456bb391aaf7f1426505fa7782a36c1be3c68 | Python | tianshang486/Pythonlaonanhai | /day09 课堂笔记以及代码/day06 课堂笔记以及代码/day06/01 作业讲解.py | UTF-8 | 4,915 | 3.8125 | 4 | [] | no_license | # 请将列表中的每个元素通过 "_" 链接起来。
#
# users = ['李少奇','李启航','渣渣辉']
# 请将列表中的每个元素通过 "_" 链接起来。
#
users = ['李少奇','李启航',666,'渣渣辉']
# users[-2] = '666'
# s = '_'.join(users)
# print(s)
# s = 'alex'
# print(str(s))
# 方法二
# s = ''
# for i in users:
# s = s + '_' + str(i)
# print(s)
# s = ''
# for index in range(len(users)):
# if... | true |
16a9f2a6defb32d40d049ff564ba4647ae8b87e3 | Python | larsks/fake-neopixel | /examples/cycle1.py | UTF-8 | 432 | 2.78125 | 3 | [] | no_license | import machine
import neopixel
import time
led_count = 30
np = neopixel.NeoPixelRing(machine.Pin(2), led_count)
while True:
for i in range(led_count):
for j in range(6):
cj = led_count*j
np[(i-j) % led_count] = (0, 255-cj, 255-cj)
for j in range(6):
cj = led_... | true |
530c7fe96bb3c2868ba2a6c3e00e564d73f4fdea | Python | yifanliu98/gitSFUBowen | /CMPT120/Assignment/5/more_examplesTurtles.py | UTF-8 | 5,808 | 4.03125 | 4 | [] | no_license | ## CMPT 120
## author: Diana Cukierman
##
## some useful functions that can be used with turtles
##
##
## notice:
## - first line of documentation: USEFUL!! (is shown when typying to call
## the function)
##
## - including in the documentation the TYPE OF THE FUNCTION
## (type of par... | true |
bdc2c7c2f2e42c2fab0bbdf3a93ba86b1ec7f1f4 | Python | tzahishimkin/extended-hucrl | /rllib/util/neural_networks/neural_networks.py | UTF-8 | 13,816 | 3.140625 | 3 | [
"MIT"
] | permissive | """Implementation of different Neural Networks with pytorch."""
import torch
import torch.jit
import torch.nn as nn
from rllib.util.utilities import safe_cholesky
from .utilities import inverse_softplus, parse_layers, update_parameters
class FeedForwardNN(nn.Module):
"""Feed-Forward Neural Network Implementati... | true |