blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
c49dba9e1eac30e595928c4d32885c4d4bc8a7f9 | StanHVA/pylette | /betTypes/BetDozenHigh.py | UTF-8 | 307 | 3.09375 | 3 | [] | no_license | from BetType import BetType
class BetDozenHigh(BetType):
def bet_success(self, number):
if number == '0' or number == '00':
return False
return int(number) > 24
def multiplier(self):
return 3
def description(self):
return 'The third dozen (25-36)' | true |
2b5863b692cc5b7b6ab63ea76eda3a77c2799c23 | mnr/rubberfish | /unneeded_stuff/fishControlViaPipe.py | UTF-8 | 3,139 | 2.578125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
# creates a pipe-driven method for telling the fish what to say
# run this as python3 fishControlViaPipe.py &
# this is run in fish_config.sh
from bmbb_fish import BmBB
import os
from wordToSay import wordToSay
import subprocess
import json
from os.path import join, dirname, expanduser
# for watson... | true |
ba19ae157f70e0e1ed5babbed5d5d0271892092c | Halerfermatqing/Python_learning_freshman | /pycharm_projects/test.py | UTF-8 | 103 | 3.03125 | 3 | [] | no_license | #练习啊啊啊
sum = 0
for i in range(50):
if i % 3 ==0:
continue
sum += i
print(sum) | true |
12d04170ddbab4026b126c20de5d4905a83d6705 | colinsongf/graph-mind | /src/tools/math/statisticsCountOpt.py | UTF-8 | 1,461 | 2.921875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
'''
Created on 2016年6月5日
@author: hylovedd
'''
from json.encoder import JSONEncoder
from json.decoder import JSONDecoder
def countElePorbInList(eleList, allList, smooth=1):
'''
'''
eleProbDic = {}
for ele in eleList:
eleProbDic[ele] = (allList.count(... | true |
1efc6033b69732bff264bfaa6867f2f76e6a586d | floquation/optoFluids | /Codes/Fluids/deprecated/moveParticles.py | UTF-8 | 8,840 | 3.171875 | 3 | [] | no_license | #! /usr/bin/env python3
import sys
import os.path
import numpy as np
from io import StringIO
class MoveParticles(object):
"""
MoveParticles takes as input a file with on each line (X Y Z) coordinates of a particle,
and evolves the z direction of that particle in time according to plug flow or a Poseille ... | true |
f088d8c05838b19416c210a75716bcd9b41102b8 | jcamil0/bitcoin-trend-analysis-with-tweepy | /tweets_streamer.py | UTF-8 | 1,393 | 2.734375 | 3 | [] | no_license | import tweepy
import json
consumer_key = "BwV6HVigRpdNHEqwK6uK3RxCg"
consumer_secret = "XoHFc5kGm8EgVauSN9JXLHDgdwyjtzQqgNYbnJZy7dXnh2iInz"
access_key = "628480072-IGQ6i1BPORUoDfQAUVUfZg7NDEDtwM3DcM2wSr6h"
access_secret = "UsoE76u5nKrptRR4E0hpiMc9vZ7wZ3kzVSxfzhKuuTvmY"
auth = tweepy.OAuthHandler(consumer_key, consume... | true |
e8b23b7520cdd532bbfa9c6e0fe288155921ded6 | GeorgeKinuthia77/Blog | /app/auth/forms.py | UTF-8 | 1,261 | 2.515625 | 3 | [
"MIT"
] | permissive | from flask_wtf import FlaskForm
from wtforms import BooleanField,PasswordField,SubmitField,StringField,TextAreaField,ValidationError
from wtforms.validators import Required,Email,EqualTo
from ..models import User
class RegistrationForm(FlaskForm):
"""
Form to register new users
Args:
FlaskForm:
... | true |
af5d3dbfa5033e5e306b8e188bcd35356fc346f3 | thtran97/UF-Machine-Learning | /TP_supervised_learning/TP1/TP1_prog2.py | UTF-8 | 4,267 | 3.140625 | 3 | [] | no_license | # import library
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import fetch_openml
import random
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier as KNNs
from sklearn.metrics import classification_report
from sklearn.metrics import confus... | true |
5da07f7b56274b2ec15d096cc28ac8a3d0c81f5b | Python-study-f/Algorithm-study_2H | /October_/211010/13422_Thief/13422_21008_minsuk1.py | UTF-8 | 543 | 2.703125 | 3 | [] | no_license | import sys; input=sys.stdin.readline;
t=int(input())
for _ in range(t):
n,m,k=map(int,input().split())
data=list(map(int,input().split()))
if n==m:
print(1) if sum(data[:m])<k else print(0)
continue
start=0; end=0; interval=0; ans=0; tmp_cnt=0
for start in range(n):
... | true |
0848575ca01651b9bb6537f14f3bfed51065e8b9 | R151865/cloud_9_files | /testing/testing_submissions/mock/test_file.py | UTF-8 | 769 | 2.75 | 3 | [] | no_license | from unittest.mock import patch
from is_weekend import is_weekend_using_get_current_day,is_weekend
"""
@patch('get_current_day.get_current_day')
def test_is_weekend_using_get_current_day_on_weekend(get_current_day_mock):
get_current_day_mock.return_value=6
result = is_weekend_using_get_current_day()
... | true |
c6972bba403c2b6d49845b41992212e149bacdca | dwrowell/Automate-the-boring-stuff-code-practice | /pictureGrid.py | UTF-8 | 888 | 3.453125 | 3 | [] | no_license | #example code from chaper 4 of ATtBS
#Desired Output:
#..OO.OO..
#.OOOOOOO.
#.OOOOOOO.
#..OOOOO..
#...OOO...
#....O....
grid = [['.', '.', '.', '.', '.', '.'], #starting grid
['.', 'O', 'O', '.', '.', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['O', 'O', 'O', 'O... | true |
9f5591a4f8e646ee68d04dff6cc10416fc69ffc6 | tienvm/python | /EnumerateVM.py | UTF-8 | 150 | 3.25 | 3 | [] | no_license | __author__ = 'tienvm'
x = [1, 5, 7, 3, 8]
ListXEnumerates = list(enumerate(x))
for a, b in ListXEnumerates:
print('X[{0}] = {1}'.format(a, b))
| true |
c327d63b9a5d2c572740bc8a1311d1f5c296584d | fabiancabau/MessingAround | /Util.py | UTF-8 | 369 | 3.3125 | 3 | [] | no_license | from random import randrange
def _generate_unique_id():
text = ""
possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
for i in range(0, 5):
rand = randrange(0, len(possible))
text += possible[rand]
return text
def _remove_unique_id_on_list(lista, unique_id):
... | true |
30df82b2797404028e1bd3d084067f1fa8fc7657 | Terryand/Leetcode | /problem_5.py | UTF-8 | 296 | 2.796875 | 3 | [] | no_license | class Solution:
def longestPalindrome(self, s):
"""
:type s: str
:rtype: str
"""
sLen = len(s)
centerIndex = int(len(s) / 2)
if (len(s) % 2 != 0)
sol = Solution()
sol.longestPalindrome('abab'); | true |
3939464c0b632598be92f4a5918ab9c90eb5f721 | GeekerWu/manager | /back-end-prj/camera.py | UTF-8 | 439 | 2.59375 | 3 | [] | no_license | import os
os.environ['LD_PRELOAD'] = '/usr/lib/arm-linux-gnueabihf/libatomic.so.1'
import cv2
cap=cv2.VideoCapture(0)
while(True):
ret, frame = cap.read() #读取帧
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) #灰度化展示
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'): ... | true |
3800e23b84affb4be62ea1957394bf6d89116278 | PrinzEugen7/Statistics | /Python/Basic/pow.py | UTF-8 | 116 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def main():
x = 5
y = pow(x,2)
print(y)
if __name__ == "__main__":
main()
| true |
50d142331e42656f139d904bf9362942a2c170da | kbcao/leetcode | /1014/1014_ckb.py | UTF-8 | 512 | 3.34375 | 3 | [
"MIT"
] | permissive | # 没想出来,关键在于拆分目标
# A[i] + A[j] - (j-i) 拆分成 A[i]+i + A[j]-j 遍历每一个j,但是A[i]+i的最大值可以通过一次遍历完成
# 其中 i<j
class Solution:
def maxScoreSightseeingPair(self, A) -> int:
aii = A[0]+0
res = -1
for i in range(1, len(A)):
res = max(res, A[i]-i+aii)
aii = max(aii, A[i]+i)
r... | true |
f146d731842ddf31fd3277b580e8af1d187c4126 | huynhbaobk/UNET | /utils.py | UTF-8 | 3,163 | 2.6875 | 3 | [] | no_license | import torch
import torchvision
from dataset import WindowsDataset
from torch.utils.data import DataLoader
import numpy as np
from torch.utils.data.sampler import SubsetRandomSampler
def save_checkpoint(state, filename="my_checkpoint.pth.tar"):
print("=> Save checkpoint")
torch.save(state, filename)
def load... | true |
8c719fc8693c28bf02314ab193ac7911e4d1f715 | gpleyson/crystaltools | /examples/solution_enthalpy_analysis/aydin_extract_murnagahn.py | UTF-8 | 10,191 | 2.71875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from collections import namedtuple
import crystaltools.vasprun_parser as vp
import crystaltools.fetch_tools as ft
import crystaltools.crystal_generator as cg
import crystaltools.murnagahn as murn
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.style.use('ggplot')
... | true |
6f9ab8ecbd79d76fbeecc986a850da87baa1d05f | vasekch/octopuslab | /esp32-micropython/lib/keypad_i2c.py | UTF-8 | 1,632 | 2.96875 | 3 | [] | no_license | class keypad():
def __init__(self, i2c, address=0x21):
self.i2c = i2c
self.address = address
self.KEYPAD = [
['1', '2', '3', 'A'],
['4', '5', '6', 'B'],
['7', '8', '9', 'C'],
['*', '0', '#', 'D']
]
self.ROW = [0,1,2,3]
... | true |
dbc29c11bbc54d816b526ad0c4d6511b1aae0b99 | seleniumbase/SeleniumBase | /examples/offline_examples/test_demo_page.py | UTF-8 | 4,833 | 2.875 | 3 | [
"MIT"
] | permissive | import os
import pytest
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)
@pytest.mark.offline # Can be run with: "pytest -m offline"
class OfflineTests(BaseCase):
def test_demo_page(self):
# Load a local html file into the web browser
dir_path = os.path.dirname(os.path.abspath(... | true |
8f1c86b29c718a8e19f96dd468505dac0614495b | fuguegrosso/Modal474 | /TD3/Question6_et_7.py | UTF-8 | 2,117 | 3.09375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
m = int(3e2)
n1 = int(1e5)
n2 = int(1e5)
a = 7.
Si = np.linspace(a/2, 3*a, m)
G = np.random.randn(n1)
V = []
for si in Si:
V.append( np.mean( (si**2)*(abs(si*G)>a) * np.exp(-(si**2-1)*G*G) ) )
#Remarque : cette etape peut ... | true |
0467b3a6ce6166fb3db0a54f190b916e4b9f6db1 | coseo12/ronacorona-dashboard | /data.py | UTF-8 | 2,093 | 2.90625 | 3 | [] | no_license | import pandas as pd
conditions = ["confirmed", "deaths", "recovered"]
def dropdown_options(df):
return df.sort_values("Country_Region").reset_index()[
"Country_Region"]
def daily_totals_df():
daily_df = pd.read_csv("data/daily_report.csv")
totals_df = daily_df[["Confirmed", "Deaths",
... | true |
8c5bcf8dbf63ed3e335cc602731058ca4dabc923 | PrateekKumarSingh/Presentations | /Generative-AI-using-Azure/completions_codex.py | UTF-8 | 641 | 2.6875 | 3 | [] | no_license | #Note: The openai-python library support for Azure OpenAI is in preview.
import os
import openai
openai.api_type = "azure"
openai.api_base = os.getenv("OPENAI_ENDPOINT")
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.api_version = "2022-12-01"
prompt = "write a python function that take city name as a parameter, ... | true |
1c2951fc48b4043025957f8e6e81aebf6beacd05 | Mokanarangan/UOM-Allen | /allennlp/data/iterators/epoch_tracking_bucket_iterator.py | UTF-8 | 3,002 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import logging
from typing import List, Tuple
import warnings
from allennlp.common.params import Params
from allennlp.data.iterators.data_iterator import DataIterator
from allennlp.data.iterators.bucket_iterator import BucketIterator
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
@DataIterator... | true |
fce5791b82726f601d0d35cd1eeb31674d0c2dc5 | ogrudko/leetcode_problems | /easy/merge_sorted_lists.py | UTF-8 | 868 | 3.859375 | 4 | [] | no_license | '''
Problem:
Merge two sorted lists
'''
class Solution:
'''
Merges two sorted lists
'''
def merge_sorted_lists(self, first_list, second_list):
new_list = []
max_len = 0
if len(first_list) >= len(second_list):
max_len = len(first_list)
else:
max_le... | true |
b12d72cb2aa100038a94b81e32df8a253d0971d3 | chr15m/django-ckeditor | /ckeditor/views.py | UTF-8 | 5,376 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | import os
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
try:
from PIL import Image, ImageOps
except ImportError:
import Image, ImageOps
try:
from django.views.decorators.csrf ... | true |
e05d8b50abef06f087fd7593c4fa66fbf016a292 | imdp4/HackerRank | /Python/Introduction/Python_If-Else.py | UTF-8 | 1,136 | 3.9375 | 4 | [] | no_license | """
Python If-Else
Task
Given an integer, n, perform the following conditional actions:
If n is odd, print Weird
If n is even and in the inclusive range of 2 to 5, print Not Weird
If n is even and in the inclusive range of 6 to 20, print Weird
If n is even and greater than 20, print Not Weird
Input Format
A single l... | true |
950bcc72188c0a7949e60574e051988f00c8064b | krpharr/MIT-6.00-Coursework | /assingments/06/ps6_4.py | UTF-8 | 12,084 | 3.4375 | 3 | [
"Giftware"
] | permissive | # Problem Set 5: 6.00 Word Game
# Name:
# Collaborators:
# Time:
#
import random
import string
import time
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
time_limit = 0.01
SCRABBLE_LETTER_VALUES = {
'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k': 5, 'l':... | true |
30d43feceae1413e5c67a3720fd81ecf50e1b423 | juancsosap/pythontraining | /projects/logic/app.py | UTF-8 | 1,233 | 3.140625 | 3 | [] | no_license | from data import Bit, Byte
from blocks import Adder
def main():
b1 = Bit(1)
b2 = Bit(True)
print(' ', 'not', b1, ':', ~b1)
print(b1, 'and', b2, ':', b1 & b2)
print(b1, 'or ', b2, ':', b1 | b2)
print(b1, 'xor', b2, ':', b1 ^ b2)
B11 = Byte('10101010')
B12 = Byte('11111111')
B21 = By... | true |
37b0019776c9d0434878475fbe66f8ed734059cd | singham3/python-programs | /photo in tkinter.py | UTF-8 | 416 | 3.40625 | 3 | [] | no_license | from tkinter import *
root=Tk()
w=Canvas(root,width=200, height=100)
w.pack()
w.create_rectangle(50,20,150,80,fill='green')
w.create_rectangle(65,35,135,65,fill='yellow')
w.create_line(0,0,50,20,width=2,fill='red')
w.create_line(0,100,50,80,width=2,fill='red')
w.create_line(150,20,200,0,width=2,fill='red')
w.create_l... | true |
89609b6a76caa8e9a4e4eaa444272fb262b4f65c | caowenqing/python- | /equation_x.py | UTF-8 | 725 | 3.6875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import math
def quadratic(a, b, c):
if(a==0):
x1=x2=-c/b,
return (x1)
else:
delta=b*b-4*a*c
if(delta<0):
print("此方程无解")
else:
x1=(-b+math.sqrt(delta))/(2*a)
x2=(-b-math.sqrt(delta))/(2*a)
return (x1... | true |
87a8211e0a138d8dd6c8775cf9e31f491f04da7c | Tarang-1996/100-days- | /bot1.py | UTF-8 | 2,947 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''from chatterbot import ChatBot
# Create a new chat bot named Charlie
chatbot = ChatBot(
'Charlie',
trainer='chatterbot.trainers.ListTrainer'
)
chatbot.train([
"Hi, can I help you?",
"Sure, I'd like to book a flight to Iceland.",
"Your flight has been booked."
])
# Get a... | true |
8511a42f1315a0cff4254488b5b12da376d94304 | thedyrt/alltheplaces | /locations/spiders/sunloan.py | UTF-8 | 2,365 | 2.515625 | 3 | [
"CC0-1.0",
"MIT"
] | permissive | import json
import scrapy
from locations.items import Feature
DAYS = {
"Monday": "Mo",
"Tuesday": "Tu",
"Wednesday": "We",
"Friday": "Fr",
"Thursday": "Th",
"Saturday": "Sa",
"Sunday": "Su",
}
class SunLoanSpider(scrapy.Spider):
name = "sunloan"
item_attributes = {"brand": "Sun ... | true |
6a4472dd5aa70132142abd827a754c7b52aa9d9d | goosling/PythonTest | /spider/test.py | UTF-8 | 459 | 2.9375 | 3 | [] | no_license | __author__ = 'joe'
import urllib2
req = urllib2.Request('http://www.baibai.com/')
try:
urllib2.urlopen(req)
except urllib2.URLError, e:
# print e.code
# print e.reason
if hasattr(e, 'code'):
print 'the server could not fulfill the request '
print 'Error code', e.code
elif hasattr(e... | true |
05be0a5ba5acd7c7b435a95df5cbe95928947159 | buckinha/galemojiga | /src/galemojiga/game_objects/Enemies.py | UTF-8 | 17,013 | 3.046875 | 3 | [] | no_license | from galemojiga.game_objects.Bullets import *
import galemojiga.globals as globals
from galemojiga.game_objects.Players import Player
from galemojiga.game_objects.Effects import SunBoom
ENEMY_OFFSET = 41
class Enemy(GameObject):
def __init__(self, game_context):
self.game_context = game_context
s... | true |
694580fd55052cee5d024c1a82a960c8a1542e60 | gurpartap0306/algorithms | /sorting/countsort.py | UTF-8 | 673 | 3.75 | 4 | [] | no_license | def count_sort(a,b,key):
c=[]
i=0
while i <= key: #make list c of length key+1
c.append(0)
i+=1
i=0
while i<len(a): #c holds no of elements of particular values
c[a[i]]=c[a[i]]+1
i+=1
i=1
while i<= key: #c holds ... | true |
f04ef35fa40492ce07704b29b7a595906b9ac328 | kennethburgener/PyTemper | /pytemper.py | UTF-8 | 3,147 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
The MIT License
Copyright (c) 2008 Anthony Lieuallen ( http://arantius.com/ )
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without lim... | true |
866e27678ac8e0523ad1f2ee3400b471320f4334 | luwzko/Steganic | /utils/write_util.py | UTF-8 | 859 | 2.515625 | 3 | [] | no_license | from PIL import Image
from colorama import Fore, init, Back
def pxwritelength(image_file, msg):
try:
im = Image.open(image_file)
rgb = im.convert("RGB")
width, height = im.size
pixel_tuple = rgb.getpixel((width - 1, height - 1))
rgb.putpixel((width - 1, height - 1),... | true |
c496770cd3610d285415d1ea7ca9522f8c5d7a7a | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4477/codes/1800_2565.py | UTF-8 | 510 | 3.421875 | 3 | [] | no_license | # Módulo
from numpy import *
# Entrada
MF = array(eval(input("Media Final: "))) # Média Final
PA = array(eval(input("Presenca: "))) # Presença
CH = array(eval(input("Carga horaria: "))) # Carga Horária
# Contador do Vetor
cont = zeros(3, dtype=int)
# Laço "For"
for i in range(size(MF)):
... | true |
a3cfaf541de0b5d24432e0a615cf91a2a2d31842 | hashbash1/school-projects | /tf-idf.py | UTF-8 | 1,869 | 2.734375 | 3 | [] | no_license | import pyspark
import pyspark.sql.functions as F
from pyspark import SparkConf, SparkContext
from pyspark.sql import SparkSession, SQLContext, Row
from pyspark.sql.types import StructType, StructField, StringType, IntegerType
# Find how many files are in the location
files = 100
def main(sc):
# Load file i... | true |
3aca0076633a4e22a2cacce826c0ea33b03c29e8 | AndreyBalabanov/e1-tg-bot | /e1-news-bot.py | UTF-8 | 2,523 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | # TODO
# 1. $$('div[class*="video"]') если в статье есть видео, нужно передавать ссылку на видео
# 2. Оторбажение фоток
# 3. Красивое форматирование текста
# 4. Логирование
# 5. Отслеживание ошибок
# 6. Болле точная проверка появления новых новостей
import requests
from bs4 import BeautifulSoup
import time
import tel... | true |
4b865f09e5ca8afafba230083a0d569bc1d53cd4 | Grub4K/bot.bat | /src/helpers/exp.py | UTF-8 | 584 | 3.625 | 4 | [
"MIT"
] | permissive | def exp_next_lvl(lvl):
"""\
returns the ammount of exp needed to reach next level"""
return 5 * (lvl * (lvl + 10) + 20)
def exp_bar(self, user, size=20):
"""\
Returns a string visualizing the current exp of the user as a bar.
"""
bar_length = user.exp * size // exp_next_lvl(user.lvl)
... | true |
fb312b0bec0ccc71503a71a3d451636f01e8abb2 | melisandeteng/duckietown-intnav | /lib-intnav/src/duckietown_intnav_tests/visual/path_as_image.py | UTF-8 | 653 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
###############################################################################
# Duckietown - Project intnav ETH
# Author: Marta Tintore
# Visualise path as image and display it for testing.
###############################################################################
import matplotlib.pyplot ... | true |
6e9c10b8105d5554c3afcfeeca1c32941bd1c604 | Aasthaengg/IBMdataset | /Python_codes/p03150/s729807274.py | UTF-8 | 242 | 2.734375 | 3 | [] | no_license | import sys
S = input()
for i in range(len(S) + 1):
for j in range(i, len(S) + 1):
erased = S[:i] + S[j:]
# print(i, j, erased)
if erased == "keyence":
print("YES")
sys.exit()
print("NO")
| true |
7d8e829ba28a7528052fc9c1fb16583a27a13258 | hakimi-laji/VigenereChat | /server.py | UTF-8 | 2,456 | 3.15625 | 3 | [] | no_license | # Python program to implement server side of chat room.
import socket
import select
import sys
import random
import string
from thread import *
# socket stuffs - dont bother
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# chec... | true |
c5ee1673bc85503717f85c22c327aebc0c4f4cc7 | 0154155lizhijian/PythonSpider | /0154155/news/new_one.py | UTF-8 | 1,203 | 3.09375 | 3 | [] | no_license | # 引入相关模块
import requests
from bs4 import BeautifulSoup
import re
url = "http://news.qq.com/"
# 请求腾讯新闻的URL,获取其text文本
wbdata = requests.get(url).text
# 对获取到的文本进行解析
soup = BeautifulSoup(wbdata,'lxml')
# 从解析文件中通过select选择器定位指定的元素,返回一个列表
news_titles = soup.select("div.text > em.f14 > a.linkto")
# 对返回的列表进行遍历
#... | true |
b8a496d8bb0d3c683e0a614aeea20d5d2267debe | hideyk/Challenges | /hackerrank/python/18. exceptions.py | UTF-8 | 347 | 3.59375 | 4 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
def divideNumbers(a, b):
try:
print(int(a)//int(b))
except ZeroDivisionError as e:
print("Error Code:", e)
except ValueError as e:
print("Error Code:", e)
noInputs = int(input())
for i in range(noInputs):
divi... | true |
f3fac35013d7f3182c3c5498d7927fc135bbcaf7 | Aasthaengg/IBMdataset | /Python_codes/p03494/s953123153.py | UTF-8 | 396 | 2.90625 | 3 | [] | no_license | # vim: fileencoding=utf-8
def main():
n = int(input())
li = list(map(int, input().split()))
c = 0
end = False
while True:
for i in range(n):
if li[i] % 2:
end = True
break
li[i] = li[i] / 2
if end:
break
el... | true |
b2cff8ff5e8e5359a8910188889dad3e2edefb59 | Baijnath559/MLOps2021 | /Task1/Model.py | UTF-8 | 353 | 3.203125 | 3 | [] | no_license |
import pandas as pd
df = pd.read_csv('Salary_Data.csv')
x = df['YearsExperience']
x = x.values
x = x.reshape(30,1)
y = df['Salary']
from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(x,y)
model.coef_
predicted_value = model.predict([[2.5]])
print("Predited salary for feature value 2... | true |
a06635825c4fb70f497070c15589520ead314dde | LokeshVadlamudi/DataStructuresLC | /Day8.py | UTF-8 | 4,699 | 3.140625 | 3 | [] | no_license |
#LC - 332. Reconstruct Itinerary (uber mock)
# import collections
#
# tickets = [["MUC","LHR"],["JFK","MUC"],["SFO","SJC"],["LHR","SFO"]]
#
# #recursive method
# targets = collections.defaultdict(list)
#
# for a , b in sorted(tickets):
# targets[a] += b,
#
# print(targets)
#
# t = {}
# for a,b in sorted(tickets)[:... | true |
c8c60057d6ee8be410d6431e070971a6c3282331 | mxcreus/GetStarted | /Learn Python/3.5.py | UTF-8 | 1,349 | 3.75 | 4 | [] | no_license | '''
文本进度条
import time
scale = 100
print("-------执行开始--------")
for i in range(scale + 1):
a = "*" * i
b = "." * (scale - i)
c = (i/scale)*100
print("{:.3f}%[{}->{}]".format(c,a,b))
time.sleep(0.1)
print("-------执行结束---------")
文本进度条刷新
刷新本质:用后打印的字符覆盖的字符
不能换行:print()需要被控制
要能回退:打印后光标回退到之前的位置\r
i... | true |
60a8ae6b92783a1b8dff667065866dfed9e75dff | Eghosa-Osayande/solfa-to-wavfile | /solpha/instrument.py | UTF-8 | 2,024 | 2.609375 | 3 | [] | no_license | import os
from .pydub_custom import AudioSegment
def list_instruments():
'''
returns list of current instruments
so far, I only added violin, but I dont plan on adding any other soon
'''
instru_names= os.listdir(os.path.join('instruments'))
return instru_names
def set_sound_duration(sound, l... | true |
e8a80d0a0bba09d078abd63481941ceae712fbb5 | lucasOlivio/Cursos_online | /Udemy/Python mega course/loops/userInput.py | UTF-8 | 190 | 3.734375 | 4 | [] | no_license | def currency_converter(rate, euros):
dollars = euros * rate
return dollars
r = input("\nrate?\n")
e = input("\neuros?\n")
print("\n",currency_converter(float(r),float(e)))
| true |
f5951e959701ea40c83fa91b77cb9a14d673f2eb | yrath/transformer | /transformer/sublayers.py | UTF-8 | 2,623 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
import torch
from torch import nn
import torch.nn.functional as F
class PositionEncoder(nn.Module):
def __init__(self, d_model, max_seq_size):
super().__init__()
positional_encoding = torch.zeros(max_seq_size, d_model)
for pos in range(max_seq_size):
... | true |
c300ee79b6650e3f01739a2269c6e1f0fcad535c | bright-night-sky/algorithm_study | /CodeUp/Python 기초 100제/6072번 ; 정수 1개 입력받아 카운트다운 출력하기1.py | UTF-8 | 433 | 3.515625 | 4 | [] | no_license | # https://codeup.kr/problem.php?id=6072
# readline을 사용하기 위해 import합니다.
from sys import stdin
# 1 ~ 100 사이인 정수 1개를 입력합니다.
# 정수형으로 변환합니다.
num = int(stdin.readline())
# num의 값이 0이 아니면 계속 반복합니다.
while num != 0:
# num의 값을 출력합니다.
print(num)
# num의 값에서 1을 빼고 다시 num에 넣어줍니다.
num -= 1 | true |
f440aed42ed1dd4ba82fcefe16b5836f918701d8 | RomeBurns/other_projects_for_richardi | /assignedproblems/planets.py | UTF-8 | 613 | 4 | 4 | [] | no_license | mass = int(input("what is your weight in pounds on Earth? "))
planet = int(input("I have information for the following planets. Enter the number corresponding to the planet you wish to know your weight on: \n 1:Venus 2:Mars 3:Jupiter 4:Saturn 5:Uranus 6:Neptune \nChosen Planet: "))
if planet == 1:
pr... | true |
a2d6a2f01acc3241a6fbeefed6b61ae546f67521 | nwatters01/spriteworld-physics | /spriteworld_physics/forces.py | UTF-8 | 6,418 | 3.1875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | """Collection of pairwise forces for physics in Spriteworld."""
# pylint: disable=import-error
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import numpy as np
import six
@six.add_metaclass(abc.ABCMeta)
class AbstractForce(object):
"""Ab... | true |
f17b310169ba5c8bad6291c0c9cc13cb31d6ad41 | Azure-Samples/cognitive-services-quickstart-code | /python/QnAMaker/sdk/preview-sdk/quickstart.py | UTF-8 | 8,329 | 2.546875 | 3 | [
"MIT"
] | permissive | # install QnA Maker package on Windows with command:
# py -m pip install azure-cognitiveservices-knowledge-qnamaker
# install QnA Maker package on Mac/Linux with command:
# pip install azure-cognitiveservices-knowledge-qnamaker
# ==========================================
# Tasks Included
# ==========================... | true |
86abd586fc482d24789be2e4a62a09a572d050e8 | SoheeKwak/Python | /workspace/python_study/p.113_8.py | UTF-8 | 34 | 2.8125 | 3 | [] | no_license | a=100
a= a<<100
a= a>>100
print(a) | true |
3a5f87a7be99200422b2394da359c1d42f7f1e29 | kevinsantana/exercicios | /cursos/Machine Learning e Data Science com Python ATUALIZADO/svm_credit_data_v2.py | UTF-8 | 1,446 | 3.171875 | 3 | [] | no_license | '''
Prever se o cliente vai ou nao pagar o emprestimo
'''
import pandas as pd
# Tratamento das idades invalidas
base = pd.read_csv('credit_data.csv')
base.loc[base.age < 0, 'age'] = 40.92
# Divisao de previsores e classes
previsores = base.iloc[:, 1:4].values
classe = base.iloc[:, 4].values
# Retira valores faltan... | true |
00f5983ea4aa39ebe556824fba1a885fc6abd392 | FrantisekHrdina/PV248 | /08-stats/student.py | UTF-8 | 5,003 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
from datetime import date, timedelta, datetime
import pandas as pd
import sys
import re
import json
import numpy as np
def get_list_of_students_ids(pandas_data):
ids = []
for i in pandas_data['student']:
ids.append(i)
ids.sort(reverse=False)
return ids
def precount... | true |
9ed5ad10180b468ec91a66cd11806c81348accc2 | tonydelanuez/python-ds-algos | /probs/1-5-one-away.py | UTF-8 | 1,282 | 4.375 | 4 | [] | no_license | """
One Away: There are three types of edits that can be performed on the strings: insert a character, remove a character, or replace a character. Given two strings, write a function to check if they are one edit (or zero edits) away.
EXAMPLE:
pale, ple -> true
pales, pale -> true
pale, bale -> true
pale, bake -> fal... | true |
4562609675871955b96084cfeaad967e354e6ef9 | kornelro/serverless-api | /Utils/ReqManager.py | UTF-8 | 2,470 | 2.734375 | 3 | [] | no_license | from ..Model.Product import Product
import azure.functions as func
from .ExceptionWithStatusCode import ExceptionWithStatusCode
class ReqManager():
def getProduct(self, req: func.HttpRequest) -> Product:
req_body = req.form
# get id
try:
id = req_body['id']
except Key... | true |
0b000729f1d9745b909ec81ade416ae7d233008b | cgnorthcutt/forum-diversification | /gold_data_model_analysis/make_pairwise_gold_metric_scores.py | UTF-8 | 5,514 | 2.53125 | 3 | [] | no_license |
# coding: utf-8
# In[ ]:
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
# In[11]:
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from scipy.stats import rankdata
from sklear... | true |
5d273619cba35b549baa7f58f1c3534c3d834308 | saiswaroopreddy/CAISO-python-Automation | /Download_CAISO_data.py | UTF-8 | 7,409 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 25 17:16:52 2018
@author: pqwa001
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import seaborn as sns
import calendar
import sys
matplotlib.rcParams['figure.figsize'] = (15, 10)
from datetime import dateti... | true |
014851e0749630026157a6aca956efc6e286ff19 | DataAnalysisMentoring/json_files | /results/HP_cviceni_1_cteni+print.py | UTF-8 | 443 | 2.828125 | 3 | [] | no_license | # Načíst soubor data\aktualne_cz0.json a celý ho vypsat. Výpis bude postupně po jednotlivých položkách ve formátu
import json
import os
files_folder = 'C:/Users/hpavlasova/Desktop/PyMum/DictListJSON/json_files/data'
soubor='aktualne_cz0.json'
file=os.path.join(files_folder, soubor)
with open(file, 'r', encoding='ut... | true |
b79867d1f60ba8fb6828b16d5a277e2407b9c0ac | jadrew43/WGAN | /pgm2png_random.py | UTF-8 | 3,765 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 30 13:56:10 2018
@author: colinpate
"""
import numpy as np
from scipy.ndimage import gaussian_filter
import os
import argparse
from PIL import Image
#parser = argparse.ArgumentParser()
#parser.add_argument("--input_dir", required=True, help="path to folder containing im... | true |
7ad9fc2ed794cff62ece574776b8a2669446ec23 | LiuYinCarl/cacheServer | /tools/md2html/md2html.py | UTF-8 | 1,865 | 3.140625 | 3 | [] | no_license | import re
import sys
is_head = True
def translate_line(line):
global is_head
if '```' in line:
if line.find('```') != 0:
return line
line = line.strip()
if len(line) == 3:
if is_head:
ret = '<pre><code class="">'
is_head = Fals... | true |
fa0b9c51bdb44398f959263e239cc3a7d8f73472 | DataReply/aiohdfs | /example/example.py | UTF-8 | 2,571 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | from aiohdfs import Client
import logging
logging.basicConfig(level=logging.DEBUG)
_LOG = logging.getLogger(__name__)
import asyncio
loop = asyncio.get_event_loop()
'''
Dirty way, you obviously would not do it this way.
You would call these from a coroutine and do yield from
'''
run_async= lambda f:loop.run_unt... | true |
f9dc772bc636c7e0b620749a1d7454c6491253f2 | CeON/chrum | /src/for_curious/wf_trans/idioms/seqIdiom.py | UTF-8 | 1,814 | 2.875 | 3 | [] | no_license | import re
###
# the fuction for substituting seq() idiom
###
class ConfigurationFileError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def isnumeric(x):
try:
int(x)
return True
except ValueError:
return False
def isvariable(... | true |
6717c3ea0ac05af29ff9fc0cafe4c719d019f0b3 | attrapezlapasteque/fr | /main_simulateur.py | UTF-8 | 1,510 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Script Python Example
import time
import sys
import simulator
import numpy as np
data_php = sys.argv #[2].replace('_',' ')
tmp = []
for x in data_php:
tmp.append(x.replace('_',' '))
user_team1 =tmp[1:15]
user_team2 =tmp[16:30]
# Name of the databse c... | true |
959cbb8b4717fc3a22bbc37ca07baa0991750c3f | hujiujie/SeleniumDemo_8 | /example/test_douban_login.py | UTF-8 | 1,629 | 2.78125 | 3 | [] | no_license | # coding=utf-8
#1. 用账号密码的方式登录豆瓣
#2. 检查登录是否成功
#3. pytest自动测试框架
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By
class TestLogin():
def test_login(self):
# 打开浏览器时去掉弹窗提示的您的浏览器正在受第三方监控
chrome_options = webdriver.ChromeOptions()
chrome_options.a... | true |
3630bd3b967876769cb5e591b56d139cbbfc53c9 | edpolanco/constraint_solver | /solver.py | UTF-8 | 9,090 | 3.765625 | 4 | [
"MIT"
] | permissive | """
Constraint propagation base solver abstract class
Author: Ed Polanco
Email: ed.polanco@outlook.com
"""
from abc import ABC, abstractmethod,ABCMeta
class ConstraintSolver(ABC):
"""
Constraint propagation base solver abstract class.
Uses elimination and only choice to solve con... | true |
0b8bb4f626f7c9f8bffe49097964080525d59742 | wangtianrui/TfDatasetApiTest | /DataSetApiTest.py | UTF-8 | 1,384 | 2.71875 | 3 | [] | no_license | import tensorflow as tf
import os
PICTURE_PATH = "F:/Traindata/MNIST_pictures/trainimage/pic2/"
NUM_CLASS = 10
def load_image():
all_classes = []
all_images = []
all_labels = []
for i in os.listdir(PICTURE_PATH):
curren_dir = os.path.join(PICTURE_PATH, i)
if os.path.isdir(curren_dir)... | true |
f9514a3b2bdf5d5e4731f3138dfd8bc29754f26d | fortable1999/shortcut_scripts | /update_hosts.py | UTF-8 | 504 | 2.515625 | 3 | [] | no_license | import sys
if len(sys.argv) < 2:
print('usage: python3 update_hosts.py <HOST> <KEY>')
exit(1)
key = sys.argv[-1]
ip = sys.argv[-2]
lines = []
with open('/etc/hosts') as fp:
for line in fp.readlines():
print(line)
splitted_line = line.split('\t')
if splitted_line[-1] == key + "\n":
... | true |
909144658fdcf2a8d3c7fcea5fc79dc47d78637f | camilabraatzz/Trabalho1.2 | /01.py | UTF-8 | 305 | 4.40625 | 4 | [] | no_license | #Faça um programa que calcule o fatorial de um número inteiro fornecido pelo usuário. Ex.: 5!=5.4.3.2.1=120
numero = int(input("Fatorial de: "))
resultado = 1
string = f'{numero}! = '
for n in range(numero, 0, -1):
resultado *= n
string = string + str(n) + '.'
print(f'{string} = {resultado}') | true |
1e575ab4b2a3def5549346daea93b44626c4e90c | BEugen/WaterCounter | /temperature.py | UTF-8 | 1,969 | 2.625 | 3 | [] | no_license | import time
import machine
import onewire, ds18x20
from machine import Pin
class Temperature(object):
def __init__(self, ow_pin, wh_en_pin, config, screen):
self.config = config
self.screen = screen
self.ds = ds18x20.DS18X20(onewire.OneWire(Pin(ow_pin)))
self.wh_en_pin = machine.P... | true |
43432fea31645f31469f76382d73f5dd6ff9684e | majiajue/LookingForQuantStar | /遗传算法因子挖掘/factor-maker/utils/fitness.py | UTF-8 | 572 | 2.90625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from gplearn.fitness import make_fitness
def _my_metric(y, y_pred, w):
value = np.sum(np.abs(y) + np.abs(y_pred))
return value
def _msle(y, y_pred, w):
value = np.square((np.log1p(y) - np.log1p(y_pred))).mean()
return value
def _mse(y, y_pred, w):
value ... | true |
cbb7dd80e23930894612235500965da7cffc559d | omargamal8/DataMiningProject_SpamFiltering | /Classifier/Classifier/classify.py | UTF-8 | 2,386 | 3.046875 | 3 | [] | no_license | import collections
import os
import parsing
ham = collections.Counter()
spam = collections.Counter()
spam_rating = collections.Counter()
ham_rating = collections.Counter()
def getAllFiles(top_directory):
files = []
for directory in os.listdir(top_directory):
if os.path.isfile(str(top_directory + direc... | true |
c710ba2d0a779aa1702502ea4e288552932b08dd | leisurehippo/TransformerModel | /transformer_model/masker.py | UTF-8 | 1,824 | 2.890625 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
class Masker(object):
def __init__(self):
"""
This class holds a collection of masking functions that are used across the entire package.
"""
@staticmethod
def create_padding_mask(seq):
"""
:param seq: the sequence to mask
:return: ... | true |
8b46eda26508c5054f5f308cb31bd7180083c8ef | juansvasquez/WarCards | /Vasquez, Juan Final Project Part 2.py | UTF-8 | 4,435 | 3.890625 | 4 | [] | no_license | import random
class Card:
ranknames =["Two", "Three", "Four", "Five", "Six", "Seven",
"Eight", "Nine", "Ten", "Jack", "Queen", "King", "Ace"] #len(13)
suitnames = ["Clubs", "Diamonds", "Hearts", "Spades"] #len(4)
def __init__(self,rank,suit):
self.rank = rank
self.suit = suit
... | true |
61d4b016d6d50344d99e2246d2ec5a8298a2171a | CodingTestAjou/Study | /Greedy/atm.woojeong.py | UTF-8 | 225 | 3.34375 | 3 | [] | no_license | getMoney = int(input())
myMoney = 1000
rest = myMoney - getMoney
coin_lst = [500, 100, 50, 10, 5, 1]
cnt = 0
for c in coin_lst:
k = int(rest / c)
if k > 0 :
cnt = cnt + k
rest = rest % c
print(cnt)
| true |
4c75a4b11c799cf3991c421ccd60f3e448e3b58f | ericchou-python/PyTapDEMON | /MininetTopology/controllers.py | UTF-8 | 1,504 | 3 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
"""
This example creates a multi-controller network from
semi-scratch; note a topo object could also be used and
would be passed into the Mininet() constructor.
"""
from mininet.net import Mininet
from mininet.node import Controller, OVSKernelSwitch
from mininet.cli import CLI
from mininet.log impor... | true |
32089f8f65001a2e258c8ef3ad70670c4e3df940 | Wallacoloo/woof-bat-signal | /bat-signal.py | UTF-8 | 414 | 2.84375 | 3 | [
"Unlicense"
] | permissive | from RPi import GPIO
import time
sense_pin = 22
supply_pin= 18
def init():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(sense_pin, GPIO.IN)
GPIO.setup(supply_pin, GPIO.OUT)
GPIO.output(supply_pin, GPIO.HIGH)
def check_state():
if GPIO.input(sense_pin):
print "HIGH"
else:
print "LOW"
i... | true |
ad765dd80816c1b90aa807ea081dafcf4d068a99 | snowdj/markdown-latex | /insert_equations.py | UTF-8 | 972 | 2.8125 | 3 | [
"MIT"
] | permissive | import urllib2
import re
import sys
RENDERER_URL = "http://latex.codecogs.com/png.latex"
def percent_encode(match):
return ".encode("utf-8")) + ")"
def replace_equations(s):
return re.sub("\$\$(.*?)\$\$", percent_encode, s)
if __name__ == "__main__":... | true |
bd055b408e24890c4090bc6ea61785d48a9ca9ee | tushar686/hackerrank | /CutTheSticks.py | UTF-8 | 443 | 3.234375 | 3 | [] | no_license | #!/usr/bin/py
def findNumberofAticksInACut(sticks):
print len(sticks)
minLength = min(sticks)
newSticks = []
for length in sticks:
if length - minLength != 0:
newSticks.append(length - minLength)
if len(newSticks) != 0:
findNumberofAticksInACut(newSticks)
if __name__... | true |
d329b76e7196378d7e3201aab830fd0f7ec858e0 | EFulmer/python-haskell | /python/main.py | UTF-8 | 746 | 2.625 | 3 | [] | no_license | from curio import run, spawn
from curio.socket import *
async def echo_server(address):
sock = socket(AF_INET, SOCK_STREAM)
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
sock.bind(address)
sock.listen(5)
print(f'Server listening at {address}')
async with sock:
while True:
cl... | true |
267f87323ef0ba35b137d502ea90bc0eff1db06d | neurodata/graspy-misc | /demo_parallel/demo_cores.py | UTF-8 | 320 | 2.75 | 3 | [] | no_license | import numpy as np
from joblib import Parallel, delayed
def _get_big_number():
big_number = np.random.randint(1e8)
return big_number
if __name__ == "__main__":
n_numbers = 10000000
np.random.seed(8888)
par = Parallel(n_jobs=4)
outs = par(delayed(_get_big_number)() for _ in range(n_numbers))
| true |
d8db85a44cf6efaf3442eeecdcc7048e42a23ba8 | nkboom/Mindstorms-ReinforcementLearning | /MindQ.py | UTF-8 | 11,714 | 2.515625 | 3 | [] | no_license | #Q Learning - Mindstorms
import random
from random import choice
from random import sample
import argparse
import GitQ
#Read in Command-Line Arguments via argparse - python MindQ.py --Iter <#> --Rand <0 or 1> --HappyStart <#> --TargetLocation <#>
parser = argparse.ArgumentParser()
parser.add_argument("--Iter", type=in... | true |
9807232b6aa6250507cd751e0742c57e2969b391 | goru108/FSM | /test.py | UTF-8 | 492 | 2.515625 | 3 | [] | no_license | # import sys
class readdb():
def __init__(self, textfile):
self.textfile=textfile
def readdb(self):
with open(self.textfile) as _text:
lines=_text.readlines()
_string=''.join(lines)
lines=[]
for lin in _string.split("\n"):
lines.append(lin.split... | true |
b94b79bd2a42fdd3dff49a331980af050ae9272f | Concarne2/ProjectEuler | /PEuler_098/PEuler_098.py | UTF-8 | 2,210 | 3.1875 | 3 | [] | no_license | import math
def swap(A,i,j):
temp = A[i]
A[i]=A[j]
A[j] = temp
def generate(n,A,word1,word2):
if n==1:
tryWithThis(A,word1,word2)
else:
for i in range(0,n-1):
generate(n-1,A,word1,word2)
if n%2==0:
swap(A,i,n-1)
else:
... | true |
c9bd3a0459681e802a743dbe3ae185b48be686db | HedaYang28/Data_Skills_2_project | /4pic.py | UTF-8 | 14,867 | 2.75 | 3 | [] | no_license | import os
import datetime as dt
import time
#from snownlp import SnowNLP
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
pd.set_option('display.width', 1000)
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
matplotlib.rcParams['... | true |
4213240c4d6de23b4250cdacd19be0419cf6186b | gherreraa1/robot_vision | /practicas/implementaciones/07/practica3_1.py | UTF-8 | 1,527 | 2.5625 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
# multiple cascades: https://github.com/Itseez/opencv/tree/master/data/haarcascades
# https://github.com/Itseez/opencv/blob/master/data/haarcascades/haarcascade_frontalface_default.xml
face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
# https://github.com/Itseez... | true |
ec7c89dbfcfecdad41ca65dbc19aed0daf9cedca | Obyka/HEIGVD-SWI-Labo1-MAC-1 | /deauth.py | UTF-8 | 1,349 | 2.515625 | 3 | [] | no_license | import argparse
import sys
from scapy.all import *
# Création d'argument en tant qu'arguments obligatoires
parser = argparse.ArgumentParser()
parser.add_argument("client", help="MAC address of the targeted STA")
parser.add_argument("ap", help="MAC address of the AP")
parser.add_argument("reason", help="Reason to put in... | true |
c20c8666d50ccd005c9eef1312ef8405556b6114 | yunlzheng/power-ansible | /power/engine/ansible/hosts.py | UTF-8 | 827 | 2.59375 | 3 | [] | no_license | # coding=utf-8
# !/usr/bin/python
class Hosts():
def __init__(self, hosts=None):
self.hosts = {}
def add_host(self, ip, remote_user, port, group_name=None, private_key=None):
host = Host(ip, remote_user, port)
if not self.hosts.has_key(group_name):
self.hosts[group_name] ... | true |
d84fe8d1ada7419ccd8bcdbbf54f6157e9d204d0 | bmarcote/seffers | /fringeSelect.py | UTF-8 | 3,960 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import sys
import numpy as np
import math
import webbrowser
import requests
from os import path,remove
from stations import Station
from util_functions import *
from sources import Flux,Source,load_rfc_cat, get_up_sources
def print_sources(sources):
print("{:>2} {:4} {:12... | true |
02b544df7ca2b86b40ee707ad1c8d22bee4d6c7e | Prat9501/Data_Structure | /leetcode/136-Single_number.py | UTF-8 | 672 | 3.390625 | 3 | [] | no_license | # Example 1:
#
# Input: [2,2,1]
# Output: 1
# Example 2:
#
# Input: [4,1,2,1,2]
# Output: 4
class Solution:
def singleNumber(self, nums: List[int]) -> int:
# duplicates = []
# for num in nums:
# if num not in duplicates:
# duplicates.append(num)
# else:
... | true |
9d717cb81f829f434bf58f2741c92e85b7b93e8c | pytorch/botorch | /botorch/settings.py | UTF-8 | 2,944 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
r"""
BoTorch settings.
"""
from __future__ import annotations
from botorch.logging import LOG_LEVEL_DEFAULT, logger... | true |
d9528f2f9ba335bb0f81c361e7e5056178267fbf | geofiber/master | /src/mpet/1_network/get_source_terms.py | UTF-8 | 1,497 | 3.109375 | 3 | [] | no_license | from sympy2fenics import str2sympy, sympy2expr, grad, div, sym, eps
from sympy import symbols, sympify, simplify, diff, eye, sin, cos, pi, exp
# Symbols for differentiation
x, y, t, alpha, mu, lamb, c, K = symbols("x y t alpha mu lamb c K")
def get_source_terms(u, p, version="biot"):
""" Function that computes the s... | true |