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 |
|---|---|---|---|---|---|---|---|---|---|---|
9cf948bd2320bd78b82950beff9bd1a4a35740e3 | gonsie/Jstudy | /souper.py | UTF-8 | 3,215 | 2.921875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import re
import sys
class Clue:
def __init__(self, clue_html):
c = clue_html.find('div')
temp = c.get('onclick').split("'")[1].split("_")
self.round = temp[1] # J, DJ, FJ
if self.round != "FJ":
self.value = c.find(class_=re.compile("clue_value")).text
self.x = int(temp[2])... | true |
14e80010b0425650f187d50af7e14436d8c164b5 | Bwh50h3n/Year9designpythonLJ | /technical Skills/BasicsGUI.py | UTF-8 | 392 | 3.34375 | 3 | [] | no_license | import tkinter as tk
print("Start Program")
def pressedbutton():
print ("button has been pressed")
root = tk.Tk()
#create widgets
btn1 = tk.Button(root)
btn1.config(text = "Press me", width = 20, command = pressedbutton)
btn1.pack()
output = tk.Text(root)
output.pack()
outputscroll = tk.Scrollbar(output)
outputsc... | true |
5ca5672c0f97f5e0f47dac99ed2d3a6e5228cc6d | leehomcs/LeetCode | /40_Combination_Sum_II.py | UTF-8 | 752 | 3.390625 | 3 | [] | no_license | class Solution:
def combinationSum2(self, candidates, target):
candidates = sorted(candidates)
self.output = []
self.backtracking([], 0, candidates, target)
return self.output
def backtracking(self, subset, start, candidates, target):
if target == 0:
self.output.append(list(subset))
f... | true |
74dab71872ebd9f43ebf55a29e8a2e8a51eecfdb | pombreda/comp304 | /Assignment4/atom3/Kernel/Layout/HierarchicalLayout/LayeringModule.py | UTF-8 | 17,436 | 3.328125 | 3 | [] | no_license | """
LayeringModule.py
This module is responsible for creating a proper layering of an arbitrary
directed graph. The optimal solution (minmal height and width layering) is an
NP-complete problem.
Responsibilities:
1) Eliminate cycles
2) Assign each node to a layer
3) Assign dummy nodes to layers wherev... | true |
ddd7fcee26cf4b4787a180d0f6220a59cf5ba484 | gycggd/Leetcode | /code/174/174.py | UTF-8 | 823 | 3.0625 | 3 | [] | no_license | # author: guoyc
# leetcode url: https://leetcode.com/problems/dungeon-game/description/
import sys
class Solution(object):
def calculateMinimumHP(self, dd):
"""
:type dungeon: List[List[int]]
:rtype: int
"""
m = len(dd)
n = len(dd[0])
dp = [[sys.maxint] * n... | true |
9a3e3e4e862c23988224f98a3560588787ae5bde | AlexCampanozzi/HomoDeUS | /homodeus_behaviors/scripts/bhvr_talking.py | UTF-8 | 4,275 | 2.59375 | 3 | [] | no_license | #! /usr/bin/env python
import rospy
import time
import actionlib
import traceback
import pal_interaction_msgs.msg
from custom_msgs.msg import ttsActionAction, ttsActionGoal, ttsActionResult
from std_msgs.msg import String, Bool
import HomoDeUS_common_py.HomoDeUS_common_py as common
class Talking_module:
"""
Th... | true |
89b0515f33ced8d0311972ea8877e6babd67cf88 | sand7242/ds-big-data-case-study | /plotting.py | UTF-8 | 3,946 | 2.640625 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def pay_Bor(df):
df_payment_type_names = df['payment_type_names']
df_PU_Borough_names = df['PU_Borough_names']
df_crosstabs_Borough_PU = pd.crosstab(df_payment_type_names,df_PU_Borough_names, normalize='columns')
# print(df_cros... | true |
738c456700dc6e059ac02e9650928b942620bcb4 | phatollie/MensaQ | /prt_iq.py | UTF-8 | 1,046 | 3.78125 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
###############################################
# Authored by Justin Acevedo in the year 2021 #
###############################################
"""
Description: Group of functions to spit out random IQ results.
Design: Create separate function based on list results for IQ ranges and... | true |
12e3edf0edc6409bee9d44380409aac68611845b | MarisaPereaOrtiz/repo | /FibonacciSerie.py | UTF-8 | 430 | 4.1875 | 4 | [] | no_license | # the Fibonacci serie is 1 1 2 3 5 8 13 21 ...
# contruction method the next number is the sum of the previous two numbers
serie_Fibonacci = [1, 1]
# Which number of the Fibonacci series would you like to know
serie_numer = 15
for numer in range(serie_numer):
Fibonacci_new = serie_Fibonacci[numer]+serie_Fibonacci... | true |
d0fc801ca13f7bca58b1f10cc6cd6d4f9c3da175 | semnik/crawler | /model/url.py | UTF-8 | 1,806 | 2.640625 | 3 | [] | no_license | import traceback
import sqlalchemy
from sqlalchemy import Column, Text, Boolean
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session
from settings import log
Base = declarative_base()
class Url(Base):
__tablename__ = 'url'
url = Column(Text, primary_key=True, i... | true |
51249e2ef457b9f8e523152d8b799ba65e2a49a0 | alcrawford12/ValpoVision | /Parker_Line_following_raspi/webcamvideostream.py | UTF-8 | 4,068 | 3 | 3 | [] | no_license | # import the necessary packages
from threading import Thread
import cv2
from time import sleep
from time import time
from queue import Queue
from datetime import datetime
class WebcamVideoStream:
def __init__(self, src=0, name="WebcamVideoStream",output_name = None, res = None,fps =None,output_width=None,output_he... | true |
f7076f7c1b0c0f4956c35e97d53dedfa6afd848e | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_95/1455.py | UTF-8 | 2,037 | 2.703125 | 3 | [] | no_license | from string import maketrans
import collections
from itertools import permutations
aaa = 'yeq'
bbb = 'aoz'
bfreq = 'etinshrdlcumwfgypbvkjxq' # abcdfghijklmnoprstuvwxz
# ngrams?
#wl = ['a', 'the', 'is', 'are', 'to', 'if', 'so', 'there', 'you', 'our', 'just', 'up', 'and', 'also']
f = open('words.txt', 'r')
wl = [l.repl... | true |
c7af5e1636ce84784256e93d3665c1f6af12fec5 | cyberbeast/viagogochallenge | /event.py | UTF-8 | 3,611 | 3.71875 | 4 | [
"MIT"
] | permissive | from ticket import Ticket
from location import Location
from random import randrange, uniform
class Event:
"""
The Event class is an abstraction for defining an event with respect to the following constraints:
* Each event has a unique numeric identifier.
* Each event has 0 or more tickets.
... | true |
9d27fbf26f20e1d0b8eb4042e7a3fe29c5a49d3c | anildhaker/DataStructures | /Arrays/rotationCount.py | UTF-8 | 883 | 3.796875 | 4 | [] | no_license | # Consideranarrayofdistinctnumberssorted in increasingorder.
# Thearrayhasbeenrotated(clockwise)knumberoftimes.Givensuchanarray,
# find the value of k.
# Method 1 - Naive Approach - Linear Search
def numRatationCount(arr):
minVal = arr[0]
for i in range(len(arr)):
if minVal > arr[i]:
minVal = arr[i]
... | true |
aa8cc88540784ec73dd2288349126cc4e914b15a | TylerBlankenbiller/FantasyFootball | /QBPred.py | UTF-8 | 16,392 | 2.6875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
from pathlib import Path
def clean(training_df):
'''
Change stats that are strings into dummy columns
... | true |
8fe452034f32c64911228f9c35136ec46f756d8a | danigunawan/Fullstack-Python-Django-Dev | /14_pylevelone/5.dictionaries.py | UTF-8 | 1,527 | 4.03125 | 4 | [] | no_license | # dictionaries
# example 1
my_stuff = {"key1": "value", "key2": "value2"}
# mengakses value dari array pertama/ 0 dengan kunci index 'key1'
print(my_stuff['key1'])
# example 2
my_stuff2 = {"key1": 123, "key2": "value2", "key3": {'123': [1, 2, 3]}}
print(my_stuff2) # mengakses value dari array pertama/ 0 dengan kunci ... | true |
75ff581bfabe98436eb729aeb18c31c48fb74002 | yudh1232/Baekjoon-Online-Judge-Algorithm | /2920 음계.py | UTF-8 | 608 | 4 | 4 | [] | no_license | # 숫자 8개를 입력받아 리스트에 넣음
data = list(map(int, input().split()))
# 1로 시작하는 경우
if data[0] == 1:
# 오름차순으로 정렬되어 있다면
if data == sorted(data):
print('ascending')
# 정렬되어 있지 않다면
else:
print('mixed')
# 8로 시작하는 경우
elif data[0] == 8:
# 내림차순으로 정렬되어 있다면
if data == sorted(data, reverse=True):
... | true |
4bcfd4123a46ca998f270c5d0f57c4d03c55cbe5 | kula124/PMRIL_Alphabot | /src/ImageProcessor/presentation/presentation_manager.py | UTF-8 | 2,346 | 2.59375 | 3 | [] | no_license | import configparser
from typing import List, Tuple, Callable
from cv2 import namedWindow, setMouseCallback, imshow
from cv2.cv2 import putText
from numpy import ndarray
from models.object import Object
from presentation.drawer import Drawer
class PresentationManager:
def __init__(self, config: configparser.Conf... | true |
3cde2a834097098ead7d62c8a784da64ce599f4d | rahulbansal16/geeksforgeekspython | /llist.py | UTF-8 | 2,662 | 3.453125 | 3 | [
"MIT"
] | permissive | class Node(object):
def __init__(self, data = None, next = None, prev = None):
self.data = data
self.next = next
self.prev = prev
def get_data(self):
return self.data
def get_next(self):
return self.next
def get_prev(self):
return self.prev
def set_nex... | true |
0552d4f0a8aee2d59e98760649f6f89c80649db6 | rao003/StartProgramming | /PYTHON/einstieg_in_python/Beispiele/operator_logisch.py | UTF-8 | 274 | 4.15625 | 4 | [] | no_license | x = 12
y = 15
z = 20
print("x:", x)
print("y:", y)
print("z:", z)
# Bedingung 1
if x<y and x<z:
print("x ist die kleinste Zahl")
# Bedingung 2
if y>x or y>z:
print("y ist nicht die kleinste Zahl")
# Bedingung 3
if not y<x:
print("y ist nicht kleiner als x")
| true |
68f96755b6a82d858a692c4ea119b070ebcac7b3 | janert/feedback-control-for-computer-systems | /python3/ch02.py | UTF-8 | 498 | 2.6875 | 3 | [] | no_license |
import sys
import math
r = 0.6
k = float( sys.argv[1] ) # 50..175
print( "r=%f\tk=%f\n" % ( r, k ) ); t=0
print( r, 0, 0, 0, 0 )
def cache( size ):
if size < 0:
hitrate = 0
elif size > 100:
hitrate = 1
else:
hitrate = size/100.0
return hitrate
y, c = 0, 0
for _ in range( 200... | true |
d04f9347dc1d425d0f90912f29c67589bda7b80e | willdougadams/candy_randy | /src/core/generate_level.py | UTF-8 | 7,639 | 2.859375 | 3 | [] | no_license | import random
import pygame
import copy
import random
ROOM_BUFFER = 3
floor_tile_offsets = {}
floor_tile_offsets["top_left"] = (0, 0)
floor_tile_offsets["top_center"] = (1, 0)
floor_tile_offsets["top_right"] = (2, 0)
floor_tile_offsets["left_edge"] = (0, 1)
floor_tile_offsets["center"] = (1,... | true |
4ec9baa7b700c522ac9a4d8cf554cbb34f6df6f6 | methsaan/python | /usefulprograms/bash.py | UTF-8 | 1,424 | 3.03125 | 3 | [] | no_license | #! /usr/bin/python3
import subprocess as sp
import time
history = []
history2 = []
cnt = 0
while True:
x = input("Enter a bash command: ")
cnt = cnt + 1
if x != "bash.py-history" and x != "bash.py-clear-history":
history2.append(x)
history.append(str(cnt))
if x == "bash.py-history":
... | true |
7fa9f59afd8c826bb7a17b1c3ef6f664fa35deaa | ClaraShar/SummerPractice | /新闻测试工具/���Ų��Թ���/CheckDoc.py | UTF-8 | 6,552 | 2.8125 | 3 | [] | no_license | import ErrType
import filter_text
import re
import datetime
class CheckDoc:
def __init__(self, dbname, colname, doc):
self.dbname = dbname
self.colname = colname
self.doc = doc
def check_basic(self):
list_errbasic = []
keys = self.doc.keys()
tag = ... | true |
d5e21ab19ae089bbad0c81eeacd643df1c74d5cd | santhoshbabu4546/vegaa | /10.py | UTF-8 | 144 | 3.40625 | 3 | [] | no_license | aa11=int(input())
bb11=[]
for i in range (2,aa11+1):
if(aa11%i)==0:
bb11.append(i)
aa11=aa11//i
k1=sorted(bb11)
print(*k1
| true |
d8d218e0dd7011adaae72e45a7237df38d81d9fe | iwakoscott/Email-Student | /emailStudent.py | UTF-8 | 2,829 | 2.6875 | 3 | [] | no_license | import csv, re, subprocess, smtplib, mimetypes, email, email.mime.application
# The collection commented out below was used for testing purposes...
#collection = [["1", "MAT", "UG", "997488942", "Iwako, Satoshi", "ssiwako@ucdavis.edu"], ["2", "MAT", "UG", "99988833", "Chumakova, Darya", "dchumakova@ucdavis.edu"], ["3"... | true |
767ebda3b3169536ae169e23edcfd0505905a188 | Dre-AsiliVentures/Python-Programming-scripts | /Py 3 (2).py | UTF-8 | 263 | 3.53125 | 4 | [] | no_license | class country:
def __init__(self,continent,name):
self.continent=continent
self.name = name
class details(country):
def city(self,name):
print("Country name:")
KEN = details("Africa", "Kenya")
print(KEN.continent)
| true |
e3c73374a5cbb30cf337fd4139e9f5713de19af6 | petitefille/Python | /kap5/no.py | UTF-8 | 756 | 3.375 | 3 | [] | no_license | class quadratic:
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def value(self, x):
return self.a*x**2 + self.b*x + self.c
def __call__(self, x):
return self.a*x**2 + self.b*x + self.c
def table(self, L, R, n):
import numpy as np
a, b, c = sel... | true |
bf8bcc3d98c180e3e090c6be6b5dd14bc6b2ded4 | SongJin-Carleton/Python-Self-Learning | /06/06-more.py | UTF-8 | 426 | 3.34375 | 3 | [] | no_license | #a = 200
a = [100]
def test(num):
num += num # in python num+=num is not equal with num = num+num,
# just for int value they are same
# num = num + num ===> [100]+[100] = [100,100], now num points to
# new list [100,100],in the global original value won't change.
... | true |
ab8cce36004b283dfb9f4527718b715e91a7eea1 | J-amelie/AJOU_python | /CH02_MOSSION01_20917_이유성.py | UTF-8 | 487 | 3.46875 | 3 | [] | no_license | jua = float(input("첫 번째 점의 x좌표를 입력하세요 : "))
fja = float(input("첫 번째 점의 y좌표를 입력하세요 : "))
spy = float(input("두 번째 점의 x좌표를 입력하세요 : "))
stw = float(input("두 번째 점의 y좌표를 입력하세요 : "))
import math
gye = math.pow((spy-jua),2)
san = math.pow((stw-fja),2)
rut = math.sqrt(gye+san)
print("두 점({0}, {1}), ({2}, {3}) 사이의 ... | true |
9b4eb5165ab35f78a3b0ca8a84255ef322c97ba1 | nhomar/upgradator | /upgradator/upgrade_code.py | UTF-8 | 4,613 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
"""
A little lib where all particularities from one version to another will be
taken into account basically here you will find a set of "helper" methods to be
used as tools to include the correct elements on python files.
"""
class migrateNextVersion():
'''C... | true |
01a955cc1acb126db4956f6812cf800cdbe3eb37 | NishiokaKazuki/HEW2020 | /mechanical/libs/state/purchase.py | UTF-8 | 557 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import time
from select import select
class MainStatePurchase(object):
def __init__(self):
self.rfids = list()
def Purchase(self):
while True:
try:
id = raw_input('>>')
except:
break
... | true |
d1b475f685a3fd9f82c1e930694d948ce67d8e24 | vishnuap25/AcadGil-Assignments-4-9 | /Assessment_4-9/Day 7/Fibo.py | UTF-8 | 439 | 4.21875 | 4 | [] | no_license | def fib2(delim):
# Check if the value is numeric and positive
if type(delim) != int:
raise TypeError("Value needs to be an Integer")
if delim < 0:
raise ValueError("Value needs to be greater than 0")
fib_series = [1,1]
# Create an empty list to append all the
for i... | true |
e6a4c6a1557586189c17e42930347d75c4d01f65 | anderslime/smache | /smache/topological_sort.py | UTF-8 | 590 | 3.15625 | 3 | [] | no_license | from collections import deque
GRAY, BLACK = 0, 1
def topological_sort(graph):
order, state = deque(), {}
enter = set(graph)
def dfs(node_id):
state[node_id] = GRAY
node = graph.get(node_id)
for k in node.parents:
sk = state.get(k.id, None)
if sk == GRAY:
... | true |
42332596221785e5d7636397f4e975bf73a8d02c | manish2627/snack_game | /main.py | UTF-8 | 1,001 | 2.828125 | 3 | [] | no_license | from turtle import Screen, Turtle
import time
from snack import Snack
from food import Food
from scorecard import Score
screen = Screen()
screen.setup(width=600, height=600)
screen.bgcolor("black")
screen.title("snake game")
screen.tracer(0)
snack = Snack()
food = Food()
scorecard = Score()
screen.li... | true |
bba415ccd1dcffa861d9a68d129b0a9e4d021a7d | niteshsrivats/Labs | /5th Semester/ADA/Sixth Class/Queens.py | UTF-8 | 752 | 3.546875 | 4 | [] | no_license | import numpy as np
size = int(input("Enter size of Board: "))
matrix = np.zeros((size, size))
def is_safe(matrix, row, col, size):
for i in range(row):
if matrix[i][col] == 1:
return False
for i in range(1, min(row + 1, size - col)):
if matrix[row - i][col + i] == 1:
... | true |
cf886fc78cf2e423dc0b3bd037811d8eaac3d57e | jonathaneunice/prefsort | /prefsort/core.py | UTF-8 | 583 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | import sys
from typing import Union
def prefsorted(seq: list,
preferred: Union[str, list, None] = None,
reverse: bool = False) -> list:
if isinstance(preferred, str):
preferred = preferred.split()
elif preferred is None:
preferred = []
taken = []
rest = ... | true |
db0b9fe8dc105acb63b58fcbf3452b898cef0776 | hunkim/DeepLearningZeroToAll | /tf2/tf2-04-3-file_input_linear_regression.py | UTF-8 | 1,102 | 3.5625 | 4 | [] | no_license | # Lab 4 Multi-variable linear regression
import tensorflow as tf
import numpy as np
xy = np.loadtxt('../data-01-test-score.csv', delimiter=',', dtype=np.float32)
x_data = xy[:, 0:-1]
y_data = xy[:, [-1]]
# Make sure the shape and data are OK
print(x_data, "\nx_data shape:", x_data.shape)
print(y_data, "\ny_data shape... | true |
26400e081b3865fd241694bd547dc4d49b021b90 | Nemwos/Data-tester | /Data Tester.py | UTF-8 | 673 | 3.1875 | 3 | [] | no_license | from random import randint
TRAIN_SET_LIMIT = 1000
TRAIN_SET_COUNT = 100
TRAIN_INPUT = list()
TRAIN_OUTPUT = list()
for i in range(TRAIN_SET_COUNT):
a= randint(0, TRAIN_SET_LIMIT)
b = randint(0, TRAIN_SET_LIMIT)
c = randint(0, TRAIN_SET_LIMIT)
op = a + (2*b) + (3*c)
TRAIN_INPUT.append([a,... | true |
acb5144cb452f9bae8ce355b23e966ab0552e980 | voraparth1337/System-Programming-and-Compiler-Construction-Solutions | /2 pass macro processor/macro_processor.py | UTF-8 | 5,054 | 3.203125 | 3 | [] | no_license | # Written by Parth V
# Disclaimer : I am no expert in python but just a learner. In no way is this code perfect or the most 'pythonic' implementaion
# It was written for practice and understanding the concepts. Feel free to extend or make it better. Cheers !!
# www.parthvora.tk
# Implementation of two pass macro ... | true |
554bcda4a7b21a3b70bade4fd434a5f4942394ac | Shadman77/DataScience | /Seaborn/categorical_plots.py | UTF-8 | 2,457 | 3.234375 | 3 | [] | no_license | import matplotlib
matplotlib.use('TkAgg')#to run using tkinter
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
def incrementIter(param):
incrementIter.i += 1
print()
print(str(incrementIter.i) + ' -------- ' + str(param) + ' -------- ')
incrementIter.i = 0
de... | true |
0bfcbea9b1aec5761b85ac0f5ad81edc8dd9e1ff | ploomber/ploomber | /tests/test_validators.py | UTF-8 | 5,264 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
import pytest
from ploomber.validators import (
Assert,
data_frame_validator,
validate_schema,
validate_values,
)
from ploomber.validators import string
def test_Assert():
assert_ = Assert()
assert_(False, "Error message")
assert_(True, "Another error message")
a... | true |
22f998d523bb9dc3868e25c07b4bab042288a78c | codermoji-contrib/python | /start/Intro to Dicts/001/main3.py | UTF-8 | 53 | 2.515625 | 3 | [
"MIT"
] | permissive | d = dict(name='Jane', age=30, mood='happy')
print(d)
| true |
9fa8b1116f550efe43e34cbb3a6b65b80a8cf433 | Junelin2333/TGNet | /gcn.py | UTF-8 | 3,238 | 2.640625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras.layers import Conv2D,Add,Concatenate,Conv1D,Activation,Softmax,BatchNormalization
from tensorflow.python.keras.layers.pooling import GlobalMaxPooling2D
def TGN(X,XL,N,C):
'''
Global Guide Graph Convolution Module
'''
_,h,w,_ = X.shape # 或者用tf.shape
# ... | true |
7d3d5d1b511630fafe45d692f3b76efab0fa1719 | 5l1v3r1/auto-wordpress | /get_ibmi_post.py | UTF-8 | 1,302 | 2.546875 | 3 | [] | no_license | import urllib.request as req
import bs4
import re
import time
import pandas as pd
url = "https://ibmi.taiwan-healthcare.org/news_detail.php?REFDOCTYPID=0o4dd9ctwhtyumw0&REFDOCID=0qf8jpira4iij9ir"
news = []
for round in range(100):
request = req.Request(url, headers = {
"User-Agent":"Mozilla/5.0 (Windows;... | true |
daab85d0854965b2b18be3fa0d0cf41b03e42c28 | colshag/ANW | /anw/Packages/anw/func/names.py | UTF-8 | 4,013 | 3.34375 | 3 | [] | no_license | # ---------------------------------------------------------------------------
# Cosmica - All rights reserved by NeuroJump Trademark 2018
# names.py
# Written by Chris Lewis
# ---------------------------------------------------------------------------
# generates random names based on name lists
# ---------------------... | true |
b6f2cef2714d684b13c32a2eee7fb94137c77e4f | CoupDe/Git_learning | /Type/File_lesson/JSON_lesson.py | UTF-8 | 572 | 2.953125 | 3 | [] | no_license | import json
employee = dict(name='Artem', age=35, child=['Eva', 'Artemovna'], wife=dict(
name='Daria', secondname='Sergeevna', lastname='Alekseeva'))
with open('JSON.json', 'w') as newJson:
if newJson.closed:
print('is closed') # Диспетчер контекста гарантирует закрыте файла
else:
print('... | true |
32851ce22b42ad6954a0a8c0f81123ad44dd7f8e | sknyx/Bioinformatica | /ATV 3 - Algoritmo de alinhamento pairwise local Smith-Waterman/BioinfAtividadePratica3/main.py | UTF-8 | 3,991 | 3.375 | 3 | [] | no_license | # Instituto Federal de Brasília - Taguatinga
# Curso: Bacharelado em Ciência da Computação - 7° semestre
# Disciplina: Introdução à Bioinformática - 1/2019
# Professor: Me. João Victor Oliveira
# Estudante: Carolina Ataíde
# Alinhamento de Sequências Pairwise - Atividade Prática 3
import numpy as np
import pandas as... | true |
6bd991a1371f6d835a27023087404271ab540721 | flaviojfpereira/ea-crossover-operators-comparison | /proj_stat_analysis.py | UTF-8 | 2,946 | 3.15625 | 3 | [] | no_license | from stat_alunos import *
import random
import copy
import operator
import math
# H0 - there's no differences between the runs. alpha = 0.05, se p value < alpha -> rejeitar nula e aceitar a H2
# fazer experiencias para as distribuiçoes. definir alpha -> se p value for inferior -> pode se rejeitar hipotese nula (é dif... | true |
2cfd0d0a36dd78f62a92ae1fbc8557f1a74a1e7c | asarkar17/Analytics-Case-Studies | /Statistical Analysis using Python/FPFunctions_AyanSarkar.py | UTF-8 | 6,288 | 2.96875 | 3 | [] | no_license |
# coding: utf-8
"""
Created on Sun Nov 25 2018
This module constains function to create bar graph, scatter plot & produce plots for a regression anlysis.
It also contians function to perform tTest for Equal Variances & Anova Test
@author: Ayan Sarkar
"""
import pandas as pd
import matplotlib.pyplot as plt
import nump... | true |
6b51d77e4b67d962e34af92e7537fa901550adae | eognianov/PythonProjects | /PythonBasics/loops/1000-7.py | UTF-8 | 63 | 3.375 | 3 | [] | no_license | for i in range (1,1001):
if (i % 10 == 7):
print(i) | true |
878a4dce59efb5cb9e3760a36411a8a5baa7e2a6 | ShpakZoia/selenium | /test_select.py | UTF-8 | 933 | 2.65625 | 3 | [] | no_license | import unittest
from selenium import webdriver
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.keys import Keys
class TestSelect(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome(executable_path='d:\зоя\Chrome\chromedriver')
self.url... | true |
9873da904ed69d5ae35ef185a1dc6c16179652d3 | danribeiro/chatbot_stackoverflow | /src/utils.py | UTF-8 | 489 | 2.78125 | 3 | [] | no_license | import requests
def call_stackoverflow_api(tags):
"""Return the list of answers for questions that contains the inputed tags"""
headers = {'content-type':'application/json'}
url = 'https://api.stackexchange.com/2.2/search/advanced?order=desc&sort=activity&tagged='+tags+'&site=stackoverflow'
result... | true |
c07cb3a722817964852c5d809bfd843b07538bc5 | hawahe/leran_frank | /oldboy/day7/AttributeMethod.py | UTF-8 | 300 | 3.78125 | 4 | [] | no_license |
class Dog(object):
n = 'Alex'
def __init__ (self,name):
self.name = name
@property
def eat(self,food):
print("%s is eating %s" % (self.name,food))
def talk(self):
print('%s is talking' % self.name)
d = Dog('ChenRonghua')
d.eat('baozi')
d.talk()
| true |
9984f94a76fbb70ff264562f2fb8b0b6bc6a7be3 | park-in-gwon/Python_Summary | /1_ 파이썬의 기본문법/1-2_ 자료형/3-5-문자열포맷팅,형식지정자.py | UTF-8 | 3,829 | 3.859375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
print("{0:ㅡ^+10,}".format(9999.9))
"""형식 지정자:
문자열 내에 값을 삽입(포맷팅)할 때, 세부적으로 붙여줄 설정을 형식 지정자로 해줄 수 있다.
%을 사용한 예전 포맷팅 방법에는 %(타입)뒤에 %형식지정자(타입), {}를 사용하는 요즘 포맷팅 방법에는 {(값)}에서 {(값): 형식지정자}로 하면 된다.
형식 지정자로 적용시킬 수있는 설정을 모두 쓰면 아래와 같다.
<<채움문자> 정렬방법> <부호표시법> <전체폭설정> <단위구분법> <소수점이하자릿수> <타입형식>
"""
print("정렬기본값... | true |
3c7272e7b7d72dbc2e975805eec3e77d2dd1a60f | akki111singh/Space-Invaders | /invasions.py | UTF-8 | 825 | 2.625 | 3 | [] | no_license | import pygame
from settings import setting
from ship import Ship
import newgf as gf
from alien import Alien
from pygame.sprite import Group
from pygame import time
from scoreboard import Scoreboard
def run_game():
pygame.init()
set_screen = setting()
screen = pygame.display.set_mode((set_screen.width, s... | true |
2c43a6c159c8c9e2f096bf987e1e09d4d20f54ed | Aasthaengg/IBMdataset | /Python_codes/p02797/s496545132.py | UTF-8 | 607 | 2.5625 | 3 | [] | no_license | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readl... | true |
b49d836318874a2673154c8b7497f4b689133867 | ThibautPages/GamePython | /exe.py | UTF-8 | 938 | 2.6875 | 3 | [] | no_license | import time
from classes import *
from interfaceGraphique import *
from events import *
t = Table(8,13)
ma1 = Maison(t, 'maison', 5,5)
ma2 = Maison(t, 'maison2', 2,10)
mi1 = Mine(t, 'mine1', 1,7)
mi2 = Mine(t, 'mine2', 3,4)
mi3 = Mine(t, 'mine3', 4,12)
ch1 = Champ(t,'champ1',6,2)
ch2 = Champ(t,'c... | true |
c6971086b87d0eb64e385960149035b110f28b0a | stevenjoelbrey/PMFutures | /Python/average6HourlyData.py | UTF-8 | 14,668 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python2
###############################################################################
# ------------------------- Description ---------------------------------------
###############################################################################
# This script will be used to generate daily met fields ... | true |
21317ae9f4f023bf9d2671796f92a6b50c42bae1 | tylors1/Leetcode | /Problems/pancakeSort.py | UTF-8 | 665 | 3.703125 | 4 | [] | no_license | def flip(arr, k):
start = 0
while start < k:
temp = arr[start]
arr[start] = arr[k]
arr[k] = temp
start += 1
k -= 1
def find_max_idx(arr, k):
idx = 0
for i in range(k):
if arr[i] > arr[idx]:
idx = i
return idx
def pancake_sort(arr):
# flip_idx = len(arr) - 1
# find max, set max = 5
# flip ma... | true |
d9979059acfacbf95640b36b393efc18294aebb7 | NATEDU/python_urllib | /Hanhan_blog_urllib.py | UTF-8 | 868 | 2.65625 | 3 | [] | no_license | #coding:utf-8
import urllib
url=['']*500
page=1
while page <=15:
con =urllib.urlopen(\
'http://blog.sina.com.cn/s/articlelist_1191258123_0_'+str(page)+'.html').read()
#print con
i=0
title=con.find(r'<a title=')
href=con.find(r'href=',title)
html=con.find(r'.html',href)
while title... | true |
b9dc1c178ba93f68ace3d9d279068943e59dffe4 | bassemhossam/Video-Summarization | /custom_rnn.py | UTF-8 | 1,239 | 3.109375 | 3 | [] | no_license | import torch
import torch.nn as nn
class customRNN(nn.Module):
"""
Custom RNN : Used to initialize one layer LSTMs with different sizes
initHidden() initializes the hidden_state, and the cell_state of the LSTM
"""
def __init__(self, input_size, hidden_size, isbidirectional, dev... | true |
819dc40eb82dd9b388861cfc88d4dc43f5482c55 | laserson/numba | /oldnumba/tests/issues/test_issue_192.py | UTF-8 | 1,028 | 2.734375 | 3 | [
"BSD-2-Clause"
] | permissive | import unittest
from numba import jit
def loop_all(begin, end, mask):
hash = 0
for i in xrange(begin, end):
hash ^= i | ((hash << 1) & mask)
return hash
def loop_all_simpler(begin, end):
hash = 0
for i in xrange(begin, end):
hash ^= begin + hash
return hash
class TestBitwiseLo... | true |
3a406b2683113ea33541ae0db753c1ecacc9cba6 | romannort/Zivs | /scripts/zivs2.py | UTF-8 | 2,010 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import math
import json
import base64
#decode args
decoded_args = base64.b64decode(sys.argv[1])
json_arg = json.loads(decoded_args)
# key #1
a = int(json_arg['a'])
# key #2
b = int(json_arg['b'])
# p
p = int(json_arg['p'])
# m - message
m = json_arg['m']
# step {2|3} - number of step... | true |
6e98ab0a76e27c7597226a687a2016a9b05035e4 | marktreyvon/python_practice | /graph2.py | UTF-8 | 3,897 | 3.390625 | 3 | [] | no_license | # 单源最短路径 : Dijkstra
# 顶点对之间最短路径 :Floyd
class stack:
def __init__(self):
self.arr = []
def push(self,p):
self.arr.append(p)
def pop(self):
return self.arr.pop(0)
def isempty(self):
return 1 if len(self.arr)==0 else 0
class graph:
def __init__(self,n):
self.arr... | true |
cf6f77a77975b9b544f849e82b316ff9e4fa6c8a | YJL33/LeetCode | /current_session/python/1465_redo.py | UTF-8 | 761 | 3.515625 | 4 | [] | no_license | """
1465
"""
from typing import List
class Solution:
def maxArea(self, h: int, w: int, hCuts: List[int], vCuts: List[int]) -> int:
maxH, maxW = 0, 0 # max height and width
prevH, prevV = 0, 0 # previous horizontal cut and vertical cut
hCuts.sort()
vCuts.sort()
hCuts... | true |
d01b2a91cfc2100b53a9aa5f193fb636915a6a5b | CEduStartup/Pyxis | /services/service_base.py | UTF-8 | 1,470 | 2.671875 | 3 | [] | no_license | # Base class for all shared services.
# All shared services must be derived from given class.
# Services are run automatically by services/services_launcer.py
import bjsonrpc
import gevent
import zlib
import cPickle
import base64
class SharedService(bjsonrpc.handlers.BaseHandler):
"""Base class for shared service... | true |
b7947a95989cea8333ea4301e396a94dd2f9530b | Malandru/codesignal-tasks | /Arcade/Python/Lambda Illusions/is_test_solvable.py | UTF-8 | 258 | 2.875 | 3 | [] | no_license | def isTestSolvable(ids, k):
digitSum = lambda id: sum(int(d) for d in str(id))
sm = 0
for questionId in ids:
sm += digitSum(questionId)
return sm % k == 0
ids = [529665, 909767, 644200]
k = 3
print(isTestSolvable(ids, k)) | true |
4c28cecd9df1bc764fe0fd1fdfd2d5ddca784968 | nijatmursali/vision-and-perception | /HOMEWORK/HW2/ex_4/ex_4.py | UTF-8 | 1,259 | 2.890625 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
from matplotlib import pyplot as plt
from skimage.filters.rank import entropy
from skimage.morphology import disk
img0 = cv2.imread('images/New-York.jpg', 0)
# converting to gray scale
gray = cv2.cvtColor(img0, cv2.COLOR_BGR2GRAY)
width = 256
height = 256
dim = (width, height)
# resize ... | true |
44d8cb2f8d46cf1ed1cea5c0fa83b0cddd1012eb | BssMsi/mllib | /classification/logistic_regression.py | UTF-8 | 6,366 | 3.3125 | 3 | [] | no_license | import numpy as np
class LogisticRegression:
'''
method:['gd', 'cd', 'bfgs', 'lbfgs', 'liblinear'] - https://stackoverflow.com/questions/38640109/logistic-regression-python-solvers-defintions
https://towardsdatascience.com/dont-sweat-the-solver-stuff-aea7cddc3451
alpha:float - if method is 'gd': Learn... | true |
bb24abdacf82a0c9bf49ca990b63c3c87e08a039 | lemonxug/AutoDealerSpider | /Cache/spiders_v2.0/HyundaiSpider.py | UTF-8 | 2,019 | 2.703125 | 3 | [] | no_license | # coding=utf-8
import json
import requests
from datetime import *
import pandas as pd
from DemoSpider import DemoSpider
today = date.strftime(date.today(), '%Y%m%d')
name = '北京现代'
url = 'https://www.beijing-hyundai.com.cn/datacenter/static/js/District.js'
class HyundaiSpider(DemoSpider):
def __init__(self):
... | true |
866f5f7ac9663a0aa541c45634c416a28e935ffa | yangshuting1/python | /senior/generator.py | UTF-8 | 750 | 4.0625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*
# 在python中,一边循环一边计算的机制,称为生成器
# 把一个列表生成式的[]改成(),就创建了一个generator:
L = [x * x for x in range(10)]
g = (x * x for x in range(10))
# L和g的区别在于:外层[]和(),L是个list,g是个generator
# 获取生成器的返回值
print next(g)
# generator保存的是算法,每次调用next(g),就计算出g的下一个元素的值,直到计算到最后一个元素,没有更多的元素时,抛出StopIterati... | true |
50ab354b49db6eeb26fbd4496f50197204b98edd | BjornH-github/test_webapp | /flaskr/__init__.py | UTF-8 | 1,815 | 2.515625 | 3 | [] | no_license | import os
from flask import Flask
from flask_login import LoginManager
from flask_bcrypt import Bcrypt
from flask_sqlalchemy import SQLAlchemy
from flaskr.development_config import DevelopmentConfig
"""Create the database object"""
db = SQLAlchemy()
bcrypt = Bcrypt()
login_manager = LoginManager()
"""Creating an ap... | true |
80e2598567d4a2cab62a5b996748db9f028e063a | JonasLopesdoO/Machine-Learning-7-Semestre | /Lista 6 - Renda Americanos/ml_libs/resample.py | UTF-8 | 1,931 | 3.40625 | 3 | [] | no_license | import numpy as np
import pandas as pd
class Utils:
def stratify(df):
# The data will be devided in equal length
qtde_por_classe = np.min(df['LABEL'].value_counts())
# obtendo as classes da base de dados
classes = df['LABEL'].unique()
# nesta lista armazena... | true |
293f05544224c85f809ea0b8cc0434cfc9624397 | virtualpeer/trading-ml | /live_trading/notification/send_sms.py | UTF-8 | 739 | 2.578125 | 3 | [] | no_license |
# +12058804170
from twilio.rest import Client
class Send_message:
def __init__(self):
self.account = 'AC7ce530153bf13cc4b5e10f7a951ea8e4'
self.token = 'c09761f603cd6f5d4b49b89d4fd2a448'
self.client = Client(self.account, self.token)
def send_a_message(self, message):
try:
... | true |
f3bf2a10bc2fb4eeb13da81f03fab1b004e915f0 | joyc/python-book-test | /PythonCrashCourse/my_car.py | UTF-8 | 294 | 2.59375 | 3 | [] | no_license | #! python3
# -*- coding:utf-8 -*-
# @Time : 2017/06/04 13:59
# @Author : Hython.com
# @File : my_car.py
# @IDE : PyCharm
from car import Car
my_new_car = Car('Audi', 'A4', 2016)
print(my_new_car.get_descriptive_name())
my_new_car.odometer_reading = 23
my_new_car.read_odometer()
| true |
a24e7fff3373f5a1987adb73f5954b1de540080d | adritoo/wifi-password-sniffer | /pwd.py | UTF-8 | 701 | 2.59375 | 3 | [] | no_license | import subprocess
data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('cp850').split('\n')
wifis = [line.split(':')[1][1:-1] for line in data if "Profil Tous les utilisateurs" in line]
for wifi in wifis:
fichier = open("password.txt", "a")
results = subprocess.check_output(['netsh',... | true |
9342c694e00fb91981a79cebd2594fc688c7f1b4 | knkillname/tomate | /timerview.py | UTF-8 | 4,684 | 2.859375 | 3 | [] | no_license | import datetime
import itertools
import json
import tkinter as tk
from tkinter import font, ttk
class TimerView(ttk.Frame):
def __init__(self, master=None, **kw):
super().__init__(master, **kw)
self.load_settings()
self.current_timer = None
self.started = None
self.duratio... | true |
9245a0aa2acbd9e0135d787af208bcc7aa7260c8 | SwagLag/IntelligentBeesChallenge | /bee_simulation/helpers.py | UTF-8 | 11,022 | 3.046875 | 3 | [] | no_license | import random
import numpy as np
import pandas as pd
import scipy.stats as stats
class Task:
"""
Abstract helper class for designating tasks that agents have
to complete. Agent interpretation should be handled by assigning
a unique task type to each object, and assigning unique attributes
... | true |
d7f7233342a5151ba4d703062071a70ca4180281 | gblanchard4/taxa_collapser | /taxa_collapser.py | UTF-8 | 2,988 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
import argparse
import sys
from collections import defaultdict
from operator import add, div, mul
__author__ = "Gene Blanchard"
__email__ = "me@geneblanchard.com"
'''
Collapse OTUs Based on Taxa Assignments
p.s. this makes me feel dirty :(
'''
def check_biom_format(biomfile):
with open(bio... | true |
b4c2f00e2f19883a0171bcdcfd34b936d8d4ce69 | imwujue/python-practice-wujue | /Q86.py | UTF-8 | 58 | 2.90625 | 3 | [] | no_license | str1 = "hello"
str2 = "wujue"
str = str1 + str2
print(str) | true |
7bf9b488a4d483950d034d263c362d5f719694b5 | mf222/Cineplanner-Hackathon-Facebook-Chile-2016- | /KTscrappingHoyts.py | UTF-8 | 1,199 | 2.90625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
url = "http://www.cinehoyts.cl"
# Realizamos la petición a la web
req = requests.get(url)
statusCode = req.status_code
print(statusCode)
if statusCode == 200:
html = BeautifulSoup(req.text, "html.parser")
#print(html.prettify().encode('UTF-8'))
lista_pelis = h... | true |
bd0f6a8d681169a4a697cb0969251a4e98bca894 | shivachoudhary/demo1 | /evenodd.py | UTF-8 | 137 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | #usr/bin/python
a=input("enter the value of a:::")
#b=input("enter the b value b::::")
if a%2==0 :
print "even"
else :
print "odd"
| true |
ea49bc34909d0535680ae6136552e14eb74f3be6 | luhralive/python | /will/0002/into_mysql.py | UTF-8 | 1,142 | 3.234375 | 3 | [] | permissive | # 第 0002 题: 将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。
'''
相关模块/库 : pymysql
1. http://www.runoob.com/python3/python3-mysql.html
'''
import random, string, time, math, uuid, pymysql
chars = string.ascii_letters + string.digits
def gen1():
key = ''.join(random.sample(chars, 10))
#key2 = ''.join(r... | true |
c19ae7065076fdf48dc1dcbc9a28b78a247aa1ef | gjeon03/study_ct | /greedy/chapter3_02.py | UTF-8 | 848 | 3.28125 | 3 | [] | no_license | n, m = map(int, input().split())
"""" my code 1
arr = []
result = 0
for i in range(n):
arr.append([])
arr[i] = input().split()
for i in range(n):
for j in range(m):
arr[i][j] = int(arr[i][j])
min = 10000
for j in range(m):
if min > arr[i][j]:
min = arr[i][j]
if min > result:
result = min
print(result... | true |
07eb85d356ddb8821a284d6657bbe6d2b64d9416 | jtrivlidis/Projects | /world bank countries data set.py | UTF-8 | 897 | 2.9375 | 3 | [] | no_license | import requests
csv_url = 'https://assets.datacamp.com/production/repositories/287/datasets/5b1e4356f9fa5b5ce32e9bd2b75c777284819cca/gapminder.csv'
req = requests.get(csv_url)
url_content = req.content
csv_file = open('Gapminder.csv', 'wb')
csv_file.write(url_content)
csv_file.close()
# Dataset in use is the world b... | true |
0f3ae2502dd48abea4a6a6b28bf32c8d29445651 | benquick123/code-profiling | /code/batch-2/vse-naloge-brez-testov/DN12-M-097.py | UTF-8 | 1,682 | 2.828125 | 3 | [] | no_license | #coding=utf-8
#from __future__ import unicode_literals
def preberi(ime_datoteke):
i = 1
slv = {}
for vrstica in open(ime_datoteke) :
vrstica = vrstica.strip()
tab = vrstica.split(" ")
tab = [int(i) for i in tab]
najm = min(tab)
while (najm != tab... | true |
4f3e60fa0979e1e9a26369091f338c47559cf38c | gem5/gem5 | /src/systemc/tests/tlm/endian_conv/testall.py | UTF-8 | 17,187 | 2.765625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license",
"LGPL-2.0-or-later",
"MIT"
] | permissive | """
/*****************************************************************************
Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
more contributor license agreements. See the NOTICE file distributed
with this work for additional information regarding copyright ownership.
Accellera lice... | true |
a85465ba42b5c5b33c4b22cb86862e28d690f7b5 | Wojcik98/evolutionary-decision-tree | /node.py | UTF-8 | 2,100 | 3.34375 | 3 | [] | no_license | # Autor: Michał Wójcik
from random import choice, randrange, random, uniform
from typing import List, Tuple
import numpy as np
class Node:
def __init__(self):
self.parent: Node = None
self.attribute = None
self.threshold = None
self.child_yes: Node = None
self.child_no: No... | true |
3f6796385d313a92d1831885c4a7ff6b1e539777 | Ketupat-Development-Studios/lumos-api | /api/area_blueprint.py | UTF-8 | 1,194 | 2.640625 | 3 | [] | no_license | from copy import copy
from flask import Blueprint, jsonify, request, abort
from repos.area_repo import AreaRepo
from models.area import Area
def construct_area_blueprint(database):
area_blueprint = Blueprint(__name__, 'area', url_prefix='/areas')
area_repo = AreaRepo(database)
@area_blueprint.route('/',... | true |
6f8666d47d035c5477acacc836dd9bc5696bf6ad | chiragJKL/PYTHON | /Chepters/chepter 6 Conditional expression/06_12_harry.py | UTF-8 | 238 | 4.09375 | 4 | [] | no_license | # find if the text has "harry" or not
a = "harry"
b = input("enter = ")
if a.upper() == b.upper(): # by this we are conerting both a,b in same text to compare
print('Both Strings are same')
else:
print('Strings are not same')
| true |
dea1aed2e41596e9edee51cdaf70f9a80729bc63 | littleneo/Blender-Exchange-Layer | /bel/uv.py | UTF-8 | 2,155 | 2.59375 | 3 | [] | no_license | from mathutils import Vector
import bel
def write(me, uvs, matimage = False) :
uvs, nest = bel.nested(uvs)
newuvs = []
for uvi, uvlist in enumerate(uvs) :
uv = me.uv_textures.new()
uv.name = 'UV%s'%uvi
for uvfi, uvface in enumerate(uvlist) :
#uv.data[uvfi].use_... | true |
63e1d4009c6b88636ecd6ab888eb289672dd7e3b | afcarl/sketches | /sketches/countmin.py | UTF-8 | 1,002 | 3.203125 | 3 | [] | no_license | import numpy as np
import unittest
from .hashing import sha1_32
class CountMin(object):
def __init__(self, d, w):
self.d = d
self.w = w
self.estimators = np.zeros((d, w))
self.p = 2**31 - 1
self.a = np.random.randint(0, self.p, size=self.d)
self.b = np.random.randi... | true |
c1dd30ac038840de36e5370e42570668ec6da3f7 | vigusmao/vigusmao.github.io | /python/randomized-watermark.py | UTF-8 | 2,621 | 3.671875 | 4 | [] | no_license | #!/usr/bin/env python3
"""Randomized codec for graph-based
software watermarking
"""
from random import randint
def encode(key):
"""Translates the given key onto the
randomized watermark graph.
"""
binary = bin(key)[2:]
n = len(binary)
S = [[0],[]]
A = [0] + [None] * (n-1)
back_... | true |
bc9b338751257bde29f9b6c42383567cd0a1bed9 | denvercoder9/python | /bin/split_path.py | UTF-8 | 284 | 2.671875 | 3 | [] | no_license | """Pipe a string to split it at each colon
Indended mainly to be used with $PATH - you'd think there'd be an easier way
to do this...
"""
import sys
import itertools
print '\n'.join(itertools.chain.from_iterable(line.split(':')
for line in sys.stdin.readlines()))
| true |
2a42a5eda70d7209c124e6ab6f25c16db937fe7f | gkcsjk/TixBlock_2.0 | /myPayment.py | UTF-8 | 6,085 | 2.6875 | 3 | [] | no_license | import paypalrestsdk
import logging
# from paypalrestsdk import Payment
# logging.basicConfig(level=logging.INFO)
"""
TODO:
1. Items can be more than 1. Need to edit the way we calculate total.
2. Items need to be placed in one function. Hence we can call both for authorize and payment functions.
3. URL redirect to ... | true |
78041414dd398e98311d74c63c804a312fcdf7a1 | FakeEmperor/crypto-lfsr-math | /kily/math/dft.py | UTF-8 | 4,451 | 3.390625 | 3 | [] | no_license | # @ see: http://vkedco.blogspot.ru/2014/07/fast-multiplication-of-polynomials-with.html
import cmath
import copy
# check if n is a power of 2.
def is_pow_of_2(n):
return n & (n-1) == 0
# formula for the n-th complex root of unity on p. 784 of Cormen's Algorithms book
# the only addition is the error argument:... | true |
61efaeb3b7d67333d1f00029640679ed857aeaea | maxym-ko/cyb_python | /1_course/1_semester/lessons/lesson10_2.py | UTF-8 | 509 | 3.34375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def f(x):
return res[0] * x + res[1]
data = np.array([(6, 100), (14, 150), (18, 200), (20, 250), (22, 300), (23, 350)])
data_x = []
data_y = []
for el in data:
data_x.append(el[0])
data_y.append(el[1])
x = np.vstack((np.asarray(data_x), np.ones(len(d... | true |
8e3c9a48ebba38b391242a1d73fe22f8ebc3eacc | justinmae/Python_Programming_Essentials | /Ch04-Lists_Tuples_Dictionaries/ch04_2_for_continue.py | UTF-8 | 243 | 3.78125 | 4 | [] | no_license | #! /usr/bin/env python3.6
"""
Program: ch04_2_for_continue.py
Function: Explor the for command
"""
p = "Plum Lucky!"
for i in p:
if i in 'aieou': continue
print( i.upper())
print( "i = ", i)
print( "That's all folks!")
| true |
c15c6fc879068f7fcc1e8e57b97e63abaa83d261 | leogtzr/python-cookbook-code-snippets | /strings_and_text/sanitizing3.py | UTF-8 | 524 | 2.90625 | 3 | [] | no_license | import unicodedata
import sys
# s = 'pýtĥöñ\fis\tawesome\r\n'
# remap = {
# ord('\t'): ' ',
# ord('\f'): ' ',
# ord('\r'): None # Deleted
# }
# a = s.translate(remap)
# cmb_chrs = dict.fromkeys(c for c in range(
# sys.maxunicode) if unicodedata.combining(chr(c)))
# b = unicodedata.normalize('NFD... | true |