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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f37d5043376f868ffa39d1c68706e24efc8ff64d | Python | rr-y/facial-expression-recognition | /src/models/VG19.py | UTF-8 | 3,570 | 2.625 | 3 | [] | no_license | from keras.applications import VGG19
import pandas as pd
import numpy as np
import tensorflow as tf
from keras.optimizers import SGD, Adamax
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout, Convolution2D, Flatten, MaxPooling2D, InputLayer
from format_data import get_data_in_matri... | true |
e1d73b3d223a1ac0934dfe9a7bdbf45ef520e787 | Python | GitMark0/wow-auction-tool | /modify_csv.py | UTF-8 | 772 | 2.71875 | 3 | [] | no_license | import pandas as pd
import math
import calendar
c = calendar.Calendar()
vos_tbl = pd.read_csv('anchor-weed18.csv')
rows_list = []
for index, row in vos_tbl.iterrows():
year = int(row['Year'])
month = int(row['monthVal'])
for i in c.itermonthdays(year, month):
if i == 0:
continue
... | true |
d63dc515fbbb003ee335275a6da650c35fa09a1a | Python | rising-entropy/Assignment-Archives | /DAA/Assignment 4/Q1a.py | UTF-8 | 559 | 3.875 | 4 | [] | no_license |
# Naive method for matrix multiplication
m1 = [[3, 4]]
m2 = [[3, 1], [5, 6]]
def matrixMultiply(m1, m2):
if len(m1[0]) != len(m2):
print("Matrix Multiplication is not possible for this matrix.")
return []
res = [[0 for i in range(len(m2[0]))] for j in range(len(m1))]
for i in range(len(m1... | true |
8265051344156244521953d3e0097badea0df6de | Python | ggruszczynski/pyVLM | /tests/test_CL_CD_from_coeff.py | UTF-8 | 449 | 2.5625 | 3 | [
"MIT"
] | permissive | import numpy as np
from numpy.testing import assert_almost_equal
from unittest import TestCase
from solver.coeff_formulas import get_CL_CD_free_wing
class TestMesher(TestCase):
def test_get_CL_CD_from_coeff(self):
AR = 20
AoA_deg = 10
CL_expected, CD_ind_expected = get_CL_CD_free_wing(AR,... | true |
d386832ccc2eb65a67f1ce920077c456ee758862 | Python | valeriobasile/wordrobber | /wordrobber_django/wrws/test_data.py | UTF-8 | 1,627 | 2.53125 | 3 | [] | no_license | from django.http import HttpResponse
import simplejson
from models import *
from django.contrib.auth.models import User
def load_test_data(request):
# delete existing objects, except admin user
Player.objects.all().delete()
User.objects.exclude(is_superuser=True).delete()
Choice.objects.all().delete()
... | true |
95f461f6098372941fca40a5f86bd7eac18f5057 | Python | zongzeliunt/Python_experiments | /algorithms/AVL_BR_tree/AVL_tree.py | UTF-8 | 7,595 | 3.453125 | 3 | [] | no_license | class bitree ():
def __init__ (self, value):
self.value = value
self.left = None
self.right = None
self.height = 1
self.balance = 0
self.is_avl = 1
def insert (self, value):
#{{{
val = self.value
if value > val:... | true |
9e94cb6d386dc122233a9a4411a34ded656ec2ea | Python | PremierLangage/Yggdrasil | /exemples/mkl.py | UTF-8 | 2,942 | 2.96875 | 3 | [] | no_license |
import csv, json, random
def fromcsv(filename, sourcecol="source", targetcol="target"):
"""
Will work for non mapping.
"""
MatchListItem=[]
expected=[]
n=789
d={}
with open(filename,"r") as csvfile:
reader=csv.DictReader(csvfile,delimiter=';')
for row in reader:
... | true |
195fdd20181d34681a4554ade6e94fde527a2df3 | Python | nicholas1717/quantitative_analysis | /py/xmb_dbconnector.py | UTF-8 | 2,850 | 2.703125 | 3 | [] | no_license | #!/usr/local/bin/python3
import pymysql
class MysqlConnector:
def __init__( self, phost, pport, pusr, ppwd):
self.__connector = pymysql.connect(host=phost,port=int(pport),user=pusr,passwd=ppwd)
self.__cursor = self.__connector.cursor()
def __del__( self):
self.__connector.close()
... | true |
6b0d07d1922e48027954898f381435c3075bdaf6 | Python | SaFuse/parse | /allhtml.py | UTF-8 | 159 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import urllib2
url = "http://uxmilk.jp/12691"
htmldata = urllib2.urlopen(url)
print unicode(htmldata.read(), 'utf-8')
htmldata.close()
| true |
694a912c7ad76b8231cc03561a304b1c8bce7742 | Python | tamarinvs19/python-learning | /matplotlib/graphics.py | UTF-8 | 357 | 3.40625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-5, 5, 100)
plt.plot(x, x**np.sign(x), label='a')
plt.plot(x, (x+5)*(x-2)*(x+6), label='b')
plt.plot(x, 5*x*np.sin(x), label='c')
plt.plot(x, np.degrees((np.sign(x)*x)**0.5), label='d')
plt.plot(x, 0.5**x, label='e')
plt.xlabel('x label')
plt.ylabel(... | true |
9bd4a7995848f4b6910037cf2dc55924544e80dd | Python | solidjerryc/Animal-world-simulate | /player.py | UTF-8 | 2,527 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 4 23:22:25 2018
@author: JerryC
"""
INIT_STARS=3 #星星的个数
import random
import collections
class player:
def __init__(self,no=0):
self.__no=no
self.__cards=['s','r','p']*4 #初始牌 s:剪刀 r:石头 p:布
self.__stars=INIT_STARS
random.shuffle(sel... | true |
e24d3320f9b6125ece18527c4d69a10e666fcd68 | Python | tchad/CSP_to_STG_parser | /preprocessor.py | UTF-8 | 5,186 | 2.59375 | 3 | [] | no_license | # CSP to STG parser v 0.0.1concept_preview_alpha
#
# Tomasz Chadzynski
# San Jose State University, 2020
#
# This software is provided AS IS and comes with no warranty
#
# The CSP source parser to token representation
import re
import regex
import p_types as t
def load_raw(model, filename):
with open(filename)... | true |
95d662701075fc534f872706564291cbbef7467e | Python | PrettyAutomation/BasicPythonProgram | /Input/loops.py | UTF-8 | 1,068 | 4.15625 | 4 | [] | no_license | # while loop
count = 0
while count<3:
print('hello pretty')
count = count + 1
print('--------------------------------------')
# while loop with else condition
num = 0
while num <3:
print('hello python')
num = num+1
else:
print('bye python')
print('--------------------------------------')
# for lo... | true |
65c299f1750c6e3f566154f209d2fed1a825663f | Python | AdrianPilko/ProjectEuler | /12.py | UTF-8 | 1,274 | 3.6875 | 4 | [] | no_license | # script to solve project euler problem 12
import time
import math
def v(x):
numberOfFactors = 0
for i in range(1,x+1):
if x % i == 0:
numberOfFactors+=1
return numberOfFactors
def factor_number(n):
number_of_factors = 0
for i in range(1, int(math.ceil(math.sqrt(n))... | true |
383b63dc198b1eeeea3d5438cb2b9d37cc2e21da | Python | wenyifeng1123/GUI | /window/4RadioButton.py | UTF-8 | 622 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import Tkinter as tk
window=tk.Tk()
window.title('my window')
window.geometry('200x200')
var=tk.StringVar()
l=tk.Label(window,bg='yellow',width=40,height=4,text='empty')
l.pack()
def print_selection():
l.config(text='you have selected '+var.get())
r1=tk.Radiobutton(window... | true |
6aa39e9a8b9d7e98e958701ce846b5f4ef46df78 | Python | compsciencelab/trifinger_simulation | /scripts/view_camera_log_real_and_sim.py | UTF-8 | 3,374 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
"""view rendered and real images in parallel.
Loads robot and camera log files and plays back the images from the log while
at the same time rendering images in the simulation, using the robot and object
state from the log file.
"""
import argparse
import pathlib
import numpy as np
import cv2
i... | true |
ebda2cc7bcc9db9ed3d22e1f35aef17ed70789cf | Python | kargarisaac/R2D2 | /memory.py | UTF-8 | 8,100 | 2.59375 | 3 | [] | no_license | import random
from collections import namedtuple, deque
from config import sequence_length, burn_in_length, eta, n_step, gamma, over_lapping_length
import torch
import numpy as np
Transition = namedtuple('Transition', ('state', 'next_state', 'action', 'reward', 'mask', 'step', 'rnn_state'))
class LocalBuffer(object)... | true |
38fe4ef2846c4df11f2aec338a231a35192daffc | Python | gomanish/Python | /basic/1st.py | UTF-8 | 240 | 4.1875 | 4 | [] | no_license | # Use for, .split() and if to create a statement that will print out words that start with 's':
st='Sam print only the words that start with s in this sentence'
world=[x for x in st.split() if x[0].lower()=='s' ]
for z in world:
print(z)
| true |
76d6a14875d6383d40aa03fe2bb7aaf6a0bb5a71 | Python | xudalin0609/leet-code | /Array/threeSumClosest.py | UTF-8 | 1,499 | 3.859375 | 4 | [] | no_license | """
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
Example:
Given array nums = [-1, 2, 1, -4], and target = 1.
The sum that is clo... | true |
4f014a5e67756d534e2d2e6621782ceaf1bd7c5c | Python | aaronlifshin/howtosavedemocaracy | /models/privateArea.py | UTF-8 | 678 | 2.6875 | 3 | [] | no_license | from google.appengine.ext import ndb
from models.whysaurusexception import WhysaurusException
import re
class PrivateArea(ndb.Model):
name = ndb.StringProperty()
@staticmethod
def create(newName):
namespaceCheck = re.compile('[0-9A-Za-z._-]{0,100}')
if not namespaceCheck.match(newName)... | true |
34e3bd0b2e28eb9e89e46589f7847f466babbe82 | Python | crisbernf/Openstack-plugin | /type.py | UTF-8 | 63 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import types
k = 5
if(type(k)==types.IntType):
print ('int') | true |
23ced4c8e38e7150102b508b3b561480bef0c10a | Python | pa/dms_data_export | /extract_table_statistics.py | UTF-8 | 2,464 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | import sys
import json
import csv
import time
import boto3
# Get DMS Table Statistics Method
def get_table_statistics(client, replication_task_arns):
"""
Get DMS Table Statistics
:client: boto3 client
:replication_task_arns: The Amazon Resource Name (ARN) of the replication task
:return: Table sta... | true |
595a1032b1bea1ba20b1e9b6872d8c7b70e02b76 | Python | YuLili-git/leetcode_offer | /剑指 Offer 47. 礼物的最大价值.py | UTF-8 | 916 | 3.671875 | 4 | [
"BSD-2-Clause"
] | permissive | #在一个 m*n 的棋盘的每一格都放有一个礼物,每个礼物都有一定的价值(价值大于 0)。你可以从棋盘的左上角开始拿格子里的礼物,并每次向右或者向下移动一格、直到到达棋盘的右下角。给定一个棋盘及其上面的礼物的价值,请计算你最多能拿到多少价值的礼物?
#示例 1:
#输入:
#[
# [1,3,1],
# [1,5,1],
# [4,2,1]
#]
#输出: 12
#解释: 路径 1→3→5→2→1 可以拿到最多价值的礼物
class Solution:
def maxValue(self, grid: List[List[int]]) -> int:
m = len(grid)
n = ... | true |
c1e9d040ee55dc2587b4202562f8beec61d02d85 | Python | mrlesmithjr/acitoolkit | /samples/aci-where-used.py | UTF-8 | 1,122 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
Find out where a DN is used
"""
from acitoolkit import Credentials, Session
from tabulate import tabulate
data = []
def main():
"""
Main execution routine
"""
description = ('Simple application that logs on to the APIC'
' and displays usage information fo... | true |
66cd46663a9752e67a6f2809fb516344ebba62b2 | Python | wuxinxi/Python_Sudy | /venv/Include/base/custiomfuction.py | UTF-8 | 2,496 | 4 | 4 | [] | no_license | def myAbs(n):
if n > 0:
return n
else:
return -n
print(myAbs(10))
# x作为定参,n可缺省默认2
def power(x, n=2):
c = 1;
while n > 0:
n -= 1
c = c * x
return c
print(power(2, 10))
def count(x):
sum = 0
for n in x:
sum += n;
return sum
print('count=', ... | true |
9940b1c042457cf0232935e3f7c46a25d547abd8 | Python | gwolf/sistop | /codigo/prod_cons_v3.py | UTF-8 | 1,158 | 3.03125 | 3 | [
"CC-BY-4.0"
] | permissive | # *-* Encoding: utf-8 *-*
import threading
import time
import random
mutex = threading.Semaphore(1)
elementos = threading.Semaphore(0)
buffer = []
max_buffer = 5
multip_buffer = threading.Semaphore(max_buffer)
duracion = {'prod': 0.5, 'cons': 1}
class Evento:
def __init__(self, hilo):
self.ident = random.r... | true |
c7adb531297bdd67234429d2d471cf992d26269a | Python | captflint/dndscripts | /statroller.py | UTF-8 | 325 | 3.171875 | 3 | [] | no_license | from roll import roll
results = []
for x in range(0, 6):
statroll = roll('4d6')
print(statroll)
statroll.sort()
del statroll[0]
results.append(sum(statroll))
modifiers = []
for stat in results:
stat = stat - 10
modifiers.append(stat // 2)
print(results)
print('total modifiers:', sum(modifie... | true |
bf8af1d70134c3911dc65208fddeed4c13c54fe3 | Python | KiroSummer/A_Syntax-aware_MTL_Framework_for_Chinese_SRL | /src/baseline-MTL-dep-private-lstm-weighted-sum-as-input/neural_srl/TreeLSTM/Encoder.py | UTF-8 | 2,470 | 2.546875 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence as pack
from torch.nn.utils.rnn import pad_packed_sequence as unpack
from TreeGRU import *
from Tree import *
class EncoderRNN(nn.Module):
""" The standard RNN encoder.
"""
... | true |
6c2b697f0b4d0f221a635a923f4bdafc66417ab1 | Python | chayin1/ikotun-ChristRiches | /project_olushola.py | UTF-8 | 4,053 | 3.15625 | 3 | [] | no_license | # Program to compute pupils results
#Olushola Sunday
#Code Lagos 5.0
#06/12/2018
print('WELCOME TO SAINT MARIS INTERNATIONAL SCHOOL RESULT COLLATION SHEET')
grand_total = 0
name = input('What is your name: ')
print('Welcome',name.upper(),'are you ready for the result compilation')
response = input('enter yes or... | true |
2bb6a9e5e12a5191989be1283f7ac0f728b33acc | Python | nakamura196/dip | /src/001_createList.py | UTF-8 | 1,337 | 2.78125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import os
import csv
# スクレイピング対象のhtmlファイルからsoupを作成
soup = BeautifulSoup(open('data/index1.htm'), 'html.parser')
aas = soup.find_all("a")
rows = []
rows.append(["url1", "label1", "url2", "label2"])
for aa in aas:
label = aa.text
# path = "data/p"+aa.get("hre... | true |
3ea540b6b9fc51f5a96858524de9f39bc1f0013e | Python | EdoardoGruppi/Sudoker | /game.py | UTF-8 | 18,811 | 3.53125 | 4 | [] | no_license | # Import packages
import random
import pygame
import numpy as np
class SudokuGame:
def __init__(self, base, clues, unique):
# Visual variables
self.screen, self.font1, self.font2 = None, None, None
self.pos_x = 0
self.pos_y = 0
self.box_side = 50
# Sudoku variables
... | true |
6f6d297077e91fa91d72aaa59eb888d6785bda09 | Python | nadeesha90/rolling-median-venmo | /src/process_paymentfile.py | UTF-8 | 1,013 | 2.78125 | 3 | [] | no_license | import json
from datetime import datetime
import pdb
import sys
from payments_window import payments_window
#class to process payment file
class process_paymentfile:
def __init__(self,fname):
self.fname = fname
#yeilds dictionary encapsulating the payment
def payment_gen(self):
with open(s... | true |
4a212be4f644c7d2d889eacbd615bc0f89e5ce11 | Python | Zorch34/Reto1-G02. | /App/view.py | UTF-8 | 5,000 | 3.203125 | 3 | [] | no_license | """
* Copyright 2020, Departamento de sistemas y Computación, Universidad
* de Los Andes
*
*
* Desarrolado para el curso ISIS1225 - Estructuras de Datos y Algoritmos
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published b... | true |
5e328c9a28cdfd2f39f2ed0317e82b8d4aca9661 | Python | Jhruzik/pybundestag | /pybundestag/parser/mdbparser.py | UTF-8 | 11,085 | 3.53125 | 4 | [
"MIT",
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Import Modules
from bs4 import BeautifulSoup
import itertools
import pandas as pd
import json
# Read in XML File
def read_mdbs(path):
"""Reads in data on members of the Bundestag
as BeautifulSoup
This function uses master data on members of the
... | true |
b2f1c460d20fe34dff0d29b67268daef96b1fa57 | Python | Blubmin/adversarial_tower_defense | /unit_agent.py | UTF-8 | 10,194 | 3.3125 | 3 | [
"Apache-2.0"
] | permissive | import pygame
from math import sqrt
from random import randint, randrange, choice
from unit import Unit
from actions import *
from mongo_wrapper import MongoWrapper
# place random
# place right of last unit
# place left of last unit
# place same as last unit
# place random right side
# place random left side
# place ... | true |
b00957031009ad64b83849aeaf403d69935ceb77 | Python | autopkg/rtrouton-recipes | /AdobeCreativeCloud/XMLReader.py | UTF-8 | 2,616 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/local/autopkg/python
from __future__ import absolute_import
import os.path
import xml.etree.cElementTree as ET
from autopkglib import Processor, ProcessorError
__all__ = ['XMLReader']
class XMLReader(Processor):
input_variables = {
"xml_path": {
"required": True,
"descri... | true |
288531850ad982d287c6b3e067746484cfa65037 | Python | A-kali/finance_and_quant | /main.py | UTF-8 | 1,893 | 2.53125 | 3 | [] | no_license | import os
import glob
import talib
import pandas as pd
import akshare as ak
import warnings
from visualize import plot_chart
from utils import period_data, pure_period_data, latest_trading_day
from pool import english_columns, StockPool
from strategy import TripleScreen
save_path = 'akshare_dataframe'
def get_stock... | true |
22ca0e2a1507e2091d77b4926e0feeeca8703436 | Python | alejandrocglez/TFM | /UsingClassifyer.py | UTF-8 | 3,720 | 3.140625 | 3 | [] | no_license | import pickle # para guardar el clasificador
from nltk.tokenize import word_tokenize
# Obtenemos el clasificador LRB
from sklearn.feature_extraction.text import TfidfVectorizer
from unidecode import unidecode
def esFakeOCSVN(text):
number = OCSVN_Classifier.predict(text)
print(number)
if number ... | true |
ed48a3e7686d0b10246fdd8ff581b2c425ae039c | Python | AlexanderOS1999/EFNMR-SNR | /Data-reader-plotter.py | UTF-8 | 2,658 | 3.46875 | 3 | [] | no_license | """
Created on Tue Nov 24 14:10:10 2020
@authors: ewank
"""
import numpy as np
import matplotlib.pyplot as plt
def lim_calc(x , y , width , sensitivity):
# Function analyses two arrays and returns appropriate x limits based on y variation
# Width controls how far either side of useful data to plot... | true |
b90da9382461db1a8e277b7c88583380c9e653f1 | Python | Aditya14nov/ScreenshotImage_to_Text | /Image to text using pytesseract.py | UTF-8 | 1,201 | 2.53125 | 3 | [] | no_license | from PIL import Image,ImageEnhance
import cv2 as cv
import pyscreenshot as ss
from pytesseract import pytesseract
import numpy as np
# part of the screen
im=ss.grab(bbox=(500,100,1400,1000))
#im.show()
im.save('C:\\Users\\ACER\\Pictures\\save.png')
# Defining paths to tesseract.exe
# and the image we would be using
#p... | true |
1aafb9426844e477d6923b3c9510e10a11ca4d26 | Python | yeafla530/baeckjoon | /python/문자열/경고.py | UTF-8 | 315 | 2.921875 | 3 | [] | no_license | h1, m1, s1 = map(int, input().split(':'))
h2, m2, s2 = map(int, input().split(':'))
start = h1*60*60+ m1*60 + s1
end = h2*60*60+ m2*60 + s2
print(start, end)
time = end - start if end > start else end - start + 24*60*60
h = time // 60 // 60
m = time // 60 % 60
s = time % 60
print("%02d:%02d:%02d" % (h, m, s))
| true |
70b13fb47cd1e738353b0ebc602a4bd2849de789 | Python | bioinfo-pf-curie/HiC-Pro | /scripts/src/ice_mod/iced/datasets/base.py | UTF-8 | 1,952 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | import os
from os import environ, makedirs
from os.path import join, expanduser, exists
from os.path import dirname
import shutil
from .. import io
# authors: Nelle Varoquaux <nelle.varoquaux@gmail.com>
# This module is greatly inspired from sklearn.datasets
def get_data_home(data_home=None):
"""Return the pat... | true |
f7c71fbd6dd148badf1a422b581b111ec7c5a70e | Python | mahendraprabhu/Raspi_CameraCalibrate | /CameraCalibration.py | UTF-8 | 938 | 2.625 | 3 | [] | no_license | import time
import picamera
import cv2
import numpy as np
Filename = 'Test_image'
exposure = 100 + 7*np.linspace(0,100,11)
#exposure = 500*np.ones(20)
count = 0
print exposure
for i in exposure:
print int(i)
with picamera.PiCamera() as camera:
camera.resolution = (500, 500)
camera.framerate = ... | true |
b97b99309af3c3ba2b859dd9acd0cb7d368c6935 | Python | Rybec/Video-Game-Design | /demos/efficiency.py | UTF-8 | 510 | 3.515625 | 4 | [] | no_license | import sys
from pympler.asizeof import asizeof
class Arrays(object):
def __init__(self, num=100):
self.pos = [(2, 2) for i in xrange(num)]
self.name = ["My Name" for i in xrange(num)]
self.level = [1 for i in xrange(num)]
self.c = ["fighter" for i in xrange(num)]
class Char(object):
def __init__(... | true |
3a2a41a89efaf3e9e080384a9476b851ff836750 | Python | annajungbluth/sEQE-Analysis-Software | /source/gaussian.py | UTF-8 | 16,151 | 2.8125 | 3 | [] | no_license | import math
import numpy as np
from numpy import exp
from scipy.interpolate import interp1d
from source.compilation import compile_EQE
from source.utils import R_squared
# -----------------------------------------------------------------------------------------------------------
# Function to calculate gaussian ab... | true |
a1dd1a02666a7dbfba4a7e07320ff66fa976107b | Python | EricLum/python-algos | /maze_example.py | UTF-8 | 2,652 | 3.75 | 4 | [] | no_license | # take a typical RXC maze wehre S is the start and E is the end
# rocks are indicated by #
# the objective is to find the shortest path between S and E.
graph = [
['S', '.', '.', '#', '.', '.', '.'],
['.', '#', '.', '.', '.', '#', '.'],
['.', '#', '.', '.', '.', '.', '.'],
['.', '.', '#', '#', '.', '.',... | true |
e8c4cebe94957802b7636cd225eea2cc8b2e2e17 | Python | zy1417548204/julive_txt_process | /extract_label/extract_rules.py | UTF-8 | 30,048 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @FileName:
# @Author: qian qian
# @Create date:
# @Description:
import jieba
from config.rule_constants import ConstValue
from utils.nlp_tools import NLPTools
from utils.text_dealer import Preprocess
class RulesMatch(object):
def rule_identifier(self):
pass
class ItemRulesMatc... | true |
35d4d303cad5df5fcb3f8008ecc14f9d978592c6 | Python | Lal4Tech/GetOldTweets-python | /Main.py | UTF-8 | 2,347 | 2.6875 | 3 | [
"MIT"
] | permissive | import sys
import json
from datetime import date, timedelta
if sys.version_info[0] < 3:
import got
else:
import got3 as got
def main():
def getJson(t):
data = {}
data['Tweetid'] = t.id
data['Permalink'] = repr(t.permalink)
data['formatted_date'] = t.formatted_date
data['Userid'] = t.author_id
data... | true |
90714eb89720f856056d420ccd22627af1c40ad3 | Python | kmorooka/sysmap | /sysmap.py | UTF-8 | 1,969 | 2.765625 | 3 | [] | no_license | #--------------------------------------------------------------------
# Name: sysmap.py
# Function: convert file from sjis to UTF8, call sysmap_jl.jl, call sysmap_pptx.py to make PPTX file.
# Usage: > python sysmap.py <sjis fn> <pptx fn> [CR]
# Sample: > python sysmap.py asset.csv asset.pptx [CR]
#---------------------... | true |
b2b3640a7fc5d3bc32dbe191db9df51331448db7 | Python | crack521/edward | /examples/beta_bernoulli_pymc3.py | UTF-8 | 804 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
A simple coin flipping example. The model is written in PyMC3.
Inspired by Stan's toy example.
Probability model
Prior: Beta
Likelihood: Bernoulli
Variational model
Likelihood: Mean-field Beta
"""
import edward as ed
import pymc3 as pm
import numpy as np
import theano
from edward... | true |
afdc5f10def4095a57cb054ed8db9bff1129d6bf | Python | d80b2t/WW4C | /plots/sky_distribution/hexbin/get_bins_aitoff_StO.py | UTF-8 | 1,899 | 2.890625 | 3 | [] | no_license | '''
Original code based on::
https://stackoverflow.com/questions/12951065/get-bins-coordinates-with-hexbin-in-matplotlib
My question and answers::
https://stackoverflow.com/questions/46320712/putting-matplotib-hexbin-into-an-aitoff-projection
'''
import numpy as np
import matplotlib.pyplot as plt
from astropy.io impo... | true |
a87cf87fc76c6518d296fa45e873a4cd7a26bf74 | Python | tinnan/python_challenge | /16_numpy/102_concatenate.py | UTF-8 | 378 | 3.46875 | 3 | [] | no_license | """
You are given two integer arrays of size NxP and MxP (N & M are rows, and P is the column).
Your task is to concatenate the arrays along axis 0.
"""
import numpy as np
N, M, P = list(map(int, input().split()))
a = np.array([list(map(int, input().split())) for _ in range(N)])
b = np.array([list(map(int, input().spl... | true |
108f2a710c216152079b07fee1e8beafecce683c | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_3/danalpha/qual_c.py | UTF-8 | 1,900 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
magic_numbers = {
16: [3, 2, 5, 2, 7, 2, 3, 2, 7],
32: [3, 2, 5, 2, 7, 2, 3, 2, 11]
}
def num_for_base(bin_string, pows):
num = 0
for index, c in enumerate(bin_string[::-1]):
if c == '1':
num += pows[index]
return num
def find_di... | true |
4b6b5da105b8839c70db3fc9e213a6000be6a28e | Python | MichielCottaar/mcot.core | /mcot/core/_scripts/parcel/discretise.py | UTF-8 | 5,278 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
Discretizes a continuous variable
"""
from loguru import logger
from mcot.core import scripts
import numpy as np
import colorcet as cc
from mcot.core.cifti import combine
def run_array(arr, nbins, bins=None, weight=None, include_zeros=False):
"""
Returns a discretised version of the ... | true |
fb29a70a341df6052a916ea51d071d59629733a6 | Python | chatanisota/nodule_me | /src/classes/label_for_display.py | UTF-8 | 1,562 | 2.71875 | 3 | [] | no_license | import numpy as np
from classes.color import Color
from classes.user import User
from copy import deepcopy
class LabelForDisplay:
__label = None
__is_writting = False
__line_color = Color.red()
__is_close = True # ラベルの開口可否
__highlight_index = -1
__points = []
__calculated_points ... | true |
64dbbd8cf0cd06ba2023142d5c511e5888020c41 | Python | rivadunga/calidad-pruebas | /Selenium/BlazeDemo/reserveFlights.py | UTF-8 | 1,846 | 2.609375 | 3 | [] | no_license | import random
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select
def randomCard(length):
out = ""
for num in... | true |
baef882fd27ee12d94286c106087538541af3b32 | Python | dbarrerap/weatherStation | /dataGathering.py | UTF-8 | 2,356 | 2.734375 | 3 | [] | no_license | #!/usr/bin/python
import Adafruit_BMP.BMP085 as BMP085
import Adafruit_DHT as DHT
import Adafruit_SSD1306
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import json
import sqlite3
from sqlite3 import Error
import time
import sys
# Initialize BMP180
sensor = BMP085.BMP085(mode=BMP085.BMP085... | true |
e16c78a748aeba6fdcb7ef5f3539f2cbb97d3082 | Python | canokay/Algorithms | /7-Datatime/Python/datetime.py | UTF-8 | 430 | 3.3125 | 3 | [] | no_license | import datetime
now = datetime.datetime.now()
yyyy = str(now.year)
mm = str(now.month)
dd = str(now.day)
hh = str(now.hour)
mi = str(now.minute)
se = str(now.second)
ms = str(now.microsecond)
print(str(now))
print('Current year:',yyyy)
print('Current month:',mm)
print('Current day:',dd)
print('Current hour:',hh)
prin... | true |
b9d9b87232b67e887db2d80f6cabefb0129556c0 | Python | IanWang15/codingExercise | /leetcode81findRSAwithDuplicate.py | UTF-8 | 1,578 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 30 19:19:06 2019
@author: yiwang
"""
class Solution():
def findTargetRSA(self, nums, target):
if nums is None or len(nums) == 0:
return False
start = 0
end = len(nums) - 1
if nums[start] == ... | true |
8e40c4be740a3c11aa8599bac1e96e4427973ecc | Python | xiaoxifei1223/Imageprocess | /util/pyramid.py | UTF-8 | 24,748 | 2.796875 | 3 | [] | no_license | # coding --utf8
'''
author:chenhao
email:haochen9212@outlook.com
data:2017.7.30
'''
import numpy as np
import scipy
import scipy.signal
from skimage.color import rgb2gray
from scipy.misc import imread as imread
from scipy import linalg as linalg
import matplotlib.pyplot as plt
import os
import cv2
import png
import py... | true |
c7ecdc02921b6fea28e135257d20640b1b4c7ed6 | Python | MacHu-GWU/pyclopedia-project | /pyclopedia/p02_ref/p02_function/p01_decorator/p02_recipe.py | UTF-8 | 2,028 | 3.859375 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Decorator is as simple as a syntax sugar for::
@wrapper
def myfunc(*args, **kwargs):
...
equals to::
wrapper(myfunc)(*args, **kwargs)
"""
from __future__ import print_function
import time
def args_printer(func):
"""此包装器... | true |
53845781dbc3ae58ea9ee003e88d6fe23b70e125 | Python | 15099947428/yamlapi | /yamlapi/demo/tool/export_test_case.py | UTF-8 | 1,904 | 2.578125 | 3 | [
"MIT"
] | permissive | import tablib
from setting.project_config import *
def export_various_formats(test_case_data_list):
"""
导出各种格式的测试用例
:param test_case_data_list: 参数为测试用例数据列表
:return:
"""
test_case_data_list_removal = list(set(test_case_data_list))
test_case_data_list_removal.sort(key=test_case_data_list.i... | true |
8a1221472ff110345d25601b28f9186a359b7fbf | Python | EugenyPenepok/pywikitext | /experiments/HeadersExtractor.py | UTF-8 | 3,064 | 2.75 | 3 | [] | no_license | from pywikiaccessor import wiki_accessor
from pywikiaccessor.wiki_categories import CategoryIndex
from pywikiutils.wiki_headers import HeadersFileIndex
class HeadersExtractor:
directory = "C:\\[Study]\\Diploma\\wiki_indexes\\"
accessor = wiki_accessor.WikiAccessor(directory)
bld = CategoryIndex(accessor)
... | true |
67b7bf1e3950283351570d49ee0fd40bcfb11236 | Python | diegofregolente/Curso-em-Video-Python | /Mundo 1/20-randomShufflefromList.py | UTF-8 | 207 | 3.703125 | 4 | [] | no_license | import random
apresentacao = ['Diego', 'Alex', 'Gesi', 'Antonio']
ordem = random.shuffle(apresentacao)
print(f'Conforme sorteado pelo programa random, segue abaixo ordem de apresentação:\n{apresentacao}')
| true |
a46ae7047615d662ac19ff1e4b8e1b186747cb96 | Python | Aminul667/MT | /Lec4.py | UTF-8 | 4,349 | 2.953125 | 3 | [] | no_license | from manim import *
import numpy as np
class Lec4Updaters(Scene):
def construct(self):
text = Tex('Follow Me').scale(0.8).set_color(BLUE).to_edge(UL)
num = MathTex('ln(2) = 0.69').next_to(text, RIGHT).set_color(RED)
#Updater
num.add_updater(lambda x: x.next_to(text, RIGHT))
... | true |
7364158bd7173771755decbe18529792cd24632e | Python | struuuuggle/NLP100 | /src/ch08/sec73_learn.py | UTF-8 | 478 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def warn(*args, **kwargs):
pass
import warnings
warnings.warn = warn
from sklearn.linear_model import LogisticRegression
import pickle as pkl
if __name__ == '__main__':
with open('./feature.bin', 'rb') as f, open('./sentiment.bin', 'rb') as s:
x = pkl.load(f)
y = pkl.lo... | true |
3a55d63308ccc7b02d4bdf0883a44074120ba1bc | Python | appnexus/schema-tool | /schematool/util/metadata.py | UTF-8 | 3,593 | 3.4375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import re
from constants import Constants
class MetaDataUtil(object):
@classmethod
def parse_direction(cls, head):
"""
Given the entire head meta-data (an array of strings) parse out
the direction of the alter (up/down) and return that value.
Returns a string 'up' or 'down' or... | true |
7fe939ea64bbd109621885bcda70017458fcd828 | Python | RahulMaganti47/Learning-in-Robotics | /HW2/hw2_p2_data/quaternion.py | UTF-8 | 2,609 | 3.140625 | 3 | [] | no_license | import numpy as np
import math
class Quaternion:
def __init__(self, scalar=1, vec=[0,0,0]):
self.q = np.array([scalar, 0., 0., 0.])
self.q[1:4] = vec
def normalize(self):
self.q = self.q/np.linalg.norm(self.q)
def scalar(self):
return self.q[0]
def vec(self):
... | true |
c673b4479ac3513f3eeb82f8cdd33a51bbe47428 | Python | NeslynChellaiah/guvi1 | /evenNumbersBwRange.py | UTF-8 | 196 | 3.203125 | 3 | [] | no_license | class main():
def func(self,a,b):
for i in range (a,b):
if (i%2==0):
print(i,end=" ")
ob = main()
a,b = input().split()
a = int(a)+1
b = int(b)
ob.func(a,b)
| true |
b03f9be1abe6ba515130a5707b5290ae866088b4 | Python | hectormateos/tfm-uah-tasador-airbnb | /src/utils.py | UTF-8 | 2,515 | 2.859375 | 3 | [] | no_license | import unicodedata
import math
import numpy as np
from haversine import haversine
"""
airbnb utils
"""
def equals_bin_value(v, d):
return 1 if v == d else 0
def contains_bin_value(v, d):
return 1 if v in d else 0
def get_bin_value_by_char(d):
if d == 't':
return 1
elif d == 'f':
... | true |
6db23747825d8a5deecd699a113ac96345dd5bea | Python | wattaihei/ProgrammingContest | /AtCoder/400/niconico5B.py | UTF-8 | 770 | 2.546875 | 3 | [] | no_license | N, K = map(int, input().split())
A = list(map(int, input().split()))
B = []
for l in range(N):
b = 0
for r in range(l, N):
b += A[r]
B.append(b)
B.sort(reverse=True)
#print(B)
def trans2(n):
A = bin(n)
return str(A[2:])
C = []
maxl = 0
for i, b in enumerate(B):
l = len(trans2(b))
... | true |
5853fae29c98ea732099482262821f4c3272744e | Python | prograsshopper/coursera | /AlgorithmicToolbox/week_1/maximum_pairwise_product.py | UTF-8 | 75 | 2.6875 | 3 | [] | no_license | def get_max_pairwiser(nums):
nums.sort()
return nums[-1] * nums[-2] | true |
37317c8a6ffdbff35a90a8f83a97802053687e05 | Python | karthyvenky/LeetCode-Challenges | /LC36 - Sudoku Validator.py | UTF-8 | 4,052 | 2.96875 | 3 | [
"CC0-1.0"
] | permissive | #%%
nboard = \
[[".",".",".",".","5",".",".","1","."],\
[".","4",".","3",".",".",".",".","."],\
[".",".",".",".",".","3",".",".","1"],\
["8",".",".",".",".",".",".","2","."],\
[".",".","2",".","7",".",".",".","."],\
[".","1","5",".",".",".",".",".","."],\
[".",".",".",".",".","2","."... | true |
878d4a8f8934999401b174d0da07080dfdffcb68 | Python | jbrusey/cogent-house | /cogent/base/model/sensor.py | UTF-8 | 1,246 | 2.703125 | 3 | [] | no_license | """
Classes and Modules that represent sensor related objects
.. codeauthor:: Ross Wiklins
.. codeauthor:: James Brusey
.. codeauthor:: Daniel Goldsmith <djgoldsmith@googlemail.com>
"""
import meta
from sqlalchemy import Column, Integer, ForeignKey, Float
class Sensor(meta.Base, meta.InnoDBMix):
""" Class ... | true |
d1bdca1aa2bd38df774039ba7754ef9745f0ba15 | Python | dimitriylol/network_courseWork | /Network/RegionalNetwork.py | UTF-8 | 10,239 | 2.78125 | 3 | [] | no_license | import random
from collections import OrderedDict
import math
from Network.NetworkConnection import NetworkConnection
from Network.NetworkElement import NetworkElement
from Network.AboutWays import AboutWays
def shortest_ways_from_sequence(sequence_sending):
table_shortest_ways = {}
for sender_dict in seque... | true |
8404b9edb73a4da30d19a79f97419b28bce1b9b8 | Python | andykash81/Iterators.Generators.Yield | /main.py | UTF-8 | 453 | 2.984375 | 3 | [] | no_license | from iter_class import Iter_country
import hashlib
def create_md5(file_name):
with open(file_name, 'r', encoding='utf-8') as read_file:
for line in read_file:
hash_md5 = hashlib.md5(line.encode()).hexdigest()
yield hash_md5
if __name__ == '__main__':
with Iter_country('countr... | true |
630a3698195578f8ef92c01e5f4d3f7c33fe2a0b | Python | MattPaul25/PythonClasses | /Fibonacci.py | UTF-8 | 537 | 4.1875 | 4 | [] | no_license | #Fibonacci function using a yield return
def FibonacciCounter(UpTo, predicate): #returns series of numbers that match predicate
current, nxt = 1, 1
if predicate(current):
yield current
while current <= UpTo:
current, nxt = nxt, current + nxt
if predicate(current):
... | true |
d526f689a1dadfdfd6278f9e54f9a9a07bd919b8 | Python | svenstaro/flamejam | /flamejam/models/gamescreenshot.py | UTF-8 | 870 | 2.75 | 3 | [
"Zlib"
] | permissive | from flamejam import db
class GameScreenshot(db.Model):
id = db.Column(db.Integer, primary_key=True)
url = db.Column(db.String(255))
caption = db.Column(db.Text)
index = db.Column(db.Integer) # 0..n-1
game_id = db.Column(db.Integer, db.ForeignKey("game.id"))
def __init__(self, url, caption, ... | true |
2f66e8b07139408102841fdc6da0bd1819f1e268 | Python | InkiInki/ELDB | /Code/MIL.py | UTF-8 | 5,535 | 2.96875 | 3 | [] | no_license | """
作者: 因吉
邮箱: inki.yinji@gmail.com
创建日期:2020 0903
近一次修改:2021 0714
说明:多示例学习的原型文件,用于获取数据集名称、包空间、包大小等
"""
import warnings
import numpy as np
import os as os
from Code.Function import load_file
warnings.filterwarnings("ignore")
class MIL:
"""
多示例学习的原型类
:param
data_path: 数据集的存储路径
save_home... | true |
53fba2497ae8c0ad98c7915422882a86c94c3fd9 | Python | truas/Document_Parser | /document_analysis/read_write.py | UTF-8 | 3,535 | 2.859375 | 3 | [] | no_license | '''
Created on Mar 13, 2018
@author: Terry Ruas
'''
#imports
import os
import nltk
import re
#from-imports
from datetime import timedelta
from stop_words import get_stop_words
#loads
tokenizer = nltk.tokenize.RegexpTokenizer(r'\w+')
en_stop = get_stop_words('en')
document_list = 'document_list.txt'
corpus = 'corpu... | true |
ce4348972306b76d09e4ff5067df3eaff4c66bc6 | Python | mcPear/naive-bayes | /main.py | UTF-8 | 3,395 | 2.875 | 3 | [] | no_license | from classifier.gaussian_naive_bayes import GaussianNaiveBayes
from classifier.width_discrete_naive_bayes import WidthDiscreteNaiveBayes
from classifier.frequency_discrete_naive_bayes import FrequencyDiscreteNaiveBayes
from classifier.entropy_discrete_naive_bayes import EntropyDiscreteNaiveBayes
from util import valida... | true |
15b174014ae58e98a79a4148ab95b94e202967ac | Python | shade-12/python-dsal | /08_Binary_Search/integer_square_root.py | UTF-8 | 632 | 3.953125 | 4 | [] | no_license | import math
def integer_square_root_math(k):
"""
Returns the largest integer whose square is less than or equal to k.
k is a non-negative integer.
"""
return math.floor(math.sqrt(k))
def integer_square_root_bin(k):
"""
Returns the largest integer whose square is less than or equal to k.
... | true |
bf0501d19e2853fb8b7b3d08b886d25ca3b002c6 | Python | Derek-lws/learnPython | /src/day01.py | UTF-8 | 1,928 | 3.703125 | 4 | [] | no_license | """
date:2020.04.13
author:Derek_lws
"""
print ('Hello World!')#output
a = 1.3#simple parameter
print (a)
print (type(a))#type of parameter
s1 = ('SAD',1.3,False,4)#tuple enum can't change
s2 = [1.4,4,True]#list enum can be changed
print(s1[0])
print(s2[2])
print(s1[0:4:2])#start:end:jump paramater
str = 'abcdefg'
... | true |
77615477aea76a8362feeee134ab9826ccee239b | Python | vaishnovrg/Goal_prediction | /goal.py | UTF-8 | 4,461 | 2.984375 | 3 | [] | no_license | import numpy as np
import pandas as pd
#Getting dataset
df=pd.read_csv('data.csv')
new_df=df.drop(['Unnamed: 0','game_season','knockout_match.1','match_event_id','location_x', 'location_y','home/away','match_id', 'team_id','team_name', 'date_of_game'],axis=1)
new_df.isnull().sum()
#Filling missing values
new... | true |
beec2d08740190e0d2e158efb5bc84e759dd78f3 | Python | bpicnbnk/bpicnbnk.github.io | /offer/3_findRepeatNumber.py | UTF-8 | 342 | 2.984375 | 3 | [] | no_license | from typing import List
class Solution:
def findRepeatNumber(self, nums: List[int]) -> int:
s = set()
for i in nums:
if i not in s:
s.add(i)
else:
return i
# return num
s = Solution()
nums = [-1, 2, 1, -4]
result = s.findRepeatNumbe... | true |
690f308a7498d4457393a11c75205135fd1347cc | Python | abhilb/myleetcode | /00015/triplets.py | UTF-8 | 1,090 | 3.609375 | 4 | [] | no_license | """
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0?
Find all unique triplets in the array which gives the sum of zero.
Notice that the solution set must not contain duplicate triplets.
"""
from typing import List
class Solution:
def threeSum(self, nums: List[int]... | true |
0c8d642c70f33d63060124b5d001034f4d59534f | Python | kajal1301/python | /main1.py | UTF-8 | 220 | 3.125 | 3 | [] | no_license |
def print_abc(string):
return f"This is a String {string}"
def add(num1, num2):
return num1+ num2+ 5
if __name__ == "__main__":
print(print_abc("Kajal"))
o= 4+5
print(o)
pass | true |
5aad5c37a4207ebf843a05a1081553fc3389574b | Python | sarzhann/got-generator | /generator.py | UTF-8 | 390 | 2.6875 | 3 | [] | no_license | from transformers import pipeline
got = pipeline('text-generation', model='./gpt2-got', tokenizer='gpt2', config={'max_length':1000})
loop = "Y"
while loop == "Y":
SOS = input('Input start of the sentence\n\t')
generated_text = got(SOS)[0]['generated_text']
print('Generated text:\n\t',generated_text)
lo... | true |
dc897f9cb1b7ebef143884e77fa40601fb37e7a0 | Python | justinmaojones/DonorsChooseAutoScreening | /code/UnderstandingUnicode.py | UTF-8 | 864 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 18 12:05:25 2014
@author: justinmaojones
"""
import re
w = "1grade\xe2"
if re.search('[^a-zA-Z0-9_]',w):
print w,"not okay"
else:
print w,"is y"
for c in w:
if re.search('[a-zA-Z0-9_]',c):
print c,"True"
else:
print c,"False"
w =... | true |
9b961f76fe636e81f0fe2b20fb8704292ad0f320 | Python | ab921189/Project1-2_Garbled_circuit | /Alice.py | UTF-8 | 832 | 3.296875 | 3 | [] | no_license | import math
g = 0
x = 0
p = 0
gxp = 0
decimal_g = 0
decimal_x = 0
pow_of_g_with_x = 0
def Alice():
inputdata = input(">>> Input g x p: ")
gxp = inputdata.split()
decimal_g = Transfer_to_decimal(gxp, 0)
decimal_x = Transfer_to_decimal(gxp, 1)
pow_of_g_with_x = Pow(decimal_g, decimal_... | true |
99d48e22879e55d451f9c231b15c173d5718379d | Python | innalesun/repetition-of-the-material | /ООП/les17.07(Human_1).py | UTF-8 | 1,780 | 3.953125 | 4 | [] | no_license | '''
class Car:
def start(self):
print('двигатель заведен')
car_a = Car()
print(Car)
print(car_a)
print(dir(Car))
print(dir(car_a))
'''
'''
class Car:
def __str__(self):
return "car class object"
def start(self):
print('двигатель заведен')
car_a = Car()
print(car_a)
print(dir... | true |
6e606869134b98ff5240d34f4a7361ce6883ab2d | Python | fxfactorial/shell_yunwei | /练习代码/tryDemo.py | UTF-8 | 198 | 3.125 | 3 | [] | no_license | # try->异常->except->finally
# try->无异常->else->finally
re = iter(range(5))
try:
for i in range(100):
print re.next()
except StopIteration:
print 'Here is end', i
print 'HaHaHaHa'
| true |
21085ebd3807053826cb7e2411b0adffa02f9e73 | Python | matferronato/Coral | /functions/google_speech_recognition/speech.py | UTF-8 | 657 | 2.609375 | 3 | [] | no_license | #pip install SpeechRecognition
import speech_recognition as sr
from functions.personality.personality_checker import runIntro, runResearch, runListening
import time
def microphone_check():
#Habilita o microfone para ouvir o usuario
microfone = sr.Recognizer()
with sr.Microphone() as source:
... | true |
b092866fe7231a9ca9decadf21e8c27ea014438f | Python | linlinli1230/study | /python_study/study_recoder.py | UTF-8 | 2,396 | 3.1875 | 3 | [] | no_license | #coding:utf-8
#
# Created on 2020 01 10
#
# @author: linlin
#变量
from _ast import Num
from pickle import BINUNICODE
test=' hell python '
print(test)
#大小写转换
print(test.title())
print(test.upper())
print(test.lower())
print('\thello \npython')
#去掉空白
print(test.rstrip()+'\n'+test.lstrip()+'\n'+test.strip())
#字符转换
age=... | true |
6ac0e98b11cc9954c9f8b7b6767fab9a697a9bb0 | Python | Y-Sisyphus/CVAE_Caption | /utils/vocab.py | UTF-8 | 2,891 | 3.203125 | 3 | [] | no_license | import numpy as np
class Vocabulary():
'''文本的单词表'''
def __init__(self):
self._word2id = {}
self._id2word = {}
self._idx = 0
self._word = []
# 特殊符号
self.pad = '<pad>'
self.bos = '<bos>'
self.eos = '<eos>'
self.unk = '<unk>'
self.... | true |
0f7aa44c2a91939641e0beab8140629c4a08c0ee | Python | dsiah/Villanova-Python-Workshop | /scripts/picture.py | UTF-8 | 214 | 3.734375 | 4 | [] | no_license | iterate = int(raw_input('Enter integer:\n'))
def pretty(iterate):
for i in range(1, iterate):
print '#' * i
print
for i in range(1, iterate):
print '#' * (iterate - i)
pretty(iterate)
| true |
6dcf0d36348337f9f70779e7fffb0fcaf97cb47e | Python | penguin2121/Udacity-Entertainment-Center-Project | /media.py | UTF-8 | 820 | 3.234375 | 3 | [] | no_license | import webbrowser
class Movie():
"""This class provides a way of storing movie information.
Attributes:
movie_title (str): Movie Title
movie_storyline (str): Storyline of Movie
poster_image (str): URL of poster image
trailer_youtube (str): URL of youtube trail... | true |
fd4b8aef83fa23427d0cba39eaab8d2d79a2036d | Python | YanxiPiao/inverted_double_pendulum | /torque.py | UTF-8 | 1,527 | 3.640625 | 4 | [] | no_license | '''balancing an inverted double pendulum'''
from math import *
# specs
mass_pen1=131 # pendulum 1 mass [g]
len1=213 # link 1 length [mm]
mass_pen2=145 # 110g bearing +35 pendulum 2 mass [g]
len2=11.35 # link 2 length [mm]
x=0.0 # x position of the end effector
y=0.0 # y position of the end effector
# let theta3 be t... | true |
3c2973be2b18ba00025ed9df7a1fff15efeca7e0 | Python | tirthankarkundu17/MovieListPy | /movielist.py | UTF-8 | 1,008 | 2.984375 | 3 | [] | no_license | import bs4 as bs
import urllib2
url = "http://in.bookmyshow.com/kolkata/movies"
request = urllib2.Request(url)
response = urllib2.urlopen(request)
soup = bs.BeautifulSoup(response, 'lxml')
data = {}
for name in soup.find_all("div", class_="card-container"):
for buytick in name.find_all("div", class_="content"):
... | true |
7fb49ae69230defb352c2d9fd168f56a7677f3a9 | Python | seveneightn9ne/Syntak | /syntak_nltk.py | UTF-8 | 383 | 3.0625 | 3 | [] | no_license | import nltk, sys
def collect_data()
def analyze(sentence):
""" Main function which performs analysis and displays results """
text = nltk.word_tokenize(sentence)
post = nltk.pos_tag(text)
print post
for word, tag in post:
if __name__ == "__main__":
if len(sys.argv == 2):
analyze(sys.argv[1])
else:
while T... | true |