blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
51cc72a9586eb090d9def75dbeb4258b5f8dae7b | Python | Termoplane/Python__Course | /lambda_mod_checker.py | UTF-8 | 119 | 3.359375 | 3 | [] | no_license | def mod_checker(x, mod = 0):
return lambda y : y % x == mod
mod_3 = mod_checker(3)
print(mod_3(5))
print(mod_3(3)) | true |
a4a2e82282922f93c0ba02e4d2d482b239ed3c1b | Python | sjraaijmakers/otolith | /prepare/prepare_stacks.py | UTF-8 | 658 | 2.6875 | 3 | [] | no_license | # Bulk prepare stacks
import os
import sys
import prepare_stack
def has_subdirectories(dir):
for f in os.scandir(s):
if f.is_dir():
return True
return False
if __name__ == "__main__":
args = sys.argv[1:]
input_folder = args[0]
output_folder = args[1]
subs = [x[0] for ... | true |
ff59d2469cf2bd83adf5b15de94cfbbf46280c1f | Python | srishtishukla-20/function | /Q4(Prime).py | UTF-8 | 593 | 3.484375 | 3 | [] | no_license | def prime_num(n):
i=1
counter=0
while i<=n:
if n%i==0:
counter+=1
i+=1
if counter==2:
print("prime number")
else:
print("not prime number")
n=int(input("enter the num"))
prime_num(n)
#prime num
def prime(num):
i=2
x=0
while i>0:
j=1
... | true |
a2e48e281ace597f272d71506979008b27d20bdf | Python | chizhdiana/Repository | /my_test/test/Redis_bit.py | UTF-8 | 942 | 2.921875 | 3 | [] | no_license | import redis
import time
conn = redis.Redis()
now = time.time()
print(now)
# БИТЫ
days = ['2013-02-25', '2013-02-26', '2013-02-27'] # лист с датами
# ID пользователей
big_spender = 1089
tire_kicker = 4045
late_joiner = 550212
# установим бит на конкретную дату с одним посещением пользователя
print(conn.setbit(days[0]... | true |
2da9f60f21acff5c59ff46f62fe2746815b12e1c | Python | Cedric-Chan/Script_of_Data_Analysis | /数据分析与机器学习/数据分析实战/图&社交网络/识别欺诈的罪魁祸首.py | UTF-8 | 3,645 | 3 | 3 | [] | no_license | import networkx as nx
import numpy as np
import collections as c
graph_file = 'desktop/fraud.gz'
fraud = nx.read_graphml(graph_file)
print('\nType of the graph: ', type(fraud)) # 显示图的类型(有并行边的有向图)
# 节点和边
nodes = fraud.nodes() # 调出所有节点
nodes_population = [n for n in nodes if 'p_' in n] # 买家节点的前缀是p_
nodes_merchant... | true |
a8795e9ac091974e528cb30cff2e38826a8bdda1 | Python | ShreyasKadiri/Machine_Learning | /corelation.py | UTF-8 | 416 | 2.921875 | 3 | [] | no_license | import pandas as pd
from sklearn.datasets import fetch_california_housing
# fetch a regression dataset
data = fetch_california_housing()
X = data["data"]
col_names = data["feature_names"]
y = data["target"]
# convert to pandas dataframe
df = pd.DataFrame(X, columns=col_names)
# introduce a highly correlated column
df... | true |
6f5194d4b67492e6e95277d9fbff27c6b0acdf40 | Python | ankawm/NowyProjektSages | /type_str_lit_emo.py | UTF-8 | 899 | 3.859375 | 4 | [] | no_license | """
* Assignment: Str Literals Emoticon
* Required: yes
* Complexity: easy
* Lines of code: 2 lines
* Time: 3 min
English:
1. Define `name` with value `Mark Watney`
2. Print `Hello World EMOTICON`, where:
3. EMOTICON is Unicode Codepoint "\U0001F600"
4. Run doctests - all must succeed
Polish:
1. Z... | true |
75322357dfa7a345795471be1b152fe9f3ae5c80 | Python | niteesh2268/coding-prepation | /leetcode/Problems/138--Copy-List-with-Random-Pointer-Medium.py | UTF-8 | 1,157 | 3.453125 | 3 | [] | no_license | """
# Definition for a Node.
class Node:
def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None):
self.val = int(x)
self.next = next
self.random = random
"""
class Solution:
def copyRandomList(self, head: 'Node') -> 'Node':
if not head:
return ... | true |
e7fcdb4143d53ed5d274f8238a45df4346e91363 | Python | xfgao/VRKitchen | /Script/tool_pos.py | UTF-8 | 3,919 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | tool_pos = {}
tool_pos["2"] = {
"Orig": {"Actor":{"Loc":{"X":0.0,"Y":0.0,"Z":0.0},\
"Rot":{"Pitch":0.0,"Yaw":0.0,"Roll":0.0}}},\
"Grater": {"Actor":{"Loc":{"X":60.0,"Y":-24.0,"Z":0.0},\
"Rot":{"Pitch":0.0,"Yaw":0.0,"Roll":0.0}}},\
"SauceBottle": {"Actor":{"Loc":{"X":54.0,"Y":20.0,"Z":0.0},\
... | true |
756c30e1a019f04f9bddf6ec5d51e5a01c5ebf97 | Python | CamachoBry/abm-environment | /agents.py | UTF-8 | 3,591 | 3.328125 | 3 | [] | no_license | from mesa import Agent
from random_walk import RandomWalk
class GrassPatch(Agent):
'''
A patch of grass that grows at a fixed rate and is eaten by bunnies
'''
def __init__(self, unique_id, pos, model, fully_grown, countdown):
super().__init__(unique_id, model)
self.fully_grown = fully... | true |
eeda8ead315d8ee8c102481e963a0a99d600103d | Python | liliarose/ComputerScienceforInsight | /hw3/old_hw3pr2.py | UTF-8 | 10,885 | 3.5625 | 4 | [] | no_license | #
# hw3pr2.py
#
# Person or machine? The rps-string challenge...
#
# This file should include your code for
# + extract_features( rps ), returning a dictionary of features from an input rps string
# + score_features( dict_of_features ), returning a score (or scores) based on that dictionary
# ... | true |
9a7fb4309d1d4ef517ff09d58faae7666ab11f5e | Python | Solanar/CMPUT313_Asn1 | /ESIM/main.py | UTF-8 | 7,145 | 2.703125 | 3 | [] | no_license | import sys
from transmitter import Transmitter
from simulate_transmission import Simulator
from receiver import Receiver, OneBitError, MultipleBitErrors
from statistics import Statistics
A = 'A' # Response overhead bit time units
K = 'K' # Number of blocks frame is broken into num b... | true |
8332ef089fea92ba25e044eba58d13c4b5d3521c | Python | ChristopherStavros/Python_Study | /Projects/OOP_and_Postgres/movie-system/app.py | UTF-8 | 2,341 | 3.78125 | 4 | [] | no_license | from user import User
import json, os
def menu():
# Ask for the user's name
name = input("Enter your name: ")
# Check if a file exists for that user
# If it already exists, welcome then and load their data.
# If not, create a User object
filename = "{}.json".format(name)
if file_exists(fi... | true |
4a2c1f16e25b32e4cf32315a356423d762e5385d | Python | atg-abhijay/LeetCode_problems | /binary_gap_868.py | UTF-8 | 739 | 3.625 | 4 | [] | no_license | """
URL of problem:
https://leetcode.com/problems/binary-gap/description/
"""
def main(num):
bin_num = bin(num)[2:]
max_dist = 0
dist_counter = -1
encounter_start_one = False
for digit in bin_num:
digit = int(digit)
if encounter_start_one:
if digit == 1:
... | true |
8b5b8edcaa925fa786c09159b76aee8511c8a12e | Python | gonrodri18/Python | /Listas y tuplas/Ejercicio13.py | UTF-8 | 542 | 4.34375 | 4 | [] | no_license | #Escribir un programa que pregunte por una muestra de números, separados por comas, los guarde en una tupla y muestre por pantalla su media y desviación típica.
numeros = input ('introduce un muestra de númros separada por comas:')
numeros = numeros.split(',')
n = len(numeros)
for i in range(n):
numeros[i] = int(n... | true |
6a3f9f968da8db0c591cc87e12dd773a525b8796 | Python | shocker8786/scripts | /python_scripts/fastq.py | UTF-8 | 182 | 2.5625 | 3 | [] | no_license | import sys
for line in sys.stdin:
line = line.strip()
if line[0:3] == 'HWI':
line = '@' + line
print line
elif not line.strip():
line = '+'
print line
else:
print line
| true |
8c03ce71210d1ea732a61402ac527d807ce72e8f | Python | standbyme227/project_with_jtlim | /first.py | UTF-8 | 2,247 | 3.640625 | 4 | [] | no_license | class Human:
# success = 0
# failure = 0
def __init__(self, id, height, weight, fatigue):
self.id = id
self.height = height
self.weight = weight
self.fatigue = fatigue
self.bmi = None
def set_bmi(self):
self.bmi = round(self.weight / ((self.height / 100)... | true |
e26f4b4cdb025fbcec07385104516470bc4457bc | Python | lordjuacs/ICC-Trabajos | /Ciclo 1/Lab ICC/PC/mayor_menor.py | UTF-8 | 382 | 4.1875 | 4 | [] | no_license | n = int(input("Ingrese N: "))
max = 29
min = 66
imprime = False
for i in range(1,n+1):
edad = int(input("Ingrese edad " + str(i) + ": "))
if edad >= 30 and edad <=65:
imprime = True
if edad > max:
max = edad
if edad < min:
min = edad
print(imprime * ("El mayor es:... | true |
35d0dac1eb6679195d4dd24ce2aff5285987b555 | Python | psm651/python-algorithm | /baekjoon10996.py | UTF-8 | 380 | 3.5 | 4 | [] | no_license | val = int(input())
for i in range(0,val):
stra=''
strb=''
for j in range(1,val+1):
if j % 2 != 0:
stra +='*'
if j % 2 == 0:
stra +=' '
print(stra)
if val > 1:
for k in range(1,val+1):
if k % 2 != 0:
strb +=' '
if... | true |
8f8a77cba95ad57fc05346f59f41e42febe41230 | Python | pdaian/mev | /parse_output.py | UTF-8 | 415 | 2.921875 | 3 | [] | no_license | import os
out = open('out2').read()
states = out.count("#Or")
print("Found %d states." % (states))
max_amt = -1
for line in out.splitlines():
if "0 in 0 |-" in line and line.index("0 in 0 |-") == 8:
amt = int(line.split()[-1])
max_amt = amt if amt > max_amt else max_amt
print(amt)
print... | true |
2fb3894a3eb5aa81782e31b46e0fc5d32e451ba0 | Python | matiasandina/useful_functions | /listdir_fullpath.py | UTF-8 | 871 | 2.90625 | 3 | [] | no_license | # This function returns the full path
# It tries to be an analogous of list.files in R...still work to do
import os
import numpy as np
def listdir_fullpath(root_dir, file_pattern=None, file_extension=None, exclude_dir = True):
# Get everything
if file_extension is None:
file_list = [os.path.join(roo... | true |
717d938ab7985e2f0adfa81c37e883bcc6f3f206 | Python | akshat12000/Python-Run-And-Learn-Series | /Codes/80) Functions_returning_two_values.py | UTF-8 | 300 | 3.96875 | 4 | [] | no_license | # Functions returning two values
def operations(a,b):
add=a+b
multiply=a*b
return add,multiply
a,b=input("Enter two numbers ").split()
res=operations(int(a),int(b)) # res will be a tuple type!!
add,mul=operations(int(a),int(b))
print(type(res))
print(res)
print(add)
print(mul) | true |
9dbfba671391c99d1dc714c5fe0a1241a79a02ae | Python | Bumskee/-Part-2-Week-2-assignment-21-09-2020 | /Problem 1.py | UTF-8 | 569 | 4.6875 | 5 | [] | no_license | """Problem 1 Assigning angle's value to the valuable degrees then converting that value to radian and then assigning the value to the variable radian"""
#A function that assigns an angle as a value for degrees then converting it to a radian value then printing the values of degrees and radians
def degToRad(angle, pi =... | true |
bdc73dd17ae16343913f58888bb2f67a3ce001b3 | Python | wtsai92/mycode | /python/python_buitin_module/use_collections.py | UTF-8 | 1,763 | 4.34375 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import namedtuple, deque, defaultdict, OrderedDict, Counter
"""
namedtuple
namedtuple是一个函数,它用来创建一个自定义的tuple对象,并且规定了tuple元素的个数,
并可以用属性而不是索引来引用tuple的某个元素。
这样一来,我们用namedtuple可以很方便地定义一种数据类型,它具备tuple的不变性,又可以根据属性来引用,使用十分方便。
"""
Point = namedtuple('Point', ['x'... | true |
0c7217f3dd8d360b50173f6bde54532489e95103 | Python | amadeusantos/Mundo_1 | /desafio09025.py | UTF-8 | 240 | 3.78125 | 4 | [] | no_license | nome = str(input('Qual seu nome completo: ')).strip().lower()
print(f'Você possui Silva no nome: '
f'{nome.count("silva") > 0}.'.replace('True', 'Sim').replace('False', 'Não')) # {nome.find("silva") != -1}
# 3 {"silva" in nome}
| true |
dac3bfeb697e0417983a7308e34525918e22921b | Python | sayed6201/sayeds_django_library | /2.views/view_html_return.py | UTF-8 | 846 | 3.203125 | 3 | [] | no_license | ========================================================================
returning HTML from view
========================================================================
monthly_challenges_dictioinary = {
"jan": "Eat no meat for entire month",
"feb": "Walk 20 min",
"mar": "Learn django"
}
def index(reques... | true |
ed95c5e96c791267ff6a41f713eefc9e6b57a8db | Python | agupta13/sdx | /player/player_interface.py | UTF-8 | 696 | 2.734375 | 3 | [] | no_license | __author__ = 'arpit'
import sys, socket
exchangeIp = "127.0.0.1"
exchangePort = 9006
def main():
print "Started the player interface"
HOST, PORT = exchangeIp, exchangePort
data = "sdx_offload:asB,{asA:asC}"
# Create a socket (SOCK_STREAM means a TCP socket)
sock = socket.socket(socket.AF_INET, ... | true |
dd112ea1f8a8886466e23f2d7653e61b7958ca0a | Python | LyaxKing/My_Printor | /2.0/Main.py | UTF-8 | 1,488 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 16:24:35 2019
@author: HP
"""
import Printor_control
import socketio
import serial
portname = "COM6"
baudrate = 115200
printid = '1'
tem_position = [0, 2]
sio = socketio.Client()
ps = Printor_control.print_state(printid, portname, baudrate, sio, tem_position)
sio.con... | true |
a4212f7d32783bf9b79fd905f34f7a45331d3148 | Python | ribeiro3115/Movie-Trailer-Website | /services.py | UTF-8 | 1,151 | 3.171875 | 3 | [
"MIT"
] | permissive | import urllib2
import xml.etree.ElementTree as ET
import media
# This file has a function with a responsability to connect a API that i found in the internet that return a webservice in XML with information about Movies.
def downloadMovies(id_page):
# Pass the id of page of movies to API.
file = urllib2.urlopen('h... | true |
9dac8023b03c2f66f8f573ce2d2f9f2859c5d4e2 | Python | wufenglun/TravelPlanner | /anytime_algo.py | UTF-8 | 1,233 | 2.59375 | 3 | [] | no_license | from DirectedGraph import *
from search import * #for search engines
from hotelAndScenery import *
def heur_zero(state):
return 0
def tsp_goal_state(state):
return len(state.get_vertices()) == 1
def fval_function(sN, weight):
return sN.gval + weight * sN.hval
def anytime_gbfs(initial_state, heur_fn,... | true |
f5bd9642a028264318b9a6e3d3e1e22b43d1d7ba | Python | Phillgb/ViSTA_GrAM | /scripts/2.2/GrAM/schedule.py | UTF-8 | 2,436 | 3.21875 | 3 | [] | no_license | # schedule.py Phillipe Gauvin-Bourdon
'''
This script is describing the scheduler for the GrAM module. This scheduler is
making sure the agents are activated one type at the time. Each agents of the
same type are activated at random.
'''
# --------------------------IMPORT MO... | true |
fa1c398ffd16beb58d2828806303c25ed70e6733 | Python | eavanvalkenburg/brunt-api | /src/brunt/http.py | UTF-8 | 5,580 | 2.578125 | 3 | [
"MIT"
] | permissive | """Main code for brunt http."""
from __future__ import annotations
import json
import logging
from abc import abstractmethod, abstractproperty
from datetime import datetime
from typing import Final
import requests
from aiohttp import ClientSession
from .const import COOKIE_DOMAIN, DT_FORMAT_STRING
from .utils import... | true |
7f131c9079ac014c3b4f7f2a0637c670ed1dd6e6 | Python | EduardoLPaez/spanish-twitter-Sentiment-Analysis | /stream_app.py | UTF-8 | 1,427 | 3.3125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import streamlit as st
import matplotlib.pyplot as plt
from main import twitter_query
import altair as alt
def overall(frame):
temp = frame['sentiment'].mean()
if temp >= 6:
return 'positive'
elif temp <= 6 and temp >= 3.1:
return 'neutral'
else:
... | true |
9da9c0012eea2cde05759892586b75908216b9fb | Python | icebert/clinvar_norm | /utils/format.py | UTF-8 | 191 | 2.65625 | 3 | [] | no_license | #!/bin/env python
import sys
import hgvs.parser
hp = hgvs.parser.Parser()
for var in sys.stdin:
var = var.rstrip('\n')
var_i = hp.parse_hgvs_variant(var)
print(str(var_i))
| true |
a01b7a97309e5bb5ac8c8a5a6628855b2a0c0196 | Python | HBinhCT/Q-project | /hackerearth/Data Structures/Advanced Data Structures/Trie (Keyword Tree)/Yet another problem with Strings/solution.py | UTF-8 | 852 | 2.796875 | 3 | [
"MIT"
] | permissive | from sys import stdin
def get_deciphered(string, last_yes_decipher):
res = ''
for c in string:
res += chr((ord(c) - 97 + last_yes_decipher) % 26 + 97) # 97 = ord('a')
return res
n, q = map(int, stdin.readline().strip().split())
strings = []
for _ in range(n):
s = stdin.readline().strip()
... | true |
9efc35382897fd9ae1a4e47a3efe15e07249f3b6 | Python | s3rvac/talks | /2017-03-07-Introduction-to-Python/examples/23-override.py | UTF-8 | 119 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | class A:
def foo(self):
print('A')
class B(A):
def foo(self):
print('B')
x = B()
x.foo() # B
| true |
6d4e1072a09915e25b9dfa3ae529c797cfc4743b | Python | qgladis45/Dinner | /new 2.py | UTF-8 | 10,570 | 2.78125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import tkinter as tk
from tkinter import *
from tkinter import ttk
from tkinter.messagebox import showinfo
import webbrowser
from PIL import Image, ImageTk
from urllib.request import urlopen
import io
import sys
#網路連線檢查
def check_internet():
try:
_ = requests.g... | true |
252d739afbf8adcc337598418688502b7263c125 | Python | nikollson/AIAnimation | /AlphaGoZeroBase/AlphaGoZeroBase/Environment/MujocoModel.py | UTF-8 | 1,263 | 2.609375 | 3 | [] | no_license |
from mujoco_py import load_model_from_path
import numpy as np
class MujocoModel:
def __init__(self, modelPath : str):
self.MujocoModel = load_model_from_path(modelPath)
self.JointList = self.GetJointList()
self.NActuator = len(self.MujocoModel.actuator_names)
se... | true |
1b847fe2c3452a0c3d6e1a45ba12c872b477fbef | Python | SciLifeLab/scilifelab | /scilifelab/utils/slurm.py | UTF-8 | 750 | 2.5625 | 3 | [
"MIT"
] | permissive | """Useful functions for interacting with the slurm manager
"""
import subprocess
import getpass
try:
import drmaa
except:
pass
def get_slurm_jobid(jobname,user=getpass.getuser()):
"""Attempt to get the job id for a slurm job name. Can this be done with python-drmaa instead?
"""
jobids = []
cmd... | true |
1709805c7b31aa7bc000947822d762e707b03d31 | Python | safciezgi/Python-Ubuntu-OS-Trial | /.vscode/DENEME.py | UTF-8 | 2,011 | 2.578125 | 3 | [] | no_license | import os
import psutil
import shutil
import netifaces
import pprint
import platform
print('')
print("="*40, "Ip Addresses", "="*40)
print('')
ip_ = os.popen("ip a").readlines()
from pprint import pprint
pprint(ip_)
print('')
print("="*40, "Network Interfaces Names", "="*40)
print('')
addrs = psutil.net_if_addr... | true |
3dfb99a05589297eadf6686bd29c80d641f5a7bd | Python | Volerous/PACalendar | /FlaskApp/FlaskApp/classes.py | UTF-8 | 5,492 | 2.515625 | 3 | [
"MIT"
] | permissive | from sqlalchemy import String, Column, Table, Integer, ForeignKey, create_engine, DateTime, Boolean, Float, Text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
import datetime
from sqlalchemy.sql import select
Base = declarative_base()
Event_has_Tags = Tabl... | true |
d8ec6bab60caaf5fd043d6804a0d6dc02423c8ac | Python | DiogoOliveira111/ProjectoTese | /OpenFiles.py | UTF-8 | 1,309 | 2.859375 | 3 | [] | no_license | import pandas as pd
import pickle
import seaborn as sns
import numpy as np
import easygui
from tkinter import Tk, Label
from WBMTools.sandbox.interpolation import interpolate_data
path = easygui.fileopenbox()
with open(path, 'rb') as handle:
collection= pickle.load(handle)
flag=0
MouseTime=[]
MouseX=[]
MouseY=[... | true |
7d0cc4c6fedf1d42d4feaa5aeb6d6002f34b4293 | Python | poojan14/Python-Practice | /Hackerearth/Monk Takes a Walk.py | UTF-8 | 946 | 4.28125 | 4 | [] | no_license | '''
Today, Monk went for a walk in a garden. There are many trees in the garden and each tree has an English alphabet on it. While Monk was
walking, he noticed that all trees with vowels on it are not in good state. He decided to take care of them. So, he asked you to tell him
the count of such trees in the garden.
Not... | true |
6c6053d1bdfd8084dbbd7b7ca10189184dd17cfb | Python | chuzcjoe/Leetcode | /337. House Robber 3.py | UTF-8 | 713 | 3.125 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def rob(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not... | true |
80f9c991bc75b37712ce6dd426fad3fe29d70e09 | Python | mbreault/python | /algorithms/sorting/index.py | UTF-8 | 2,465 | 3.390625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from functools import wraps
from time import time
import numpy as np
# from https://stackoverflow.com/questions/1622943/timeit-versus-timing-decorator
def timing(f):
@wraps(f)
def wrap(*args, **kw):
ts = time()
result = f(*args, **kw)
te = time()
print(... | true |
9b78d2f4624390257522e511f0472618e1377405 | Python | xbb66kw/Bandit | /bandit_experiment/UCB1.py | UTF-8 | 8,847 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import gzip
import re
import random
from logistic_high_di import HighDimensionalLogisticRegression
class DataReader(object):
def __init__(self):
self.articles_old = set()
self.articles_new = set()
self.li... | true |
30a017b4248cc1248625418e10040a0e542a0e19 | Python | sohailADev/keygen | /gen.py | UTF-8 | 297 | 3.046875 | 3 | [
"MIT"
] | permissive | import random
import hashlib
def generate_key():
random_num = random.randint(0, 4)
randoms_nums = [11, 22, 33, 44, 55]
bytes_list = bytearray(b'\x01\x02\x03')
bytes_list.append(randoms_nums[random_num])
return hashlib.sha256(bytes_list).hexdigest()
print(generate_key())
| true |
1f4756016a52c9b65489b8c3c5126bc0a469b2be | Python | blont714/Project-Euler | /Problem16.py | UTF-8 | 204 | 3.296875 | 3 | [] | no_license | def main():
num_str = str(2**1000)
sum = 0
for i in num_str:
sum += int(i)
print(sum)
if __name__ == "__main__":
main()
#出力結果: 1366
#実行時間: 0.103s
| true |
9ef7b0e57332e915efe9051e45fa739a35f343f7 | Python | luilui163/zht | /projects/python_chen/task3.py | UTF-8 | 1,207 | 2.828125 | 3 | [] | no_license | # -*-coding: utf-8 -*-
# Python 3.6
# Author:Zhang Haitao
# Email:13163385579@163.com
# TIME:2018-10-23 09:57
# NAME:zht-task3.py
import requests
from bs4 import BeautifulSoup
def get_baidu_news_title(pages=5):
titles=[]
for page in range(1,pages+1):
url=f'http://news.baidu.com/ns?word=%E6%AD%A6%E6%B... | true |
589e3c12b7755d38426b1c0df59c0e67990742ef | Python | programparks/Kennesaw-Capstone-Project | /Project Files/Scripts + Installation Instructions/Insert.py | UTF-8 | 11,977 | 2.609375 | 3 | [] | no_license | import json
import pyodbc
import glob
import sys
from Crawler import login
import sys
# from urllib import unquote
from urllib import parse
import requests
import re
from lxml import etree
from bs4 import BeautifulSoup
import os, json, time
from Crawler import crawl
userName = 'zdowning@students.kennesaw.edu '
p... | true |
2fbf0cac41e8a9c0ea4d2acd8afed0e1a4201686 | Python | Semal31/Gedcom-parser-group1 | /test_parser.py | UTF-8 | 88,881 | 2.84375 | 3 | [] | no_license | import pytest
from parser import *
# Generic individuals dict that should pass most tests
CORRECT_INDIVIDUALS = {
"@I1@": {
"NAME": "Ryan /Hartman/",
"SEX": "M",
"BIRT": "",
"DATE": "11 NOV 1999",
"FAMS": "@F9@",
"FAMC": "@F2@",
},
"@I3@": {
"NAME": ... | true |
019b5d23d15f4b1b28ee9d89112921f4d325375e | Python | TonyZaitsev/Codewars | /7kyu/Sum Factorial/Sum Factorial.py | UTF-8 | 1,148 | 4.8125 | 5 | [
"MIT"
] | permissive | """
https://www.codewars.com/kata/56b0f6243196b9d42d000034/train/python
Sum Factorial
Factorials are often used in probability and are used as an introductory problem for looping constructs. In this kata you will be summing together multiple factorials.
Here are a few examples of factorials:
4 Factorial = 4! = 4 * ... | true |
13fd6dcf6cb638ca81ae9155348eb3a8136120e1 | Python | lgcy/tf-head-pose | /datasets.py | UTF-8 | 6,356 | 2.546875 | 3 | [] | no_license | import os
import numpy as np
from random import randint
import tensorflow as tf
from PIL import Image, ImageFilter
import utils
def get_list_from_filenames(file_path):
# input: relative path to .txt file with file names
# output: list of relative path names
with open(file_path) as f:
lines = f... | true |
9fac40da3b6f3a2daa77269d9966389a095beeb9 | Python | 2015shanbhvi/flask_sn | /models.py | UTF-8 | 670 | 2.78125 | 3 | [] | no_license | import sqlite3 as sql
from os import path
#do "pathing"
#layer that contains info for server <--> database
#get dir name, get file path of whatever we pass in
ROOT = path.dirname(path.relpath(__file__))
def create_post(name, content):
#conenct to database
con = sql.connect(path.join(ROOT, 'database.db'))
cur = con... | true |
288d970ea0ec55bbd6d3f3601df0f22e36fb0d39 | Python | ELE-22/Monica | /webscrap_index.py | UTF-8 | 2,556 | 2.90625 | 3 | [] | no_license | import pandas as pd
from selenium import webdriver
from read_excel import get_Tags
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import trans... | true |
5be312dd6dadf6f6b0eaf9c87714432fefa83e54 | Python | Inndy/tkinter_samples | /src/text_editor.py | UTF-8 | 1,404 | 2.796875 | 3 | [] | no_license | import os
from tkinter import *
HEIGHT = 32
WIDTH = 80
root = Tk()
root.title("Text editor")
def onlist():
onclear()
file_list = '\n'.join(os.listdir())
textarea.insert('@0,0', file_list)
def onread():
onclear()
try:
fobj = open(txtFile.get(), "r")
textarea.insert("@0,0", fobj.re... | true |
74e37718207744607fba568efa2f4b513f30b206 | Python | steview-d/practicepython-org-exercises | /practice_python_org/16_pass_gen.py | UTF-8 | 3,559 | 3.71875 | 4 | [] | no_license | import random
pw_len, upper, lower, numbers, symbols = 8, 1, 1, 1, 1
stored_pw = []
pw_list_upper = "QAZXSWEDCVFRTGBNHYUJMKIOLP"
pw_list_lower = "polmkiujnbhytgvcfredxzswqa"
pw_list_numbers = "1234567890"
pw_list_symbols = '!"£$%^&*()_+][}{;@#:~?><,./\|'
def generate_password(source, pass_length):
"""Generate a ... | true |
1b48850f668068a7c1174c04e1bbb57e7d4ec7f2 | Python | Ankit-Kumar-Saini/Applications-of-Data-Science | /Sentiment Analysis/app/app.py | UTF-8 | 3,441 | 3.328125 | 3 | [] | no_license | # import necessary modules
import re
import nltk
import time
import pickle
import sqlite3
import numpy as np
from nltk.corpus import stopwords
from bs4 import BeautifulSoup
from flask import Flask, render_template, request
# download stopwords from nltk
nltk.download('stopwords')
## Function to connect to sql databa... | true |
b4de57ba88721f4f144d5ec0412d1891085e312e | Python | adi-dhal/vistaar_cvg | /prob_stat_1/ps_1_1.py | UTF-8 | 144 | 2.859375 | 3 | [] | no_license | import sys
import math
def inp(arg):
ans=[]
for x in arg:
ans.append(math.factorial(int(x)))
print (ans)
return
inp(sys.argv[1:])
| true |
6a3d9af07cc34c3e928dd11fa21c920868076fe3 | Python | zihao-fan/ensemble_learning | /src/data_helper.py | UTF-8 | 1,183 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import os
import numpy as np
import matplotlib.pyplot as plt
current_path = os.path.realpath(__file__)
root_path = '/'.join(current_path.split('/')[:-2])
data_path = os.path.join(root_path,
'data', 'ContentNewLinkAllSample.csv')
def train_test_split(data, ratio=0.2)... | true |
bda43fecae815b41c782a506143e389e7199783a | Python | adrielgentil/practica-programacion | /adivina.py | UTF-8 | 8,926 | 3.734375 | 4 | [] | no_license | # Importamos libreria random
import random
# Generamos número aleatorio
n1 = random.randint(1, 30)
# Funcion para preguntar si quiere jugar o no
def pregunta():
sn = input()
if sn.lower() == 'no':
print('Oh, que pena, quería divertirme un poco. Será la próxima entonces. Chau!')
elif sn.lower() =... | true |
36ab1990f8f757f61413200b51d8e4d9e7de568f | Python | daniel-reich/ubiquitous-fiesta | /Mwh3zhKFu332qBhQa_18.py | UTF-8 | 54 | 2.703125 | 3 | [] | no_license |
def guess_sequence(n):
return 30 * n * n + 60 * n
| true |
d5a4c342aa1b09d3cb66d00d5737b63c9fa15d6b | Python | raphael-group/chisel | /src/chisel/Plotter.py | UTF-8 | 25,707 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python2.7
import sys, os
import argparse
import random
import warnings
from itertools import cycle
from collections import defaultdict
import numpy as np
import scipy
import scipy.cluster
import scipy.cluster.hierarchy as hier
import pandas as pd
import matplotlib as mpl
mpl.use('Agg')
from matplotli... | true |
8c8e1318746ccbb75eaba152e8c06d1598c8b68b | Python | EaconTang/python-cook-notes | /book/machine_learning_in_action/decision_tree/trees.py | UTF-8 | 1,948 | 3.46875 | 3 | [] | no_license | # coding=utf8
from numpy import *
from math import log
import matplotlib
def calc_shannon_ent(data_set):
"""
计算香农熵,熵越高,混合的数据越多
"""
num_entries = len(data_set)
label_counts = {}
for _ in data_set:
_label = _[-1]
if _label not in label_counts.keys():
label_counts[_lab... | true |
4f1edd0c5397940979f4d6660041ffdcf190fd95 | Python | lucianojunnior17/Python | /Curso_Guanabara/aula59.py | UTF-8 | 1,136 | 4.40625 | 4 | [
"MIT"
] | permissive | from time import sleep
print(' Olá programa feito para brinar om números ')
sleep(3)
n1 = int(input('Primeiro valor'))
n2 = int(input('Segundo valor'))
opção = 0
while opção != 5:
print('''[1] SOMAR
[2] MULTIPLICAR
[3] MAIOR
[4] NOVOS NÚMEROS
[5] SAIR DO PROGRAMA ''')
opção = int(inp... | true |
5b0b283265523b4c25ba06b4e7aab3bc7c66cad3 | Python | Puepis/ProjectEuler | /PEuler11 (Reading Grid of Numbers).py | UTF-8 | 2,460 | 4.15625 | 4 | [] | no_license |
'''Description: PEuler 13
"Work out the first ten digits of the sum of the following
one-hundred 50-digit numbers." (numbers read from text file)
Date: Jan. 20, 2019
'''
from operator import mul
def main():
# Open file
gridFile = open("grid.txt", "r")
# Initialize sum
theS... | true |
1d91138fde8cfc6f39230d36982d8fb830f15d46 | Python | Mechalabs/LocalHackDay-Dec1 | /Starting Page.py | UTF-8 | 1,681 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import pygame
import time
pygame.init()
WIDTH = 800
HEIGHT = 800
gameWindow = pygame.display.set_mode((WIDTH, HEIGHT))
# variables
WHITE = (255,255,255)
BLACK = ( 0, 0, 0)
outline = 0
pygame.font.init()
pygame.mixer.init()
font = pygame.font.SysFont("Comic Sans MS", 36)
Narwhal = pygame.image.load("C:\Users\user\... | true |
b3ad09277c8c4fd9fb89cfbeb8ece5df04fdb55c | Python | cmutel/ecoinvent-row-report | /ecoinvent_row_report/filesystem.py | UTF-8 | 304 | 3.140625 | 3 | [] | no_license | import hashlib
def md5(filepath, blocksize=65536):
"""Generate MD5 hash for file at `filepath`"""
hasher = hashlib.md5()
fo = open(filepath, 'rb')
buf = fo.read(blocksize)
while len(buf) > 0:
hasher.update(buf)
buf = fo.read(blocksize)
return hasher.hexdigest()
| true |
2bf24e759522d5deb2fb8947884678010b68a755 | Python | 2torus/creme | /creme/metrics/confusion.py | UTF-8 | 4,562 | 3.5625 | 4 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import collections
import functools
import operator
__all__ = ['ConfusionMatrix', 'RollingConfusionMatrix']
class ConfusionMatrix(collections.defaultdict):
"""Confusion matrix.
This class is different from the rest of the classes from the `metrics` module in that it
doesn't have a ``get`` method.
... | true |
dc643664a440d7429b3deb060f611b8c6cfc90d2 | Python | neont21/do-it-python | /chapter02/ex06_price.py | UTF-8 | 361 | 3.625 | 4 | [] | no_license | def service_price():
service = input('서비스 종류를 입력하세요, a/b/c: ')
valueAdded = input('부가세를 포함합니까? y/n: ')
prices = { 'a': 23, 'b': 40, 'c': 67 }
price = prices[service] # need error handling
if valueAdded == 'y':
price *= 1.1
print(str(round(price, 1))+'만원입니다')
service_price()
| true |
a015f0543b6b7f9facd33ee0981f6ca76d329534 | Python | cccristhian/django | /bolg/models.py | UTF-8 | 746 | 2.53125 | 3 | [] | no_license | from django.db import models
from django.utils import timezone
class Publicar(models.Model):
autor =models.ForeignKey('auth.User')
titulo=models.CharField(max_length=200)
texto=models.TextField()
fecha_crear=models.DateTimeField(
default=timezone.now)
fecha_publica=models.DateTimeField(
... | true |
4fd0c081415b1f1c9eb2392160e3660519186aca | Python | sunnyliang6/Infinite-Double-Panda | /main.py | UTF-8 | 36,751 | 2.96875 | 3 | [] | no_license | ####################################
# This game is based on the original Double Panda game:
# https://www.coolmathgames.com/0-double-panda
####################################
####################################
# Run this file to run the project
# This file contains the game loop
##################################... | true |
d77fcf859522fc913cb14fc980d63cea6a059ed9 | Python | broodfish/cs-ioc5008-hw1 | /connect.py | UTF-8 | 577 | 2.578125 | 3 | [] | no_license | import pandas as pd
import os
id = pd.read_csv("./result/id.csv")
label = pd.read_csv("./result/label.csv")
label = label[0:1040]
labels={
0:'bedroom', 1:'coast', 2:'forest', 3:'highway', 4:'insidecity', 5:'kitchen', 6:'livingroom', 7:'mountain', 8:'office', 9:'opencountry',
10:'street', 11:'subur... | true |
0ad935c5977e65bcda56e79c7e5a618189a53b88 | Python | qccr-twl2123/python-algorithm | /base/numpy_test.py | UTF-8 | 1,334 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import numpy as np
dataset = [[1,0,1,0],[1,0,1,1],[1,1,1,0]]
print dataset
#将列表转换成多维数组
dataset = np.array(dataset)
print dataset
#numpy.sum 数组加法
# sum axis=none 全部相加 0 按列相加 1 按行相加
a = np.sum(dataset,0)+1
print a
sub_dataset =[[1,0,1,0],[1,0,1,1]]
sub_dataset = np.array(su... | true |
b7f85d0380f1a44628e9da19eef1d04fbaa8bb91 | Python | nigellak/python-basics | /lesson6.py | UTF-8 | 144 | 3.140625 | 3 | [] | no_license | scores=[45,57,89,56,70]
print(scores[1])
scores.append(81)
print(scores)
scores.pop(0)
print(scores)
for score in scores:
print(score) | true |
42adf510d30a1d81385c41b8fd1558776f3bf07f | Python | kwj2104/ProjectClimbML | /climbing_dataset.py | UTF-8 | 2,249 | 2.5625 | 3 | [] | no_license | import numpy as np
import pickle
import torch
from torch.utils.data import Dataset
import sys
class ClimbingDataset(Dataset):
# Print everything
np.set_printoptions(threshold=np.inf)
# video level data structures
label_dict = {}
video_list = []
# frame level data structures
frame_list =... | true |
f0789f0414a5d3e9eec187482820b5e797aafa29 | Python | uborzz/ocr-search | /rady_stream.py | UTF-8 | 2,959 | 2.53125 | 3 | [] | no_license | from threading import Thread
import cv2
"""
rady
basado en webcamvideostream de pyimagesearch para raspi camera.
Camera props:
CAP_PROP_POS_MSEC Current position of the video file in milliseconds.
CAP_PROP_POS_FRAMES 0-based index of the frame to be decoded/captured next.
CAP_PROP_POS_AVI_RATIO Relative ... | true |
d2d92542e8b2775686d07b0f47b7894396d5a93d | Python | qnddkrasniqi/prod-python-practice | /advanced-syntax/conditional_expressions.py | UTF-8 | 696 | 3.25 | 3 | [] | no_license | def number(a):
if a == 1:
return 'Yes'
else:
return 'No'
def number(a):
return True if a == 1 else False
def my_list(lst):
if len(lst) > 3:
return 'Too long'
else:
return 'Okay'
def my_list(lst):
return 'Too long' if len(lst) > 3 else 'Okay'
def numrat(c):... | true |
ab2ace41de8b4cd35a43ef994d66e9051557d905 | Python | rj-ram/python-sample | /real_time_video.py | UTF-8 | 2,020 | 2.515625 | 3 | [] | no_license | from keras.preprocessing.image import img_to_array
import imutils
import cv2
from keras.models import load_model
import numpy as np
detection_model_path = ''
emotion_model_path = ''
face-detection = cv2.CascadeClassifier(detection_model_path)
emotion_classifier = load_model(emotion_model_path, compile=False)
E... | true |
1d55abc151aeffcd6869c5711bdfbc887f6117c4 | Python | cmattey/leetcode_problems | /Python/lc_110_balanced_binary_tree.py | UTF-8 | 730 | 3.5 | 4 | [
"MIT"
] | permissive | # Time: O(n), where n is size(tree)
# Space: O(n)
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def isBalanced(self, root: TreeNode) -> bool:
return self.get_height(root)!=-... | true |
9c8e7ccabc6c763be9ab85e1f7a00685ae04ca9d | Python | Subham2901/Python_Tutorials | /Variables.py | UTF-8 | 2,083 | 4.4375 | 4 | [] | no_license | """Definiton: A variable is a storage location(identified) by a memory location/addrress)
paired with an associated symboloic name(an identifier),which contains some known or unkmnown quantity of information
refered to as value
i.e It's an named memory location which can be used to store information which can be later... | true |
3e00cb4972af1b3654d8e27fa334ec7050a25edb | Python | Aasthaengg/IBMdataset | /Python_codes/p02580/s349625629.py | UTF-8 | 935 | 3.03125 | 3 | [] | no_license | from collections import defaultdict
def main():
_, _, m = map(int, input().split())
row_dict = defaultdict(int)
col_dict = defaultdict(int)
row_col_dict = defaultdict(set)
for _ in range(m):
row, col = map(int, input().split())
row_dict[row] += 1
col_dict[col] += 1
... | true |
23bf1724fa328bfa54e1f42b74a4b5e2956e57cb | Python | TrinityChristiana/py-multi-inheritance | /uncle-jake/py-files/arrangements/types/valentines_day.py | UTF-8 | 699 | 2.734375 | 3 | [] | no_license | from arrangements import Arrangement
class ValentinesDay(Arrangement):
def __init__(self):
super().__init__()
self.stem_inch = 7
self.refrigerated = True
self.descriptor = "flamboyant"
def enhance(self, *args):
try:
for i in args:
... | true |
c6ffbf0009fbad72ac0f5aed6a8d2c8a5f75fd90 | Python | tarun571999/Pythonprograms | /class.py | UTF-8 | 408 | 3.828125 | 4 | [] | no_license | '''def largest1(a,b,c):
if(a>b and b>c):
print(a)
elif(b>c):
print(b)
else:
print(c)
a= int(input("enter a"))
b= int(input("ENTER b"))
c = int(input("enter c "))
largest1(a,b,c)
l=[1,2,3,4,5]
print(sum(l))
strr ='hello'
print(strr[::-1])'''
n = int(input('enter no of... | true |
cc3abfdc1674f2cd63dfdc827b7e4b6054c1aa00 | Python | frankye1000/LeetCode | /python/Shortest Distance to a Character.py | UTF-8 | 189 | 2.953125 | 3 | [] | no_license | S = "loveleetcode"
C = 'e'
# Output: [3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0]
Cindex = [i for i, v in enumerate(S) if v == C]
print([min([abs(i - j) for j in Cindex]) for i in range(len(S))])
| true |
3266eba50c39b5a521b71766b48b31659c9bdc26 | Python | jColeChanged/MIT | /Computer Science 6.01 SC/Unit 1/Exercises 2/2-3-3.py | UTF-8 | 341 | 2.640625 | 3 | [] | no_license | from lib601 import sm
class CountingStateMachine(sm.SM):
startState = 0
def getNextValues(self, state, inp):
return (state + 1, state)
class AlternateZero(CountingStateMachine):
def getNextValues(self, state, inp):
state, output = CountingStateMachine.getNextValues(self, state, inp)
return (state, 0 if outp... | true |
0a51d22e2d833dacc3672c62d2e3fd59d175aff9 | Python | Pexeso/CWR-DataApi | /tests/parser/dictionary/encoder/record/test_instrumentation_detail.py | UTF-8 | 1,192 | 2.625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import unittest
from cwr.parser.encoder.dictionary import InstrumentationDetailDictionaryEncoder
from cwr.work import InstrumentationDetailRecord
"""
InstrumentationDetailRecord to dictionary encoding tests.
The following cases are tested:
"""
__author__ = 'Bernardo Martínez Garrido'
__lice... | true |
108858809506032b7c4f56b21213796daea65cd6 | Python | sunilkumarhr5593/test_git | /trial_1.py | UTF-8 | 37,654 | 2.75 | 3 | [] | no_license | import pandas
import itertools
from math import log
import math
import numpy as np
# =============================================================================
# to calculate the prob of trigram
# =============================================================================
df_trigram = panda... | true |
4f9485605b3a65731cc1f675d6558427b02655b0 | Python | ShenQianli/FlowerClassification2018 | /src/datagen_show.py | UTF-8 | 1,463 | 2.734375 | 3 | [] | no_license | from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing import image
import numpy as np
import matplotlib.pyplot as plt
datagen = ImageDataGenerator(
featurewise_center=False, # set input mean to 0 over the dataset
samplewise_center=False, # set each sample mean to 0
featurewise_st... | true |
a16605c48c01a071e37407ba529d04379b37dac1 | Python | valerija-h/DDQN-Assignment | /Code/pixel_ram.py | UTF-8 | 11,351 | 2.84375 | 3 | [] | no_license | import tensorflow.compat.v1 as tf
import os
import matplotlib.pyplot as plt
import gym
import numpy as np
from collections import deque
from IPython.display import clear_output
import random
import pickle
import time
# please note the code in the agent class was adapated from tutorial material
# please note the priorit... | true |
b8f2cfe33fecf9d2494dbeb13c9f3b64647fe49a | Python | Fyssion/FyssionMediaServer | /server/utils/flags.py | UTF-8 | 3,617 | 2.875 | 3 | [] | no_license | """
This source code was responsibly sourced from Rapptz/discord.py
Original: https://github.com/Rapptz/discord.py/blob/a8f44174bafed3989ec2959a62b89006f4a9e9a1/discord/flags.py
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of thi... | true |
36cfc2d2f193c93ecd32eda7ea95598fb966d870 | Python | krishnakaushik25/Multi-Class-Text-Classification-BERT | /Modular_code/src/ML_Pipeline/utils.py | UTF-8 | 2,494 | 3.09375 | 3 | [] | no_license | import pandas as pd
import tensorflow as tf
from datasets import list_datasets, load_dataset
# check the gpu settings
def check_gpu_info():
print("Tensorflow version : ", tf.__version__)
print("GPU available : ", bool(tf.test.is_gpu_available))
print("GPU name : ", tf.test.gpu_device_name())
# i... | true |
7938714a865e1115a45fa79042ff23317c0c2165 | Python | JaMesLiMers/Image_Retrieval_Framework_FYP | /Models/Word2Vec/source/w2v_tfidf.py | UTF-8 | 4,070 | 3.109375 | 3 | [] | no_license | import numpy as np
from numpy.core.fromnumeric import size
from tqdm import tqdm
class W2V_TFIDF:
def __init__(self, corpora, tfidf_model, tfidf_M, w2v_model, corpora_vocab):
"""Initialize the pram that W2V_TFIDF algorithm need.
W2V_TFIDF算法类, 实现了对词向量进行TFIDF加权得到句向量的相似度衡量方法。
Args:
... | true |
bed317dcb9681806f5549988014b9bc5d3276fbd | Python | vladworldss/billing | /src/db/logic.py | UTF-8 | 3,324 | 2.71875 | 3 | [] | no_license | import logging
from decimal import Decimal
from sqlalchemy.orm import Session
from db.models import Wallet, Transaction
from db.constants import WalletStatuses, TransactionStatuses, Currency
logger = logging.getLogger('billing.' + __name__)
class WalletStore:
@staticmethod
def get_wallet(db_session: Sessi... | true |
07bce61e75315c4c38bf2d8f5651ac5793e9f2c0 | Python | GongMeiting2020/IBI1_2019-20 | /Practical5/variables.py | UTF-8 | 630 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 20 00:26:39 2020
@author: gongmeiting
"""
a=457
b=a*1000+a
print(b%7==0)
c=b/7
d=c/11
e=d/13
print(a==e)
print(a>e)
print(a<e)
#a==e is always True since b/a=7*11*13
#another code, to avoid same variables,use f~j to represnt a~e
f=input ("a three-d... | true |
c04d74d94a3a40f90dba8a4a86ddd2dfc288655c | Python | explore-ITP/explore-itp.github.io | /code/notebook-3/vis1_dropdown.py | UTF-8 | 8,302 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 26 10:43:16 2020
@author: larabreitkreutz
"""
import plotly.graph_objects as go
import pandas as pd
import plotly.io as pio
pio.renderers.default = "browser"
import chart_studio
import chart_studio.plotly as py
import chart_studio.tools as tls
# ... | true |
8d81ed08fecf0110b882e230061a4d518ac38184 | Python | redhat-raptor/pi-camera | /receiver/receiver.py | UTF-8 | 1,136 | 2.609375 | 3 | [] | no_license | import socket
import os
from datetime import datetime
import logging
logging.basicConfig(
format='%(asctime)s %(levelname)-8s %(message)s',
level=logging.DEBUG,
datefmt='%Y-%m-%d %H:%M:%S')
def open_connection():
logging.info('Starting receiver')
sock = socket.socket(socket.AF_INET, socket.SOCK_ST... | true |
108b63f69a955f3f4d652c555aa65a9c3556c41c | Python | suixin233/OJ | /input_output.py | UTF-8 | 719 | 3.171875 | 3 | [] | no_license |
def in_put():
num = input()
num2 = num.split(' ')
num3 = []
for i in range(len(num2)):
num3.append(num2[i])
return num2
def out_put(x):
s = " ".join(str(i) for i in x)
return s
def in_put():
num = int(sys.stdin.readline())
return num
import sys
def in_put():
lines ... | true |
265d1dc3109dcbc8b447a1e2087333a81c6285b1 | Python | aludvik/sawtooth-core | /validator/sawtooth_validator/database/lmdb_database.py | UTF-8 | 3,913 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2016 Intel Corporation
#
# 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 to in wri... | true |
7f5363f80116b9e90cedcb189bd9d2f42f978baa | Python | AtsukoFukunaga/us_states_game | /main.py | UTF-8 | 1,058 | 3.46875 | 3 | [] | no_license | import turtle
import pandas as pd
screen = turtle.Screen()
screen.title('U.S. States Game')
screen.bgpic('blank_states_img.gif')
screen.setup(width=800, height=500)
data = pd.read_csv('50_states.csv')
all_states = data.state.to_list()
player = turtle.Turtle()
player.hideturtle()
player.penup()
guessed_states = []
... | true |