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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
51fc5447d1eb0b0cbc3b2cdc4d6ae52fafb2498c | Python | mikaponics/mikapod-soil-rpi | /src/bluetooth/foundation.py | UTF-8 | 1,563 | 2.671875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
import datetime
from datetime import timedelta
import os
import time
import pytz
from dotenv import load_dotenv
load_dotenv(verbose=True)
#---------------------------#
# APPLICATION CONFIGURATION #
#---------------------------#
"""
Variables used for configuring the how the... | true |
0cf14607b9b9166cfdb26044acae78a6fac43e82 | Python | vinodharani/Python-Basics | /Question/app.py | UTF-8 | 621 | 3.8125 | 4 | [] | no_license | from Question import Question
question_prompts = [
"What color is banana?\na. Yellow\nb. Black\nc. Red\n",
"What color is strawberry?\na. Magenta\nb. Red\nc. Green\n",
"What color is apple?\na. Green\nb. Red\nc. Blue\n"
]
questions = [
Question(question_prompts[0], "a"),
Question(question_prompts[... | true |
41b5847623de7ab8477a3a49d761dbe2db0bed1e | Python | isebarn/betterbet | /Tables.py | UTF-8 | 4,004 | 2.890625 | 3 | [] | no_license | def options_table(data):
for price in data:
price_value = price['Value']
day = price['Time'].day
yield {'Value': price_value, 'Time': price['Time'], 'SN': price['SN'], 'increment': 0}
for increment in price['increments']:
if increment['Value'] == 0: continue
price_value += increment['Value... | true |
a469f61aac40bb63bae4c8e40a8bae79a35e879a | Python | BASILJACOB123/Physics_Calculator | /Computer project/FBDS.py | UTF-8 | 1,341 | 3.921875 | 4 | [] | no_license | #Python program for FBD's of blocks attached by string one below the other
def two_blocks(m1,m2):
g=10
t=(m2*g)
t1=(m1*g)+t
return t1,"N",t,"N"
#and
#to calculate the acceleration of the block
def acc_blocks(a,b):
g=10
acc1=(g*(2*a-b))/(4*a+b)
acc2=2*acc1
return acc1,acc2
def lift():
#t... | true |
09cd6d3bacd4a048a281f016b3471d4f450075b9 | Python | M4lek1t/RPG | /main.py | UTF-8 | 375 | 2.5625 | 3 | [] | no_license | from Hero import Hero
from Monster import Monster
from Battle import Battle
battle = Battle()
hero = Hero()
monster = Monster()
print('----------------------------------')
print(hero.damage())
print(hero.spell())
print('----------------------------------')
print(monster.damage())
print(monster.spell())
print('-------... | true |
88a8060c32f68d7b5c82f13b3855a5efa83872f0 | Python | fjgreco/paccmann_predictor | /paccmann_predictor/utils/layers.py | UTF-8 | 4,082 | 2.921875 | 3 | [
"MIT"
] | permissive | """Custom layers implementation.
Inspired by Bahdanau attention, the following implements a contextual attention
mechanism. The attention weights specify how well each token of the encoded
SMILES (e.g. bRNN, raw embedding, conv_output) targets the genes.
NOTE:
gene_projection and smiles_projection are used to project... | true |
59daa8f384d3c0ae2d4bacce6f64b23956e66af2 | Python | matxa/AirBnB_clone | /models/base_model.py | UTF-8 | 1,400 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python3
""" BaseModel class which all other classes inhirit from """
from datetime import datetime
import models
import uuid
class BaseModel():
"""Base Model"""
def __init__(self, *args, **kwargs):
"""Init"""
if kwargs:
for k, v in kwargs.items():
if k =... | true |
3758ae4ec867d6f92fa9645c7d35a168b9088911 | Python | Sanket-Mathur/CodeChef-Practice | /PAJAPONG.py | UTF-8 | 132 | 3.203125 | 3 | [] | no_license | for _ in range(int(input())):
X, Y, K = map(int, input().split())
turn = (X+Y) // K
print('Paja' if turn%2 else 'Chef')
| true |
b7566ccd8806b8417651f8af2b1e07bfe2211535 | Python | Fokriz/Hashi | /HashiGame.py | UTF-8 | 25,254 | 2.671875 | 3 | [] | no_license | import pygame, sys
import random
TypeLines = '|#-='
Numbers = '12345678'
genLevel = 0
pobeda = False
class Dot():
countOfDots = 0
radius = 10
def __init__(self, x = 0, y = 0, value = 1, genLvl = -1):
Dot.countOfDots += 1
self.x = x
self.y = y
self.value = value #Количесв... | true |
181018256e289e9fe01b28e6149acef6cd97ae02 | Python | lpwwpl/remote_car_repo | /motor_thread.py | UTF-8 | 3,299 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import time
import threading
import Queue
# for motor control
import RPi.GPIO as GPIO
en_a = 18
in_1 = 23
in_2 = 24
en_b = 16
in_3 = 12
in_4 = 25
class MotorThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.name = 'Motor Control Thread'
... | true |
a670523428b346a60a426b90c2be40a4cd0623fe | Python | mariayasar/mypackage | /lambdata_mariayasar/function.py | UTF-8 | 1,080 | 3.859375 | 4 | [
"MIT"
] | permissive | def split_data(dt):
"""
Function to split dates ("MM/DD/YYYY", etc.) into multiple columns
Input: DF column, output - 1x3 data frame
"""
import pandas as pd
assert type(dt)==pd.Series, 'argument should be a pandas Series'
dt=pd.to_datetime(dt)
year=dt.td.year
month=dt.td.month
... | true |
beb8d61f282c1f074922a2b92e2448c2499cf04a | Python | mkioga/32_python_Blackjack | /Import_test.py | UTF-8 | 21,469 | 3.953125 | 4 | [] | no_license |
# ========================================================
# Import_test.py ==> Importing Techniques
# ========================================================
# We can include Blackjack program in another program
# We will import "Blackjack1.py" and see how it runs
# import Blackjack1 # NOTE we only use this for B... | true |
39ce23a8ddc1abe76dfd48d2bb51020f6dc30e8a | Python | w4lck3r/logique-python | /formules-master/formules-master/formule.py | UTF-8 | 2,726 | 3.109375 | 3 | [] | no_license | class Et:
"""Classe permettant de construire des conjonctions de formules"""
def __init__(self,gauche,droite):
self.gauche = gauche
self.droite = droite
def f_gauche(self):
return self.gauche
def f_droite(self):
return self.droite
def to_string(self):
retu... | true |
68b36881e028157ca86a12b70665fdb958110144 | Python | upura/yugioh.duellinks.balance | /duellinks_balance.py | UTF-8 | 1,319 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import cv2
from sklearn.cluster import KMeans
from collections import Counter
import matplotlib.pyplot as plt
import numpy as np
img_dirs = ['img']
CARD_NUM = 4
CLASS_NUM = 3
img_data = []
def convertImgToRGB(img):
for card in range(CARD_NUM):
trim... | true |
07365d293c27f42504a5f4e0bd84147fac783eec | Python | mike-kane/resume-chatbot | /actions/email_resume.py | UTF-8 | 1,060 | 2.53125 | 3 | [] | no_license | from email_validator import validate_email, EmailNotValidError
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import os
def _is_valid(email_address):
try:
valid = validate_email(email_address)
return True
except EmailNotValidError as e:
... | true |
81759e5e3a88370aae92ff70fffb3a20ec598541 | Python | ssdatar/compciv-2016 | /exercises/0012-got-babynames/a.py | UTF-8 | 451 | 2.703125 | 3 | [] | no_license | import os
import requests
from os.path import basename
os.makedirs('tempdata', exist_ok = True)
url = 'http://stash.compciv.org/ssa_baby_names/ssa-babynames-nationwide-2014.txt'
response = requests.get(url)
content = response.text
base = basename(url)
got_name = os.path.join('tempdata', base)
got_file = open(got_nam... | true |
fcd813b681b61500336da02cc7338a65d93607c6 | Python | Twil-7/Selective_Search | /selective_search.py | UTF-8 | 8,042 | 2.84375 | 3 | [] | no_license | import cv2
import numpy as np
import skimage.segmentation
import random
import skimage.feature
# Selective Search algorithm
# step 1: calculate the first fel_segment region
# step 2: calculate the neighbour couple
# step 3: calculate the similarity dictionary
# step 4: merge regions and calculate the second merged r... | true |
9fb4a984a83df966c3fd9a3762d2eadd95ee8e64 | Python | fykss/python-sandbox | /problems/leetcode/uncommon_words_from_two_sentences.py | UTF-8 | 592 | 3.609375 | 4 | [] | no_license | from typing import List
from collections import Counter
# My solution
def uncommonFromSentences(A: str, B: str) -> List[str]:
A = A.split(" ")
B = B.split(" ")
counter = Counter(A + B).most_common()
result = []
for i in range(len(counter)):
if counter[i][1] == 1:
result.appe... | true |
2c54ca1bbd5a37d8e597de8c88f350d8a3c387a2 | Python | darkcharan/Recommended-System-Projects | /movies.py | UTF-8 | 2,434 | 3.859375 | 4 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer #histogram(array) representation of words
from sklearn.metrics.pairwise import cosine_similarity #to calculate the cosine_similarity
from sklearn import datasets
df = pd.read_csv('movie_dataset.csv')
# print(df.keys()) ... | true |
f941955e5bb5f289476e283311d748ab2eaffcee | Python | MelodyLucien/python_repo | /startDemopython3/6.dict.py | UTF-8 | 392 | 3.46875 | 3 | [] | no_license | #!/usr/bin/python3
#dictionary
dict = {}
dict["one"]="one"
dict["two"]="two"
dict["three"]="three"
print (dict)
print (dict.keys())
print (dict.values())
tinydict={"four":"four","five":["five","six"],"six":"six","seven":"seven"}
print (tinydict)
print (tinydict.keys())
tinydict['four']='f'
print(tinydic... | true |
4071d7abf9c561f5b780afc491d4540eb2987cab | Python | FirebirdSQL/firebird-qa | /tests/bugs/core_6279_test.py | UTF-8 | 4,237 | 2.546875 | 3 | [
"MIT"
] | permissive | #coding:utf-8
"""
ID: issue-6521
ISSUE: 6521
TITLE: Put options in user management statements in any order
DESCRIPTION:
According to new syntax that is described in doc\\sql.extensions\\README.user_management, any statement that
creates or modifies user, must now look like this:
CREATE OR ... | true |
fe8a014593ccd0cc051b00cd51a06524b2e2055f | Python | AIFFEL-coma-team01/Yongho | /week_03/Trapping Rain Water_42.py | UTF-8 | 1,763 | 3.859375 | 4 | [] | no_license | '''
42. Trapping Rain Water [빗물 트래핑]
각 막대의 너비가 1 인 고도지도를 나타내는 음이 아닌 정수 n 개가 주어지면
비가 내린 후 얼마나 많은 물을 가둘 수 있는지 계산합니다.
- 배열에 크기를 블럭의 크기라 생각하고 1 0 1 일때는
- ■ ■ 크기 1 블럭이 양옆에 있고 중간에는 비어있는 구조이다.
- 여기서 비어 있는 부분에 물이 차이니 저기서 물은 1만큼 가둬집니다.
풀이 :
가장 큰 값을 기준으로 왼쪽에서 오른쪽, 오른쪽에서 왼쪽으로 진행하자.
L : 가장 큰 값을 기준으로 왼쪽에서 오른쪽 증가 값
R ... | true |
d9775b5f891898b9a67bfcda6ed78bd607637347 | Python | commonlisp/bearded-tribble | /listcrawler.py | UTF-8 | 2,556 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from pyspark import SparkContext
from lxml import etree, html
from collections import Counter
import time
import urllib2
import sys
import datetime
today = datetime.date.today()
dates = ['%d%02d'%(today.year, month) for month in range(1,today.month)]
baseurl = "http://mail-archives.apache.org/m... | true |
35b9ce16eec565435f49b810667a9d1926b421c1 | Python | roechi/machine_learning_assignment | /excercises/excercise_2/uebung2.py | UTF-8 | 4,032 | 2.96875 | 3 | [] | no_license | # Dies ist nur ein Verlauf der Bearbeitung der Uebung
# in ipython
import numpy as np
import matplotlib.pyplot as plt
In [4]: x_min = -10.
In [5]: x_max = 10.
In [6]: x = np.random.uniform(x_m
x_max x_min
In [6]: x = np.random.uniform(x_min, x_max, 10)
In [7]: x
Out[7]:
array([-4.86564111, -8.49550024, -5.20... | true |
ff42b0865da32df8de9a8522aedb31e1e4c5240c | Python | Nick11/LaTeX-CV-Template | /python/CVDate.py | UTF-8 | 1,911 | 3.125 | 3 | [] | no_license | # encoding: utf-8
__author__ = 'scheuing'
class CVDate:
number_post = {0:'', 1:'1st', 2:'2nd', 3:'3rd'}
month_en = {0:'', 1:'January', 2:'February', 3:'March', 4:'April', 5:'May', 6:'June', 7:'July', 8:'August', 9:'September', 10:'October', 11:'November', 12:'December'}
month_de = {0:'', 1:'Januar', 2:'Feb... | true |
f1124b2c862e6231ee94b612566fa7d5171ef314 | Python | IfDougelseSa/cursoPython | /exercicios_seccao4/18.py | UTF-8 | 138 | 3.921875 | 4 | [] | no_license | # metros cúbicos para litros
m = float(input('Digite o valor em metros cúbicos: '))
l = 1000 * m
print(f'O valor em litros é {l}.')
| true |
43c54402cba3578771a885cb9f7420d298e40733 | Python | sjmignot/sceance | /sceance/set_watchlist.py | UTF-8 | 2,925 | 3.125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
'''
Starts a Firfox headless brower to see if movies on your watchlist are playing
at any of your favorite theaters.
Favorite theaters are taken from a txt file (extracted from "theaters.txt").
These showtimes are compared to a watchlist (extracted from "watchlist.txt")
-samuel mignot-
'''
# ... | true |
83a64405383ad80788aa747b445f657c204a800f | Python | archenRen/learnpy | /leetcode/backtracking/code-46.py | UTF-8 | 493 | 3.375 | 3 | [] | no_license | # from itertools import permutations
def permute(nums: 'List[int]') -> 'List[List[int]]':
def backtrack(result, path):
if len(path) == n:
result.append(path.copy())
return
for i in range(n):
if nums[i] in path:
continue
path.append(nu... | true |
5d0d3cd7c351fa7760d053ddbe08e168f92f8b9e | Python | binoytv9/problem-solving-with-algorithms-and-data-structures | /3rd chapter/9.py | UTF-8 | 549 | 3.96875 | 4 | [] | no_license | """ Modify the Hot Potato simulation to allow for a randomly chosen counting value so that
each pass is not predictable from the previous one """
from queue import *
import random
def hotPotato(nameList):
sim_queue = Queue()
for name in nameList:
sim_queue.enqueue(name)
while sim_queue.size() > 1:
num = rand... | true |
f2872304438c69a30a7ce7fa89ef76d377a467d5 | Python | eriknyquist/blatann | /blatann/waitables/waitable.py | UTF-8 | 1,233 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | import queue
from blatann.exceptions import TimeoutError
class Waitable(object):
def __init__(self):
self._queue = queue.Queue()
self._callback = None
def wait(self, timeout=None, exception_on_timeout=True):
try:
results = self._queue.get(timeout=timeout)
... | true |
7a1585305809469f16551973e16c1d4ccd1fd591 | Python | pmchrist/Poker-Thesis-Project | /Analyzer/logFileParser_Classification.py | UTF-8 | 45,148 | 2.765625 | 3 | [] | no_license |
import os
import datetime
import copy
from treys import Card
from treys import Evaluator
# Each game comes with its start date
dateTimeFormat = "%Y-%m-%d %H:%M:%S.%f"
# To decode card ids we need a lookup array
index2card = ['As', '2s', '3s', '4s', '5s', '6s', '7s', '8s', '9s', 'Ts', 'Js', 'Qs', 'Ks',
'Ah... | true |
977b100d31eeaf9b858c06e9f4c04f0772b9cd3b | Python | karellat/msc | /deep_mri/dataset/dataset_encoder.py | UTF-8 | 4,307 | 2.90625 | 3 | [
"MIT"
] | permissive | import numpy as np
import tensorflow as tf
import nibabel as nib
import random
from nilearn.image import resample_img
from deep_mri.dataset import AUTOTUNE
from deep_mri.dataset.dataset import load_files_to_dataset
def _get_3d_boxes(img_array, N, box_size=5, max_tries=100, include_zeros=True):
"""
Extract th... | true |
8c744b43af90046c387b8084573e62c26e97812f | Python | eghutton/jab | /test/harness_test.py | UTF-8 | 6,178 | 2.953125 | 3 | [] | no_license | import asyncio
from collections import Counter
from inspect import isfunction
from typing import get_type_hints
import pytest
import toposort
from typing_extensions import Protocol
import jab
class NumberProvider(Protocol):
def provide_number(self) -> int:
pass # pragma: no cover
class ClassBasic:
... | true |
0d4fb62d6ecca7c0768f8026dd7c2223fa503caa | Python | Michael231234/Web_Mining | /ass9.py | UTF-8 | 670 | 2.796875 | 3 | [] | no_license | import csv
inverted_idx = {}
with open('jeopardy_csv.csv') as f:
reader = csv.reader(f, delimiter=',')
next(reader)
for i, row in enumerate(reader):
text = ''.join([row[3], row[5], row[6]]).split()
text = [word.lower() for word in text]
text = list(set(text))
# print(i)
... | true |
8625373d56d801c1c951e72c99d338123c90c49b | Python | NuxiNL/cloudabi-ports | /src/catalog_set.py | UTF-8 | 2,967 | 2.609375 | 3 | [
"BSD-2-Clause"
] | permissive | # Copyright (c) 2015 Nuxi, https://nuxi.nl/
#
# SPDX-License-Identifier: BSD-2-Clause
import os
from typing import List, Set, Tuple
from . import util
from .version import FullVersion
from .catalog import Catalog
from .package import TargetPackage
class CatalogSet:
def __init__(self, catalogs: Set[Catalog]) -> ... | true |
8e5f2eb73252a7c438c49e02cbacb4be81eb61da | Python | JohnsonzxChang/devil | /src/common_util/flow.py | UTF-8 | 2,799 | 2.953125 | 3 | [
"MIT",
"CC-BY-SA-3.0",
"CC-BY-SA-4.0"
] | permissive | import numpy as np
import torch
from torch.nn.functional import grid_sample
def warp_flow(img_input, bkwd_flow_input, mode='bilinear', padding_mode='nan', align_corners=True):
"""Warp the input image by the given backward flow.
Conceptually, for each pixel coordinate in the output, it goes to the correspondi... | true |
8cabfdf0067f9283a6893643204a48913fb24cb3 | Python | pmaldagu/42AI_bootcamp_python | /day04/ex05/HowManyMedalsByCountry.py | UTF-8 | 737 | 3.125 | 3 | [] | no_license | import pandas as pd
from FileLoader import FileLoader
def howManyMedalsByCountry(data, name):
new = data[data['Team'] == name]
for games in new['Games']:
new['Medal'].drop_duplicates()
new_dico = {}
for year in new['Year'] :
new_dico[year] = {'G': 0, 'S': 0, 'B': 0}
for year, meda... | true |
758a2add8149585655cedc4b86bdd601231fbc90 | Python | paolotof/python | /p4erCoursera/week6_strings.py | UTF-8 | 2,594 | 3.609375 | 4 | [] | no_license | fruit = 'banana'
letter = fruit[1]
print letter
# a character too far
# len will tell us the length of the string. and not the length - 1
# you can loop through strings
fruit = 'bamama'
index = 0
while index < len(fruit):
leter = fruit[index]
print index, letter
index = index + 1
# it can also be done in a loo... | true |
e8091ddc826716ab7662210414de046cc7da3169 | Python | xiaoyma/autotest_ywwlrobot | /tools/emailCom.py | UTF-8 | 6,947 | 2.515625 | 3 | [] | no_license | # # encoding: utf-8
import time
import smtplib
import email
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
from email.header import Header
from email.mime.multipart import MIMEMultipart
import os.path
import re
from bs4 import BeautifulSoup
from cfg import Global
class SendEma... | true |
e4bcf7e20036c0f570d5bf10b4579e807ed588e6 | Python | NERSC/pytokio | /tests/test_connectors_mmperfmon.py | UTF-8 | 6,485 | 2.671875 | 3 | [
"BSD-3-Clause-LBNL",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """Test the mmperfmon connector
"""
import os
import gzip
import json
import nose
import tokio.connectors.mmperfmon
import tokiotest
def validate_iterable(obj):
"""Ensure that a obj is a valid data structure of some sort
"""
assert obj is not None
print("object has length %d" % len(obj))
assert le... | true |
59eb0a5c8ffdfe2911d38367017f0e2092e9d543 | Python | ICS3U-Gallo/cpt-ryan-kim | /main.py | UTF-8 | 2,384 | 2.953125 | 3 | [] | no_license | from sub_modules import alarm
from fish import *
import cv2
import numpy as np
import threading
import time
#Create a camera object, and set the width to 420 and the height 240 (420x240 pixels)
cap = cv2.VideoCapture(0)
cap.set(3,420)
cap.set(4,240)
#Intialize a background subtraction object
fgbg = cv2.createBackgro... | true |
d2d7f90ef172aa14600d9dbbfe15fb4fb03d972f | Python | jij3x/SolutionJudger | /_problems_009/Word Ladder II/convert_out.py | UTF-8 | 327 | 3.03125 | 3 | [] | no_license | import sys
import json
lines = sys.stdin.readlines()
for line in lines:
ladders = json.loads(line)
ladders.sort()
output = "["
for i, ladder in enumerate(ladders):
output += "," if i > 0 else ""
output += "[{}]".format(",".join(map(lambda x: '"{}"'.format(x), ladder)))
print(output ... | true |
246a0d1f159f145ff7bd51091b65cea35b1a4d6b | Python | mariomartgarcia/Feasibility_study_of_a_spectra-based_classication_of_the_Gaia_Photometric_Alerts | /code/utils_gaia.py | UTF-8 | 10,475 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[6]:
import pandas as pd
import numpy as np
from sklearn.metrics import confusion_matrix, accuracy_score, precision_score, recall_score, f1_score
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklearn.model_selection import train_test_split
from tensorfl... | true |
c57b1d811ba50298b11f8ec66d5e719c97b9ab58 | Python | Octopus-free/meme-generator | /QuoteEngine/InvalidFileExtension.py | UTF-8 | 576 | 3.265625 | 3 | [] | no_license | """A class for implement a user exception."""
class InvalidFileExtension(Exception):
"""Implement exception for file extension."""
def __init__(self, *args):
"""Initialize the class state."""
self.default_message = 'The file is not suite'
self.input_message = ''
for value in a... | true |
3e1b32e604ea0ecbb873ca4e5d1e284e6b507215 | Python | brad-schoonover/poropy | /interface/widgets/diagwidgets.py | UTF-8 | 3,146 | 2.625 | 3 | [
"MIT"
] | permissive | """
Provides custom QWidgets for use in automatically drawn plugin dialogs
"""
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QMessageBox, QProgressBar, QPushButton, QLineEdit, QToolButton, QFileDialog, QLabel
from PyQt5.QtCore import QThread
import os
class LinkText(QWidget):
def __init__(self,name,parent=N... | true |
253ae1744cc1b6b54db7ca177692797e6eda6e1a | Python | Alishirinova/python_lesson | /lesson10.py | UTF-8 | 1,206 | 3.234375 | 3 | [] | no_license | # работа с файлами
import os
current_dir = os.getcwd()
print(current_dir)
list_dir = os.listdir()# даст содержимое текущего каталога, если () пустые
print(list_dir)
list_dir = os.listdir('..')# две точки поднимают к верхней папке, не рекомендуется юзать
print(list_dir)
#создаем путь через джоин
tmp_path = os.path.j... | true |
807050d2d2065247f8b06acb0d10a235da2c72f4 | Python | jawhnycooke/ansible-cumulus-upgrade | /l2-demo/validation/steps/interfaces.py | UTF-8 | 6,682 | 2.671875 | 3 | [] | no_license | from behave import *
import yaml
import json
import subprocess
import time
import shutil
import os
'''
Scenario: Check BGP Neighbors
Given BGP is enabled
when neighbors are configured
then the neighbors should be up
'''
spine_vars_location = "../roles/spines/vars/main.yml"
leaf_vars_location = "../rol... | true |
2c36d748db9dbef81b1e1ca436f95afed555122c | Python | gistable/gistable | /all-gists/ed884c433c495075f000/snippet.py | UTF-8 | 1,456 | 2.53125 | 3 | [
"MIT"
] | permissive | graph = tf.Graph()
with graph.as_default():
with graph.device('/gpu:0'):
# input data
train_dataset = tf.placeholder(tf.int32, shape=[batch_size])
train_labels = tf.placeholder(tf.int32, shape=[batch_size, 1])
valid_dataset = tf.constant(valid_examples, dtype=tf.int32)
# va... | true |
b372ee554ef0ec5b6869197fcd9f8fa89b3b6e60 | Python | synnea/the-modern-witcher | /shop/models.py | UTF-8 | 810 | 2.5625 | 3 | [] | no_license |
from django.db import models
from django.contrib.auth.models import User
from items.models import Item
class Review(models.Model):
RATING_CHOICES = (
('5', '5'),
('4', '4'),
('3', '3'),
('2', '2'),
('1'... | true |
205d5fd582b583ac94108fc577e2ca135e87b56d | Python | softxjl/StockData | /test/__init__.py | UTF-8 | 859 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# insert_symbols.py
from __future__ import print_function
import datetime
from math import ceil
import bs4
import requests
def obtain_parse_wiki_snp500():
now = datetime.datetime.utcnow()
response = requests.get(
"http://en.wikipedia.org/wiki/List_of_S%26P_... | true |
f8cbee66e105bf647044a633d6a3e76a031ea950 | Python | ermshiperete/km-show-pages | /show_page/sortkbds.py | UTF-8 | 1,601 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
import gi
import logging
import os.path
import re
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Merge entries in file')
parser.add_argument('file', help='file with entries to merge')
parser.add_argument('-v', '--verbose', action='store_true',
... | true |
0f77a1d9234c0c2a73bad3a4bd37ce80e0db7717 | Python | gw-vis/SuspensionModel | /requirements/main.py | UTF-8 | 2,225 | 2.734375 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
from gwpy.frequencyseries import FrequencySeries
def act_lim(fmax,width,mass):
vel = np.sqrt(2*fmax*width/mass) # kinetic energy
return vel.decompose()
if __name__ == '__main__':
# Ground Velocity
finess = 50 ... | true |
ec4c216433b55c47179eb6a41e7cfa793e5ec21d | Python | futurescamp/Sandbox | /biblio_pub_finalw.py | UTF-8 | 2,093 | 3.140625 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/python
from bs4 import BeautifulSoup
import urllib2
import codecs
import csv
import re
#this defines some tags we will use later to only scrape from the part of the page with the publication info
def pub_tag(tag):
return ('p', {"dir": "ltr"})
def pub_info(tag):
return ('li')
f = code... | true |
2345d6bf6a5ec4885ba92abf5a3af7f0e070329e | Python | Crissal1995/rq1_m1 | /reportsanalyzer.py | UTF-8 | 5,799 | 2.8125 | 3 | [] | no_license | import argparse
import pathlib
import re
from functools import partial
from typing import List
from reports.commands import COMMANDS, COMMANDS_BY_NAME
from reports.reports import (
JudyReport,
JumbleReport,
MajorReport,
MultipleClassUnderMutationError,
MultipleFilesReport,
PitReport,
Report... | true |
924b3c363ba8093538fe0fa59f8eaa4c96c72bed | Python | pangpang-zhuzhu/APItest | /try/login.py | UTF-8 | 1,446 | 2.625 | 3 | [] | no_license | import requests
import xlrd
filename='E:\\test1.xlsx'
workbook = xlrd.open_workbook(filename)
sheets = workbook.sheet_names()
# print(sheets)
worksheet = workbook.sheet_names()[0]
print(worksheet) #得到表名称
yushuo_sheet= workbook.sheet_by_name('yushuo')#通过表名称获取
print(yushuo_sheet)#得到一个内存地址
nums = yushuo_sheet.nrows #得到行数
... | true |
d9616dacf647d8df4791ffcdd6705837ffe3b059 | Python | hg-mirrors/pypy_benchmarks | /lib/monte/monte/terml_nodes.py | UTF-8 | 5,108 | 2.640625 | 3 | [
"Python-2.0",
"MIT"
] | permissive | from collections import namedtuple
import sys
if sys.version_info[0] > 2:
long = int
unicode = str
basestring = (str, bytes)
_Term = namedtuple("Term", "tag data args span")
class Term(_Term):
def __new__(cls, tag, data, args, span):
#XXX AstroTag tracks (name, tag_code) and source span
... | true |
5e0e5fd55d951e9e953e0c899f040803cb336f52 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/allergies/eced9133fc10486aa0f384d72d503859.py | UTF-8 | 273 | 3.1875 | 3 | [] | no_license | ALLERGENS = 'eggs peanuts shellfish strawberries tomatoes chocolate pollen cats'.split()
class Allergies:
def __init__(self, n):
self.list = [ALLERGENS[i] for i in range(8) if (n>>i) & 1 != 0]
def is_allergic_to(self,s):
return s in self.list
| true |
772196bad0b3491ed64c95757b021f1eb4b65853 | Python | ddejohn/ItemFactory | /util/cli.py | UTF-8 | 3,180 | 3.3125 | 3 | [] | no_license | """A CLI for ItemFactory"""
import yaml
from random import choice
from typing import List
with open("ItemFactory/data/menus.yml") as f:
MAIN_MENU = yaml.safe_load(f.read())
TITLE = r"""
Greetings adventurer, and welcome to...
_ _| | ____| |
| __| _ \ __ ... | true |
581c83cfae5095502bffa210fd1556ce8fbdfefb | Python | ewerton5/Python-Projects | /pythonexercicios/ex055.py | UTF-8 | 224 | 4 | 4 | [] | no_license | l = [0, 0, 0, 0, 0]
for c in range(0, 5):
l[c] = float(input(f'Peso da {c+1}° pessoa: '))
print(f'O maior peso é {max(l[0], l[1], l[2], l[3], l[4])}Kg'
f'\nO menor peso é {min(l[0], l[1], l[2], l[3], l[4])}Kg')
| true |
0141174d4e877e51f8ab6c1ec88cc1e1038be1a0 | Python | qiraat-attar/git-python | /cont2.py | UTF-8 | 62 | 2.890625 | 3 | [] | no_license | print type(True)
print type("True")
x = 4
print x
print 'x==4' | true |
054e4d1c9d6a110b3c85620cb762ab9da1137c4a | Python | LelandYan/machine_learning | /python/chapter11/yield.py | UTF-8 | 4,338 | 3.5625 | 4 | [] | no_license | # _*_ coding: utf-8 _*_
__author__ = 'LelandYan'
__date__ = '2019/3/30 12:29'
import random
# 使用yield关键字,将普通的函数变成生成器
def mygen(alist):
while len(alist) > 0:
c = random.randint(0, len(alist) - 1)
yield alist.pop(c)
a = ["aa", "bb", "cc"]
c = mygen(a)
# 生成器就是一个迭代器,可以使用for进行跌打,生成器的最大的特点就是可以接受传入的一... | true |
1533fd61d877382434f3d332881d98df3350f29e | Python | williamwebb35/sarcasm_is_bad | /scripts_pickled_web/OOP_clas_def.py | UTF-8 | 10,004 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 20 12:29:11 2020
@author: sinua
This file contains the functions that train and fit the sarcasm model.
Reference: https://towardsdatascience.com/deploying-models-to-flask-fb62155ca2c4
Reference: https://github.com/mmalinas/Springboard_Git/blob/master/Capstone2_MelanieM... | true |
ae8b41333808305ea2d9741cc07c0d127ba73790 | Python | aisk/skime | /tests/test_syntax_rules.py | UTF-8 | 3,874 | 3.03125 | 3 | [] | no_license | import helper
import pytest
from skime.compiler.parser import parse
from skime.errors import SyntaxError
from skime.macro import DynamicClosure, Macro
from skime.types.pair import Pair as pair
def filter_dc(expr):
if isinstance(expr, DynamicClosure):
return filter_dc(expr.expression)
if isinstance(ex... | true |
ce8ef3e784dcbb4177111db1b92b5c56f1d72160 | Python | kurosouza/txledger | /cli.py | UTF-8 | 491 | 2.71875 | 3 | [] | no_license | import os
from fileloader import load_from_file, save_to_file
from ledger import Transaction, TransactionLog
if __name__ == '__main__':
transactions = load_from_file('transactions.csv')
tx_log = TransactionLog(transactions=transactions)
print('James: {}'.format(tx_log.get_account_balance('james')))
pri... | true |
92515ad6efd86bd054b05cad5e5e568a6c0b5a11 | Python | ulrichji/HeightmapTileMaker | /heightmaptilemaker/modifiers/min_modifier.py | UTF-8 | 642 | 3.03125 | 3 | [
"MIT"
] | permissive | from .base_modifier import BaseModifier
class MinModifier(BaseModifier):
def __init__(self):
super().__init__(supports_sub_modifiers=True)
self.sub_modifiers = []
def add_submodifiers(self, sub_modifiers):
self.sub_modifiers.extend(sub_modifiers)
def modify_vertex(self, vertex):
... | true |
64e840079ca89505e4b9a5c37401e3a0cbe2e27f | Python | calebrauscher/Python-Courses | /CraftingQualityCode/Week2/test_stock_price_summary.py | UTF-8 | 1,014 | 2.9375 | 3 | [] | no_license | import a1
import unittest
class TestStockPriceSummary(unittest.TestCase):
""" Test class for function a1.stock_price_summary. """
def test_stock_price_summary1(self):
""" Test a random list of numbers. """
self.assertEqual(a1.stock_price_summary([0.01, 0.03, -0.02, -0.14, 0,
... | true |
872100ed7867fe81a851a29451163b64cc0f1d31 | Python | essharmavi/Automate-the-boring-stuff-with-Python | /UmbrellaReminder.py | UTF-8 | 1,001 | 2.890625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import smtplib
import requests as rq
url=rq.get('https://forecast.weather.gov/MapClick.php?lat=40.71455000000003&lon=-74.00713999999994')
soup=BeautifulSoup(url.text,'html.parser')
weather= (soup.select('#current_conditions-summary p')[0]).text
temperature= (soup.select('#current_condi... | true |
1b387c5768c2b71bd32cf04ad75af6472f045ef8 | Python | aslisabanci/algo-ds | /problems/find_kth_smallest.py | UTF-8 | 1,223 | 4 | 4 | [] | no_license | from typing import Optional
def find_kth_smallest_log(items: list, k: int) -> Optional[object]:
if len(items) < k:
return None
sorted_items = sorted(items)
return sorted_items[k - 1]
def _partition(items: list, begin: int, end: int) -> int:
pivot = items[end]
i = begin - 1
for j in r... | true |
9be5150c44f38adc469520ae7b793ba18a1424ef | Python | denypradana/TelePhy | /function.py | UTF-8 | 8,775 | 2.515625 | 3 | [
"MIT"
] | permissive | from datetime import datetime
import RPi.GPIO as GPIO
import input
import output
import login
import telegram
# Menyembunyikan warning dari GPIO
GPIO.setwarnings(False)
# Inisialisasi bot telegram
bot = telegram.bot
# Fungsi untuk membaca suhu dari sensor yang ada pada modul input
def suhu():
humidity, tempe... | true |
8c8f90ea14b4fbeb8aa31ddbf8a05bf1b27e95b9 | Python | Rafa7046/SFP-Code-smells | /Start.py | UTF-8 | 1,817 | 2.765625 | 3 | [] | no_license | from interfaces.Minus_one import Finish
from interfaces.Ten import Undo_Redo
from interfaces.Nine import Create_Payment_Agenda
from interfaces.Eight import Change_Paymet_Agenda
from interfaces.Seven import Run_Payroll
from interfaces.Six import Change_Info
from interfaces.Five import Service_Fee
from interfaces.Four im... | true |
0b9e095b0929091753b37879324d2392d35b893b | Python | mgrelewicz/NAI | /05.images_classification_tensorflow_cnn_CIFAR10dataset.py | UTF-8 | 5,422 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# """
# Edyta Bartoś, Marcin Grelewicz,
# The use of Convolutional Neural Network (CNN) for images classification
#
# based on Tensorflow tutorial:
# https://www.tensorflow.org/tutorials/images/cnn
# """
# In[1]:
import tensorflow as tf
from tensorflow.keras import datasets, l... | true |
b67ee0f10b3a1fdc5b481c0bf3334a39cef28a20 | Python | justherin/NLP | /NLP.py | UTF-8 | 2,272 | 2.890625 | 3 | [] | no_license |
# coding: utf-8
# In[7]:
import urllib.request
import csv
import pandas as pd
import numpy as np
tsvin = pd.read_csv('datafile.tsv', delimiter='\t')
import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
from nltk import word_tokenize
from skl... | true |
7ca229b40d88f112c3b3aa147eef836c65236522 | Python | handaeho/lab_python | /lec06_class/class03.py | UTF-8 | 565 | 4 | 4 | [] | no_license | """
Class 연습(클래스 생성, 인스턴스 / 메소드 생성 및 사용)
"""
class Employee:
"""
Field ~> empno, ename, sal, deptno
Method ~> 급여 인상률을 받아 인상된 급여 리턴
"""
def __init__(self, empno, ename, deptno, sal):
self.empno = empno
self.ename = ename
self.deptno = deptno
self.sal = sal
def ras... | true |
527995f01817236aef6dd1cb544c11285e91f468 | Python | titansarus/AI-Projects | /Genetic Programming/code/src/DataStructure.py | UTF-8 | 11,689 | 2.828125 | 3 | [
"MIT"
] | permissive | from copy import copy
import numpy as np
from sklearn.utils.random import sample_without_replacement
from src.Fitness import FitnessCounter
from src.Function import Function
class Chromosome(object):
def __init__(self,
function_set,
arg_counts,
init_depth,
... | true |
433e0384677457ad219b95370d6ca946e26ce1ba | Python | MLDL/JointSVD | /resnet.py | UTF-8 | 13,998 | 2.546875 | 3 | [] | no_license |
'''
Author: Shaowu Chen
Paper: Joint Matrix Decomposition for Deep Convolutional Neural Networks Compression
Email: shaowu-chen@foxmail.com
Time: 2020/12/13
Describe:
Network: 'ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'
Dataset: imagenet(224x224x3)/cifar10(32x32x3)/cifar100(32x32x3)... | true |
a9ecf82989e58213f3f4e7215423c4cc8670525a | Python | AndrusovN/TaskGenerator | /generator.py | UTF-8 | 1,006 | 3.640625 | 4 | [] | no_license | import random
# Тупая генерация простого примера линейного уравнения
def generate_random():
a = random.randint(1, 10)
a1 = random.randint(2, 10)
b = random.randint(1, 10)
b1 = random.randint(2, 10)
c = random.randint(-100, 100)
c1 = random.randint(2, 10)
text = '\\frac{' + str(a... | true |
564bdd088a429e0efc223155031ed423bdf061a0 | Python | ak30274/asa-duplicate-object-discovery | /asa_duplicate_object.py | UTF-8 | 10,667 | 3.140625 | 3 | [] | no_license | '''
Name: asa_duplicate_object.py
Description: Cisco ASA Firewall Duplicate Object Detection
Requires: Python 'sys', 'datetime' and 'ciscoconfparse' libraries
Usage: asa_duplicate_object.py 'configuration_file_name' 'output_file_name'
output_file_name is an optional argument
'''
import sys
import datetime
from cisc... | true |
ba6e76fce14da5484aeb19f2025c4cc8ad5fccb1 | Python | naruto-li/lss1 | /study/随机.py | UTF-8 | 303 | 3.09375 | 3 | [] | no_license | import random
print(random.randint(1,10))
print(random.randrange(1,10))
list1=[1,2,3,4]
print(random.sample(list1,k=2))
print(random.choices(list1,k=2))
print(random.choice(list1))
random.shuffle(list1)
print(list1)
random.seed(10)
print(random.randint(1,10))
print()
random.seed(10)
| true |
3f401df6c153d8f0cef2958e8a5045fe80fecb43 | Python | kingralph33/Coding-Dojo-great_number_game | /server.py | UTF-8 | 1,279 | 3.046875 | 3 | [] | no_license | from flask import Flask, render_template, session, request, redirect
import random
import os
app = Flask(__name__)
app.secret_key = os.urandom(24)
@app.route('/')
def index():
if 'number' in session:
print(session)
print('\n')
else:
session['number'] = random.randrange(0, 101)
... | true |
ca9925969883fd7362b9cf1c915ee7ed95eb8978 | Python | Fondamenti18/fondamenti-di-programmazione | /students/1812851/homework02/program01.py | UTF-8 | 3,450 | 3.40625 | 3 | [] | no_license | '''
I post di un forum sono raccolti in alcuni file che hanno il seguente formato.
Un file contiene uno o piu' post, l'inizio di un post e' marcato da una linea che contiene
in sequenza le due sottostringhe "<POST>" ed "N" (senza virgolette) eventualmente
inframmezzate, precedute e/o seguite da 0,1 o piu' spazi.
"N"... | true |
85aeb99636e5924b6ee7fea6e0813cc3b77fc5f2 | Python | muck0120/contest | /AtCoder/ABC/153/D.py | UTF-8 | 144 | 3.296875 | 3 | [] | no_license | # D - Caracal vs Monster
H = int(input())
cnt = 0
i = 0
while True:
cnt += 2 ** i
i += 1
if H < 2 ** i:
break
print(cnt)
| true |
a95d0f35f7d384081cc74005b70477e686e54aaf | Python | SUKESH127/bitsherpa | /[13] DFS/max_level_sum.py | UTF-8 | 2,564 | 3.953125 | 4 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
#Question: https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree/
# Solution: We DFS through the tree starting from... | true |
5128a5aba62fd2c480186258096d4f38c0e564e9 | Python | rohansasmal123/continuous-testing | /login.py | UTF-8 | 3,651 | 2.515625 | 3 | [] | no_license | '''
!/usr/bin/env python
-*-coding:utf-8-*-
@author:ayanava_dutta,rohan_sasmal,shivam_gupta
'''
import streamlit as st
import pandas as pd
import numpy as np
import os
def login():
cred_path='/root/caascript/res/'
img_path='/root/caascript/res/bg/'
server_list=['AWS-US','AWS-EU','AWS-Gold']
cre... | true |
c0fd2fef875b77acf8db228291362302696e712f | Python | Ocnarf2070/BuddyfightLifeCounter | /View/PrincipalView.py | UTF-8 | 2,045 | 2.921875 | 3 | [] | no_license | from tkinter import *
from tkinter.font import Font
from Controller import Controller
from Model import Game
from View import PlayerFrameView
from View import RecordView
class PrincipalView:
def __init__(self, master: Frame, model: Game):
self.model = model
master.columnconfigure(0, weight=1)
... | true |
759570ad10a92d0c73a0d20a4eafa813054111b9 | Python | yanxing66/Synthesizer | /dsplab_project_final.py | UTF-8 | 14,611 | 2.890625 | 3 | [] | no_license | '''
author: Yan Xing, Ruijing Wang
finish time: 12/16/2020
subject: DJ KEYBOARD
'''
import logging
import threading
import time
import wave
import pyaudio
import struct
import tkinter as Tk
from math import sin, pi, cos
from collections import deque
from PIL import Image,ImageTk
#-------------------------------------... | true |
4e46c9755cb84211364299691225994b4351e1d4 | Python | mshaneck/cryptopals | /challenge31-server.py | UTF-8 | 1,221 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
import web
import time
from hashing import *
from Crypto.Random import random
urls = (
'/test', 'test'
)
class test:
hmacKey = random.choice(open("/usr/share/dict/words").readlines()).rstrip()
def GET(self):
user_data = web.input()
#web.internalerror(self)
... | true |
13785bcd2a1fb399caf8016e1a476759df2d35c7 | Python | ValdZX/PythonRepository | /PZ4.py | UTF-8 | 3,719 | 3.296875 | 3 | [] | no_license | def mul2(x):
return x * 2
def map_yield(func, arr):
it = iter(arr)
for i in it:
yield func(i)
def test_map_rek():
assert map_yield(mul2, (1, 2, 3)) == [2, 4, 6]
assert map_yield(str, (1, 2, 3)) == ["1", "2", "3"]
print "Test map_rek passed OK!"
def is_positive(num):
return num ... | true |
334e97d102155e7bed39be412a5d4c0ce848f2b9 | Python | zqf123/CaiXuKun | /test3.py | UTF-8 | 2,155 | 3.4375 | 3 | [] | no_license | import time
import sys
import matplotlib.pyplot as plt
import numpy as np
sys.setrecursionlimit(100000000)
def sort(lst):
sortHelper(lst,0,len(lst)-1)
def sortHelper(lst,low,high):
if low < high:
indexOfMin = low
min = lst[low]
for i in range(low+1,high+1):
if lst[i] < min:
... | true |
84e55d1b81b7ec17d20aa1014c7bccc9bfca5320 | Python | EnHaHB/EDA_US_bank_wages | /US_bank_wages_model.py | UTF-8 | 2,814 | 2.859375 | 3 | [
"MIT"
] | permissive | ## import libraries
import pandas as pd
import statsmodels.api as sm
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
import pickle
# read data
wages = pd.read_table("us_bank_wages/us_bank_wages.txt", header=0,index_col=0)
wages.columns = [c.lower() for c in wages.co... | true |
8e8cb35e04232cf99a8ea52fdeaaba728b0fa445 | Python | tbourg/perso | /S1/Algo/dessin.py | UTF-8 | 549 | 3.015625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from turtle import *
clear()
speed(0)
colormode(255)
r=13
v=13
b=13
compteurTour=1
rayon=200
ht()
def arc(rayon):
left(60)
for i in range(1,4):
circle(rayon,120)
left(120)
right(60)
up()
goto(0,-200)
down()
circle(200)
while rayon>=0:
for a in range(0,36):
if 0<=compteurTour<=120:
... | true |
212082d9c6e8152dbd2cdb312c705b9655de3865 | Python | jakjan95/DTsolver | /tests/tree_leaf_test.py | UTF-8 | 1,053 | 3.109375 | 3 | [] | no_license | from unittest import TestCase
from src.tree_leaf import TreeLeafGeneric
class TreeLeafGenericTest(TestCase):
def setUp(self):
self.leaf_with_numeric_data = TreeLeafGeneric('Numeric feature', {'>=0':5, '<0':1}, 0, 1, True)
self.leaf_without_numeric_data = TreeLeafGeneric('Feature', {'A':5, 'B':1}, 0... | true |
0f8acc244de73932b163b4c26637add8853d416d | Python | Loading-dot-dot-dot/Python-doodles | /web.py | UTF-8 | 300 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
"""Web version 1.4
Python 3.7.2"""
import webbrowser
def web_site(site_name):
"""website"""
site_name = input('Type site name: ')
url = f'http://www.{site}.com'
webbrowser.open(url)
if __name__ == "__main__":
web_site('site_name')
| true |
3f3b9981450a2035af327e64c8accf29a26e46e6 | Python | awslabs/syne-tune | /syne_tune/backend/time_keeper.py | UTF-8 | 2,360 | 2.765625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | true |
a7cc39b0ee5dda3b7bb43cba055be7cf36da6491 | Python | TinoLiu7/PyCharm_Course | /Py27Lab/step12_pandas/lab85_pandas2.py | UTF-8 | 367 | 2.78125 | 3 | [] | no_license | #encoding=UTF-8
import pandas
data1 = pandas.read_csv('.\\data\\data2_utf8.csv')
print data1.head()
print data1.columns
print data1.info()
data1Grouped = data1[['處分字號','違反勞動基準法條款','違反法規內容']].\
groupby(['違反勞動基準法條款']).count()
print data1Grouped.head()
data1Grouped.sort_values('處分字號', ascending=False) | true |
68da3c74aaa7ae8327883647a31feadae6b80272 | Python | RolandSherwin/project-euler-solutions | /Python_Solutions/utils/matrix.py | UTF-8 | 6,288 | 3.34375 | 3 | [] | no_license | import numpy as np
class MatrixTraversal():
def __init__(self, grid, look_ahead, wrap_around=False):
self.grid = grid
self.look_ahead = look_ahead
self.wrap_around = wrap_around
def cannot_go_up(self, index, look_ahead=None):
if look_ahead is None:
look_ahead = sel... | true |
713f1305357a97de90ec3392705389bb4311c090 | Python | cardel/graphicsNetworkEvolu | /500/graficacolor.py | UTF-8 | 6,603 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import numpy as np
plt.rc('xtick',labelsize=6)
plt.rc('ytick',labelsize=6)
#Caso SWHD
#Iteracion
x = np.array([1... | true |
6ac0c7ed812635da99c431c6d2a7a1785bd4daf1 | Python | teslinroys/fiction_profiling | /splitfiles_sent.py | UTF-8 | 1,554 | 2.8125 | 3 | [] | no_license | # Sentence-level based file splitter
# Teslin Roys
import os
import pprint
import nltk
nltk.download('punkt')
def chunks(lst, n):
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(lst), n):
yield lst[i:i + n]
def clump(lst, n):
return list(chunks(lst,n))
def clump_sentenc... | true |
4182b459ee1da66e069297a0364f8379f0c38551 | Python | AK-1121/code_extraction | /python/python_27313.py | UTF-8 | 96 | 2.6875 | 3 | [] | no_license | # Get mutplie values from a dict at once
a, b, c = map(the_dict.get,("a","b","c"))
print(a,b,c)
| true |
9b212a6bae57e22b3082b0520d0572cd5356a60a | Python | claySorrick/randomDecision | /random_fetcher.py | UTF-8 | 592 | 2.765625 | 3 | [] | no_license | from jsonrpcclient.http_client import HTTPClient
class Random_Client(HTTPClient):
def __init__(self, endpoint='https://api.random.org/json-rpc/1/invoke'):
HTTPClient.__init__(self, endpoint)
def get_numbers(self, n=333, min=0, max=9):
params = {
"apiKey": "0e4a2072-e36... | true |
824299d22fcd8ef257210afc59365bf410510bd7 | Python | pviafore/AdventOfCode2020 | /challenge21.py | UTF-8 | 2,548 | 3.1875 | 3 | [
"MIT"
] | permissive | import operator
from dataclasses import dataclass
from functools import reduce
import common.input_data as input_data
@dataclass
class Meal:
ingredients: set[str]
allergens: set[str]
def get_number_of_ingredients_matching(self, ingredients: set[str]) -> int:
return len(ingredients & self.ingredie... | true |