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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1184c9828054edc7613be40c0db3e74ec88cdaef | Python | DevanshiAP/TicTacToe | /practice.py | UTF-8 | 4,176 | 3.015625 | 3 | [] | no_license | # a=int(input("enter number:"))
# b=a-1
# for i in range(a):
# for j in range(a):
# if(i == j):
# print("x",i,end=" ")
# elif (b == j):
# print("x",b,end=" ")
# b-=1
# else:
# print(" ",end=" ")
# print("\n")
# #zip and filter
# CTemp_a=... | true |
234c62968de9b0e8184ee40affb6e0a5f5cc2f1e | Python | sbirmi/bari | /src/fwk/MsgSrc.py | UTF-8 | 5,482 | 2.875 | 3 | [] | no_license | """Infra piece to manage a bunch of source message sources and
websockets.
MsgSrc1 --> +-------------+
| | --> WebSocket1
MsgSrc2 --> | Connections |
| | --> WebSocket2
MsgSrc3 --> +-------------+
If a new connection is added, last cached messages from
each MsgSrc to th... | true |
0d5956f5565778be9c00ceca2db9616b5858be34 | Python | NChesser/learning_examples | /Python/digit_factorials.py | UTF-8 | 204 | 3.4375 | 3 | [] | no_license | import math
def digit_factorial(num):
digits = [math.factorial(int(n)) for n in str(num)]
return sum(digits) == num
print(sum([i for i in range(3, 10**6) if digit_factorial(i)]))
| true |
9a9de1dd60425297374adb1a5e851f33598683fb | Python | mikedh/trimesh | /trimesh/exchange/urdf.py | UTF-8 | 6,147 | 2.625 | 3 | [
"MIT"
] | permissive | import os
import numpy as np
from ..constants import log, tol
from ..decomposition import convex_decomposition
from ..version import __version__
def export_urdf(mesh,
directory,
scale=1.0,
color=None,
**kwargs):
"""
Convert a Trimesh object int... | true |
030d3a05dc93c4c55aea2f7b0790c54cf6da8932 | Python | yokoyk/leetcode | /array/foursum.py | UTF-8 | 796 | 3.578125 | 4 | [] | no_license | def foursum(list, target):
list.sort()
results = []
for i in range(len(list)):
for j in range(i+1, len(list)):
k = j + 1
z = len(list) - 1
while k < z:
sum = list[i] + list[j] + list[k] + list[z]
if sum < target:
... | true |
38a3d8060ffef8c2dc63fc7a19e9557e2fccbe3a | Python | jayson-chao/Miiko-Bot | /Miiko Bot/commands/preference.py | UTF-8 | 1,622 | 2.59375 | 3 | [] | no_license | # preference.py
# Preference Settings for Miiko Bot - set on a server-by-server basis.
import discord
from discord.ext import commands
from bot import MiikoBot
from common.aliases import pref_aliases, pref_settings
import models
from main import CMD_PREFIX
bool_true_strings = {'True', 'true', 'on'}
bool_false_string... | true |
ef130a2b0477ace9a0230aff463efd0fa1504fa0 | Python | scrapy/scrapy | /scrapy/utils/template.py | UTF-8 | 918 | 3.4375 | 3 | [
"BSD-3-Clause"
] | permissive | """Helper functions for working with templates"""
import re
import string
from os import PathLike
from pathlib import Path
from typing import Any, Union
def render_templatefile(path: Union[str, PathLike], **kwargs: Any) -> None:
path_obj = Path(path)
raw = path_obj.read_text("utf8")
content = string.Tem... | true |
b75fbdeb25fe3667bc9d13343170202bd31cabcb | Python | atharva0401/Python-Practice | /graph_basics.py | UTF-8 | 2,788 | 3.3125 | 3 | [] | no_license | ''' Python Program to perform operations on graphs.'''
import urllib2
EX_GRAPH0={0:set([1,2]),1:set([]),2:set([])}
EX_GRAPH1={0:set([1,4,5]),1:set([2,6]),2:set([3]),3:set([0]),4:set([1]),5:set([2]),6:set([])}
EX_GRAPH2={0:set([1,4,5]),1:set([2,6]),2:set([3,7]),3:set([7]),4:set([1]),5:set([2]),6:set([]),7:set([3]),8... | true |
68e48187802d10ec3adea9293de6820fc2546367 | Python | TheBB/Geomaker | /geomaker/polyfit.py | UTF-8 | 3,783 | 2.765625 | 3 | [] | no_license | from functools import partial
from itertools import combinations
import numpy as np
import scipy.optimize as opt
def filter_none(objs):
for obj in objs:
if obj is not None:
yield obj
def intersect_single(left, right, x, bias='down'):
if left[0] == x == right[0]:
if bias == 'down'... | true |
37b030cf098fa45e1b974dbc8b2e6262756c9e47 | Python | FranciscoCristovao/RecSys2018Polimi | /mail_notification/notify.py | UTF-8 | 1,795 | 2.703125 | 3 | [] | no_license | # Notification on finishing
import pandas as pd
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
class NotifyMail:
def __init__(self, to_address, dataframe, text='A message from RS', subject='RS evaluation'):
if dataframe is not None:
self.data... | true |
0c2e2c3d66d77e3430cb66ac284bf07f7c24e75a | Python | horacn/test_python | /test/gui/test46.py | UTF-8 | 5,027 | 3.546875 | 4 | [] | no_license | # 图形界面
'''
Python支持多种图形界面的第三方库,包括:
Tk
wxWidgets
Qt
GTK
等等。
但是Python自带的库是支持Tk的Tkinter,使用Tkinter,无需安装任何包,就可以直接使用。本章简单介绍如何使用Tkinter进行GUI编程。
Tkinter
我们来梳理一下概念:
我们编写的Python代码会调用内置的Tkinter,Tkinter封装了访问Tk的接口;
Tk是一个图形库,支持多个操作系统,使用Tcl语言开发;
Tk会调用操作系统提供的本地GUI接口,完成最终的GUI。
所以,我们的代码只需要调用Tkinter提供的接口就可以了。
'''
'''
# 第一个GUI程序
# 使用... | true |
87fd59a877497dd00c22cd5077fb04df05626886 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_1_neat/16_0_1_cocofun_a.py | UTF-8 | 403 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python
T = int(raw_input())
CASE = 1
while T > 0:
T -= 1
N = int(raw_input())
digits = set()
ret = 0
if N > 0:
L = 1
while len(digits) < 10:
Q = N * L
for ch in str(Q):
digits.add(ch)
L += 1
ret = Q
if r... | true |
afc676b69f2fc0de4331ba51ee09646987b4b101 | Python | Stardustlv8/RSA_Algoritmo | /RSA_1/RSA/euext.py | UTF-8 | 609 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def euclides_ext(a,b,r):
"""Expresa 2 valores como combinacion lineal de su mcd
ENTRADA:(3 VALORES)
Los numeros para obtener el mcd
SALIDA:(1 VALOR)
en una lista de 2 elementos retorna los valores
que cumplen la combinacion lineal.
"""
k=[0,0]
if a%b==0:
... | true |
20ddceb69ca7d40e3c9b711ce27f5bd581d21bad | Python | pranavpatel706/Wilson | /FINAL.py | UTF-8 | 3,075 | 2.6875 | 3 | [] | no_license | import RPi.GPIO as gpio
from time import sleep
import cv2
import numpy as np
from math import cos, radians
# pin 17 left wheels +
# pin 22 left wheels -
# pin 23 right wheels +
# pin 24 right wheels -
# pin 18 rotor +
# pin 15 rotor -
gpio.setwarnings(False)
gpio.setmode(gpio.BCM)
gpio.setup(17, gpio.OUT)
gpio.setup(... | true |
b54f51ccc0bee183706fc696e847619591706ff5 | Python | AnkaChan/UnitardMarkDetection | /CornerDetection/Python/GoodFeaturesToTrack.py | UTF-8 | 477 | 2.578125 | 3 | [] | no_license | import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread('corner1.png')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imshow('img', img)
cv2.waitKey(0)
img=cv2.bilateralFilter(img, 10, 75, 75)
cv2.imshow('img_blured', img)
cv2.waitKey(0)
corners = cv2.goodFeaturesToTrack(gray, 0, 0.05,... | true |
7afcfbf55d2387dad7800868ea55264d42f52f09 | Python | Seas-dev/Coding-Dojo-Work | /Algorithms/Python/inOrderSubsets.py | UTF-8 | 158 | 2.96875 | 3 | [] | no_license | def rios(str,sub="",i=0):
if i == len(str):
return [sub]
else:
return rios(str,sub+str[i],i+1) + rios(str,sub,i+1)
print(rios("abc")) | true |
bf5de1d8b55763a67079b13b5e81d23440ed689a | Python | srinithish/Aritificial-Intelligence-Game-Playing-and-Naive-Bayes | /part2/geolocate.py | UTF-8 | 6,040 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python3
## -- coding: utf-8 --
#"""
#Created on Fri Oct 12 19:16:21 2018
#
#@author: 18123
"""
The following program has been prototype using the Naive Bayes Classifier, based on the
conditional independence assumption, given as,
P(Location/Tweet) = P(Tweet/location)*P(Location)
where in the right han... | true |
163df05a55ce617d753d5e14530a3fe8eb7ad0be | Python | KATO-Hiro/AtCoder | /AtCoder_Virtual_Contest/macle_20221007/a/main.py | UTF-8 | 241 | 3.3125 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | # -*- coding: utf-8 -*-
def main():
import sys
input = sys.stdin.readline
s = input().rstrip()
days = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
print(7 - days.index(s))
if __name__ == "__main__":
main()
| true |
469299fbceb47494b99c953296cc718e207beecf | Python | linruohan/my_study | /itmsv1_mvc/common/read_json.py | UTF-8 | 623 | 2.921875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import json
# loads: 将 字符串 转换为 字典
def loads(path):
with open(path) as f:
data = json.load(f)
print(data)
return data
def store(path,data):
with open (path, 'w') as f:
f.write (json.dumps (data))
return None
if __name__ == '__main__':
data={'bigberg'... | true |
c37d05d2147fa495ab07dcad5dda3207ff4f57a7 | Python | YoTcA/Rezeptdatenbank | /test/testmain.py | UTF-8 | 1,444 | 2.578125 | 3 | [] | no_license | import tkinter as tk
import Testsecond
from tkinter.font import Font
# myFont = Font(family="Helvetia", size=10)
class Navbar(tk.Frame):
def __init__(self, parent):
super().__init__(parent)
self.option_add("*Font", "arial 20 bold")
self.parent = parent
self.but1 = tk.Button(parent,... | true |
2cf63b5df2decd3e492f65b15b109b4af5ade10c | Python | mayosol/Algorithm | /ThisIsCodingTest/210421.py | UTF-8 | 2,001 | 3.359375 | 3 | [] | no_license | # 2751
import sys
nums = []
for i in range(int(input())) :
nums.append(int(sys.stdin.readline()))
for j in sorted(nums) :
print(j)
# 2751 _ 선택 정렬 try _ but, 시간 초과
import sys
nums = []
for i in range(int(input())) :
nums.append(int(sys.stdin.readline()))
for j in range(len(nums)) :
... | true |
ba9782958f4a29200ea80ded869d54e02e3b2d87 | Python | markzentile/ElecSus | /elecsus/libs/solve_dielectric.py | UTF-8 | 14,782 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2017 J. Keaveney
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... | true |
6802798f901d649a8cfadcf30bb5fefdf5c996b0 | Python | Nepta75/hi-python | /ex02_guessing/main.py | UTF-8 | 1,226 | 4.03125 | 4 | [] | no_license | import random
startNumber = input("Entre le premier nombre: ")
endNumber = input("Entre le deuxième nombre: ")
def game():
numberOfTry = 0
randomNumber = random.randrange(int(startNumber), int(endNumber))
oddOrEven = 'pair' if (randomNumber % 2) == 0 else 'impair'
lenNumber = len(str(randomNumber))
win = Fal... | true |
6a1657be001241ae37aed009e115818d16d1e262 | Python | andrewatandplus/Sophos | /Sophos/SophosTest.py | UTF-8 | 4,315 | 2.890625 | 3 | [] | no_license | import unittest
import SophosNet as sn
import SophosGauss as sg
import numpy as np
class MainTests(unittest.TestCase):
def setUp(self):
self.model_gauss = sg.Model()
def test_LinearClassification(self):
# Build Model
model = sn.Model()
l1 = sn.Layer(2, 1)
prin... | true |
ac753155e46c6612e996665baa549e8476ca214e | Python | ABNER-1/MultiVectorEngine | /benchmark/split-key.py | UTF-8 | 753 | 3 | 3 | [] | no_license | import pickle
def write2pickle(data, file_name):
with open(file_name, "wb") as out:
pickle.dump(data, out)
def split_func(part_number):
with open(key_file_name, 'rb') as file:
data = pickle.load(file)
raw_length = len(data)
print(raw_length)
step = raw_length // part_... | true |
1271f0c189c9e886df307e4746719cfc54e38a0c | Python | GuangyanZhang/Paddle-Paddle_SCNN-Deeplabv3-bisenet-icnet | /百度无人驾驶比赛模型/scnn/scnn_eval.py | UTF-8 | 23,680 | 2.515625 | 3 | [] | no_license | import random
import cv2
import numpy as np
import paddle
import PIL.Image
import paddle.fluid as fluid
import time
import os
np.set_printoptions(threshold=np.nan)
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
import matplotlib.pyplot as... | true |
6aea6004111f85af3a9bbde6c9413e5a6610d883 | Python | gutus/PythonMosh | /5.Data Structures/06_finding_items.py | UTF-8 | 452 | 4.5 | 4 | [] | no_license | ###FINDING ITEMS
letters = ["a", "b", "c", "d", "d", "e"]
print(f"Berikut adalah isi list letter>>> {letters}")
if "d" in letters: #Jika string "d" ada pada letters
print(letters.index ("d")) # Print index pertama kemunculan string "d" pada list letter.
print(letters.count("a")) #Menghitung jumlah tampilnya huruf "... | true |
5e5f1f00c6e3919c8c32a6d0a31dc2c2909da0cb | Python | ramesh960386/jarwell | /customers/models.py | UTF-8 | 1,921 | 2.703125 | 3 | [] | no_license | from django.db import models
class Customer(models.Model):
first_name = models.CharField(max_length=75)
last_name = models.CharField(max_length=75)
address = models.CharField(max_length=150)
contact = models.CharField(max_length=75)
date_encoded = models.DateTimeField(auto_now_add = True)
... | true |
7ea7747be9ae18b676c27d6b6ae5f3a5f66a23d8 | Python | lbk3/DataWrangling | /urlCrawl.py | UTF-8 | 823 | 2.5625 | 3 | [] | no_license | Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import unicodecsv
>>> import urllib2
>>> from bs4 import BeautifulSoup
>>> from datetime import datetime
>>> target_page = 'http://www.newlook.com/uk/womens... | true |
3aa327e431341ea71ed8ea8a34521a11a0cb1855 | Python | pbarden/python-course | /Chapter 5/painting_a_wall.py | UTF-8 | 1,013 | 4.15625 | 4 | [] | no_license | import math
# Dictionary of paint colors and cost per gallon
paint_colors = {
'red': 35,
'blue': 25,
'green': 23
}
# Prompt user to input wall's width
# Calculate and output wall area
wall_height = int(input('Enter wall height (feet):\n'))
wall_width = int(input('Enter wall width (feet):\n'))
wall_area = flo... | true |
0af46b0a9f61e2a7adf86c38d1c78ceab366ae72 | Python | ralphribeiro/facilita-DOU | /tests/conftest.py | UTF-8 | 597 | 2.59375 | 3 | [
"MIT"
] | permissive | from datetime import date
from os.path import join
from random import randbytes, randint
import tempfile
from pytest import fixture
@fixture
def temp_dir():
td = tempfile.TemporaryDirectory(suffix=date.today().isoformat())
yield td.name
td.cleanup()
@fixture
def files(temp_dir):
ret = []
for i ... | true |
36bcd46831d6dc379b099ed40f8f0a124a81d2f9 | Python | vongostev/QTeleportationCM | /biguaa/qteleportation.py | UTF-8 | 3,001 | 2.828125 | 3 | [
"MIT"
] | permissive |
from qutip import *
import numpy as np
import math
import matplotlib.pyplot as plt
import qutip.qip
import scipy.stats
from qutip.qip.operations import snot, cnot, rx, ry, rz
from qutip.qobjevo import proj
# ############ FUNCTIONS FOR ANY REPRESENTATIONS OF QUANTUM STATES ################
def get_dict_form_qutip(w... | true |
02b2a24cc9c186c8930ef87026155c72658f3648 | Python | tkarna/crane | /crane/data/eqState.py | UTF-8 | 4,356 | 3.125 | 3 | [] | no_license | #!/usr/bin/python
"""
Implementation of Jackett et al. (2006) equation of state.
Vertical density gradient is best computed with the thermal expansion and haline
contraction coefficients (alpha and beta, respectively):
dRhodz = alpha(S,Th,p)*dThdz_at_const_p + beta(S,Th,p)*dSdz_at_const_p
Jackett, D. R., McDougall, T... | true |
50867c9da5ebeda1cd3d8c8a3d7e18fa4ada7a58 | Python | l3u9/differential-crypto-analysis | /toycipher.py | UTF-8 | 2,161 | 2.75 | 3 | [] | no_license |
pm = [17, 22, 27, 28, 21, 26, 31, 0, 25, 30, 3, 4, 29, 2, 7, 8, 1, 6, 11, 12, 5, 10, 15, 16, 9, 14, 19, 20, 13, 18, 23, 24]
invpm = [7, 16, 13, 10, 11, 20, 17, 14, 15, 24, 21, 18, 19, 28, 25, 22, 23, 0, 29, 26, 27, 4, 1, 30, 31, 8, 5, 2, 3, 12, 9, 6]
# sbox = [1, 10, 4, 12, 6, 15, 3, 9, 2, 13, 11, 7, 5, 0, 8, 14]... | true |
b12162141813f007378e72b7a043ad95a98d04cf | Python | adaick/Quiz-Application | /questions.py | UTF-8 | 1,496 | 3.296875 | 3 | [] | no_license | import sqlite3
with sqlite3.connect("quizdatabase.db")as db:
cursor = db.cursor()
cursor.execute("""DELETE FROM quizzes""")
db.commit()
cursor.execute("""
INSERT INTO quizzes(quizName)
VALUES("Python_basic"),("Python_datatypes"),("Miscellaneous");
""")
db.commit()
cursor.execute("""DELETE FROM questions""")
db.... | true |
0373617c371cc1a12c0a747bcffd1d5773be5f36 | Python | sjay-jx/pizza-delivery | /pizzaapp/v.py | UTF-8 | 3,542 | 2.609375 | 3 | [] | no_license | from django.shortcuts import render, redirect
from django.contrib.auth import authenticate,login, logout
from django.contrib import messages
from django.contrib.auth.models import User
from .models import PizzaModel, CustomerModel, OrderModel
# Create your views here.
def adminlogin(request):
return render(request, "... | true |
af70c7ef6167fbe7326a4d91e55c6a9244075d15 | Python | troyzx/Python | /week13/100-张子昕-p2.py | UTF-8 | 3,703 | 2.875 | 3 | [] | no_license | # To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% Change working directory from the workspace root to the ipynb file
# location. Turn this addition off with the DataScience.
# changeDirOnImportExport setting
# ms-python.python added
# %%
import numpy as np
from matplotlib import... | true |
073994aea0431effd75610222a4db2cd38371863 | Python | wix-pl/fileupload-eval | /lessions/tpa-resources/SignatureEncoding/python/WixSignatureEncoder.py | UTF-8 | 2,599 | 2.671875 | 3 | [] | no_license | import base64
from collections import OrderedDict
from datetime import datetime
import hashlib
import hmac
import itertools
import urllib
import pytz
API_HOST = 'openapi.wix.com'
API_PORT = 443
API_VERSION = '1.0.0'
def add_signature_header(http_headers, signature):
http_headers['x-wix-signature'] = signature
... | true |
f709902cefde13ab0a7f24e1b178a0bd0dc3e4fe | Python | Lamsko/Stratego | /game/board.py | UTF-8 | 1,078 | 3.53125 | 4 | [] | no_license | from game.field import Field
# Class representing game board
class Board(object):
def __init__(self, size):
self._size = size
self._fields = [x[:] for x in [[Field(None)] * size] * size]
# Returns board size (side length)
def size(self):
return self._size
# Returns board fiel... | true |
c192d532d22ab256b1a817378326baf4a1873140 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_083/ch28_2020_03_18_01_52_28_157908.py | UTF-8 | 58 | 3.296875 | 3 | [] | no_license | x=1
y=1
while x>=99:
x=1+1/2**y
y=y+1
print(x) | true |
ee7f1253b4c83cb8dcb80d65a1e77c493ba95eb9 | Python | Souvikavi/Python-Programs | /Trapizoidal Using Lambda Input.py | UTF-8 | 535 | 3.953125 | 4 | [] | no_license | # BY USING LAMBDA
#INPUT AS "trapizoidal (lambda x : function)"
def trapizoidal(func):
a = float(input("Enter Lower Limit : "))
b = float(input("Enter Upper Limit : "))
n = int(input("Enter the value of 'n': "))
h = (b-a)/n
init = func(a)
final = func(b)
middle_values =0
for i... | true |
f8e8de5093d0aed5733c463ca6bf389eca979250 | Python | faisalhusain007/PiFire | /display_pygame_240x320b.py | UTF-8 | 34,350 | 2.625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python3
'''
*****************************************
PiFire Display Interface Library
*****************************************
Description: This library supports using pygame
on your Linux development PC for debug and development
purposes. Only works in a graphical desktop
environment. Tested ... | true |
6e80ac839546c3aa504727306b72653bea0a6e32 | Python | BambooEngineer/PygamePong | /Functional.py | UTF-8 | 9,640 | 3.140625 | 3 | [] | no_license | import pygame # functions objects design
# Cant USB sniff yet for controllers + Serial wouldnt work properly
# maybe UDP Sockets
import random
import math
import time
import serial
pygame.init()
random.seed()
play = False
i = input("Enter 2 for 2 players or 4 for 4 players\n")
if(i == '2'):
play = ... | true |
a8e2409048d80b9d919f2e24a121bdca8c51ee0a | Python | luwis93choi/RL-Random_Maze_Solver | /Discrete_Actor_Critic.py | UTF-8 | 4,633 | 2.890625 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
class ActorCriticNetowrk(nn.Module):
def __init__(self, alpha, input_dims, fc1_dims, fc2_dims, n_actions, device):
super(ActorCriticNetowrk, self).__init__()
self.input_dims = inp... | true |
1bb9e859013c8559751ec5a8295463a551b2d658 | Python | trunghieult1807/AI | /orac/caro/caro.py | UTF-8 | 23,981 | 2.71875 | 3 | [] | no_license | import pygame
import re
import copy
from . import palette
def text_objects(text, font, font_color):
textSurface = font.render(text, True, font_color)
return textSurface, textSurface.get_rect()
def score_pattern(grid_pattern, pattern, player):
if len(pattern.group(0)) < 5:
return 0
elif len(p... | true |
dc6b0232aa1d466973ca4a38e4c6d61596412b23 | Python | arron-h/protour-stat-trawler | /ProTrawler.py | UTF-8 | 1,275 | 2.515625 | 3 | [] | no_license | from metrics.MetricsCalculator import MetricsCalculator
from trawlers.TrawlerFactory import TrawlerFactory
from trawlers.TrawlerTypes import TrawlerTypes
from exporters.ExporterFactory import ExporterFactory
from exporters.ExporterTypes import ExporterTypes
from Models import Metrics
def main():
riderListTrawler = Tr... | true |
82de3d9469440e5eb64d0e6eb08ab2580f3c85e2 | Python | m-takeuchi/ilislife_wxp | /gid7.py | UTF-8 | 4,868 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import serial
import time
import re
#RS232_PORT = '/dev/ttyS0'
#UNIT_NUM = 1
BAUDRATE = 9600
class RS232():
# At first, get initialized
def __init__(self, portname, unitnum=1):
self._portname_ = portname
self.raw = serial.Serial(self._portname_, BAUDR... | true |
27b4b1a566b149cf5cbc5b0e8f264e0284a0e070 | Python | aboghossian/MST | /PrimsAlgo.py | UTF-8 | 1,349 | 3.78125 | 4 | [] | no_license | # function to perform Prim's algorithm to calculate size of MST
# takes graph and a vertex to start from
def prims(graph, s):
vertex_set = [] # visited vertices
heap = [s] # vertex names in the heap
heap_values = [0] # vertex values in the heap
distances = [100] * len(graph) # distance array
... | true |
2c813d7b3d839c109da0d5cb59f6fe70cc835118 | Python | dak-7309/Data-Mining-Assignments | /Assignment 1/Assn1.py | UTF-8 | 17,284 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import json
from pandas import json_normalize
from datetime import *
from copy import *
import numpy as np
import matplotlib.pyplot as plt
#... rest of the imports
def compDates(s, sd, ed):
months = {'Jan': 1, 'Feb' : 2, 'Mar': 3 , 'Apr': 4, 'May':5, 'Jun'... | true |
13011c1db927acf3081516d6506f3bbd70b014e3 | Python | cmazzoni87/MLTransformersProjects | /ESGTextFactorGenerator.py | UTF-8 | 4,488 | 2.578125 | 3 | [] | no_license | import pandas as pd
import re
from sklearn.metrics.pairwise import cosine_similarity
from transformers import TFGPT2LMHeadModel, GPT2Tokenizer
import numpy as np
import itertools
import os
PATH_DOC = os.path.join(os.path.dirname(__file__), 'Documents')
PATH_OUT = os.path.join(os.path.dirname(__file__), 'Output')
def ... | true |
4579611b371f51baa41517ae7bb467700099bad9 | Python | shramov/tll | /python/test/test_chrono.py | UTF-8 | 1,541 | 2.890625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# vim: sts=4 sw=4 et
import pytest
from tll.chrono import *
def test_str():
assert str(Duration(100, Resolution.ns, type=float)) == '100.0ns'
assert str(Duration(100, 'ns', type=int)) == '100ns'
assert str(Duration(100, (1, 1000000000), type=int)) == '100ns'
assert str(Duratio... | true |
cb64b45491aeb7d19c6c693cedd90b342758dd1e | Python | naorton/Advent-of-Code | /2016/Day 1/test_puzzle.py | UTF-8 | 848 | 2.96875 | 3 | [] | no_license |
import unittest
import puzzle
class TestBasic(unittest.TestCase):
def test_pass(self):
data = puzzle.parse("data.txt")
answer = puzzle.solve(data)
self.assertEqual(0, answer)
def test_directionChanger(self):
pass
def test_northChanger(self):
self.assertEqual(puzzle.northChanger("R"), "E... | true |
5cf6b61f36012722e3c59903ad25a7843ccd64b9 | Python | rheehot/AAT | /TEST/ex_stock_code.py | UTF-8 | 6,232 | 2.84375 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QAxContainer import *
class MyWindow(QMainWindow):
def __init__(self):
super().__init__()
# Kiwoom Login
self.kiwoom = QAxWidget("KHOPENAPI.KHOpenAPICtrl.1")
self.kiwoom.dynamicCall("CommConnect()")
... | true |
77ab6c07e43b16f068dea51cb3fd91ad548da044 | Python | scizzorz/eminem-lyrics | /count.py | UTF-8 | 641 | 3.15625 | 3 | [] | no_license | import sys
from collections import defaultdict
files = sys.argv[1:]
words = defaultdict(int)
spacechars = '.:;,!?*()[]{}'
badchars = '"\'-'
stopwords = {x.strip() for x in open('stopwords')}
for file in files:
with open(file) as fp:
text = fp.read()
for char in spacechars:
text = text.replace(char, ' '... | true |
17396ee75f2bde55a88c1b011b4a2371eadb3ba5 | Python | ZhangLe59/GAimplementDEAP | /DeapImpl/FV.py | UTF-8 | 1,340 | 2.734375 | 3 | [] | no_license | import random, math, csv
from deap import creator, base, tools, algorithms
CNRate = 0.015
SGRate = 0.005
def compoundfinal(value,rate,year):
pv = round(value * math.pow((1 + rate),year),2)
return pv
def startvalue():
value = inputdata() #input("pls input the value:")
year = 2 #input("pls input the num... | true |
88fc25b4d6e3cbbdc08724c96a5b431f65b99ab7 | Python | Jreema/Kloudone_Assignments | /Python/python2/swapPosition.py | UTF-8 | 342 | 4.1875 | 4 | [] | no_license | #swap position of two numbers in a list
list1=[78,90,34,23,12,67,56,77]
pos1 = int(input("Enter position1, number between 0 and 7:"))
pos2 = int(input("Enter position2, number between 0 and 7:"))
print("The original list is: ")
print(list1)
list1[pos1],list1[pos2] = list1[pos2],list1[pos1]
print("The swapped lis... | true |
702ce06f5db6af4e252d2f598f35077c425dccb7 | Python | dibollinger/CookieBlock-Consent-Classifier | /resource_construction/name_features.py | UTF-8 | 1,615 | 2.765625 | 3 | [
"MIT"
] | permissive | # Copyright (C) 2021-2022 Dino Bollinger, ETH Zürich, Information Security Group
# Released under the MIT License
"""
Small script to detect terms inside the name of cookies.
This produces a list of terms that are checked for as part of the feature extraction.
"""
from typing import Dict
import re
import enchant
min_l... | true |
370f15b8303bfecfcc9ca4beee8595f6725abe95 | Python | HoangDinhHoi/PythonOfMe | /Exercise_1306.py | UTF-8 | 740 | 3.453125 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
'''
Cach 1: Su dung ham rfind('ki_tu_can_tim_trong_string'): tra ve phan tu can tim o vi tri cuoi cung trong chuoi, neu khong tim
thay se tra ve -1
'''
import time
start = time.clock()
s = 'a.b.c.mp3'
a = s.rfind('.')
print(s[a+1:])
end = time.clock()
print('Time run : %s' %(end-start))
... | true |
baeaaf8973af57176bc84cd2092b7a55619d7959 | Python | forons/hay_checker | /haychecker/dhc/metrics.py | UTF-8 | 34,191 | 2.8125 | 3 | [
"MIT"
] | permissive | """
Module containing metrics for the distributed version of hay_checker.
"""
import pyspark
from pyspark.sql.functions import isnan, when, count, col, sum, countDistinct, avg, to_date, lit, \
abs, datediff, to_timestamp, current_timestamp, current_date, approx_count_distinct, log2, log
from haychecker.dhc import... | true |
3694a0491cb4b0c89f31320fabad4369c488d0a2 | Python | lorenzoreyes/Binance-Traders-Bots-24-7- | /crypto_spectre.py | UTF-8 | 1,977 | 2.796875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import yfinance as yahoo
import datetime as dt
import matplotlib.pyplot as plt
from pylab import mpl
mpl.rcParams['font.family'] = 'serif'
plt.style.use('fivethirtyeight')
# Quick screener of crypto performance
spectre = ['AAVE-USD', 'ADA-USD', 'BNB-USD', 'BTC-USD', 'BAT-USD', ... | true |
c4306f5e84c240781f13c083760fa36ab6d88614 | Python | HermiteBai/UIUC | /2017FA/CS412/HW/assignment_2/Question3.lbai5.py | UTF-8 | 3,161 | 3.203125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import itertools
from collections import OrderedDict
def havePattern(l, pattern):
return all([i in l for i in pattern])
def title(t):
print('============%s============' % t)
def maxPatterns(support):
max_patterns = set()
freq_pattern = list(filter(lambda... | true |
e34a74fae60066f398cfc684f98474ff797ef214 | Python | aidan-clyens/Simple_Digit_Recognition | /input.py | UTF-8 | 1,880 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | from trainer import Trainer
import os
import sys
if __name__ == '__main__':
# Create a Trainer object
contour_area_threshhold = 60
crop_width = 50
crop_height = 50
crop_margin = 5
trainer = Trainer(contour_area_threshhold, crop_width, crop_height, crop_margin)
# User must enter at least on... | true |
dc310da5e48fd71dad0e86f9d23ab9ffa29d33a0 | Python | Orlando-Houston/Python | /DataTypeList.py | UTF-8 | 1,110 | 3.671875 | 4 | [] | no_license | #Data Types
# Lists
#[] # list()
grades = [90,80,70,50]
type(grades)
mixList =["a",19.3,4]
mixlist = ["b",19.3,90,grades]
len (mixlist)
#In-list query
type(mixlist)
type(mixlist[0])
type(mixlist[3])
all_list = [mixList,mixlist]
#del all_list or remove
#Adding, changing, deleting... | true |
0806c5cf5bc76d1d81455d452e531ac863438504 | Python | measylite/measyPython | /classDemo/class_start.py | UTF-8 | 618 | 3.578125 | 4 | [] | no_license | #
# Miguel Soria
#
class myClass():
def method1(self):
print "myClass method1"
def method2(self, someString):
print "myClass method2 " + someString
# Inheritance demo another class based off myClass()
class anotherClass(myClass):
def method2(self):
print "anotherClass method2"
def method1(self):
myC... | true |
7b86344ad6c09034b35a94980a1c2b482d7e0092 | Python | Python3pkg/Latte | /tests/analyzer_test.py | UTF-8 | 972 | 2.765625 | 3 | [
"MIT"
] | permissive | import unittest
import os
from latte.Analyzer import Analyzer
class TestAnalyzer(unittest.TestCase):
def setUp(self):
self.config = {}
self.config['appPath'] = os.path.expanduser('latte/')
self.config['statsPath'] = 'stats/'
self.config['sleepTime'] = 5
self.config['autosav... | true |
c849f3e98b35f7fbdcff432acb30e18a01a45e4c | Python | chernogorsky/bestconfig | /bestconfig/adapters.py | UTF-8 | 2,420 | 2.875 | 3 | [] | no_license | import os
from pathlib import Path
import typing as t
from .source import Source
from .file_parsers import *
class AbstractAdapter(metaclass=ABCMeta):
@classmethod
@abstractmethod
def get_dict(cls, source: Source) -> dict:
"""Возвращает словарь с конфигами,
необходимые параметры находятс... | true |
c4f7714a069e97fa8b053b8074d636121b5bb8af | Python | hsingchien/Algorithm-course | /course/week16/DFS.py | UTF-8 | 2,688 | 2.703125 | 3 | [] | no_license | import numpy as np
def DFS_loop(G, vertices, ft={}): # G is a dict with each value store the outgoing list
global t
t = 0
global s
s = None
n_nodes = len(G)
global state_list
global v_f_time
state_list = {}
v_f_time = {}
for i in vertices:
state_list[i] = 1
v_f_time[i] = 0
global leader
l... | true |
aef1b47c985b2a52bcc276181387e29c51aee1ca | Python | alazyer/pycodes | /rabbitmq/003_receive.py | UTF-8 | 1,019 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
import time
import pika
def receive():
connection = pika.BlockingConnection(
pika.ConnectionParameters(host='localhost')
)
channel = connection.channel()
channel.exchange_declare(exchange='logs',
... | true |
c79b67860b487fe1e3744839227ebd8d3b275f1c | Python | tor4z/crabs | /crabs/threadpool/threadpool.py | UTF-8 | 5,473 | 2.859375 | 3 | [
"MIT"
] | permissive | import threading
from queue import Queue
import os
from .utils import _Singleton
class Future:
def __init__(self):
self._result_ = None
self._event = threading.Event()
self._has_callback = False
self._callback_func = None
self._done=False
def _set_result(self, result):
... | true |
06544ab7b2b5199955e0fc959d7c8b45e2415113 | Python | wirooo/IdentifEye | /src/face_detector.py | UTF-8 | 4,404 | 3.046875 | 3 | [] | no_license | import cv2
import torch
import numpy as np
from PIL import Image
from facenet_pytorch import MTCNN
from torchvision import transforms, models
import torch.nn as nn
class FaceDetector:
"""
Program that classifies images from video capture based on trained models.
"""
def __init__(self, mtcnn, clf, clas... | true |
09dc417a7de78a3fd8dcf0dcd368b2b1912a0369 | Python | FergusFitzpatrick/project1 | /loginRequired.py | UTF-8 | 379 | 2.59375 | 3 | [] | no_license | from functools import wraps
from flask import redirect,session, url_for, flash
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get("username") is None:
flash("You must be logged in to use this feature")
return redirect(url_for('login'))
... | true |
42d6f466ffe9579ffbd4af34e74754af30b042cf | Python | pkmm91/competitive-programming-solutions | /URI/1515.py | UTF-8 | 157 | 2.796875 | 3 | [] | no_license | while True:
n = int(raw_input())
if n == 0:
break
else:
for i in xrange(n):
string = map(str , raw_input().split())
| true |
f388262d89bd3c3c39a8d352b3a7f8dcde645f76 | Python | rizveeredwan/CSEDU | /CSE-4271[NLP]/context_based_spell_checker/SpellCheckerContext/res/Paper Dataset/sentence_shuffler.py | UTF-8 | 453 | 2.671875 | 3 | [] | no_license |
import random
f = open("spell_checker_dataset_bellayetbot", "r")
lines = f.readlines()
f.close()
f = open("spell_checker_dataset_bellayetbot_1k", "w")
flag = dict()
for i in range(0, len(lines)):
flag[i] = 0
counter = 0
while (counter <= 500):
v = random.randint(0, len(lines)/2-1) # from 0,1,2,......, le... | true |
5b662d2c26717806192f42b00515b0b36f693526 | Python | matheussampaio/problems-solving | /codeforces/1000A - Codehorses T-shirts.py | UTF-8 | 1,753 | 3.625 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# https://codeforces.com/problemset/problem/1000/A
# sizes: M, S, XS, XXS, XXXS, L, XL, XXL, XXXL
similar_sizes = {
"S": ["S", "M", "L"],
"M": ["M", "S", "L"],
"L": ["L", "S", "M"],
"XS": ["XS", "XL"],
"XL": ["XL", "XS"],
"XXS": ["XXS", "XXL"],
"X... | true |
9e2452fb564770217a0b2752791b163ba5678d26 | Python | siraom15/coffee-to-code | /Python/pontakornth.py | UTF-8 | 580 | 4.0625 | 4 | [] | no_license | # Very Evil version
coffee = "coffee"
ascii_coffee = list(map(ord, coffee))
f_position = ord("f")
d_position = ord("d")
e_position = ord("e")
def f_to_d(char_ord: int):
"""
Convert f to d. Return the same character otherwise.
Args:
char_ord: Character in Unicode order
Returns:
str: If... | true |
aeb05a97e8699721887cbdf8f3e3ea6ed710271d | Python | shift-dynamics/fsanalyzer | /fsanalyzer/link.py | UTF-8 | 1,900 | 3.171875 | 3 | [] | no_license | import numpy as np
from .frame import Frame
class Link:
def __init__(self, name):
self.name = name
# append origin to list of frames
origin = Frame()
origin.set_parent_body(self)
self.frames = [origin]
self.points = None
def add_frame(self, frame):
fo... | true |
33604e5b351190c866bf3e27d71c99a16f67665d | Python | IMIO/wcs-scripts-teleservices | /liste_type_general_rdv.py | UTF-8 | 652 | 3.03125 | 3 | [] | no_license | import requests
import json
import re
def tri_rendez_vous(liste):
"""
:param liste: liste json des types de rendez-vous avec le nombre de personnes encodé de la façon' - 1 personne' + pluriel ou ' pour 1 personne' + pluriel
:return: liste du type de rendez-vous sans le nombre de personnes
"""
... | true |
59a525fd0778ceb0b46a65c97422fa2ad1b8fd2b | Python | shubhraagarwal/ML-AZ | /Regression/SImple_Linear_Regression.py | UTF-8 | 1,523 | 3.84375 | 4 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
# ! Importing the dataset
dataset = pd.read_csv("Machine+Learning+A-Z+(Codes+and+Datasets)/Machine Learning A-Z (Codes and Datasets)/Part 2 - Regression/Section 4 -... | true |
3c7fb4313d8e0fa8d7df4d3f85c5c0d1abec02a0 | Python | craciunescu/algo | /U3/test/test_e4.py | UTF-8 | 1,743 | 3.375 | 3 | [
"MIT"
] | permissive | """
@author: David E. Craciunescu
@date: 2020/04/29 (yyyy/mm/dd)
4. You'd like to program a robot to match cork stoppers to glass bottles at
a recyling factory.
Design an algorithm that follows the Divide and Conquer scheme to plug N
bottles optimally.
"""
from random import randint, shuffle... | true |
e34715db0c7651e957a9f44cfcece8db1581d732 | Python | binh-vu/semantic-modeling | /pysm/semantic_modeling/karma/karma_graph.py | UTF-8 | 3,163 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
from typing import Dict, Tuple, List, Set, Union, Optional, TYPE_CHECKING
from data_structure import Graph, GraphNode, GraphLink, graph2dict, dict2graph
from semantic_modeling.karma.karma_link import _dict_camel_to_snake, KarmaGraphLink
from semantic_modeling.karma.karma_node... | true |
d55520992a909c9f0b77a331dd6a07dfd09b471c | Python | helunxing/algs | /leetcode/649.py | UTF-8 | 566 | 2.953125 | 3 | [] | no_license | from typing import Collection, Deque
import collections
class Solution:
def predictPartyVictory(self, senate: str) -> str:
qd = collections.deque([i for i, s in enumerate(senate) if s == 'D'])
qr = collections.deque([i for i, s in enumerate(senate) if s == 'R'])
while qd and qr:
... | true |
35e8e8b942600b5f71eaa69eefbaa792980d3966 | Python | daniel-reich/ubiquitous-fiesta | /z9tnydD5Fix3g3mas_16.py | UTF-8 | 300 | 2.859375 | 3 | [] | no_license |
from collections import defaultdict
def check_pattern(l, word):
dic = {''.join([str(i) for i in a]): b for a, b in zip(l, word)}
res = defaultdict(list)
for k, v in dic.items():
res[v].append(k)
return len(res) == len(set(word)) and all([len(a) == 1 for a in res.values()])
| true |
e38c06be0c2880aef748a9d138a6cf398950b6a5 | Python | omiderfanmanesh/Machine-Learning-Project-Template | /data/preprocessing/encoders.py | UTF-8 | 5,290 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2021, Omid Erfanmanesh, All rights reserved.
from category_encoders import OneHotEncoder, OrdinalEncoder, BinaryEncoder
from sklearn.preprocessing import LabelEncoder
from tqdm import tqdm
from data.based.encoder_enum import EncoderTypes
class Encoders:
def __init__(self, cdg):
self._cf... | true |
b0a9082badeaf5223f35419da46a7f9f07d5eb7e | Python | jkeesh/crossover | /crossover.py | UTF-8 | 2,021 | 3.625 | 4 | [] | no_license | STARTING_CAPITAL = 50000
MONTHLY_EXPENSES = 2000
MONTHLY_INVESTMENT = 2500
LONG_TERM_RATE = 0.05
def total_capital_needed(monthly_expenses, interest_rate):
return monthly_expenses * 12.0 / interest_rate
def commas(val):
return "${:,}".format(val)
def _c(val):
return commas(val)
def compute_years_to_... | true |
1353913cdf1c8a0c6b163f133f4c2822e0e999bd | Python | CUAGAIN-95/opencv | /ComputerVision/_source/openCV/7장/opencv05.py | UTF-8 | 377 | 2.765625 | 3 | [] | no_license | # 이미지 회전
import cv2
img = cv2.imread("../../../_image/_foxes.jpg")
r, c ,cannel= img.shape
print(r,c,cannel)
M = cv2.getRotationMatrix2D((233,233), 90, 1)
new_img = cv2.warpAffine(img, M, (r, c))
r, c = new_img.shape[:2]
print(r,c)
cv2.imwrite("rotate_img.jpg", new_img)
cv2.imshow("main", img)
cv2.imshow("turn!", ... | true |
f7ea0ebe55b0ba85d371e33971b1066f2570b3bd | Python | Aringan0323/Racetrack | /src/preprocess_img.py | UTF-8 | 2,185 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import Int32
import cv2 as cv
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
class TriangleMask:
def __init__(self):
self.img_sub = rospy.Subscriber('/camera/rgb/image_raw', Image, self.img_callba... | true |
1f8d0f6ad1a6fa5f0cd3b26b43480649c6c8c97c | Python | SamWheating/AoC2018 | /day7/day7.py | UTF-8 | 2,990 | 3.03125 | 3 | [] | no_license | import string
# Set this to use the sample input and conditions
DEBUG = False
if DEBUG:
with open('day7_sample.txt') as f:
input = f.readlines()
else:
with open('day7.txt') as f:
input = f.readlines()
rules = []
for row in input:
rules.append((row.split(" ")[1], row.split(" ")[7]))
to_do... | true |
ce13797616f5376f6b3be55c1addceabb644d3b4 | Python | mpentek/ParOptBeam | /source/solving_strategies/schemes/runge_kutta4_scheme.py | UTF-8 | 3,741 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from source.solving_strategies.schemes.time_integration_scheme import TimeIntegrationScheme
class RungeKutta4(TimeIntegrationScheme):
"""
(Explicit) Runge Kutta 4th order approximation
"""
def __init__(self, dt, comp_model, initial_conditions):
# introducing and initializ... | true |
39a787b6c40912b662d58a62cfbef4923ab189ad | Python | MewX/MyPracticeInOne | /WebCrawlers/osu.ppy.sh/parselist.py | UTF-8 | 788 | 2.6875 | 3 | [] | no_license | # extract all list from the database
import re
from getlists import PAGE_PATTERN
from property_db import PropertyDb
propertyDb = PropertyDb()
for record in propertyDb.get_all():
current_page = record[1]
page_matcher = re.search(PAGE_PATTERN, current_page, re.DOTALL | re.MULTILINE)
if page_matcher:
... | true |
72fa84a016fa290e1c58fd40d9e299cb6b1dd63a | Python | JamesBirchall/jamesbirchall.github.io | /python-crash-course/samples/xmltojson.py | UTF-8 | 737 | 3.25 | 3 | [
"Apache-2.0"
] | permissive | import xmltodict
import json
def main():
### read in data from file (XML) or via URL
my_data = open("test.xml", "r")
my_dict = {}
if my_data.mode == "r":
contents = my_data.read()
print(contents)
my_dict = xmltodict.parse(contents)
my_data.close()
### parse this int... | true |
6bd1bd4a43ada9787bb9975833a35c4677cb7c0e | Python | ashutoshtripathi123/codes-and-notes | /codes/python_programs/multi_processing.py | UTF-8 | 707 | 3.90625 | 4 | [] | no_license | import time
import multiprocessing
def calc_square(numbers):
print("calculating Square of Numbers:")
for num in numbers:
time.sleep(0.3)
print('Square: ', num * num)
def calc_cube(numbers):
print("calculating Cube of Numbers:")
for num in numbers:
time.sleep(0.3)
prin... | true |
7efef04fb3c03935c3ee3cd9dc14ec56f5bbb3cb | Python | cfjimbo/fp-utpl-18-evaluaciones | /eval-parcial-primer-bimestre/Ejercicio_9.py | UTF-8 | 643 | 4.3125 | 4 | [] | no_license | """
Dos triángulos son congruentes si tienen la misma forma y tamaño, es decir, su ángulos y lados
correspondientes son iguales. Elaborar un algoritmo que lea los tres ángulos y tres lados de dos
triángulos e imprima si son congruentes, caso contrario que imprima que no son congruentes.
"""
lado11 = input("Esc... | true |
72613888c9745103c7bab853912a0391bb9a03e9 | Python | Sameer-Mann/codes | /python/p_class.py | UTF-8 | 1,030 | 3.75 | 4 | [] | no_license | #code
class Stack:
def __init__(self):
self.stack = []
def push(self,data):
self.stack.append(data)
def pop(self):
if not self.isEmpty():
return self.stack.pop(len(self.stack)-1)
def isEmpty(self):
return len(self.stack) == 0
... | true |
d40826ac0087090be2a67bd3cf76e418ffd044fd | Python | mattgorb/NBA_FanDuel_ML | /nba_statistical_learning.py | UTF-8 | 4,525 | 2.796875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import sys
from datetime import timedelta
import pandas as pd
from sklearn.linear_model import Ridge, BayesianRidge, ElasticNet, RidgeCV, ElasticNetCV
from sklearn.model_selection import cross_val_score, ShuffleSplit
from sklearn.metrics import mean_squared_error
from sk... | true |
955aa788bb044868a04ada44d92452f8e2bdd67b | Python | Marc-Adrien/OWDC | /ScriptPython/MapMaker/map-2.py | UTF-8 | 2,654 | 2.65625 | 3 | [
"MIT"
] | permissive | import folium
import numpy as np
from pyensae.notebookhelper import folium_html_map
def read_coordinate(s):
sx = ""
sy = ""
cpt = 0
while s[cpt] != ",":
sx += s[cpt]
cpt+=1
sy = s[cpt+1:]
#print("test x : ",sx)
#print("test y : ",sy)
x = float(sx)
y = float(sy)
r... | true |
7421ec18e57def7a3487837c9cd5b11df4681277 | Python | naliniganesan/python1 | /42.py | UTF-8 | 82 | 2.71875 | 3 | [] | no_license | d1,d2=map(str,input().split())
if(len(dl)>len(d2)):
print(dl)
else:
print(d2)
| true |
0a909cd1d418838c3e1ab9f84bf3686944e5429e | Python | keinuma/self-taught | /part1/chapter5.py | UTF-8 | 1,113 | 3.171875 | 3 | [] | no_license |
FAVORITE_ARTIST = [
'山下達郎',
'Greeen',
'宇多田ヒカル',
'ゲスの極み乙女',
'Ed Sheeran',
]
LOCATION_VISITED = [
(39.72, 140.10),
(39.69, 140.12),
(42.98, 144.38),
(43.19, 140.99),
(38.26, 140.86),
(35.86, 139.60),
]
MY_INFO = {
'height': 180,
'weight': 55,
'favorite': 'python... | true |
9b606c2d1e7ad020c92d338374aaf89718341841 | Python | shivstha/coraonaapp | /myapp/views.py | UTF-8 | 2,152 | 2.5625 | 3 | [] | no_license | from django.shortcuts import render
from bs4 import BeautifulSoup
import requests
from . import models
# Create your views here.
BASE_URL = 'https://www.worldometers.info/coronavirus'
BASE_URL_COUNTRY = 'https://www.worldometers.info/coronavirus/country/{}'
FLAG_URL = 'https://www.worldometers.info/{}'
def home(re... | true |
8f5936d8cec79f333c17df9d29b442536e25666d | Python | LovisaFJSundin/cookingproject | /smalltrial.py | UTF-8 | 799 | 3.265625 | 3 | [] | no_license | ### little trial
import nltk
from nltk.tag import StanfordPOSTagger
st = StanfordPOSTagger('english-bidirectional-distsim.tagger')
original = "In a medium bowl, whisk together the flour, oats, coconut, baking soda, and salt."
tag_list = st.tag(original.split())
print( tag_list )
if tag_list[0][0] in ('In','in'): ... | true |
9068b5a5a7d893eb215e868999122d03656bfe9c | Python | homezzm/leetcode | /LeetCode/简单/412. Fizz Buzz.py | UTF-8 | 524 | 3.453125 | 3 | [] | no_license | class Solution(object):
def fizzBuzz(self, n):
"""
https://leetcode-cn.com/problems/fizz-buzz/
:type n: int
:rtype: List[str]
"""
li = []
for i in range(1, n + 1):
strs = ""
if i % 3 == 0:
strs = "Fizz"
if i ... | true |