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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d000380cd90ab3b0cfc00ff7288969b0de26e376 | Python | ryfeus/lambda-packs | /Spacy/source2.7/spacy/tests/regression/test_issue1518.py | UTF-8 | 247 | 2.578125 | 3 | [
"MIT"
] | permissive | # coding: utf8
from __future__ import unicode_literals
from ...vectors import Vectors
def test_issue1518():
'''Test vectors.resize() works.'''
vectors = Vectors(shape=(10, 10))
vectors.add(u'hello', row=2)
vectors.resize((5, 9))
| true |
0761f9f1e028d3705bcbf3de279b5058291f2316 | Python | rudidev89/OpenWRT-Tools | /IPnames.py | UTF-8 | 1,561 | 2.515625 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/python
#
# Prints a list of IPs to Names.
# Prints a JSON dict if -j specified
#
# Builds list by checking
# Active DHCP leases
# DHCP Configuration
#
# TODO: implement argparse
# TODO: implement -H option to add headers.
import os
import sys
import subprocess
import json
import socket
DHCP_LEASES = "/... | true |
733b5711519a01652437a49831e477f53448b1e1 | Python | suharshs/CU-Bucket | /handlers/search.py | UTF-8 | 2,430 | 2.90625 | 3 | [] | no_license | from base import BaseHandler
from lev_dist.levenshtein_distance import *
import simplejson as json
class SearchHandler(BaseHandler):
"""
This handler gives the closest activities to the ones that the user typed in the search bar
"""
def get(self):
info = {}
info['username'] = self.... | true |
13d23556e39d0004cbf1d423ddfa35ea5be98848 | Python | OscarMo10/school-work | /Intro_To_C/assignment3/compile.py | UTF-8 | 2,965 | 3.03125 | 3 | [] | no_license | #!/usr/bin/python
import sys
import re
def writeInt(lastLine, content, outputFile):
defineVariable.append("%02d SET %04d\n" % (lastLine, int(content)))
lastLine += 1
return lastLine
def writeLineToFile(memoryLoc, value, outputFile):
lineText = "%02d SET %04d\n" % (memoryLoc, value)
outputFile.w... | true |
76dc21627fe8abee4c111e7a69b167c5b4859595 | Python | godofdacoits/CB-LV-DS-Feb21 | /PY-DEV/Session 12/Project-Copy&Move/to_move/command_line_arguments.py | UTF-8 | 313 | 3.265625 | 3 | [] | no_license | # a = int(input())
# b = int(input())
import sys
try:
filename = sys.argv[0]
a = int(sys.argv[1])
b = int(sys.argv[2])
except IndexError:
print("Please provide values for both numbers to be added.")
exit()
# print(type(sys.argv))
# print()
# print(sys.argv)
# print()
print("Sum is:", a+b) | true |
348f3230ed6662ce672069c029fa8337ca6d0809 | Python | Cendra123/C45-Decission-Tree-Python | /C45.py | UTF-8 | 5,715 | 2.78125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import sys
def entropiS(df_pred):
count_label = pd.DataFrame(index=[1])
total = 0
for index in df_pred.index:
total += 1
if(df_pred[index] in count_label):
count_label[df_pred[index]] +=1
else:
count_label[... | true |
e21a1477923c9ced41e983a5a63c7d2df247d652 | Python | christama/pythontest | /basic/2datatype/number1.py | UTF-8 | 113 | 3.046875 | 3 | [] | no_license | print(25 + 9)
print(25 - 9)
print(25 * 9)
print(25 / 9)
print(2**10)
print(25 % 9)
print(25 // 9)
print(-25 // 9) | true |
568f6110b16756e291003b0b7fd3f48794758f54 | Python | JinXJinX/practice | /leetcode/383_Ransom_Note.py | UTF-8 | 960 | 3.03125 | 3 | [] | no_license |
class Solution(object):
def canConstruct(self, ransomNote, magazine):
"""
:type ransomNote: str
:type magazine: str
:rtype: bool
"""
# 126 / 126 test cases passed.
# Status: Accepted
# Runtime: 172 ms
from collections import Counter
... | true |
3dab3aa0e39bfde757bd4f64464c789d561f8a67 | Python | DarthS1d1ous/computer-geometry | /MathFunctions.py | UTF-8 | 2,478 | 3.53125 | 4 | [] | no_license | import math
def determinant(p1, p2, p):
d = (p2.x - p1.x) * (p.y - p1.y) - (p2.y - p1.y) * (p.x - p1.x)
return d
def min_and_max(p):
xmin = p[0].x
ymin = p[0].y
xmax = p[0].x
ymax = p[0].y
for i in range(len(p)):
if (xmin > p[i].x):
xmin = p[i].x
if (xmax < p[... | true |
66369a6149c3d4f7441570b41e56456945a5a794 | Python | stuycs-softdev/submissions | /5/01-python/chowdhury_wayez/PersonalGreeter.py | UTF-8 | 326 | 4.125 | 4 | [] | no_license | import random
def greeting():
name = raw_input("Who are you?\n")
greet(name)
def greet(name):
greetings = ["Hello", "W'sup?", "My name is Inigo Montoya, you killed my father. Prepare to die.", "Good day,", "Greetings", "How do you do?"]
x = random.randint(0,5);
print greetings[x] + " " + name
... | true |
525a5656a79f5e21f1746961f7c6fcfbe99a34e7 | Python | DarelShroo/eoi | /10-iot/herramientas/B03_UDP.py | UTF-8 | 471 | 2.90625 | 3 | [] | no_license | import socket
UDP_PORT = 5000
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(("0.0.0.0", UDP_PORT))
sock.settimeout(5)
print("Escuchado por puerto {}".format(UDP_PORT))
try:
while True:
try:
data, addr = sock.recvfrom(256) # payload maximo en bytes
except socket.tim... | true |
1ce8bd191b2d3754347791fdd7227356b77424c8 | Python | Aasthaengg/IBMdataset | /Python_codes/p02784/s904224827.py | UTF-8 | 262 | 2.96875 | 3 | [] | no_license | #https://atcoder.jp/contests/abc153/tasks/abc153_b
S_list = [(input()) for i in range(2)]
H,N = map(int,S_list[0].split())
S_list_1 = list(map(int,S_list[1].split()))
damage = sum(S_list_1)
if damage >= H:
result = "Yes"
else:
result = "No"
print(result) | true |
a4c5b573af8c3cfb14c09a997eb997d96ca22f6a | Python | ufal/lsd | /bert_udp/eval_chg_dist.py | UTF-8 | 2,822 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import re
from collections import defaultdict
# both
ID = 0
# conll
FORM = 1
POS = 3
PARENT = 6
# score
NONE = 3
SCORE = 5
SCORES = 6
def readconllu(filename):
result = list()
cur_sent = dict()
with open(filename, 'r') as infile:
for line in infile:
i... | true |
7c534698a0f8440107609908ea75504482cd8201 | Python | NeoMindStd/CodingLife | /programmers/Coding/후보키.py | UTF-8 | 1,231 | 3.34375 | 3 | [] | no_license | def solution(relation):
answer = 0
combs = []
for i in range(len(relation[0])):
getComb(combs, [i], len(relation[0])-1)
combs.sort(key=lambda x:len(x))
candKeys = []
for comb in combs:
isTried = False
for candKey in candKeys:
cnt = 0
... | true |
19cbd461be47b1fdfd25172a07de398c30f668a7 | Python | WyTho/python_flask | /tests/test_event_resource.py | UTF-8 | 2,573 | 2.71875 | 3 | [] | no_license | from models.Event import EventModel
from models.UnitEnum import UnitEnum
from models.Error import Error
from tests.test_calls import test_get, test_post, send_get
from datetime import datetime
def test_event_resource():
print("#################### TESTING EVENT RESOURCE ####################")
# GETTING A... | true |
c2809638375d85c57a407c89b4d9ea254dd43a46 | Python | daniel-reich/ubiquitous-fiesta | /JPfqYkt6KGhpwfYK7_1.py | UTF-8 | 183 | 3.046875 | 3 | [] | no_license |
def replace_the(n):
n = n.lower().split()
return' '.join('an'if n[i]=='the'and n[i+1][0]in'aeiou'else'a'if n[i]=='the'and n[i+1][0]not in'aeiou'else n[i]for i in range(len(n)))
| true |
e5dcfb1ea0c0db80c25f5d5cf71dfbced84da098 | Python | PKStuff/task | /IsMulByTwo.py | UTF-8 | 578 | 3.46875 | 3 | [] | no_license | def isTwo(number):
if number == 1:
return True
else:
flag = True
while(number != 1):
number/=2
remainder = number % 2
if number == 1:
flag = True
elif remainder > 0:
flag = False
break
re... | true |
e550966c1dff9920129022ce6e54fd5a91baa91a | Python | OPTO-torchard/SSH-Demo | /readtc.py | UTF-8 | 1,088 | 2.84375 | 3 | [] | no_license | from apiKey import key
import sys # to handle argument values
import requests # to make get/post requests
# ignore insecure https requests warning:
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
# head is a JSON obj... | true |
ac9d5b4b85fac6fbf5184f5999d3d973d982bf89 | Python | spilabkorea/COVID19dashboard | /DBpia_Crawling.py | UTF-8 | 5,651 | 3.390625 | 3 | [] | no_license |
# 요청 변수(request parameter) 출처
# http://api.dbpia.co.kr/openApi/about/search.do
# $ conda install -c anaconda requests
# $ conda install -c anaconda beautifulsoup4
# $ conda install -c anaconda lxml
import requests
from bs4 import BeautifulSoup
import re
import pandas as pd
#텍스트에 포함되어 있는 특수 문자 제거
def cleanText(rea... | true |
93d16890557d15d92b58d6a1a63145a8c8e529eb | Python | maqiv/ba17_stdm_1 | /src/spectrogram_generation/spectrogram_converter.py | UTF-8 | 1,800 | 2.75 | 3 | [] | no_license | import wave
import numpy as np
import scipy.signal as signal
import scipy.io.wavfile as wav
import librosa
def spectrogram(wav_file):
(rate, sig) = wav.read(wav_file)
nperseg = 20*rate/1000;
for i in range(0, 12):
n = 2**i
if n >= nperseg:
nfft = n
break
f, t... | true |
26039a2eeb2eb00adc190592af9092fb096dbfb9 | Python | jo1jun/Machine-Learning-Python | /ex2/costFunction.py | UTF-8 | 1,489 | 3.3125 | 3 | [] | no_license | import numpy as np
from sigmoid import sigmoid
def costFunction(theta, X, y):
#COSTFUNCTION Compute cost and gradient for logistic regression
# J = COSTFUNCTION(theta, X, y) computes the cost of using theta as the
# parameter for logistic regression and the gradient of the cost
# w.r.t. to the p... | true |
c7f2505b8e1955132c7782e793fecba9ebb7a156 | Python | GameMaker2k/C-Scripts | /tarview/untaralt.py | UTF-8 | 2,124 | 2.96875 | 3 | [] | no_license | import os
# Converts an octal number to a decimal number
def oct2dec(num):
total = 0
power = 1
while num > 0:
total += power * (num % 10)
num //= 10
power *= 8
return total
# Reads a property from a file
def read_property(file, size):
buffer = file.read(size)
return oct... | true |
ee412f71e4688dfd51247ca38d7e5e476bf70776 | Python | jason272727/MachineLearning | /K_Means.py | UTF-8 | 1,170 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 17 22:05:31 2020
@author: User
"""
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn import preprocessing,cluster
import sklearn.metrics as sm
iris=pd.read_csv('C:/Users/User/Desktop/pypractice/iris.csv')
label_encoder=preprocessing.Labe... | true |
71bdf9271ffc545c3faa8baa39b965f07f5ee111 | Python | happyleavesaoc/python-aoc-qq | /aocqq/__init__.py | UTF-8 | 5,991 | 2.640625 | 3 | [] | no_license | """API for QQ AoC (aocrec.com)."""
import io
import re
import zipfile
from datetime import datetime
import bs4
import requests
from requests.exceptions import RequestException
MGZ_EXT = '.mgz'
BASE_URL = 'http://aocrec.com'
MAX_RANK_PAGE_ID = 10
MAX_MATCH_PAGE_ID = 10
LADDER_RANKS_LIMIT = 50
MATCH_LIMIT = 10
REQ_TIM... | true |
8f00e7478d3768725637e2c33f4f66af39060000 | Python | abheesht17/decepticonlp | /tests/test_paraphrase.py | UTF-8 | 1,574 | 2.65625 | 3 | [
"MIT"
] | permissive | _author_ = "Abheesht Sharma"
from decepticonlp.transforms import paraphrase
import random
import pytest
LENGTH_CONTRACTION_EXAMPLE = "had"
NOT_A_CONTRACTION_EXAMPLE = "Shes"
@pytest.mark.parametrize(
"text, expected_result",
[
("I had", "I'd"),
("I would have", "I'd've"),
("Rohan is"... | true |
66629894c5748dda62e7bf0f96291725d729c50f | Python | alr0cks/CollegeStuff | /IOT/myPublisher.py | UTF-8 | 955 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
import time
import paho.mqtt.client as paho
import Adafruit_DHT as dht
#broker="broker.hivemq.com"
broker="172.16.180.64"
#broker="iot.eclipse.org"
def on_connect(client2, userdata, flags, rc):
print("Publisher Connected with result code "+str(rc))
time.sleep(2)
#define DHT11 reading... | true |
ca1ada8bd9721b3b5f36e1cc3ca22ceb6d78f14d | Python | abhilashaop/Computer-Vision | /canny.py | UTF-8 | 553 | 2.515625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import cv2 as cv
img = cv.imread('cat.jpg',0)
lap = cv.laplasian(img,cv.CV_64F,ksize=3)
lap = np.uint8(np.absolute(lap))
sobelx = cv.Sobel(img,cv.CV_64F,1,0)
sobely = cv.Sobel(img,cv.CV_64F,0,1)
canny_d = cv.Canny(img,100,200)
xsobel = np.uint8(np.absolute(sobelx... | true |
74ef68a46eef79f4ffdf3fd709b83e5191618eae | Python | feritkerimli/PragmatechFoundationProject | /Python_Tasks/Week08Weekend_Tasks/task02.py | UTF-8 | 145 | 3.0625 | 3 | [] | no_license | myList=[1,34,56,100,-12,87,987,1,3,5,56,67]
def elem(lst):
s=""
for i in lst:
s+=str(i)+" "
print("Elements:",s)
elem(myList) | true |
c81a395b7530c7c7d1e586337e114b3d33bdf7ff | Python | shinbian11/1_day_1_commit | /3.26 python basic commit/local,global_Variable.py | UTF-8 | 561 | 3.8125 | 4 | [] | no_license | #전역변수, 지역변수
gun = 10
#def checkpoint(soldiers): #경계근무
#global gun #전역 공간에 있는 gun 변수를 사용
#gun = gun - soldiers
#print('[함수 내] 남은 총 : {0}자루'.format(gun))
def checkpoint_ret(gun, soldiers):
gun = gun - soldiers
print('[함수 내] 남은 총 : {0}자루'.format(gun))
return gun
print('전체 총 : {0}자루'.format(gun)... | true |
7376e7da8562d9a7c221a34a2e0c22cb5fcb0fd8 | Python | alim395/PythonProjects | /CountryCatalogue/catalogue.py | UTF-8 | 1,759 | 3.5625 | 4 | [] | no_license | from country import Country
class CountryCatalogue:
def __init__ (self, countryFile):
self.countryCat = dict()
f = open(countryFile, 'r', encoding='utf-8', errors='ignore')
rawData = f.readlines()
for n in range(1, len(rawData)):
cName, cContinent, cPop, cArea = ... | true |
dca11084e53a6fa7c86c5ed1b82944421f2336d3 | Python | grupo-de-automacao-e-robotica-aplicada/S.P.E.A.R. | /Spear_Manual_Control_XY/Spear_Manual_Control XY.py | UTF-8 | 4,869 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Grupo de Automação e Robótica aplicada - GARRA
Spear Manual Control V2.2
"""
import time
from msvcrt import kbhit
import pywinusb.hid as hid
import serial
globals()['XDATA_TO_ARDUINO'] = None
globals()['XDATA_TO_ARDUINO_ANT'] = None
globals()['YDA... | true |
8e69a30518df0b0868c20d60263b465c082981ef | Python | ullas0601/My_Coding_Interview_Prepration_Guide_for_FAANG | /Recursion and Backtracking/ratInMaze.py | UTF-8 | 883 | 3.296875 | 3 | [] | no_license | def printMatrix(sol):
for eachLine in sol:
print(eachLine)
print("-----------------")
def hasPathHelper(maze, sol, x, y, n):
if x == n-1 and y == n-1:
sol[x][y] = 1
printMatrix(sol)
return True
if (x < 0 or y < 0 or x>=n or y >= n or maze[x][y]==0 or sol[x][y]==1):
... | true |
000b3025b2ec2d9ab24c22b674a0da1dabf983f0 | Python | Russian-AI-Cup-2015/python3-cgdk | /model/Bonus.py | UTF-8 | 394 | 2.5625 | 3 | [] | no_license | from math import *
from model.BonusType import BonusType
from model.RectangularUnit import RectangularUnit
class Bonus(RectangularUnit):
def __init__(self, id, mass, x, y, speed_x, speed_y, angle, angular_speed, width, height, type: (None, BonusType)):
RectangularUnit.__init__(self, id, mass, x, y, speed_... | true |
416e52cfb013fa0f0762892fbca858b591e1a94b | Python | heshunan/python-learning | /ex5.py | UTF-8 | 578 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
name = 'Zed A. Shaw'
age = 35 # not a lie
height = 74 * 2.54 # inches
weight = 180 *0.45 # lbs
eyes = 'Blue'
teeth = 'White'
hair = 'Brown'
print "Let's talk about %r." % name
print "He's %4f cm tall." % height
print "He's %4f kg heavy." % weight
print "Actually that's not too heavy."
print "... | true |
55f50dc0e1d9acf8fd404e1d847283a99a5b556e | Python | andrewyang96/AdventOfCode2017 | /day07/solution.py | UTF-8 | 2,563 | 3.140625 | 3 | [
"MIT"
] | permissive | from collections import Counter
from collections import defaultdict
from typing import Dict
from typing import Tuple
class Node(object):
def __init__(self, name, weight):
self.name = name
self.weight = weight
self.parent_name = None
self.children = set() # names of children, if any
... | true |
4d8bf02225d589889981b831271b36f8dbebc0fc | Python | ishti-du/class_scheduler | /data/facultydata.py | UTF-8 | 1,274 | 3.03125 | 3 | [] | no_license | import json
import pandas
from faculty import Faculty
class FacultyData:
def __init__(self, file_path):
self._faculty_objects_list = []
excel_data_df = pandas.read_excel(file_path, sheet_name='Faculty Preference')
json_str = excel_data_df.to_json(orient='records') # use this to read r... | true |
982113fef6c9cb709c95c87fcd5baa1d5df7c2a0 | Python | MegyAnn/isacademy | /day2/calc.py | UTF-8 | 380 | 4.15625 | 4 | [] | no_license |
liczba_a = int(input("Podaj liczbe pierwsza: "))
liczba_b = int(input("Podaj liczbe druga: "))
# print(liczba_a + liczba_b)
# Suma liczby x i y jest rowna xxx
wynik = liczba_a + liczba_b
#print("Suma " + str(liczba_a) + ' i ' + str(liczba_b) + ' jest rowna ' + str(wynik))
# sformatowane stringi
print(f"Suma lic... | true |
1eb710fe3424301e4e147177d98813da9ac0a3d5 | Python | Connor-Cahill/tweet-generator | /app.py | UTF-8 | 2,082 | 2.96875 | 3 | [] | no_license | from flask import Flask, jsonify, render_template
from source.markov import Markov_Chain
from markov import markov, sentence_starters
from gen_sent import Tweet_Generator
import pickle
import json
app = Flask(__name__)
def serialize_markov(markov_chain, file):
"""Serializes a large markov chain to a file that can... | true |
a8e1ff48d24175949f4a073d901367e08f13f3e8 | Python | meraldoantonio/Autoclassifier | /predict.py | UTF-8 | 28,100 | 3.03125 | 3 | [] | no_license | import numpy as np
import os
import sys
import cv2 as cv
from scipy.io import loadmat
import os
import shutil
from tqdm import tqdm
import pandas as pd
import plotly.graph_objs as go
from plotly.offline import iplot, plot
from sklearn.metrics import confusion_matrix
import tensorflow as tf
import time
from matplotlib i... | true |
86fd0c6d9389cccc1c36c09ae7b5cfb0f7439544 | Python | all-in-one-of/houdini2vr | /scripts/python/hou2vr.py | UTF-8 | 9,864 | 2.65625 | 3 | [
"MIT"
] | permissive | """
Preview your Houdini VR renders in HMD
"""
import os
import hou
import time
import base64
import inspect
import logging
import urllib2
import webbrowser
import numpy as np
import SocketServer
from PIL import Image
import SimpleHTTPServer
from pathlib2 import Path
from threading import Thread
logging.basicConfig(l... | true |
a2391c37ef54014085addc5fbda07d7f9f130a2c | Python | l-deniau/AdventOfCode2019-Python | /Day2/1.py | UTF-8 | 1,155 | 3.296875 | 3 | [] | no_license | import sys
import os
def main():
input_file_path = sys.argv[1]
if not os.path.isfile(input_file_path):
print(int("File path {} does not exist. Exiting...".format(input_file_path)))
sys.exit()
data_raw = open(input_file_path, 'r').readline()
data_string = data_raw.split(",")
da... | true |
6d7daa1bcecedf7b1dcea3c28b4868b757554b08 | Python | Wizmann/ACM-ICPC | /Leetcode/Algorithm/python/2000/01452-People Whose List of Favorite Companies Is Not a Subset of Another List.py | UTF-8 | 479 | 2.546875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | class Solution(object):
def peopleIndexes(self, favoriteCompanies):
n = len(favoriteCompanies)
res = []
for i in xrange(n):
for j in xrange(n):
if i == j:
continue
u = set(favoriteCompanies[i]) & set(favoriteCompanies[j])
... | true |
30b96aff6eb86fcf1c0f06c6a1488b079d44eef7 | Python | MachFour/info1110-2019 | /week9/R14D/circle.py | UTF-8 | 737 | 3.828125 | 4 | [] | no_license | import math
class Circle:
# class variable
# Accessing the class variable: Circle.PI
PI = math.pi
# c = Circle()
# c.get_wiki_page()
@staticmethod
def get_wiki_page():
return "https://en.wikipadia.org/foaijfa"
def __init__(self, radius):
self.radius = radius
# used ... | true |
0802632ed0d54d93ff4fbb23150a78a3eba80ce4 | Python | alexbadran/insight_kiva | /kiva_modules/modSearch.py | UTF-8 | 3,645 | 3.078125 | 3 | [] | no_license | from bs4 import BeautifulSoup
import re
from nltk.corpus import stopwords # Import the stop word list
from sklearn.feature_extraction.text import CountVectorizer as cv
from sklearn.feature_extraction.text import TfidfVectorizer as tfidf
import pandas as pd
import numpy as np
import ast
# no need to normalize, sinc... | true |
54ab27e68012caa109dc106cb0950332fa0e608c | Python | emptycastlepark/TIL | /Algorithm/SWEA/5185. 이진수.py | UTF-8 | 236 | 2.5625 | 3 | [] | no_license | # bin, hex
for tc in range(1, int(input())+1):
N, N16 = map(str, input().split())
N10 = int(N16, 16)
N2 = bin(N10)[2:]
while len(N2) < 4 * int(N):
N2 = '0' + N2
print('#{} {}'.format(tc, N2))
# 비트연산
| true |
75ab683c253da59948629a23affb00f242a22a45 | Python | marcosptf/fedora | /python/sistema-de-medicamentos-pytest/sistema_medicamentos_class.py | UTF-8 | 17,661 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from lista_medicamentos_json import medicamento
class SistemaMedicamento:
def __init__(self):
med = medicamento()
self.lista = med.lista_medicamentos_json()
def medicamento_doril(self):
return self.lista['medicamento'][0]['nome']
def medicamento_generic... | true |
a367b796e9cb8e4bd144e6c6f859fbe7ed86c1e9 | Python | Stevenzzz1996/MLLCV | /Leetcode/十大排序算法/快速排序.py | UTF-8 | 3,382 | 4.34375 | 4 | [] | no_license | #!usr/bin/env python
# -*- coding:utf-8 -*-
# author: sfhong2020 time:2020/3/28
"""快速排序(有时称为分区交换排序)是一种高效的排序算法。由英国计算机科学家Tony Hoare
于1959年开发并于1961年发表,它在现在仍然是一种常用的排序算法。
如果实现方法恰当,它可以比主要竞争对手(归并排序和堆排序)快两到三倍。
其核心的思路是取第一个元素(或者最后一个元素)作为分界点,
把整个数组分成左右两侧,左边的元素小于或者等于分界点元素,而右边的元素大于分界点元素,
然后把分界点移到中间位置,对左右子数组分别进行递归,最后就能得到一个排序完成的数组。... | true |
e1bf8dbf57b023dbc2d00f4a5aafa34075a1912d | Python | ManishBhat/Project-Euler-solutions-in-Python | /P67/P67.py | UTF-8 | 661 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 25 09:16:17 2019
@author: manis
"""
import time
start_time = time.time()
import numpy as np
f = open('p067_triangle.txt', 'r')
# Read in all the lines of your file into a list of lines
lines_list = f.readlines()
# Does a double-nested list comprehension to get into the m... | true |
422c3ea3d1a045011173dfe3a3acd3cd686345b3 | Python | rbirkaur23/factorial_sum_series | /factorial_sum_series.py | UTF-8 | 168 | 3.71875 | 4 | [] | no_license | import math
n=int(input("Enter n: "))
total=0
for i in range(1,n+1):
print(i,"! + ",end="")
total=total+math.factorial(i)
print("Sum of series is: ",total)
| true |
ea56766507955df5f43f1ed67e7167b204c01f59 | Python | tvelichkovt/LinearRegressionHousePrices | /train_test_split.py | UTF-8 | 2,996 | 3.375 | 3 | [] | no_license | # https://towardsdatascience.com/train-test-split-and-cross-validation-in-python-80b61beca4b6
#train_test_split
import pandas as pd
import numpy as np
from sklearn import datasets, linear_model
from sklearn.model_selection import train_test_split
from matplotlib import pyplot as plt
# Load the Diabetes dataset, https... | true |
55e5b07d51bbe3e2a8587142d7191b1f86f96396 | Python | nishant184/python | /inbuiltfunc.py | UTF-8 | 804 | 4.625 | 5 | [] | no_license | #In this we are to see inbuilt functions available in python
#1.absolute value-abs()
#This function is used to give the positive value only
print(abs(-21))
#2.Bool function-bool()
#This function is used to check if the value is 0 or 1 i.e false or true
print(bool(0))
print(bool(1))
print(bool(110))
#this function onl... | true |
65a3051c3e5e7a46609db1d70bc90e163076e483 | Python | Nmbirla/HackerRank | /30 Days of Code/Python/03 - Day 2 - Operators.py | UTF-8 | 994 | 3.140625 | 3 | [
"MIT"
] | permissive | # =========================================================================
# Challenge Information
# =========================================================================
# Direct Link: https://www.hackerrank.com/challenges/30-operators/problem
# Difficulty: Easy
# Max Score: 30
# Lan... | true |
af39e25d0438f7ecde1803ef05c251e53decccfd | Python | Aasthaengg/IBMdataset | /Python_codes/p02632/s514736251.py | UTF-8 | 235 | 2.796875 | 3 | [] | no_license | k = int(input())
s = input()
n = len(s)
MOD = 10**9+7
d = pow(26, -1, MOD)
ans = val = pow(26, k, MOD)
for i in range(1, k+1):
val *= (i+n-1) * 25 * pow(i, -1, MOD) * d % MOD
val %= MOD
ans += val
ans %= MOD
print(ans) | true |
d78b6a3e74754f7e6847ea990e274d1d8e57b2d9 | Python | ibraheem-moosa/TravelingSanta | /run_hc_on_nn.py | UTF-8 | 192 | 2.546875 | 3 | [
"MIT"
] | permissive | import os
import sys
tours = os.listdir(sys.argv[1])
for t in tours:
print(t)
os.system("./a.out cities.csv {} {}".format(os.path.join(sys.argv[2], t), os.path.join(sys.argv[1], t)))
| true |
1a107248f55708d0ced8f9a77e0b1b15dd800b2c | Python | mekartje/ismc_recombination | /scripts/msprime_sim_bottleneck.py | UTF-8 | 2,926 | 2.578125 | 3 | [] | no_license | ##Parameter file format:
#recom_bedgraph = //bedgraph with rho estimates output from ismc_mapper. none if using breaks and r options
#Tcol = //colonization time (integer)
#out_pre = //outfile prefix
##1st argument -- parameter file
#msprime simulation outline (forward in time)
#1 -- ancestral population N = 175,00... | true |
d84fc17d4361c8e4a967d6d36176e68813385b3c | Python | baihao8904/LeetCodeExerciese | /179. Largest Number.py | UTF-8 | 641 | 3.4375 | 3 | [] | no_license | class Solution:
# @param {integer[]} nums
# @return {string}
def largestNumber(self, nums):
#cmp函数中,返回正数表示大于 返回负数表示小于 0 表示等于
#两字符串相加返回的字符串相比较
nums = sorted(nums, cmp=lambda x, y: 1 if str(x) + str(y) < str(y) + str(x) else -1)
largest = ''.join([str(x) for x in nums])
... | true |
195388539525ecaec944781849b5842fc4bf7e63 | Python | rlatjcj/viewer | /viewer/saliency/vanillagrad.py | UTF-8 | 1,117 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import torch
import torch.nn as nn
from .base import Viewer
class VanillaGrad(Viewer):
"""Vanilla Gradient Attribution Method"""
def __init__(self, model, **kwargs):
r"""
Reference Paper: https://arxiv.org/abs/1312.6034
Args:
model:
rescale_mode: `Viewer.rescal... | true |
75131a5ef05b870f09c011bce0ced80c226e9082 | Python | MyaGya/Python_Practice | /Programers_backup/소수 만들기.py | UTF-8 | 517 | 3.265625 | 3 | [] | no_license | from itertools import combinations
def make_prime_number(MAX):
data = [True for i in range(MAX + 1)]
data[1] = False # 1은 소수가 아니다
for i in range(2, MAX // 2):
if data:
for j in range(i + i, MAX + 1, i):
data[j] = False
return data
def solution(nums):
prime_nu... | true |
a7e9a60dfba59df956503e20828c3a614f47d8b6 | Python | mingweihe/leetcode | /_1492_The_kth_Factor_of_n.py | UTF-8 | 620 | 2.9375 | 3 | [] | no_license | class Solution(object):
def kthFactor(self, n, k):
"""
:type n: int
:type k: int
:rtype: int
"""
# Approach 2, O(sqrt(n))
a, b = [], []
for i in xrange(1, int(n**.5)+1):
if n % i == 0:
a += i,
b += n / i,
... | true |
d00b496edd1c252c2e09eb3cfbabdbb881d228d7 | Python | zyg11/human_detect2_keras | /train_simple.py | UTF-8 | 3,458 | 2.625 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import Dense,Activation,Flatten,Dropout
from keras.layers import Conv2D,MaxPooling2D
from keras.utils import np_utils
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import SGD
from keras import backend as k
from PIL import Image
impor... | true |
f6a8a7439fbb32c6dcc560b62348420af83bda89 | Python | cpique/Bots | /SlackBot/SlackBot.py | UTF-8 | 968 | 3.40625 | 3 | [] | no_license | import requests
import json
def getWordOfDay():
url = "https://www.vocabulary.com/dictionary/randomword"
response = requests.get(url)
print("Vocabulary.com: Status code", response.status_code)
print("Vocabulary.com: JSON response ", response.text)
word = response.url.split('/')[-1]
# meaning = ... | true |
fc3d0bf380880d503e70ead934892110bbbb07ab | Python | jonnyf89/AirlineManagementSystem | /currencyAtlas_unit_test.py | UTF-8 | 1,462 | 3.234375 | 3 | [] | no_license | import unittest
from currencyAtlas import CurrencyAtlas
class CurrencyAtlas_test(unittest.TestCase):
def setUp(self): #creates test variables
print ("Before the Test")
self.atlas1 = CurrencyAtlas("currencyrates.csv")
self.barbados_dollar = "... | true |
0d326127ebf7d7426adc11730997f1a6d2913b72 | Python | garyjyzhang/MyProjects | /robot_project_data_simplify.py | UTF-8 | 623 | 2.734375 | 3 | [] | no_license | def simplify_data(Data2):
Data = []
for i in range(len(Data2)):
print Data2[i];
Data.append(float(Data2[i]))
L = len(Data) / 12
price = []
xx = [0, Data[0]]
price.append(xx)
for i in range(12):
start = i * L;
endd = i * L + L;
for j in range(start, endd + 1):
Min = start
for k in range(j, endd):... | true |
88001116fa4eda5c2f4abc664b435e6b7b8fd184 | Python | Ankit-29/competitive_programming | /BitManipulation/alternatingBits.py | UTF-8 | 554 | 4.1875 | 4 | [] | no_license | '''
Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.
Input: 5
Output: True
Explanation:
The binary representation of 5 is: 101
Input: 7
Output: False
Explanation:
The binary representation of 7 is: 111.
'''
def hasAlternatingBits(n: int) -... | true |
6248c148da0140ed1ca95adbf88c3b0282be6145 | Python | MagdalenaSvilenova/Python-Advanced | /tuples_and_sets/count_symbols.py | UTF-8 | 126 | 3.703125 | 4 | [] | no_license | text = input()
sorted_text = sorted(list(set(text)))
for ch in sorted_text:
print(f"{ch}: {text.count(ch)} time/s") | true |
2f94e18b8b81f2db72292592b5354a714afe150e | Python | JesseS95/9021workspace | /Quiz/Quiz_3/quiz_3.py | UTF-8 | 2,451 | 3.640625 | 4 | [] | no_license | # Uses Global Temperature Time Series, avalaible at
# http://data.okfn.org/data/core/global-temp, stored in the file monthly_csv.csv,
# assumed to be stored in the working directory.
# Prompts the user for the source, a year or a range of years, and a month.
# - The source is either GCAG or GISTEMP.
# - The range of ye... | true |
0c4f729925bcd1f7eb484529730f17a7e69a2a86 | Python | igbes/Data-Structure-and-Algorithms-Python | /hash-table/hash_table.py | UTF-8 | 1,547 | 3.75 | 4 | [] | no_license | class HashTable:
def __init__(self, sz, stp):
self.size = sz
self.step = stp
self.slots = [None] * self.size
def hash_fun(self, value):
"""Принимает в квчестве аргумента строку, возвращает индекс слота"""
sum_code = 0
for simbol in value:
... | true |
a6e14cfd23421417ecda9e6c7978028551a44aef | Python | garyklam/TriviaMaze | /maze.py | UTF-8 | 8,332 | 3.484375 | 3 | [] | no_license | class Room:
def __init__(self, row, column):
self._position = [row, column]
self._doors = {"north": True,
"south": True,
"east": True,
"west": True}
self.answers = {
"north": 'not set',
"south": ... | true |
9aad48ddd93f88d2eaee9e82b14eb69fe842c7df | Python | JohnCLong/SEF_ML | /initial models/All_models.py | UTF-8 | 13,915 | 2.703125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression, ElasticNet, Lasso
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import cross_val_score
from sklearn.ensemble import RandomForestRegressor
# import data form csv files
... | true |
8ac99f415c0dd3ecc54fb4d8b2a03315bb5ec63b | Python | pjc509/appsec9163-4 | /test_check.py | UTF-8 | 2,020 | 2.796875 | 3 | [] | no_license | import unittest
import requests
from bs4 import BeautifulSoup
server_address="http://127.0.0.1:5000"
server_login=server_address + "/login"
def getElementbyID(text, id):
soup=BeautifulSoup(text, "html.parser")
result = soup.find(id="id")
return result
def login(uname, pword, twofactor, session=None):
... | true |
a1c0bca99da49d9d21d49d0cda0cf72b7749fa12 | Python | happa64/AtCoder_Beginner_Contest | /ARC/ARC009/ARC009-A.py | UTF-8 | 427 | 2.96875 | 3 | [] | no_license | # https://atcoder.jp/contests/arc009/submissions/14462909
# A - 元気にお使い!高橋君
import sys
import math
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(input())
res = 0
for _ in range(n):
a, b = map(int, input().split())
res... | true |
36d13105c1a37442578e5536037d5350087a880c | Python | cosinechicken/connect4-1 | /src/mcts/mcts_strategy.py | UTF-8 | 3,126 | 3.171875 | 3 | [] | no_license | import random, math
from .node import Node
from .tree import Tree
from random_strategy import RandomStrategy
from strategy import Strategy
class MctsStrategy(Strategy):
def __init__(self, rollout_limit):
self.rollout_limit = rollout_limit
def move(self, game, player_id):
tree = Tree()
... | true |
6560ae57b41b7685267cb81be7ae0e31fb32c5ce | Python | GenryEden/kpolyakovName | /233.py | UTF-8 | 119 | 3.46875 | 3 | [] | no_license | def f(n):
if n > 0:
return g(n-1)
return 0
def g(n):
ans = 1
if n > 1:
ans += f(n-3)
return ans
print(f(11)) | true |
78518ed8daf44e3d8af83aed8d6dfa48c18a2924 | Python | Lewic1201/pythonDemo | /source/moudleDemo/thirdDemo/rabbitMQDemo/pickDemo/demo2/send.py | UTF-8 | 1,119 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
参考链接 https://www.cnblogs.com/jfl-xx/p/7324285.html
"""
import pika
import random
# 新建连接,rabbitmq安装在本地则hostname为'localhost'
# hostname = '192.168.1.133'
hostname = 'localhost'
parameters = pika.ConnectionParameters(hostname)
connection = pika.BlockingConnection(param... | true |
5866bf30de8e4878e32b25f0ff18dd6d6ea52837 | Python | DNN-STYX/demo | /Tool/traditional_training/Train_fmnist_CNN.py | UTF-8 | 2,543 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
'''Trains a simple convnet on the fashion-MNIST dataset.
Gets to 92.50% test accuracy after 20 epochs
(there is still a lot of margin for parameter tuning).
16 seconds per epoch on a GRID K520 GPU.
'''
from __future__ import print_function
import os
import time
import kera... | true |
d5a6d2cd4db3cbd7454eafacb569832e728b78ca | Python | VeraKuzmina1/DMI | /PYTHON/variables.py | UTF-8 | 1,151 | 3.40625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
a = 65; print type(a)
print "Mainīga a vērtība kā dec skaitlis ir:%d"%(a)
print "Mainīga a vērtība kā hex skaitlis ir:%x"%(a)
print "Mainīga a vērtība kā oct skaitlis ir:%o"%(a)
print "Mainīga a vērtība kā simbols skaitlis ir:%c"%(a)
a = 'A'; print type(a)
print "Mainīga a vēr... | true |
580b5a770bdcfc42b69fa407f224a88fd38b8000 | Python | Oashpak/Lv-625.PythonCore | /HW3/TuziakT/hw3_t2.py | UTF-8 | 573 | 4.09375 | 4 | [] | no_license | """
for the resolving of this tusk we need to use 3 methods
before all of that i like more when you can giv your own number
now about methods:
1-st metod is about reversing of your number
2-nd metod is about product(sum) of numbers
3-d metod is about sort the numbers that are in your number
"""
number = list(map(int, i... | true |
7ab02986a3134eb3c6ab4c05637d1833af6b9ee9 | Python | joba01/coax | /coax/value_transforms/_base.py | UTF-8 | 3,284 | 2.875 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | # ------------------------------------------------------------------------------------------------ #
# MIT License #
# #
# Copyright (c) 2... | true |
d7efae93436caf6da74cc4244156fec8ebacb21c | Python | RedstoneRender/PracticeProblems | /Num 3/sample solution.py | UTF-8 | 279 | 3.703125 | 4 | [] | no_license | def alternateCase(str):
newStr = ""
for i in range(len(str)):
char = str[i]
if i%2 == 0:
if char.upper() == char:
char = char.lower()
else:
char = char.upper()
newStr+=char
return newStr
| true |
665330d0be709ec6007f242bed7ca0901344dc30 | Python | kamojiro/atcoderall | /beginner/165/E.py | UTF-8 | 515 | 2.875 | 3 | [] | no_license | #import sys
#input = sys.stdin.readline
def main():
N, M = map( int, input().split())
ANS = []
if N%2 == 1:
n = N//2
for i in range(M):
ANS.append([n-i, n+1+i])
else:
n = N//2
t = 0
for i in range(M):
if i%2 == 0:
ANS.append... | true |
622885768d4a00e783e005acb188815fd879f475 | Python | Vivekyadv/450-DSA | /1. Array/24. Longest Consecutive subsequence.py | UTF-8 | 1,848 | 4.5 | 4 | [] | no_license | # Given array, find length of longest consecutives present in array. The consecutive
# numbers can be in any order.
# Arr = [3,9,1,10,4,12,5,11,6,7]
# consecutives are -> [3,4,5,6,7] and [9,10,11,12]
# longest = 5
# Method 1
# sort the unique numbers of array, then from end check consecutives numbers
def solve(arr... | true |
3862ec0d59fd2e92da5cc69ec51594b6a18b9830 | Python | tangzzz-fan/learnpython3thehardway | /Project/Ex13.py | UTF-8 | 952 | 3.375 | 3 | [] | no_license | # 使用参数初始化 py 文件
# 从模块中导入对应的函数模块, 这里是从 sys 模块中导入 argv 功能
from sys import argv
# read the WYSS section for how to run this
# 这里 用户 input() 的输入依次作为输入展示
# 脚本名 第一个参数 第二个参数 第三个参数
script, first, second, third = argv
print("The script is called:", script)
print("Your first variablfe is:", first)
print("Your second variable i... | true |
751f0227bba8b658a20680252a863361beb73635 | Python | illmatictime/python-mini-project | /Ch10-1.py | UTF-8 | 1,459 | 3.609375 | 4 | [
"MIT"
] | permissive | import string
def openFile():
while True:
try:
fileName = input("Please enter file name to process: ")
fileOpen = open(fileName)
wordTuple = dict()
for line in fileOpen:
line = line.translate(str.maketrans('', '',
... | true |
beb7aef0846725f549deb3c77272e1c6110ad785 | Python | ynjacobs/PokeGIFS-API | /pokegifs.py | UTF-8 | 978 | 2.96875 | 3 | [] | no_license | import json
import requests
import os
# Equivalent to: curl -X GET "http://pokeapi.co/api/v2/pokemon/pikachu/"
# res = requests.get("http://pokeapi.co/api/v2/pokemon/pikachu/")
# Parsing the content (string) to JSON (Dict)
# body = json.loads(res.content)
# Helper method for convenience
def get_json(url):
body = ... | true |
843aba60b2823921bfed29a9e4df60baa37ae8ba | Python | DiaryChris/PythonShootGame | /game.py | UTF-8 | 9,114 | 2.984375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import pygame
from sys import exit
from pygame.locals import *
import random
SCREEN_WIDTH = 1280
SCREEN_HEIGHT = 600
PLAYER_SPEED = 8
BULLET_SPEED = 10
ENEMY_SPEED = 2
PLAYER_POS = (600, 450)
#子弹类
class Bullet(pygame.sprite.Sprite):
def __init__(self, bullet_img, in... | true |
ef2f216d934c849a0c975eefbf2b5afe2759736e | Python | tatiana3105/Face_Recognition | /reconocimiento.py | UTF-8 | 3,993 | 2.59375 | 3 | [] | no_license | import cv2
import os
import imutils
import numpy as np
def extraccion():
Name = 'Ana'
Path_data = 'D:/Universidad/Semestre 1-2021/Vision Artificial/Reconocimiento Facial/Data'
person = Path_data + '/' + Name
if not os.path.exists(person):
print('Carpeta creada: ',person)
os.m... | true |
c2dba8830e44f5c35720417038b9a786f947cf86 | Python | artak-kirakosyan/interview_task_iseo | /vehicle_availability.py | UTF-8 | 3,152 | 3.234375 | 3 | [] | no_license | import re
from typing import List, Tuple
import pandas as pd
def parse_timestamps(text: str) -> List[Tuple[str, str]]:
"""
Match all Timestamp pairs and return them in the list
:param text: string representation of a list of timestamp pairs
:return: list of timestamp pairs matched frm the busy_ranges... | true |
7bfbe5d3dbafa3fe96792a3c328316f98c2fdc88 | Python | fstakem/pycam | /pycam/test.py | UTF-8 | 153 | 2.734375 | 3 | [] | no_license | import machine
pin19 = machine.Pin(19, machine.Pin.OUT)
while True:
pin19.value(1)
utime.sleep_ms(500)
pin19.value(0)
utime.sleep_ms(500) | true |
a6a334577f9e87e7e0413b2203f5b85203cc6d25 | Python | ATLS1300/pc02-graffiti-13-dylan-nguyen | /PC02_Graffiti_Nguyen.py | UTF-8 | 1,064 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 8 15:39:26 2020
@author: dylannguyen
"""
from turtle import * #import the library of commands that you'd like to use
colormode(255)
# Create a panel to draw on.
panel = Screen()
w = 750 # width of panel
h = 750 # height of panel
panel.setup(wid... | true |
274fbe466dd72aab0179759a7516a73b2ad90a54 | Python | hentrope/syllabus-wizard | /src/tests/test_system.py | UTF-8 | 1,411 | 2.609375 | 3 | [] | no_license | from tests.base import TestBase
from datatypes import Syllabus, Term, User
class TestSystem(TestBase):
def test_system_1(self):
# Create the user, no need to simulate logging in
success, user = User.create_user("test", password_raw="test")
self.assertEqual(success, True, "Unable to c... | true |
1304950e0d362e4a57198c6e32da548d5e73edbf | Python | makjunior92/Supershop_products_scrapper | /shwapno.py | UTF-8 | 2,718 | 2.828125 | 3 | [] | no_license | from selenium import webdriver
from time import sleep
from selenium.webdriver.support.ui import Select
from bs4 import BeautifulSoup
from selenium.webdriver.chrome.options import Options
import json
import re
class Product:
def __init__(self, name, price, shop, link, img):
self.name = name
self.p... | true |
2c1dd1515364097c9e217fce5a317a90859e64da | Python | wahello/physics | /backend/api_test.py | UTF-8 | 1,256 | 2.59375 | 3 | [] | no_license | import http.client
import json
import re
import os
addr = '127.0.0.1'
port = ':4040'
target = addr + port
conn = http.client.HTTPConnection(target)
body = json.dumps({
"username":"admin",
"password":"123456"
})
conn.request('POST','/api/login_in',body=body)
response = conn.getresponse()
if (response.stat... | true |
1c3098deac12ef9e3f12a16a07e5f05080210719 | Python | guoqiao/gnome-dynamic-wallpapers | /gnome-dynamic-wallpaper-xml-generator.py | UTF-8 | 2,395 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import argparse
import os
import jinja2
def render(template_path, output_path, context={}):
env = jinja2.Environment(
loader=jinja2.FileSystemLoader(["."])
)
template = env.get_template(template_path)
output_text = template.render(**context)
with open(output_path, "w... | true |
2aad18363dc3ba9fafe1131368dc8719cc2b470c | Python | mlabuda2/DesignPatterns | /02Fabryka/Students/2018/DuniaWojciech/SimpleFactory/Prosta_fabryka_podwozia.py | UTF-8 | 1,149 | 3.5 | 4 | [] | no_license | from podwoziesimplefactory import PodwozieSimpleFactory
class FabrykaPodwozia:
__singleton_factory = None
def __init__(self, fabryka: PodwozieSimpleFactory):
self.__singleton_factory = fabryka
def podwozie_simple_factory(self, nazwa: str)->PodwozieSimpleFactory:
element = self.__singleto... | true |
2e5eb5524d224f0be2d41652cb8002713177401e | Python | shivamgupta7/python-program | /NumPy/numpyProgram.py | UTF-8 | 10,304 | 4.15625 | 4 | [] | no_license | import numpy as np
class programNumPy:
def listToArray(self):
'''
Convert a list of numeric value into a one-dimensional NumPy array
'''
lst = [float(item) for item in input('\nEnter list elements separate by comma: ').split(',')]
print("\nOriginal List is : ", lst)
... | true |
beaee15a677e0ea132757029d4aed1a1aeaa6d2c | Python | Chandler-Song/Python_Awesome | /Python_ABC/2-4string/1stringIndexSlice.py | UTF-8 | 1,549 | 4.25 | 4 | [
"MIT"
] | permissive | samp_string = "Whatever you are, be a good one."
# # You can get a character by referencing an index
# print(samp_string[0])
#
# # Get the last character
# print(samp_string[-1])
#
# # Get the string length
# print("Length : ", len(samp_string))
#
# # Get a slice by saying where to start and end
# # The 4th index isn'... | true |
5ffda10ba0275a9a508b2be5f936e81a6b80675b | Python | tjlee/poptimizer | /poptimizer/data/views/quotes.py | UTF-8 | 4,185 | 2.765625 | 3 | [
"Unlicense"
] | permissive | """Функции предоставления данных о котировках."""
import functools
import numpy as np
import pandas as pd
from pandas.tseries import offsets
from poptimizer.data.views.crop import div, not_div
from poptimizer.shared import col
@functools.lru_cache(maxsize=4)
def prices(
tickers: tuple[str, ...],
last_date: ... | true |
3f242589e17917c4c883a6f7e4687045afde4dec | Python | Ghilphar/bootcamp_python | /day03/ex01/ImageProcessor.py | UTF-8 | 1,517 | 3.484375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import os
class ImageProcessor:
@staticmethod
def load(path):
try:
# Test image path.
if not os.path.exists(path):
raise FileNotFoundError(f"FileNotFoundError -- strerror: No such file or directory {path}")
... | true |
2e45c119b7cb2b8858fdd7b693522c960699aa91 | Python | rahulhegde99/COVID-19-Statistics | /scrape.py | UTF-8 | 1,244 | 3.1875 | 3 | [] | no_license | #This script scrapes the data from "https://www.mohfw.gov.in/"
import requests
import re
import os.path
from os import path
import bs4
from bs4 import BeautifulSoup
from datetime import datetime
def getContents():
url = "https://www.mohfw.gov.in/"
r = requests.get(url)
txt = ""
if r.status_code ==... | true |
47e2382e979b0e95e0e1a50f4fee931ff748e98c | Python | Moenupa/MINEWORLDY | /python_tools/finished/range().py | UTF-8 | 364 | 4.03125 | 4 | [] | no_license | for i in range(0,5,1):
print(i)
print(i)
x=0
for i in range(0,5,1):
x=x+i
print(x)
print(x)
print(list(range(5)))
print(list(range(0,-10,-1)))
squares = []
for i in range(1,11):
square = i**2
squares.append(square)
print(squares)
#this is how range() is used in practice
#Or used in an advanced way... | true |