blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
21bac28de43ad701ce618d2bb4db1375376377ea | rakeshpati1722/sample | /simple_python_pro.py | UTF-8 | 47 | 2.734375 | 3 | [] | no_license | a = 10
b = 20
sum = 10+20
print(sum) | true |
9b97f4c56b8203cda381387489ebd250806ffce3 | VishwakarmaKomal/My-Python-programs | /listcomprehensionexample.py | UTF-8 | 846 | 3.515625 | 4 | [] | no_license | #format of list comprehension
#list_using_comp = [var for var in input_list if var % 2 == 0]
x=1
y=1
z=2
n=3
i=0
j=0
k=0
inputlist=[]
for i in range(x+1):
for j in range(y+1):
for k in range(z+1):
a=[]
a.append(i)
a.append(j)
a.append(k)
... | true |
12ccfcc0949f7221a91184ce544eeec403b4bc34 | Paulcappaert/zero-divisor_semigroup | /zdg/semigroup.py | UTF-8 | 2,686 | 3 | 3 | [] | no_license | from .mod_math import ModularCounter
def inverse_set(a, b, pm, elements):
'''
returns: set of values z such that az = b is a possible mapping
'''
inv = set()
for z in elements:
if b in pm[frozenset({a, z})]:
inv.add(z)
return inv
def get_assoc_maps(pm, elements):
'''
... | true |
68750daf1464ca20e5df22d416c144b45cdfd616 | chyylq/leetcode | /004_median_of_two_sorted_arrays/sol.py | UTF-8 | 5,647 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 19 16:41:52 2017
logic:
each time throw front or back # records in each array based on 2 medians
# records is ~ half of the smaller array
still keeps median or median decision elements -- central neighbors of an even array
discuss when the smaller array has 0,1,2 elements... | true |
02b6c4f9ff56da7672a41971a640d7986759bdb5 | Kiruen/kiruen_funbox | /funalgo/python/other1.py | UTF-8 | 4,532 | 3.3125 | 3 | [] | no_license | from collections import deque
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
# Definition for a binary tree node.
class TreeNode:
def __init__(se... | true |
8906549bc81497c40449a2f8333fec789ede4c56 | raymond234/redi | /lesson_6_oop/l600_full.py | UTF-8 | 20,369 | 3.984375 | 4 | [
"MIT"
] | permissive | import calendar
from collections import namedtuple
from datetime import date
from math import floor
from typing import Set
class Address:
def __init__(self, street: str, number: int, postal_code: int, city: str):
self.street = street
self.number = number
self.postal_code = postal_code
... | true |
dcca9cfcbede0f24b6ce809e4987be4ac40fb773 | jmhogan/singleLepAnalyzer | /utils.py | UTF-8 | 6,632 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python
import os,sys,math,string
from ROOT import *
def isEqual(a, b):
try:
return a.upper() == b.upper()
except AttributeError:
return a == b
def contains(a, b):
try:
return b.upper() in a.upper()
except AttributeError:
return b in a
def cleanEOSpath(path)... | true |
06a046a046be03a836bb8767ba61dcd310c09a90 | luisb/find_eng_lang_ALTO | /find_eng.py | UTF-8 | 1,066 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python
import sys
if len(sys.argv) == 1:
print "FATAL: " + __file__ + " expects to be passed one or more files."
print "usage: " + __file__ + " file [file]..."
sys.exit()
import lxml.etree as ET
from StringIO import StringIO
for File in sys.argv:
if File == __file__:
continue
# if language == 'en... | true |
a28be6791414f145f83edf327b94db7170bfd4ff | amarufd/duckiego | /exercises/distance_to_object_shared.py | UTF-8 | 1,396 | 2.828125 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
def find_centroid_lines(img):
hsv_img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
lower_yellow = np.array([20,100,100])
upper_yellow = np.array([30,255,255])
mask = cv2.inRange(hsv_img, lower_yellow, upper_yellow)
kernel = np.ones((5,5), np.uint8)
mask_erosion = cv2.erode(mask, ke... | true |
58e55a97dbca96361076280f8954b6614fa21718 | keigo-brook/RaspberryPiProjects | /7291p/7291test.py | UTF-8 | 1,529 | 3.109375 | 3 | [] | no_license | import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
class MoterDriver:
"""docstring for 7291p"""
def __init__(self, in1, in2):
GPIO.setup(in1, GPIO.OUT)
GPIO.setup(in2, GPIO.OUT)
self.in1 = in1
self.in2 = in2
def stop(self):
GPIO.output(self.in1, False)
... | true |
3d449278b93b661ad2fc05676afa5c431c7a8d3a | ronw/frontend | /tests/test_sources.py | UTF-8 | 1,601 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import os
import unittest
import numpy as np
from numpy.testing import *
import sources
TEST_DATA_DIR = os.path.join(os.path.dirname(sources.__file__), 'test_data')
class TestAudioSource(unittest.TestCase):
def _test_audio_source(self, filename, length, channels):
samples = source... | true |
d078f4396e4d15c4f0c4ebc095ef5ff5e4dc3286 | OMYJO/BPNeuralNetwork | /src/module/Tokenizer.py | UTF-8 | 4,026 | 2.78125 | 3 | [] | no_license | class TokenizerV0(object):
def __init__(self, max_len: int, vocab_file, cls_token=None, sep_token=None):
self.max_len = max_len
self.vocab = []
with open(vocab_file, 'r', encoding="utf-8") as f:
for line in f:
if line:
self.vocab.append(line.st... | true |
55184b39c685d10ebc560e3ef78f0704ef05d8d6 | JanekLehr/SlackPoll | /tests/test_pollingMachine.py | UTF-8 | 2,984 | 2.578125 | 3 | [] | no_license | from unittest import TestCase
from Poll import PollingMachine, Poll
__author__ = 'James Royal'
class TestPollingMachine(TestCase):
def test_create_poll_no_other_poll(self):
pm = PollingMachine()
poll = pm.create_poll("James", "#jamestestchannel", "Test topic", {"option1": 0, "option2": 0})
... | true |
98dd8b69256b5938862d17017064307c8d24692a | LyingCortex/HFSS | /Python-HFSS-API/Design/Create.py | UTF-8 | 10,117 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 1 20:25:51 2017
@author: LY
func list:
CreateBox
CreateRectangle
CreateArcSector
CreateCircle
CreateCylinder
CreatePolyline
CreateRelativeCS
"""
'''
create the box boject
name: the box name you want to named
... | true |
4a93e2e1120a02bfd311ab6bafb7d51c24073396 | uradora/ohtu-2021 | /viikko3/web-login-robot/src/services/user_service.py | UTF-8 | 1,934 | 3.21875 | 3 | [] | no_license | from entities.user import User
from repositories.user_repository import (
user_repository as default_user_repository
)
import re
import sys
class UserInputError(Exception):
pass
class AuthenticationError(Exception):
pass
class UserService:
def __init__(self, user_repository=default_user_repository)... | true |
5be3f83a7c2509854080bba6a926901a5143e079 | cofinley/Proj_Eul | /Problem #09.py | UTF-8 | 234 | 3.375 | 3 | [] | no_license | for i in xrange(1,500):
for j in xrange(1,500):
for k in xrange(1, 500):
if ((((i**2)+(j**2)) == (k**2)) and (i+j+k == 1000)):
print i, j, k, "product = %d" % (i*j*k)
else: continue
| true |
27371910d8b23cf4bf8ccce157be201ee790ab6f | SLACE93/PhytonProject_V2.0 | /PythonProject_V2.0/src/state.py | UTF-8 | 774 | 3.25 | 3 | [] | no_license | class State(object):
def __init__(self):
pass
def enter(self):
pass
def exit(self):
pass
def reason(self):
pass
def act(self):
pass
class StateMachine(object):
def __init__(self, host, first_state=None):
self.host = host
... | true |
8b6922a9473747e947a82fab4aea2355aa3817ec | BlurryFa/time-series-forecasting | /ann_fitting.py | UTF-8 | 3,133 | 2.796875 | 3 | [] | no_license | import numpy as np
from pandas import Series
from data_reading import data_reading
from data_preprocessing import *
from data_evaluating import sMAPE, MSE
import math
from season_decomposition import de_seasonality
from keras.layers import Dense
from keras.models import Sequential
from keras.utils import plot_model
fro... | true |
8d37f87d01860051b73d1dee44873a1943b830b4 | sepherro/reidentification | /main.py | UTF-8 | 4,597 | 2.671875 | 3 | [] | no_license | import cv2
import numpy as np
import glob
import winsound
import time
template_listoffiles = []
test_listoffiles = []
topleft_coords = [0, 0]
# predefined sizes of cutout window you can cycle through [width, height]
cutout_sizes = [[20, 40], [40, 80], [60, 120], [80, 160], [100, 200], [120, 240]]
cutout_size_idx = 0
... | true |
8f664edb2f8db18242347ba55aa16e3de425235d | tomogwen/ffneuralnet | /ffnn2.py | UTF-8 | 2,328 | 2.75 | 3 | [] | no_license |
import numpy as np
import matplotlib.pyplot as plt
x = np.array([ [1, 1, 1, 1, 1, 1, 0], # 0
[0, 1, 1, 0, 0, 0, 0], # 1
[1, 1, 0, 1, 1, 0, 1], # 2
[1, 1, 1, 1, 0, 0, 1], # 3
[0, 1, 1, 0, 0, 1, 1], # 4
[1, 0, 1, 1, 0, 1, 1], # 5
... | true |
c0304d11653c1952d6a6048d35a3796ab4327f4f | wsh231314/IntelligentOperation | /sikuli/StuffContainer/testScripts/testApp/testParameter.sikuli/testParameter.py | UTF-8 | 497 | 3 | 3 | [] | no_license | # chrome to open a given webpage
cmd = r'"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://sikulix.com'
# using an App instance
bc = App(cmd)
print bc
if not bc.isRunning():
bc.open()
wait(3)
bc.close()
# reusing the App instance but changing open parameters
bc.setUsing("http://sikulix.com/quicks... | true |
c5974e955f5f49f2e9416841bcfca78b1c2597ed | sohag95/pythonProjects | /snake game/main.py | UTF-8 | 1,561 | 3.09375 | 3 | [] | no_license | from turtle import Screen
from random import randint
import time
from food import Food
screen=Screen()
screen.setup(width=600,height=600)
screen.bgcolor("black")
screen.title("Snake Game")
from snake import Snake
from scoreboard import Scoreboard
snake=Snake()
food=Food()
scoreboard=Scoreboard()
scree... | true |
1be80218b523c2dd4638f2317a7fd59caeaa9bd0 | salceson/geometria | /project/triangles.py | UTF-8 | 3,400 | 3.078125 | 3 | [] | no_license | # coding=utf-8
from basic.mixins import OperatorMixin
from basic.orient import orient
from gui.primitives import Polygon
__author__ = 'Michał Ciołczyk, Michał Janczykowski'
def edge_of_neighbor(neighbor):
return neighbor[0]
def triangle_of_neighbor(neighbor):
return neighbor[1]
class Triangle(object):
... | true |
b95c3dda6f6c0d8fa516d0f3f86a091c58fa5835 | platinum2015/python2015 | /cas/information_retrieval/mini_retrieve_0512.py | ISO-8859-1 | 8,633 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
# coding=iso-8859-1
import sys
import os
import os.path
import re
import collections
import math
import operator
import platform
from nltk.stem.porter import *
from nltk.tokenize import TweetTokenizer
'''
DF DOCUMENT FREQUENCIES:
<Term_1,count>
<Term_n,... | true |
58d4cb1abf00172bf1f877874f3dcf5ce0967c2a | send2manoo/Deep-Learning | /deprecated/Keras/ANN/prerequisites/data_preprocessing.py | UTF-8 | 1,092 | 3.25 | 3 | [] | no_license | #Importing libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#Read dataset
dataset = pd.read_csv('customerhire.csv')
x = dataset.iloc[:, :-1].values
y = dataset.iloc[:,3].values
print x
print '\n'
print y
#Missing Values
from sklearn.preprocessing import Imputer
imputer = Imputer (mi... | true |
6f21eff4d486678dcb387e8ea7a57da2f0efb7f7 | IvanKurkov/PythonAlgorithms | /1 Введение в Алгоритмизацию/Побитовый сдвиг.py | UTF-8 | 686 | 4.03125 | 4 | [] | no_license | a = 5
b = 6
print(b & a)
print(b | a)
print(b ^ a)
print(~a)
print(a >> 2)
print(a << 2)
###################
# 2. Выполнить логические побитовые операции «И», «ИЛИ» и др. над числами 5 и 6.
# Выполнить над числом 5 побитовый сдвиг вправо и влево на два знака.
# Объяснить полученный результат.
bit_and = 5 & 6
bit_o... | true |
4199e1dff697f9269dd275498b4b8b90e343dfaf | Azure/azure-sdk-for-python | /sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_translations_async.py | UTF-8 | 2,137 | 2.65625 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT",
"LGPL-2.1-or-later"
] | permissive | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""
FILE: list_translations_async.py
DESCRIPTION:
This sample demonstrates how to list all the submitted translation operations for the resource.
To set up yo... | true |
7f5f47c387c0656a3fb14336958e2116069a67c9 | junhong-CHEON/flask_study | /04-ORM/models/Student.py | UTF-8 | 1,351 | 2.59375 | 3 | [] | no_license | from flask_sqlalchemy import SQLAlchemy
from sqlalchemy_serializer import SerializerMixin
db = SQLAlchemy()
# 클래스 선언시 괄호 안에 들어 가는 내용은 해당 기능을 그대로 상속 받겠다는 의미
class Student(db.Model, SerializerMixin):
__tablename__ = 'student'
studno = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Col... | true |
5f4deefc4722cd16306a7da85f7bc64e1dca376e | Usmaneeyy/Covid-Stats | /reader.py | UTF-8 | 166 | 2.953125 | 3 | [] | no_license | import csv
with open("another-pakistan.csv", 'r') as file:
csv_file = csv.DictReader(file)
for row in csv_file:
print(type(row['date']))
break | true |
978a4b636327c4b592f6078a48783d4beaece1e1 | SwitchCase/Problem_Solutions | /Project Euler/21_amicable_pairs.py | UTF-8 | 711 | 2.859375 | 3 | [] | no_license | import numpy
mp=numpy.zeros(10005,int);
def preprocess():
mx=0
for x in range(1,10000):
sum=0;
i=1;
while (i*i<=x):
if x%i==0:
sum+=i;
if int(x/i) !=i and int(x/i)!=x:
sum+=int(x/i);
i=i+1 ... | true |
d0a34cfdc819c502216733154c02491920253706 | JettPhillips/WeekofOct7 | /Stuff.py | UTF-8 | 2,126 | 4.3125 | 4 | [] | no_license | x = "There are %d types of people." % 10
binary = "binary"
doNot = "don't"
y = "Those who know %s and those who %s." % (binary, doNot)
print(x)
print(y)
print("I said: %r" % x)
print("I also said: '%s'." % y)
hilarious = True
joke_evaluation = "Isn't that joke so funny?! %r"
print(joke_evaluation % hilarious)
w = "... | true |
34fb6b9c4bd3007ad4f80f5d654e50dd6dd22b68 | TatyanaSavtsova/LearnQA_PythonAPI | /ex6_long_redirect.py | UTF-8 | 218 | 2.515625 | 3 | [] | no_license | import requests
response = requests.get("https://playground.learnqa.ru/api/long_redirect")
print(f"Количество редиректов - {len(response.history)}")
print("Конечный URL - " + response.url) | true |
89fa3e637e8c6ff5504ee594244900c0905a8cb1 | baidongbin/python | /疯狂Python讲义/codes/02/2.6/combining_logic_test.py | UTF-8 | 208 | 2.796875 | 3 | [] | no_license | bookName = "疯狂Python"
price = 79
version = "正式版"
if bookName.endswith('Python') and (price < 50 or version == "正式版"):
print("打算购买这本Python图书")
else:
print("不购买!")
| true |
b84820a71a53db1f2dcc7e2740f4f59d9901ffd3 | sgriffith3/pyapi-2020-08-17 | /complex_data_structs.py | UTF-8 | 309 | 3.734375 | 4 | [] | no_license | import pprint
pets = {"cats": [{"name": "garfield", "age": 7, "colors": ["orange", "brown"]}, {"name": "snowball", "age": 2, "colors": ["white"]}]}
# garfield is orange and brown
print(f'{pets["cats"][0]["name"]} is {pets["cats"][0]["colors"][0]} and {pets["cats"][0]["colors"][1]}.')
pprint.pprint(pets)
| true |
19d02b4a9b412736f40f08f2b213cc440f414780 | 0hhanum/SeleniumAutoBot | /responsive.py | UTF-8 | 1,576 | 3.1875 | 3 | [] | no_license | import time
from math import ceil
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import os
"""
웹사이트의 화면을 가로 사이즈 별로 스크롤하며 모두 스크린샷 하는 코드
"""
class ResponsiveTester:
def __init__(self, urls):
self.urls = urls
self.browser = webdriver.Chrome(ChromeDriverManage... | true |
9fd35e6a1b6e9f097c07780f049500d00da6888e | PerlinWarp/NeuroLeap | /dual_data_gather.py | UTF-8 | 2,969 | 2.78125 | 3 | [] | no_license | # Gather data from 2 seperate Myos
import time
import multiprocessing
import pandas as pd
import blue_myo
from myo_raw import MyoRaw
file_name = "dual_emg.csv"
PLOT = True
# For BlueMyo
mac1 = "de:36:7a:87:63:be" # First Bought, Right 117 237 250 237 175 59 235 118 222
mac2 = "c2:19:f0:35:28:5d" # Second Bought, Le... | true |
a65aae40340722624f31c18ce9682befe1613a1b | boldijar/python-labs | /lab4-6/DeleteAllApartamentBillsPanel.py | UTF-8 | 1,299 | 2.734375 | 3 | [] | no_license | import wx
from apartament_controller import ApartamentController
from validator import IntValidator
class DeleteAllApartamentBillsPanel(wx.Panel):
def __init__(self,parent,apartamentController,position,size):
super(DeleteAllApartamentBillsPanel,self).__init__(parent,pos=position,size=size)
self.ap... | true |
c09803087c25b11da80806c6c7b1ba76ef125290 | johnsonyue/auto | /bgpsim/shared/ping_test.py | UTF-8 | 766 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 21 20:39:57 2017
要两个参数:监听的ip 监听时间
结果:生成一个ip_日期_时间的日志(第一行为是否打断,后面为具体BGP包)
@author: zyl
"""
import datetime
import sys
import os
import time
ip = sys.argv[1]
kill_arg = 'killall ping'
now_time = datetime.datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
ti... | true |
fae75aeb093f5d06737d8945f4b9a096863f5437 | penguinwang96825/intelligent-asset-allocation | /model/offline_predict_q.py | UTF-8 | 6,780 | 2.640625 | 3 | [
"MIT"
] | permissive | import sys
sys.path.insert(1, '..')
import pickle
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm
import datetime as dt
from collections import defaultdict
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
import tensorflow as tf
from tensorflow.keras.models impo... | true |
9fe63ab3f0f61c2c2f158300cc67024976a13cef | KeckObservatory/kcwi_python | /lib/Blue.py | UTF-8 | 47,568 | 2.578125 | 3 | [] | no_license |
#from . import Version
#Version.append('$Revision: 85432 $')
#del Version
"""
.. module:: Blue
"""
import ktl
import os, sys, time
import logging as lg
import math
#from multiprocessing import Process
import threading
from KCWI.Helper import setupMonitoring, checkInitialValues,say, checkIfMoveIsPossible, changeMoveM... | true |
7350aa711a22da746c8aeec2dedf22b58f3c0ce5 | oscarada87/news-analyze | /searchID.py | UTF-8 | 3,868 | 3.015625 | 3 | [
"MIT"
] | permissive | from pprint import pprint
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import requests
import time
import json
import re
import abc
class Crawler(abc.ABC):
def __init__(self, url, keyWord):
self.url = url
self.keyWord ... | true |
0d0318016784d5ed0b08ca89dca85ba41f807ec5 | chenz16/AdvancedLaneFind_Submission | /Code/process.py | UTF-8 | 19,601 | 2.921875 | 3 | [] | no_license | '''
This module defines the core functions to process images
camera_cal: get camera calibration matrix
abs_sobel_thresh: return a binary array at each pixle
where normalized pixle gradient of x or y direction is within a specified range
mag_thresh: return a binary array at each pixle where normalized magnitude ... | true |
20a6436f552e9f67eb7497f35459f9b62a7408fb | caofaxin/Cail_Text_similarity_esimtribert | /Model/initialize.py | UTF-8 | 1,566 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import torch.nn as nn
import numpy as np
def init_embedding(input_embedding):
"""
初始化embedding层权重
"""
scope = np.sqrt(3.0 / input_embedding.weight.size(1))
nn.init.uniform_(input_embedding.weight, -scope, scope)
def init_lstm_weight(lstm, num_layer=1):
"""
初始化lstm权重
"""
for i in ... | true |
3798a78c3f59eb08ce33301f528f6129fcb0ea57 | parkermac/ptools | /obs_willapa/process_moor.py | UTF-8 | 635 | 2.671875 | 3 | [] | no_license | """
Code to do initial processing of mooring data from Willapa Bay.
"""
import pandas as pd
import numpy as np
import pickle
from datetime import datetime, timedelta
# where the data is, and where results will be stored
dir0 = '../../ptools_data/willapa/'
fn = dir0 + '2017Bay Center pCO2AverageBurke.xlsx'
df = pd.r... | true |
d5776b480b86f3e48819011b71fe80ea44dc9c37 | Demitroi/playing-with-python | /ejercicios/13_ciclo_while/13_ciclo_while.py | UTF-8 | 769 | 4.34375 | 4 | [
"MIT"
] | permissive | # El ciclo while permite ejecutar un bloque de código,
# siempre y cuando una condición sea verdadera.
# Este ejemplo utiliza un contador para imprimir
# números desde el 0 al 9
contador = 0
while contador <= 9:
print("Contador", contador)
# Imprime Contador del 0 al 9
contador += 1
# break permite romper... | true |
9db1bdb5da6a650074f56f32a8ba88071d8b7691 | unfoldingWord-dev/d43-catalog | /libraries/tools/legacy_utils.py | UTF-8 | 4,740 | 2.578125 | 3 | [
"MIT"
] | permissive | import os
import re
import yaml
import json
from file_utils import read_file, download_rc, remove_tree
def index_obs(lid, rid, format, temp_dir=None, downloader=None):
"""
Generates a JSON index of an OBS RC.
The resulting content can be written to a file and uploaded for use in the uW 2.0 and tS 2.0 APIs... | true |
65c5cfa327bfe570352ed977eb684d5989a76356 | claudiuolteanu/crypto | /tema2/ECB_cut_and_paste.py | UTF-8 | 2,147 | 2.90625 | 3 | [] | no_license | import sys
import json
import re
import os
from Crypto.Cipher import AES
mail_pattern = re.compile("^[a-zA-Z_0-9\.]+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$")
BLOCK_SIZE = 32
def from_cookie_to_json(cookie):
key_value_pairs = cookie.split('&')
key_value_dict = dict(s.split('=') for s in key_value_pairs)
return json.... | true |
939a09beb650e9e4fd696cad88c81659b292ab2f | gpatsiaouras/nao-kicking-a-ball | /nao_controller/converter.py | UTF-8 | 1,416 | 3.09375 | 3 | [] | no_license | #!/bin/python2.7
import argparse
import csv
class Converter:
def __init__(self):
self.names = list()
self.times = list()
self.keys = list()
def parse_motion_file(self, motion_file_location, webots_time_type):
with open(motion_file_location) as motion_file:
reader = csv.DictReader(motion_file, delimit... | true |
e435e8a1a46b2b8196c8cd724e375a7f101c7c44 | epksingh/wordcloud | /app/wc/wd_cloud.py | UTF-8 | 1,938 | 3.171875 | 3 | [] | no_license | import wordcloud
import numpy as np
from matplotlib import pyplot as plt
import re
# method for wordcloud egneration
def calculate_frequencies(file_contents):
# Here is a list of punctuations and uninteresting words you can use to process your text
punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''
uninter... | true |
cee4bc72bfb8ec0583fff45e244ac21dbf1ccfa6 | ricktoews/python-lab | /mathtoys/tests/test_tri.py | UTF-8 | 354 | 3.09375 | 3 | [] | no_license | import unittest
import sys
sys.path.insert(1, '..')
from modules.tri import nth_triangular
class TestTri(unittest.TestCase):
def test_tri1(self):
self.assertEqual(nth_triangular(5), 15, "Should be 15")
def test_tri2(self):
self.assertEqual(nth_triangular(4), 6, "Should be 10")
if __name__ ==... | true |
7d8a353802fe992191ce306ffa747713e36e7895 | danielShap/pysaga | /pysaga/actionstep.py | UTF-8 | 3,714 | 3.4375 | 3 | [] | no_license | from abc import ABC, abstractmethod
from typing import Callable, Dict
class ActionError(Exception):
"""
ActionError is the Exception type raised when an error occurs in one of the Saga's ActionSteps.
The ActionError contains the exception raised in the ActionStep.
"""
def __init__(self, action_na... | true |
26a6ac90f65ea62141e29a9a20fcb67364571836 | RonCom/algorithm_specialisation | /3.Graphs/5.Minimum_Spanning_Trees/connecting_points.py | UTF-8 | 3,454 | 3.5625 | 4 | [] | no_license | #Uses python3
import sys
import math
'''IMPLEMENTING MIN_HEAP'''
class MinHeap:
def __init__(self):
#heap array is where we store the nodes in heap
'''Each element in the heap will be a list, the 0th element
will be the node id, the 1th element will be the current
weight associated with it.
'''
self.heap... | true |
c1e6460bc1b7ecebf72696334723f15612cac3e1 | CoordML/runner | /coordml_runner/gpu_report.py | UTF-8 | 559 | 2.5625 | 3 | [
"MIT"
] | permissive | import asyncio
from central_client.client import CentralClient
from gpu_status import GpuStatus, GpuStatusMode
import logging
logger = logging.getLogger(__name__)
class GpuReport:
def __init__(self, client: CentralClient, gpu_status: GpuStatus):
self.client = client
self.gpu_status = gpu_status
... | true |
f428c34b5bcb634f8a74d82905e53326186799b3 | fare21/medium | /12021/bias_variance/data_generator.py | UTF-8 | 1,787 | 3.71875 | 4 | [
"MIT"
] | permissive | """Generate data for a given distribution."""
import numpy as np
import constants as C
def get_x_data(num: int, how: str = "fixed",) -> np.ndarray:
if how == "fixed":
x_vals = np.linspace(C.X_RANGE[0], C.X_RANGE[1], num)
elif how == "random":
x_vals = np.random.uniform(C.X_RANGE[0], C.X_RANGE... | true |
4563169e3010baf83344d86e921aa8958b345812 | Wanpeng66/Python_learning | /异步IO/async,await.py | UTF-8 | 458 | 3.125 | 3 | [] | no_license | # Python 3.5开始引入了新的语法async和await
# 来替代@asyncio.coroutine和yield from
import asyncio
async def hello():
print("hello world")
await asyncio.sleep(2)
print("hello again...")
async def hello2():
print("hello world2")
await asyncio.sleep(1)
print("hello2 again...")
if __name__ == "__main__":
... | true |
20c614699785986b9be6eedb29bcf91df6e7c3c8 | Kalyan-Gokavarapu/Python-Tutorial | /07 NetworkProgramming/01peer2.py | UTF-8 | 359 | 3.046875 | 3 | [] | no_license | import socket
socketObj = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
socketObj.bind(('localhost', 12344))
print (socketObj)
try:
received = socketObj.recv(1024)
socketObj.sendto(b"Hello there from socket 2!",('localhost', 12345))
print(received)
except Exception as e:
print ("Exception occured... | true |
4d55dc9e75194a51694a000eeeda43ad26252e6e | Sleeper4real/CN | /Client.py | UTF-8 | 6,562 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python3
import sys
import socket
import random
import time
import urllib.parse
from urllib.request import urlopen
from bs4 import BeautifulSoup
from threading import Thread
try:
f = open("config.txt", "r")
channel = f.read().split('\'')[1]
f.close()
except SyntaxError:
print("Read File Error... | true |
8255b46449e1eaa2d3ec45c606116e513b9cdacd | teltechsystems/teaspoon | /example/teaspoon.py | UTF-8 | 3,228 | 2.671875 | 3 | [
"MIT"
] | permissive | import struct
import socket
import time
import uuid
class Packet(object):
__slots__ = [
'op_code', 'priority', 'method', 'resource', 'sequence',
'total_sequences', 'request_id', 'payload_length', 'payload'
]
def __init__(self):
self.op_code = 0x2
self.priority = 0x5
... | true |
13b04c972f4e004edb4e82bcf72efe29056b1ce2 | huragok/LeetCode-Practce | /272 - Closest Binary Search Tree Value 2/cbstv2.py | UTF-8 | 983 | 3.34375 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def closestKValues(self, root, target, k):
"""
:type root: TreeNode
:type target: float
:... | true |
f1ba4776b5300b975d2c6544e842e080ea09023d | william-frazier/FormalMethods | /frazier_william.hw02/sudoku_in_PL.py | UTF-8 | 4,201 | 3.203125 | 3 | [] | no_license |
# Will Frazier
# Adapted from Prof. Kfoury
from z3 import *
# The 9x9 grid, together with the 9 possible digits in each cell,
# is represented by a 9x9x9 matrix S of Boolean values :
S = [ [ [ Bool("s_%s_%s_%s" % (i+1, j+1, k+1)) for k in range(9) ]
for j in range(9) ]
for i in range(9) ]
# CONSTRA... | true |
54734876064878c85483553ca55e1509a3a5d3e4 | edu-athensoft/stem1401python_student | /py210628e_python1b/day05_210715/if_2.py | UTF-8 | 1,016 | 4.75 | 5 | [] | no_license | """
if statement
story:
What will we do for today?
if it is sunny , we then hang out for shopping.
if it is rainy, we then stay home and play video game.
please write some code to describe the decision making statement above.
"""
# find out or determine the condition
# case 1.
is_sunny = True
# is_sunny = Fals... | true |
8ec2979993dcdc9c993ad3436d5458bf78db4879 | suohongliu/covid19-realtime-bot | /get_data.py | UTF-8 | 1,023 | 2.84375 | 3 | [] | no_license | import requests
import json
import datetime
"""
Json from open ottawa
https://open.ottawa.ca/datasets/covid-19-cases-and-deaths-in-ottawa/geoservice?page=2
"""
res = requests.get(
'https://opendata.arcgis.com/datasets/6bfe7832017546e5b30c5cc6a201091b_0/FeatureServer/0/query?where=1%3D1&outFields=Date,Daily_Cases_... | true |
e6ff891a60f44f23c65bfa80f0cedae25cde6bd6 | suyashpujari/PythonTrial | /assignment_methods/reverse_string/reverse.py | UTF-8 | 144 | 2.953125 | 3 | [] | no_license | def rev():
print("\n---Answer 1---")
str="Python Skills"
print("\nOriginal string: ",str)
print("\nReversed string: ",str[::-1]) | true |
61510ceca1bddc1ad980e21c9c4b9090f29815c2 | Praveen-Murugan/thinkpython | /Chapter 10/Exercise_10_5.py | UTF-8 | 217 | 3.984375 | 4 | [] | no_license | """
Write a function called chop that takes a list, modifies it by removing the first and
last elements, and returns None
"""
def chop(list):
del list[0]
del list[-1]
l = [1,2,3,4]
print(chop(l))
| true |
4f4515ac3dc227851aa305169129b410617cb55e | nutllwhy/Leetcode_python | /Easy/1Array/8Move_zero.py | UTF-8 | 742 | 4.125 | 4 | [] | no_license | # 移动零
# 给定一个数组 nums, 编写一个函数将所有 0 移动到它的末尾,同时保持非零元素的相对顺序。
# 例如, 定义 nums = [0, 1, 0, 3, 12],调用函数之后, nums 应为 [1, 3, 12, 0, 0]。
# 注意事项:
# 必须在原数组上操作,不要为一个新数组分配额外空间。
# 尽量减少操作总数。
class Solution:
def moveZeroes(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modif... | true |
c4aedfa2ec2753c12db5cf5f697270fd4ce0f395 | yangliyi/coursera-algorithmic-toolbox | /week2/assignments/1-intro-starter-files/fibonacci/fib.py | UTF-8 | 419 | 3.875 | 4 | [] | no_license | # Uses python3
# def calc_fib(n):
# if (n <= 1):
# return n
# return calc_fib(n - 1) + calc_fib(n - 2)
# n = int(input())
# print(calc_fib(n))
def calc_fib(n):
if (n <= 1):
return n
else:
arr = []
arr.append(0)
arr.append(1)
for i in range(2, n+1):
... | true |
47014e94b1818d6f3932956e384838deadfa281b | awarrier99/Conrad | /BARK/res/cmpformat.py | UTF-8 | 648 | 2.578125 | 3 | [] | no_license | with open(r"C:\Conrad\BARK\res\cmudict-en-us.dict", 'r') as fp:
x = fp.read()
words = sorted(x.splitlines())
swords = []
for i in range(len(words)):
swords.append(words[i][:words[i].find(' ')])
print(len(swords))
with open(r"C:\Conrad\BARK\res\engdictedit.txt", 'r') as tp:
y = tp.read()
cwords = sorted(y... | true |
51fc95c19b71351891d4c54840ee09e63f813f54 | akhilmurali/sensor_data_gen | /binary_detector.py | UTF-8 | 1,243 | 2.625 | 3 | [] | no_license | import socket
import time
import random
import sys
def start_socket(threshold):
if len(sys.argv) < 5:
print("Format: <host> <port> <device-id> <floor>", sys.argv[0])
exit(-1)
HOST = sys.argv[1]
PORT = int(sys.argv[2])
DEVICE_ID = sys.argv[3]
FLOOR = sys.argv[4]
LIMIT = thresho... | true |
e101cdc060a4e2cab5712ea3be09c7ef1f317c49 | firegod2018/GUI_For_CanFestival | /gnosis/util/convert/curses_txt2html.py | UTF-8 | 9,334 | 2.546875 | 3 | [] | no_license | import curses, traceback, string, os
from . import dmTxt2Html
import importlib
#-- Define the appearance of some interface elements
hotkey_attr = curses.A_BOLD | curses.A_UNDERLINE
menu_attr = curses.A_NORMAL
#-- Define additional constants
EXIT = 0
CONTINUE = 1
#-- Define default conversion dictionary
cfg_dict = {'... | true |
21cec749f446a0715e0e12a03d051833af552509 | YANGYANTEST/Python-development | /stage one/day04/作业.py | UTF-8 | 1,236 | 4.78125 | 5 | [
"MIT"
] | permissive | '''
第一题:
num_list = [[1,2],[‘tom’,’jim’],(3,4),[‘ben’]]
1. 在’ben’后面添加’kity’
2. 获取包含’ben’的list的元素
3. 把’jim’修改为’lucy’
4. 尝试修改3为5,看看
5. 把[6,7]添加到[‘tom’,’jim’]中作为第三个元素
6.把num_list切片操作:
num_list[-1::-1]
第二题:
numbers = [1,3,5,7,8,25,4,20,29];
1.对list所有的元素按从小到大的顺序排序
2.求list所有元素之和
3.将所有元素倒序排列
'''
num_list = [[1,... | true |
678d0c0b04f5e34204423dac35ba2a582c328c1b | Aasthaengg/IBMdataset | /Python_codes/p03680/s270320935.py | UTF-8 | 211 | 2.890625 | 3 | [] | no_license | N = int(input())
a = [int(input()) for _ in range(N)]
log = set()
i = 0
count = 1
while a[i] != 2:
i = a[i] - 1
if i in log:
print(-1)
break
else:
log.add(i)
count += 1
else:
print(count) | true |
e89ff9fe07c9db6a7d9cea5144bfd6e44a1bcbfa | Aivrie/ga-task | /plot.py | UTF-8 | 4,855 | 2.671875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from bokeh.plotting import figure, output_file, show
from bokeh.themes import built_in_themes
from bokeh.io import curdoc
from bokeh.embed import components
from bokeh.resources import CDN
from bokeh.plotting import figure
df = pd.read_csv('challenge_data_2.csv', encoding = ... | true |
fd38ef88d053b0c215a39adcff99690d43c69980 | Crystaleee/web-application-development | /src/sqldemo.py | UTF-8 | 662 | 3.15625 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect("superheroes.db")
cursor = conn.cursor()
cursor.execute('DROP TABLE IF EXISTS superheroes')
cursor.execute('CREATE TABLE IF NOT EXISTS superheroes(last_name varchar(100),first_name varchar(100),hero_name varchar(100))')
go = "y"
while go == "y":
last = raw_input("Enter last... | true |
72166173af227b6376345482be1839536b55885a | vladislavvalt/RC_PRO | /ai/reversi_engine.py | UTF-8 | 23,807 | 3.671875 | 4 | [] | no_license | __author__ = "danylofitel"
from random import randrange
# Integer constants representing infinity
int_max = 1000000000000
int_min = -int_max
# Reversi game engine
class ReversiEngine(object):
# States of a cell and player titles
empty = 0
first = 1
second = 2
# List of possible directions from... | true |
88b03a078dde3adb5ec9ccd8c0ea52be60fec44f | kleinerman/dobie | /controller/py_src/events.py | UTF-8 | 5,516 | 2.6875 | 3 | [] | no_license | import threading
import logging
import datetime
import time
import sys
import database
import queue
import genmngr
from config import *
class EventMngr(genmngr.GenericMngr):
'''
This thread receives the events from the main thread, tries to send them to the server.
When it doesn't receive confirmati... | true |
8f079bbe1d06ae0f2b7b76ea8287286aab068eb5 | hhadian/kaldi | /scripts/wakeword/get_random_subsegments.py | UTF-8 | 3,736 | 2.953125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | #! /usr/bin/env python
# Copyright 2017 Vimal Manohar
# 2017 Matthew Maciejewski
# 2019 Yiming Wang
# Apache 2.0.
from __future__ import print_function
import argparse
import logging
import random
import sys
import textwrap
def get_args():
parser = argparse.ArgumentParser(
descript... | true |
aa88a51ca39bdc368b9c69e0b3a2879fff8ddf07 | dersonnex/Python_learning | /Learn_PhythonEx/ex15.py | UTF-8 | 325 | 3.359375 | 3 | [] | no_license | from sys import argv
script, filename = argv #line1-3 to get a filename
txt = open(filename) #command open
print "Here's your file %r:" % filename
print txt.read() # function on txt named read
print "type the filename again:"
file_again = raw_input(">")
txt_again = open(file_again)
print txt_again.r... | true |
09006a4f29f50e130154683ca49b579b986b4ce2 | BigObasheer/holbertonschool-higher_level_programming | /0x03-python-data_structures/8-multiple_returns.py | UTF-8 | 167 | 3 | 3 | [] | no_license | #!/usr/bin/python3
def multiple_returns(sentence):
strlen = len(sentence)
if strlen == 0:
return strlen, None
i = sentence[0]
return strlen, i
| true |
02e866f4fbfc833a60e2d862a05e6fda4e26c52a | AdamZhouSE/pythonHomework | /Code/CodeRecords/2798/60787/303500.py | UTF-8 | 1,194 | 2.6875 | 3 | [] | no_license | n=int(input())
num=[int(i) for i in input().split()]
if not sum(num)%3==0:
print(0)
else:
s=int(sum(num)/3)
flag=True
temp,cut1,cut2=0,-1,-1
if not s==0:
for i in range(0,n):
temp+=num[i]
if temp==s:
temp=0
if cut1==-1:
... | true |
e63737e0a3cccf979762a66bd759d7ce54408c3f | jrg-sln/basic_python | /02_variables_ej.py | UTF-8 | 608 | 4.1875 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
################Ejercicio sobre la definición de variables###############
'''Ahora que ya ha aprendido a definir variables, hacer el mismo programa
del ejercicio anterior pero ahora declarando por ejemplo en caso del
triángulo y el rectangulo la base y la altura y en el caso del círculo el rad... | true |
cb3bb957311b9368293746e7cb07ef03fb18c85b | minhnh94/codility-lesson-solutions | /Time Complexity/TapeEquilibrium.py | UTF-8 | 222 | 3.078125 | 3 | [] | no_license | def solution(a):
sum_left = sum(a)
sum_right = 0
results = []
for i in a[:len(a) - 1]:
sum_left -= i
sum_right += i
results.append(abs(sum_left - sum_right))
return min(results)
| true |
2cfb136620b6536c4e5efc577c3d90bf1aa02102 | ljw980105/MaliciousDomanFetch | /main.py | UTF-8 | 3,833 | 3.453125 | 3 | [] | no_license | import urllib.request
import argparse
"""
A class that represents a domain list.
"""
class DomainList:
def __init__(self, url):
""" execute a http fetch with the given link and store in to data structure
:param url: The url used to initialize and populate the domain list
"""
self.da... | true |
069c5d66c41ba300a690030606598bd607b47bb7 | patrick-potocny/digit_recognition | /digit_recognition/custom_funcs.py | UTF-8 | 4,559 | 3.25 | 3 | [] | no_license | from sklearn.model_selection import StratifiedShuffleSplit
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import numpy as np
import itertools
def initial_sss(df, label, test_size, out_file):
sss = StratifiedShuffleSplit(n_splits=1, test_size=test_size,
... | true |
8d15391c5ab365e0561f0dbaa824f3a013ecbe84 | lmrodriguezr/MicrobeAnnotator | /independent_scripts/ko_mapper.py | UTF-8 | 31,499 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
"""
########################################################################
# Author: Carlos A. Ruiz Perez
# Email: cruizperez3@gatech.edu
# Intitution: Georgia Institute of Technology
# Version: 0.9
# Date: March 05, 2020
# Description: Maps protein KO inf... | true |
042e171048266f84a6c54b0d0f54fbb07be7a163 | NoTalkFiveDe/task | /task-4/yk/py/caesar_code.py | UTF-8 | 1,800 | 3.34375 | 3 | [] | no_license | from string_helper import sentence_shift as ss
def code(s: str, shift: int = 0):
return ss(s, shift)
def decode(s: str, shift: int = 0):
return ss(s, -shift)
def rot13(s: str):
return code(s, 13)
def get_input(s: str):
ret = None
while not ret:
ret = input(s)
print()
return r... | true |
dd8218f3bc11b589308aaa2d97ea3f96f8465a34 | faucetsdn/beka | /test/unit/test_chopper.py | UTF-8 | 1,400 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import struct
import unittest
from io import BytesIO
from beka import chopper
class ChopperTestCase(unittest.TestCase):
def test_valid_bgp_open_message(self):
# test bgp open = "\x04\xfe\x09\x00\xb4\xc0\xa8\x00\x0f\x00"
serialised_data = struct.pack(
"!16sHB10s20s", b"\xFF" * 16, 29, ... | true |
5d9065cd7d8536600e94ed30336fbcbd4de45c67 | aaaaatoz/programerpractice | /src/q19.py | UTF-8 | 282 | 3.328125 | 3 | [] | no_license | def average(scoreList):
if len(scoreList) <= 2:
return 0
else:
return (sum(scoreList) - min(scoreList) - max(scoreList)) * 1.0 / (len(scoreList) - 2)
if __name__ == "__main__":
scorelist = [1,2,3,4,5,6,7,8,9,10,11,8,9,34]
print(average(scorelist))
| true |
d98a6a79022b3552dc517e150daed4f3f0e9f716 | biertje72/Neural-evo | /simulation_1.py | UTF-8 | 2,043 | 3.46875 | 3 | [] | no_license | from organism_and_ecosystem import Organism, Ecosystem
import numpy as np
def main():
# The function to create the initial population, will be passed on as generator for Ecosystem
organism_creator = lambda : Organism([1, 16, 16, 16, 1], output='linear')
# The function we are trying to learn. numpy do... | true |
81cdd595a89953c3a93ed9a1155524cd54e81c45 | tyjkenn/decisiontree | /main.py | UTF-8 | 936 | 3.03125 | 3 | [] | no_license | import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
import id3
data = pd.read_csv("lenses.data.txt", dtype=None,
names=["number", "age", "spectacle", "astigmatic", "tears", "class"],
delim_whitespace=True)
da... | true |
dd71516eb060a77a2cb002179b1d1594e0adbb76 | itucsdb1708/itucsdb1708 | /classes/drink_control_functions.py | UTF-8 | 1,391 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | import psycopg2 as dbapi2
from flask import current_app
def select_all_drinks():
with dbapi2.connect(current_app.config['dsn']) as connection:
cursor = connection.cursor()
statement = """SELECT * FROM DRINKS"""
cursor.execute(statement)
drinks = cursor.fetchall()
return drin... | true |
59b392b88868268a68ea7229ae6efe8f11919ed1 | RodrigoCabaco/Joipsploit-Framework | /Payloads/Windows/windows_listener.py | UTF-8 | 1,239 | 2.828125 | 3 | [] | no_license | import socket
import threading
import os
import sys
import colored
HOST = str(sys.argv[1])
PORT = int(sys.argv[2])
green = colored.fg('green')
red = colored.fg('red')
white = colored.fg('white')
listener = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
listener.bind((HOST,PORT))
listener.listen()
print(f"Started Li... | true |
0db6e8618171e8b3fe41c2ea44ebc2b4a6dfcb92 | rammme/Python-100 | /code/22.py | UTF-8 | 134 | 3.765625 | 4 | [] | no_license | #문제22: 배수인지 확인하기
i = int(input())
if i%6 == 0:
print('6의 배수 O')
else:
print('6의 배수 X') | true |
abb9061aed4538f26adf1d3bea890d4360256c78 | vmilkovic/racunarski-i-robotski-vid | /vjezba2/zadatak6.py | UTF-8 | 752 | 3.125 | 3 | [
"MIT"
] | permissive | # Napisati program koji će napraviti masku pravokutnika dimenzija 100 x 200 i iskoristiti ju za fokus na središte slike slike po želji. Navedeno ostvarite korištenjem logičko "i" odnosno "AND".
import numpy as np
import cv2 as cv
from os.path import dirname
image = cv.imread(cv.samples.findFile(dirname(__file__) + ... | true |
78affe36e89934209149b3e7ee2ef52948e043cb | butoly/DensityVisualization | /main.py | UTF-8 | 1,447 | 2.8125 | 3 | [] | no_license | import sys
import os
from PyQt5 import QtWidgets
import numpy as np
import mayavi.mlab as mlab
import design
readFlag = False # Флаг для проверки считали ли файл или нет
data = "" # Данные которые мы считываем
class ExampleApp(QtWidgets.QMainWindow, design.Ui_Dialog):
def __init__(self):
super()._... | true |
60bd611d1fb6a4a588efa8faa17815b0a0cf4c6a | acromarti/cse491-numberz | /sieve_gen/test1.py | UTF-8 | 149 | 3.078125 | 3 | [] | no_license | # Testing to see if the first number in the generator is equal to 3
import sieve
def test1():
s= sieve.sieve()
assert s.next() == 3
test1()
| true |
aa9c7cd5d31062f59311ef123c580612235ba742 | dankyKang7/Calledge_Hawkey | /Calledge_Hawkey/hockeyDF_Analysis.py | UTF-8 | 8,311 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 25 22:36:51 2020
@author: travm
"""
import os
import pandas as pd
import re
from bs4 import BeautifulSoup as bs
import requests as req
from datetime import datetime as dt
from dateutil.parser import parse
import matplotlib.pyplot as plt
from ggplot import... | true |
d2bd7debdf0ad97b49ec550dfa8d11c3c99a6233 | IanC95/Master18-fleet-drones | /DistanceDetect.py | UTF-8 | 2,713 | 2.9375 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
pImg = cv2.imread('Ball/19.jpg',1)
#pImg = cv2.resize(img,(800,600)) # Resize
#Convert image from B,G,R to HSV
hsv = cv2.cvtColor(pImg, cv2.COLOR_BGR2HSV)
#range of orange in HSV
lower_yellow = np.array([20, 100, 100]) #Gimp values (37, 60, 54)
upper_yellow = np.array([30, 255, 255... | true |
4fdbb1d88551f5bc22791bebb4639a35f95d0e6e | adamltaylor/dacapo | /dacapo/tasks/post_processors/post_processor.py | UTF-8 | 1,349 | 3.09375 | 3 | [] | no_license | import time
class PostProcessor:
def __init__(self, parameter_range):
self.parameter_range = parameter_range
def set_prediction(self, prediction):
'''To be implemented in subclasses. This function will be called before
repeated calls to ``process`` and allows the post-processor to ca... | true |
f33989b8531cb57881f0d1549b3b1281c7b5d88f | iam91/thesis_master | /grad/eda/eda_req.py | UTF-8 | 5,293 | 2.609375 | 3 | [] | no_license | import re
import urlparse
from urllib import unquote
from functools import partial
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style='whitegrid')
pos_total = 0
neg_total = 0
pos_fields_stat = None
neg_fields_stat = None
pos_grams_stat = None
neg_grams_stat ... | true |
d4e88fce2da2c779cc04dfa8097bcff665feec7f | morrrrr/CryptoMasters | /13_power_mod.py | UTF-8 | 1,479 | 4.40625 | 4 | [] | no_license | """
Fast exponentiation by squaring algorithm:
1. Initialize the result to 1
2. If the exponent is 0, return the result. stop.
3. If the exponent is even, update values to:
result = result * base
exponent = exponent / 2
base = base * base
and repeat from the step ... | true |