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
ff73d0310ab9c1f21cda851aadc62beea64d8412
Python
antonfire/extremitypathfinder
/tests/helper_classes_test.py
UTF-8
2,284
2.5625
3
[ "MIT" ]
permissive
import unittest import numpy as np import pytest from helpers import proto_test_case from extremitypathfinder.helper_classes import AngleRepresentation class HelperClassesTest(unittest.TestCase): def test_angle_repr(self): with pytest.raises(ValueError): AngleRepresentation(np.array([0.0, 0....
true
23ab9cadc23114ff65eaaecbe78cae3e01a6dfef
Python
gabriellaec/desoft-analise-exercicios
/backup/user_084/ch17_2020_03_11_10_46_16_588474.py
UTF-8
149
3
3
[]
no_license
def eh_bissexto(x): if x<==0: return('esse ano nao existe') elif x%4==0: return('esse ano é bissexto') else: return('ano nao bissexto')
true
c030fc401a247da413b4bfc3b6708c10c34efd4c
Python
erikerlandson/htcondor
/src/condor_contrib/campus_factory/python-lib/campus_factory/util/ExternalCommands.py
UTF-8
2,065
2.8125
3
[ "DOC", "LicenseRef-scancode-unknown-license-reference", "OpenSSL", "Apache-2.0" ]
permissive
# File for running external commands # # import logging import os from popen2 import Popen3 from select import select def RunExternal(command, str_stdin=""): """Run an external command @param command: String of the command to execute @param stdin: String to put put in stdin @return: (str(stdout)...
true
b5b0339a64d526c1d13527b13a661780543a0193
Python
oxovu/NeuralNetwork
/ZeroLab/Programms/B_LogicalFunc.py
UTF-8
605
3.515625
4
[]
no_license
def func(x1: int, x2: int, x3: int, x4: int, x5: int): return x1 & x2 | x3 | x4 & x5 if __name__ == '__main__': listX1 = [] listX2 = [] listY1 = [] listY2 = [] n = 1 print('Logical func = ', '\n') print('Table of truth:\n') print('number \t operands \t\t result') for x1 in ra...
true
d06ff6166bfd124828ad229a992af6415f8956ea
Python
XKNX/xknx
/test/dpt_tests/dpt_scene_number_test.py
UTF-8
1,743
2.609375
3
[ "MIT" ]
permissive
"""Unit test for KNX scene number.""" import pytest from xknx.dpt import DPTArray, DPTSceneNumber from xknx.exceptions import ConversionError, CouldNotParseTelegram class TestDPTSceneNumber: """Test class for KNX scaling value.""" @pytest.mark.parametrize( ("raw", "value"), [ ((0...
true
6ee890d3ed11fa764414c38cb9d1d4de9491747c
Python
LiuhaiqinFudan/InvestorBeliefMarketEfficiency_HaiqinLiu
/2.MergeRemarks.py
UTF-8
1,725
3.046875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Oct 16 20:34:58 2021 Merge Stock Forum data to get High Frequency Panel and construct Corpus Input: RawData\个股股吧评论数据(scraped) OutPut: allComments.xlsx, 包括股票代码(文件名,手动修改),经过清理的评论 @author: Haiqin """ import os os.chdir(r"D:\Course2021Autumn\MachineLearningFintech\p...
true
eeb84777028b9aead68056202692bb835968c38d
Python
Ivan-Kouznetsov/lucina_suite
/model/counted_collocation.py
UTF-8
156
2.84375
3
[ "MIT" ]
permissive
class CountedCollocation: def __init__(self, collocation: tuple, count: int): self.collocation = collocation self.count = count
true
3bf99a8584442a5ee08acec44b5a78526f1df8ea
Python
mohammadrezamzy/python_class
/mysql-driver.py
UTF-8
2,516
3.28125
3
[]
no_license
''' Python needs a MySQL driver to access the MySQL database, so first install it. python -m pip install mysql-connector ''' import mysql.connector mydb = mysql.connector.connect( host="localhost", user="user_class", passwd="123456", database="demodb" ) # print(mydb) mycursor = mydb.cursor() mycursor.execute...
true
906bad9833dbc720e1b7b064712f1ed43b4d69e8
Python
samconde/UnityMachineLearningForProjectButterfly
/MuJoCo/Tools/Models/arm/PPO/sb_PPO2.py
UTF-8
4,926
2.609375
3
[ "MIT" ]
permissive
""" Stable baselines implementation of SAC applied to the ARM """ import os #import mujoco_py import gym import numpy as np import matplotlib.pyplot as plt from arm_mjpy import arm_env_mj from stable_baselines import SAC, DDPG from stable_baselines.common.policies import MlpPolicy,MlpLnLstmPolicy from stable_baseline...
true
3fc97aef23483fbeb7d385a410fc6bc782962d49
Python
jacobfitz99/proof2
/python intermediate/serializacion.py
UTF-8
1,093
3.203125
3
[]
no_license
import pickle poema = """Cuantas veces, amor sin reconocer tu mirada, sin mirarte, centaura, en regiones contrarias, en un mediodía quemante: eras sólo el aroma de los cereales que amo. Tal vez te vi, te supuse al pasar levantando una copa en Angola, a la luz de la luna de Junio, o eras tú la cintura de aquella g...
true
cbcbd5123e6944d6c79f1f2362d15ad08f6b43cb
Python
HanxianshengGame/EffectivePython
/2.2_了解如何在闭包里使用外围作用域中的变量.py
UTF-8
796
3.25
3
[]
no_license
#!/usr/bin/env python27 # -*- coding: utf-8 -*- # @Time : 2021/6/1 15:02 # @Author : handling # @File : 2.2_了解如何在闭包里使用外围作用域中的变量.py # @Software: PyCharm def sort_priority(numbers, group): found = [False] def helper(x): if x in group: found[0] = True return 0,...
true
42a4c8dbbe5d4f689fe031645f9028375cafd2e7
Python
monda00/hackerrank
/python/#30_the_minion_game.py
UTF-8
464
4.3125
4
[]
no_license
''' The Minion Game ''' def minion_game(string): vowels = 'AEIOU' kevin = 0 stuart = 0 for i in range(len(string)): if string[i] in vowels: kevin += (len(string)-i) else: stuart += (len(string)-i) if kevin > stuart: print('Kevin ', kevin) elif ...
true
f28aa33ac4221257f2017fa7abf11964473ec46f
Python
Marioegarcia/tuto_Flask
/app/views.py
UTF-8
1,443
2.796875
3
[]
no_license
# Se importan Clases from flask import Blueprint #Se importan Funciones from flask import render_template,request, flash from .forms import LoginForm , RegisterForm from .models import User page = Blueprint('page', __name__) @page.app_errorhandler(404) def page_not_found(error): return render_template('...
true
d243fdcdc349e07aff270a305125c528bced01b8
Python
emarinhoss/projects_jupyter
/bnn/loss_equations.py
UTF-8
3,822
3.125
3
[]
no_license
#!/bin/python import numpy as np from keras import backend as K from tensorflow.contrib import distributions # model - the trained classifier(C classes) # where the last layer applies softmax # X_data - a list of input data(size N) # T - the number of monte carlo simulations to run def montecarlo_prediction(model...
true
95226abc7834d81594c4fa4335a1a59a6a84bd9d
Python
mgoszcz/testifactory
/client/testifactory_api/test_execution.py
UTF-8
687
2.515625
3
[]
no_license
from testifactory.client.testifactory_api.api_methods.api import get from testifactory.client.server_url.url import URL from testifactory.client.testifactory_api.test_execution_result import TestExecutionResult class TestExecution: def __init__(self, execution_id: int): self._execution = get(f'{URL}/execu...
true
05d748a8417b10681a21d9e26f9f825811322252
Python
kz26/petpeeve
/kevin/cluster2D.py
UTF-8
2,555
2.875
3
[]
no_license
#!/usr/bin/python # Uses distance-based slice-by-slice hierarchical clustering to eliminate # superfluous objects import os, sys, dicom import numpy as np from scipy.cluster.hierarchy import fclusterdata def read_slice(fn): ds = dicom.read_file(fn) objects = {} for i in range(0, ds.pixel_array.shape[0]): ...
true
d8a5096f3a8a13034f45ef34999560e80b4fd47b
Python
StephenNeville/BCS
/sample_code/func/square_func.py
UTF-8
197
4.09375
4
[]
no_license
# A functional approach to squaring # a list of numbers nums = [1, 2, 3, 4, 5] def sqr(nums): return nums ** 2 print(list(map(sqr, nums))) # The output will be # [1, 4, 16, 25, 49]
true
41c826749dc36e35ddedefbbb602ae3dbcd6d150
Python
tsoijackson/CAUCI-Coin-Wars-with-SQLite
/assets/main.py
UTF-8
7,169
3.25
3
[]
no_license
import sqlite3 from collections import namedtuple DB_FILE = "coinwars.db" Player = namedtuple('Player', 'name points coins dollars') def create_connection(db_file): conn = sqlite3.connect(DB_FILE) return conn def create_table(conn: sqlite3): command = ('CREATE TABLE IF NOT EXISTS coinwars_db...
true
3c811c004cf7b4c67473735835e70ca33e2ea8bf
Python
blaws/CoinDash
/Guardian.py
UTF-8
1,975
2.796875
3
[]
no_license
# CoinDash # blaws, amarti36 # Guardian.py import pygame from pygame.locals import * from Platform import * from threading import Lock class Ground(pygame.sprite.Sprite): def __init__(self, x = 0, y = 0): self.rect = Rect(x, y, 120, 120) #self.rect.move(x, y) self.xspeed = -5 self.yspeed = 0 def tick(self): ...
true
6401482a8805eb4839999f4547e58f2c5a19177b
Python
NotEnding/udaan_upload_aws
/UploadToS3.py
UTF-8
2,311
2.53125
3
[]
no_license
#! /usr/bin/python # -*- coding: utf-8 -*- # @Time : 2019/7/5 上午9:12 import os, sys import random import time from multiprocessing.pool import Pool import requests current_path = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(current_path)[0] sys.path.append(rootPath) from auxiliary.S3Connect im...
true
b23f16ec0adbc3892c8bce11c7a694541a13139e
Python
jos-h/Python_Exercises
/palindrome_pairs.py
UTF-8
14,868
3.265625
3
[]
no_license
from pprint import pprint def check_palindrome(temp_str): return temp_str == temp_str[::-1] def print_palindrome_pairs(words, distinct_indices): temp_str = '' dict_word_counts = {word: index for index, word in enumerate(words)} for index, word in enumerate(words): for each in dict...
true
bd406bbed165ddecbc07a8dafd5e03e7d4850381
Python
shrukerkar/ML-Fellowship
/PythonLibraries/PlotlyScatterPlot/LineAndScatterPlotForRandom100XAndYCoordinate.py
UTF-8
689
2.875
3
[]
no_license
# Write a program to draw line and scatter plots for random 100 x and y coordinates import plotly import plotly.plotly as py import plotly.graph_objs as go import numpy as np plotly.tools.set_credentials_file(username='shrukerkar',api_key='Xz0m9hmG79qoKrR9kam6') N=100 x_random=np.linspace(0,1,N) y0_random=np.ran...
true
ad531bbe8f7a189766ea90356542c4cbef19b25d
Python
gokuldevp/Amazon-automated-price-tracker
/main.py
UTF-8
1,609
2.78125
3
[]
no_license
import requests from bs4 import BeautifulSoup from smtplib import SMTP # ******************************************** SENDING MESSAGE ********************************************************* FROM = "from@gmail.com" PASSWORD = "**********" TO = "to@yahoo.com" def send_mail(): """function to send mail""" ser...
true
7e6aeb127fd96db68d8fa979f99a77de0b7a40be
Python
Leyni/mycode
/acm/leetcode_0070.py
UTF-8
480
3.59375
4
[]
no_license
# -*- coding: utf-8 -*- class Solution(object): def climbStairs(self, n): """ :type n: int :rtype: int """ res = range(0, n + 2) res[1] = 1 res[2] = 2 for i in range(3, n + 1): res[i] = res[i - 1] + res[i - 2] print (i, res[i])...
true
1c76083e27e0e05f44f2d8f9f3d48d72acf1316e
Python
ambroziepaval/Number-Plate-Recognition
/tests.py
UTF-8
709
2.65625
3
[]
no_license
from visionapi import vision from lpdetection import number_plate_detection from yolov3 import car_detection import cv2 test_frame = cv2.imread("visionapi/test_frame.png") test_car = cv2.imread("lpdetection/car.jpg") # Integration Test: Vision API # vision_api = vision.Vision() # texts = vision_api.detect_texts(test_...
true
ebc9cc5005b759c77785f7259f8912f72533db1d
Python
Deserve82/KK_Algorithm_Study
/Kangho/BOJ_3109.py
UTF-8
631
3.015625
3
[]
no_license
movements = [(-1, 1), (0, 1), (1, 1)] def re_dfs(x, y): checker[x][y] = True if y == C - 1: return 1 for move_row, move_col in movements: mr, mc = move_row + x, move_col + y if 0 <= mr < R and 0 <= mc < C: if not checker[mr][mc] and board[mr][mc] == '.': ...
true
42322286da82a0cf63b0535df1766565f9793d30
Python
atobaum/Algorithm-problem-solving-book-code
/MATCHFIX.py
UTF-8
1,378
3.09375
3
[]
no_license
# 2020.3.23 # p1005 from utils import parse from FordFulkerson import networkFlow def test(): inputs = """3 2 2 3 3 0 1 0 1 3 3 4 2 2 1 2 1 2 1 2 4 4 5 3 3 2 0 1 1 2 2 3 1 3""" inputs = parse(inputs) c, = inputs.pop() for _ in range(c): _, m = inputs.pop() win = inputs.pop() mat...
true
44bcda6aa83205065647e21228a29fc87c0b4802
Python
LichAmnesia/LeetCode
/python/58.py
UTF-8
391
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- # @Author: Lich_Amnesia # @Email: alwaysxiaop@gmail.com # @Date: 2016-09-18 23:20:43 # @Last Modified time: 2016-09-18 23:23:53 # @FileName: 58.py class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ s = s.split()...
true
0b7a035c9278105693edc645ca71f41d7b40d780
Python
jackysatpal/PythonAlgoKit
/leet-code/Easy/lastWordIn.py
UTF-8
1,063
3.75
4
[]
no_license
class Solution(object): def lengthOfLastWord(self, s): last_word = get_last_word(s) if not last_word: return 0 return len(last_word) # This is trivially simple to implement def get_last_word(string): if not string: return None words = get_words(string) if ...
true
ad3e0ea5e96f4399415551cd8fc260441ea872b3
Python
Python-Repository-Hub/Pine-Data-Tools
/lib/preprocess.py
UTF-8
2,543
3.453125
3
[ "MIT" ]
permissive
#! /usr/bin/env python3 """ Preprocess csv data, line by line -Reads from csv input_file, and writes to new csv output_file Usage: proprocess.py <input_file.csv> <output_file.csv> [<headers_present = 0>] [<skip_missing_or_incorrect_data = 1>] [<default_value = 0>] """ import csv import sys ...
true
870b9ed4d92f1909d2ec9d60cd454b93171ca625
Python
divya-ai/hybrid-recommender-api
/utils/recommendations_helper.py
UTF-8
4,367
2.640625
3
[]
no_license
from mongo import mongo from db import db from sqlalchemy import func, case from models.movie import MovieModel from models.genre import GenreModel from models.user_rating import UserRatingModel class RecommendationsHelper: @staticmethod def get_dict(ratings, take=10, skip=0): return dict(ratings[ski...
true
6d85f1548d6f17ac35b4650450db1cc3ce951231
Python
toddt/lyman
/lyman/tools/tests/test_graphutils.py
UTF-8
1,990
2.59375
3
[ "BSD-2-Clause" ]
permissive
from nipype.testing import assert_equal, assert_true from nipype import Workflow, Node, MapNode, IdentityInterface, DataGrabber from .. import graphutils as gu def make_simple_workflow(): wf = Workflow(name="test") node1 = Node(IdentityInterface(fields=["foo"]), name="node1") node2 = MapNode(IdentityI...
true
39006491f560964f7ef4e25ddc183fb9fdf48381
Python
rafaelalvesferreira/rtl_data_scrapper
/R_5_7_1_IC.py
UTF-8
10,555
2.625
3
[]
no_license
import time import datetime import os import random import logging import shutil from func_timeout import func_set_timeout from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.common.exceptions import TimeoutException, NoSuchEle...
true
e3fac649e6f0c45ebd89b0580caf854a7e4c822d
Python
PJoyet/challenge_project
/scripts/challenge2/distance_servoing.py
UTF-8
1,505
2.71875
3
[]
no_license
#! /usr/bin/env python # -*- coding: utf-8 -*- """author: Pierre Joyet (3407684) - Marine CORNET (3531423) - Project ROS- M1 SAR 2020""" import rospy from geometry_msgs.msg import Twist from challenge_project.msg import cardinal_direction # Parameter initialization pubTopicName = "/cmd_vel" # Motor command topic su...
true
753ee19745e64c484d6608020621e6b3fb69bdcc
Python
reidac/AOC2020
/day16b.py
UTF-8
3,314
2.9375
3
[]
no_license
import re if __name__=="__main__": f = open("day16.txt") range_dict = {} error_rate = 0 my_ticket = None valid_tickets = [] nearby_tickets_seen = False for ln in f: m = re.search('^(.*): ([0-9]+)-([0-9]+) or ([0-9]+)-([0-9]+)',ln) if m: datum = m.group(1) ...
true
c3b9d7eff1235613f806b600715878b3a3b70193
Python
bigboss-pf/Hogwarts-hour
/homework_first/cal.py
UTF-8
288
2.625
3
[]
no_license
""" ~~~~~~~~~~~~~~~~~~~~~~~ author:hour time:2020/12/11 E-mail:58166728@qq.com ~~~~~~~~~~~~~~~~~~~~~~~ """ class Calculator(): def add(self,a,b): return a+b def sub(self,a,b): return a-b def mul(self,a,b): return a*b def div(self,a,b): return a/b
true
c7cbcf16c864e660c8792219bd81800ff525fe41
Python
hiteshkrypton/Python-Programs
/string.py
UTF-8
193
4.28125
4
[]
no_license
# Python program to Print Characters in a String str1 = input("Please Enter your Own String : ") for i in range(len(str1)): print("The Character at %d Index Position = %c" %(i, str1[i]))
true
46c2a93a42f433df6ba3a01716367dae65e515ce
Python
ankitbhatia8993/parkingservice_python
/src/manager/vehicle_parking_slot_manager.py
UTF-8
3,394
2.765625
3
[]
no_license
from dao.cache import Cache from dao.inmemory import VehicleParkingSlotDao from entity.vehicle_parking_slot import VehicleParkingSlot from manager.parking_slot_manager import ParkingSlotManager from manager.vehicle_manager import VehicleManager from messages.messages import SuccessMessages, ErrorMessages class Vehicl...
true
1850e9c998ced777e249dca102a1453164504049
Python
piba941/Real-Time-Digit-Recognizer
/CNN_training.py
UTF-8
4,957
2.6875
3
[]
no_license
import numpy as np from keras.models import Sequential,load_model from keras.layers import Dense , Conv2D, Dropout, Flatten, MaxPooling2D from keras.utils import np_utils from keras import regularizers from keras.optimizers import Nadam from keras.callbacks import ModelCheckpoint import h5py import os import cv2 from s...
true
ce496380c8d890ed5dd1a4a193e28ff2c387d856
Python
turky/sphinxcontrib-getstart-sphinx
/sphinxcontrib/getstart_sphinx/footnote_relocator.py
UTF-8
1,191
2.875
3
[]
no_license
# -*- coding: utf-8 -*- from docutils import nodes from sphinx.transforms import SphinxTransform class FootnoteVisitor(nodes.NodeVisitor): def __init__(self, document): self.footnotes = [] nodes.NodeVisitor.__init__(self, document) def visit_section(self, node): for footnote in self....
true
1dc57b4ce46dc4e2869d8cc0581950bc3678599a
Python
bloomfieldfong/Generador-de-Analizadores
/Aritmetica.py
UTF-8
1,453
3.1875
3
[]
no_license
from automata import * from scanner import * #keywords keywords =['while', 'do', 'if', 'switch'] #character letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" letter = character(letter) digit = "0123456789" digit = character(digit) tab = chr(9) tab = character(tab) eol = chr(10) eol = character(eol)...
true
4a32cdb4fd31957373d0712f35dc54d9baa49816
Python
danielle20-meet/Meetyl1201819
/game/ball.py
UTF-8
780
3.8125
4
[]
no_license
from turtle import Turtle import turtle class Ball (Turtle): def __init__(self, x, y, dx, dy, r, color): Turtle.__init__(self) self.penup() self.goto(x, y) self.dx = dx self.dy = dy self.r = r self.shape("circle") self.shapesize(r/10) self.fillcolor(color) def move(self, screen_width, screen_h...
true
47d00848e2b0ff4670d23fbe35fc95c222cf9055
Python
Tuxinet/webscraper2.0
/scraper.py
UTF-8
3,503
2.703125
3
[]
no_license
import robotparser import socket import sys from time import sleep from urllib import FancyURLopener import urlparse from bs4 import BeautifulSoup import MySql class myOpener(FancyURLopener, object): version = 'Slow Web Crawler v0.1' class Scraper(): def __init__(self, url, urlLimit, delay): #self...
true
acccdd694e27129c9188138f4c074822d2fdadda
Python
pyro-team/bkt-toolbox
/features/bkt_excel/cells.py
UTF-8
82,745
2.625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- ''' Created on 2017-07-18 @author: Florian Stallmann ''' from __future__ import absolute_import # import System.Convert as Converter #required for convert to double # import System.DateTime as DateTime #required for parse as date and time from System import DateTime, Array import bkt import b...
true
f1c22a9363765f7711a13f5792a0a1904cb20b52
Python
vinicius-toshiyuki/Don
/Test/test.py
UTF-8
1,597
2.78125
3
[]
no_license
import Widget.Manager as wm from Widget import Io, Prompt m = wm.Manager() w1 = wm.Window(timeout=5, background='223322') w2 = wm.Window(weight=2, background='443344') f1 = wm.Frame(orientation='horizontal', background='130001') w3 = wm.Window(background='223322') w4 = wm.Window(background='443344', foreground='aa0000...
true
689d14fb36ca2d64fe0bcb14ee82d226c6ecb061
Python
bboyrankingz/codejam
/adventofcode/day8/registers.py
UTF-8
1,242
3.171875
3
[]
no_license
class Register(object): def __init__(self, cache={}): self.cache = cache self.greatest = 0 def parse_modify(self, sequence): chaine, modify, number = sequence.split(" ") if not self.cache.get(chaine): self.cache[chaine] = 0 if modify == "inc": re...
true
4c1267fa0882d893a4d1efcc175977f6b92e2c76
Python
sk0g/plant-classifier-v2
/data_prep.py
UTF-8
5,817
3.109375
3
[ "MIT" ]
permissive
#!/user/bin/env python3 import os import sys from random import shuffle from shutil import copy from matplotlib import pyplot def deal_with_cultivars(): basedir = "./dataset" folder_names = [f[0].split("/")[-1] for f in os.walk(basedir)] # folder names: eg Beryl's Gem => Beryls Gem (breaks processing l...
true
d1d016fa073aac60adddef36dfd2b30bdddff2b3
Python
sandance/MyPractice
/1A/1A.py
UTF-8
81
2.90625
3
[]
no_license
n,m,a=map(int,raw_input().split()) print -n/a*(-m/a) #Ceiling of both n and m
true
b703be75d068397c70c2f1084775c1a9cd9984f0
Python
ndwb/GreyWolfOptimiser_CoveragePathPlanning
/main.py
UTF-8
6,203
3.046875
3
[]
no_license
import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation import seaborn import numpy as np import time import math position_target = np.array([592,592]) position_Start = np.array([0,0]) numberOfWolves = 15 socialLearningNumber = 3 num_iter = 300 #This is a function to change the position of the t...
true
edd40de34688428d060366a9cb29029a49c1827c
Python
snejDev/ElementaryCodes
/DataStructures/Arrays/O(n).py
UTF-8
109
3.3125
3
[]
no_license
a=['a','b','c','d','e'] a.pop(1) #O(n) print(a) a.insert(0,1) #O(n) print(a)
true
4b28dcbd5b585280fbd41b044007a9929385f9cb
Python
Alagupreethi/python
/largest.py
UTF-8
170
3.109375
3
[]
no_license
n1=int(input()) n2=int(input()) n3=int(input()) if((n1>n2)and(n1>n3)): largest=n1 elif((n2>n1)and(n2>n3)): largest=n2 else: largest=n3 print(largest)
true
1ff47bf487ec682e7f4e2fdf7b80602b3bea1fc3
Python
marinakeu/uriexercises
/1010.py
UTF-8
1,521
4.53125
5
[]
no_license
''' Neste problema, deve-se ler o código de uma peça 1, o número de peças 1, o valor unitário de cada peça 1, o código de uma peça 2, o número de peças 2 e o valor unitário de cada peça 2. Após, calcule e mostre o valor a ser pago. Entrada O arquivo de entrada contém duas linhas de dados. Em cada linha haverá 3 valore...
true
c8e2d189089bb698e4149911573a4108ccc98a24
Python
marianux/jupytest
/untitled1.py
UTF-8
2,429
2.640625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 29 14:49:03 2023 @author: mariano """ # Inicialización e importación de módulos # Módulos externos import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import scipy.signal as sig # Ahora importamos las funciones de PyTC2 ...
true
efaea196685c18887bbe7774859c17b0dc393922
Python
Harshilpatel134/cs5590_python_deep_learning
/lab 2/Scource/task4.py
UTF-8
643
3.453125
3
[]
no_license
import numpy l=[] a=1 d=input("enter dimension 1, 2, 3:") ## geting no. of dimension from user for i in range(0,int(d)): ## getting size of each dimension l+=[int(input("enter size of "+ str(i+1) +" dimension:"))] a=a*l[i] l.reverse() arr=numpy.random.randint(0,1000,a,int) ## creating random v...
true
ed6a5484e4e256787f20bacb72a7405f550fe85b
Python
Sheventon/DataMiningEducation
/PageRank/transiction_matrix.py
UTF-8
1,590
2.984375
3
[]
no_license
class TransictionMatrix: def __init__(self, global_nodes): self.nodes = global_nodes self.matrix = [[0] * (len(global_nodes) + 1) for i in range((len(global_nodes) + 1))] self.dumping_factor = 0.85 self.vector = [] for element in range(len(self.nodes)): self.vect...
true
2805b2597a997f30c442f36440419a08dea92a29
Python
abhaysinh/Data-Camp
/Data Science for Everyone Track/19-Introduction to Shell/02- Manipulating data/08-How can I select columns from a file.py
UTF-8
896
3.890625
4
[]
no_license
''' How can I select columns from a file? head and tail let you select rows from a text file. If you want to select columns, you can use the command cut. It has several options (use man cut to explore them), but the most common is something like: cut -f 2-5,8 -d , values.csv which means "select columns 2 through 5 ...
true
a71258d77208cafbdad428a36b1a95983568c418
Python
aarthisandhiya/aarthi
/23player.py
UTF-8
253
2.984375
3
[]
no_license
m,n=map(int,input().split()) a=[int(m) for m in input().split()] b=[int(n) for n in input().split()] r=[] for j in range(0,len(b)): if b[j] in a: print(max(a),end=" ") else: a.append(b[j]) print(max(a),end=" ")
true
6d9347d39d536591c14f2a11a268caa403fc835b
Python
SchizoDuckie/mega
/music_crawler/aliasCreator/wiki_loader.py
UTF-8
335
2.53125
3
[]
no_license
import sqlite3 import re import urllib3 from bs4 import BeautifulSoup import datetime import sys import wikipediaapi def wiki_crawler(target): wiki_wiki = wikipediaapi.Wikipedia('zh-tw') page_py = wiki_wiki.page(target) print(page_py.title) print(page_py.summary) if __name__ == "__main__": wiki_cr...
true
f6ec81dd6c5239ee6ea412492ea98da2da423c4d
Python
therealcooperpark/Rosalind-Project
/algorithmic_heights/3SUM/solution.py
UTF-8
2,328
3.3125
3
[]
no_license
#! /usr/bin/env python3 from argparse import ArgumentParser def get_args(): parser = ArgumentParser() parser.add_argument('input_file', help = 'rosalind input file') parser.add_argument('output_file', help = 'output file for rosalind') return parser.parse_args() def parse_input(input_file): '''...
true
3985ad6143249a9eb6ddce0077770121b6311522
Python
anirudhshenoy/projectabc
/aggregator/models.py
UTF-8
1,502
2.609375
3
[]
no_license
from django.db import models class chapterDetail (models.Model): GRADE_CHOICES = ( ('5th', '5th'), ('6th', '6th'), ('7th', '7th'), ('8th', '8th'), ) grade = models.CharField( max_length=3, choices=GRADE_CHOICES, default='5th', ) SUBJECT_CHO...
true
a5074b900cd51b708323cb1bdabaac9c38326475
Python
deepick/marklogic-setup
/tests/test_integration.py
UTF-8
5,664
2.53125
3
[]
no_license
""" tests application of CMA and trigger configs using curl. using curl (rather then python requests) keeps HTTP requests generic """ import unittest import subprocess import json import time import requests from requests.auth import HTTPDigestAuth import pytest def check_resource_exists(test_cma_creds, test_rma...
true
5d2ebf9b891360d74a4264c6fea9a36e748fc69b
Python
htl1126/leetcode
/1640.py
UTF-8
348
3.03125
3
[]
no_license
# Ref: https://leetcode.com/problems/check-array-formation-through-concatenation/discuss/918408/Python-5-lines-hashmap class Solution: def canFormArray(self, arr: List[int], pieces: List[List[int]]) -> bool: d = {p[0]: p for p in pieces} ans = [] for n in arr: ans += d.get(n, []...
true
7cb2686af6a66b39c94aa182468251d7096988d9
Python
nalangekrushna/comprinno_test
/10.py
UTF-8
234
3.71875
4
[]
no_license
def get_gross_salary(salary) : hra = 0 da = 0 if salary < 1500 : hra = salary*.1 da = salary*0.9 else : hra = 500 da = salary*0.98 return salary+hra+da print(get_gross_salary(1312))
true
5af694d4d42afb33096f704b3c28b25eb734a540
Python
Ronypea/GameOfLife
/GameOfLife.py
UTF-8
6,847
3.34375
3
[]
no_license
import pygame from pygame.locals import * import random from pprint import pprint as pp import time import pygame from pygame.locals import * import random from pprint import pprint as pp import time class Cell: def __init__(self, x, y): self.state = 0 self.x = x self.y = y def is_ali...
true
736b25d9dd6ccb8c04ea88d667c2c6ec69bf359c
Python
lyl0521/lesson-0426
/lesson/day03/test.py
UTF-8
866
4.09375
4
[]
no_license
# all() print(all([0,1,2,3])) # False print(all([1,2,3])) # True print(all(['a','b','c',''])) # False print(all(['a','b','c','d'])) #True print(all(('a','b','c','d'))) #True print(all(('a','b','','c'))) #False print(all((0,1,2,3))) #False print(all((1,2,3))) #True pr...
true
29fc913c63388dec0691169a12d144c7518d2462
Python
Mo0dy/Code4Fun
/Projects/MatrixAnimations/LangdonsAnt.py
UTF-8
1,348
2.734375
3
[]
no_license
from Code4Fun.Utility.Vec2 import * import numpy as np import pygame as pg from scipy.ndimage.filters import convolve import random directions = [Vec2(1, 0), Vec2(0, 1), Vec2(-1, 0), Vec2(0, -1)] dir_index = 0 def turn_right(): global dir_index dir_index = (dir_in...
true
f0639c22efd76e2a17f0b0d8c7d0f993ac3882e9
Python
incolumepy-cursos/poop
/head_first_design_patterns/factory/abstract_factory/cheese.py
UTF-8
679
3.40625
3
[ "MIT" ]
permissive
""" Notes: - Each cheese has its own str representation - Each ingredient is a product that is produced by a Factory Method (create_cheese) in the Abstract Factory (PizzaIngredientFactory) See pizza_ingredient_factory.py """ from abc import ABC, abstractmethod class Cheese(ABC): @abstractmetho...
true
d68de8134ce962dcae70808832fcd50ca272ec42
Python
Yarince/PythonProjects
/py_games/hangman_game/app_main.py
UTF-8
2,272
4.03125
4
[]
no_license
class Hangman(object): __lives = 10 __guesses = 0 __answer = "" def __init__(self, lives): self.__lives = lives self.__answer, self.__word = self.start_up() def run(self): while True: print("Lives = ", self.__lives) if self.__lives <= 0: ...
true
2017a3cfe307d892ce4ba8776f892a5d9ff24675
Python
daniel-reich/ubiquitous-fiesta
/smLmHK89zNoeaDSZp_16.py
UTF-8
503
3.09375
3
[]
no_license
class Country: ​ def __init__(self, name, population, area): self.name = name self.population = population self.area = area self.pdens = population / area self.is_big = self.population > 2.5 * 10**8 or self.area > 3*10**6 def compare_pd(self, other): report_str = '%s has a %s populatio...
true
7677041d4c2245ef0bbda2db835edfff474b48e4
Python
hemelroy/detekt
/viewimagewindow.py
UTF-8
1,933
2.53125
3
[]
no_license
from PyQt5 import QtCore, QtGui, QtWidgets class ImageWindow(object): def setupUi(self, OtherWindow): OtherWindow.setObjectName("OtherWindow") OtherWindow.resize(1000, 1000) self.centralwidget = QtWidgets.QWidget(OtherWindow) self.centralwidget.setObjectName("centralwidget") ...
true
0a1eb720ab7a47246ef4e0a414de573e35a551d3
Python
rafaelperazzo/programacao-web
/moodledata/vpl_data/303/usersdata/293/68196/submittedfiles/testes.py
UTF-8
92
2.65625
3
[]
no_license
nome= input('Qual seu nome') idade= input('Qual sua idade') peso= input('Qual seu peso')
true
4d57768bc45a533d076349ad7fb786c7ff9b71c7
Python
dumberdude/twitter-api
/app/models.py
UTF-8
174
2.671875
3
[]
no_license
from datetime import datetime class Tweet(object): def __init__(self, msg): self.id = None self.text = msg self.created_at = str(datetime.now())
true
8d3cc0e3396c621c0500e18d30c6158b7a7080dd
Python
Mahi/RPG-SP
/addons/source-python/plugins/rpg/skills/longjump/events.py
UTF-8
227
2.578125
3
[]
no_license
def player_jump(player, skill, variables, **eargs): v = player.velocity multiplier = 1 + variables['velocity_multiplier_per_level'] * skill.level v.x *= multiplier v.y *= multiplier player.base_velocity = v
true
45caf86edebc8d386cf863eb553e3fcfce94c496
Python
zeusops/anniversary-banner
/banner/image/views.py
UTF-8
4,895
2.53125
3
[]
no_license
from random import randint from django.http import HttpResponse from django.shortcuts import render from django.views.decorators.cache import cache_page from PIL import Image, ImageDraw, ImageFont from .models import BannerConfigEntry, Side, Team TEAMS_PER_COLUMN = 5 TEAMS_LIMIT = TEAMS_PER_COLUMN * 3 WHITE = (229, ...
true
aa5d44a6be09a25c5faf93617cac19f3ae15b624
Python
Kazhuu/movelister
/pythonpath/movelister/utils/alignment.py
UTF-8
222
2.546875
3
[ "MIT" ]
permissive
from enum import Enum class HorizontalAlignment(Enum): STANDARD = 0 LEFT = 1 CENTER = 2 RIGHT = 3 BLOCK = 4 class VerticalAlignment(Enum): STANDARD = 0 TOP = 1 CENTER = 2 BOTTOM = 3
true
fc01a3f5f9f02d38ba4766b174bafd02e6c0b85d
Python
citizenofathens/knowledge-graph-embedding
/KGE/ns_strategy.py
UTF-8
4,348
3.03125
3
[]
no_license
import numpy as np import tensorflow as tf from .utils import ns_with_same_type class NegativeSampler: """ A base module for negative sampler. """ def __init__(self): """ Initialized negative sampler """ raise NotImplementedError("subclass of NegativeSampler should implement __init...
true
a230f53599de8f5c6bd17065bff56868e854edc6
Python
MisterLenivec/studyPython
/stepic-python-programming/1-12_area-of-triangles.py
UTF-8
616
3.625
4
[]
no_license
#Напишите программу, вычисляющую площадь треугольника по переданным длинам трёх его сторон по формуле Герона. #На вход программе подаются целые числа, выводом программы должно являться вещественное число, соответствующее площади треугольника. #Sample Input: #3 #4 #5 #Sample Output: 6.0 a = int(input()) b = int(input(...
true
b1527254b1f3d00eaeedb6e95dfd4306d91ce088
Python
Aasthaengg/IBMdataset
/Python_codes/p03001/s487504198.py
UTF-8
404
3.125
3
[]
no_license
# import sys # sys.setrecursionlimit(100000) def input(): return sys.stdin.readline().strip() def input_int(): return int(input()) def input_int_list(): return [int(i) for i in input().split()] def main(): w, h, x, y = input_int_list() area = (w * h) / 2 bl = (w == 2 * x and h == 2 * y)...
true
c74b80c5952b0436c284d3065cbbb859e349fa9b
Python
bsakari/Python-Lessons
/Lesson4/If_ElseStetement.py
UTF-8
240
3.84375
4
[]
no_license
num1 = 10 num2 = 20 if num1<=num2: print("Num1 is less or Equal to Num2") else: print("Num 2 is greater than Num1") if num2<=num1: print("Num 1 is greater than or Equal to Num2") else: print("Num2 is less or Equal to Num1")
true
1f6f4b47c92967c485e043b62b2e2079f8c7b87c
Python
Tosin5S/GlobalAIHubPythonCourse
/Homeworks/day_5_Animals.py
UTF-8
1,465
4.15625
4
[]
no_license
class Animals: def __init__ (self, name = " ", colour = " ", type = " ", age = 0): self.name = name self.colour = colour self.type = type self.age = age def setName(self,name): self.name = name def getName(self): return self.name def setColour(self,colour): self.colour = colour def setT...
true
f1951a5f9b8753e7a3fdca3e477e557467887ed6
Python
hckmd/objects-database-examples
/queries/snippets/fetch_rows.py
UTF-8
151
3.328125
3
[]
no_license
# Runs a SELECT query to retrieve rows from fruit table cursor.execute('SELECT * FROM fruit') rows = cursor.fetchall() for row in rows: print(row)
true
06892767b3869dba2c81542a2c042a6b22540b6e
Python
lqiqiqi/self-driving
/Zmq_SUB1 (复件).py
UTF-8
911
2.546875
3
[]
no_license
import zmq import time import sys port = "5556" if len(sys.argv) > 1: port = sys.argv[1] int(port) if len(sys.argv) > 2: port1 = sys.argv[2] int(port1) # Socket to talk to server context = zmq.Context() socket = context.socket(zmq.SUB) print "Collecting updat...
true
7f2164206eabb13f28ffb23eb0ff471d8ba6d389
Python
davidphan34/Gallery-Website-with-SQL
/mp3-77452669/viewImage.py
UTF-8
2,559
2.796875
3
[]
no_license
#View Image python file # - can view the Image Name and details import pymysql import cgi db = pymysql.connect(host='localhost', user='gallery', passwd='eecs118', db= 'gallery') cur = db.cursor() form = cgi.FieldStorage() image_id_str = str(form.getvalue...
true
de88fb7c7969b6da6a8ddd20684a91fe9ad828e9
Python
AnhellO/DAS_Sistemas
/Ene-Jun-2022/jesus-raul-alvarado-torres/práctica-2/capítulo-9/Dice.py
UTF-8
1,390
4.78125
5
[ "MIT" ]
permissive
"""9-14. Dice: The module random contains functions that generate random num- bers in a variety of ways . The function randint() returns an integer in the range you provide . The following code returns a number between 1 and 6: from random import randint x = randint(1, 6) Make a class Die with o...
true
fd9df542d06863433784372507bb3326c8b8cb34
Python
krrskl/chat
/app/views/estudiante.py
UTF-8
309
2.875
3
[]
no_license
class Estudiante(): def __init__(self,nombre,fila,columna): self.nombre = nombre self.fila = fila self.columna = columna def getNombre(self): return self.nombre def getFila(self): return self.fila def getColumna(self): return self.columna
true
01f024bf4ed5da72292ba21e71e574826f5d44b3
Python
P34br41n/Crypto
/OneTimePad.py
UTF-8
2,408
3.5
4
[]
no_license
# output is binary ( 0bXXXXXXXX ), if you need a string # look at hexlify and unhexlify in the binascii module def otp(message, key): if len(key) < len(message): print("Key is too small") return None else: crypt_msg = ''.join([bin(ord(a) ^ ord(b)) for a, b in zip(key, message)]) print(crypt_msg) return cryp...
true
15e8bc60ee23653b20e997a64fc712ef3b81d8e6
Python
holomagnet/homeexercises
/python_functions - Ali Homework.py
UTF-8
4,078
4.59375
5
[]
no_license
# coding: utf-8 # <img src="http://imgur.com/1ZcRyrc.png" style="float: left; margin: 20px; height: 55px"> # # ## Practise Python Functions # # --- # ### Resources: potentially helpful functions # # * [Dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) # * [`enumerate`](https://doc...
true
44ff7a625bab06d367b3b378160527504b04f007
Python
lzwhirstle/comp1531
/lab02/password.py
UTF-8
1,867
4.03125
4
[]
no_license
def check_password(password): ''' Takes in a password, and returns a string based on the strength of that password. The returned value should be: * "Strong password", if at least 12 characters, contains at least one number, at least one uppercase letter, at least one lowercase letter. * "Mode...
true
ec6d3af845d49d59e54942406461ce86a3ea94c3
Python
goliksa/Python
/6.while-break.py
UTF-8
479
3.953125
4
[]
no_license
def attempt (name): print (name + ", how are you? \"good\" or \"bad\"" ) print('Enter you name') input_name = input() while True: attempt(input_name) mood = input() if mood == 'good' or mood == 'bad' or mood == 'Good' or mood == 'Bad': break else: print('It is sh...
true
fc146253c963e729c6f4e6ff9ea381fd82904cd4
Python
orbicube/battlebutt
/ext/roles.py
UTF-8
12,651
2.71875
3
[]
no_license
import discord from discord.ext import commands from discord import app_commands from typing import Optional, Literal from random import randint import aiosqlite class Roles(commands.Cog): def __init__(self, bot): self.bot = bot @app_commands.command(name="color", description="Change your role color...
true
b5d64515a4761aedc3eb495a891f38575ad4fe54
Python
MISabic/tweet-emotion-detection-dataset
/tweepy_streamer.py
UTF-8
2,599
2.515625
3
[]
no_license
from tweepy import OAuthHandler, API from excelWrite import * from decouple import config from tqdm import tqdm import sys, os try: CONSUMER_KEY = config('CONSUMER_KEY') CONSUMER_SECRET = config('CONSUMER_SECRET') ACCESS_TOKEN = config('ACCESS_TOKEN') ACCESS_TOKEN_SECRET = config('ACCESS_TOKEN_SECRET')...
true
d7760e338d78f1fee52c4ce040b430dfbaf18d36
Python
ankursharma319/python_misc
/misc_labs/lab8.py
UTF-8
2,191
3.78125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Dec 04 11:32:15 2015 @author: Ankur """ import math import pylab from scipy.optimize import brentq def f1(x): """ accepts an number x as input and returns cos(2pi*x)*(e^(-x^2)) """ return math.cos(2*math.pi*x)*math.exp(-(x**2)) def f2(x): """ ...
true
859bd059a9e229a07029c5077a7dbdb9bc0ca452
Python
jonikmen/Librivox-Grabber
/Python/pandas.py
UTF-8
2,491
3
3
[]
no_license
import numpy as np import pandas as pd from sklearn.calibration import CalibratedClassifierCV from sklearn.ensemble import RandomForestClassifier from sklearn.grid_search import GridSearchCV from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import GaussianNB from sklearn.neural_network imp...
true
6bc12f0a49aa1c1b9ea82d0bfd50f225658caa67
Python
JiXuanyuan/tensorflow_example
/example02_graph.py
UTF-8
1,021
3.46875
3
[]
no_license
import tensorflow as tf # graph 计算图 # 1.graph用来构建计算流程,不组织数据和运算 # 2.graph由节点和弧组成,对应tensor和operator # 3.tensorflow提供了一个默认图,创建的节点默认加到该图 # ============================================== # 1.使用默认的计算图 # 构建计算图 a1 = tf.constant(12, dtype=tf.float32, name="input1") a2 = tf.constant(5, dtype=tf.float32, name="input2") print(...
true
ffbf0b44f35365817f618c45e48bfb70277d83de
Python
sravanthi-kethireddy/LeetCode
/14 Patterns/excel.py
UTF-8
180
3.15625
3
[]
no_license
def printChar(n): # print(chr(n)) string = '' while n >0: n, i = divmod(n-1, 26) n = n%26 print(n,i) string = chr(65 + i) + string return string print(printChar(152))
true
c8722af2d8d0c31e29c05c0a7a972340ae75a5f9
Python
Ashok-Mishra/python-samples
/python exercises/dek_program021.py
UTF-8
1,664
3.9375
4
[ "Apache-2.0" ]
permissive
# !/user/bin/python # -*- coding: utf-8 -*- #- Author : (DEK) Devendra Kavthekar # A robot moves in a plane starting from the original point (0,0). The # robot can move toward UP, DOWN, LEFT and RIGHT with a given steps. The # trace of robot movement is shown as the following: # UP 5 # DOWN 3 # LEFT 3 # RIGHT 2 # Th...
true
75a6406c87facc9cf241b90ae83a3d214278d9ea
Python
the-carpnter/codewars-level-7-kata
/sum_of_a_nested_list.py
UTF-8
165
2.9375
3
[]
no_license
def sum_nested(lst): if lst == []: return 0 return lst[0] + sum_nested(lst[1:]) if type(lst[0]) is int else sum_nested(lst[0]) + sum_nested(lst[1:])
true
993d8cd024fecd53c8a6535a25ca67192ecff3d8
Python
sakshi97/btp
/main.py
UTF-8
405
3.125
3
[]
no_license
# File: Hello.py # print(char['text'].encode('utf-8')) import pdfplumber with pdfplumber.open("./resume.pdf") as pdf: dictionary={} count=0 for page in pdf.pages: for char in page.chars : dictionary[count] = [char['text'],char['x0'],char['y0'],char['fontname'],char['size']] ...
true
6959a7e7b99be2fb768c800bac886893da0218e7
Python
Lyxn/or-model
/model/optimize_constraint.py
UTF-8
4,099
2.796875
3
[]
no_license
from ortools.linear_solver import pywraplp from util import reduce def print_solver(solver): print('Number of variables = %d' % solver.NumVariables()) print('Number of constraints = %d' % solver.NumConstraints()) print("Optimal objective value = %f" % solver.Objective().Value()) def print_constraint(co...
true
085ebea83373188fde159ded60cfc843f02f7337
Python
LSaldyt/proofs
/3-26/problems/code
UTF-8
469
3.46875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import matplotlib.pyplot as plt x = range(5) y1 = x y2 = [4, 3, 2, 1, 0] bound_below = [0] * 5 bound_above = [4] * 5 plt.scatter(x, y1, label='strictly increasing, monotonic, bounded') plt.scatter(x, y2, label='strictly decreasing, monotonic, bounded') plt.plot(x, bound_below, label='lower bound...
true