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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b05b7b39c534b17b94f0d8dd82dfeee7463512c7 | Python | glassstone/HSRL_python_Brad | /lg_dpl_toolbox/formats/VectorTableLibrarian.py | UTF-8 | 5,637 | 2.515625 | 3 | [] | no_license | import calendar
import dplkit.role.decorator
import dplkit.role.narrator
import dplkit.role.librarian
import re,os
from datetime import datetime,timedelta
class basicTimeParser(object):
def __init__(self):
self.datematch=re.compile('[0-9]{8}T[0-9]{4}')
def __call__(self,fname,deftime,info):
""... | true |
a5f4b512b0fa24716506c3537028e6f8c9d2c8af | Python | sizhousama/crawl | /scrapy爬取电影/tutorial/tutorial/spiders/movie_spider.py | UTF-8 | 651 | 2.640625 | 3 | [] | no_license | import scrapy
from tutorial.items import MovieItem
class MovieSpider(scrapy.Spider):
name = "movie"
allowed_domains = ["meijutt.com"]
start_urls = ['http://www.meijutt.com/new100.html']
def parse(self,response):
sel = scrapy.selector.Selector(response)
sites = sel.xpath('//ul/... | true |
80d3ca1fda7127d5d7018a650524082ab8952a69 | Python | nlu17/lstm-language-model | /vocabulary.py | UTF-8 | 3,587 | 3.125 | 3 | [] | no_license | import numpy as np
import operator
import tensorflow as tf
class TokInfo:
def __init__(self, tok, idx, one_hot, collection_count):
self.tok = tok
self.idx = idx
self.collection_count = collection_count
self.one_hot = one_hot
def __str__(self):
return self.tok + " " + s... | true |
2e5ee216e541544972e5dfb04d63dc7368759d1d | Python | bigdatasciencegroup/tf_imagenet_video | /tf_imagenet_vid/label.py | UTF-8 | 6,596 | 2.5625 | 3 | [] | no_license | from collections import defaultdict
import os
from attrdict import AttrDict
import xml.etree.cElementTree as ElementTree
import numpy as np
def parse_object(obj):
"""Extracts object properties from an xml node representing an object."""
id = int(obj[0].text)
x2, x1, y2, y1 = (int(i.text) for i in obj[2]... | true |
1df0c4e83c2fa32cacb18e01efcffa0b182ea31d | Python | stephwild/voc_test | /rdm/random_draw.py | UTF-8 | 446 | 2.953125 | 3 | [] | no_license | # from vocitem.py import VocItem
import os
import sys
import random
def random_draw(l, treshold):
if len(l) < treshold:
os.write(sys.stderr, 'Fatal error in random_draw: threshold too large')
draw_list = []
tmp = list(range(len(l)))
for i in range(treshold):
drawn = random.choice(tmp... | true |
2751f4dfa297f1eb030f8bb28be2be1d9edbfe91 | Python | mnot/redbot | /redbot/resource/active_check/base.py | UTF-8 | 3,361 | 2.640625 | 3 | [
"MIT"
] | permissive | """
Subrequests to do things like range requests, content negotiation checks,
and validation.
This is the base class for all subrequests.
"""
from abc import ABCMeta, abstractmethod
from configparser import SectionProxy
from typing import List, Type, Union, TYPE_CHECKING
from redbot.resource.fetch import RedFetcher
... | true |
9912aa92b9edb76c78c8abb88a7ebe017a6a59fb | Python | moritzwilksch/DataScienceEducation | /Statistics/statisticalTesting.py | UTF-8 | 1,595 | 2.984375 | 3 | [] | no_license | # %%
import scipy.stats as stats
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# %%
# Sample Size
n_m = 1000
n_f = 3440
# Conversion Rates
_mcr = 0.13
_fcr = 0.16
# Setup Data
sex = ['m'] * n_m + ['f'] * n_f
m_convert = np.random.choice((0, 1), p=(1 - _mcr, _mcr), size=... | true |
1ef2e8bbc138d2447d92c1362c333c4b938415e1 | Python | AtlantixJJ/LargeScaleTrafficSim | /vis_old.py | UTF-8 | 2,095 | 2.546875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate as integrate
import matplotlib.animation as animation
fig = plt.figure(figsize=(7,7))
ax = fig.add_axes([0, 0, 1, 1], frameon=False)
ax.set_xlim(0,1), ax.set_xticks([])
ax.set_ylim(0,1), ax.set_yticks([])
def parselog():
log = open("log.txt... | true |
1b492c19b5350491784f997a558a7ddea1fab873 | Python | ryu-0406/study-python | /basic/pythonweb/dictionary/pythonweb08-01-01.py | UTF-8 | 249 | 3.640625 | 4 | [] | no_license | # coding:utf-8
# 辞書の作成
# 変数に代入された値を要素として指定
x = 1
y = "Desktop"
mydict = {x:y}
print(mydict)
mydict = {1:"Desktop"}
print(mydict)
x = 1
y = "Desktop"
mydict = {x:y}
print(mydict)
y = "Movie"
print(mydict) | true |
56c536593ca9877f766e2fe608949e25b166d693 | Python | shyba/MongoFinance | /mongofinance/core/balance.py | UTF-8 | 979 | 3.609375 | 4 | [] | no_license | """
Balance logic module.
"""
class Balance(object):
"""
Represents a bank balance
"""
def __init__(self, current=0, initial=0, expenses=False):
"""
Initializes the balance representation
"""
self.current = current
self.initial = initial
s... | true |
df3d7434a53ef2aefb496f76e0581b8292f28ddc | Python | mattvenn/openlane | /scripts/consoletext.py | UTF-8 | 2,461 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #!/ef/efabless/opengalaxy/venv/bin/python3
# Copyright 2020 Efabless Corporation
#
# 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... | true |
8204e502f8e0515f02c05a70b143c8a4e7ebc39a | Python | EdgeLab-FHDO/Sliding-Window | /TCP_Server/TCP_Message_manager.py | UTF-8 | 742 | 3.03125 | 3 | [
"MIT"
] | permissive | #TCP_Message_manager.py
import time
TCP_Buffer= "0014Testing_Buffer0010my message0008the-rest0002hi0005heo"
header_length=4
init_position=0
TCP_messages=[ ]
def getTCPdata(TCP_Buffer):
while TCP_Buffer:
char_to_read=int (TCP_Buffer[init_position: header_length])
if len(TCP_Buffer)-hea... | true |
242612829ff1e842c3466e0dc9177f5fa2a85129 | Python | sriharsha004/LeetCode | /String/Leetcode 168. Excel Sheet Column Title.py | UTF-8 | 534 | 3.046875 | 3 | [
"MIT"
] | permissive | class Solution1:
def convertToTitle(self, n: int) -> str:
res = ''
while n>26:
n,m = divmod(n, 26)
if m ==0:
m = 26
n -= 1
res = chr(m-1 + ord('A')) + res
res = chr(n-1+ord('A')) + res
return res
... | true |
f88bb0941e7dbe48ca5c846c51c77bc24acd119c | Python | liunianmaster/pythonTest | /MySql.py | UTF-8 | 2,492 | 2.78125 | 3 | [] | no_license | import pymysql
import traceback
import time
class mysqlClass():
db = None
host = 'localhost'
usr = 'root'
pwd = ''
dbname = 'pythondb'
port = 3306
charset = 'utf8'
def showVersion(self):
db = pymysql.connect(self.host, self.usr, self.pwd, self.dbname)
cursor = db.cursor... | true |
bdbe799385dc8b03ee9c0356cc51363d6a5fe491 | Python | Exious/TAC | /lab-3/RealObject.py | UTF-8 | 3,616 | 2.859375 | 3 | [] | no_license | import numpy as np
from Data import params
from scipy.integrate import odeint
class RealObject:
def __init__(self):
numeric_params = params['numeric']
self._var = numeric_params['variant']
self.start_time = numeric_params['start_time']
self.duration = numeric_params['duration']
... | true |
b11c718dafb0029a0bc41f7aee8d557917e51215 | Python | malhotrasahil/coding_ninjas | /pycharm/pandas/iris_value.py | UTF-8 | 247 | 3.1875 | 3 | [] | no_license | import pandas as pd
columns=['SepalLength','SepalWidth', 'PetalLength', 'PetalWidth' , 'Species']
iris=pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data", names=columns)
df=iris.copy()
print(df.head()) | true |
fae6f5c5348b594e0c81b35cf180e4887dcd8cf6 | Python | rzch/stats-algorithms | /random_forest/rffit_scilearn.py | UTF-8 | 1,746 | 3.25 | 3 | [] | no_license | # Pandas is used for data manipulation
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
#Import scikit-learn metrics module for accuracy calculation
from sklearn import metrics
#Predicting whether a match came from the WTA or the ATP tour from match stats
#This script learns ... | true |
37dc078d1910e218c9e89c28d298435737c0419f | Python | Hashimabdulla/Regromeans_Learning | /Pythonexamples(1-5)/Print_hello.py | UTF-8 | 145 | 2.953125 | 3 | [] | no_license | #print hello world!
def print_hello(name):
return print("Hello {} !\n Welcome to Regromeans Learning.".format(name))
print_hello("hashim") | true |
6ead580b86145b82ed3e35d6c968336cc473c516 | Python | m-elhussieny/code | /maps/build/mayavi/enthought/mayavi/tests/test_mlab_source_integration.py | UTF-8 | 16,647 | 2.921875 | 3 | [] | no_license | """
Test for the various mlab source functions.
These tests are higher level than the tests testing directly the
MlabSource subclasses. They are meant to capture errors in the formatting
of the input arguments.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2008, Enthought, I... | true |
da8f7397decfe0fdf66cbf0819588e59875ccbf4 | Python | EmmanuelTovurawa/Python-Projects | /Data Visualisation/Chapter 16/question16.1.py | UTF-8 | 1,073 | 3.234375 | 3 | [] | no_license | #16.1
import csv
from datetime import datetime
import matplotlib.pyplot as plt
filename = 'data/sitka_weather_2018_simple.csv'
with open(filename) as f:
reader = csv.reader(f)
header_row = next(reader)
# for index, column_header in enumerate(header_row):
# print(index, column_header)
# Get dates, and high a... | true |
57181470e3df4cb6efe9448d9999ba68119ca6c7 | Python | byan21/relkereta | /progress/gui_prog/tes.py | UTF-8 | 293 | 2.765625 | 3 | [] | no_license | import os
import time
import MySQLdb
f = open('log.txt', 'r', os.O_NONBLOCK)
n=0
while 1:
for lines in f:
print ("%s"%(lines))
a,b,c,d,e,f,g,epx,waktu=lines.split(",")
print ("no %s x=%s y=%s z=%s va=%s lat=%s lon=%s epx %s waktu %s "%(a,b,c,d,e,f,g, epx, waktu))
| true |
380e10b542254e5ca8b2ab4fe6695d8c842b5c1c | Python | ManishaS24/Python | /Exercises_LPTHW/ex40.py | UTF-8 | 649 | 3.359375 | 3 | [] | no_license | class Song(object):
def __init__(self, lyrics):
self.lyrics = lyrics
def sing_me_a_song(self):
for line in self.lyrics:
print line
happy_bday = Song(["Happy Bday to you",
"I dont want to get sued"
"So I will stop right there"])
bulls_on_parade = Song(["They ... | true |
ec95bfbde5fd2df8d021beff3849bb7708beecae | Python | mironmiron3/SoftuniPythonFundamentals | /ListsAdvanced/OfficeChairs.py | UTF-8 | 533 | 3.640625 | 4 | [
"MIT"
] | permissive | number_of_rooms = int(input())
free_chairs = 0
insufficiency = False
for i in range(1, number_of_rooms + 1):
list_of_chairs_and_people = input().split()
chairs = len(list_of_chairs_and_people[0])
needed_ones = int(list_of_chairs_and_people[1])
if chairs >= needed_ones:
free_chairs += cha... | true |
2761044cbbc4896eb613e8bffad5523feef3088a | Python | sachinlokesh05/snake-and-ladder-problem | /snakeandladder.py | UTF-8 | 2,423 | 3.8125 | 4 | [] | no_license | import random
# Snakes and Ladders dictionary
SnLadDict = {
7: 18,
16: 3,
22: 15,
26: 21,
35: 44,
39: 35,
46: 62,
67: 58,
70: 58,
78: 69,
85: 86,
86: 81,
88: 30,
92: 55,
99: 2
}
... | true |
ae4aca7520e035b9567b44b641272018bf3e5fe3 | Python | vumanskyi/dictionary | /app/models/words.py | UTF-8 | 458 | 3.03125 | 3 | [
"MIT"
] | permissive | from app.models.model import Model
class Words(Model):
def get_all_words(self):
print(self.get_source)
def set_word(self, word):
self.__word = word
def get_word(self):
return self.__word
def get_result(self):
if self.__word in self.get_source():
words = s... | true |
1a60068f9be292aebc424df260958c239ce860c6 | Python | a20r/Slowpoke | /slowpoke/sensors.py | UTF-8 | 1,378 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive |
import rospy
import freenect
from nav_msgs.msg import Odometry
import tf
import numpy as np
import math
import orientedpoint
import point
class Sensors(object):
def __init__(self):
rospy.Subscriber("odom", Odometry, self.set_position)
self.x = 0
self.y = 0
self.theta = 0
def... | true |
910444244b5fe82c7e077c43935c7356c72db767 | Python | leomcp/Algorithms | /Python/Data Structure/Trees/bst_deletion.py | UTF-8 | 4,006 | 3.6875 | 4 | [
"Apache-2.0"
] | permissive | """
Deletion of Node
------------------------
"""
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
self.parent = None
class BSTree:
def __init__(self):
self.root = None
def get_Root(self):
return self.root.data
def insert(self, data):
if self.root is ... | true |
5f605e869cad387dfd36815ffa397955bf9595c9 | Python | sadanandu/Problems | /RotateMatrix.py | UTF-8 | 463 | 3.21875 | 3 | [] | no_license | #result[j][matrix.size() - i - 1] = matrix[i][j];
class Solution:
# @param A : list of list of integers
# @return the same list modified
def rotate(self, A):
for i in xrange(len(A)):
for j in xrange(len(A[i])):
temp = A[j][len(A)-i-1]
A[j][len(A) - i - 1] ... | true |
30620e4e84edfb114376d45e3819d99793652cca | Python | shaneaaron380/chapel | /bin/inputs.py | UTF-8 | 4,100 | 2.59375 | 3 | [] | no_license | #! /usr/bin/env python
import sys,os,inspect,urllib2
from subprocess import call,PIPE
INPUTS_DIR = 'inputs'
EXTENSION = 'txt'
def input_name_from_func_name(func_name):
"""
this is where we'll generate the cannonical output name from a function
name. right now that just means that we strip the 'make_' from the
b... | true |
07e753f118f50efdbf89339971753e798f5b8269 | Python | JackNova/advent-of-code-2015 | /day17/solution.py | UTF-8 | 1,856 | 3.890625 | 4 | [] | no_license | from itertools import combinations, permutations
from collections import defaultdict
# --- Day 17: No Such Thing as Too Much ---
# The elves bought too much eggnog again - 150 liters this time.
# To fit it all into your refrigerator, you'll need to move it into smaller containers.
# You take an inventory of the capac... | true |
98d7e1c732c72200844eba6c8f56413f82cb3d2e | Python | AlwxSin/Course | /Python/3rdWeek/3.3 Generator.py | UTF-8 | 1,231 | 3.578125 | 4 | [] | no_license | from random import randint, choice
from string import ascii_uppercase, ascii_lowercase
#import time
def generator(number_count):
"""Generates a dict Name: Number. Number of strings = number_count"""
#start = time.clock()
phone_numbers = set()
name_list = set()
phone_book = {}
while len(phone_nu... | true |
3eed28118775604511cb62e33bbaa7f4cb461a8b | Python | WeiyuZheng/elo_merchant_category_recommendation | /elo/processing.py | UTF-8 | 22,983 | 2.75 | 3 | [] | no_license | import datetime
import gc
import os
import time
import warnings
from contextlib import contextmanager
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from pandas.core.common import SettingWithCopyWarning
from sklearn.metrics import mean_squared_error
from sklearn.model_sele... | true |
8e40af4791d0a401217937647db00333a91abb67 | Python | Alanronald/codekata | /difference between time.py | UTF-8 | 124 | 2.828125 | 3 | [] | no_license | h1,m1=raw_input().split()
h2,m2=raw_input().split()
h1=int(h1)
h2=int(h2)
m1=int(m1)
m2=int(m2)
print abs(h1-h2),abs(m1-m2)
| true |
bbef99a52a5f06afe2d8d22735f0ef14b6f3c37f | Python | oatzy/advent_of_code_2018 | /python/day22.py | UTF-8 | 1,968 | 3.15625 | 3 | [] | no_license | from networkx import Graph
import networkx as nx
DEPTH = 4848 #510 #
TARGET = (15, 700) #(10, 10)#
def memoise(fn):
store = {}
def inner(x, y):
if (x,y) in store:
return store[(x,y)]
return store.setdefault((x,y), fn(x, y))
return inner
@memoise
def get_gi(x, y):
#print ... | true |
0a7f2ed54ac0819682b0b0b475fee133cd31c866 | Python | SunggookCHOI/algorithm | /beakjoon/11657 타임머신/solution.py | UTF-8 | 684 | 2.6875 | 3 | [] | no_license | import sys
def bf(n,edge):
INF = 999999999
dist = [0,0] + [INF for _ in range(n-1)]
for count in range(1,n+1):
for a in range(1,n+1):
if dist[a] != INF :
for b,c in edge[a].items():
if dist[b] > dist[a]+c :
dist[b] = dist[a]+c
if count == n:
pri... | true |
50c8597394b2d7b55d1dcb1cfae6815e997eca3d | Python | Havoc0228/auto-python-moto-e6-flasher | /flash.py | UTF-8 | 14,517 | 2.546875 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
import os
import sys
import time
#folder where root imgs are at
rootdir = 'root\motoe6-root'
#stock firmware files
stockdir = 'un-root\stock-firmware\stock'
if not os.path.exists('acceptterms.txt'):
with open('acceptterms.txt', 'w'):
WriteTxtFile = op... | true |
5b9e64f7e83488bb19769856886ad635dc153f89 | Python | Sarkermdjahirulislam/tkinter_sample | /tk-04.py | UTF-8 | 186 | 3.046875 | 3 | [] | no_license | import tkinter as tk
root = tk.Tk()
root.title('widget')
root.geometry('450x350+350+250')
lb=tk.Label(text='Label1')
bt = tk.Button(text='button1')
lb.pack()
bt.pack()
root.mainloop() | true |
4dd4c578051d421d8f867105889bda5a00500660 | Python | VinayK1985/Python-3-CP-Template | /python_cpTemplate.py | UTF-8 | 1,475 | 3.28125 | 3 | [] | no_license | #-- Competitive Programming Python 3.9 --#
#-- Fast Inputs and Outputs --#
import atexit, io, sys, numba # System Libraries
import collections, itertools, functools, operator # Data Structures
import bisect, heapq, re, math, statistics # Algorit... | true |
aee155e13122c28603348a71955a92d04444eb7f | Python | shiv125/Competetive_Programming | /codechef/JUNE17/neon.py | UTF-8 | 537 | 2.59375 | 3 | [] | no_license | t=input()
z=[]
while t>0:
t-=1
N=input()
arr=map(int,raw_input().split())
t1=0
t2=0
c=0
neg_arr=[]
pos_arr=[]
for i in range(N):
if arr[i]<0:
t1+=arr[i]
neg_arr.append(arr[i])
else:
t2+=arr[i]
pos_arr.append(arr[i])
c+=1
neg_arr=sorted(neg_arr,reverse=True)
pos_arr.sort()
lp=len(pos_arr)
... | true |
a9ef802be52f187d03a53d9e16490816e6437388 | Python | tkoz0/problems-online-judge | /vol_104/p10405.py | UTF-8 | 650 | 3.046875 | 3 | [] | no_license | import sys
for line in sys.stdin:
in1 = line[:-1]
in2 = input()
commonchars = set(list(in1)) & set(list(in2)) # set intersection
s1, s2 = '', '' # form strings by excluding chars not in both
for c in in1:
if c in commonchars: s1 += c
for c in in2:
if c in commonchars: s2 += c
... | true |
13e8d3da36f24dfc61901f385ee31b612ce7f465 | Python | Lornatang/zero-to-CNN | /MNIST.py | UTF-8 | 3,278 | 3.1875 | 3 | [
"MIT"
] | permissive | import numpy as np
# Loader base.
class Loader(object):
"""init
path: data dir.
count: file count.
"""
def __init__(self, path, count):
self.path = path
self.count = count
# read file
def get_file_content(self):
print(self.path)
f = open(self.path, 'rb')
... | true |
831b0163fb57c61e78fda63cdd93df1f152aa680 | Python | syurskyi/Python_Topics | /125_algorithms/_exercises/exercises/Python_Hand-on_Solve_200_Problems/Section 6 String/count_character_solution.py | UTF-8 | 492 | 3.5 | 4 | [] | no_license | # # To add a new cell, type '# %%'
# # To add a new markdown cell, type '# %% [markdown]'
# # %%
# # Write a Python program to count the number of characters (character frequency) in a string.
# # Sample String : google'
# # Expected Result : {'g': 2, 'o': 2, 'l': 1, 'e': 1}
#
# ___ char_frequency str1
# di.. _ # d... | true |
4c4da40cef277fbf5f3dd9b9db52cc7512d0603c | Python | zephyract/my_repo | /Digital-Image/hm1/2.2.py | UTF-8 | 2,774 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__Auther__ = 'M4x'
from pprint import pprint
import Queue
import pdb
class point():
def __init__(self, x, y, step):
self.x = x
self.y = y
self.step = step
image = ""
vis = ""
st = ""
ed = ""
def init():
global image, st, ed, vis
st =... | true |
7980286f9fb6f796949ce2929d6d81ed32c8b6aa | Python | rlworkgroup/garage | /tests/fixtures/envs/dummy/dummy_box_env.py | UTF-8 | 1,716 | 2.953125 | 3 | [
"MIT"
] | permissive | """Dummy akro.Box environment for testing purpose."""
import akro
import numpy as np
from tests.fixtures.envs.dummy import DummyEnv
class DummyBoxEnv(DummyEnv):
"""A dummy gym.spaces.Box environment.
Args:
random (bool): If observations are randomly generated or not.
obs_dim (iterable): Obse... | true |
ad07f43400d56d782ac5d67e5565c42e45fd0a87 | Python | meadow163/bss | /src/AuxIVA.py | UTF-8 | 3,557 | 2.921875 | 3 | [
"MIT"
] | permissive | import numpy as np
from numpy.linalg import inv
from scipy.signal import stft, istft
import sys
# suppose that the number of sources and microphones are equal.
# M : # of channels whose index is m
# K : # of frequency bins whose index is k
# T : # of time frames whose index is t
class AuxIVA:
def __init__(self... | true |
f339505c7f75692073f0f859c8212114b3c6486d | Python | michaeldallen/Unit-Testing-and-Test-Driven-Development-in-Python | /section4/test_FloatingPoint.py | UTF-8 | 92 | 2.5625 | 3 | [] | no_license | import pytest
def test_approx():
val = 0.1 + 0.2
assert val == pytest.approx(0.3)
| true |
de7ab63487cc804ab380c3176a504b4ac110371e | Python | zhuxiaodong2019/VIP9Base2 | /reqtest/cookie_test4.py | UTF-8 | 1,398 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
@Time : 2021/2/6 15:26
@Author : zxd
'''
#1---导入
import requests
# 发送Post请求
urlstr = 'https://www.wanandroid.com/user/login'
data = {'username':'zhuxiaodong','password':'test01'}
#2---发送请求
r = requests.post(url=urlstr,data=data)
# print('***text',r.text)
# print('***cookie',r.cooki... | true |
3f910070308b36b54ce29f11d0dc8d04dc498544 | Python | WisTiCeJEnT/intro-to-python | /day2/pt2_4.py | UTF-8 | 268 | 3.6875 | 4 | [] | no_license | # n = int(input())
# if n % 2 == 1:
# print("This is ODD!")
# else:
# print("This is EVEN!")
def odd_or_even(n):
if n % 2 == 1:
print("This is ODD!")
else:
print("This is EVEN!")
odd_or_even(2)
odd_or_even(5)
odd_or_even(6)
| true |
db566424b0e9821ab89677ec06b6ac8c8a12afff | Python | IsmailKent/ComputerVision2Submissions | /Sheet02/Sampler.py | UTF-8 | 2,536 | 3.328125 | 3 | [] | no_license | import numpy as np
class PatchSampler():
def __init__(self, train_images_list, gt_segmentation_maps_list, classes_colors, patch_size):
self.train_images_list = train_images_list
self.gt_segmentation_maps_list = gt_segmentation_maps_list
self.class_colors = classes_colors
self.patc... | true |
5a86ab06929c050a63e83554b3a42c5d90558ed9 | Python | emkael/jfrteamy-ausbutler | /ausbutler/goniec.py | UTF-8 | 588 | 2.609375 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | import socket
from .tour_config import Constants
class Goniec(object):
def __init__(self, config):
self.config = config
def send(self, files):
if self.config['enabled']:
try:
content_lines = [Constants.path] + files + ['bye', '']
goniec = socket.so... | true |
01b0cd653809a55a82c6829dff7211a176850ec1 | Python | qamine-test/codewars | /kyu_4/next_bigger_number_with_the_same_digits/test_next_bigger.py | UTF-8 | 2,995 | 3.6875 | 4 | [
"Unlicense",
"BSD-3-Clause"
] | permissive | # Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
# REFACTORING NUMBERS STRINGS INTEGERS
import allure
import unittest
import pytest
from utils.log_func import print_log
from kyu_4.next_bigger_number_with_the_same_digits.next_bigger import next_bigg... | true |
bd801227a71b492af7efa228817716401e02f2ab | Python | Maksim-Dobrozhanov/osnovi_yasika_python | /lesson_2_task_5.py | UTF-8 | 1,712 | 4.21875 | 4 | [] | no_license | # Реализовать структуру «Рейтинг», представляющую собой набор натуральных чисел, который
# не возрастает. У пользователя нужно запрашивать новый элемент рейтинга. Если в рейтинге
# существуют элементы с одинаковыми значениями, то новый элемент с тем же значением
# должен разместиться после них.
# Подсказка. Например, н... | true |
08deebe02523e6fcda97df08f75b9fda924833c8 | Python | isabella232/pyalgs | /pyalgs/algorithms/commons/shuffling.py | UTF-8 | 243 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | from random import randint
from pyalgs.algorithms.commons.util import exchange
class KnuthShuffle(object):
@staticmethod
def shuffle(a):
for i in range(1, len(a)):
r = randint(0, i)
exchange(a, r, i)
| true |
181654bced73c1c3c86be46736412fe04247793f | Python | NgoBaCuong-lqa/update-finalproject | /pom/test/test_search.py | UTF-8 | 1,441 | 2.53125 | 3 | [] | no_license | from selenium import webdriver
import unittest
from Page_Object.Search import Searchss
# import HtmlTestRunner
import sys
import time
sys.path.append(r"C:\My-Final-Project-main\FInalProjects")
class Searchs(unittest.TestCase):
baseURL = "http://automationpractice.com/index.php"
def setUp(self):
se... | true |
127cc43c0309bcfb01a1799d504244fa2a26223b | Python | kochandrea/MachineLearning_CAPP30254 | /Homework_2/functions.py | UTF-8 | 3,556 | 3.46875 | 3 | [] | no_license | # Functions created for Homework 2.
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sklearn.tree as tree
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
import graphviz
import seaborn ... | true |
c19f8ff4dff763ab3f9320965e82ab74c3475487 | Python | pylangstudy/201707 | /25/02/setattr.py | UTF-8 | 195 | 3.28125 | 3 | [
"CC0-1.0"
] | permissive | #setattr(object, name, value)
class C: pass
def A(self): print('method A.')
c = C()
print(dir(c))
setattr(c, 'A', A)
v = 'some value.'
setattr(c, 'value', v)
print(dir(c))
print(c.value)
c.A(c)
| true |
13a0ab9ca984adbc39b8390e4ac4f7bf4e3fa087 | Python | alexako/ProjectEuler | /15.py | UTF-8 | 1,465 | 3.4375 | 3 | [] | no_license | #!/bin/python
import math
import random
import sys
def find_route(grid_size):
limit = grid_size
moves = ['Right', 'Down']
path = []
x = 0
y = 0
while True:
next_move = random.choice(moves)
if x <= limit and y <= limit:
if next_move == 'Right':
y... | true |
0aee6e286854910cc42f464275911ed5a271acc9 | Python | pi-kolo/AST-comparison-thesis | /structures/node.py | UTF-8 | 406 | 3.890625 | 4 | [
"MIT"
] | permissive | class Node():
"""A class representing a simple node of a tree
Attributes:
parent: Node object representing parent in a tree
children: list of node objects that are direct descendants in a tree
name: string identifier of a node
"""
def __init__(self, name: str) -> None:
... | true |
4d30f4294a9f3aab8cae20dca9d280c53b37ed25 | Python | wuchaoml/on-campus-recruitment | /校招-2017/meituan.py | UTF-8 | 587 | 3.34375 | 3 | [] | no_license | num = int(input())
bull_str = input().split(' ')
bull_list = []
for i in range(len(bull_list)):
bull_list.append(int(bull_str[i]))
flag = 0
while True:
flag += 1
for i in range(len(bull_list)):
if bull_list[i] == 1:
for j in range(bull_list.index(bull_list[i]), len(bull_list)):
... | true |
40e011c2099dfeb110a5e87599eec0c2ce3a5932 | Python | yxzero/-basemodel | /optics_cluster.py | UTF-8 | 4,704 | 2.71875 | 3 | [] | no_license | # -*- coding:utf-8
'''
created at 2016-03-11
author:yx
'''
'''
@simirlar_metrix:dict 元组(a,b):2
@N:list对应元组里面节点
@usio:很小的范围距离
@minpts:在usio范围内最小的节点数
usio与minpts用来确定是否为核心节点
'''
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
class op... | true |
5c560afc4dbd56b92fab57d1c76326851a368a1f | Python | ashu002712/python_sem3 | /object.py | UTF-8 | 494 | 3.75 | 4 | [] | no_license | #In python every thing is a object. Object are typed,variable are untyped.
print(isinstance(4,object))
print(isinstance("Hello",object))
print(isinstance(None,object))
print(isinstance([1,2,3],object))
#object have identity
#id(object) gives object's "identity"
#"identity" is unique and fixed during an object's lifeti... | true |
bb359bffcb5f65331800e11ae58a664628851889 | Python | maximechemenda/WebScraper | /DataManager.py | UTF-8 | 2,204 | 2.796875 | 3 | [] | no_license | from requests import get
from requests.exceptions import RequestException
from contextlib import closing
from bs4 import BeautifulSoup
import csv
class DataManager(object):
def __init__(self, fileToWrite, filter, ignoring_characters_length):
self.fileToWrite = fileToWrite
self.filter = filter
... | true |
636c792a75d49a169e2d69afc132549d80aa11dd | Python | jwangac/doi2bib.py | /doi2bib.py | UTF-8 | 2,824 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import argparse
import re
import sys
import urllib.parse
import urllib.request
from collections import OrderedDict
def set_proxy(proxy):
proxy_support = urllib.request.ProxyHandler({'https': proxy})
opener = urllib.request.build_opener(proxy_support)
urllib.request.install_opener(o... | true |
f58e5b798b18494b750ddbd6628ace2917be3a14 | Python | PritKalariya/HackerRank-Python-Practice-Problems | /Basic Data Types/Find the Runner-Up Score.py | UTF-8 | 289 | 3.421875 | 3 | [] | no_license | if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
higgest = max(arr)
secondHiggest = min(arr)
for items in arr:
if (items > secondHiggest and items < higgest):
secondHiggest = items
print(secondHiggest) | true |
644f39cd3a0baa018f5b9e15f2680c32975b57b4 | Python | sftom/ee1054 | /sources/EE1054-Atividade07-Questao02-Print.py | UTF-8 | 2,216 | 2.8125 | 3 | [
"CC0-1.0"
] | permissive | #!/bin/python
# -*- coding: cp1252 -*-
'''
// Licenca Creative Commons
// Circuitos Integrados e Sistemas Embarcados - Relatorio Final de
// Gustavo Esteves, Joao Ferreira, Kadna Maria e Sergio Mendonca
// esta licenciado com uma Licenca Creative Commons
// Atribuicao-NaoComercial-CompartilhaIgual 4.0 Internacional.
/... | true |
fb06473ec84e51fff1d4b41f22f0ccb9a77e9493 | Python | Nico89000/Projet-Python-M1-Informatique-ELEOUET-MATEOS | /Projet/Appli.py | UTF-8 | 7,981 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 15 17:23:53 2021
@author: eleou
"""
import re
import pandas as pd
from Document import Document
from Auteur import Auteur
from Corpus import *
from Text import *
from Graphe import *
import plotly.graph_objs as go
import networkx as nx
import dash
import praw
import dash_... | true |
27c4f749ad6b4f37eb59c6463aa000e300f959f9 | Python | pberck/cosmo | /cosmo/group_deviation/group_deviation.py | UTF-8 | 5,066 | 3 | 3 | [
"MIT"
] | permissive | from .reference_grouping import ReferenceGrouping
from cosmo import IndividualDeviation
from cosmo.utils import DeviationContext, TestUnitError, NoRefGroupError
from datetime import datetime
import pandas as pd, numpy as np, matplotlib.pylab as plt
class GroupDeviation:
'''Self monitoring for a group of units (ma... | true |
7108caf2785ebb757cff6224e593ccd0f356a89e | Python | gaya-/hpn_cram | /toy_hpncsp/kitchen_domain.py | UTF-8 | 20,753 | 2.625 | 3 | [] | no_license |
from collections import OrderedDict # for World.location_poses
import hpncsp.miscUtil # for flatten()
import hpncsp.execute
import csplan.planner # for State
import csplan.constraints # for VarType, Constraint ...
import csplan.domain_globals # for WORLD
# # # # # # # # # # Environment # # # # # # # # # #
class W... | true |
87a12f1d554d9f4ba6d7521d67e8c0b6bc6efa47 | Python | qq854051086/46-Simple-Python-Exercises-Solutions | /problem_18_alternative.py | UTF-8 | 641 | 4.46875 | 4 | [] | no_license | '''
A pangram is a sentence that contains all the letters of
the English alphabet at least once, for example: The
quick brown fox jumps over the lazy dog. Your
task here is to write a function to check a sentence to
see if it is a pangram or not
'''
def check_pangram(passed_string):
passed_string = passed_string.l... | true |
ed133bf01e1f11fd36017a8510894e2093e3363a | Python | katasanirohith/Python-Codes | /ML lab1.b.py | UTF-8 | 356 | 3.65625 | 4 | [] | no_license | # Exponential Distribution
import random
import cmath
import matplotlib.pyplot as plt
n = int( input("Enter n value "))
lam = int(input("Enter lamda"))
y = []
ans =[]
for i in range(0,n):
x = random.uniform(-3,3)
y.append(x)
y.sort()
for i in range(0,n):
temp = lam * (cmath.e**(-1*(lam*y[i])))
ans.appe... | true |
67d8c65c9edd4211218376b79e69ef1986fd59b4 | Python | Wastoon/RL-learning | /Actor-Critic/RL_brain.py | UTF-8 | 2,251 | 2.984375 | 3 | [] | no_license |
from net import Actor, Critic
import numpy as np
import torch
import torch.optim as optim
import torch.nn.functional as F
class Actor_Critic:
def __init__(self, n_feature, n_action, lr_A=0.001, lr_C=0.01, GAMMA=0.1):
self.n_feature = n_feature
self.n_action = n_action
self.GAMMA = GAMMA
... | true |
26c707dacc44db8ede723641766c8c7fbd3e28f3 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/1379.py | UTF-8 | 435 | 3.109375 | 3 | [] | no_license | import sys
def solution(line):
count = 0
invited = 0
for i, num in enumerate(line):
if count < i:
count += 1
invited += 1
count += int(num)
return invited
def main():
sys.stdin.readline()
sys.stdout.writelines('Case #%d: %d\n' % (i + 1, solution(line.s... | true |
9c2fcb51d8030f6a571e416e95953afe2d0d091c | Python | taylorbenwright/PySide2Widgets | /widgets/ps2_BoxLayoutSeparator.py | UTF-8 | 462 | 3.109375 | 3 | [
"MIT"
] | permissive | from PySide2.QtWidgets import QFrame
class BoxLayoutSeparator(QFrame):
def __init__(self, direction, *args, **kwargs):
"""
Creates a shallow separator for a BoxLayout to use.
:param direction: Which direction this separator should go
:type direction: QFrame.Shape
"""
... | true |
d611e90c7bbf9eb53c9a542c4ea3a5e01d612671 | Python | matthewhenderson15/web_scraper | /web_scraper.py | UTF-8 | 547 | 2.875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup as bs
username = input('Input Github username: ')
url = 'https://github.com/' + username
res = requests.get(url)
content = bs(res.content, 'html.parser')
image = content.find('img', {'alt': 'Avatar'})['src']
profile = content.find('div', {'class': 'p-note user-profile-bio... | true |
d02e5c2cf394afa85d56167a5bf4fba4e9e15de3 | Python | fjy960120/python-8th-unit-exercise | /8.3.py | UTF-8 | 1,829 | 3.890625 | 4 | [] | no_license | def user_name(frist_name,last_name):
full_name = frist_name + " " + last_name
full_name = full_name.title()
return full_name
musician = user_name('jimi','edward')
print(musician)
"""8.3.2"""
def get_formatted_name(frists_name,lasts_name,middles_name=''):
fulls_name=frists_name + " " + middles_name + " ... | true |
a468ee57be3345d4070a61ec8e87cfd40da0598b | Python | mauricioklein/algorithm-exercises | /challenge-17/test_solver.py | UTF-8 | 474 | 2.953125 | 3 | [
"MIT"
] | permissive | import unittest
from solver import Solution
class TestSolver(unittest.TestCase):
def test_solver(self):
self.assertEqual(Solution().lengthOfLongestSubstring("abrkaabcdefghijjxxx"), 10)
self.assertEqual(Solution().lengthOfLongestSubstring("abcdefghij"), 10)
self.assertEqual(Solution().length... | true |
b0dd9e29c66717c7b0f187dbe8f974c9dddc046d | Python | olhanotolga/python-challenges | /positive_negative/positive_negative.py | UTF-8 | 1,443 | 4.5 | 4 | [] | no_license | __doc__
import re
def neutralize(str1, str2):
"""
Function neutralize takes two eqal-length input strings. It returns one string of the same length where each character is the result of interaction between the character in string 1 and string 2 at the same index.
- When "+" and "+" interact, they remain... | true |
732baac74dd4089bd68ac6edadf1739314dc5860 | Python | balakrishn156/Backend_engineer_leadbook | /company_profile.py | UTF-8 | 4,436 | 2.53125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import json
url = 'https://www.sgmaritime.com/company-listings?page='
company_list = []
try:
for x in range(1,600):
page_url= url+'/'+str(x)
page = requests.get(page_url,verify=False)
# print(page.status_code)
# print(page.... | true |
f9b0a9af078d163d47cd701d040d4a89a9ba2e66 | Python | ldx-web/pc_example | /baidu/pipelines.py | UTF-8 | 1,890 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import json
import pymysql
import traceback
from pymysql.cursors import DictCursor
#以json格式进行保存
class BaiduPipeline(object):
... | true |
36e61a77786eaa6d1c3a8fafcc7f25b1d6e865da | Python | shoucangjia1qu/study_python | /study0724(matplotlib).py | UTF-8 | 1,076 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 24 22:04:30 2018
@author: ecupl
"""
import os
os.chdir("D:/mywork/test")
import matplotlib.pyplot as plt
#plot图
plt.figure(figsize=(15,10), dpi=80, facecolor='#ccffff', edgecolor='#ff3333')
listx1=[10,20,30,40,50,60,70,80]
listy1=[2,4,8,16,32,64,128,256]
barx1=[10,20,30... | true |
0f2127b0eae66e85992cc8d734101250ba4e896a | Python | sbsdevlec/PythonEx | /Hello/Lecture/Day02/004. Ex.py | UTF-8 | 3,887 | 4 | 4 | [] | no_license | # 출력에 대하여 알아보자
# 형식에 맞추어 출력하기
print('12'.zfill(5))
print('-12'.zfill(5))
print('3.14'.zfill(7))
print('-3.14'.zfill(7))
print('3.14159265359'.zfill(5))
print('-3.14159265359'.zfill(5))
print('-' * 40)
# 길이와 정렬
"""
{[값인덱스]:[[채움문자]정렬][부호][#][0][,][폭][.정밀도][값의타입]}
s : 문자열, d 정수, f 부동소수, o 8진수,x 16진수, %... | true |
4d3ee0a339a7f7087d3443a04d3410060f4247f1 | Python | Kondrahin/The-mind | /app/models/models.py | UTF-8 | 1,472 | 2.609375 | 3 | [] | no_license | import logging
from sqlalchemy import Column, String, ARRAY, Integer, CheckConstraint, ForeignKey
from sqlalchemy.orm import relationship
from app.crud.base import Base
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
class Player(Base):
__tablename__ = 'players'
id = Column(String(... | true |
c9ff19199c577f38db050e28554a0649135dbd58 | Python | yhboo/lemontree | /lemontree/deprecated/misc.py | UTF-8 | 1,443 | 2.71875 | 3 | [
"MIT"
] | permissive | # Kyuhong Shim 2016
"""
Misc functions
"""
import csv
import numpy as np
import pandas as pd
import theano
import theano.tensor as T
import theano.gof.graph as graph
from theano.tensor import TensorConstant, TensorVariable
from collections import OrderedDict
# moved
def split_data(data, label, rule=0.9):
ndata =... | true |
4d7b7632874dbfda78d8df895cdf671dbab93ab0 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_53/1011.py | UTF-8 | 2,249 | 3.1875 | 3 | [] | no_license | #! /usr/bin/env python
"""
This program is part of "Google Code Jam Contest", a programming competition in which professional and student programmers are asked to solve complex algorithmic challenges in a limited amount of time.
Visit http://code.google.com/codejam
"""
__author__ = "Rodrigo Augosto (rodrigo.augosto... | true |
07bc1af205d76c088e32543c96d60206c4a671e4 | Python | oSoc19/voices-to-emotions-ai | /data/move_test_files.py | UTF-8 | 432 | 2.609375 | 3 | [
"MIT"
] | permissive | import os
import random
DIR = './train_noisy'
files = [name for name in os.listdir(DIR) if os.path.isfile(os.path.join(DIR, name))]
len_files = len(files)
NEWDIR = './test_files'
names = open('test_files.txt', 'w')
for i in range(50):
filename = files[random.randint(0, len_files - 1)]
os.rename(o... | true |
d5ebd167573d6c463fefb181b27f584449681c53 | Python | kuldeep891/DataAnalysis_with_Python | /Day3/Pandas_initial.py | UTF-8 | 489 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[32]:
import pandas as pd
data = pd.read_csv(r"C:\Users\kukumar\Documents\GitHub\LearningPython\Sample_data.csv","~")
#print(data)
#print("\n","type of data","\n")
#print(type(data))
#print(data.loc[data.COST>120000])
#print(data.loc[data.COST>120000])
#for i in ran... | true |
e9bac269f2419048085754ad43a208bacf438f6d | Python | sorako/pool | /webScrap.py | UTF-8 | 16,963 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import mySql
import requests
from bs4 import BeautifulSoup
from termcolor import colored
import schedule
import time
def web_scraping():
mySql.deleteData()
mySql.delete1Data()
mySql.delete2Data()
mySql.delete3Data()
def unit_exchanger(s):
"""
unit_cha... | true |
e0ba65a25f0d381079025e109f1ddcd47f7bb9ac | Python | uniphil/Windermere | /import-old/reload.py | UTF-8 | 1,527 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
import json
import sqlite3
import dbtypes
DATABASE = 'data.sqlite'
UPLOAD_ROOT = '/srv/www/vhosts/windermere/sites/default/files/websiteuploads/'
SAVE_TO = 'data.json'
con = sqlite3.connect(DATABASE)
con.text_factory = lambda x: unicode(x, 'utf-8', 'ignore')
con.row_factory = sqlite3.Row
cla... | true |
65cc5f833d2a5f3f87620345c8669ec61c297de4 | Python | gabonator/LA104 | /system/apps_featured/113_circuitpython/scripts/chess.py | UTF-8 | 236 | 2.796875 | 3 | [
"MIT"
] | permissive | import mini
lcd = mini.lcd()
colors = [0x8040ff, 0x8060ff, 0x8080ff, 0x40a0ff]
for x in range(0, 320/20):
for y in range(0, 200/20):
i = x + y
c = colors[i % 4]
lcd.color(c)
lcd.bar(x*20, y*20+14, x*20+18, y*20+18+14)
| true |
0a38d7596ec8f512e93ec72cdcce5c2bfd162288 | Python | lmdslyngl/lmdsmusic | /src/musictag/util.py | UTF-8 | 589 | 2.734375 | 3 | [
"MIT"
] | permissive |
class TagLoaderException(Exception):
pass
def str2int(s: str, default=0) -> int:
try:
return int(s)
except ValueError:
return default
def get_or_default(d, k, default=""):
if k in d:
return d[k]
else:
return default
def bytes2str(buffer: bytes) -> [str, bytes]:... | true |
46d1bba3a06e10441a712808e189ea86f0226b53 | Python | alixdamman/memento | /python/functions/model_function_4.py | UTF-8 | 1,614 | 4 | 4 | [] | no_license | # ====== How to define and call functions ======
#
# Exercise 4: create a function in a model script
#
# * open the module "model_function.py"
# * create a function called 'projection' that reproduces the calculation done below comments "# start projection ..."
# The function has two arguments called 'initial_pop' an... | true |
535707bf0e575399aa55916cb359a6b54cc7de61 | Python | darts/CSU33061-ArtificialIntelligence | /assignment2/hw2.py | UTF-8 | 2,404 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
import json
import sys
class DictDefaultEncoder(json.JSONEncoder):
def default(self, o):
return o.__dict__
class PR:
def __init__(self, p, r):
self.p = p
self.r = r
PR_MAT = {
'exercise': {
'fit': { 'fit': PR(0.99, 8), 'unfit': PR(0.01, 8) },
... | true |
793bf468d50287c4bf82785810194ec7dcbd69c1 | Python | tobywynne-mellor/csvToBarcodeGenerator | /barcodeSheetGeneratorV2.py | UTF-8 | 4,409 | 2.640625 | 3 | [] | no_license | import os
import math
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.graphics.shapes import Drawing, String
from reportlab.graphics.barcode.eanbc import Ean13BarcodeWidget
from reportlab.graphics import renderPDF
from reportlab.pdfgen.canvas import Canvas
class BarcodeSheetGe... | true |
7e640940bca2f7bfb8f3a8fab2c1e3cde5b25493 | Python | artemfile2/python_parser | /file_exist.py | UTF-8 | 650 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Модуль для проверки есть ли файл в папке
import os
# Год, месяц и наименование ЛПУ для файла в архиве
# year, month, glpu
def exist(dir, year, month, glpu):
#Наименование файла zip c xml
file_zip = 'HT05S50_' + year[2:4] + month + glpu
if os.path.exists(dir + file... | true |
7d3c0021c92e624b43bda202fcf68737f4aaa68a | Python | demo112/1807 | /python/Myself_Project/student_project/student.py | UTF-8 | 1,315 | 3.8125 | 4 | [] | no_license | class Student:
def __init__(self, name='无名氏', age=0, score=0):
"""此方法用来给人对象添加'姓名', '年龄', '家庭住址'三个属性"""
self.name = name
self.age = age
self.score = score
def set_score(self, score):
if 0 <= score <= 100:
self.score = score
def show_info(self):
""... | true |
75f7e15d6f742f5f3c3468bc9055b6c71656090a | Python | BhavyasreeS/Multicloud_Flask_Application | /bucketaccess.py | UTF-8 | 1,239 | 2.734375 | 3 | [] | no_license | # Note: This code is lambda function B, and is used for read/write to s3
import json
import boto3
def lambda_handler(event, context):
s3=boto3.client('s3')
bucket='bucketcoursework' #name of s3 bucket
input=(event['key1'])
input=input.split(",")
choice=int(input[0])
#choice=1, then write to S3 ... | true |
c361d8c527cf1c3af93a6476fadc427b9d34026b | Python | surenthiran123/sp.py | /380.py | UTF-8 | 205 | 3.296875 | 3 | [] | no_license | n1,n2=input("").split()
n1,n2=(int(n1),int(n2))
for i in range(n1,n2):
a=0
b=i
while(i!=0):
r=i%10;
a=a+r*r*r;
i//=10;
if(b==a):
print(b,end=" ")
| true |
a1a4173d961e7e16e9b2f0f42ee468f69d23c921 | Python | spicelfreep/python_learn1 | /基础/python中的args和kw/1.py | UTF-8 | 668 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File : python中的args和kw.py
@Time : 2019/11/27 14:49
@Author : helin
@Version : 1.0
@Contact : spicalfreep@163.com
@License : (C)Copyright 2019-2020
@Desc : None
@Modify Time @Author @Version @Desciption
--------... | true |
d704c543b9d9b2fe4cb27a2b4cc662249ef50492 | Python | HabibAroua/appML | /basic/list.py | UTF-8 | 306 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
listName= ["Habib" , "Safa" , "Nada" , "Salah"]
print listName
print listName[1]
listName.append("Laila")
print listName
del listName[2] #del is delete
print listName
listNumber = [5,3,8,7,1,5,4,9]
print listNumber
print max(listNumber)
print min(listNumber)
print len(listNumber)
| true |
6cc69a811ad6f69c60404128bf82d6543e8ca663 | Python | brianchiang-tw/leetcode | /No_1051_Height Checker/height_checker_by_sort_pythonic.py | UTF-8 | 1,433 | 3.71875 | 4 | [
"MIT"
] | permissive | '''
Description:
Students are asked to stand in non-decreasing order of heights for an annual photo.
Return the minimum number of students not standing in the right positions. (This is the number of students that must move in order for all students to be standing in non-decreasing order of height.)
Example 1:
... | true |