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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
cfd6e953c5c18d79110677b5eb63ad4672620c58 | Python | andrsdt/DosHermanasWarBot | /src/print_palabras.py | UTF-8 | 4,197 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 17 17:42:19 2020
@author: andres
"""
from PIL import Image, ImageFont, ImageDraw
from sort_barrios import leer_archivo
barrios = leer_archivo('./data/barrios_ordenados.txt')
font = ImageFont.truetype('./data/fonts/Roboto-Light.ttf', size=40, encoding="unic")
... | true |
663f56c8b184f2f8694e33b467c32eebb4c57aa4 | Python | JakesCode/The-Saving-of-Chora | /spellLib.py | UTF-8 | 3,440 | 3.234375 | 3 | [] | no_license | # Spell Library for Python Adventure Game #
# Copyright Jake Stringer 2015 #
from termcolor import *
import colorama
import sys
import os
colorama.init()
def spells():
global spellDict
global damage
global specialSpellsKeys
global specialSpells
spellDict = {"Blink": "Casts a sharp, dark blanket of shadow over t... | true |
dd9919be7890dba415eabb308ee109c89bafc769 | Python | HsinTieh/one-max-problem | /TS.py | UTF-8 | 1,483 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 30 19:11:57 2019
@author: toke8
"""
import random
import time
class Individual:
def __init__(self,data,fitness,tabu_list):
self.data=data
self.fitness=fitness
self.tabu_list=tabu_list
#mothed : change someone of initial list
def action(ts,iter... | true |
e88c2af942994a0ec20ac0e357dfd219bb90cc32 | Python | JacobTyo/PAN21_SAV | /src/AuthorshipAttribution/dsets/fanfiction.py | UTF-8 | 20,126 | 2.875 | 3 | [
"MIT"
] | permissive | # starting with the large dataset
# data looks like json
# try to read it, lets play a bit I assume
# dataset description:
# The train (calibration) and test datasets consists of pairs of (snippets from) two different fanfics,
# that were obtained drawn from fanfiction.net. Each pair was assigned a unique identifier a... | true |
663f42000855b1719db67e1028e49013ee02ad7b | Python | aaron64/pychic_type | /scenes/Parallax.py | UTF-8 | 1,150 | 2.671875 | 3 | [] | no_license | from util.SpriteField import SpriteField
from util.vec2f import vec2f
from scenes.Scene import Scene
import pyglet
import math
class Parallax(Scene):
def __init__(self, switch_type, key, g, params, res, v=vec2f(1,1), space = 64, speed = 6):
super().__init__(switch_type, key)
self.image = pyglet.image.load('res/... | true |
39c9821fbe518fa8ecd949166495bd8e222af3cf | Python | hyungilk/ProblemSolving | /BOJ/Q2839.py | UTF-8 | 908 | 3.78125 | 4 | [
"MIT"
] | permissive |
n = int(input())
bool_3,bool_5 = True, True
# for문 최대 숫자 가능범위 출력 함수 정의
def counter(n, divider):
bool_tmp = True
cnt_tmp = 0
while bool_tmp:
if n < cnt_tmp * divider:
bool_tmp = False
else:
cnt_tmp += 1
return cnt_tmp
# 3, 5에 대한 숫자 가능 범위 획득
cnt_3 = counter(n, 3)... | true |
4cae12577bc0c5dc23e53694254280399583b9d0 | Python | dayemsiddiqui/Sentiments | /Sentiment Analysis/imdbReviews.py | UTF-8 | 841 | 2.625 | 3 | [] | no_license | import mechanize
from bs4 import BeautifulSoup
br = mechanize.Browser()
br.set_handle_robots(False)
br.addheaders = [('User-agent','Firefox/4.0')]
with open("movieid.csv",'r') as f:
tt = f.read()
for t in tt.split(','):
url = "http://www.imdb.com/title/" + t + "/reviews"
html = br.open(url).read()
... | true |
2cf0d409eee05e8d4e2381c37e21bfe2278a6218 | Python | Tharnid/Pergitor | /LP/PFSA/msg3.py | UTF-8 | 444 | 2.640625 | 3 | [] | no_license | amount= None
location= None
with open("message2.txt", "r") as source:
for line in source:
clean= line.lower().rstrip()
junk, pay, pay_data= clean.partition("pay")
junk, meet, meet_data= clean.partition("rendezvous")
if pay != '':
amount= pay_data
elif meet != '':
... | true |
1f22b51c1b54ac2e6a42b670d0773806ff0bfc67 | Python | hppRC/PythonAtcoder | /practice2/l/main.py | UTF-8 | 5,991 | 2.890625 | 3 | [] | no_license | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L(): return sys.stdin.readline().split()... | true |
93992bb9491b139bcf17d9d6794f49ed2d25fc68 | Python | shasheene/chess.py | /test/test_pawn.py | UTF-8 | 9,514 | 3.0625 | 3 | [] | no_license | from chess.board import conduct_move
from chess.move import MoveType, Move
from chess.pieces import BlankPiece, Rook, Pawn, Queen, Bishop, Knight
from test.unit_test_fn import assert_length, assert_contains, create_list_of_moves, \
assert_row_contain_same_type_elements
def test_white_pawn_movements():
__ = Bl... | true |
8014c82e13ae0c5e4c6cdfc01b18af101f34115b | Python | stenpiren/Flask-MonitoringDashboard | /flask_monitoringdashboard/database/count_group.py | UTF-8 | 2,858 | 2.625 | 3 | [
"MIT"
] | permissive | import datetime
from sqlalchemy import func
from flask_monitoringdashboard.core.timezone import to_utc_datetime
from flask_monitoringdashboard.database import Request, TestEndpoint
def get_latest_test_version(db_session):
"""
Retrieves the latest version of the user app that was tested.
:param db_sessio... | true |
545c4fe1856dc2354a7a0d7865ea4f43e86bd38b | Python | peksula/twitter-client | /twitter.py | UTF-8 | 1,129 | 3.078125 | 3 | [] | no_license | """
Never Again Twitter client.
"""
import logging
import tweepy
def _limit_handled(cursor):
""" Handles Twitter API rate limits. """
while True:
try:
yield cursor.next()
except tweepy.RateLimitError as err:
logging.warning('Twitter API RATE LIMIT exceeced.')
... | true |
1d3a160f33d3345912b3619b96e7529534a3a021 | Python | Darshitpipariya/Information_technology | /frequency_analysis.py | UTF-8 | 318 | 3.203125 | 3 | [] | no_license | def chr_freq(text):
d={}
for i in text:
key=d.keys()
if i in d:
d[i]+=1
else:
d[i]=1
return d
fre_alphabet=['e','t','a','o','i','n','s','r','h','d','l','u','c','m','f','y','w','g','p','b','v','k','x','q','']
text=input("enter text")
fre_text=chr_freq(text)
| true |
6698ff865430dd1cc7005062c50866805ca76c22 | Python | Rahul-Krishna14/Python-Programs | /infy.py | UTF-8 | 210 | 3.390625 | 3 | [] | no_license | def cap(x):
l = ''
for i in x:
if i == ' ':
l = l + ' '
elif ord(i) >= 95 and ord(i) <= 122:
a = ord(i) - 32
l = l + chr(a)
print(l)
cap(input()) | true |
bfaee969dd0fd12cc7fe84808af27339198f031a | Python | AToner/AdventofCode2018 | /Python/Day7.py | UTF-8 | 8,469 | 3.90625 | 4 | [] | no_license | """
--- Day 7: The Sum of Its Parts ---
You find yourself standing on a snow-covered coastline; apparently, you landed a little off course. The region is too
hilly to see the North Pole from here, but you do spot some Elves that seem to be trying to unpack something that washed
ashore. It's quite cold out, so you decid... | true |
9c4f5b1494b825bddcae2cb673fbd246a428f472 | Python | fabagaipo/cmsc23 | /Bagaipo-labExer08.py | UTF-8 | 3,296 | 3.328125 | 3 | [] | no_license | from abc import ABC, abstractmethod
from datetime import date,timedelta
class Delivery(ABC):
@abstractmethod
def estimatedTimeArrival(self) -> date:
pass
@abstractmethod
def deliveryFee(self) -> float:
pass
@abstractmethod
def deliveryDetails(self) -> str:
... | true |
cc23278e6340a9fee05f1dba28bf107a6c63f2ef | Python | JonathanSum/Computer-Vision-Note-and-Project | /Main/intejbackground/DataStruNote/imging.py | UTF-8 | 246 | 2.625 | 3 | [] | no_license | import numpy as np
from scipy.misc import imread, imresize
import matplotlib.pyplot as plt
img= imread('cat1.jpg')
img_tinted = img* [1,0.95,0.9]
plt.subplot(1,2,1)
plt.imshow(img)
plt.subplot(1,2,2)
plt.imshow(np.uint8(img_tinted))
plt.show() | true |
bf6dd40d04a1198b294b9c23f109e9f2a02df2a5 | Python | JarvisLee0423/Pytorch_Practice | /Deep_Neural_Network_with_Pytorch/Convolutional_Neural_Network_Demo/GAN_Image_Generator/DCGANModel/Trainer.py | UTF-8 | 9,986 | 2.609375 | 3 | [] | no_license | #============================================================================================#
# Copyright: JarvisLee
# Date: 2020/11/21
# File Name: Trainer.py
# Description: This file is used to training the model.
#=======================================================================... | true |
4bb7c9718de4fe48cb568754eb6364d41ce7f293 | Python | Diralf/evolution | /core/entity/entity_group.py | UTF-8 | 1,111 | 3.109375 | 3 | [
"MIT"
] | permissive | import pygame
from pygame.sprite import Group
class EntityGroup(Group):
def __init__(self, *sprites):
super(EntityGroup, self).__init__(*sprites)
def draw(self, surface):
sprites = self.sprites()
surface_blit = surface.blit
surface_rect = surface.get_rect()
sprite_de... | true |
07df6bf447619872c5ac532c0cf019a34d283a21 | Python | kpreference/pythonProject | /3009.py | UTF-8 | 270 | 3.40625 | 3 | [] | no_license | xx=[]
yy=[]
xr=0
yr=0
for i in range(3):
x,y=map(int,input().split())
xx.append(x)
yy.append(y)
xx.sort()
yy.sort()
if xx[1]==xx[0]:
xr=xx[2]
elif xx[1]==xx[2]:
xr=xx[0]
if yy[1]==yy[0]:
yr=yy[2]
elif yy[1]==yy[2]:
yr=yy[0]
print(xr,yr) | true |
4f947e8a03e92b7247f54dfad0cf7c04f9603365 | Python | lumina-networks/lfm-cli | /lfmcli/commands/cmd_treepath.py | UTF-8 | 2,986 | 2.65625 | 3 | [
"MIT"
] | permissive | import click
from lfmcli.context import pass_context
@click.group()
def treepath():
pass
@treepath.command(name='list')
@pass_context
def lst(ctx):
fm = ctx.fm
result = fm.get_treepaths()
paths = result.get('treepaths')
if paths is not None and len(paths) > 0:
ctx.print_json(paths)
... | true |
f32574c5e80effaa627ed2966fcc64e2a097cddd | Python | Syreus868389/Pan-Records-a-digital-journey-through-the-ethnic-music-niche | /Spotify/Fetching Spotify genres.py | UTF-8 | 3,707 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 4 18:08:09 2020
@author: Théo
"""
import spotipy
from spotipy.oauth2 import SpotifyOAuth
import csv
import pandas as pd
# spotify authentication and initialization of client object
client_id = '##########'
client_secret = '#############'
redirect_uri = '############'
... | true |
9c89f809d0cc5ac47a7f1831ac9c9587cb9bafdc | Python | micahaza/python3-project-template | /myapp/damager.py | UTF-8 | 110 | 3.109375 | 3 | [
"MIT"
] | permissive | from random import randint
def random_damage(modifier):
roll = randint(1, 8)
return modifier + roll
| true |
4be46c6196e32b37ad3cba9ff8ea69bf2eae8a57 | Python | v0y/sport-tracker-with-acziwments | /app/routes/models.py | UTF-8 | 4,756 | 2.75 | 3 | [] | no_license | # encoding: utf-8
from datetime import timedelta
import json
from django.contrib.auth.models import User
from django.db import models
from app.shared.models import CreatedAtMixin
from app.workouts.models import Workout
from .helpers import get_distance
from .gpx_handler import (
get_distance_and_elevations_delt... | true |
3faf37588e4b7978bdf57f72c0252b0f8f10e59d | Python | ground0state/pyanom | /pyanom/utils.py | UTF-8 | 1,757 | 3.0625 | 3 | [
"MIT"
] | permissive | """
Copyright (c) 2019 ground0state. All rights reserved.
License: MIT License
"""
import numpy as np
import pandas as pd
import warnings
warnings.simplefilter(action='ignore')
def check_array_type(array):
"""Input validation on an array.
Parameters
----------
array : object
Input object to... | true |
ed7810100c027938c8bc7e793674fa8f90cea918 | Python | DLHub-Argonne/dlhub_sdk | /dlhub_sdk/utils/futures.py | UTF-8 | 3,211 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | """Tools for dealing with asynchronous execution"""
from globus_sdk import GlobusAPIError
from concurrent.futures import Future
from threading import Thread
from time import sleep
class DLHubFuture(Future):
"""Utility class for simplifying asynchronous execution in DLHub"""
def __init__(self, client, task_id... | true |
001edc02a8b8d47c021db8c7fcdee8f2ce09f3a6 | Python | dimasahmad/bootcamp | /hackerrank/challenges/simple_array_sum/simple_array_sum.py | UTF-8 | 200 | 3.5625 | 4 | [] | no_license | # simple array sum
# https://www.hackerrank.com/challenges/simple-array-sum/problem
def simple_array_sum(ar: list[int]) -> int:
ar_sum = 0
for n in ar:
ar_sum += n
return ar_sum
| true |
eca92174fada57db80e26ec7916d02b2c75cd264 | Python | drdhaval2785/SanskritVerb | /scripts/slptowx.py | UTF-8 | 904 | 3.96875 | 4 | [] | no_license | """
Expected outcome:
Convert a file from SLP1 encoding to WX encoding.
The code can be called as module like `from slptowx import slptowx` and then used as a function.
Usage:
python slptowx.py inputfile outputfile
"""
import string
import sys
# Function to convert an input from SLP1 to WX encoding
def slptowx(inpu... | true |
ad8f1c45a77fed0ffd959ec33da05fc72e625883 | Python | csal90/CSC-243 | /wLoop2.py | UTF-8 | 232 | 4.3125 | 4 | [] | no_license | # while loop
# Allows a user to enter any user name and adds it to list (l)
# once user enters '.' it wil break out of loop
l = []
while True:
name = input('Enter a name: ')
if name == '.':
break
l.append(name)
| true |
3a69af8d0a81f4584ee7d9ee89d0ab3c8bf1267d | Python | kminito/decrypt_pdf | /gui.py | UTF-8 | 1,693 | 2.859375 | 3 | [] | no_license | import os
import sys
import pikepdf
from PyQt5.QtWidgets import *
class Window(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("decrypt pdf")
self.setGeometry(350,150,400,100)
self.UI()
def UI(self):
vbox=QVBoxLayout()
hbox1=QHBoxLayout()
... | true |
6cb0b67ece8aaee133bb23f4096848d326ebe937 | Python | lodre/Pakulnevitch_Kostia | /Учебный год 2020-21/Работа на уроке/Работа на уроке 2021.03.29/n1.py | UTF-8 | 61 | 2.984375 | 3 | [] | no_license | f = open('x.txt', 'r')
s = 0
for l in f:
s = s+1
print(s) | true |
c70de9b57cb12e3dbcb79afa99deb28fd2dc4b37 | Python | sreekeerthireddy/iot_smart_fridge | /iou.py | UTF-8 | 440 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 16 21:56:13 2021
@author: SreeKeerthiGudipatiR
"""
import torch
import torchvision.ops.boxes as bops
xc=49.78
yc=53.25
w=56.17
h=57.20
x= round(xc-w/2)
y= round(yc-h/2)
xe=x+w
ye=y+h
print(x)
print(y)
print(xe)
print(ye)
b1=torch.tensor([[22, 15, 72, 73]], dtype= to... | true |
53d2666e0abd057e69bcee7fb378ee3bfe848483 | Python | nehannn86/Python-Scripting | /4.operators/1.arithmetic-operators.py | UTF-8 | 1,610 | 4.71875 | 5 | [] | no_license | #implementing arithmetic operators.
import os
os.system("clear")
def Addition(num1 , nume2):
Addition = num1 + num2
print(f'Addition of {num1} & {num2} is: ',Addition)
def Substraction(num1, num2):
Substraction = num1 - num2
print(f'Substraction of {num1} & {num2} is: ',Substraction)
def Multiplica... | true |
3236380b6e2b894be831f5867139e9929f78fe72 | Python | nidhiatwork/Python_Coding_Practice | /GoogleTopQues/840_MagicSquaresInGrid.py | UTF-8 | 1,459 | 3.640625 | 4 | [] | no_license | '''
grid 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, column, and both diagonals all have the same sum.
Given an grid of integers, how many 3 x 3 "magic square" subgrids are there? (Each subgrid is contiguous).
Input: [[4,3,8,4],
[9,5,1,9],
[2,7,6,2... | true |
df62fbdae958bf78acbda3a2e4584b50899be1c0 | Python | eMapR/lc_mapping_sensitivity | /from_justin/ee/1_get_chunks_from_gdrive.py | UTF-8 | 2,447 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 02 09:15:58 2017
@author: braatenj
https://googledrive.github.io/PyDrive/docs/build/html/index.html
https://pypi.python.org/pypi/PyDrive
"""
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import os
import sys
import time
import ... | true |
f7bca325fc4284abb20cc15ec1316fa27e17f6ef | Python | annelios/NRK-case | /modify_data.py | UTF-8 | 1,576 | 2.578125 | 3 | [] | no_license | import pandas as pd
def date_utc(s):
return lambda x: pd.to_datetime(s, utc=True)
data = pd.read_csv('https://storage.googleapis.com/nrk-us/intervjuoppgave/unge-lovende.csv', sep=',', index_col=0)
data['visitEndTime'] = (data.visitStartTime + data.timeWithinVisit)
with open("data.csv", "w") as file:
csv = ... | true |
bde60d4e41fca0f9e3c0a290256ddeffc9175260 | Python | SKPANDA2403/MyCaptain-Tasks | /textgenerator (1).py | UTF-8 | 3,214 | 3.046875 | 3 | [] | no_license | #import dependancies
import numpy
import sys
import nltk
nltk.download('stopwords')
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
from keras.models import Sequential
from keras.layers import Dense,Dropout,LSTM
from keras.utils import np_utils
from keras.callbacks import ModelCheckpoint
#d... | true |
0083394f6ccf33fc255bbe7d7e3bafb295b28ab6 | Python | enmacap/Grupo5-BD2021 | /Read.py | UTF-8 | 411 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import RPi.GPIO as GPIO
from mfrc522 import simpleMFRC522
obj = SimpleMFRC522()
try:
leer = input('Nuevo Personal:')
print("Ponga su tarjeta para registrarse")
obj.write(leer)
print("Tarjeta leida")
finally:
GPIO.cleanup()
try:
id, leer=... | true |
a255680e60934bee118fdfd7c1410cd5ebe471b0 | Python | mastbaum/repoman | /repoman/handlers/printer.py | UTF-8 | 213 | 2.546875 | 3 | [] | no_license | from handler import Handler
from ..log import log
class Printer(Handler):
'''print the document'''
def __init__(self):
pass
def handle(self, doc):
log.write('Printer: ' + str(doc))
| true |
b5f066ac4ea070de6df37d3f9ea003d3de5fbe78 | Python | pie-man/pi_stepper_101 | /stepper_demo.py | UTF-8 | 6,292 | 3.40625 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
from random import random
GPIO.setmode(GPIO.BCM)
class StepperMotor(object):
"""Class for a stepper motor. Defines the pin sequence for
movement and provides basic movement methods"""
seq = [
[1,0,0,0],
[1,1,0,0],
[0,1,0,0],
... | true |
4a600f2f81305439a803b5ed6b82bde45fe429a5 | Python | MarvinHaa/DeepNNforTopoOptisation | /Neural_Networks/LSTM/LSTM_classes.py | UTF-8 | 13,484 | 2.71875 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
torch.manual_seed(42)
torch.cuda.manual_seed(42)
#############################################
######### Dataloarder #######################
#############################################
def load_LSTM_series(file: str = 'data/'):
te... | true |
127fa66d84b9095ca4e23c8620c1a4ebf42f5f3e | Python | upendram91/caserta | /gcpEval.py | UTF-8 | 2,953 | 2.84375 | 3 | [] | no_license | import requests
import json
import csv
import os
import google.cloud.storage as storage
import google.cloud.bigquery as bigquery
def fetch_api_data(url):
r = requests.get(url=url)
if r.status_code == requests.codes.ok:
return r.content
def save_json_as_csv(data, file_name, file_path="data"):
with ... | true |
5224082e846ceb25cf3243232d40f6d402141ad8 | Python | Mayank300/CLASSWORK-141 | /venv/main.py | UTF-8 | 1,072 | 2.859375 | 3 | [] | no_license | from flask import Flask, request, jsonify
import csv
all_movies = []
with open('movie.csv') as f:
reader = csv.reader(f)
data = list(reader)
all_movies = data[1:]
app = Flask(__name__)
@app.route('/get-movies')
def get_movies():
return jsonify({
'name': all_movies[0],
'status': '😻'... | true |
883a1665cc11521e8c028305176d18817420bb7e | Python | syurskyi/Algorithms_and_Data_Structure | /_algorithms_challenges/codewar/_CodeWars-Python-master/solutions/Convert_number_to_reversed_array_of_digits.py | UTF-8 | 357 | 3.984375 | 4 | [] | no_license | """
8 kyu: Convert number to reversed array of digits
Convert number to reversed array of digits
Given a random number:
C#: long;
C++: unsigned long;
You have to return the digits of this number within an array in reverse order.
Example:
348597 => [7,9,5,8,4,3]
"""
def digitize(n):
return [int(s) for s in st... | true |
d8b355057ea161e540dad34bba3ea209f35a2fa6 | Python | Margarita89/LeetCode | /0198_House_Robber.py | UTF-8 | 735 | 3.65625 | 4 | [] | no_license | class Solution:
def rob(self, nums: List[int]) -> int:
"""
General idea: from dynamic programming. If dp[i] - max amount of money at the ith house.
dp[0] = nums[0]
dp[1] = max(num[0], num[1])
dp[k] = max(dp[k-2] + nums[k], dp[k-1])
prev1 stores dp[k-1], prev2... | true |
ecb8fad334b9a4c0b38b952c5251d02c3ee33658 | Python | kinglintianxia/python_learning | /01-if.py | UTF-8 | 798 | 4.15625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding utf-8 -*-
############# 条件判断 #############
age=3
if age>=18:
print('Your age is:',age)
print('Adult')
else:
print('your age is:',age)
print('Teenager')
#elif
age=3
if age>=18:
print('Adult')
elif age>=6:
print('teenager')
else:
print('kid')
# if 判断条件还可以... | true |
85fe0d7dbcaac5f5a2596ed7e541024eb2a081ad | Python | squintal73/Python | /API/bot_telegram.py | UTF-8 | 887 | 3.15625 | 3 | [] | no_license | # Consultar API viacep
# Telegram Bot: Como criar um bot, receber e enviar mensagens
# Data: 07/07/2020
# Autor: Sidnei Quintal
# V001.
import requests
token='859780563:AAGKJLs9F2sW8NvbVR3gIYXScBwxXbrt22M'
def get_msg():
url='https://api.telegram.org/bot{0}/getUpdates'.format(token)
r=requests.get(url)
... | true |
416ff79a5d0f20f23950caee8a5362963d111524 | Python | cnatom/Machine-learning-tries | /final.py | UTF-8 | 6,773 | 2.75 | 3 | [] | no_license | from catboost import CatBoostRegressor
from lightgbm import LGBMRegressor
from sklearn.feature_selection import f_classif, SelectKBest
from sklearn.metrics import roc_auc_score, roc_curve, auc
from sklearn.model_selection import train_test_split, GridSearchCV, KFold
from imblearn.combine import SMOTETomek
from sk... | true |
bf4c31df80eb526d1a1dfaec1683c860ccf81640 | Python | marquesleandro/aleStent | /libClass/importVTK.py | UTF-8 | 2,459 | 2.6875 | 3 | [] | no_license | # ==========================================
# Code created by Leandro Marques at 03/2020
# Gesar Search Group
# State University of the Rio de Janeiro
# e-mail: marquesleandro67@gmail.com
# ==========================================
# This code is used to import .vtk file
# Converting .msh in a python list
import ... | true |
fb9597143e1b4b421ba0b1aca6b47feb28494d35 | Python | pulkitkapoor98/CS839-DataScience | /Stage1/src/markup_PositiveEx.py | UTF-8 | 3,191 | 3.109375 | 3 | [] | no_license | #input: this code takes clean data files as input
#output: -> creates a new file for each of the clean data by removing tags from the data. We call it unsupervised data
# -> creates a dictionary of positive samples and stores in a file (phrase, start index, end index)
#note: all processing happens filewise
imp... | true |
0ac71b656df1ac3cecf1bbe8ed3acc468ea779a9 | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/222/users/4061/codes/1684_1104.py | UTF-8 | 515 | 4.125 | 4 | [] | no_license | # Teste seu código aos poucos.
# Não teste tudo no final, pois fica mais difícil de identificar erros.
# Ao testar sua solução, não se limite ao caso de exemplo.
a = float(input("digite numero a: "))
b = float(input("digite numero b: "))
c = float(input("digite numero c: "))
d = float(input("digite numero d: "))
prin... | true |
ffc85694325544ed5b5706c2febad4d00e1154d5 | Python | fuzeman/plex.metadata.py | /tests/test_matcher.py | UTF-8 | 458 | 2.640625 | 3 | [
"MIT"
] | permissive | import logging
logging.basicConfig(level=logging.DEBUG)
from plex_metadata import Matcher
def test_parse():
cases = [
('Show.Name.S05E10-11', [{'season': '05', 'episode_from': '10', 'episode_to': '11'}]),
('Show.Name.S05E10E11', [{'season': '05', 'episode': ['10', '11']}]),
('Show.Name.5x... | true |
ca3a8b83428436ef3dfea456d605704a2771e494 | Python | Ze1598/Python_stuff | /single_purpose_scripts/guess 5 digit number.py | UTF-8 | 2,591 | 4.1875 | 4 | [] | no_license | #guess 5 digits number
#modules
from random import randint
# introduction
# setting up the number
a = ''
a1 = randint(0,9) #digit1
a2 = randint(0,9) #digit2
a3 = randint(0,9) #digit3
a4 = randint(0,9) #digit4
a5 = randint(0,9) #digit5
a += str(a1) + str(a2) + str(a3) + str(a4) + str(a5) #setting up the entire number... | true |
819a07fad404b0bc61c0b89c35d1a30eb9af821d | Python | aliaksei135/seedpod_ground_risk | /seedpod_ground_risk/ui_resources/plot_webview.py | UTF-8 | 492 | 2.5625 | 3 | [
"MIT"
] | permissive | import PySide2
from PySide2.QtCore import Signal
from PySide2.QtWebEngineWidgets import QWebEngineView
class PlotWebview(QWebEngineView):
resize = Signal(int, int)
def __init__(self, *args, **kwargs):
super(PlotWebview, self).__init__(*args, **kwargs)
def resizeEvent(self, event: PySide2.QtGui.Q... | true |
1091819250d6dd30076df09723191b5cdcb5db7e | Python | jlyons6100/Procedural-Epithet-Generation-Using-Markov-Chains | /generate_epithets.py | UTF-8 | 2,997 | 3.015625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import sqlite3
# Generating Random Initial epithets based on format of GoT epithets
# Handpicked which epithets were good enough to be inserted in database
nicknames = []
materials = ['Stone','Steel','Wood','Dirt','Shadow','Wind']
directions = ['West','North','South','East'... | true |
2a72f26ebd5a1c4e984bd46ea0d1159d874d42a0 | Python | bestyharis/Python-Interesting-Problems | /ListComprehension.py | UTF-8 | 283 | 3.40625 | 3 | [] | no_license | x = int(input())
y = int(input())
z = int(input())
n = int(input())
list1 = []
for i in range(0,x+1):
for j in range(0,y+1):
for k in range(0,z+1):
if(i+j+k != n and ([i,j,k] not in list1)):
list1.append([i,j,k])
print(list1) | true |
132630d5242bf8cdbc63d209aa6776c16e947b35 | Python | janiszewskibartlomiej/Python_Code_Me_Gda | /Python - advanced/zajecia02/iter03b.py | UTF-8 | 243 | 3.203125 | 3 | [] | no_license | from iter02 import ParzysteLiczby
p_licz = ParzysteLiczby()
# klasy ParzysteLiczby można teraz użyć wszędzie, gdzie przyjmowany jest obiekt Iterable
lista_liczb = list(p_licz)
print(lista_liczb)
print(lista_liczb)
print(lista_liczb)
| true |
fc3d309257470be22bd5217fdd78dbcfcbbff52f | Python | zjhayes/Module10 | /class_definitions/customer.py | UTF-8 | 721 | 3.71875 | 4 | [] | no_license | # Zachary Hayes
class Customer:
'''Customer Class'''
#Constructor
def __init__(self, id, lname, fname, phone, add):
if not isinstance(id, int): # Constructor raises error.
raise AttributeError # Errors should be caught as early as possible.
self.customer_id = id
... | true |
74b265e16c0e59108d07d8ec486506b400b78e69 | Python | jwill49/networking | /hw2/gameplay.py | UTF-8 | 748 | 2.609375 | 3 | [] | no_license | import sys
import struct
import random
import string
from WarServer import WarServer
from WarClient import WarClient
from connect import *
def play_war(entity):
entity.play_init()
entity.play_ready()
entity.play_in_progress()
entity.play_complete()
def print_usage(errno):
print >> sys.stderr, "usage: ./p... | true |
f0ea6e41ef61e4802ee8b27c64f8e202659fd409 | Python | chintan97/subject-practicals | /Python Programming/set 7/1.py | UTF-8 | 264 | 3.265625 | 3 | [] | no_license | obj = open("test.txt","r")
r1 = obj.read()
print (r1)
print()
obj.seek(0)
r2 = obj.readlines()
for i in r2:
print (i,end='')
print ("\n")
obj.seek(0)
while True:
x = obj.readline()
if not x == '':
print (x,end='')
if x == '' and obj.read() == '':
break | true |
fe48c1bd0564d415b514b8405f23ede01db4d59d | Python | fredlqin/gentrification | /old_files/variable_ave.py | UTF-8 | 4,711 | 3.6875 | 4 | [] | no_license | import requests
import string
import json
from collections import *
#
# readcsv is a starting point - it returns the rows from a standard csv file...
#
def readcsv( csv_file_name ):
""" readcsv takes as
+ input: csv_file_name, the name of a csv file
and returns
+ output: a list of lists,... | true |
14a5d33dc39fd884524486a5462bdc910f414b86 | Python | rrkrp100/Progs | /Anime Downloader/anime.py | UTF-8 | 843 | 2.75 | 3 | [] | no_license | #! Python 3
import pyperclip
from selenium import webdriver
anime=pyperclip.paste()
if len(anime)==0:
print('Please Copy a valid name and relaunch')
exit()
link ="http://animeheaven.eu/i.php?a="+anime
browser= webdriver.Firefox()
browser.get(link)
ep=browser.find_elements_by_class_name('infovanr')
if len(ep)==0... | true |
70757ae84c4df3648936886aec7a2c9a78981986 | Python | sohaibali01/AI | /Astar.py | UTF-8 | 5,172 | 3.296875 | 3 | [] | no_license |
import math
def findMin(frontier):
# returns that node in the frontier which has a lowest cost
minV=math.inf
node=''
for i in frontier:
if minV>frontier[i][1]:
minV=frontier[i][1]
node = i
return node
def actionSequence(graph, initialState, goalS... | true |
dbb241381fee8c6a69057a9e20da69056f03cda1 | Python | AK-1121/code_extraction | /python/python_12193.py | UTF-8 | 141 | 2.625 | 3 | [] | no_license | # How can I pass an argument to a keyfunc being passed to itertools.groupby?
groupby(..., lambda x: my_normal_function(x, other, arguments))
| true |
dd2825f8b840edee73ca6531d37fda476543265f | Python | pythontech/ptcons | /consd.py | UTF-8 | 7,473 | 2.609375 | 3 | [] | no_license | #!/bin/env python
#=======================================================================
# Console daemon
#=======================================================================
from twisted.internet import protocol, reactor, error
from twisted.protocols import basic
from twisted.conch import telnet
from tuple... | true |
2e63e5af552b04fa77fc749cc11b96539e481108 | Python | mahewi/TKO2096 | /sourceCodes/SymmetricPairCV.py | UTF-8 | 2,991 | 2.78125 | 3 | [] | no_license | '''
Authors: Marco Willgren, 502606
Jarno Vuorenmaa, 503618
'''
import os
import numpy as np
import operator
import scipy.spatial.distance as ssd
if __name__ == '__main__':
pass
basepath = os.path.dirname(__file__)
featurepath = os.path.abspath(os.path.join(basepath, "../Data5/proteins.featur... | true |
55f2c2994b265a26e0f00ba0eff513588961b0e4 | Python | alpodolsky/419-GroupProject | /UserProfile.py | UTF-8 | 3,739 | 3.25 | 3 | [] | no_license | # from essential_generators import DocumentGenerator
import socket
import random
import time
'''
Variables that could be unecessary inclue name,
'''
class User():
def __init__(self, name, ip_address=None, port_no=None, socket=None):
self.name = name
#self.gen = DocumentGenerator()
self.ip_address = ip_addr... | true |
129426f194891c81f0ebd3a37f4af8c9ef018d9d | Python | Cecilia9999/pyspg | /pointgp.py | UTF-8 | 24,550 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding=utf-8 -*-
"""
Created on 2019-03-10
Update on 2020-06-23
Author: Cecilia9999
GitHub: https://github.com/Cecilia9999/
"""
'''
This file is for finding point group
'''
import numpy as np
import primitive
import delaunay
def AllRotOperation():
"""
Find all point ope... | true |
181e988992aa7b1d08a63a113e815b48f86f9c8e | Python | Cognizant-CDB-AIA-BAI-AI-OI/LEAF-ENN-Training-V2 | /servicecommon/fitness/comparator.py | UTF-8 | 455 | 3.828125 | 4 | [] | no_license |
class Comparator():
"""
An interface for comparing two objects.
"""
def compare(self, obj1, obj2):
"""
:param obj1: The first object offered for comparison
:param obj2: The second object offered for comparison
:return: A negative integer, zero, or a positive integer a... | true |
d62569f653e566ada2fa2b44f66168b22045d068 | Python | Duckchoy/AI-algos | /ML/supervised/SVC.py | UTF-8 | 3,511 | 3.453125 | 3 | [] | no_license | # Support Vector Classifier (SVC)
import numpy as np
class SVC:
"""
A robust (to outliers) large/maximum margin classifier: maximize the size of
the projection of a data point onto the parameter axis (which sits normal to
the decision boundary). In other words, minimize ||params||.
"""
d... | true |
55044c7635bcc73260b3b0300839725f1607623d | Python | finnishmiko/Azure | /Connect_to_Azure_Event_hub.py | UTF-8 | 1,023 | 2.828125 | 3 | [] | no_license | ## Send data from Raspberry Pi to Azure Event hub ##
import time
import sys
from azure.servicebus import ServiceBusService
import json
## Event hub ##
NamespaceName = "<add namespace name here>"
## Namespace is called "Endpoint" in Azure connection string. ##
## From Namespace ignore "sb://" and "servicebus.windows.... | true |
1b57f1ec9d5d89c6e27bc4345fce0976f45fb9bd | Python | pohmelie/ainject | /tests/test_func.py | UTF-8 | 1,365 | 2.828125 | 3 | [
"WTFPL"
] | permissive | import pytest
@pytest.mark.asyncio
async def test_coroutine(binded_injector):
@binded_injector.inject(value="singleton_value")
async def foo(value):
return value
a = await foo()
b = await foo()
assert a is b
@pytest.mark.asyncio
async def test_function(binded_injector):
@binded_i... | true |
a3b3403ce2bc092556e07fc75106e6946877f1a3 | Python | sanchit2843/ArtificialEyes | /client_code.py | UTF-8 | 664 | 2.9375 | 3 | [] | no_license | import cv2
import requests
import os
import keyboard
ngrok_url = 'http://f07b6690.ngrok.io'
def send_data_to_server(image_path):
form_data = open(image_path, 'rb')
print(form_data)
files = {'file': form_data}
print(files['file'])
response = requests.post(ngrok_url, files=files)
print(response)
c... | true |
09c1ce89692352a9004f7edc81ac20ae91b75d46 | Python | flaviu2001/University-Projects | /Semester 1/Fundamentals of Programming/Labs/Assignment 6-9+11/Assignment/Repos/BaseRepos/StudentRepo.py | UTF-8 | 1,498 | 3.5 | 4 | [] | no_license | from utils import *
class StudentRepo:
def __init__(self, student_list=None):
if student_list is None:
student_list = []
if student_list is Container:
self._student_list = student_list
else:
self._student_list = Container(student_list)
@property
... | true |
af4867a894f5a403638728a9f03bfc4062f1f43b | Python | rakuseirobot/Aquila-OpenMV | /RTCtest.py | UTF-8 | 230 | 2.921875 | 3 | [
"MIT"
] | permissive | # RTC Example
#
# This example shows how to use the RTC.
import time
from pyb import RTC
rtc = RTC()
rtc.datetime((2000, 0, 0, 0, 0, 0, 0, 0))
while (True):
print(rtc.datetime()[5]*60+rtc.datetime()[6])
time.sleep(1000)
| true |
cc4411b2eb0b047c449b90d25980d993b64db2b6 | Python | Design-Enginnering/PrepBytes-questions | /Four and Seven.py | UTF-8 | 290 | 3.40625 | 3 | [] | no_license | def sol(s):
a, b = 0, 0
while (s > 0):
if (s % 7 == 0):
b += 1
s -= 7
elif (s % 4 == 0):
a += 1
s -= 4
else:
a += 1
s -= 4
ans = ""
if (s < 0):
ans = "-1"
return ans
ans += "4" * a
ans += "7" * b
return ans
s = int(input())
print(sol(s))
| true |
e45272a69f7e4f46cf3491fbfa72f9e6beeccb2d | Python | Danfoa/differentiable-robot-model | /differentiable_robot_model/rigid_body/utils.py | UTF-8 | 8,970 | 2.515625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright (c) Facebook, Inc. and its affiliates.
import random
from contextlib import contextmanager
import numpy as np
import timeit
import torch
import operator
from functools import reduce
prod = lambda l: reduce(operator.mul, l, 1)
torch.set_default_tensor_type(torch.DoubleTensor)
def cross_product(vec3a, ve... | true |
ec9b98982fc5986063129ce87e6a8d7107ade84f | Python | otraczyk/gsevol-web | /bindings/gsevol.py | UTF-8 | 3,190 | 2.734375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import tempfile
from bindings.base import launch as base_launch
from bindings.utils import wrap_in_tempfile
def launch(params, timeout=300, stdin=None, *args, **kwargs):
command = ['python2', 'lib/gsevol2013/src/gsevol.py']
return base_launch(command, params, timeout, stdin, *args, **k... | true |
e61c983bd05dc1f52b4373fe8b877e54bc58ace3 | Python | sfdye/leetcode | /basic-calculator-iii.py | UTF-8 | 936 | 3.234375 | 3 | [] | no_license | class Solution:
def calculate(self, s):
"""
:type s: str
:rtype: int
"""
num, stack, sign = 0, [], "+"
s += " "
i = 0
while i < len(s):
if s[i].isdigit():
num = num * 10 + int(s[i])
elif s[i] == "(":
... | true |
8a888f95af2453d0dc571731752a0193fa9c1d56 | Python | soulomoon/HotelScraper | /common.py | UTF-8 | 401 | 2.953125 | 3 | [
"MIT"
] | permissive | import re
def price_filter(original_function):
def wrapper(*args, **kwargs):
prcstr = original_function(*args, **kwargs)
if not prcstr:
return None
prcstr = prcstr.replace(",", "")
reg = re.search(r"\d+", prcstr)
return reg.group() if reg else None
return wr... | true |
0a415c3df80e8e75c34779c946e2eaf7532623c5 | Python | ZverevDmitriyZDV/HW-custom_decorator_Generator_Iterator | /decorator_log.py | UTF-8 | 1,371 | 2.953125 | 3 | [] | no_license | from datetime import datetime
import os
# начало конструктора
def loger_constructor_decor(file_name, file_path=None):
if file_path is None:
file_place = os.path.join(os.getcwd())
else:
file_place = os.path.join(os.path.abspath(file_path))
file_path = os.path.join(file_place, file_name)
... | true |
ede0b85ddd7a5fd8fc6ce2068581b1b1e7e9984e | Python | MariaDukmak/DIP | /paxos_implementatie/tests/canvas_examples.py | UTF-8 | 5,763 | 2.859375 | 3 | [] | no_license | from unittest import TestCase, main
from paxos_implementatie.paxos import simulation
class CanvasExamples(TestCase):
def test_example1(self):
"""
Example 1 from the canvas page.
"""
simulation_input = "1 3 0 15\n" \
"0 PROPOSE 1 42\n" \
... | true |
d2bae7466ee50a28561ef03b7424b78752348a5d | Python | RianBrenoPolonini/Prog-I | /prova_runcode/p2/ex3.py | UTF-8 | 323 | 3.375 | 3 | [] | no_license | mensagem = input()
palavra = input()
t_m = len(mensagem)
t_p = len(palavra)
def check(palavra, mensagem, i):
for x in range(t_p):
if palavra[x] == mensagem[i+x]:
return False
return True
n = 0
for i in range(t_m - t_p + 1):
if check(palavra, mensagem, i):
n += 1
print... | true |
b9b0369906d25018cf235d3bdbf4cbe06c9362c4 | Python | AmanStreak/Program-to-convert-Number-to-Binary-Number-using-Python | /NumbertoBinary.py | UTF-8 | 527 | 3.890625 | 4 | [] | no_license | def Numtobinary():
num = int(input("Enter the number: "))
st = ''
if num % 2 == 0:
while num != 1:
div = num // 2
x = num - (div * 2)
st = st + str(x)
num = div
if num == 1:
st = st + '1'
else:
while ... | true |
d3cd4058ea557aa6e962aa7a84323e57522545ae | Python | R1chardJam3s/python-regenerator | /Corridor.py | UTF-8 | 272 | 3.09375 | 3 | [] | no_license | class Corridor:
def __init__(self, start_x, start_y, end_x, end_y):
self.start_x = start_x
self.start_y = start_y
self.end_x = end_x
self.end_y = end_y
def getStart(self):
return(self.start_x, self.start_y)
def getEnd(self):
return(self.end_x, self.end_y) | true |
ab12afd894a4a9069c05c27274347c1947dc8429 | Python | thiagomaia971/SistemasInteligentes | /NP1/adaline.py | UTF-8 | 2,086 | 3.34375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from activation_functions import heaviside_step_function
import math as math
class Adaline():
def __init__(self, log, input_size, act_func=heaviside_step_function, epochs=5000, learning_rate=0.0015, precision=0.00001):
self.log = log
self.act_... | true |
52cb0d04b94b2037f809973184fcef180cd10041 | Python | strmrider/RUDP | /src/models/packet.py | UTF-8 | 2,885 | 2.890625 | 3 | [] | no_license | import struct, random, hashlib
from .constants import ACK, SYN, FIN, SYN_ACK, FIN_ACK, PACKET_HEADER_SIZE
_INT_MAX = 4294967296
_HEADER_SIZE = PACKET_HEADER_SIZE
_CHECKSUM_LEN = 4
_PACK_FORMAT = "!I I B H"
_UNPACK_FORMAT = "!I I B H"
def generate_id():
return random.randint(0, _INT_MAX)
def _calculate_checksum(... | true |
c93e1e6807bffd42ffa0d1f76df458dd261cd2a9 | Python | HenryHK/App-Markets-Classifier | /NBClassifier.py | UTF-8 | 5,203 | 3.1875 | 3 | [] | no_license | #!/usr/bin/python3
import csv
import math
import random
import time
from operator import itemgetter
import numpy as np
from sklearn import metrics
#42%
# merge training and label -> name label tfidf ...
def concentrateData(train_data, labeled_data):
training_list = list(csv.reader(open(train_data,'r'), delimit... | true |
d30986b6a58c537cd60bb58da76f5fb0bd82e826 | Python | hbinl/hbinl-scripts | /Scripts/allocationcheck.py | UTF-8 | 1,381 | 2.765625 | 3 | [
"MIT"
] | permissive |
inp = str("X = alloc(regA, regB, regA, regC, regA) ;\
X = alloc(regA, regB, regA, regC, regB) ;\
X = alloc(regA, regB, regC, regA, regB) ;\
X = alloc(regA, regB, regC, regA, regC) ;\
X = alloc(regA, regC, regA, regB, regA) ;\
X = alloc(regA, regC, regA, regB, regC) ;\
X = alloc(regA, regC, regB, regA, regB) ;\
X = all... | true |
6383de8db1f59b8ea9dc7b21f3d16b31de97acd1 | Python | kkchen/rnn_software | /keras_example.py | UTF-8 | 2,273 | 3.421875 | 3 | [] | no_license | """Simple Keras RNN example.
Builds, trains, and tests an RNN discriminator that distinguishes between
English and German/French.
"""
import warnings
with warnings.catch_warnings():
warnings.simplefilter('ignore', RuntimeWarning)
warnings.simplefilter('ignore', FutureWarning)
from tensorflow import kera... | true |
7189ba24762e3386317262a1a06488dff54deed2 | Python | SeedofWInd/LeetCoding | /Facebook/311_Sparse_Matrix_Multipilication.py | UTF-8 | 1,139 | 3.640625 | 4 | [] | no_license | """
Description
___________
Given two sparse matrices A and B, return the result of AB.
You may assume that A's column number is equal to B's row number.
Example:
A = [
[ 1, 0, 0],
[-1, 0, 3]
]
B = [
[ 7, 0, 0 ],
[ 0, 0, 0 ],
[ 0, 0, 1 ]
]
| 1 0 0 | | 7 0 0 | | 7 0 0 |
AB = | -1 0 3 | x | 0 0... | true |
81476aa62f3dda8d13839aaff73fbdf7a0cfda98 | Python | Tinttu7/my-first-blog | /test.py | UTF-8 | 330 | 3.328125 | 3 | [] | no_license | print("hello world")
name= "Stina"
city="Porvoo"
print("Hello my name is "+ name)
print(name+" lives in "+city)
Adress= " Huvituksentie 23 06150 " +city
print("hello my name is "+name+" I live in "+city+". My address is"+Adress)
födelseår=[1976, 1978, 1983, 1946, 1949]
print(födelseår)
födelseår.sort()
print(födelseår... | true |
4d242841e825f3866c26d9c64f3fb00d69bf8bde | Python | fakedrake/overlay_parse | /overlay_parse/matchers.py | UTF-8 | 8,430 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | import re
from .overlays import Overlay, OverlayedText
from functools import reduce
class BaseMatcher(object):
"""
An interface for Matcher objects.
"""
def offset_overlays(self, text, offset=0, **kw):
raise NotImplementedError("Class %s has not implemented \
offset_overlays" % type... | true |
d8035756eab71a00ccf0aef46f5e0f00784cc946 | Python | let-me-code/API-s | /Operator and Location.py | UTF-8 | 385 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 9 14:38:40 2019
@author: saurabh
"""
phnum = int(input("Enter mobile number : "))
url = "https://api.datayuge.com/v1/lookup/" + str(phnum)
import urllib.request as ur, json
result = json.loads(ur.urlopen(url).read())
print("Operator Name: " + r... | true |
6be311e7efbbd13d3037a78a3c2befe93780ea5f | Python | csyezheng/CS_61A_Summer_2016 | /week 1 Introduction/disc00/disc00.py | UTF-8 | 1,735 | 4.0625 | 4 | [] | no_license | # discussion00
# 1.3 Questions
# 1. What will Python print?
x = 6
def square(x):
return x * x
square(x)
max(pow(2, 3), square(-5)) - square(4)
# Answer
# 36
# 9
# 2. What will Python print?
from operator import sub, mul
def print_sub(x, y):
print('sub')
return sub(x, y)
def print_mu... | true |
c6ef625adf98ceeb2e50016c5f48a7ffa744d539 | Python | ajkannan/Classics | /Tests/test_one_class_svm.py | UTF-8 | 2,144 | 2.625 | 3 | [] | no_license | from Models.OneClassSVM import OneClassSVM as SVM
from os import listdir
from os.path import isfile, join
from pprint import pprint
from Utilities.Text import Text
from Utilities.FunctionalNGram import FunctionalNGram as FNG
from Utilities.FunctionalNGram import combine_n_gram_features as combine
import pylab as pl
... | true |
0553460362c019501e74be272748b965a39bf869 | Python | timbearden/Project | /twitter/top_links.py | UTF-8 | 428 | 2.65625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from collections import Counter
tweets = pd.read_csv('../data/tweets.csv', encoding='utf8', engine='python')
link_lists = tweets.link
link_splits = map(lambda links: links.split() if links else '', link_lists)
links = [link for link_list in link_splits for link in link_list]
lin... | true |
45a7c34e517c9edb5f7756e8decd6648c4c1eae0 | Python | vikramforsk2019/FSDP_2019 | /day7andcodechallenges/json.py | UTF-8 | 738 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 11 16:52:12 2019
@author: vikram
"""
"""
Code Challenge
Name:
JSON Parser
Filename:
json.py
Problem Statement:
Get me the other details about the city
Latitude and Longitude
Weather Condition
Wind Speed
... | true |
947d5c21eae9ada06dca54c099af71c0a852a3cc | Python | Pranav016/Dynamic-Programming | /LongestCommonSubsequence/LCS_Recursive.py | UTF-8 | 566 | 3.921875 | 4 | [] | no_license | # Problem Statement- Given two strings, print the lenght of the longest common subsequence for the two given strings.
# Difference between substring and subsequence- Substring is continous whereas subsequence may or may not be a continous string.
def lcs(a,b,n,m,ans):
if n==0 or m==0:
return 0
if ... | true |
c82b8757d47893e3e5334f61d3db1b98653a63eb | Python | Nekmo/nekutils | /modules.py | UTF-8 | 2,083 | 2.84375 | 3 | [
"MIT"
] | permissive | # coding=utf-8
from importlib import import_module
import traceback
import six
import sys
__author__ = 'nekmo'
def get_module(path, print_traceback=False):
missing_module = True
try:
return __import__(path, globals(), locals(), [path.split('.')[-1]])
except ImportError as e:
if print_trac... | true |