blob_id large_string | language large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|---|
11ec0e1543fc5d3364a6a1abb4b7159b97011064 | Python | amitgroup/parts-net | /pnet/rescalc.py | UTF-8 | 3,065 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive |
import numpy as np
def calc_precision_recall(detections, tp_fn):
indices = np.where(detections['correct'] == True)[0]
N = indices.size
#precisions = np.zeros(N)
#recalls = np.zeros(N)
precisions = []
recalls = []
last_i = None
for i in range(N):
indx = indices[i]
if i==... | true |
df3f5e3484564d5798cb837bb786e0a46754a979 | Python | chaerui7967/K_Digital_Training | /Python_KD_basic/String/formatting.py | UTF-8 | 931 | 3.234375 | 3 | [] | no_license | # formatting : %d %f %s %c
aa, dd = 10, 20
aasdf = 'ppp'
print('문자 : %d' %aa)
print('문자 : ', format(aa,'d'),'개')
print('문자 : {0}, 숫자: [1}'.format(aa,dd))
print('문자 : {aa}개, 숫자 : {dd}개'.format(aa=aa, dd=dd))
print('키 : {0:5.1f}'.format(aa))
#정렬
print('{0:<10}'.format(aasdf))
print('{0:>10}'.format(aasdf))
print('{0:^10}... | true |
acef283fa26a4c62f066015e7cec2d2b484a4fc5 | Python | matsu4ki/study_python | /chapter4/question2.py | UTF-8 | 2,822 | 3.484375 | 3 | [
"MIT"
] | permissive | import sys
import time
def go_sukiya(wallet, is_bilk):
menu = {
"牛丼ミニ": 290,
"牛丼並盛": 350,
"牛丼中盛": 480
}
print("いらっしゃいませ!")
if is_bilk:
print("お客様は一度食い逃げしています")
print("警察を呼びます")
sys.exit()
print("何をご注文なさいますか?")
products = choice_multiple(menu)
... | true |
01523d1a142d92c95223c210527bdede5880c35e | Python | somenzz/tutorial | /largest_files.py | UTF-8 | 791 | 3.203125 | 3 | [] | no_license | import os
import time
from os.path import join, getsize
from heapq import nlargest
def walk_files_and_sizes(start_at: str):
for root, _, files in os.walk(start_at):
for file in files:
path = join(root, file)
try:
size = getsize(path) # bytes
yield ... | true |
2070aff160d9b50080976442c7c54c4445ed37eb | Python | Fazle-Rabby-Sourav/deep-learning-hands-on | /find-nearest-pont/nearest-point-on-a-line-from-point-x.py | UTF-8 | 592 | 4.1875 | 4 | [] | no_license | # alpha : a, unit vector : u
# au define a line of point that may be obtained by varrying the value of a (Alpha)
# Derive an expression for the point y that lies on the line that is as close as possible to an arbitary point x
import numpy as np
# values of a specific given point, x
x = np.array([[1.5], [2.0]])
print(... | true |
6ab60078627859dcb5efc779b88c0a35f0820241 | Python | samatova1215/itrun | /Lesson_6/app.py | UTF-8 | 1,664 | 3.3125 | 3 | [] | no_license | # d = {}
#
# s = "If the implementation is hard to explain, it's a bad idea."
#
#
# for key in s:
# if key.lower() not in d:
# d[key.lower()] = 0
# # d["i"] = 0
# # d["f"] = 0
# # d[" "] = 0
# # d["t"] = 0
# # d["h"] = 0
# d[key.lower()] = d[key.lower()] + 1
# pri... | true |
e91ee724d0bd69b04a14fe266df2ac3ec7cf8eab | Python | missionpinball/mpf | /mpf/platforms/interfaces/light_platform_interface.py | UTF-8 | 5,751 | 3.015625 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | """Interface for a light hardware devices."""
import abc
import asyncio
from asyncio import AbstractEventLoop
from functools import total_ordering
from typing import Any, Optional
from mpf.core.utility_functions import Util
@total_ordering # type: ignore
class LightPlatformInterface(metaclass=abc.ABCMeta):
... | true |
3fba76524148c8d6929e9b5f501d7f9f41c90930 | Python | UoM-Podcast/helper-scripts | /lib/rest_requests/request.py | UTF-8 | 3,656 | 2.796875 | 3 | [
"BSD-2-Clause"
] | permissive | """
This module offers different types of requests to a given URL.
"""
import requests
from requests.auth import HTTPDigestAuth
from rest_requests.request_error import RequestError
def get_request(url, digest_login, element_description, asset_type_description=None, asset_description=None):
"""
Make a get re... | true |
424ed6f646e0f095bdd3879eb8efc794429d1078 | Python | qwerasdft/pyLeetcodes | /py.leetcode130.py | UTF-8 | 2,177 | 3.546875 | 4 | [] | no_license |
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# def stringToTreeNode(input):
# input = input.strip()
# input = input[1:-1]
# if not input:
# return None
# inputValues = [s.strip() for s in input.split(',')]
# ... | true |
383db62486877f189ac89758ac3181298adbef07 | Python | gabrieletiboni/Incremental-learning-on-CIFAR100 | /CODE/models/ablation_losses.py | UTF-8 | 8,895 | 2.84375 | 3 | [] | no_license | import torch
import torch.nn as nn
#
# L2 Loss
# L2Loss(outputs, targets)
# outputs -> shape BATCH_SIZE x NUM_CLASSES
# targets -> shape BATCH_SIZE x NUM_CLASSES
#
class L2Loss():
# Constructor
def __init__(self, reduction=None, alpha=1.0):
default_reduction = 'mean'
if red... | true |
1f5b75298918985bc6b430d5320a069589c924cf | Python | qszhuan/vicroad-knowledge-collector | /get_test.py | UTF-8 | 3,432 | 2.78125 | 3 | [] | no_license | import pickle
import requests
from bs4 import BeautifulSoup
from os import path
question_set = set()
final_list = []
pickle_dict = {'question_set': set(), 'question_list': []}
if path.exists('./question.pickle'):
with open('./question.pickle', 'rb') as pfile:
try:
pickle_dict = pickle.load(pfi... | true |
77a2a9cbdb5d1ddc9027a9d124d78c56b1952b16 | Python | Matthew94/reshef_battle_sys | /player_functions.py | UTF-8 | 2,386 | 3.765625 | 4 | [] | no_license | from random import shuffle
def shuffle_decks(players):
"""Shuffles the deck and returns it."""
shuffle(players[0].deck)
shuffle(players[1].deck)
return players
def print_and_get_player_move():
"""Prints all possibel moves and asks for the player's choice."""
print("""
#################### ... | true |
23f0557e74fadf15ace745da34440312035081fa | Python | Girgis98/Neural_Network_FrameWork_ | /Utils.py | UTF-8 | 4,260 | 3.265625 | 3 | [
"MIT"
] | permissive | import pickle
import os
import numpy as np
class Model_Utils():
def __init__(self, save_path='saved_models/'):
self.save_path = save_path
if not os.path.isdir(self.save_path):
os.mkdir(self.save_path)
def save(self, model, name):
save_file = open(self.save_path... | true |
9b1c9e893f309a1e0b4146a37db920aa1a42e583 | Python | xiaochen19v587/Chat_project | /client.py | UTF-8 | 1,364 | 2.71875 | 3 | [] | no_license | from socket import *
import os, sys
ADDR = ('176.234.8.10', 7890)
def client_main():
'''
客户端
:return:
'''
s = socket(AF_INET, SOCK_DGRAM)
do_request(s) # 处理信息
def do_request(s):
while 1:
name = input('输入姓名:')
msg = 'L ' + name
s.sendto(msg.encode(), ADDR)
... | true |
b0266acbe3a50148224ecfd3159f0fe2468e9e48 | Python | moussafirk/DIGITALLIGHTING | /Codings/ESP32/Zerynth/DFRobot FireBeetle ESP32/dali/dali/address.py | UTF-8 | 8,879 | 3.015625 | 3 | [] | no_license | """Device addressing
Addressing for control gear is described in IEC 62386-102 section 7.2.
Forward frames can be addressed to one of 64 short addresses, one of
16 group addresses, to all devices, or to all devices that do not have
a short address assigned.
Addressing for control devices is described in IEC 62386-103... | true |
e0597c49542ed229bb92996dd9eef07e81597778 | Python | RB3IT/BRDWebApp | /Archives/DBFix- Stock Update5.py | UTF-8 | 1,085 | 2.578125 | 3 | [] | no_license | import datetime
import pprint
import traceback
import sqlite3 as sql
db = sql.connect(r"C:\Users\J-Moriarty\Dropbox\BRD Services\BRDWebApp\db.sqlite3")
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
db.row_factory = dict_factory
t... | true |
c523389bfc6af7c7184b13bb75c11d7305bef098 | Python | dearman/HDF5DotNet | /examples/py/vlstringatt.py | UTF-8 | 1,340 | 2.515625 | 3 | [] | no_license | import clr
clr.AddReferenceToFile('HDF5DotNet.dll')
import HDF5DotNet
from HDF5DotNet import *
import System
from System import Array, IntPtr
status = H5.Open()
print '\nWelcome to HDF5 ', H5.Version.Major, '.', H5.Version.Minor, '.', H5.Version.Release, ' !\n'
fileId = H5F.open('h5ex_t_vlstringatt.h5', ... | true |
63f6854d25bab8d661f57c4069f29524a3f01ab3 | Python | gperrett/nba-predictor | /Players/get_urls.py | UTF-8 | 3,029 | 2.875 | 3 | [] | no_license | import time
start_time = time.time()
import pandas as pd
import ssl
import string
import requests
from bs4 import BeautifulSoup
import numpy as np
import os
ssl._create_default_https_context = ssl._create_unverified_context
from_year = 1991
# process duplicates used in later function
def rem_dup(l):
seen = se... | true |
6f330cd0b919d544f0e880d8d36a555ff6dc1ce5 | Python | kalindideshmukh/Alexa-vs-Google-Home-Sentiment-Analysis | /mapper.py.txt | UTF-8 | 1,823 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import division
import os
import re
import sys
import time
import json
import string
# Sentiments dictionary
sentimentDict = {'positive': {}, 'negative': {}}
def loadSentiments():
with open('/home/cloudera/Downloads/Source_files_final/sentiments/positive-wo... | true |
5d027a9c4ac31ae99f4d31dbe7429bf24380e529 | Python | XHAL9000/Machine-Learning-Algorithms | /fuzzyKmeans.py | UTF-8 | 1,546 | 3.109375 | 3 | [] | no_license | import numpy as np
def get_wij(X,centers,m):
n = X.shape[0] #number of data points
k = centers.shape[0] #number of clusters
W = np.zeros((n,k)) #membership matrix, wij represents the degree that xi belongs to cluster j
for i in range(n):
_sum = 0
for j in range(k):
W[i,j... | true |
8e46fbd96f6c695faa694f21a688c36d5e1081b3 | Python | cvsa91/MNIST | /run_cvsa.py | UTF-8 | 2,435 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 28 11:13:09 2019
@author: cvegas
"""
import numpy as np
layers=3
# =============================================================================
#
# to train and test the data
#
#
# ======================================================================... | true |
644ce47a154ceb0c772075b4177646919a733561 | Python | shennyjohn/python | /if-condition-1.py | UTF-8 | 955 | 4.625 | 5 | [] | no_license | # coding: utf-8
#!/usr/bin/python
# Here we will see the if condition, take the case that you are comparing your income and expenditure.
# the code compares the income and expenditure, if income is more, it will say “Good work, you saved this much amount “,
# If expenditure is more it should display “Be carefully, you... | true |
0504754bfaf0589e35f587984f567b9e7ae58913 | Python | Boberkraft/Data-Structures-and-Algorithms-in-Python | /chapter7/LinkedStack.py | UTF-8 | 825 | 3.8125 | 4 | [] | no_license | class Empty(Exception):
pass
class LinkedStack:
class _Note:
__slots__ = 'element', 'next'
def __init__(self, element, next):
self.element = element
self.next = next
def __init__(self):
self._head = None
self._size = 0
def __len__(self):
... | true |
eb01b0341a4962e9d64817e9b179b204fc6cdc99 | Python | huang1988519/SYM | /SYM/Models/models.py | UTF-8 | 1,166 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import re
import requests
def get_raw(url):
r = requests.get(url)
if r.status_code != 200:
return None
return r.text
def parse_models(regex, text):
result = []
lastModel = ""
model_regex = re.compile(r'.*\d,\d')
for item in regex.finda... | true |
09723e6589ad1555be941874a8e28644204c7b09 | Python | anhaidgroup/py_entitymatching | /py_entitymatching/dask/dask_xgboost_matcher.py | UTF-8 | 1,952 | 2.578125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | # from py_entitymatching.matcher.mlmatcher import MLMatcher
from py_entitymatching.dask.daskmlmatcher import DaskMLMatcher
from py_entitymatching.matcher.matcherutils import get_ts
# from sklearn.svm import SVC
try:
from xgboost.sklearn import XGBClassifier
except ImportError:
raise ImportError('Check if xgboo... | true |
2943859dbfb5e0384141a73da8c137a8d9650465 | Python | blastlab/Machine-Learning-Begineer-s-Project | /HaarClassifier.py | UTF-8 | 1,090 | 2.984375 | 3 | [] | no_license | import cv2
class HaarClassifier:
def __init__(self):
self.colaCascade = cv2.CascadeClassifier('cascades/cola.xml')
self.spriteCascade = cv2.CascadeClassifier('cascades/sprite.xml')
def detectCola(self, grayFrame, outputFrame):
colaScaleFactor = 1.2
colaMinNeighs = 5
# w... | true |
f4848bbe39a9061a91faa214ef7b9e4b30c6bf6c | Python | TarikEskiyurt/Python-Projects | /Caesar Encryption.py | UTF-8 | 563 | 3.46875 | 3 | [] | no_license | metin=input("Şifrelemek istediğiniz metni giriniz") #kullanıcının şifrelemek istediği metni soruyoruz
artmik=int(input("Artma miktarı ne olsun")) #kullanıcıdan her bir rakamı kaç arttırarak metni şifrelemek istediğini soruyoruz
sifre=""
for k in metin: #bütün rakamlara "artmik" teki değeri ekliyoruz ve şifrel... | true |
133d894f42e74532079e794dd3cca3d4e3425396 | Python | kjnevin/python | /10.File.input.output/Redo's.py | UTF-8 | 568 | 3.09375 | 3 | [] | no_license | # cities = ["Adelaide", "Alice Springs","MElbourne","Sydney"]
#
# with open("cities.txt",'w') as city_file:
# for city in cities:
# print(city, file=city_file, flush = True)
#
# cities = []
# with open("cities.txt",'r') as city_file:
# for city in city_file:
# cities.append(city)
# ... | true |
0bfb7bb996febfbdad70aeeac9f466eb7fffaa1b | Python | sesh/ghostly | /ghostly.py | UTF-8 | 14,139 | 2.546875 | 3 | [
"ISC"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Basic acceptance testing with just 7 commands
(& 5 asserts)
Browser Commands: load, click, fill, submit, wait, switch_to, navigate
Asserts: assert_text, assert_element, assert_value, assert_title, assert_url
Handy helpers:
- XPath for button with text `'//button[te... | true |
f21a617dff80e4e119c15973f6b6c59e9f743a9f | Python | Hamudss/PTL | /ptl.py | UTF-8 | 7,171 | 2.703125 | 3 | [] | no_license | import re
import sys
import requests
import json
import barcode
from docassemble.base.util import get_config, DAFile
from datetime import datetime, timedelta
# Busca Key do Cliente
url_base = 'https://agnes-api.preambulo.com.br/api/v1/platform/'
def get_cliente_key(cliente):
config = get_config('clientes', None)... | true |
9ba6be41c6e0b3b2e9d93f4639d64dcda84ae5e5 | Python | ddaugaard/Learn-Python-The-Hard-Way | /ex5.py | UTF-8 | 789 | 3.6875 | 4 | [] | no_license | my_name = 'Daniel G. Daugaard'
my_age = 27 # close to 28 :(
my_height = 175 # cm.
my_weight = 67 # kilos
my_eyes = 'Blue'
my_teeth = 'White'
my_hair = 'Light Brown'
print "Let's talk about %s." % my_name
print "He's %d cm tall." % my_height
print "He's %d kilos heavy." % my_weight
print "Actually that's not too heavy.... | true |
0cba1976ac01d0033bace87179e92d0862a2ef24 | Python | adaminfinitum/ColorHelper | /lib/coloraide/spaces/din99o.py | UTF-8 | 2,738 | 2.921875 | 3 | [
"MIT"
] | permissive | """
Din99o class.
https://de.wikipedia.org/wiki/DIN99-Farbraum
"""
from ..spaces import RE_DEFAULT_MATCH
from .xyz import XYZ
from .lab.base import LabBase, lab_to_xyz, xyz_to_lab
import re
import math
KE = 1
KCH = 1
# --- DIN99o ---
# C1 was a bit off due to rounding and gave us less than 100
# lightness when trans... | true |
dc969caced9599510aef21a9cdb0181366a1b7f4 | Python | jack0989599022/hw3 | /FFT.py | UTF-8 | 904 | 2.828125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import serial
import time
import math
#(the following codes might have some changes before lab, please view codes on github as main code, thx)
t = np.arange(0,10,0.1)
x1 = np.arange(0,10,0.1)
y1 = np.arange(0,10,0.1)
z1 = np.arange(0,10,0.1)
tilt = np.arange(0,1... | true |
304799bc060f4c9066b4cf6fa11cae4786c83b1b | Python | WenjieLuo2333/ModuleDesign | /storage.py | UTF-8 | 1,312 | 3.359375 | 3 | [] | no_license | # Copyright 2018 Gang Wei wg0502@bu.edu
# storage module
class storage():
def __init__(self,bo,bp,pul):
self.bo = bo
self.bp = bp
self.pul = pul
def filter(self):
return 0
#for useful data
Input = input()
# connection to the database
# storage the data into t... | true |
1037e4e7ebe5e1d6cf3d3ea79b288f5f119e0586 | Python | Helvethor/matrix-mouse-draw | /client.py | UTF-8 | 2,429 | 3.125 | 3 | [] | no_license | #!/usr/bin/python3
import socket, argparse, time
from Xlib import display
from pynput import mouse
class MouseStreamer:
def __init__(self, server_address):
self.color = [127, 127, 127]
self.server_address = server_address
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... | true |
2ccca516f5286feb9df239da28aa631ecece0c3d | Python | ModoUnreal/spritesheet | /dice-roller.py | UTF-8 | 1,014 | 2.96875 | 3 | [] | no_license | import pygame as pg
pg.init()
def strip_from_sheet(sheet, start, size, columns, rows=1):
frames = []
for j in range(rows):
for i in range(columns):
location = (start[0]+size[0]*i, start[1]+size[1]*j)
frames.append(sheet.subsurface(pg.Rect(location, size)))
return frames
scr... | true |
f18c6d1738f069e75b462962ea540599206c30e4 | Python | jdarangop/holbertonschool-machine_learning | /unsupervised_learning/0x02-hmm/6-baum_welch.py | UTF-8 | 6,252 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python3
""" The Baum-Welch Algorithm """
import numpy as np
def forward(Observation, Emission, Transition, Initial):
""" performs the forward algorithm for a hidden markov model.
Args:
Observation: (numpy.ndarray) contains the index of the observation.
Emission: (num... | true |
34fed8a3dbe9f2140f8c093b4e9c45b12f95437b | Python | d3athwarrior/LearningPython | /Functions.py | UTF-8 | 4,605 | 4.84375 | 5 | [] | no_license | def add(num1: float = 1, num2: float = 0):
# A function's doc string will always be inside it rather than on top of it
'''
This function will add the two numbers passed to it
'''
return num1 + num2
def subtract(num1: float = 1, num2: float = 0):
return num1 - num2
def multiply(num1: float ... | true |
6abc49636d9f3a008d453823b0aaba0f4fcee9aa | Python | definitelyprobably/alnitak | /alnitak/printrecord.py | UTF-8 | 12,339 | 2.703125 | 3 | [
"MIT"
] | permissive |
import re
import argparse
import pathlib
from alnitak import prog as Prog
from alnitak import exceptions as Except
from alnitak import certop
from alnitak import logging
def populate_targets(prog):
"""Populate the target list with the print flag arguments.
When the '--print' flag is given without arguments... | true |
884876e53a6cfd793885157d53342046d470b37a | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_142/596.py | UTF-8 | 1,561 | 3.0625 | 3 | [] | no_license | import string
def get_rows(lines):
if lines == 1:
return map(str, raw_input().split())
return [raw_input() for _ in range(lines)] #[map(str, raw_input().split()) for _ in range(lines)]
def get_diff(strings):
length = len(get_count(strings[0]))
total = [0] * length
for s in strings:
... | true |
d84a39e74de02d61fbce9330cfceeb5e6b05eeb7 | Python | richiesui/tensorflow2-yolov5 | /preprocess/old/augment_data.py | UTF-8 | 8,656 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@auther : zzhu
@time : 21/7/21 7:14 PM
@fileName : augment_data.py
'''
import cv2
import math
import random
import numpy as np
from .image_utils import resize_image
random.seed(1919)
from callbacks.plot_utils import draw_box, get_class
is_plot =False
class_nam... | true |
57b7d7a1e5ddf841b863ff41477727925ff408ba | Python | RamyaGuru/BoundaryScattering | /scattering_scripts/AMMTransport.py | UTF-8 | 11,325 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 28 17:00:55 2020
@author: ramyagurunathan
AMM Transport: Thermal Resistance due to Acoustic Mismatch at a boundary
because of the solid rotation and elastic anisotropy of the material
"""
import sys
sys.path.append('/Users/ramyagurunathan/Document... | true |
3be77097388f3d3664b07c28987c40a041de5d80 | Python | sameer999/Twitter-Data-Analysis | /phase2/visualization/query4.py | UTF-8 | 480 | 3.171875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
label=['week days', 'weekend']
tweet_count=[148657, 57078]
colors = ['#ff9999', '#66b3ff']
fig1, ax1 = plt.subplots()
ax1.pie(tweet_count, colors=colors, labels=label, autopct='%1.1f%%', startangle=90)
# draw circle
centre_circle = plt.Circle((0, 0), 0.70, fc='white'... | true |
1c953122e4f3f8f16f31d9d10f386e7292fccef0 | Python | arcadeindy/truemoney-wallet-api | /examples/profileDetail.py | UTF-8 | 800 | 2.734375 | 3 | [
"MIT"
] | permissive | from WalletAPI import Wallet
print()
wallet = Wallet("email","password",showLoginMessage=True)
profile = wallet.fetchProfile()
fullname = "%s %s" % (profile["data"]["title"],profile["data"]["fullname"])
email = profile["data"]["email"]
thaiID = profile["data"]["thaiId"]
mobileNumber = profile["data"]["mo... | true |
6de45f0a9aad1e99d493c5ef36351de269ca81aa | Python | Zidious/BTT-TouchBarScript | /Moonlight.py | UTF-8 | 488 | 3.015625 | 3 | [] | no_license | from pycoingecko import CoinGeckoAPI
# INSTANCE OF CoinGeckoAPI()
coinGecko = CoinGeckoAPI()
# LX FUNCTION - PRICE, 24HVOL
def getLXPrice():
getLX = coinGecko.get_coins_markets(ids='lux',
vs_currency='usd')
currentPrice = "{:,}".format(round(getLX[0]['current_price'], ... | true |
1cdf0fddc8dd1576d0de626115823f38c108ebd9 | Python | Noraabdull/DS-ML-Sep-Nov-2021 | /week2_data-structures/spider-example.py | UTF-8 | 2,527 | 3.453125 | 3 | [] | no_license | # Import the scrapy library
import scrapy
# Import a special class called CrawlerProcess from the folder scrapy.crawler
from scrapy.crawler import CrawlerProcess
# Import openpyxl for reading and writing Excel documents
from openpyxl import Workbook
# Instantiate a new workbook
wb = Workbook()
# Choose the active wor... | true |
f159aef279351e98f0046d040979859815a10f89 | Python | lusty/GNGT | /db/gardenDBtoJSON.py | UTF-8 | 1,591 | 2.578125 | 3 | [] | no_license | import sqlite3
from datetime import datetime
import json, urllib
GEOCODE_BASE_URL = 'http://maps.googleapis.com/maps/api/geocode/json'
def geocode(address,sensor, **geo_args):
geo_args.update({
'address': address,
'sensor': sensor
})
url = GEOCODE_BASE_URL + '?' + urllib.urlencode(geo_a... | true |
beec41cc2885d8f56b19ea2466c9ae769c631b64 | Python | lim-so-hyun/sparta_argorithm | /week_1/homework/01_find_prime_list_under_number_ing.py | UTF-8 | 571 | 3.390625 | 3 | [] | no_license | input = 20
def find_prime_list_under_number(number):
under_number_list = list(range(number))[2:]
multiple_list = []
for first_num in under_number_list:
for second_num in under_number_list:
multiple_num = first_num * second_num
multiple_list.append(multiple_num)
for ... | true |
fd23fb428ac2a630cbfc1018babe4b34f1cefc4b | Python | suramakr/play-zone | /simpleGuess.py | UTF-8 | 668 | 4.03125 | 4 | [] | no_license | import random
orig = random.randint(1, 20)
# print("Orig number computer has is " + str(orig))
guessed = False
tries = 0
while(not guessed and tries <= 7):
print("Guess what number I have")
print("You have " + str(7-tries) + " remaining...")
try:
guess = int(input())
except NameError:
p... | true |
75449ab77c0b3c2f38ec67672edf9f084f5484c7 | Python | markcapece/itp-u6-c2-oop-hangman-game | /test_guess_attempt.py | UTF-8 | 577 | 2.71875 | 3 | [
"MIT"
] | permissive | import pytest
from hangman.game import GuessAttempt
from hangman.exceptions import InvalidGuessAttempt
def test_guess_attempt_interface_hit():
attempt = GuessAttempt('x', hit=True)
assert attempt.is_hit() is True
assert attempt.is_miss() is False
def test_guess_attempt_interface_miss():
attempt = Gu... | true |
985ed6131d5dc5cf0fbda22e3d1ec4233b3e0c68 | Python | natoftheboonies/advent-of-code-2015 | /day7.py | UTF-8 | 4,021 | 2.984375 | 3 | [] | no_license | from collections import defaultdict
sample = '''123 -> x
456 -> y
x AND y -> d
x OR y -> e
x LSHIFT 2 -> f
y RSHIFT 2 -> g
NOT x -> h
NOT y -> i
'''.splitlines()
bitmax = 65535+1
# https://stackoverflow.com/questions/11557241/python-sorting-a-dependency-list
def topological_sort(source):
"""perform topo sort on el... | true |
a03a1513be1619d58c94c06eec5e296856cdaaea | Python | srajsonu/InterviewBit-Solution-Python | /Heaps/Heaps II/refuelling_stops.py | UTF-8 | 951 | 2.96875 | 3 | [] | no_license | from heapq import heappop, heappush
class Solution:
def Solve(self,A,B,C,D):
max_heap=[]
C.append(A)
D.append(float('inf'))
ans=prev=0
for dist, cap in zip(C,D):
B-= dist-prev
while max_heap and B < 0:
B += -heappop(max_heap)
... | true |
18353fc82cee2a7efa017eec030240d81c86d009 | Python | JarHMJ/leetcode | /python_solutions/45. 跳跃游戏 II.py | UTF-8 | 530 | 2.875 | 3 | [] | no_license | from typing import List
class Solution:
def jump(self, nums: List[int]) -> int:
cur_max_index = 0
pre_max_index = 0
count = 0
for i, v in enumerate(nums[:-1]):
if cur_max_index == i:
if pre_max_index > i + v:
cur_max_index = pre_max_i... | true |
20b9f3b942c51f37cbee98ac35748e741230eed2 | Python | pninitd/devopscourse | /lesson4_Jan24/lesson4_ex.py | UTF-8 | 2,043 | 2.78125 | 3 | [] | no_license | from selenium import webdriver
# 1a
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome(executable_path="/Users/pninitds/PycharmProjects/chromedriver")
driver.get("http://www.walla.co.il")
# 1b
driver = webdriver.Firefox(executable_p... | true |
b88a13afb92334d531a909876b2a4398fb72f6b9 | Python | dremok/python-sentiment-analysis | /structure.py | UTF-8 | 2,026 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python
# Filename: structure.py
# -*- coding: utf-8 -*-
from __future__ import division
import re
from token import *
neg_str = r"""
(?:
^(?:never|no|nothing|nowhere|noone|none|not|
havent|hasnt|hadnt|cant|couldnt|shouldnt|
wont|wouldnt|dont|doesnt|didnt|isnt|arent|aint
)$
... | true |
9f282a3b1f967b29fec69bd043517934dcf85f5a | Python | eddddddy/AoC2020 | /day24/day24.py | UTF-8 | 2,995 | 3.53125 | 4 | [] | no_license | def tokenize(s):
i = 0
tokens = []
while i < len(s):
if s[i] == 'e':
tokens.append('e')
i += 1
elif s[i] == 'w':
tokens.append('w')
i += 1
elif s[i] == 'n':
if s[i + 1] == 'e':
tokens.append('ne')
... | true |
40ad3d12c97cb759ccb90268e33eb5568ee756f4 | Python | prakHr/DataRepo | /other1.py | UTF-8 | 1,368 | 2.9375 | 3 | [] | no_license | def NumberInt(n):return int(n)
def NumberLong(n):return int(n)
import json
#barcodes comes from barcodeInventory
setToBeSearched=set()
namesToBeSearched=set()
#counter=0
with open('f2.json' ,'rt', encoding='utf-8') as f:
data=json.load(f)
# counter+=1
for key in data:
setToBeSearched.add(key)
#print(c... | true |
ac53eba5331727a351addba3cb018604bb8a51b4 | Python | wuxiaohan123/OpenCV | /模板匹配demo.py | GB18030 | 1,360 | 2.90625 | 3 | [] | no_license | # -*- coding: cp936 -*-
import cv2.cv as cv
#load image
filename = "../Video/cat.jpg"
image = cv.LoadImage(filename)
#create one window
win_name = "test"
cv.NamedWindow(win_name)
win2_name = "test2"
cv.NamedWindow(win2_name)
#take off one template ģ
rect = (170,80,50,50) #ǰλΪϽ꣬λΪͼС
cv.Se... | true |
7dcdd0f5ded82e8f3ba0d492a1ca3650c8911e1c | Python | Vyizis/aeronaut | /scripts/bitcoin.py | UTF-8 | 257 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
import requests
import json
response = requests.get("https://api.coindesk.com/v1/bpi/currentprice.json")
data = json.loads(response.content)
price = data["bpi"]["GBP"]["rate"]
print(f"The Price of Bitcoin is £{price} damn high.")
| true |
7665f33d5dd24600c38c39944375336851358ca9 | Python | AFKD98/Understanding-Mobile-Video-Streaming-Performance-Youtube-in-Low-End-Devices-In-a-Reasonably-Large-M | /DF/memory/df-mem-diffvid.py | UTF-8 | 849 | 2.84375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
# data to plot
n_groups = 6
means_frank = (3740,3705,1928,1299,2046,2537)
means_guido = (940,1146,864,1089,993,1130)
# create plot
fig, ax = plt.subplots()
index = np.arange(n_groups)
bar_width = 0.35
opacity = 0.8
rects1 = plt.bar(index, means_f... | true |
257ea67a887508de48a0ff27b7f372919681a550 | Python | anjalirai13/Python | /repeatedString.py | UTF-8 | 199 | 3.390625 | 3 | [] | no_license | # Complete the repeatedString function below.
def repeatedString(s, n):
return s.count('a')*n//len(s)+ s[:n % len(s)].count('a')
string = 'a'
no = 1000000000000
print(repeatedString(string, no)) | true |
e05f1dff1e8a72f4ea6406dbb73e74c3c5bcfaaa | Python | Nidhi-kumari/nlu_Assignment2 | /char_model/generate_sentence.py | UTF-8 | 1,575 | 2.71875 | 3 | [] | no_license | from keras.models import model_from_json
import numpy as np
file = open('modelc1.json', 'r')
jmodel = file.read()
file.close()
model = model_from_json(jmodel)
model.load_weights("modelc.h5")
with open("input.txt", encoding='utf-8') as f:
text = f.read().lower()
maxlen = 8
chars = sorted(... | true |
bdb9300fa1765876851bf48d9746b2ea6f559851 | Python | jdanray/leetcode | /minimumSum.py | UTF-8 | 310 | 3.203125 | 3 | [] | no_license | # https://leetcode.com/problems/minimum-sum-of-four-digit-number-after-splitting-digits/
class Solution(object):
def minimumSum(self, num):
digits = []
while num > 0:
digits.append(num % 10)
num //= 10
digits = sorted(digits)
return (10 * digits[0] + digits[2]) + (10 * digits[1] + digits[3])
| true |
8d6dcde4e468a0227dd4b4318a1819c08a841a21 | Python | ravikumarvj/DS-and-algorithms | /Trees/Trie/spell_checker.py | UTF-8 | 5,333 | 3.84375 | 4 | [] | no_license | #### COPIED ###### VERIFIED
from trie import Trie
import time
class SpellChecker: # Copied
# chars = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
# 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')
# Better to define as string and convert to tuple, if needed
cha... | true |
e999836918d9e6f85b3b1af7f986209be4b31e65 | Python | open-mmlab/mmocr | /mmocr/models/common/losses/l1_loss.py | UTF-8 | 2,405 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Union
import torch
import torch.nn as nn
from mmocr import digit_version
from mmocr.registry import MODELS
@MODELS.register_module()
class SmoothL1Loss(nn.SmoothL1Loss):
"""Smooth L1 loss."""
@MODELS.register_module()
class MaskedSmo... | true |
e6e675e27e35a6b649db0b8257b4a079fb4e8608 | Python | Gackle/zako-for-bit-war | /webapp/controllers/zako/zako_battle.py | UTF-8 | 2,272 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | # coding: utf-8
from collections import namedtuple
from .zako_strategy import StrategyCompiler
peace_rules = [
[(1, 1), (5, 0)],
[(0, 5), (3, 3)]
]
def battle(battle_round, attacker, defender):
''' 入参对战回合数以及对抗双方的语法树, 得到各自的比分,以及对抗经过
'''
score_of_attacker = 0
score_of_defender = 0
record_fo... | true |
6e5c0ded469444576e09c0feca25c1163b5e9a23 | Python | 0xd2e/python_playground | /Daftcode Python Level UP 2018 solutions/zadanie2/task2_utils.py | UTF-8 | 1,155 | 3.390625 | 3 | [
"MIT"
] | permissive | import numpy as np
from task2 import primesfrom2to, approximate_prime
def find_min_i(range_lim, const):
'''
Input:
range_lim
-- integer, upper bound of a range
-- must be greater than or equal to 6
const
-- float number, constant
-- must be greater than or equal to 0.... | true |
f48441afee78f5843943e1fccee759db211e220a | Python | chiminwon/Python365 | /demo.py | UTF-8 | 1,051 | 3.890625 | 4 | [] | no_license | # 中国 = 'China'
# print(中国)
# print("This" " is" " Shanghai")
# total = input("input:")
# print(int(total) / 30)
str = 'Testing'
# print(str) # 输出字符串
# print(str[0:-1]) # 输出第一个到倒数第二个的所有字符
# print(str[0]) # 输出字符串第一个字符
# print(str[2:5]) # 输出从第三个开始到第五个的字符
# print(str[2:]) # 输出从第三个开始后的所有字符
# print(str * 2) # 输出字符串两次... | true |
cc2a6c6355906bb353e397883d4030f6f5827b28 | Python | christabor/MoAL | /MOAL/computer_organization/bcd.py | UTF-8 | 2,687 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from MOAL.helpers.display import Section
from MOAL.helpers.display import divider
from MOAL.helpers.display import print_h4
from MOAL.... | true |
69c9d0f3e3942a24d8abbf20e0238db9fbe49cd3 | Python | gagandeeo/python_hacks | /python_hacks/hashg.py | UTF-8 | 6,190 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python
import hashlib
from urllib.request import urlopen
import hashlib
from termcolor import colored
import crypt
######### HASHING VALUES ############
def value_md5(hashvalue):
hashobj1 = hashlib.md5()
hashobj1.update(hashvalue.encode())
return(hashobj1.hexdigest())
def value_sha1(hashvalue):
hashobj2... | true |
45cbba0c739de6d7aaa9c8d859d5e77c09ecb1ac | Python | XuTan/PAT | /Advanced/1009.Product of Polynomials.py | UTF-8 | 1,615 | 3.6875 | 4 | [] | no_license | """
1009. Product of Polynomials (25)
时间限制
400 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
This time, you are supposed to find A*B where A and B are two polynomials.
Input Specification:
Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polyno... | true |
aac127eda83b859b8d197656941348d31ab117c2 | Python | kristjanv001/hangman | /main.py | UTF-8 | 1,485 | 3.53125 | 4 | [] | no_license | import random
from replit import clear
from ascii import stages
from ascii import logo
from words import word_list
user_letters = {}
def get_random_word(words):
random_num = random.randint(0, len(words)-1)
random_word = words[random_num].lower()
return random_word
def display_blanks(word):
blanks = []
for char ... | true |
7f8fc1ebe03713bbf94afcbe9288aab15eb80985 | Python | zgthompson/fa14 | /theory-of-comp/game-of-life/game_of_life.py | UTF-8 | 2,294 | 3.703125 | 4 | [] | no_license |
class GameOfLife(object):
BOARD_SIZE = 3
CELL_DEAD = " "
CELL_LIVE = "o"
def __init__(self):
self.board = [[ " ", "o", " "], [" ", "o", " "], [" ", "o", " "]]
def prettyPrint(self):
print "-" * (GameOfLife.BOARD_SIZE + 2)
for row in self.board:
curRow = "|"
... | true |
d098e1ac1f83907941f3dd37f8518dd0b533dc4d | Python | KevinTou/Sorting | /src/iterative_sorting/iterative_sorting.py | UTF-8 | 2,646 | 4.0625 | 4 | [] | no_license | # TO-DO: Complete the selection_sort() function below
def selection_sort(arr):
# loop through n-1 elements
for i in range(0, len(arr) - 1):
cur_index = i
smallest_index = cur_index
# TO-DO: find next smallest element
# (hint, can do in 3 loc)
for j in range(cur_index, len... | true |
47443f1fc2277cc7d5c62c724ecd08be80816908 | Python | deveshpatel0101/python-data-structures-algorithms | /algorithms/sorting/quick_sort/sort.py | UTF-8 | 672 | 3.609375 | 4 | [
"MIT"
] | permissive | class QuickSort:
def sort(self, arr):
self.sortUtil(arr, 0, len(arr)-1)
return arr
def sortUtil(self, arr, low, high):
if low >= high:
return
idx = self.findPivot(arr, 0, high)
self.sortUtil(arr, low, idx-1)
self.sortUtil(arr, idx+1, high)
def fi... | true |
04642433bedb0f849bb9be7c5d2cd1d3af79a3d5 | Python | joyonto51/Programming_Practice | /Python/Old/Python Basic/Problem/22-08-17/Problem-1.1.1.py | UTF-8 | 179 | 3.984375 | 4 | [] | no_license | inp=input("Plz enter an year:")
n=int(inp)
if (n%4==0 and (n%400==0 or n%100!=0)):
print(str(n)+" is a Leap year")
else:
print(str(n)+" is not a Leap year")
| true |
105fa3dd2ebf2d6ddb7421b0d0d8297506ce25dc | Python | dnsimple/dnsimple-python | /dnsimple/service/tlds.py | UTF-8 | 1,663 | 2.90625 | 3 | [
"MIT"
] | permissive | from dnsimple.response import Response
from dnsimple.struct import Tld, TldExtendedAttribute
class Tlds(object):
"""Handles communication with the Tld related methods of the DNSimple API."""
def __init__(self, client):
self.client = client
def list_tlds(self, sort=None):
"""
List... | true |
79a7a9a63e0ed6bef9605fdfc328a92f63dc74e9 | Python | jsw7524/pykt0803 | /demo62.py | UTF-8 | 1,278 | 2.90625 | 3 | [] | no_license | import pandas as pd
from sklearn.model_selection import KFold, cross_val_score
from sklearn.preprocessing import LabelEncoder
from keras.utils import np_utils
from keras import Sequential
from keras.layers import Dense
from tensorflow.python.keras.wrappers.scikit_learn import KerasClassifier
dataFrame1 = pd.read_csv('... | true |
babb7600aa2c3c63e586eee8adf0f5687b1761fe | Python | nobodyatall648/picoGym-CTF | /web exploitation/Who are you/script.py | UTF-8 | 1,339 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python3
import requests
from bs4 import BeautifulSoup
chalURL = 'http://mercury.picoctf.net:46199/'
#refer to list of HTTP headers
headers = {
#Only people who use the official PicoBrowser are allowed on this site!
#set the user-agent to PicoBrowser to tell it that it's from official PicoBrowser
'User-... | true |
739d432369e8a923b7cda35c6da314cfd6896af9 | Python | saikumar208/sqlFuzz | /app/sqlStubGenerator.py | UTF-8 | 1,902 | 2.703125 | 3 | [] | no_license | ''' Generates stub of SQL queries '''
from lib.grammar.parser import Parser, Token
from lib.grammar.grammarElements import LexElementMaster, Expression, unpack, AtomicLiteral
def initializeGrammarElements():
''' Intializes Tokens and other elements '''
parserObj = Parser()
parserObj.parse()
def getExp( ... | true |
26fdf44f6747d73e283636c5eefabb6e5cd7b8b4 | Python | researchstudio-sat/wonpreprocessing | /python-processing/tools/cosine_link_prediction.py | UTF-8 | 4,607 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive |
__author__ = 'bivanschitz'
from math import log10
from scipy.spatial.distance import cosine
from scipy.sparse import csr_matrix
from tools.tensor_utils import SparseTensor
#FUNCTIONS
#get the most commen elements using the cosinus distance (alternative distance measure available)
def most_common_elements(needinde... | true |
57fc06c04836c5d34aa4f9450dd97da934d80e14 | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/225/users/1165/codes/1712_2506.py | UTF-8 | 312 | 3.375 | 3 | [] | no_license | tam = float(input("Quant. de peixes: "))
P_cres = float(input("Percentual de cres: "))
q = int(input("Quant. para vendas: "))
anos = 0
while( tam > 0 and tam < 12000):
y = tam * P_cres / 100
tam = tam + y - q
anos = anos + 1
if(tam >= 12000):
print("LIMITE")
elif(tam <= 0):
print("EXTINCAO")
print(anos) | true |
09438ecc20f873d090d7bcce046483483c93503f | Python | procool/mygw | /daemons/websocketsclass/core/handlers/messages/misc.py | UTF-8 | 1,691 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive | import logging
import brukva
import json
class MessagesCommon(object):
clients = []
@classmethod
def show_message(cls, data):
logging.debug("NEW MESSAGE: %s" % data.body)
mbody = str(data.body)
try: data_ = json.loads( mbody )
except: return None
if isinstance... | true |
1dca5432c10c76faf304a73216f796d8a82e72a2 | Python | LuJunru/SentimentAnalysisUIR | /LSTM/lstm_sa_test.py | UTF-8 | 3,399 | 3 | 3 | [] | no_license | import yaml
import os
import jieba
import numpy as np
from gensim.models.word2vec import Word2Vec
from gensim.corpora.dictionary import Dictionary
from keras.preprocessing import sequence
from keras.models import model_from_yaml
import sys
sys.setrecursionlimit(1000000)
# define parameters
np.random.seed... | true |
b63de9d01764af9011ca2fd323907cab3e7a24d5 | Python | arm-star/Streamlit_example | /call_streamlit.py | UTF-8 | 8,048 | 2.953125 | 3 | [] | no_license | from definitions import *
from utils.visualizer_stramlit import *
from utils.preprocessing import *
from utils.model_engine import *
st.markdown("## Streamlit example using LightGBM XRP!")
#### Importing data
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
if uploaded_file is not None:
df_raw = ... | true |
118e95b759e26743658357fb8932dbaa14912084 | Python | ShyamV11/My-Learnings | /List.py | UTF-8 | 476 | 4.46875 | 4 | [] | no_license | List = []
print("Blank List")
print(List)
List.append(1)
List.append(2)
List.append(10)
print("\nList after adding three elements: ")
print(List)
for i in range(11, 19):
List.append(i)
print("\nList after adding elements through iterator: ")
print(List)
List.append((21, 22))
print("\nList a... | true |
7f3353c4d4ed552efde16dc2d1d03b50c6fce09f | Python | Maddallena/python | /day_1.py | UTF-8 | 851 | 4.3125 | 4 | [] | no_license | #DZIEŃ PIERWSZY____________________________________________________________________________________________________-
# print("Hello world!")
# print("Day 1 - Python Print Function\nThe function is declared like this:\nprint('What to print')")
# print("Hello " + "Magdalena")
# print("Day 1 - String Manipulation")
... | true |
f52feab15ce08bf6ae7fc90800ea91980ba8d459 | Python | ekmixon/threat_hunting_library | /rl_threat_hunting/child_evaluation.py | UTF-8 | 2,349 | 2.5625 | 3 | [
"MIT"
] | permissive |
from rl_threat_hunting.filter.intersting_children import Child
from rl_threat_hunting.filter.intersting_children import InterestingChildren
def a1000_select_interesting_extracted_files(a1000_extracted_files_response, interesting_child_limit=10, include_all_malware=False):
children = a1000_extracted_files_respons... | true |
76d3e88ca1895418412656bada95e6fc9f1c7a59 | Python | skyyi1126/leetcode | /532.k-diff-pairs-in-an-array.py | UTF-8 | 552 | 3.015625 | 3 | [] | no_license | #
# @lc app=leetcode id=532 lang=python3
#
# [532] K-diff Pairs in an Array
#
# @lc code=start
import collections
class Solution:
def findPairs(self, nums: List[int], k: int) -> int:
res = 0
if k == 0:
for _, value in collections.Counter(nums).items():
if value >= 2:
... | true |
ea55f0fe1ef2267a0453100615ff73f24b264f64 | Python | Ryan-Amaral/wikisim | /wikify/wsd_util.py | UTF-8 | 7,778 | 2.625 | 3 | [] | no_license | """A few general modules for disambiguation
"""
from __future__ import division
import sys, os
from itertools import chain
from itertools import product
from itertools import combinations
import unicodedata
dirname = os.path.dirname(__file__)
sys.path.insert(0,os.path.join(dirname, '..'))
from wikisim.config import *... | true |
a4fa5de2d66a34b9830acbdac10caf5dcd8c934c | Python | jedben2/Python-Multiplayer-Game | /network/host_mods/player.py | UTF-8 | 1,135 | 3.078125 | 3 | [] | no_license | from ursina import *
class Player(Entity):
def __init__(self, position, conn, addr):
super().__init__()
self.hp = 100
self.dmg = 0
self.direction = "right"
self.position = position
self.dx = self.dy = 0
self.dt = 1 / 60
self.g = 9.8
self.on_... | true |
c044a5576712ab7b888f067e5b5155f647861ba5 | Python | bakerwm/goldclip | /goldclip/goldcliplib/trim.py | UTF-8 | 26,895 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
For CILP analysis, there are three steps of trimming
1. trim 3' adapter
2. cut inline-barcode
3. collapse (optional, if randomer exists)
There are 3 types of CLIP library structures:
1. NSR:
a. trim 3' adapter
b. cut 7-nt at both 5' and 3' ends
c. collapse (optional)
2. eCLIP: (... | true |
96a3160e42da10442a0091b4c28333fc0dd5b69f | Python | YunyLee/BaekJoon | /7. 문자열/1152_단어의개수.py | UTF-8 | 185 | 2.875 | 3 | [] | no_license | import sys
sys.stdin = open('input_1152.txt', 'r')
TC = 3
for test_case in range(1, TC+1):
SENTENCE = input().split()
print(len(SENTENCE))
# print(SENTENCE.count(' ')+1)
| true |
d893883d68b5bdd92b9643474cf5a669f0407248 | Python | PyEldar/DoorAccess | /InputPINClass.py | UTF-8 | 658 | 3.046875 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
class InputPIN:
"""Input on specified PIN"""
def __init__(self, PIN):
self.PIN = PIN
self.STATUS = "INIT"
GPIO.setmode(GPIO.BOARD)
GPIO.setup(PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def __str__(self):
return self.PIN
def l... | true |
341a9b4bcc1578492eba0a5e827e25f6d10329c5 | Python | predictscan3/scan3 | /read_data.py | UTF-8 | 2,294 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
pd.set_option('display.expand_frame_repr', False) # widen num cols displayed
import os
import pickle
def dump_pickle(dictionary):
with open('trimester.pickle', 'wb') as handle:
pickle.dump(dictionary, handle, protocol=pickle.HIGHEST_PROTOCOL)
go_pickle = False
centr... | true |
828bca7e46f753ff63f2b64ba357444fe528a844 | Python | Ginga1892/bert-x | /trainer.py | UTF-8 | 3,142 | 2.671875 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
from pretrain import BertPreTrain
from finetune import BertClassification
class Trainer(object):
def __init__(self, bert_model):
self.bert_model = bert_model
def pre_train(self, iterator, do_train, num_train_epochs=3, learning_rate=1e-5):
print("***** Pre-tr... | true |
bc36116c5793d08001a59abc296326ab8c065f54 | Python | Shrijeet16/image_basicoperations | /blue_line_detection.py | UTF-8 | 1,222 | 2.6875 | 3 | [] | no_license |
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while(1):
ret , img = cap.read()
img1 = cv2.medianBlur(img , 7)
#minimum area required is 21200
#at 33 cm height of camera
hsv = cv2.cvtColor(img1 , cv2.COLOR_BGR2HSV)
lower_blue = np.array([100,150,0] ,... | true |
70078c327ed96508c3f22e65b1e351c67e942dd0 | Python | minipele06/custom-functions | /my_functions.py | UTF-8 | 1,139 | 4.25 | 4 | [] | no_license | # custom-functions/my_functions.py
# TODO: define temperature conversion function here
def celsius_to_fahrenheit(i):
return (i * 9/5) + 32
# TODO: define gradebook function here
def numeric_to_letter_grade(i):
if i >= 93:
return "A"
elif i >= 90:
return "A-"
elif i >= 87.5:
r... | true |
b8fbb9dad7cda901088ec114cf1774ccbd1db8c0 | Python | ErickJonesA7X/py_lessons2 | /exercicios_curso_em_video/ex082.py | UTF-8 | 543 | 3.875 | 4 | [] | no_license | geral = []
pares = []
impares = []
while True:
n = int(input('Digite um valor: '))
if n % 2 == 0:
if n not in pares:
pares.append(n)
geral.append(n)
else:
if n not in impares:
impares.append(n)
geral.append(n)
resp = str(input('Quer contin... | true |
cc2d44ca6324ebdb54fcfeb5801c377b4ca70bfd | Python | graphql-python/graphql-core | /tests/utilities/test_concat_ast.py | UTF-8 | 769 | 2.78125 | 3 | [
"MIT"
] | permissive | from graphql.language import Source, parse, print_ast
from graphql.utilities import concat_ast
from ..utils import dedent
def describe_concat_ast():
def concatenates_two_asts_together():
source_a = Source(
"""
{ a, b, ... Frag }
"""
)
source_b = Source... | true |