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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
75057625e316583894517eade56251cdff955a64 | Python | RPGroup-PBoC/human_impacts | /data/land/FAOSTAT_agriculture_landuse/viz/generate.py | UTF-8 | 4,343 | 2.75 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | # %%
import pandas as pd
import altair as alt
import anthro.io
# Load the data sets
data = pd.read_csv('../processed/FAOSTAT_global_agricultural_landuse.csv')
data['year'] = pd.to_datetime(data['year'], format='%Y')
data['land_area'] = anthro.io.numeric_formatter(data['area_Mha'].values * 1E6,
... | true |
2ee18f9965302be540131220b532583879b43408 | Python | TanitPan/comp1531_UNSW_Dreams | /tests/dm_list_test.py | UTF-8 | 2,002 | 2.890625 | 3 | [] | no_license | """
This file contains test function for dm_list function in dm.py
"""
import pytest
from src.dm import dm_create_v1, dm_list_v1
from src.channels import channels_create_v2, channels_list_v2
from src.auth import auth_register_v2
from src.error import InputError, AccessError
from src.other import clear_v1
from src.helpe... | true |
2a3bcf6e83278747b36e6f805080d1b5a7733db5 | Python | Sumindar/Basic-python | /opentheparenthesis.py | UTF-8 | 652 | 3.78125 | 4 | [] | no_license | a = 20
b = 10
c = 15
d = 5
print ("a:%d b:%d c:%d d:%d" % (a,b,c,d ))
e = (a + b) * c / d #( 30 * 15 ) / 5
print ("Value of (a + b) * c / d is ", e)
e = ((a + b) * c) / d # (30 * 15 ) / 5
print ("Value of ((a + b) * c) / d is ", e)
e = (a + b) * (c / d) # (30) * (15/5)
print ("Value of (a + b) ... | true |
b967676e91cd40acf254f2e158e3069abbfc4b17 | Python | Arihant-Surana/UDACITY_CNVD-COURSE_COURSE | /blue_screeen.py | UTF-8 | 1,250 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Blue Screen
# In[1]:
import matplotlib.pyplot as plt
import numpy as np
import cv2
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
image = cv2.imread('F:\ObjectDetection\pizza_bluescreen.jpg')
print('This image is :', type(image),
'with dimension' , ... | true |
bb68a9898fc2d986056d085231c23a29cc2fc97e | Python | mucahidyazar/python | /worksheets/projects/shop/main.py | UTF-8 | 3,254 | 3.609375 | 4 | [] | no_license | print("""
Welcome to Computer Shop
1 Buy Computer
2 Buy CPU
3 Buy Motherboard
4 Buy SSD
5 Buy Gpu
6 Buy Memory
7 Buy Power
8 Your Basket
9 Your Orders
10 Working Hours
Press Q to exit
""")
import json
from computer import Computer
from client import Client
with open('stocks.json', 'r', enc... | true |
9dbd114ed7da90578831108b9fa3e4ed7eb6d560 | Python | RohitGuptacs50/DSA | /leet code/Fibonacci_Number.py | UTF-8 | 394 | 2.71875 | 3 | [] | no_license | class Solution(object):
def fib(self, N):
"""
:type N: int
:rtype: int
"""
F0 = 0
F1 = 1
if N == 0:
return F0
elif N == 1:
return F1
else:
for i in range(2,N + 1):
f = F1 + F0
... | true |
0971c44d908c51f7706ebba81ccb7086f498049f | Python | Avagr/BisimilarityGame | /ui/qtui/widgetutils.py | UTF-8 | 5,681 | 2.5625 | 3 | [] | no_license | from typing import Tuple
import bisimilarity_checker
from PyQt5 import QtCore
from PyQt5.QtCore import Qt, pyqtSignal, QObject, pyqtSlot
from PyQt5.QtGui import QFont, QIntValidator, QBrush, QColor
from PyQt5.QtWidgets import QMessageBox, QLabel, QFrame, QTableWidget, QItemDelegate, QWidget, QStyleOptionViewItem, \
... | true |
d5fa3e972b92b35682a1e56e2d0ebeef6dbfb57e | Python | kmuhin/OFDru | /json_save_restore.py | UTF-8 | 609 | 2.75 | 3 | [] | no_license | import json
import json_save_restore
"""
сохранение словаря в json файл.
получение словаря из json файла.
json удобно экранирует все спецсимволы.
"""
def save_json(data: dict, filename: str):
with open(filename, 'w', encoding='utf-8') as f:
json.dump(data, f, sort_keys=True, indent=2)
def... | true |
20fe683eac3f8ef6571f7a24275799e9f320e3eb | Python | TheSwagLord69/TinderForNTURejects | /globalvars.py | UTF-8 | 1,424 | 3 | 3 | [] | no_license | '''
Global Variables.py
Team:
Chua Guang Jun
Dominic Keeley Gian
Ho Xiu Qi
Lee Jun Ming
Yeo Han, Jordan
'''
def init():
global currentuser
global showpagecommand
global userdictionary
global maindictionary
global list_of_shortlisted_users
# function to update global variable conta... | true |
3cd113eb248d03c1b862b073f1b0802b0e60fc76 | Python | himIoT19/python3_assignments | /assignment_1/Q16.py | UTF-8 | 215 | 4.125 | 4 | [] | no_license | # Python function to create and print a list where the values are square of numbers between 1 and 30
def printValues():
l = list()
for i in range(1, 31):
l.append(i ** 2)
print(l)
printValues() | true |
4dcc840f157dd964080989139467c5a0b5b928bb | Python | jahirulislammolla/CodeFights | /Fights/isSumOfConsecutive.py | UTF-8 | 255 | 3.109375 | 3 | [] | no_license | def isSumOfConsecutive(n):
for start in range(1, n):
number = n
subtrahend = start
while number > 0:
number -= subtrahend
subtrahend += 1
if number == 0:
return True
return False
| true |
5b20af02b71382bfa62d3af13fdceb061514c3e2 | Python | timcu/builder_police | /set1/pycharm-edu/lesson2/task4/task.py | UTF-8 | 1,520 | 3.203125 | 3 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | import math
def set_node(x, y, z, item):
"""similar to MinetestConnection.set_node but stores nodes in a dictionary rather than sending to minetest
x, y, z: coordinates to be added to nodes. They are converted to integers so that each node has unique set of coordinates
item: minetest item name as a strin... | true |
8b2ae31d2b8d4ab3668706ca70b7ec87e6eed3e3 | Python | NightKirie/NCKU_NLP_2018_industry3 | /Packages/matplotlib-2.2.2/examples/userdemo/demo_gridspec02.py | UTF-8 | 663 | 2.921875 | 3 | [
"MIT"
] | permissive | """
===============
Demo Gridspec02
===============
"""
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
def make_ticklabels_invisible(fig):
for i, ax in enumerate(fig.axes):
ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center")
ax.tick_params(labelbottom=False, labe... | true |
2115571d3eb30cdddbf61230f1e2cc3a0372b4b2 | Python | 1054028125/PixivBiu | /app/lib/common/msg.py | UTF-8 | 2,257 | 2.578125 | 3 | [
"MIT"
] | permissive | # coding=utf-8
import os
import platform
BIUMSG_METHODS = {
"default": 0, "highlight": 1, "underline": 4, "flash": 5, "anti": 7, "disable": 8
}
BIUMSG_COLORS = {
"black": (30, 40),
"red": (31, 41),
"green": (32, 42),
"yellow": (33, 43),
"blue": (34, 44),
"purple-red": (35, 45),
"cyan-b... | true |
3dc477107cb877cfd3649a5b83bc3c2bd743ea1e | Python | CurisZhou/PLM_annotator | /annotator/get_representation_samsum.py | UTF-8 | 2,575 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import codecs
import json
import os
from tqdm import tqdm
import torch
from utils import get_model, get_tokenizer, get_dialogue_summary_pairs, load_json
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
def get_datas():
train_datas = load_json("./data/s... | true |
99d75dffbe89b3efc40db5a9f059c360be7c69d1 | Python | PrzemyslawWojslaw/DAP-DDAP_solver | /tools/logger.py | UTF-8 | 1,914 | 2.96875 | 3 | [] | no_license | import datetime
import os
class Logger:
def __init__(self, network_name):
self.logFile = None
self.path = "output/" + network_name + "/"
try:
if not os.path.exists(self.path):
os.mkdir(self.path)
except OSError:
print("Creation of the directo... | true |
ad0e8ba4f781ad2bee3205c02e653fb8e9fb8d4a | Python | manuhuth/Replication-of-Bailey-2010- | /auxiliary/reg_fig5.py | UTF-8 | 23,726 | 2.71875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.axes as ax
import statsmodels.api as sm
import warnings as wn
def gen_Fig4_A(df):
"""Function to create the plot from Figure 6 in Bailey (2010)
Args:
-------
takes a data frame for ... | true |
49253bd4c3a8dce741b7f685cab1f3177e3c771c | Python | ekourkchi/Evolutionary_Art | /evolveImage.py | UTF-8 | 8,147 | 2.765625 | 3 | [] | no_license | # /*****************************************************************
# //
# // Author: Ehsan Kourkchi
# //
# // DATE: September, 27, 2017
# //
# // FILE: evolveImage.py
# //
# // Description: Evolving Imeges.
# // use '-h' flag to see all the possible options
# //************... | true |
d2396c68394e49b57b7bda306fccb659c044f39a | Python | ajishidiq/traffic-report | /conn.py | UTF-8 | 527 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
import psycopg2
from config import config
def connect():
"""
Connection Initiation To Postgresql database
"""
conn = None
try:
# Read Connection Parameters
params = config()
# Connect to the PostgreSQL Server
print("Connecting to Server")
... | true |
81532629cbe4160bb7feb6c5aa4c2faf3ca6fd43 | Python | mjpost/sockeye-scripts | /masking/replace_masks.py | UTF-8 | 2,751 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Takes a source, masked source, and target, and a fast_align model.
It runs fast_align to recover the alignments
"""
import argparse
def parse_alignments(align):
t2s = {}
for x in align.split(' '):
s, t = x.split('-')
t2s[int(t)] = int(s)
return t2s
def ismask(... | true |
ab593ef887eaf09bde836c3bfb01d57e70fd5870 | Python | cohenra/Python | /exercises/fibunacci.py | UTF-8 | 173 | 3.125 | 3 | [] | no_license | from cachetools import cached
@cached(cache={})
def fib (num):
if num == 0 or num == 1:
return 1
return fib(num - 1) + fib(num - 2)
print(fib(400)) | true |
bfe4b37cacf0c1bfd8f2ff77292994ec6dc6bcfa | Python | david-develop/holbertonschool-web_back_end | /0x03-caching/2-lifo_cache.py | UTF-8 | 1,043 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python3
""" LIFOCache module
"""
BaseCaching = __import__('base_caching').BaseCaching
class LIFOCache(BaseCaching):
""" LIFOCache defines:
- Caching system inherit from BaseCaching
"""
def __init__(self):
"""Instantiation
"""
super().__init__()
self.queue ... | true |
79f8f33ca925159aa448b3d153be8b67ab673f01 | Python | khaldi505/holbertonschool-web_back_end | /0x04-pagination/0-simple_helper_function.py | UTF-8 | 199 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
"""
doc test
"""
def index_range(page: int, page_size: int) -> tuple:
"""
a function that
"""
return ((page * page_size - page_size), (page * page_size))
| true |
a6bea5f0d0e6a3e8f43f5245ecab25e1917de605 | Python | NaveenChowdary-19/Python | /Beautifulsoup.py | UTF-8 | 319 | 2.796875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
source = requests.get('https://www.imdb.com/search/title-text/?plot=top+movies').text
html_soup = BeautifulSoup(source,'lxml')
movie_list = html_soup.find_all('div',class_='lister-item mode-detail').text
print(type(movie_list))
print(len(movie_list))
#print(movie_list.h3)
| true |
e26eaeb120ff8d9ae49cadccb6491122ff245910 | Python | CharmingCheol/python-algorithm | /백준/정렬/1181.py | UTF-8 | 214 | 2.78125 | 3 | [] | no_license | import sys
arr = []
for i in range(int(sys.stdin.readline().strip())):
arr.append(str(sys.stdin.readline().strip()))
result = list(set(arr))
result.sort(key=lambda x: (len(x), x))
for i in result:
print(i) | true |
844250dd0bb8a2caf60923a61b3c9d648fdb34ad | Python | ersaree/DeepTool | /Detection/LabelData.py | UTF-8 | 3,709 | 2.671875 | 3 | [] | no_license | import numpy as np
from skimage import data, io
import matplotlib.pyplot as plt
import os.path
import cv2
data_path = 'data1/'
save_path = 'save/'
def DataLoader(path,as_grey = False):
file_name =[]
file_name = [x for x in os.listdir(path)]
imgName_list = []
img_list = []
for name... | true |
8a9b58d09dabb1eb0f12cac61d81abc46e3e059b | Python | henktillman/gradpam | /tools/vis_saliency.py | UTF-8 | 3,792 | 2.578125 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | """Generates interactive HTML visualization.
In this visualization, your cursor position is discretized to a 50x50 bin, and
the corresponding image is shown.
To use, output saliency maps to a directory of your choosing
(by default, ./images, from whatever directory you're in). This script will
iterate over all images... | true |
626290c63c09dfe18c0a78b6a672f91fc64c3397 | Python | freehawkzk/utilities | /DetectFace.py | UTF-8 | 4,792 | 3.109375 | 3 | [] | no_license | """
在建立明星人脸数据库的过程中,通过爬虫爬取了大量明星图片之后,需要对图片进行过滤。
本脚本会对传入的图片路径列表文件中的所有文件,进行人脸检测,对于不能检测到人脸的图片,将其
路径保存到输出文件中。方便后续的图片过滤或删除操作。
本脚本通过Dlib的正脸检测进行人脸检测,使用了多线程技术。
"""
import dlib
import cv2
import os
import sys
import threading
import time
dir=[]
if(len(sys.argv) == 1):
print("You dont input the folder path that you wa... | true |
9105f2bc5dd1b448b680896ef5071aebca7d9959 | Python | Andrew23487/Test | /test.py | UTF-8 | 194 | 3.171875 | 3 | [] | no_license | import time
x = "This is a Test2"
timeout = time.time() + 60 * 5
while True:
if time.time() > timeout: # Infinite loop will break after 5 minutes
break
else:
print x | true |
17555e2817c7ca9291389d29e2f24bc8388489ea | Python | keurfonluu/My-Daily-Dose-of-Python | /Solutions/17-create-a-simple-calculator.py | UTF-8 | 1,329 | 4.375 | 4 | [] | no_license | #%% [markdown]
# Given a mathematical expression with just single digits, plus signs, negative signs, and brackets, evaluate the expression. Assume the expression is properly formed.
#
# Example
# ```
# Input: - ( 3 + ( 2 - 1 ) )
# Output: -4
# ```
#%%
def eval(expression):
# Reduce functions
reduce = {
... | true |
41c2622aca374d276d9958a1ef6b13242674210b | Python | Jimmy-INL/google-research | /infinite_nature/geometry.py | UTF-8 | 8,899 | 3.3125 | 3 | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | true |
cc30237b37b94105875b6845ad374aa79735f06f | Python | InIronClad/python-project-1 | /crismon_robert_hw1.py | UTF-8 | 2,192 | 3.78125 | 4 | [] | no_license | #Assignment: (Homework #1)
#
#Description: (Programming Task - Loan Calculator)
#
#Author: (Robert Crismon)
#
#Completion Time: (3 hours)
#
#In completing this program, I obtained help or worked with the following:
#
#(for the Loan Calculator Programming Task, I did use a few websites,
#https://www.... | true |
611cfa9dd052a0ad1283a45f2a8d52ea4372232f | Python | Gabe397/TalesDB | /oldTales/talesDB/talesAPI/APIFunctions.py | UTF-8 | 4,293 | 2.828125 | 3 | [
"MIT"
] | permissive | import json
import requests
import APIFunctions
import pprint
import random
#--- api url , key, and specific request TEST---
api_url = ("https://www.thecocktaildb.com/api/json/v2/9973533/")
request = ("search.php?s=gin")
# --- FUNCTION : format JSON data to view ONLY ---
def jprint(obj):
text = json.dumps(obj, so... | true |
5fcf9915f344989ac76ce9e90f6c32baa7015964 | Python | davidjguinane/machine-learning | /dataframes/dataframe-example-2.py | UTF-8 | 1,022 | 3.734375 | 4 | [] | no_license | import numpy as np
import pandas as pd
data = {'year': [2010, 2011, 2012, 2011, 2012, 2010, 2011, 2012],
'team': ['Bears', 'Bears', 'Bears', 'Packers', 'Packers', 'Lions','Lions', 'Lions'],
'wins': [11, 8, 10, 15, 11, 6, 10, 4],
'losses': [5, 8, 6, 1, 5, 10, 6, 12]}
football = pd.DataFrame(dat... | true |
4a6d1772ea978991d01a4791a8351367fb7a1f5d | Python | jojonki/atcoder | /abc/abc85c.py | UTF-8 | 512 | 3.109375 | 3 | [] | no_license | def read_int_list():
return list(map(int, input().split()))
def read_ints():
return map(int, input().split())
def f(a, b, c):
# print('price=', 10000 * a + 5000 * b + 1000 * c)
print(a, b, c)
def main():
N, Y = read_ints()
for a in range(2001):
for b in range(2001):
c ... | true |
60346b28772e539508921f357d3c5853a3c5f14c | Python | LeemDawoon/fewshot_segmentation | /core/models/vgg_pspnet.py | UTF-8 | 6,365 | 2.65625 | 3 | [] | no_license | """
Encoder for few shot segmentation (VGG16)
"""
import torch
import torch.nn as nn
import torchvision
def convrelu(in_channels, out_channels, kernel, padding):
return nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel, padding=padding),
nn.ReLU(inplace=True),
)
# def double_conv(in_... | true |
768e0723bdccb1e2441370a19325cbc393a24850 | Python | naumenko-sa/crg | /crg.intersect_sv_reports.py | UTF-8 | 5,666 | 2.515625 | 3 | [
"MIT"
] | permissive | import os
import csv
import sys
import argparse
import shutil
import re
from datetime import datetime
from pybedtools import BedTool
from structuralvariant import GeneAnnotations, StructuralVariant, StructuralVariantRecords
csv.field_size_limit(sys.maxsize)
'''
crg.intersect.sv.reports.py
August 2018
Center for Com... | true |
fc0ea45b49fcf7ef1a1373ecd3771c016a833838 | Python | chriszyyy/leetcodePy | /miniproject/tetris.py | UTF-8 | 4,517 | 3.140625 | 3 | [] | no_license | #coding:utf8
#! /usr/bin/env python
# 注释说明:shape表示一个俄罗斯方块形状 cell表示一个小方块
import sys
from random import choice
import pygame
from pygame.locals import *
from block import O, I, S, Z, L, J, T
COLS = 16
ROWS = 20
CELLS = COLS * ROWS
CELLPX = 32 # 每个cell的像素宽度
POS_FIRST_APPEAR = COLS / 2
SCREEN_SIZE = (COLS * CELLPX, ROWS ... | true |
a36b5452f1a0ad5a098640187d7a5ae45b885c69 | Python | cds-mipt/raai_summer_school_cv_2021 | /ros_basics/scripts/crop_image.py | UTF-8 | 1,292 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python3
import rospy
import cv_bridge
from sensor_msgs.msg import Image
class CropImageNode:
def __init__(self):
rospy.init_node('crop_image')
self.x_top_left = rospy.get_param('~x_top_left', 0)
self.y_top_left = rospy.get_param('~y_top_left', 0)
self.x_bottom_right ... | true |
c2428518f5bd1ee90fecc8744c306ce4fe4fb98a | Python | ritsuxis/kyoupro | /past/past3a.py | UTF-8 | 165 | 3.75 | 4 | [] | no_license | s = input()
t = input()
s_l = s.lower()
t_l = t.lower()
if (s == t):
print("same")
elif (s_l == t_l):
print("case-insensitive")
else:
print("different")
| true |
6bc8154f462e6810814e2f0a1526c8e42f1518ed | Python | tachyon83/code-rhino | /DAY200~299/DAY257-BOJ1931-회의실 배정/guno.py | UTF-8 | 270 | 3.109375 | 3 | [] | no_license | import sys
input=sys.stdin.readline
n=int(input())
meetings=[list(map(int,input().split())) for _ in range(n)]
meetings.sort(key=lambda x:(x[1],x[0]))
now,answer=0,0
for meeting in meetings:
if now<=meeting[0]:
answer+=1
now=meeting[1]
print(answer)
| true |
99efeda47718f0fb0e016f2d5db0bcd3aeb65b88 | Python | S2KtheGeek/Learn_Python_Free_Professionally | /Day 6/Day6_1.py | UTF-8 | 897 | 4.15625 | 4 | [] | no_license | '''
Hello guys so today we will be talking about abstraction and encapsulation
Abstraction - Hiding Unnecessary information from the user
Encapsulation - Wrapping up of data members and member functions in a single unit called class
Encapsulation: — Information hiding.
Abstraction: — Implementation hiding.
_ = Sing... | true |
106dbd2a7f538fd70914fc32f16af50f43db2c27 | Python | chaithyagr/pysap-etomo-1 | /etomo/operators/linear/wavelet.py | UTF-8 | 3,920 | 2.921875 | 3 | [
"LicenseRef-scancode-cecill-b-en"
] | permissive | """
Wavelet class from pyWavelet module
"""
import numpy as np
import pywt
from .utils import (flatten_swtn, unflatten_swtn, flatten_wave, unflatten_wave)
from .base import LinearBase
class WaveletPywt(LinearBase):
""" The 3D wavelet transform class from pyWavelets package"""
def __init__(self, wavelet_name,... | true |
16c189a87c7df81012def86e1424ab4277a8d150 | Python | jtrain/supapowa | /elem.py | UTF-8 | 10,318 | 3.265625 | 3 | [] | no_license | class ElemError(Exception):
"""Error in Elem object."""
pass
class AlreadySearched(Exception):
"""Island search already performed for this node."""
pass
class BusTypeObserver(object):
"""An observer to notify swing holder when a bus becomes swing bus."""
def __init__(self, default=None):
... | true |
690f88ed9cd53180957456c73f544a307638fe7b | Python | accubits/ProcessBud | /resource/tagui_py/tagui_py.py | UTF-8 | 3,640 | 2.59375 | 3 | [
"MIT"
] | permissive | # PYTHON INTERFACE FOR TAGUI FRAMEWORK ~ TEBEL.ORG #
# delay in seconds between scanning for inputs
scan_period = 0.1
import time
from basefile import *
# for redirecting output to captured string
# try/except for python 2/3 compatibility
import sys
try:
import StringIO
except ImportError:
import io
# counter to t... | true |
cb8e90bde1dce953ccaee360dff8e2dc4f100df8 | Python | leocjj/0123 | /Python/python_dsa-master/linkedlist/node.py | UTF-8 | 610 | 4.3125 | 4 | [
"MIT"
] | permissive | #!/usr/bin/python3
"""
Simple implementation of Node
"""
class Node:
# Simple implementation of Node
def __init__(self, data):
# Initialize a Node
self.data = data
self.next = None
def get_data(self):
# Return the data
return self.data
def get_next(self):
... | true |
7d2ee0e624c656c43e39263670f6bbd038997fe5 | Python | Huijuan2015/leetcode_Python_2019 | /47. Permutations II.py | UTF-8 | 1,632 | 3.328125 | 3 | [] | no_license | class Solution(object):
def permuteUnique(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
if not nums:
return
nums.sort()
visited = set() #放 index
self.res = []
self.findPath(nums, visited, [])
return sel... | true |
1d9ca67769a71e1afce6a1d8895e8f8ca13fa067 | Python | diegomohammadbrazil/listadeexercicios9 | /desafio2.py | UTF-8 | 563 | 4.03125 | 4 | [] | no_license |
lista = []
count = 0
n1 = int(input('Escreva o numero de matérias: ' ))
n2 = int(input('Digite o valor de cada nota de cada matéria: '))
quant = int(input("Digite a quantidade de matérias que deseja digitar: "))
media = n1 + n2 / 2
print('A média entre {} e {} é igual:{}'.format(n1, n2, media))
while ... | true |
8d73d28ae713fbbd349d41642653e386a87855d4 | Python | prashravoor/digital_borders_animal_reid | /test/calc_cross_ds_acc.py | UTF-8 | 1,015 | 2.671875 | 3 | [] | no_license | import os
import sys
sys.path.insert(0, '../reid-strong-baseline')
from modeling import Baseline
from calc_closed_reid_acc import getAverageCmcMap
if __name__ == '__main__':
args = sys.argv
if not len(args) == 11:
print('Usage: <5 models> <5 image folders>')
exit(1)
mod... | true |
e0b8c4ff98ae918f772d9c33697fdc56f5f249c0 | Python | deiga/Introduction-to-Artifical-Intelligence | /week2/file_ops.py | UTF-8 | 1,958 | 2.875 | 3 | [] | no_license | #!/usr/bin/python
# This Python file uses the following encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import glob
from stop import Stop
class File_ops(object):
def __init__(self):
self.stops = self.parse_stops()
self.transportations = self.parse_transportation()
self.populate_st... | true |
33e6392f1d0100c862e3dd181c629c4c987b4b5e | Python | shouyuantianxia/Algorithmic-Game-Theory-Application-on-Multi-agent-Combat-and-Verification-Platform-Design | /算法代码/draw_plot.py | UTF-8 | 5,458 | 2.796875 | 3 | [] | no_license | import os
def draw_and_save(x,y,save_path,expected_value):
import matplotlib.pyplot as plt
plt.plot(x,y)
if expected_value:
plt.plot(x,[expected_value for i in range(len(x))])
# plt.plot(0,0.6)
plt.ylabel('reward_recent_1000')
plt.xlabel('training times')
save_path+=".png"
if os... | true |
d935d736ed16b0b82e2f178233b8e27415283355 | Python | weegreenblobbie/sd_audio_hackers | /20160821_wavetable_chorus/code/sdaudio/wt_oscillators.py | UTF-8 | 4,196 | 3.0625 | 3 | [
"MIT"
] | permissive | '''
wave table generators
'''
import numpy as np
from sdaudio import assert_py3
from sdaudio.draw import get_n_samples
from sdaudio.callables import Circular
class Nearest(object):
'''
Returns samples from the wavetable without any interpolation.
'''
def __init__(self, sr, table):
table =... | true |
1c274521a9cca104e456f677cfaab5f9c829c943 | Python | kabir-jolly/nasal_cycle | /pulse_readings_two_sensor_serial.py | UTF-8 | 1,893 | 2.9375 | 3 | [] | no_license | import serial
import time
import numpy as np
from matplotlib import pyplot as plt
from tqdm import tqdm
import pandas as pd
# set up Serial connection and data input
s = serial.Serial("/dev/cu.usbserial-01C84FCC",250000)
start = time.perf_counter()
sensor_a_readings = []
sensor_b_readings = []
times = []
data_dumping... | true |
ea5d65c225f4a64c4b959940260eba195394e9ef | Python | aini626204777/spider | /scrapy_CrawlSpider/youGuoWang/youGuoWang/spiders/youguo.py | UTF-8 | 3,866 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from youGuoWang.items import YouguowangPageItem,YouguowangdetailsItem
class YouguoSpider(CrawlSpider):
name = 'youguo'
allowed_domains = ['ugirls.com']
start_urls = ['https://w... | true |
00e57feea96ba253ae901c9cf42c1746611aa04b | Python | real-moo/Programmers_solution | /Level 1/완주하지 못한 선수.py | UTF-8 | 194 | 2.640625 | 3 | [] | no_license | def solution(participant, completion):
p = sorted(participant)
c = sorted(completion)
for i in range(len(c)):
if p[i] != c[i]:
return p[i]
return p[-1]
| true |
d921793135475995d3317ea2441adc5e3c3f27d4 | Python | chengqian2020/Appium | /python/test_005.py | UTF-8 | 1,145 | 4.28125 | 4 | [] | no_license | # 函数的参数
# 必须参数
# 必须参数的含义就是,如果在函数内有参数,且我们在调用的过程中,没有给参数进行传参,则会报错
# 示例
# def test(a):
# print(a)
#
# test() #不填值则会报错
# 默认参数
# 1.调用函数时,如果没有传递参数,则会使用默认参数
# 2.默认参数在定义函数的时候定义
# 3.默认值只会执行一次,这条规则在默认值可变对象时很重要
# def test1(a, b=[]):
# b.append(a)
# return b
#
# print(test1(10))
# print(test1(11))
# # 字典传参
# def... | true |
6037e59f74ef159822aff048dadcf48c25449e1d | Python | wuzhenbin/zhiwang-code | /img-handle.py | UTF-8 | 453 | 2.984375 | 3 | [] | no_license |
'''
单张图片二值化 灰度处理demo
'''
import tesserocr
from PIL import Image
import os
path = os.getcwd() + '\\imgs'
file_lis = os.listdir(path)
for item in file_lis:
image = Image.open('./imgs/{}'.format(item))
image = image.convert('L')
threshold = 165
table = []
for i in range(256):
if i < threshold:
table.a... | true |
fb5a777985e982b6e8e4abf38462520ad61547be | Python | JohnSun23/SmartGridProject | /evaluate_visualize_model/process_date_time_errors.pyx | UTF-8 | 5,086 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import numpy as np
cimport numpy as np
import sys, os
sys.path.append(os.environ['SMART_GRID_SRC'])
import pandas as pd
import random
import pickle
from collections import defaultdict
import time
FTYPE = np.float32
ctypedef np.float32_t FTYPE_t
ITYPE = np.int32
ctypedef np.int32_t ITYPE_t
''' Gi... | true |
e2f04faf6d35deb0759059dd96b7bccdb709b18c | Python | TechInTech/algorithmsAnddataStructure | /numberArray/interview49.py | UTF-8 | 2,150 | 4.5 | 4 | [] | no_license | # -*- coding:utf-8 -*-
"""丑数
> 定义:把只包含质因子2、3和5的数称作丑数(Ugly Number)。例如6、8都是丑数,但7、
14不是,因为它们包含质因子7。 习惯上我们把1当做是第一个丑数。
> 判断:首先除2,直到不能整除为止,然后除5到不能整除为止,然后除3直到不能整除为止。
最终判断剩余的数字是否为1,如果是1则为丑数,否则不是丑数。
"""
class Solution_49(object):
# method 1
def get_ugly_number(self, n):
"""
n: 为给定的索引大小
... | true |
7ea2ff5b41a6ae99e5ca970f36b7a79fab575581 | Python | NotNite/s2 | /s2/exts/bent.py | UTF-8 | 1,027 | 2.59375 | 3 | [] | no_license | import typing as T
import discord
import lifesaver
def ban_channel_for(guild: discord.Guild) -> T.Optional[discord.TextChannel]:
"""Return the ban echoing channel for a :class:`discord.Guild`."""
return discord.utils.find(
lambda channel: channel.topic is not None and "[s2:bent]" in channel.topic,
... | true |
bd3ed9ac1af3d76013d48394018567c2df0620bf | Python | Chunkygoo/Algorithms | /Recursion/numberOfBinaryTreeTopologies.py | UTF-8 | 413 | 2.984375 | 3 | [] | no_license | # O(N^2) T O(N) S, stack call never exceeds N
def numberOfBinaryTreeTopologies(n, cache = {0: 1}):
if n in cache:
return cache[n]
totalNumTrees = 0
for left in range(n):
right = n-1-left
numOfLeftTrees = numberOfBinaryTreeTopologies(left, cache)
numOfRightTrees = numberOfBinaryTreeTopologies(right, cache)... | true |
b5859c92ab2e5baba9835880ea7b156a952e477d | Python | burakbayramli/books | /Practical_Numerical_Methods_with_Python_Barba/CFD_Codes/advection/flux_calculator.py | UTF-8 | 5,902 | 3.625 | 4 | [
"CC-BY-4.0",
"CC-BY-3.0",
"MIT"
] | permissive | """
Author: Rohan
Date: 24/06/17
This file contains a linear advection flux calculator that contains implementations of simple finite volume flux
calculator schemes
"""
import numpy as np
class AdvectionFluxCalculator(object):
def __init__(self):
pass
@staticmethod
def evaluate_fluxes(grid, dx,... | true |
2348ddad42c1c77235adedf0014ebbdea24af225 | Python | Gojay001/toolkit-DeepLearning | /utils/show_img.py | UTF-8 | 2,415 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
# encoding: utf-8
# @Time : 2021/5/18 上午12:11
# @Author : gojay
# @Contact: gao.jay@foxmail.com
# @File : show_img.py
import matplotlib.pyplot as plt
import numpy as np
import cv2
import torch
def tensor2np(img):
if isinstance(img, torch.Tensor):
img = img.squeeze().detach().c... | true |
20f979eb536302cdf8b721cc5c8a906eea44993c | Python | daniel-reich/ubiquitous-fiesta | /Ddmh9KYg7xA4m9uE7_0.py | UTF-8 | 90 | 2.6875 | 3 | [] | no_license |
def convert_binary(string):
return ''.join(str(int(x > 'm')) for x in string.lower())
| true |
7de4da097c3b985db3c7197c4cbd857cf554d670 | Python | mono-0812/procon | /atcoder.jp/arc104/arc104_b/Main.py | UTF-8 | 434 | 2.921875 | 3 | [] | no_license | n,s=input().split()
n=int(n)
ans=0
for i in range(n):
c1,c2=0,0
S=s[i]
if S=="A":
c1+=1
elif S=="T":
c1-=1
elif S=="C":
c2+=1
else:
c2-=1
for j in range(i+1,n):
S=s[j]
if S=="A":
c1+=1
elif S=="T":
c1-=1
... | true |
ce036147827f53ea7ec3b96c731c3cea656b6813 | Python | 4theKnowledge/s-vaal | /src/tests/_test_data.py | UTF-8 | 1,895 | 2.796875 | 3 | [
"MIT"
] | permissive | """
Tests for data.py
"""
import unittest
class Tests(unittest.TestCase):
def setUp(self):
# Init class
self.sampler = Sampler(budget=10, sample_size=2)
# Init random tensor
self.data = torch.rand(size=(10,2,2)) # dim (batch, length, features)
# output_classes = ['ORG', '... | true |
7e5f1a75a7c82e51e394d49a652bd0930ac92077 | Python | yimeng0701/CKD_pytorch | /onmt/utils/loss.py | UTF-8 | 22,933 | 2.578125 | 3 | [
"MIT"
] | permissive | """
This includes: LossComputeBase and the standard NMTLossCompute, and
sharded loss compute stuff.
"""
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
import onmt
from onmt.modules.sparse_losses import SparsemaxLoss
from onmt.modules.sparse_activations... | true |
8da42a3326529da05c368a56009e504a13687f1c | Python | DarkPurple141/Yipple-Universal-Authentication-Network | /assignment2/flaskr/db.py | UTF-8 | 490 | 2.5625 | 3 | [] | no_license | # Database Imports
import sqlite3
from flask import g
DATABASE = 'users.db'
def getDB():
db = getattr(g, '_database', None)
if db is None:
db = g._database = sqlite3.connect(DATABASE)
return db
def queryDB(query, args=(), one=False):
cur = getDB().execute(query, args)
rv = cur.fetchall()... | true |
fe8785d22ceb2fdc024d443193f2d49ebb9d4825 | Python | songwell1024/AndroidRepackageDetection | /DynamicMethod/LogisticRegression.py | UTF-8 | 2,726 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
'''
@author: WilsonSong
@license: (C) Copyright 2013-2018, Node Supply Chain Manager Corporation Limited.
@contact: songzhiqwer@gmail.com
@software: garner
@file: LogisticRegression.py
@time: 2019/1/3/003 16:54
@desc: 逻辑回归问题
'''
from numpy import *
filename = r'C:\Users\Song\Des... | true |
b476a302cf761d4d453dc3e2f305505612d8744f | Python | karma0/stock_gym | /tests/interfaces/test_continuous_ohlcv_market.py | UTF-8 | 4,973 | 2.640625 | 3 | [
"MIT"
] | permissive | import pytest
import pandas as pd
import numpy as np
TEST_INC_PARAMS = { # Allow for 1 increment
'max_observations': 2,
'observation_size': 4,
'total_space_size': 5,
'data': np.array([.1, .2, .3, .4, .5]),
}
TEST_NOT_INC_PARAMS = { # Don't allow for any increments
'max_observations': 1,
'ob... | true |
b97792655a325a2e532a368253569a8df84dd022 | Python | usman-01/smap-coding-challenge | /dashboard/consumption/models.py | UTF-8 | 2,286 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.db.models.functions import ExtractMonth
import calendar
class user_data(models.Model):
user_id = models.IntegerField(primary_key=True)
area = models.CharField(max_length=10)
tariff = models.CharField(m... | true |
01ad5b81d927d12658aad0a016536af251648858 | Python | mveselov/CodeWars | /tests/kyu_8_tests/test_find_the_position.py | UTF-8 | 401 | 3.53125 | 4 | [
"MIT"
] | permissive | import unittest
from katas.kyu_8.find_the_position import position
class PositionTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(position('a'), 'Position of alphabet: 1')
def test_equal_2(self):
self.assertEqual(position('z'), 'Position of alphabet: 26')
def test_e... | true |
6f2d43ba0798777166cfbe2ea2bb06e2a98dbf14 | Python | 17-76018348/auto_bitcoin_trading | /stock/news_crawling.py | UTF-8 | 1,462 | 2.5625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import re
import pandas as pd
import os
import copy
def crawling(company_code):
url = 'https://finance.naver.com/item/news_news.nhn?code=' + str(company_code) + '&page=1'
source_code = requests.get(url).text
html = BeautifulSoup(source_code, "lxml")
tmp_st... | true |
47d1ffdc1187401e4c76ee352fd0f6684c01012e | Python | ellie-long/analysis-scripts | /devel/run_information/back-ups/run_info_L.py | UTF-8 | 9,115 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python2.3
#
# run_info_L.py
#
# This files should take the runs from runNumFile and the search for their corresponding
# url from halogFile and output the run data into these files in the folder ./run_info:
# l_beam_energy, l_momentum, l_theta, l_target_type, l_target_pol, l_bhwp, l_events,
# l_s... | true |
cd94329e0ee1f52f9f35831704cf148b42b470bc | Python | gitbuda/mage | /python/tests/graph_coloring/test_conflict_error.py | UTF-8 | 2,560 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import random
import pytest
import math
from mage.graph_coloring_module import Individual
from mage.graph_coloring_module import ChainPopulation
from mage.graph_coloring_module import ConflictError
from mage.graph_coloring_module import Graph
from mage.graph_coloring_module import Parameter
@pytest.fixture
def set_s... | true |
9a16d28ab0c27a7315ea4d8f4cf0e4d5708f9ea3 | Python | jjengo/asteroids | /asteroids/game.py | UTF-8 | 10,150 | 2.640625 | 3 | [] | no_license | import pygame
from pygame.locals import *
from random import randint
from asteroids import sound as Sound
from asteroids.sound import Mixer
from asteroids.sprite import Explosion
from asteroids.ship import Ship
from asteroids.asteroid import Asteroid
from asteroids.saucer import Saucer
from asteroids.particle import Pa... | true |
0d82fe4537590652d969082b1f276c0a7e69c18f | Python | Miguelflj/Prog1 | /UriLista/somab.py | UTF-8 | 124 | 2.890625 | 3 | [] | no_license | #UFMT CCOMP
#SOMA BASICO
#URI LISTA 2
def main():
A = input()
B = input()
X = (A+B)
print "X =", (X)
main() | true |
d0433d3382f856a0b413c63d8080be0567f55b85 | Python | ZordoC/the-self-taught-programmer-August-2019 | /Chapter 7 . Loops/Challenge-3.py | UTF-8 | 348 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 16 00:57:53 2019
@author: zordo
"""
#Challenge 3 - Print each item in the list from the first challenge and their indices
shows = ["The Walking Dead","Entourage","The Sopranos","The Vampire Diaries"]
for i , show in enumerate(shows):
print(i)... | true |
d88ad0f0bc0f221b0f3bdbb0baacfcadea9505ea | Python | murayama333/python2020 | /03_ds/ex/src/01/numpy_ex01.py | UTF-8 | 63 | 2.6875 | 3 | [] | no_license | import numpy as np
array = np.arange(0, 100, 5)
print(array)
| true |
1a221e1fbbab8a14672129dc7d17685a2dece34e | Python | ritikpatel003/GeeksforGeeks | /Find the Highest number.py | UTF-8 | 403 | 3.046875 | 3 | [] | no_license | class Solution:
def findPeakElement(self, a):
# Code here
if a[0]>a[1]:
return a[0]
if a[len(a)-1]>a[len(a)-2]:
return a[len(a)-1]
l=1
r=len(a)-2
while(r>=l):
m=(l+r)//2
if a[m]>a[m-1] and a[m]>a[m+1]:
break
elif a[m]>a[m-1]:... | true |
7a500f4703034bfd49a615fb114d20a7a0c50e58 | Python | angr/angr | /angr/analyses/bindiff.py | UTF-8 | 51,815 | 2.90625 | 3 | [
"BSD-2-Clause"
] | permissive | import logging
import math
import types
from collections import deque, defaultdict
import networkx
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from angr.knowledge_plugins import Function
from . import Analysis, CFGEmulated
from ..errors import SimEngineError, SimMemoryError
# todo include an explanatio... | true |
c08a29714fc76bcde30a13762b857d35a0f77c94 | Python | sthoduka/motion_detection_scripts | /synthetic_flow/test.py | UTF-8 | 2,233 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# test.py
# Copyright (C) 2014 Santosh Thoduka
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
import math
import matplotlib.pyplot as plt
import numpy as np
from ego_flow import EgomotionFlow
from motion_flow import Mot... | true |
0f7d9962c92c8e9aa3faaf9840d7914b5bb089ff | Python | asavyy/School-Work | /Software-Engineering/Final Project/Sentiment Analysis/sentimentAnalysis.py | UTF-8 | 3,108 | 3.46875 | 3 | [] | no_license | import numpy as np
from Values import *
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from fpdf import FPDF
import matplotlib.pyplot as plt
from datetime import date
def graphStuff():
height = [pos, neg]
bars = ('Positive', 'Negative')
y_pos = np.arange(len(bars))
plt.figure(figsize=(7... | true |
10ee773b27c0f06dd703eaf0e932218cb9e04316 | Python | Rinvay67/Python-Notes | /ch04_oop/multiploy.py | UTF-8 | 1,043 | 4.03125 | 4 | [] | no_license | class Person(object):
def __init__(self, name, gender):
self.__name = name
self.__gender = gender
def get_name(self):
return self.__name
def get_gender(self):
return self.__gender
def say(self):
return 'i am a Person, my name is %s' % self.get_name()
class St... | true |
74ef57b6bffb6291282a39235d03ba47d917596a | Python | Jorge-Hoyos/python-workshop | /f_strings/int_example.py | UTF-8 | 189 | 3.796875 | 4 | [] | no_license | # Python3 program introducing f-string
val = 'Geeks'
print(f"{val}for{val} is a portal for {val}.")
name = 'Jorge'
age = 27
print(f"Hello, My name is {name} and I'm {age} years old.")
| true |
572b08eeed82bde0a779118b46af18abd4172a2f | Python | revera-/test_api | /Test_api.py | UTF-8 | 1,362 | 3.046875 | 3 | [] | no_license | import pytest
from MyJSON import MyJSON
@pytest.mark.tryfirst
def test_total_count():
"""Проверям праметр total. Отправляем запрос без параметров
https://regions-test.2gis.com/1.0/regions
"""
req = MyJSON()
response = req.do_request(req.make_url)
assert req.get_total(response) >= 22
@pytest... | true |
cd21dc99ec03235179437ec2bd5830f3fbfd8826 | Python | cogniteev/pymailgun | /pymailgun/client.py | UTF-8 | 2,075 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | """
The Mailgun client
"""
import requests
class Client:
""" The client for mailgun's API
@param key: the api key
@param domain: the domain to send mails from
"""
def __init__(self, key, domain):
self.api_key = key
self.domain = domain
def __request(self, method, path, resou... | true |
d3f86c9a3d7bd9afca501f21d804676c1a2f393c | Python | rafaelperazzo/programacao-web | /moodledata/vpl_data/99/usersdata/149/49399/submittedfiles/av1_parte3.py | UTF-8 | 283 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#COMECE AQUI ABAIXO
n=int(input('digite o valor de n:'))
soma=0
j=1
k=3
for i in range(0,n,1):
if i%2==0:
soma=soma+1/(j*(3**i))
j=j+2
else:
soma=soma-1/(j*(3**i))
j=j+2
produto=(12**(0.5))*soma
print('%.6f'%produto)
| true |
6ea859ae4f54bd2d59cd64378b366bcbf3d125d0 | Python | stephaneworkspace/flatlib_fr | /recipes/leapyears.py | UTF-8 | 1,900 | 3.515625 | 4 | [
"MIT"
] | permissive | """
Author: João Ventura <flatangleweb@gmail.com>
Solar return date and time jumps forward and backwards
every year. This is related with the average number of
days in a year (365.25). However, in certain conditions,
the time distance is greater than 24h and increases with
the years.
... | true |
fa222e69d664568414e5de608c0118e7159a20a1 | Python | mbobinski/TAPIR | /teamplay/models.py | UTF-8 | 869 | 2.53125 | 3 | [] | no_license | from django.db import models
class Team(models.Model):
CHOICES=[('7 vs 7', '7 vs 7'),
('Kompania VIII tieru', 'Kompania VIII tieru'),
('Kompania VI tieru', 'Kompania VI tieru'),
('Kompania IV tieru', 'Kompania IV tieru')]
title = models.CharField('Tytul', max_length=40,... | true |
d50ce8ae9d19c5f2089ec5564f9885283fe0bee7 | Python | Rika321/smallSnake | /gui_game.py | UTF-8 | 19,759 | 2.71875 | 3 | [] | no_license | import pygame,sys,time,random
from control.menu_loop import menu_loop
from model.board import Board
from model.snake import Snake
from view.term_draw import draw_surface, show_message
from utils import *
from database import firebase
import io
import requests
from AI import AI1,AI12
LEFT = [-1, 0]
RIGHT = [1, 0]
UP... | true |
91fbb4d3b96bc4cee16551bc760893859bee2cb6 | Python | UofGSocialRobotics/psychsim-querylanguge | /actiontree.py | UTF-8 | 2,324 | 2.859375 | 3 | [] | no_license | import anytree
def create_action_node(name, parent, action, agent, models=None, V=None, V_for_agent=None, p=None):
return anytree.Node(name, parent=parent, action=action, agent=agent, models=models, V=V, V_for_agent=V_for_agent, p=p, next_action=None)
def get_child(node, child_name):
for child in node.childr... | true |
dd40c737c1b90730d02c91339b30a75bfb2582fe | Python | emilykohler/ToolBox-WordFrequency | /frequency.py | UTF-8 | 2,162 | 4.40625 | 4 | [] | no_license | """ Analyzes the word frequencies in a book downloaded from
Project Gutenberg """
import string
def get_word_list(file_name):
"""
Reads the specified project Gutenberg book. Header comments,
punctuation, and whitespace are stripped away. The function
returns a list of the words used in the book as a list.
Al... | true |
0537b9572f944e39f08a00b632df849c14eaf6d6 | Python | letsgetcooking/Sketches | /processing/2015/twistedcircle.py | UTF-8 | 1,147 | 2.640625 | 3 | [] | no_license | W = H = 480
FPS = 20.0
SPEED = 3.0
BG_COLOR = color(27, 40, 27)
RECORD = True
TWIST = 8.0
TWIST_SPEED = 5.0
R = 150
def setup():
size(W, H, P3D)
frameRate(FPS)
ortho()
noFill()
strokeWeight(7)
colorMode(HSB, 100)
def draw():
if (frameCount // (SPEED * FPS)) % 2 == 1:
theta = TWIST... | true |
30ea7819aee2cc6fab487c29b9b607385bce21d9 | Python | galid1/Algorithm | /python/baekjoon/2.algorithm/DFS_BFS/hide_and_seek.py | UTF-8 | 1,066 | 3.40625 | 3 | [] | no_license | #baekjoon 1697 숨바꼭질
import sys
import queue
class Node:
value = 0
count = 0
def __init__(self, value, count):
self.value = value
self.count = count
def hide_and_seek(n,m):
visit = [0 for i in range(100001)]
q = queue.Queue()
start = Node(n,0)
q.put(start)
... | true |
453d0124ab63d4a7f68efc7844b2692118aad650 | Python | matt-varnam/CalypSO | /plume_distance.py | UTF-8 | 4,304 | 3.203125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 30 19:58:32 2020
@author: mbexwmv3
"""
from math import radians, cos, sin, asin, atan2, acos, sqrt, pi
#Import numpy for the great maths functions
import numpy as np
#import matplotlib for the great plotting functions
import matplotlib.pyplot as plt
#from... | true |
6069f14d903b4107ce0c27608a169a1017d195da | Python | HiLab-git/RPR-Loc | /data_process/data_process_func.py | UTF-8 | 26,077 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import nibabel
import numpy as np
import random
from scipy import ndimage
import matplotlib.pyplot as plt
import SimpleITK as sitk
import math
def mkdir(path):
"""
创建path所给文件夹
:param path:
:return:
"""
folder = os.path.exists(path)
i... | true |
b98d86528a5e70ecc4332cb9e93dd777a4c15b99 | Python | lmorchard/lizardfeeder | /themes/lizardfeeder/sources.json.plugin | UTF-8 | 2,297 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
"""
Extract a list of sources used and output as JSON.
"""
# Find library locations relative to the working dir.
import sys, os
base_dir = os.getcwd()
sys.path.extend([ os.path.join(base_dir, d) for d in
( 'lib', 'extlib', 'venus', 'venus/planet/vendor' )
])
import xml.sax
from xml.sax.hand... | true |
d6ec37ba9d8309cfd13699c381adb6c68466af62 | Python | raquelmachado4993/omundodanarrativagit | /python/dao/razao_hapax.py | UTF-8 | 1,757 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import dao.mysql_connect as myc
class RazaoHapax(object):
idproc_razaoHapax=int
id_pessoa=int
cod_tx=int
numerodehapaxes=str
qtd_palavras_texto=str
hapax_legomana=str
def __init__(self):
self.idproc_razaoHapax=int
... | true |
4ac68237cecb9e2f3a6eb5d406164bc6d19458c9 | Python | iorodeo/mct | /mct_camera_trigger/src/mct_camera_trigger/trigger_device.py | UTF-8 | 1,086 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | import serial
import time
class CamTrigDev(serial.Serial):
"""
Provides a simple serial interface to the JFRC multi-camera tracker
hardware trigger device.
"""
def __init__(self,*arg,**kwarg):
super(CamTrigDev,self).__init__(*arg,**kwarg)
time.sleep(1)
def start(self,freq):
... | true |