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 |
|---|---|---|---|---|---|---|---|---|---|---|
c2306478ef9c10df31da02bf9ad86b0f847fb54d | Naveduran/holbertonschool-higher_level_programming | /0x0F-python-object_relational_mapping/2-my_filter_states.py | UTF-8 | 810 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python3
'''my module 2'''
import MySQLdb
from sys import argv
def My_Filter_States(username, password, db_name, state_name):
'''shows only the specified names of states'''
db = MySQLdb.connect(host="localhost",
port=3306,
user=username,
... | true |
d30611afe20c14206ec5a4d88bdb24a0dce825db | excelexcavator/MyLeetCode | /medium/80.py | UTF-8 | 558 | 3.046875 | 3 | [] | no_license | class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums: return 0
temp = nums[len(nums)-1]
flag = 0 # the same number has only appeared for once
for i in range(len(nums)-2,-1,-1):
... | true |
3950167b5fd696c8e5b2a6f42caef730cbdbca40 | faradaywallet/faradayapp | /db_controller.py | UTF-8 | 4,489 | 2.65625 | 3 | [
"MIT"
] | permissive | __author__ = 'Bren'
import pymysql.cursors
class FaradayDB:
def __init__(self, c_host, c_port, c_user, c_password, c_db):
self.connection = ''
self.c_host = c_host
self.c_port = c_port
self.c_user = c_user
self.c_password = c_password
self.c_db = c_db
def start... | true |
bc94a39ebe859384392e38d0e38e4994b1f247f4 | valeman/vest-python | /vest/aggregations/entropy.py | UTF-8 | 632 | 2.59375 | 3 | [
"MIT"
] | permissive | import numpy as np
import nolds
from tsfel.feature_extraction import wavelet_entropy
class EntropyFeatures:
"""
Entropy based features
"""
@staticmethod
def sample(x: np.ndarray):
""" Sample Entropy
:param x: a 1-d numeric vector
:return: scalar feature
"""
... | true |
4bc745eea4fbbef4af234424dc4356f6aa55ee04 | twosixlabs/bro-clickhouse | /generate_schema.py | UTF-8 | 4,136 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
import os
import sys
from json import dumps
import itertools
from collections import OrderedDict
def reader(f):
line = ''
headers = {}
it = iter(f)
while not line.startswith("#types"):
line = next(it).rstrip()
k,v = line[1:].split(None, 1)
headers[k] = v
... | true |
332f899124482cfee3566b42962d87b00aff0742 | DAVIDCRUZ0202/DS-Unit-3-Sprint-2-SQL-and-Databases | /module1-introduction-to-sql/rpg_queries.py | UTF-8 | 3,862 | 3.046875 | 3 | [
"MIT"
] | permissive | import sqlite3
import os
DB_FILEPATH = os.path.join(os.path.dirname(__file__), "rpg_db.sqlite3")
conn = sqlite3.connect(DB_FILEPATH)
curs = conn.cursor()
# 1How many total characters are there?
chars = 'SELECT COUNT(*) FROM charactercreator_character'
result1 = curs.execute(chars).fetchall()
print("Question 1", resu... | true |
73e199b1cd394d8467a0110d6d4b8571f3616ab4 | SunghoonSeok/Study | /keras/keras56_optimizer.py | UTF-8 | 3,163 | 2.8125 | 3 | [] | no_license | import numpy as np
# 1. 데이터
x = np.array([1,2,3,4,5,6,7,8,9,10])
y = np.array([1,2,3,4,5,6,7,8,9,10])
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
# 2. 모델구성
model = Sequential()
model.add(Dense(1000, input_dim=1))
model.add(Dense(100))
model.add(Dense(100))
model.add(Dense... | true |
5970515eb82dd012e9e1f80103c422b195da6fa7 | ruthdevgpwr/introducao-programacao-uniesp | /atividade-A04/Q05.py | UTF-8 | 688 | 3.953125 | 4 | [] | no_license | print('--- IDENTIFICAÇÃO DA CATEGORIA DO NADADOR ---')
idade = int(input('Nadador, por favor, informe a sua idade para saber em qual categoria você se encaixa: '))
if idade >= 5 and idade <= 7:
print('Nadador, você se encaixa na seguinte categoria: INFANTIL A')
elif idade >= 8 and idade <=10:
print('Nada... | true |
15c334d4a54c0641df04a519aaee0a16bbcdba01 | sh1nu11bi/OkStupid_PlentyofPhish | /Plenty_of_Phish/PlentyofPhish.py | UTF-8 | 7,540 | 2.546875 | 3 | [] | no_license | import mechanize
from bs4 import BeautifulSoup
import sqlite3 as db
## Login with Provided Username and Password
def pof_login(pop, username, passwd):
login_status = False
pop.open("http://www.pof.com")
pop.select_form("frmLogin")
pop["username"] = username
pop["password"] = passwd
pop.submit()... | true |
3e01a1f71cbdf1f6737d4bf3d43704863e399632 | jhven/DTU_work | /1.semester/02807_ComputationalToolsForDataScience/Week2/Exercises/Week2Exercises/Chapter1/ex1_4_C2.py | UTF-8 | 1,159 | 3.546875 | 4 | [] | no_license | import sys
x = sys.argv[1].split(',')
def findLongestPlateau(x):
plateauValue = -999999999
plateauLocation = [0, 0]
for i in range(len(x)):
if i == 0:
plateauValue = x[i]
elif i == len(x) - 1 and plateauValue < x[i]:
plateauValue = x[i]
plateauLocation[0... | true |
43cbc803f514880e77f3ee4d140c699b3ad58733 | dlyshare/TripletChain | /loss.py | UTF-8 | 4,564 | 2.75 | 3 | [] | no_license | """
Created on Thu Nov 24 12:50:06 2015
TripletChainer
@author: Igor A. Stankevich (loknar at list.ru)
created with help of Alfredo Canziani, Torch TripletEmbedding (https://github.com/Atcold/torch-TripletEmbedding) author
License: MIT
"""
import numpy as np
from chainer import cuda
from chainer impo... | true |
1ca07f097fa6075c206d5b2e3461f6bd7109f646 | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/abc007/B/4923920.py | UTF-8 | 61 | 3.40625 | 3 | [] | no_license | s = input()
if s == 'a':
print(-1)
else:
print('a') | true |
2230e8e0e7d1cfe8153750cea332d2dca37ea010 | Muikkunen/Defence | /explosion_graphics_item.py | UTF-8 | 1,018 | 2.625 | 3 | [] | no_license | from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import QTimer
class ExplosionGraphicsItem(QtWidgets.QGraphicsPixmapItem):
def __init__(self, location, explosion_type, explosion_time, square_size):
# Call init of the parent object
super(ExplosionGraphicsItem, self).__i... | true |
c343cfd35608231ceb01de7c1be0501e5c802474 | KonradRomanski/python_tasks | /pp_test_who_will_pass.py | UTF-8 | 1,121 | 2.875 | 3 | [] | no_license | def main():
a = int(input())
M = [[0 for i in range(a)] for j in range(a)]
W = [[0 for i in range(a)] for j in range(a)]
for i in range(a):
l = [int(i) for i in input().split()]
for j in range(a):
M[i][j] = l[j]
W[i][j] = l[j]
# M[0][0] = a
# p... | true |
e347f2868ffa9d3e10018e1427e6fb2b877cf5c6 | huiiz/WeSeek | /common/search.py | UTF-8 | 2,027 | 2.671875 | 3 | [] | no_license | from django.db.models import Q
from activity.models import Activity, ActivityCollection
from competition.models import CompetitionInfo, CompetitionCollection
from user.info import get_user_info
from user.models import User
def search(keyword):
"""
搜索功能
:param keyword:
:return:
"""
c_res = sea... | true |
92e5ebe38d0a1fa587392152a4678019d0f89897 | KarAbhishek/MSBIC | /BioInformatics/Week_12/working_prefix_trie_match.py | UTF-8 | 1,641 | 3.28125 | 3 | [] | no_license | class IdGen:
id_var = 0
@staticmethod
def get_id():
temp = IdGen.id_var
IdGen.id_var += 1
return temp
def trie_construction(ls_of_strings):
trie = [{}]
edges = []
IdGen.get_id()
for single_string in ls_of_strings:
make_tree(single_string, trie, edges)
... | true |
a0c3798dc2045a5d1ed2837cff34ead3af31515d | bbhunter/sheepl | /utils/base/base_autoit_block_class.py | UTF-8 | 830 | 2.609375 | 3 | [
"MIT"
] | permissive | """
Base class for AutoIT Blocks so that the core INIT functions are based.
Purely for inheritance
Allows the new AutoIT Block definition to expand the constructor
TODO Needs to expand and take in *args
"""
__author__ = "Matt Lorentzen @lorentzenman"
__license__ = "MIT"
##########################################... | true |
8b78a0a232ac3d6651c6d286fdb4e9da9bcc0dd5 | valentinmoulard/Dijkstra | /test(affiche_graphe).py | UTF-8 | 647 | 3.515625 | 4 | [] | no_license | import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
# G=nx.Graph()
# G.add_node("A")
# G.add_node("B")
# G.add_node("C")
# G.add_edge("A","B")
# G.add_edge("B","C")
# G.add_edge("C","A")
# print("Nodes: " + str(G.nodes()))
# print("Edges: " + str(G.edges()))
G=nx.Graph()
G.add_node("a")
G.add_... | true |
9ff3ea0e19418a261c0a5514a55e04681ba70d6d | tomasr8/fastslam | /mincostflow/cc.py | UTF-8 | 785 | 2.828125 | 3 | [] | no_license | from bf import find_neg_cycle
from graph import Matrix, ResidualMatrix
def cycle_canceling(matrix: Matrix):
iters = 0
while True:
residual_edges = ResidualMatrix.to_edges(matrix)
source = matrix.M + matrix.N
delta, cycle = find_neg_cycle(residual_edges, matrix.M, matrix.N)
i... | true |
11d1ec9e94492fbd6286db07e755696a5c44a388 | AndroidOL/RE0DamageCalculator | /RE0.py | UTF-8 | 25,162 | 3.09375 | 3 | [
"MIT"
] | permissive | class Character:
SKILLTYPE = ["普通攻击", "AP 技能", "SP 技能", "必杀技能"]
Attack = {
"基础攻击": 0,
"伤害加成": 0
}
Probability = [0, 0]
Auxiliary = [150, 1.5]
AttackValue = [0, 0, 0]
Skill = {
"A": {
"TYPE": 0,
"NAME": "",
"LV1": [(0, 0... | true |
e42e346e22eed326528d0b249644ccba69fa2756 | ancalabrese/DailyProblem | /ReverseLinkedList/reverseLinkedList.py | UTF-8 | 2,271 | 4.75 | 5 | [] | no_license | # Given a singly-linked list, reverse the list. This can be done iteratively or recursively.
# Can you get both solutions?
# Example:
# Input: 4 -> 3 -> 2 -> 1 -> 0 -> NULL
# Output: 0 -> 1 -> 2 -> 3 -> 4 -> NULL
#Proposed solution: O(n)
# Iterative method:
# 1. Set node, previous and next node equals to head
#... | true |
75ccae5d3717fed422320dee79b54146632839a6 | NicoChampagne/MissionHacks-ANSR | /PythonPrograms/jobSuggestion.py | UTF-8 | 606 | 2.84375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn import svm
import json
import sys
arrayofValues=[]
sys.argv.pop(0);
for eachArg in sys.argv:
arrayofValues.append(int(eachArg))
df =pd.read_csv("P:\Git\EduPath\PythonPrograms\jobsuggestions.csv")
feature_names = ["Mathematics","Sciences","Languages","Arts","P... | true |
3830c584d9d0dfd25ed423daffb8238dd23bb8d2 | Chandan-IITI/online-continual-learning | /experiment/metrics.py | UTF-8 | 2,252 | 2.5625 | 3 | [] | no_license | import numpy as np
from scipy.stats import sem
import scipy.stats as stats
def compute_performance(end_task_acc_arr):
"""
Given test accuracy results from multiple runs saved in end_task_acc_arr,
compute the average accuracy, forgetting, and task accuracies as well as their confidence intervals.
:para... | true |
160da20a1d1229c20a4ad1b2a2fa50772c703f87 | Hann/Python_Snake_Game | /snake.py | UTF-8 | 6,696 | 3.421875 | 3 | [] | no_license | #-*- coding:utf-8 -*-
import random
import thread , time
import unittest
from Tkinter import *
'''
class TestSnakeGame(unittest.TestCase):
def setUp(self):
print "jinsoo"
def tearDown(self):
print "zzang"
def testAdd(self):
self.assertEqual(2 , 1+1)
def testSnakeMoveDown(self)... | true |
9d58656beb46479cc71e9e23fda451a1bd809fec | DSE-S12-ICBMDefence/C-DH | /pixel angle function.py | UTF-8 | 1,614 | 2.984375 | 3 | [] | no_license | import math as m
import numpy as np
#I made this but I really think it's wrong and that it makes no sense now
def pic_angles(w_bright,h_bright,n_pix_w,n_pix_h,FOV_w,FOV_h):
FOV_w = FOV_w*m.pi/180
FOV_h = FOV_h*m.pi/180
center_width = -(n_pix_w/2-0.5)+(w_bright-1)
center_height = -(n_pix_h/2-0.5)+(h_... | true |
10a04deabb9efb9637e8814784ed447a15d0f5d7 | nicolaskruger/reconhecimento | /teste/listOfLinks.py | UTF-8 | 207 | 2.546875 | 3 | [] | no_license | def func_names():
f = open("allxmlNames.txt","r")
txt = f.readline()
lOfLinks = []
while(txt != ''):
lOfLinks.append(txt)
txt = f.readline()
f.close()
return lOfLinks
| true |
8458fa2a6b09ea110c2cc1e1594a90a31d6fd7cb | nixawk/hello-python3 | /ctypes/ctypes.from_buffer_copy.py | UTF-8 | 2,309 | 3.03125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
from ctypes import *
import socket
import struct
class IP(Structure):
_fields_ = [
("ihl", c_uint8, 4),
("version", c_uint8, 4),
("tos", c_uint8),
("len", c_uint16),
("id", c_uint16),
("offset", c_uint16),
("ttl", ... | true |
54397030b63c03892968cf6161f319ebb4b97c63 | AnkitP7/python | /scraper.py | UTF-8 | 1,909 | 3.234375 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
"""
Author : Ankit Patel
Scraper class that parses through pages and fetches links
"""
class Scraper:
def __init__(self, parser, url, page=1):
self.parser = parser
self.url = url
self.page = page
def scrape(self):
if self.parser:
... | true |
8398a7aea07d0f65826ab381c859743862cb5ec4 | rotemga/infosec7 | /q5/q5.py | UTF-8 | 1,535 | 2.734375 | 3 | [] | no_license | import json, os, time
import threading
import run
#Generate fix json file for passing the validate_script function in run.
def generate_fix_json_file():
return json.dumps({"command": "echo cool", "signature": "6c68e3c88a87339fa8667cb36c82d4cf0bdcc131efcf98eb8df1867122e66e0e2e9d8d1ce01c40261fb8bde61a7768215c20feb... | true |
66f49e25fc7692c44ba7a3f14c5c3de262ab4283 | yxqd/luban | /core/luban/AppConfig.py | UTF-8 | 2,923 | 2.796875 | 3 | [] | no_license | # -*- python -*-
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Jiao Lin
# California Institute of Technology
# (C) 2006-2011 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | true |
047fef2c1cf3e7d7fc245cf2df9aaeb7d1e1fe29 | D1egoS4nchez/Ejercicios | /Ejercicios/ejercicio200.py | UTF-8 | 2,425 | 4.59375 | 5 | [] | no_license | #!/usr/bin/env python3
#-*- coding: utf-8 -*-
"""
Plantear una clase Persona que contenga dos atributos: nombre y edad. Definir como responsabilidades la carga por teclado y su impresión.
En el bloque principal del programa definir un objeto de la clase persona y llamar a sus métodos.
Declarar una segunda clase llama... | true |
1db9bebc406bfcf426b7295b3c9f5a6bfdce0d6c | sabinM1/8424432925592889329288197322308900672459420460792433 | /show.py | UTF-8 | 1,031 | 3.703125 | 4 | [
"MIT"
] | permissive | # Inspired by https://youtu.be/L4ArlAfKTLA
# Program made by Maxim Sabin
# See this project at https://github.com/sabinM1/8424432925592889329288197322308900672459420460792433
# Code:
# --GCD--
def hcfnaive(a,b):
if(b==0):
return a
else:
return hcfnaive(b,a%b)
# --GCD end--
# the one and only:
ma... | true |
842b73908020574f9e9a2dc6a43fb38316ef041b | edybsd/BotManager | /botmanager/config.py | UTF-8 | 7,021 | 2.609375 | 3 | [
"BSD-2-Clause"
] | permissive | import argparse
import yaml # noqa
import io # noqa
import logging
import os
import sys
log = logging.getLogger(__name__)
class Config(object):
"""Config class
Manages params and the config file
"""
def __init__(self, args):
self.arguments=self.parse_args(args)
def parse_args(self,... | true |
b37ae771259f7284a01239754b2aed636b33c138 | imrehg/physicscalc | /loopfilter/transfer/zerogain.py | UTF-8 | 4,067 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python2
from __future__ import division
import numpy as np
import pylab as pl
import scipy.optimize as op
import scipy.interpolate as ip
def angle(v):
""" Complex number to angle conversion """
try:
deg = np.arctan(v.imag / v.real) / np.pi * 180
except ZeroDivisionError:
if v... | true |
8d21638e28d29e707d37b28c1c6d9c4a3f4b4a64 | Refreezer/DSP-SIGS | /ml/ThirdTask/4.py | UTF-8 | 2,640 | 2.78125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model, datasets
from scipy import stats
def swap_each_third(vec, val):
for i in range(2, len(vec), 3):
vec[i] = val
rv_normal = stats.norm(0, 1)
x_train = np.array(rv_normal.rvs(400))
x_test = np.array(rv_normal.rvs(200))
y_t... | true |
e54c1aba4b4233214c41d8c07d25e26907f11bd4 | bryanbritten/cybersecurity-ioc-etl | /firehose.py | UTF-8 | 6,457 | 2.6875 | 3 | [] | no_license | import tweepy
import json
import re
import splunk2
import requests
from bs4 import BeautifulSoup as BS
from urllib.parse import urlparse
import sys
class Firehose(tweepy.StreamListener):
def __init__(self, splunk):
super(Firehose, self).__init__()
self.splunk = splunk
def on_error(sel... | true |
482126ffe80ebc3e99717752b01f0258119b5e18 | kevindvaf/rocketmiles | /features/steps/search.py | UTF-8 | 4,218 | 2.796875 | 3 | [] | no_license | """
examples
@when('the user searches for "{phrase}"')
def step_impl(context, phrase):
search_input = context.browser.find_element_by_name('q')
search_input.send_keys(phrase + Keys.RETURN)
@then('results are shown for "{phrase}"')
def step_impl(context, phrase):
links_div = context.browser.find_element_b... | true |
5fdb8ea1f264121b6ead2e6f50ff8a2a6fe043be | Miloxing/DoubanTop250 | /spider.py | UTF-8 | 1,785 | 2.921875 | 3 | [] | no_license | import requests
from requests.exceptions import RequestException
from multiprocessing import Pool
import re
import json
def get_one_page(url):
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
try:
respon... | true |
fb1e02bd93a25da3fe88350acab9a558512ce9a1 | niangu/Python_machine_learning | /机器人1.py | UTF-8 | 6,765 | 2.734375 | 3 | [] | no_license | import itchat
itchat.login()
# 这里需要你人工手机扫码登录
itchat.send('Hello, 文件助手', toUserName='filehelper')
import itchat
@itchat.msg_register(itchat.content.TEXT)
def text_replay(msg):
return msg.text # 人家说啥你回复啥。。。
itchat.auto_login()
itchat.run()
import itchat
import time
itchat.auto_login(hotReload=True)
SINCERE_WIS... | true |
f5580e5088a96add8a8985f0f6bdd5f07973fa07 | jiangsinan/mServices | /other/socket_server.py | UTF-8 | 388 | 2.71875 | 3 | [] | no_license | import socket
server = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server.bind(('127.0.0.1',8010))
server.listen()
print('服务端已启动...')
client,address = server.accept()
print('%s 已连接'%address[0])
client.send('您好,我是小爱同学'.encode('utf-8'))
msg = client.recv(4096)
print(address,'说',msg.decode())
... | true |
9678f4d42a913cc8aa60f46cd0d33776a5b861eb | UglyDogIsDog/VectorizeBlockchainNews | /scripts/delete.py | UTF-8 | 383 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import json
inp = open("data.json", "rb")
passages = json.load(inp)
l = []
for passage in passages:
p = {}
p['title'] = passage['title']
p['date'] = passage['date']
p['passage'] = passage['passage']
p['label'] = 0
l.append(p)
inp.close()
outp = open("test.json", 'w', encoding="utf-8")
outp.... | true |
dd9e96b94a0f3b104186721d490e00fb833f9e36 | ncarkaci/IDO-Bogaz-Hatti-iskele-Kurulum-Problemi | /src/runningTimeCompute.py | UTF-8 | 1,320 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
#-*-coding:utf-8-*--
import random
from bruteForceSolution import *
from greedySolution import *
from dynamicProgrammingSolution import *
from divideAndConqureSolution import *
from branchAndBound import *
limit = 100
size = 10
distances = random.sample(range(1, 50000), 40)
... | true |
a4b4c9a4cde268a5c43698e1419147ea7455f80e | jorgemauricio/becarios | /ejercicios/08_examen.py | UTF-8 | 549 | 3.515625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
#######################################
# Author: Jorge Mauricio
# Email: jorge.ernesto.mauricio@gmail.com
# Date: 2018-02-01
# Version: 1.0
# No. Examen 8
# Valor: 10 puntos
#######################################
De una serie de datos del 0 al 100, realizar
las sigu... | true |
c49083b486e72052e8be093fdae38302609af0e3 | LucasDonato333/CursoEmVideo | /Python/Aulas/Aula017.py | UTF-8 | 1,660 | 4.1875 | 4 | [] | no_license | #Exemplo Lanche
'''
lanche = ['hamburguer','suco','pizza','pudim']
print(lanche)
lanche[3]='picolé'#realiza a troca de elementos
print(lanche)
lanche.append('Coockie')#adiciona um elemento
print(lanche)
lanche.insert(0,'cachorro quente')#adciona um elemento antes de hamburguer
print(lanche)
#eliminando iten... | true |
bf804f1a1d6e0be537a3521ddafe7acbc6d0ce1b | alimov9abbos/pythonprojects | /dish_picker.py | UTF-8 | 1,876 | 3.453125 | 3 | [
"CC0-1.0"
] | permissive | #OWNER: Abboskhon Alimov
#Project Start Date: 12/29/19
#last edit made 12/29/19
from datetime import date
import calendar
import random
#Hi, this is a program I wrote to choose a random dish from a dinner menu to prepare
#,as my we (my family and I) had problems coming up with a meal to prepare for everyone... | true |
24588d52dd30b5f9ea94013bd4f320af5b16ec96 | gmraju/ML-optimization-implementations | /kfolds_cvalidation.py | UTF-8 | 2,840 | 3.0625 | 3 | [] | no_license | import numpy as np
import math
import random
import matplotlib.pyplot as plt
#load data from the file
def load_data():
data = np.array(np.genfromtxt('galileo_ramp_data.csv', delimiter=','))
return data
#Splitting input data into input and corrsponding output
def get_input_output(data):
x = np.res... | true |
370876be97f9046eb8b6665321d6bf91f12e7139 | npr96/Python | /mini_text_adventure.py | UTF-8 | 237 | 3.1875 | 3 | [] | no_license | def hello():
print('howdy')
return
def shadow():
power_switch = 1
while power_switch == 1:
player_input = input()
if player_input == 'hello':
hello()
else:
pass
shadow()
| true |
f98827c6a4b9044c18368a5def2ade4c982e0896 | duane1983/asl_fixedwing | /models/skywalker/mass_properties/mass_properties.py | UTF-8 | 9,884 | 2.8125 | 3 | [
"MIT"
] | permissive | import numpy as np
import csv
from os.path import dirname, abspath, join
from matplotlib import pyplot as plt
from scipy.fftpack import fft, fftfreq
from scipy.interpolate import interp1d
import pdb
PATH = dirname(abspath(__file__))
G = 9.80665
M_CRADLE = 1.042 # kg, mass of cradle
M_ASSEMBLY = 3.512 # kg, mass of cra... | true |
cfe11dd09208263d08e0171386dd2781ce804891 | YashenNaidu/Shutdown-PC | /chess.py | UTF-8 | 690 | 3.03125 | 3 | [
"MIT"
] | permissive | # Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LogNorm
dx, dy = 0.015, 0.05
x = np.arange(-4.0, 4.0, dx)
y = np.arange(-4.0, 4.0, dy)
X, Y = np.meshgrid(x, y)
extent = np.min(x), np.max(x), np.min(y), np.max(y)
Z1 = np.add.outer(range(8), range... | true |
4f5055aae408a5a0c51fe27b8fa2f66de76260fc | emelynsoria/more_python | /activities/json_yaml_convert.py | UTF-8 | 956 | 3.296875 | 3 | [] | no_license | """
API/JSON/YAML Time!
Given API.py , convert the data into a JSON format, and then convert and write it into a .yaml file (in YAML format of course)
Dependencies:
json
requests
ruamel.yaml OR pypi yaml
"""
import json
import requests
from ruamel.yaml import YAML
import pickle
# or use yaml
... | true |
22d7c0f476325fadb239d5720355dea85e50876d | st110723/deepGrasping | /deepGrasping/src/customLossfunction.py | UTF-8 | 5,713 | 2.59375 | 3 | [] | no_license | import torch
import numpy as np
from torch import nn
from shapely.geometry import Polygon
class IOU(nn.Module):
def __init__(self, weight=None, size_average=True, flag="training"):
super(IOU, self).__init__()
def forward(self, inputs_, targets, flag):
if flag == "training":
in... | true |
63957e4ca37f0df0bec9825269fb1c04ba3dd172 | stay5sec/bibi_code | /Python入门/1.2 判断if.py | UTF-8 | 1,315 | 3.921875 | 4 | [] | no_license | # coding:utf-8
# author:stay5sec
# # 原始输出
# for i in range(1, 11):
# print(i)
# exit()
# # 判断输出
# for i in range(1, 11):
# if i > 5:
# print(i)
# exit()
# # 多判断案例
# chengji = {"jack": 45, "tony": 80, "5sec": 60}
#
# for name, score in chengji.items():
# if score > 60:
# print("{}的成绩:优秀".f... | true |
52392a6af0eb1ad2e32f6113611dd4343cf4fb47 | krunal7558/week3 | /intf_graph_snmpv3.py | UTF-8 | 3,635 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive |
'''
Problem statement :
Using SNMPv3 create two SVG image files.
The first image file should graph the input and output octets on interface FA4 on pynet-rtr1 every five minutes for an hour.
Use the pygal library to create the SVG graph file.
Note, you should be doing a subtraction here (i.e. the input/output octe... | true |
26d31bcf97687ca5a4a487e6076bbd2bed1486e2 | LfqGithub/LfqGithub.github.io | /docs/python/oldButImportant/note/key_para.py | UTF-8 | 196 | 2.8125 | 3 | [] | no_license | def person(name,age,**kw):
print('name:',name,'age:',age,'other:',kw)
person('Michael',30)
person('Bob',25,city='Beijing')
extra={'city':'Beijing','job':'Engineer'}
person('Jack',24,**extra)
| true |
5857f2fabaa8a6f923db3fbb47bc2a70b617e2ec | zumbipy/PythonExercicios | /ExerciciosFuncoes/ExerciciosFuncoes-05.py | UTF-8 | 1,589 | 3.671875 | 4 | [] | no_license | # Telegram: @ZumbiPy __ _ ___
# /_ / __ ____ _ / / (_) _ \__ __
# / /_/ // / ' \/ _ \/ / ___/ // /
# /___/\_,_/_/_/_/_.__/_/_/ \_, /
# E-mail: zumbipy@gmail.com /___//dev - 26/02/2018
"""
05 - Faça um programa que converta da notação de 24 horas para a notação de 12 horas.
Por exemplo, o programa deve con... | true |
98d63bc81c5828f4cd2720278d4f739469c5b5ab | KonH/GParser | /Code/PageParser.py | UTF-8 | 1,447 | 2.921875 | 3 | [
"MIT"
] | permissive | from Database import DB
from Logger import Log
from Parser import Parser
from Common import Common
class PageParser:
def __init__(self, _db):
self.db = _db
def get_pages(self):
return self.db.get_pages()
def process_all(self):
pages = self.get_pages()
Log.log("Process " ... | true |
4f38d60eaeb73bdee9611d4451cfacf0d1dcf2ce | 23edson/seguranca | /BruteForce/main.py | UTF-8 | 860 | 2.765625 | 3 | [] | no_license | #Criptografia clássica : Caesar, vigenere, transposição, substituição.
#Edson Lemes da Silva
#Disciplina de Segurança
#Testes para as cifras
from os import listdir
from breaker import *
outputs = listdir('test/output/')
#print(cipher['c'
dic = open('dic.txt','rb').read()
dic = dic.split()
for out in outputs:
tr... | true |
7aac88d0356aaa0ce44bee50286e7f9199a1b6e6 | lysol/saulscript | /saulscript/lexer/lexer.py | UTF-8 | 8,366 | 3 | 3 | [
"MIT"
] | permissive | import logging
import string
import tokens
from .. import exceptions
class Lexer(object):
def __init__(self, src):
self.src = src
self.char_pos = 0
self.current_token = None
self.tokens = []
self.in_escape = False
self.in_line_comment = False
self.in_block_... | true |
18d5e208995a994efdf89c8e3c9cef13aa6698fa | ManInAGarden/Python3D | /test_vectors2.py | UTF-8 | 1,856 | 3.078125 | 3 | [] | no_license | from TestBase import *
import unittest
import python3d as pd
import math
class Vectors2Test(TestBase):
def test_vectoraddition(self):
v1 = pd.Vector2.Zero()
v2 = pd.Vector2.newFromList([1.0, 2.0])
v3 = v2 + v1
self.assertEqual(v2, v3)
v4 = v2 + v2
self.assertEqual(pd... | true |
834399029675a243c3d5a176e7bf2f84cc79f1c7 | omarsagoo/tweet_gen_app | /static/code/sentence_reverse.py | UTF-8 | 1,254 | 3.984375 | 4 | [] | no_license | import random
import sys
# Create reverse() func to reverse a list.
# ' '.join the list to return it back to a sentence. and have functionality to turn a string into a list
#
def reverse(params):
#
# Check a list to see if it has more than one item,
# If not turn the string word into a list and pass the ar... | true |
6d07f3e18784a554bf66711448e1e7b5d761b2f1 | the-xkcd-community/the-red-spider-project | /src/Geico.py | UTF-8 | 2,157 | 3.390625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #! /usr/bin/env python2
# Copyright 2013 Bryton Moeller
# Licensed under the Red Spider Project License.
# See the License.txt that shipped with your copy of this software for details.
# club cost estimates by: http://sports.whatitcosts.com/golf-clubs-pg3.htm
golfbag = {"Putter":[0.1,175],"5iron":[0.15,100],"7iron":[... | true |
309f2a0560d95a5eb0423c84ec9b2f62dd7d60f6 | moliendocode/Space-Invaders | /Space_Invader.py | UTF-8 | 4,273 | 3.25 | 3 | [] | no_license | import random
import math
import pygame
from pygame import mixer
pygame.init()
# Creacion de la ventana
screen = pygame.display.set_mode((800,600))
# fondo
background = pygame.image.load('2362730.png')
mixer.music.load('fondo.wav')
mixer.music.play(-1)
# Titulo y icono
pygame.display.set_caption("Space Invaders")
... | true |
464a39a8ca69e7bcb9b2c29d4dd99f6fccfaa936 | ashwin-ganesh23/curriculum_dev | /peerbuds/py_for_professionals/day1/indexing.py | UTF-8 | 660 | 4.84375 | 5 | [] | no_license | """
Fundamentals of Python
Topics include:
-Variables and Data Types
-Control Flow
-Data Structures
Part 5 : Indexing and Slicing Sequences
"""
# Now that we understand the BASICS of control flow and data structures,
# let's take a look at accessing values in sequences
# the first value always starts at index... | true |
1d0ac4f0b69d4ed4df4741d8cf5934893bf70d15 | get-thepacket/privacy-analyzer | /analyser/PrivacyAnalyser/lib/textprocessors.py | UTF-8 | 2,091 | 3.34375 | 3 | [] | no_license | # Set up our initial text cleaning function
from nltk.corpus import stopwords
from nltk.stem.snowball import *
import re
import string
def text_process_policy(doc):
"""
stems the string and remove unneccesary elements
like stop words
"""
sn = SnowballStemmer(language='english')
s = re.sub(r'\<... | true |
925346446971f8cdab19e77959e68e1f90e9d3cb | atiffany/pushBot | /pushBot.py | UTF-8 | 2,969 | 3.171875 | 3 | [] | no_license | from slackclient import SlackClient
import time
class slackCommunication(object):
def __init__(self):
self.slack_client = SlackClient("xoxb-513177741924-513252573923-nHARsKDPzRK0O4MfRapVKS3O")
self.appName = "pushbot"
def slackConnect(self):
return self.slack_client.rtm_connect()
... | true |
2a51c2e8e9b93debb1baf813e1f18aff64804dc0 | kevinzg/twitter-scraper | /test.py | UTF-8 | 1,288 | 3.15625 | 3 | [
"MIT"
] | permissive | import unittest
from twitter_scraper import get_tweets
class TestFamilyUnderscore(unittest.TestCase):
def test_father(self):
user = '_'
tweets = list(get_tweets(user=user, pages=1))
self.assertTrue(tweets[0]['text'].__contains__('Want to feel old?'))
def test_mother(self):
u... | true |
f8fa82cfc7d929cef4df51402e938d744a3ca7fe | ichi-pg/deep-learning | /python/src/zero/softmax.py | UTF-8 | 720 | 3.296875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pylab as plt
def softmax(a):
exp_a = np.exp(a)
return exp_a / np.sum(exp_a)
a = np.array([0.3, 2.9, 4.0])
print(softmax(a))
a = np.array([1010, 1000, 990])
print(softmax(a))
#実際には値がでかいとエラーとなる
#したがって計算結果が変わらない特質から最大の要素で分子分母全体をマイナスする
def softmax(a):
exp_a = np.exp(a - ... | true |
231106e05f32b0e01958b19a2b0f2a8ffa99fb5f | pksebben/paws | /python/pyg/web/views/fundraiser.py | UTF-8 | 3,761 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import datetime
import flask
from wtforms import Form, StringField, TextAreaField
from wtforms.fields.html5 import DateField, IntegerField
from wtforms.validators import InputRequired, Length, ValidationError, DataRequired
from pyg.web import db, models
# TODO(ian) : axe the fundraiser section? Is that going to be ... | true |
fa41c488e599dec2aa599581c20392bb8a241954 | thariqfahry/year-in-industry | /pex-formatter/pexformatter.py | UTF-8 | 16,221 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 30 09:57:06 2021
@author: tfahry
PEX formatter
Call the formatpex() function to format a PEX file.
Requires Python 3.8.8 or later.
Last built on Python 3.8.8.
Python versions above 3.9 will not work on Windows 7.
"""
import pandas as pd
from datetime i... | true |
c0fb1cc1a27c8342d9677eabd93e3fa759ff0f00 | Mong-Gu/PS | /programmers/행렬의곱셈.py | UTF-8 | 774 | 3.34375 | 3 | [] | no_license | import numpy as np
def solution(arr1, arr2):
a = np.array(arr1)
b = np.array(arr2)
return np.dot(a, b).tolist()
# 다른 사람 코드
'''
def productMatrix(A, B):
return [[sum(a*b for a, b in zip(A_row,B_col)) for B_col in zip(*B)] for A_row in A]
이거 보고 공부하기. 내가 원래 시도하려던 거랑 똑같은 원린데 난 구현하지 못했어.
하지만 속도는 numpy 이용... | true |
30c79145892f0b5420375672ffe56d01caeef546 | MilenaValarezo28/Actividad-Autonoma-POO-Milena-V | /Tarea#1 Ejercicios POO Milena Valarezo.py | UTF-8 | 10,779 | 3.75 | 4 | [] | no_license | class Ejercicios_Deber:
def __init__(self):
pass
#1) Diseñamos un pseudocódigo para encontrar la superficie de un círculo para un radio cualquiera.
def CalcularRadio(self):
Re = float(input("ingrese el radio del circulo: "))
pi = 3.1416
s = pi*Re**2
prin... | true |
9fbb87224398515623666a7ab0da98159958e67d | horizonsz/Exercises-Python | /second_module.py | UTF-8 | 469 | 3.671875 | 4 | [] | no_license | import first_operation
num1 = 12
num2 = 4
added_nums = first_operation.add(num1, num2)
subtracted_nums = first_operation.subtract(num1, num2)
multiplied_nums = first_operation.multiply(num1, num2)
divided_nums = first_operation.divide(num1, num2)
print "{} + {} = {}".format(num1, num2, added_nums)
print "{} - {} = {... | true |
125b8889382fcc7378960706767d9152eaa89921 | CALlanoR/virtshell_server | /virtshell_server/security/groups.py | UTF-8 | 672 | 2.625 | 3 | [
"MIT"
] | permissive | from security.groups_repository import GroupsRepository
import uuid
class Groups(object):
def __init__(self):
self.groups_repository = GroupsRepository()
def get_all_groups(self):
return self.groups_repository.get_all_groups()
def get_group(self, name):
return self.groups_reposito... | true |
02bd4d8c5b7f5ee571bf79d27ec708e3779ed9cd | plt3/basic_selenium_projects | /sendemail.py | UTF-8 | 1,579 | 2.609375 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
from secrets import *
def findbyclass(name, driver, keys='click'):
elem = driver.find_element_by_class_na... | true |
daceb5cb04a4ea0a12d5796d52c6d6e5694bd8f4 | Tosavilovi/PythonBegin | /WeatherBot.py | UTF-8 | 3,208 | 2.9375 | 3 | [] | no_license |
import requests
offset = 1 # параметр необходим для подтверждения обновления
URL = 'https://api.telegram.org/bot' # URL на который отправляется запрос
#TOKEN = '463970218:AAHWaKUtekg6sBhJKYO77_FkM8que2RV6zY' # PSnews токен вашего бота, полученный от @BotFather
TOKEN = '289062799:AAHmdbKRxqIdhnHqao6t2LjdON4jfaOiYgY' #... | true |
c425792274796823ac58850deb2b8265249c05a3 | h2oai/h2o-3 | /h2o-py/h2o/model/models/word_embedding.py | UTF-8 | 4,382 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | # -*- encoding: utf-8 -*-
# noinspection PyUnresolvedReferences
from h2o.utils.compatibility import * # NOQA
from collections import OrderedDict
import h2o
from h2o.expr import ExprNode
from h2o.model import ModelBase
class H2OWordEmbeddingModel(ModelBase):
"""
Word embedding model.
"""
def find_s... | true |
1158511635e99e15b8f3697ec89a308350d58297 | pyre/pyre | /packages/pyre/schemata/Mapping.py | UTF-8 | 2,202 | 3.09375 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
#
# michael a.g. aïvázis <michael.aivazis@para-sim.com>
# (c) 1998-2023 all rights reserved
# externals
import collections.abc # for container identification
# superclass
from .Container import Container
# declaration
class Mapping(Container):
"""
The base class for type declarator... | true |
ce3e0f6a9ea076000c90a18a57cd413dccc48317 | pengfei123xiao/python_adv_path | /step2/spam1.py | UTF-8 | 284 | 2.859375 | 3 | [] | no_license | # spam模块,与Python文件在同路径下
__all__ = ['money', 'f1']
print('from the spam.py')
money = 0
def f1():
print('spam1模块.f1:', money)
def read2():
print('spam模块.read2')
read1()
def change():
global money
money = 1 # 在模块中修改
| true |
c38aab4eff7f227b6281a0616c899a9177d1e44c | Dracks/django-monit-collector | /monit_collector/monitcollector/templatetags/monitcollector_tags.py | UTF-8 | 2,311 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | import time
from django import template
from django.conf import settings
from django.utils import timezone
register = template.Library()
try:
monit_update_period = settings.MONIT_UPDATE_PERIOD
except:
monit_update_period = 60
@register.filter
def timestamp_to_date(timestamp):
if not isinstance(timestam... | true |
91cbbaa13b2bb6b1fdab03e43e9803c38079d276 | akansh12/Learning_Machine_Learning | /Gender classifier.py | UTF-8 | 392 | 2.90625 | 3 | [] | no_license | from sklearn import tree
#[hieght, weight, shoe size]
X= [[181,80,44],[177,70,43],[160,60,38],[154,54,37],[166,65,40],[190,90,47],[175,64,39],[177,70,40],[159,64,42],[171,75,42],[181,85,43]]
Y=['male','female','female','female','male','male','male','female','male','female','male']
clf=tree.DecisionTreeClassifier()
clf=... | true |
ecd632c439112e61a09784018d34a51264476f91 | AdrianoBotti/autoencoder_distributed_training | /autoencoder.py | UTF-8 | 7,407 | 2.796875 | 3 | [] | no_license | import os
import json
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
import datetime
import datasetpreprocessing as dpp
import pandas as pd
import math
# Set TF_CONFIG
os.environ['TF_CONFIG'] = json.dumps({
'cluster': {
'worker': ["10.0.2.4:1717", "10.0.2.5:1818"]
},
... | true |
0058ff8b758557348198b1b7c1240ddb8250da54 | KNOT-FIT-BUT/CPKclassifier | /CPKclassifierPack/testing/SplitTestSet.py | UTF-8 | 4,199 | 3.34375 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
"""
Obsahuje nástroje pro testování klasifikátoru.
:author: Martin Dočekal
:contact: xdocek09@stud.fit.vubtr.cz
"""
from sklearn.model_selection import StratifiedShuffleSplit, StratifiedKFold, LeaveOneOut, KFold
class SplitTestSet(object):
"""
Třída pro rozdělení všech dat na ... | true |
67dda8b716757b1b750bc07ee9dd7b6d7c75fa22 | shezz77/hackerrank-python | /learning/itertools/products.py | UTF-8 | 86 | 3 | 3 | [] | no_license | from itertools import product
A = [1, 2]
B = [3, 4]
ans = product(A, B)
print(*ans) | true |
b05547175f8d437108401db3832eaf1498b989a9 | biberger/Cestimii | /cestimii/occupancygrids.py | UTF-8 | 40,192 | 3.046875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 26 18:07:47 2021
@author: Simon Biberger
Cestimii.
Compute curvature estimations on point clouds using integral invariants.
This file contains all methods that have something to do with the
initialization, construction, splitting or merging of occupancy grids or
occupa... | true |
1ae6bd71f8deadc21398ed8a5af6bb80a8e66343 | quanganh991/KhaiPhaWeb | /googlenews_encoding/encoding_vector.py | UTF-8 | 5,274 | 2.71875 | 3 | [] | no_license | import re
import numpy as np
# lets import some stuff
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics import confusion_matrix, accuracy_score
from sklearn.model_selection import train_test_split
import gensim
from gensim.models import Word2Vec
fro... | true |
d0568cc7cdca1ac151fc5b772a5725f19936f168 | adamsmail54321/twelvedata-python | /src/twelvedata/client.py | UTF-8 | 3,503 | 2.578125 | 3 | [
"MIT"
] | permissive | from .context import Context
from .endpoints import (
StocksListEndpoint,
StockExchangesListEndpoint,
ForexPairsListEndpoint,
CryptocurrenciesListEndpoint,
CryptocurrencyExchangesListEndpoint,
TechnicalIndicatorsListEndpoint,
)
from .http_client import DefaultHttpClient
from .time_series import ... | true |
c07122d85f08b6e57ded94225184a432c3abbf10 | fredlllll/PyWavefront | /tests/utils.py | UTF-8 | 231 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | from pathlib import Path
FIXTURE_PATH = Path(__file__).parent.absolute() / 'fixtures'
def fixture(name: str):
"""
Construct an absolute path to the fixture directory
"""
return Path(FIXTURE_PATH, name)
| true |
6212e0d6ee6115f76cea267c1c70bf470de8214d | Acemyzoe/face-recognition | /catch_face_cv.py | UTF-8 | 1,170 | 2.578125 | 3 | [
"MIT"
] | permissive |
import os
import cv2
cascPath = "/home/ace/anaconda3/pkgs/libopencv-3.4.2-hb342d67_1/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml"
output_dir = './myface'
if not os.path.exists(output_dir):
os.makedirs(output_dir)
# classifiers
faceCascade = cv2.CascadeClassifier(cascPath)
#camera
camera = cv2.... | true |
205c4f5aee9b53a892ff2c3dfaf7beed1e5b1ec2 | harryhk/ProgrammingCompetition | /googleCodeJam/2014/round0/c1.py | UTF-8 | 3,358 | 2.890625 | 3 | [] | no_license | import sys
import numpy as np
def myprint(matrix, R, C):
# 0 mine
# 1 empty
for i in range( R ) :
for j in range( C):
if i==0 and j==0:
sys.stdout.write('c')
elif matrix[i,j] ==0 :
sys.stdout.write('*')
else:
sy... | true |
04555a9b0cb26c6aac34339a1d5fbabcce303b2f | siddhism/leetcode | /leetcode/1057.campus-bikes.py | UTF-8 | 2,869 | 3.171875 | 3 | [] | no_license | #
# @lc app=leetcode id=1057 lang=python
#
# [1057] Campus bikes
#
class Solution(object):
def assignBikes(self, workers, bikes):
"""
:type workers: List[List[int]]
:type bikes: List[List[int]]
:rtype: List[int]
"""
# worker sorted by x, y, index
# bikes sorte... | true |
d3640a3485fdd4f7a2449f6afafa6a5c248d5754 | jadenPete/AdventOfCode | /2019/day3-part2.py | UTF-8 | 516 | 3.3125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
with open("day3.txt", "r") as file:
def crawl_wire():
loc = [0, 0]
steps = 0
for move in file.readline().split(","):
delta = {"L": (0, -1), "R": (0, 1), "U": (1, 1), "D": (1, -1)}[move[0]]
for _ in range(int(move[1:])):
loc[delta[0]] += delta[1]
steps += 1
yield tupl... | true |
d35fe77c4b2a6386624e1967c24cb86d62e8dd55 | kellytranha/cs5001 | /lab03/guessing_game.py | UTF-8 | 2,604 | 4.09375 | 4 | [] | no_license | import random
MIN_DIGIT = 1
MAX_DIGIT = 50
FIRST_COUNT = 1
SCALDING_HOT = 1
EXTREMELY_WARM = 2
VERY_WARM = 3
WARM = 5
COLD = 8
VERY_COLD = 13
EXTREMELY_COLD = 20
LUCKY = 1
AMAZING_LOW = 2
AMAZING_HIGH = 4
OKAY_LOW = 5
OKAY_HIGH = 6
MEH = 7
NOT_GAME_LOW = 8
NOT_GAME_HIGH = 9
def main():
print("Welcome to the G... | true |
e5e59a2fdac7610e2e95e0226762b4254f9625a9 | Strongeric89/Python | /week3/CreatingFile.py | UTF-8 | 286 | 3.6875 | 4 | [] | no_license | #the following program creates a file in python
fileName = "batman.txt"
file = open(fileName,"a")
print("Writing to file " + fileName)
file.write("Story bud This is a program that writes new stuff\n\nhell year!")
file.close()
#now open the file
file = open(fileName)
print(file.read()) | true |
49f5226ead7fc3d156c7b6fc306a29aa67137904 | yakshitgupta310/Data-Structures-and-Algorithm | /Array/FindWordsThatCanBeFormedbyCharacters.py | UTF-8 | 575 | 3.421875 | 3 | [] | no_license | words = ["hello", "world", "leetcode"]
chars = "welldonehoneyr"
def Find(words, chars):
char = {}
for i in chars:
if i in char:
char[i] += 1
else:
char[i] = 1
for word in words:
x = char.copy()
y = 0
for j in word:
... | true |
109ed3cf83e6457cc1679f61022f6f971552c9c5 | r14sandeep/Test | /python/for_list_tup.py | UTF-8 | 228 | 3.375 | 3 | [] | no_license | #!/usr/bin/python
list1=[1,2,3,44,5,55,"abc"]
print "list:",
for cnt in list1:
print cnt,
print
print "tup:",
tup=(22,33,44,"xyz",11.234)
for cnt in tup:
print cnt,
low=2;high=10
print
for val in range(low,high):
print val,
| true |
6030314b88bdc39bdd43d996d7ee6c9458f0a2fa | dishant888/voice-notes | /website/website/views.py | UTF-8 | 977 | 2.53125 | 3 | [] | no_license | from django.shortcuts import render, redirect
notesList = [
{'id':1,'Title':'Title 1','Description':'description 1'},
{'id':2,'Title': 'Title 2', 'Description': 'description 2'},
{'id':3,'Title': 'Title 3', 'Description': 'description 3'},
{'id':4,'Title': 'Title 4', 'Description': 'description 4'},
]
... | true |
51ce01f477df0a9e527f70784c7d5439567fb5d9 | thomas-li-sjtu/IDS-WSN | /ContrastModel/IF.py | UTF-8 | 2,492 | 2.703125 | 3 | [] | no_license | from sklearn.ensemble import IsolationForest
import pandas as pd
import numpy as np
def Normalization(data):
for i in range(len(data[0])):
# 查找最大值
max_num = np.amax(data[:, i])
min_num = np.amin(data[:, i])
# 使用 min-max normalization 标准化
for j in range(len(data)):
... | true |
088692141795d734cd601c760aa56233fb4e043f | gsirow/cashflow | /main/models.py | UTF-8 | 4,065 | 3.0625 | 3 | [
"MIT"
] | permissive | from django.db import models
import pandas as pd
FREQ_INTERVAL_CHOICES = [('M', 'Month(s)'), ('W', 'Week(s)'),
('D', 'Day(s)')]
WEEKDAYS = {0: 'MON', 1: 'TUE', 2: 'WED', 3: 'THU', 4: 'FRI',
5: 'SAT', 6: 'SUN'}
def _date_range(begin_date, end_date, freq_num, freq_interval):
""... | true |
599fada7a9b5fa0ebddd8e371794fd4d24bc8a8e | yogeshbalaji/InvGAN | /cleverhans/model.py | UTF-8 | 11,073 | 2.84375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | """
The Model class and related functionality.
"""
from abc import ABCMeta
import warnings
import tensorflow as tf
from cleverhans import utils_tf
class Model(object):
"""
An abstract interface for model wrappers that exposes model symbols
needed for making an attack. This abstraction removes the dependency o... | true |
42e2fc36677ae407965d03a7e47431452b5572b8 | lawrencedovin/100-days-of-python | /day-3/bmi-2.py | UTF-8 | 574 | 3.640625 | 4 | [] | no_license | height = float(input("enter your height in m: "))
weight = float(input("enter your weight in kg: "))
bmi = round(weight / height ** 2)
msg = f"Your BMI is: {bmi}"
def bmi_2(bmi):
if bmi < 18.5:
return msg + " you are underweight"
elif bmi < 25:
return msg + " you are normal weight"
elif ... | true |