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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e69172b7b1718cc0041ee79f3b23f5c683dcec27 | Python | APS-XSD-OPT-Group/wavepytools | /wavepytools/diag/coherence/load_2_pickles_results.py | UTF-8 | 1,359 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*- #
"""
Created on %(date)s
@author: %(username)s
"""
# %%% imports cell
import numpy as np
import matplotlib.pyplot as plt
import wavepy.utils as wpu
# %%
import pickle
def _load_data_from_pickle(fname):
fig = pickle.load(open(fname, 'rb'))
fig.set_size_inches((12, 9), forward=Tru... | true |
968888e10f5c992546f539957d92723eb89a464b | Python | textbook/aoc-2020 | /day04/impl.py | UTF-8 | 4,852 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
from os.path import dirname
import re
from textwrap import dedent
import unittest
VALID_EYE_COLOURS = ("amb", "blu", "brn", "gry", "grn", "hzl", "oth")
def valid_year(min_, max_):
def valid(s):
return re.match(r"^\d{4}$", s) is not None and min_ <= int(s) <= max_
return valid
... | true |
97cdb186e97561a54929f112cb3ea1e4d4ab43e3 | Python | charliestrawn/thundersnow | /thundersnow/api/weeks.py | UTF-8 | 867 | 2.546875 | 3 | [] | no_license | import datetime
from flask import Blueprint, jsonify, request
from thundersnow import db
from thundersnow.utils import login_required
from thundersnow.models import Week
weeks_blueprint = Blueprint('weeks', __name__)
@weeks_blueprint.route('/weeks', methods=['GET', 'POST'])
@login_required
def api_weeks():
""... | true |
3764472f80ffa878f7fe3c8e576d79fb88ad4a6f | Python | EduardDek/ML-lvl-0-Homeworks | /week 5/ICe Cream Parlor.py | UTF-8 | 507 | 3.515625 | 4 | [] | no_license | t = int(input("how many times?"))
for i in range(0,t):
found = False
money = int(input("money="))
CostSize = int(input("Cost size="))
cost = []
for j in range (0,CostSize):
cost.append(int(input("Cost")))
for e in range (0,len(cost)):
for c in range(e+1,len(cost)):
... | true |
30978f6039713cabdc91d71fd13a4789219a1939 | Python | BrianBock/ENPM809T | /HW9/openmotors.py | UTF-8 | 353 | 2.5625 | 3 | [] | no_license |
import RPi.GPIO as gpio
def init():
gpio.setmode(gpio.BOARD)
gpio.setup(31,gpio.OUT)
gpio.setup(33,gpio.OUT)
gpio.setup(35,gpio.OUT)
gpio.setup(37,gpio.OUT)
gpio.setup(36,gpio.OUT)
def gameover():
gpio.output(31,False)
gpio.output(33,False)
gpio.output(35,False)
gpio.output(37,False)
gpio.output(36,False)
... | true |
917f20d35009e13cb3a3fcd6853508c3707a77e2 | Python | hkdeman/FunScripts | /FacebookRepeatedMessages.py | UTF-8 | 591 | 2.6875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
username = ""
password = ""
directory = ""
link = ""
driver = webdriver.Chrome(directory)
driver.get(link)
emailElement = driver.find_element_by_id('email')
emailElement.send_keys(username)
passElement = driver.f... | true |
8e6fbf88f556db362f6edb37a9bf406a4561ce02 | Python | TalhaAsmal/machine-trading | /statistical_analysis.py | UTF-8 | 2,255 | 2.96875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
from os import path
import datetime
import numpy as np
from common import data_dir, get_bollinger_bands, plot_data, get_daily_returns
def bollinger_bands(df):
ax = df.plot(title="SPY rolling mean", label='SPY')
rm_spy = df['SPY'].rolling(center=False, windo... | true |
a3fb715cb80ced8ca6a584c967a15b26d3ec690f | Python | lulu03/TestCourses | /unittest_hw0604/run.py | UTF-8 | 1,343 | 3.359375 | 3 | [] | no_license | '''
新建一个run.py入口
'''
import unittest
from utils.HTMLTestRunner import HTMLTestRunner
# 1. 去查找testcase模块下面的所有的testcase开头的 .py 文件结束的py文件
# ./testcase:run.py所对应的相对路径
# testcase*.py:所有满足这个一个表达式的 py 文件
testcases = unittest.defaultTestLoader.discover("./testcases", "testcase*.py")
# 2. 把所有测试用例装载到测试集里面
testsuites = unitt... | true |
43624fc958980bb689122edea073d91307775d64 | Python | yruss972/opencontrol-linter | /vendor/schemas/transformation-scripts/utils.py | UTF-8 | 485 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | """ These are shared functions between v2_to_v1 and v1_to_v2 """
def add_if_exists(new_data, old_data, field):
""" Adds the field to the new data if it exists in the old data """
if field in old_data:
new_data[field] = old_data.get(field)
def transport_usable_data(new_data, old_data):
""" Adds th... | true |
3ac4d9947703d532cf321fb2ec6682415ef83a9e | Python | hckmd/week7-lecture-demos | /parameters/app.py | UTF-8 | 1,502 | 3.21875 | 3 | [] | no_license | from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
# Code to setup the connection to a database (more details on this later in the lecture)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///animals.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAl... | true |
110175361a94dcfb1be3ac80ca8b67c707ea72ec | Python | Tsgzj/CS6200 | /HW3/src/page.py | UTF-8 | 4,224 | 2.734375 | 3 | [
"MIT"
] | permissive | from lxml import etree
from urlparse import urlparse, urljoin
from readability.readability import Document
import re
import validators
import json
from sets import Set
# import urllib2 #used for test
class Page:
def __init__(self, url = None, header = None, body = None, inlinks = None, fetched = False):
se... | true |
d8da2fbc13cc3f1920c678cb9316f93b1958a95d | Python | GustavoVargasHakim/Naive-Bayes-Book-Classification | /Python trials/CommonWordsBusiness | UTF-8 | 3,611 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 27 19:11:05 2019
@author: Clemente + Gustavo
"""
import nltk
import string
from nltk.corpus import stopwords
from nltk.tokenize import RegexpTokenizer
import fileinput
import glob
import csv
#Funcion para unir listas
def join(lista) :
union = ... | true |
6f0ba16cff9f6c346303191729be4bbd1c0e5889 | Python | koren-v/SocialMediaClassification | /Neural Nets/utils_for_dl.py | UTF-8 | 7,675 | 2.625 | 3 | [] | no_license | import torch
from torchtext import data
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchtext
from torch.autograd import Variable
from torch.optim import lr_scheduler
import time
import copy
import numpy as np
def test(model, criterion, optimizer, test_iterator, batch_size,... | true |
435ff50bc55ff7e6a6c1f99c6e34a6d9b5da0700 | Python | Qiguanyi/Coursera-Data-Structures-and-Algorithms-Specialization | /Part II - Data Structures/week2_priority_queues_and_disjoint_sets/3_merging_tables/merging_tables.py | UTF-8 | 2,093 | 2.84375 | 3 | [] | no_license | # python3
import sys
#class Database:
# def __init__(self, row_counts):
# self.row_counts = row_counts
# self.max_row_count = max(row_counts)
# n_tables = len(row_counts)
# self.ranks = [1] * n_tables
# self.parents = list(range(n_tables))
#
# def merge(self, src, dst):
# ... | true |
9fb15012951ab0b5e7707019e27e70f8ebc6b4d0 | Python | harriscw/advent_of_code_2020 | /day17/part1.py | UTF-8 | 2,283 | 3.5625 | 4 | [] | no_license | import sys
import numpy as np
from collections import Counter
###
# Data wrangling
###
#Read data
text_file = open("input.txt", "r")
lines = text_file.readlines()
mylist=[]
for i in range(len(lines)):
mylist.append(list(lines[i].strip("\n")))
print(np.array(mylist)) #print as array for formatting
#get coords in... | true |
45184f8a65bac1ac4166d1153b212682722bd591 | Python | hewg2008/DeepBindRG | /python.py | UTF-8 | 295 | 2.5625 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
import pandas as pd
# the random data
#f=open('out.csv', 'r')
#arr=f.readlines()
df=pd.read_csv('out.csv', sep = ' ',header = None)
x = df.iloc[:,0].values
y = df.iloc[:,1].values
print x
print y
| true |
206893a35a7a782d9cde7457c5d02ef297bb0a8f | Python | sarvex/composer | /composer/algorithms/colout/colout.py | UTF-8 | 13,822 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
"""Core ColOut classes and functions."""
from __future__ import annotations
import logging
import textwrap
import weakref
from typing import Any, Callable, Tuple, TypeVar, Union
import torch
import torch.utils.data
from PIL.Image impor... | true |
2e977066495d3861258edb19acc7a0290f1f814a | Python | fanliu1991/LeetCodeProblems | /93_Restore_IP_Addresses.py | UTF-8 | 2,298 | 3.578125 | 4 | [] | no_license | '''
Given a string containing only digits,
restore it by returning all possible valid IP address combinations.
Example:
Input: "25525511135"
Output: ["255.255.11.135", "255.255.111.35"]
'''
import sys, optparse, os
class Solution(object):
def restoreIpAddresses(self, s):
"""
:type s: str
... | true |
f3d3639d3bd8352cf160b99b7feaeb7356b7488f | Python | CaueVieira/curso | /Cap 4/Exercício 4.5.py | UTF-8 | 472 | 4.03125 | 4 | [] | no_license | """Escreva um programa que pergunte a distância que um passageiro deseja percorrer em km. Calcule o preço da passagem, cobrando R$ 0,50 por km
para viagens de até 200 km e R$ 0,45 para vigens mais longas"""
print ("Calculadora de preços com base em Kms percorridos em viagem")
kms = float(input("Informe distância em K... | true |
ec81b2316981f9dccbe5db2a4857c8901e530d39 | Python | kellystroh/regression-tools | /regression_tools/dftransformers.py | UTF-8 | 4,072 | 3.140625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler as SS
from sklearn.base import BaseEstimator, TransformerMixin
class ColumnSelector(BaseEstimator, TransformerMixin):
"""Transformer that selects a column in a numpy array or DataFrame
by index or name.
"""
def __i... | true |
983837142b953c52fb9ca39ee10da18cb6014ff1 | Python | jackh423/python | /CIS41B/SqLite3/Delete.py | UTF-8 | 1,001 | 3.75 | 4 | [
"Apache-2.0"
] | permissive | '''
To convert this delete code to be a member function of a class:
1. The sqliteConnection should be a data member of the class and already connected
2. The function should take a string parameter for the delete query
3. It should return 'true' if deleted, otherwise 'false'
'''
import sqlite3
def deleteR... | true |
8b8163d7268ba5130500a986c55f43d7e2199b1b | Python | saarraz/fakebook | /model.py | UTF-8 | 11,512 | 2.578125 | 3 | [] | no_license | import abc
import random
import time
from typing import Optional, List, Union
import os
from PIL import Image as PILImage
import datetime
next_id = 0
IMAGE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'images')
class Node(object):
__metaclass__ = abc.ABCMeta
classes = []
@staticmetho... | true |
3fa4b66a67446dd6e2e21c7beb7f5b161e8db7db | Python | gabriellaec/desoft-analise-exercicios | /backup/user_213/ch47_2019_04_02_23_09_30_567932.py | UTF-8 | 145 | 2.96875 | 3 | [] | no_license | mes=int(input('qual o n do mes? ')
meses=['jan','fev','mar','abr','maio','jun','jul','ago','set','out','nov','dez']
print (meses[mes-1])
| true |
21064a1765d577574e2d836bd97507fa05c20ecd | Python | tdworowy/PythonPlayground | /Playground/other_staff/prime_number_staff.py | UTF-8 | 311 | 3.1875 | 3 | [] | no_license | from math import sqrt
from itertools import islice, count
def is_prime(n):
return n > 1 and all(n % i for i in islice(count(2), int(sqrt(n) - 1)))
if __name__ == "__main__":
for x in range(1, 1000000):
y = (x ** 2) + x + 41
if not is_prime(y):
print(x)
break
| true |
e037b0a5538c965fdc0697f57d0f5dfe172272b9 | Python | alexandraback/datacollection | /solutions_5630113748090880_0/Python/Kenchy/prob2.py | UTF-8 | 668 | 3.078125 | 3 | [] | no_license | __author__ = 'ligenjian'
if __name__ == '__main__':
input = open('input.txt', 'r')
output = open('output.txt', 'w')
t = int(input.readline())
for i in range(t):
total_number = {}
n = int(input.readline())
for line in range(2 * n - 1):
numbers = map(int, input.readlin... | true |
5caf567f6737e12fe80246366a42396d1c79a338 | Python | mcmoralesr/Learning.Python | /Code.Forces/P0334A_Candy_Bags.py | UTF-8 | 377 | 2.8125 | 3 | [] | no_license | __copyright__ = ''
__author__ = 'Son-Huy TRAN'
__email__ = "sonhuytran@gmail.com"
__doc__ = 'http://codeforces.com/problemset/problem/334/A'
__version__ = '1.0'
n = int(input())
n2 = n * n + 1
ndiv2 = n // 2
for i in range(1, n + 1):
first = list(range(ndiv2 * (i - 1) + 1, ndiv2 * i + 1))
last = [n2 - k for k... | true |
ed659d5c9581ec4a813ad6fe455b0e6f50ea4e18 | Python | Halldor-Hrafn/PythonShenanigans | /Forrit41.py | UTF-8 | 283 | 3.46875 | 3 | [] | no_license | file = open('nofn2.txt')
longName = []
fourName = []
for line in file:
word = line.strip()
if len(word) >= 30:
longName.append(word)
if word.count(' ') >= 3:
fourName.append(word)
print(longName)
print('******************************')
print(fourName)
| true |
19a62541a9286f1b7cd4f34978c5ac3a40465589 | Python | a-valado/python | /Práctica 5/Práctica 5.7.py | UTF-8 | 244 | 3.796875 | 4 | [] | no_license | #Albert Valado Pujol
#Práctica 5 - Ejercicio 7
#Escribe un programa que pida la altura de un triángulo y lo dibuje de
#la siguiente manera:
altura=int(input("Introduce la altura del triángulo.\n"))
for i in range(altura,0, -1):
print("*"*i)
input(" ")
| true |
c7ce636459e8f3f64aa5011efb05623d6a4c4b35 | Python | EvanNingduoZhao/learning_while_recording | /plotly_study/plotly_experiment.py | UTF-8 | 808 | 2.640625 | 3 | [] | no_license | import plotly as py
import plotly.graph_objs as go
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
orders = pd.read_excel('/Users/apple/PycharmProjects/qtm385/plotly_study/sales.xls')
with pd.option_context('display.max_rows', 10, 'display.max_columns', 10): # more options can be specified als... | true |
5974d0a73444a83c7221a083835cc637c3bf95f1 | Python | offero/algs | /dcp629_kpartitions.py | UTF-8 | 1,155 | 4.0625 | 4 | [] | no_license | '''
# Definition
Given an array of numbers N and an integer k, your task is to split N into k partitions such that
the maximum sum of any partition is minimized. Return this sum.
For example, given N = [5, 1, 2, 7, 3, 4] and k = 3, you should return 8, since the optimal
partition is [5, 1, 2], [7], [3, 4].
# Solutio... | true |
d410f9eca0d23ab27405aa84259534c240e5a5a3 | Python | chewlite/selenium-project | /python-mod/exercise8.py | UTF-8 | 549 | 2.515625 | 3 | [] | no_license | import pytest
from selenium import webdriver
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
request.addfinalizer(wd.quit)
return wd
def test_sticker_on_product(driver):
driver.get("http://localhost/litecart/")
box_list = driver.find_elements_by_class_name('box')
for box in box_... | true |
3e3903ee9c3fb016be6574c994a7ee6528b96e4e | Python | achiyae/repository_mining | /paper/graphics/ttest/ttest.py | UTF-8 | 1,808 | 2.671875 | 3 | [] | no_license | import os
from itertools import product
import pandas as pd
from scipy.stats import ttest_ind
from config import Config
path = Config.get_work_dir_path(os.path.join("paper", "graphics", "scores", "data.csv"))
data = pd.read_csv(path)
columns = [
'Feature Selection',
'Score',
'Dataset 1',
'Dataset 2'... | true |
04cc192a41d4bd977540730956b0c0850d0edaa0 | Python | louiselessel/Shaders-on-raspberry-pi4 | /Ex_Pixelize/run_shader_Pixelize.py | UTF-8 | 4,261 | 2.6875 | 3 | [] | no_license | import time
import demo
import pi3d
#(W, H) = (None, None) # Fullscreen - None should fill the screen (there are unresolved edge issues)
(W, H) = (400, 400) # Windowed
# For scale, make sure the numbers are divisible to the resolution with no remainders (use even numbers between 0 and 1). 1.0 is full non-scaled resolu... | true |
1faaa9939a70a2c663cb276c1d86096152571d88 | Python | dwiberg4/num_meth | /mullers.py | UTF-8 | 1,962 | 3.90625 | 4 | [] | no_license | # Root Finding Method
# Open Method
# Muller's Method
import numpy as np
# Define the main Muller's Method Function
def mullers(x0,x1,x2,es,imax):
itera = 0
ea = es
while (ea >= es) and (itera < imax):
itera += 1
# Muller's Method
h0 = x1-x0
h1 = x2-x1
d0 = (f(x1)... | true |
5d16e3cf3ddd8d92bdf252d16f722120d00b30f4 | Python | RifatTauwab/Python | /swap_char.py | UTF-8 | 377 | 3.96875 | 4 | [] | no_license | def swap_char(sentance):
sentance = list(sentance)
for i in range(len(sentance)):
if sentance[i].isalpha():
if ord(sentance[i])<91:
sentance[i] = chr(ord(sentance[i])+32)
else:
sentance[i] = chr(ord(sentance[i])-32)
... | true |
f93177bfc864210176f46d3d1e9bb5566169526c | Python | moeyashi/practice-python-eel | /hello.py | UTF-8 | 563 | 2.640625 | 3 | [] | no_license | from __future__ import print_function # For Py2/3 compatibility
import eel
import random
# Set web files folder
eel.init('web')
@eel.expose
def py_random():
return random.random()
@eel.expose
def py_list():
return [1, 2, "3", "4"]
@eel.expose
def py_dict():
return {
"1": "hoge",
"a": "fu... | true |
da47d88f3a0c95e3b988d2cc675b4a394dfd2379 | Python | HaojieSHI98/HouseExpo | /pseudoslam/envs/simulator/util.py | UTF-8 | 4,076 | 3.1875 | 3 | [
"MIT"
] | permissive | import numpy as np
def transform_coord(y_coordMat, x_coordMat, rotationCenter, transformVect):
""" Transform x-y coordinate (y_mat & x_mat) by transformVect | round to int | return rotated y & x coord as vector"""
""" y_mat and x_mat are the coord to be rotated | rotationCenter [y;x] or [y;x;phi] are the cent... | true |
4dc278cafd5a5fb84a0dd43b2c19501f1afcc399 | Python | menonf/PythonProjects | /MachineLearning/LinearAlgorithms/LinearRegression/LeastSquares.py | UTF-8 | 1,175 | 3.546875 | 4 | [] | no_license | from csv import reader
def load_csv(filename):
dataset = list()
with open(filename, 'r') as file:
csv_reader = reader(file)
for row in csv_reader:
if not row:
continue
dataset.append(row)
return dataset
# Convert string column to float
d... | true |
740c4a60d8773b862dcb4e1ddc563a908d4003c6 | Python | hasnatnayeem/hackerrank_solutions | /python/06_itertools/combinations-with-replacement.py | UTF-8 | 296 | 3.515625 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/itertools-combinations-with-replacement
from itertools import combinations_with_replacement
text, length = input().split()
length = int(length)
ans = [''.join(sorted(x)) for x in combinations_with_replacement(text, length)]
print('\n'.join(sorted(ans)))
| true |
be67f242d26db44eb6a29456455ab1b785dbbd4c | Python | chasingegg/Data_Science | /Python/stock_sold/data.py | UTF-8 | 3,293 | 3.140625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# Author: Chao Gao
# manipulating data
import xlrd
import xlsxwriter
data = xlrd.open_workbook(u"test.xlsx")
#得到两张表
table_sold = data.sheet_by_name(u'销售结算单')
table_stock = data.sheet_by_name(u'进货结算单')
#获取行数和列数
sold_rows = table_sold.nrows
sold_cols = table_sold.ncols
#其实有多少列肯定是一样的,... | true |
c50ab308262a4f7bb32e7350f69f223b673a7a22 | Python | faberikaneko/Intern | /ImageSuggestion/ImageSuggestion/ScoringClass.py | UTF-8 | 5,975 | 2.78125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import sys
import codecs
import csv
import sqlite3
#External import package to check Unicode parameter
import regex as re
#External import package to check encoding of file
import chardet
from chardet.universaldetector import UniversalDetector
#External import package to Morphological Analysi... | true |
4b3e852d1e555b0b7f19971ac1ab7573506703db | Python | AmaniAlshami/100DaysOfCodePython | /Day17-Tuples2.py | UTF-8 | 385 | 3.640625 | 4 | [] | no_license | color = tuple(("Red","Green","Yellow","Red"))
fruits = ('Apple','Banana','Orange')
Number= (1,2,3)
Number = Number + (4,5,6)
def check(fruits):
fruit = input("Enter fruti name : ")
if fruit in fruits :
print("Yes")
else:
print("No")
print(color[:1])
print(color.count("Red"))
check(fruits... | true |
e8e9d4c6a1b1705196095a49943251833731cf9a | Python | henrik-leisdon/Bachelor_Thesis_stochastic_computing | /04_image_processing/04_entropy_frame/entropy.py | UTF-8 | 4,991 | 2.90625 | 3 | [] | no_license | import math
import random
import numpy as np
from PIL import Image, ImageOps
import matplotlib.pyplot as plt
from skimage.filters.rank import entropy
from skimage.morphology import disk
def save_img(img_mat, img_name, img_num):
result = Image.fromarray(img_mat)
r = result.convert("L")
r.save(str(img_nam... | true |
5b5772dfdf572d9f0124d880054588515760d41d | Python | usersubsetscan/autoencoder_anomaly_subset | /visualization/detectionpower.py | UTF-8 | 1,718 | 2.609375 | 3 | [] | no_license | """ Detection power visualization """
import os
import argparse
from sklearn import metrics
import numpy as np
import matplotlib.pyplot as plt
from util.resultparser import ResultParser, ResultSelector
def plot(cleanscores, anomscores):
""" plot and calculate the detection power """
resultselector = Res... | true |
2329815fb4f750790bdb115055eda9f78ac9dc0b | Python | arevalolance/advent-of-code | /python/2015/day7/solve.py | UTF-8 | 548 | 3.203125 | 3 | [] | no_license | import fileinput
import math
print(123 & 456)
print(123 | 456)
print('left',123 << 2)
print('right',456 >> 2)
print(~123)
print(~456)
gates = dict()
def solve(q):
if 'AND' in q:
return q[0] and q[2]
elif 'OR' in q:
return q[0] and q[2]
elif 'LSHIFT' in q:
return q[0] << q[2]
el... | true |
cf75ea3972664f9e333be8e48a97d5c7b5c03da9 | Python | m0baxter/hephe-article | /images/plotOneP.py | UTF-8 | 2,770 | 2.609375 | 3 | [] | no_license |
import matplotlib
matplotlib.use('PS')
import matplotlib.pyplot as plt
#plot parameter things:
lbl_size = 24
lgd_size = 20
mrks = 9
lw = 3
fontsize = 24
matplotlib.rcParams.update({'font.size': fontsize, 'text.usetex': True, "ps.usedistiller" : "xpdf"})
def readData(path):
xs = []
ys = []
with open( p... | true |
121f58c90ab2a0d2bf005af4da83612042381d78 | Python | prayer1/Python_from_entry_to_practice | /ch7/counting.py | UTF-8 | 189 | 3.4375 | 3 | [] | no_license | current_number = 1
while current_number <= 5:
print(current_number)
current_number += 1
message = ""
while message != 'quit':
message = input("enter a str:")
print(message) | true |
fa47b3ccbaa70bc386e0c9e09d47e3b83c216415 | Python | liqiwa/python_work | /5/5.3/aline_color.py | UTF-8 | 989 | 3.921875 | 4 | [
"Apache-2.0"
] | permissive | alien_color = 'black'
if 'green' in alien_color:
print("you are right is green,and you get 5 point!")
if 'black' in alien_color:
print("you are right is black,and you get 5 point !")
if alien_color == 'green':
print('you get 5 point')
elif alien_color =='black':
print("you get 10 point")
elif alien_color =='red':
... | true |
6bec313d23a5a910b7f7e252921121c3bc1385f0 | Python | MissNeerajSharma/Text-Classification-using-TextBlob | /analysis2.py | UTF-8 | 3,545 | 2.78125 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
# get_ipython().run_line_magic('matplotlib', 'inline')
# import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# In[2]:
fruits = pd.read_table(r'C:\Users\akasriva2\Music\Analysis\fruit_data.txt')
fruits.head()
# In[3]:
print(fruits['fruit_name'... | true |
46c5be1f70d2a24bfc6d7b113a5842a2daffcde8 | Python | alexwestside/parser_bitcoins | /parser_bitcoins.py | UTF-8 | 3,560 | 3.25 | 3 | [] | no_license | import requests
import json
import re
import csv
from decimal import Decimal
top = 20 # Count of top coins that need to collect in dataset
coins_list = []
api_coins = 'https://www.cryptocompare.com/api/data/coinlist/' # Exemple of api request that given data of all coins wich we will range by parametr SortOrder
curr... | true |
a7e36de0a0f90363d0a15fe7838002d2a919e6c0 | Python | aduxhi/learnpython | /Class/class_learn.py | UTF-8 | 2,309 | 4.1875 | 4 | [] | no_license | '''
类(class):用来描述具有相同属性和方法的集合
方法:类中定义的函数
类变量:类变量在整个实例化的对象中是公用的。类变量定义在类中且在函数体之外。类变量通常不作为实例变量使用。
实例变量:在类的声名中,属性是用变量来表示的。这种变量就称为实例变量。是在类声明的内部但是在类的其他成员方法之外声明。
数据成员:类变量或者实例变量用于处理类及其实例对象的相关的数据。
实例化:创建一个类的实例,类的具体对象。
对象:通过类定义的数据结构实例。对象包括两个数据成员(类变量和实例变量)和方法。
'''
'''
class MyClass:
i = 12345
def f(self):
return "he... | true |
cc53d25ec9012395e834b0cd50b181e46210b7ce | Python | Chirag-v09/Python | /OpenCV/template bounding box.py | UTF-8 | 3,071 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 3 16:32:23 2020
@author: Chirag
"""
import cv2
method = cv2.TM_SQDIFF_NORMED
# Read the images from the file
small_image = cv2.imread('mahindra.jpg')
large_image = cv2.imread('mahindra small.jpg')
result = cv2.matchTemplate(large_image, small_image, ... | true |
b1d837c50e146e285485f9ce34170bbe83ccc4d3 | Python | django/django | /tests/db_functions/text/test_reverse.py | UTF-8 | 2,372 | 2.5625 | 3 | [
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"GPL-1.0-or-later",
"Python-2.0.1",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-other-permissive",
"Python-2.0"
] | permissive | from django.db import connection
from django.db.models import CharField, Value
from django.db.models.functions import Length, Reverse, Trim
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class ReverseTests(TestCase):
@classmethod
def setUpTestData(c... | true |
773c5919bd394d59e7b86dabb33a8c956c04d418 | Python | EmilHernvall/projecteuler | /12.py | UTF-8 | 428 | 3.265625 | 3 | [] | no_license | import math
t = 0
j = 0
maxCount = 0
while True:
t += j
i = 2
n = t
factorCount = 0
max = n
while i <= max:
if n % i == 0:
max = n / i
factorCount += 2
i = i + 1
if n > 0 and math.floor(math.sqrt(n))**2 == n:
factorCount += 1
if factorCount >= 500:
print "Found: " + str(t)
break
if factorC... | true |
52106d6fbed41b27b31f07d89a6fb2f2c39e2e32 | Python | yubowenok/vision-zero | /hourly_segments/aggregate.py | UTF-8 | 8,654 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# Process the generated speed files and aggregate the speeds based on
# street, hour, time of day, etc.
import sys, datetime, re
import road_network, sign_installation, speed_limit
import argparse
supported_bin_attrs = [
'segment',
'day_of_month',
'time_of_day',
'day_of_week',
'is_we... | true |
b3aa402f821ebe0778bc5fd92da032bb37bc703d | Python | wangcho2k/confidence_intervals | /get_scores.py | UTF-8 | 7,973 | 2.578125 | 3 | [] | no_license | import argparse
import logging
import sys
from collections import OrderedDict
from my_pycocoevalcap.bleu.bleu import Bleu
from my_pycocoevalcap.rouge.rouge import Rouge
from my_pycocoevalcap.cider.cider import Cider
from my_pycocoevalcap.meteor.meteor import Meteor
from my_pycocoevalcap.tokenizer.ptbtokenizer import PT... | true |
9e0bd84bef9b6795af293c27c91fc9dd80f5a6c2 | Python | SudeepS97/Daily-Market-Report | /market_report.py | UTF-8 | 2,486 | 2.625 | 3 | [] | no_license | import os
import argparse
import pandas as pd
import datetime as dt
from config.inputs import stocks
from utils.market_data_puller import get_stock_data, calc_market_stats
from utils.plotter import get_plot_price_movement, save_plot_as_image
from utils.reporter import Reporter
import dataframe_image as dfi
import warni... | true |
47f0bd6cfe4a9e447b6706c717885db496d4d618 | Python | leehoawki/HyperShells | /timestamp.py | UTF-8 | 609 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python3
import argparse
import time
from _datetime import datetime
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='timestamp command')
parser.add_argument('-a', help="e.g. timestamp -a 1420000000000")
parser.add_argument('-b', help="e.g. timestamp -b 20141231122640")
... | true |
dbe0655d11a83ddfd6cbe3943cac42378df738b6 | Python | binchen15/leet-python | /interview/prob150.py | UTF-8 | 605 | 3.078125 | 3 | [] | no_license | class Solution:
def evalRPN(self, tokens: List[str]) -> int:
def eval(a, b, op):
if op == "+":
return a + b
elif op == "-":
return a - b
elif op == "*":
return a * b
else:
return int(a / ... | true |
70049e959a107a9ca2ad3358723e8eb2ea3ad1f8 | Python | PaddlePaddle/PARL | /benchmark/torch/coma/sc2_model.py | UTF-8 | 3,727 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2020 PaddlePaddle Authors. 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | true |
d36934cc623a396f13e0e1a5724e87ad6a59d6fd | Python | psc040922/presika | /A.IOP.py | UTF-8 | 142,016 | 2.640625 | 3 | [] | no_license | import discord
import openpyxl
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print('*DB Online*')
print("Client Name= " + "'" + client.user.name + "'")
print("Client ID= " + "'" + client.user.id + "'")
print('---LOG---')
await client.change_presence... | true |
ef9c8ce7e52f7ccbac0a11111f7d8472e55144bb | Python | Thomas-Rice/mindmap | /Integration_Tests/Int_Add_Leaf.py | UTF-8 | 1,730 | 2.546875 | 3 | [] | no_license | import unittest
from app import *
class IntegrationAddLeaf(unittest.TestCase):
def setup_test(self):
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.sqlite3'
app.config['TESTING'] = True
client = app.test_client()
db.drop_all()
db.create_all()
return clie... | true |
8bb879045c6b00d4d7370a87e2e9a5c9479ba41f | Python | pymee/studygroup | /1st/code/ono/omikuji_6_for.py | UTF-8 | 902 | 3.828125 | 4 | [] | no_license | # coding: utf-8
import random
# 運勢_1 =全体運,運勢_2 =仕事運
fortune = [{'運勢_1':'運勢は大吉! すべてよし。 ','運勢_2':'仕事運は、全て上手くいく'},
{'運勢_1':'運勢は中吉! まぁまぁよし。 ','運勢_2':'仕事運は、努力すれば実る'},
{'運勢_1':'運勢は吉! よし。 ','運勢_2':'仕事運は、なかなか実らず'},
{'運勢_1':'運勢は凶! わるし。 ','運勢_2':'仕事運は、全てが上手くいかず'}]
# 運勢1の中からランダムで選択
unsei_1 = random.choice([x['運勢_1'] fo... | true |
2e3489e4d121fd6b799eb91949842970875fe6ee | Python | amajal/Aoc2017 | /App20.py | UTF-8 | 2,431 | 3.4375 | 3 | [] | no_license | import functools
def convert_particle_string_to_coordinates(particle_string):
coordinate_string = particle_string.split('<')[-1]
return list(map(int, coordinate_string.split(',')))
def increment_properties():
for particle in particles:
for i in range(0, 3):
particle['v'][i] += particl... | true |
3e2a27511bab0b4cf4737b1925cb457d65b21584 | Python | CommanderPho/pyPhoPlaceCellAnalysis | /src/pyphoplacecellanalysis/GUI/Qt/Unused/CustomGridLayout.py | UTF-8 | 1,864 | 3.09375 | 3 | [
"MIT"
] | permissive | from qtpy import QtWidgets, QtCore
class CustomGridLayout(QtWidgets.QVBoxLayout):
""" A replacement for QGridLayout that allows insert/deletion of rows into the layout at runtime to overcome the issue of being unable to set it
https://stackoverflow.com/questions/42084879/how-to-insert-qwidgets-in-the-middle-of... | true |
16eb99033431fe22037d89e1d9c67de01216851d | Python | Moejay10/FYS4150 | /Project4/Codes/plotter.py | UTF-8 | 9,631 | 2.78125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import os
print("Which Project Task do you want to run")
print("Task C - Equilibrium State: Write c")
print("Task D - Probability Histogram: Write d")
print("Task E & F - Phase Transitions & Critical Temperature: Write e")
Task = input("Write here: ")
tablesdir = os.p... | true |
a29be6d8169147b125c6e42b5b6a5d4f12e7251a | Python | xyb/gmail-backup | /dobackup.py | UTF-8 | 3,188 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import email
import getpass
import imaplib
import os
import re
import time
from fix import fix_large_duplication, get_message_ctime, update_file_mtime, \
write_hash_data
LAST_ID_FILE = 'last_fetched_id.dat'
UID_RE = re.compile(r"\d+\s+\(UID (\d+)\)$")
FILE_RE = re.co... | true |
ab87313d3f964c3a2678bb1f6e90f8ad26f1dcb6 | Python | Ciuel/Python-Grupo12 | /Trabajo_Final/src/Event_Handlers/config.py | UTF-8 | 4,421 | 2.765625 | 3 | [
"MIT"
] | permissive | import PySimpleGUI as sg
import json
import os
from ..Components import menu
from ..Event_Handlers.Theme_browser import choose_theme
from ..Constants.constants import USER_JSON_PATH,BUTTON_SOUND_PATH,vlc_play_sound
def build_initial_config(nick:str)->dict:
"""Se busca la configuracion del usuario que inicia sesion... | true |
79c0ba1f8071c42d3797f6440212a45f6c3398c5 | Python | elaeon/dama_ml | /src/dama/data/web.py | UTF-8 | 537 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | import tqdm
class HttpDataset(object):
def __init__(self, url, sess=None):
self.url = url
self.sess = sess
def download(self, filepath, chunksize):
response = self.sess.get(self.url)
with open(filepath, "wb") as f:
for chunk in tqdm.tqdm(response.iter_content(chunks... | true |
c57a513c1f8a0bb8f4c463aed4ab0f7dc945c7be | Python | AldenJurling/jwxml | /jwxml.py | UTF-8 | 33,322 | 2.734375 | 3 | [
"BSD-2-Clause"
] | permissive | """
jwxml: Various Python classes for parsing JWST-related information in XML files
* SUR: a segment update request file (mirror move command from the WAS to the MCS)
* Update: a single mirror update inside of a SUR
* SIAF: a SIAF file (Science Instrument Aperture File, listing the defined apertures for a given instru... | true |
533752739b1cbf4d440aa785fa3ceab1a368adc4 | Python | duncanlindsey/GoogleCodeJam2018 | /trouble.py | UTF-8 | 3,193 | 3.109375 | 3 | [] | no_license | import sys
from random import randint
sample_input = ['2',
'5',
'5 6 8 4 3',
'3',
'8 9 7']
def solve(V):
list_1 = V[::2]
list_1.sort()
list_2 = V[1::2]
list_2.sort()
error = False
error_i = None
for i in rang... | true |
1ff6d952b6315e8bf04a9ac394a183c9590316ae | Python | kevwill79/Python | /Learning Python/LearnPythonTheHardWay/Exercises/ex25.py | UTF-8 | 1,488 | 4.875 | 5 | [] | no_license | #More function practice
def break_words(stuff):
""""This function will break up words for us."""
words = stuff.split(' ')
return words
#Used str.lower so all words would be lowercase before sorting
def sort_words(words):
"""Sorts the words."""
return sorted(words, key=str.lower)
def p... | true |
22fa581bed33e20c75074d106eea1d9e2e9fd0ca | Python | salildabholkar/Machine-Learning | /code/knn.py | UTF-8 | 1,017 | 2.875 | 3 | [
"MIT"
] | permissive | from collections import Counter
import numpy as np
from utils.helpers import euclidean_distance
from utils.CommonSetup import CommonSetup
class KNN(CommonSetup):
def __init__(self, k=5):
self.k = k # l[:None] returns the whole list
def get_most_common(self, neighbors_targets):
return Count... | true |
cae6fd3840d58f917df6478edd2e268ea0fc7a2f | Python | shirsho-12/MathVisuals | /mult table.py | UTF-8 | 250 | 3.90625 | 4 | [] | no_license |
x = int(input("Enter number: "))
y = int(input("Enter number of multiples: "))
for i in range(1, y+1):
print('{0} x {1} = {2}'.format(x, i, x*i))
from fractions import Fraction
a, b = map(Fraction, input().split())
print(a+b, a*b, a-b, a/b) | true |
5b310f1c196d746f685dabb7b1ec908cbd682571 | Python | Aasthaengg/IBMdataset | /Python_codes/p03000/s923238339.py | UTF-8 | 141 | 2.84375 | 3 | [] | no_license | n, x = map(int, input().split())
cnt = 1
now = 0
for l in map(int, input().split()):
now += l
if now > x:
break
cnt += 1
print(cnt) | true |
c415ff4b9303309d9fc30cde892cd4aec9c9120e | Python | thiagoborba/py-easy-rest | /py_easy_rest/caches/memory.py | UTF-8 | 961 | 2.625 | 3 | [] | no_license | from datetime import datetime, timedelta
from py_easy_rest.caches import Cache
class MemoryCache(Cache):
def __init__(self, initial_data={}, initial_expire_data={}):
self._data = initial_data
self._when_data_expire = initial_expire_data
async def get(self, key):
value = self._data.g... | true |
8bf859c41bfbd9f5433f12dca994f6154ec98e28 | Python | yinccc/leetcodeEveryDay | /BubbleSort.py | UTF-8 | 852 | 3.796875 | 4 | [] | no_license | def BubbleSort(nums):
length=len(nums)
if length<=1:
return nums
for i in range(length):
for j in range(length-i-1):
if nums[j]>nums[j + 1]:
nums[j], nums[j + 1]= nums[j + 1], nums[j]
return nums
#Time O(n2)
#Space O(1)
arr=[9,8,7,6,5,4,3,2,1]
print(BubbleSort... | true |
05b3efb522fc6ffc6860492acfc689418499d70f | Python | tungct/chatbot-accountant | /src/cosine_test.py | UTF-8 | 992 | 2.640625 | 3 | [] | no_license | import sys
sys.path.insert(0, '../../')
sys.path.insert(0, '../')
sys.path.insert(0, '.')
from src.cs import CS
from src.greeting_utils import Greeting
import random
if __name__ == '__main__':
cs = CS(threshold=0.45)
X, y = cs.data_utils.sent_tokens, cs.data_utils.labels
cs_greeting = CS(threshold=0.45)
... | true |
5642132c53b146bdd0a829e823f6633624a4c77f | Python | anebz/ctci | /01. Arrays and strings/hackerrank/reduce_to_palindrome.py | UTF-8 | 663 | 4.0625 | 4 | [] | no_license | # Algorithms > Strings > The Love-Letter Mystery
# https://www.hackerrank.com/challenges/the-love-letter-mystery
import unittest
def theLoveLetterMystery(s):
if len(s) == 1:
return 0
count = 0
for i in range(len(s)//2):
count += abs(ord(s[i]) - ord(s[-1-i]))
return count
cl... | true |
95977b8fe3b66e547a9bf9a32aaef4fbe618b213 | Python | zeroryuki/mysolatcli | /mysolatcli/__init__.py | UTF-8 | 1,784 | 2.5625 | 3 | [] | no_license | """
A wrapper around the api.azanpro.com
"""
import requests,time
import requests_cache
from datetime import datetime,timedelta
def secondsinday():
time_delta = datetime.combine(
datetime.now().date() + timedelta(days=1), datetime.strptime("0000", "%H%M").time()
) - datetime.now()
return time_delta... | true |
5a10fd259854d4f0d2ccd13891fbd02526db65d4 | Python | ELW4156/W4156 | /lecture_code/object_relational_mapping/orm/ormservice.py | UTF-8 | 1,731 | 2.875 | 3 | [] | no_license | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask import jsonify
from sqlalchemy.sql import exists
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://' # memory
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
db.create_all()
class User(db.Model)... | true |
d8546dc19899c00b0175ffe7a292c337936a20ce | Python | Python3pkg/PyDataset | /pydataset/support.py | UTF-8 | 1,381 | 3.1875 | 3 | [
"MIT"
] | permissive |
from difflib import SequenceMatcher as SM
from collections import Counter
from .locate_datasets import __items_dict
DATASET_IDS = list(__items_dict().keys())
ERROR = ('Not valid dataset name and no similar found! '
'Try: data() to see available.')
def similarity(w1, w2, threshold=0.5):
"""compare two ... | true |
951ca941b1789bec15bc3c78abc47ffe9695d842 | Python | Sobeit-Tim/BigDataProject | /postproc.py | UTF-8 | 576 | 3.140625 | 3 | [] | no_license |
file = open("result.txt", "r")
res = file.read()
file.close()
print("pagerank result, (value, vertex)")
print(res)
res = res.split('\n')
keywords = []
for i in res:
if not i:
continue
temp = i.replace(')', ',').split(',')[1]
keywords.append(temp)
vocab = {}
file = open("vocab.txt", "r")
res2 = f... | true |
e9c4c195fa72f876a8bedb77c7c958c79f405384 | Python | xk97/repo | /test.py | UTF-8 | 25,047 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 21 20:06:32 2018
@author: ccai
"""
import numpy as np
hour = ["%02d:00" % i for i in range(0, 24, 3)]
day = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
features = day + hour
"{Mon}, {Tue}".format(**{_: i+1 for i, _ in enumerate(day)})
x = l... | true |
457a57727f0f1c8077232ffc4543ffc26d1fde8b | Python | arunmastermind/AWS-examples-using-BOTO3 | /translate/TranslateText.py | UTF-8 | 399 | 2.671875 | 3 | [] | no_license | import boto3
translate = boto3.client('translate')
result = translate.translate_text(Text="Hello, World",
SourceLanguageCode="en",
TargetLanguageCode="de")
print(f'TranslatedText: {result["TranslatedText"]}')
print(f'SourceLanguageCode: {result["Sourc... | true |
95afff888030cea1bf855c5d34bcd1392b7d6064 | Python | EvanGrandfield1/BeerMe | /beer_advocate_scraper_v2.py | UTF-8 | 2,205 | 2.890625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup as soup
import pandas as pd
import itertools
url = "https://www.beeradvocate.com/beer/styles/"
# Deal with empty cells
def replaceBlank(x):
if x == '':
return 0
else:
return x
# create a new Chro... | true |
ceb1c5a84446af6bf0f2a285c9dde213633813d0 | Python | AgnesMartinez/Huachilate-tools | /core.py | UTF-8 | 6,100 | 2.9375 | 3 | [] | no_license | import time
import sqlite3
import operator
import random
import string
class HuachiNet():
"""Huachicol as a service
---------------------------------
Requiere nombre de usuario para obtener la siguiente informacion:
-Saldo total
-Historial de movimientos (Global,Depositos,Retiros)
El usuario p... | true |
29898ae7ff96a7a73d44190e20d5e236222564e4 | Python | bpcrao/my-python-learnings | /IterTools.py | UTF-8 | 142 | 2.984375 | 3 | [] | no_license | from itertools import accumulate, takewhile
lista = list(accumulate(range(10)))
print(lista)
print(list(takewhile(lambda x: x < 10, lista))) | true |
69aeb66a233800d0e5848f25279c8b61d9a02aca | Python | Aasthaengg/IBMdataset | /Python_codes/p02831/s564333677.py | UTF-8 | 91 | 3.015625 | 3 | [] | no_license | a,b=map(int,input().split())
def g(x,y):
while y: x,y=y,x%y
return x
print(a*b//g(a,b)) | true |
190f77c910cea0ed83973dee0f65632168afd685 | Python | mgrose31/cn2_forecast | /create_dataset.py | UTF-8 | 9,686 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 30 17:27:10 2020
@author: mgrose
"""
# %% import libraries
import os
import pandas as pd
import numpy as np
from helpers import read_davis_weather, extract_DELTA_summary_data_single_dir
from helpers import window_average
import matplotlib.pyplot as plt
from d... | true |
46e1b18d2a574770896bae6e10f7440a8ee554fb | Python | Schokokex/reverseEngineeringPython | /Classes/Type.py | UTF-8 | 731 | 2.890625 | 3 | [] | no_license | import Wrapper_Descriptor
import Object
class Type:
__init__ = Wrapper_Descriptor()
def __init__(self, object_or_name: str, bases: tuple, dict: dict):
# TypeError: type() takes 1 or 3 arguments
pass
# TypeError: type.__new__() argument 1 must be str, not int
# TypeError: type.__new__() argument 2 must be tup... | true |
2508e7af7fc201ad67f0910a11965cd65eea5fce | Python | asad1996172/Obfuscation-Systems | /Style Nueralization PAN16/AuthorObfuscation/AuthorObfuscation/Evaluation/pos_measures.py | UTF-8 | 989 | 2.6875 | 3 | [] | no_license | import text_utils
from Evaluation import POSTagging as pt
def pos_ratio(text):
if text:
word_count = text_utils.word_count(text)
pos_tagged = pt.pos_tag(text)
noun_count = 0
verb_count = 0
adj_count = 0
adv_count = 0
punctuation_count = 0
for tagged_word in pos_tagge... | true |
08ad0c3f0830f527916442b451783228330eeb4a | Python | liangguang/20180910 | /pythoncode/catchImg/catchYoumeiyu.py | UTF-8 | 5,616 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import requests, traceback
import re,threading
import os,time,random
from bs4 import BeautifulSoup
headers = {
'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Mobile Safari/537.36'
}
def getHTML... | true |
4a7d2c24889bd94b3f13d42f02a3aa2c748cf2dd | Python | ashomah/ie_pandas | /tests/mixed/df.get_row()/test_input_mixed_in_dict_of_np_get_row.py | UTF-8 | 2,807 | 2.890625 | 3 | [] | no_license | from ie_pandas import DataFrame
import pytest
import numpy as np
def test_input_mixed_in_dict_of_np_get_row_by_index():
obj = {
"age": np.array([30.1, 53.1, 31.1, 47.1, 32.1]),
"albums": np.array([4, 10, 2, 5, 4]),
"C": np.array(["a", "b", "c", "d", "e"]),
"D": np.array([True, Fals... | true |
968a5fadb3b5521ae4b4c2de6194c5a2930c3b59 | Python | edfan/Project-Euler | /1.py | UTF-8 | 261 | 3.28125 | 3 | [] | no_license | numbers = []
result = []
top = 999
while top > 0:
numbers.append(top)
top -= 1
numbers.sort()
for n in numbers:
if n % 3 == 0:
result.append(n)
elif n % 5 == 0:
result.append(n)
print (sum(result))
| true |
a7efed60faa4c34ddb2b83e9da6635fe4d510c56 | Python | ug-kim/algorithms | /DFS_BFS/3_word_conversion.py | UTF-8 | 746 | 3.140625 | 3 | [] | no_license | from collections import deque
def solution(begin, target, words):
queue = deque()
bfs_dict = dict()
def trans_available_func(a, b): return sum(
(1 if x != y else 0) for x, y in zip(a, b)) == 1
bfs_dict[begin] = set(
filter(lambda x: trans_available_func(begin, x), words))
for wo... | true |
fce66c737a23c069bf8a504c8e13e5c2621ce296 | Python | kopecmartin/grains-recognition | /main.py | UTF-8 | 2,348 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
File: main.py
Authors: Martin Kopec <xkopec42@gmail.com>
Maros Kopec <xkopec44@vutbr.cz>
Patrik Segedy <xseged00@vutbr.cz>
Tomas Sykora <xsykor25>
"""
from AABBlib import detection
from AABBlib import threshold
import argparse
import csv
import cv2
def parse_args... | true |
8b3da76da79180378978f34b806cc944b49818b6 | Python | olimpiadi-informatica/oii | /2018/territoriali-remastered/scommessa/managers/generator.py | UTF-8 | 1,199 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf8 -*-
from limits import MAXN
from sys import argv, exit, stderr
import os
from random import random, randint, choice, sample, shuffle, seed
usage = """Generatore di "oddcycle".
Parametri:
* S - seed
* 0 - il valore zero, molto importanteh!!!!
"""
def run(N, mode):
print... | true |
b245fac5c5fefc13308fa523b5b6f56ee93aa30e | Python | AllStars04/Dawood | /Commands/verifyResults.py | UTF-8 | 3,008 | 2.578125 | 3 | [] | no_license | import Module.getObject
import Module.logger
import Module.Algorithms
import Module.Utility
import Class.Automation
import Module.CleanUp
import Module.Report
import Class.UserDefinedException
import Class.SeleniumBrowser
import re
import time
from datetime import datetime
from dateutil.relativedelta import relativedel... | true |
5af8f43fa973ac836b18df8f9625c541b1ed13c9 | Python | hsjfans/machine_learning | /machine_learning/base.py | UTF-8 | 585 | 2.578125 | 3 | [
"MIT"
] | permissive | class BaseEstimator:
"""The base class for all estimators.
"""
def get_params(self):
"""
return: the params of model
"""
pass
def set_params(self):
"""
"""
pass
class ClassifierMixin:
"""Mixin class for all classifiers
"""
_... | true |