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 |
|---|---|---|---|---|---|---|---|---|---|---|
93c62d85fc29b7411ba5e33d8a4018fcfcf1b740 | SWHL/image_augmentor | /img_aug_offline/img_aug_offline.py | UTF-8 | 5,832 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # !/usr/bin/env python
# -*- encoding: utf-8 -*-
# @File: main.py
import os
import re
import sys
import traceback
from multiprocessing.dummy import Pool
from os.path import isfile
import cv2
try:
from .counter import Counter
from .ops.blur import Blur
from .ops.fliph import FlipH
from .ops.flipv impor... | true |
8c63a211f9498ec6386e9000dafa87e64bf3d79d | lichuan89/neural_network_note | /nn_NeuronNetwork.py | UTF-8 | 21,699 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf8 -*-
"""
@author lichuan89@126.com
@date 2016/09/12
@note
"""
import base64
import numpy as np
import itertools
import math
import sys
import collections
from common import str_2_json, json_2_str, file_2_str, str_2_file
from nn_activation import logistic
from nn... | true |
3ed22fe83fc6dfdb0f57b6fcab659c5ac0369033 | Star-Coder-7/FunGames | /Checkers/checkers.py | UTF-8 | 1,266 | 3 | 3 | [] | no_license | import pygame
from constants import WIDTH, HEIGHT, SQ_SIZE, GREEN, BLUE
from checkers_game import Game
from checkers_AI import minimax
pygame.init()
MAX_FPS = 60
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('CHECKERS')
def getRowColFromMouse(pos):
x, y = pos
row = y // SQ_SIZE
... | true |
36b3696a63b7ee71d2395fff626bbc29992fc9e0 | thisishuzaifa/textencoding | /morseTo8utf.py | UTF-8 | 1,384 | 3.203125 | 3 | [
"MIT"
] | permissive | import os
import re
import sys
file = open('testfilem.txt','r')
input_text = file.read()
print(input_text)
morse_alphabet = {'A':'.-', 'B':'-...','C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....','I':'..', 'J':'.---', 'K':'-.-',
'L':'.-..', 'M':'--', 'N':'-.... | true |
f2031eeb50196eaddb819d2604f48014be81a8ea | harshitaggarwal-1999/python | /simple calculator.py | UTF-8 | 6,850 | 3.21875 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
t=Tk()
t.title("Calcy")
t.geometry("260x390")
e1=Text(t,height=2,width=27)
e1.place(x=20,y=30)
def Equal():
s1 = e1.get('0.0',END)
s1 = s1[0:len(s1)-1]
s2 = s1
s2 = s2.replace('+',',')
s2 = s2.replace('-',',')
s2 = s2.replace('*',',')
s2... | true |
39d77f7a9c5f706bd87b1583d870dbf019a17b37 | Vital-Fernandez/vital_tests | /pyConES19/presentation/animationPendulum.py | UTF-8 | 5,100 | 2.515625 | 3 | [] | no_license | import math
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib
import matplotlib.pyplot as plt
import os
background = np.array((43, 43, 43))/255.0
foreground = np.array((179, 199, 216))/255.0
red = np.array((43, 43, 43))/255.0
yellow = np.array((191, 144, 0))/255.0
figConf = {'text.color': for... | true |
af976d648301a85c4d11d59c6763c409ff7b83af | bnhalder/basic_ml | /kemansnet/kmeans.py | UTF-8 | 1,995 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 22 17:22:41 2017
@author: jabong
"""
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 22 16:59:42 2017
@author: jabong
"""
import numpy as np
class kmeans:
def __init__(self, k, data):
self.nData = np.shape(... | true |
3e1637828b5abaf223e14d8a59dfaa86844aac20 | lakshay1296/OCR_Conversion_JPEG2PDF | /GUI.py | UTF-8 | 2,992 | 3.09375 | 3 | [] | no_license | """
pack manger parameters: -after, -anchor, -before, -expand, -fill, -in, -ipadx, -ipady, -padx, -pady, or -side
anchor params: n, ne, e, se, s, sw, w, nw, or center
grid param: -column, -columnspan, -in, -ipadx, -ipady, -padx, -pady, -row, -rowspan, or -sticky
"""
from tkinter import *
from tkinter.filed... | true |
e6f31eb2648d080f73f25cd135d7390696f031a6 | Threesomes/fastText | /fasttext_0.7861_20180720/compute_accuracy.py | UTF-8 | 1,935 | 3.140625 | 3 | [] | no_license | import fastText
import os
def print_results(N, p, r):
print("N\t" + str(N))
print("P@{}\t{:.3f}".format(1, p))
print("R@{}\t{:.3f}".format(1, r))
def load_model(model_path):
model = fastText.load_model(model_path)
return model
def read_data(path):
"""读取txt,返回两个列表,一个是sentence list[],一个是labe... | true |
48298c8fb54e2ebd74ca4e979f1e102f0e242a03 | shaojs/NessusAPI | /Nessus.py | UTF-8 | 9,028 | 2.625 | 3 | [] | no_license | import requests
import json
import sys
class Nessus:
def __init__(self, url):
self.url = url
self.username = None
self.password = None
self.token = None
self.secretKey = None
self.accessKey = None
def login(self, username, password):
"""
Function to log in and set class token values... | true |
9996729c8a28e253b13bb1ac1f88aa8fd3c76c9a | adafruit/circuitpython | /tests/basics/frozenset_binop.py | UTF-8 | 1,227 | 3.21875 | 3 | [
"MIT",
"GPL-1.0-or-later"
] | permissive | try:
frozenset
except NameError:
print("SKIP")
raise SystemExit
sets = [
frozenset(), frozenset({1}), frozenset({1, 2}), frozenset({1, 2, 3}), frozenset({2, 3}),
frozenset({2, 3, 5}), frozenset({5}), frozenset({7})
]
for s in sets:
for t in sets:
print(sorted(s), '|', sorted(t), '=', so... | true |
16fa38ec6603b85ff66e309ccd2f9572581ae7b7 | AnanthakrishnanAG/COVID-19 | /corona.py | UTF-8 | 1,403 | 2.90625 | 3 | [] | no_license | from selenium import webdriver
from twilio.rest import Client
import time
class Coronavirus():
def __init__(self):
chromedriver = 'C:\CHROMEDRIVER\chromedriver'
self.driver =webdriver.Chrome(chromedriver)
cor=Coronavirus()
def corrun(cor):
cor.driver.get('https://www.worl... | true |
ff9ddd29c776f0c682f64d75d9d02a95aec4d5ca | fyuval/nerds | /nerds_orig/test/test_dictionary_ner_model.py | UTF-8 | 2,963 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | from nose.tools import assert_equal, assert_in, assert_true
from nerds.core.model.input.annotation import Annotation
from nerds.core.model.input.document import AnnotatedDocument, Document
from nerds.core.model.ner.dictionary import ExactMatchDictionaryNER
from nerds.core.model.ner.dictionary import ExactMatchMultiCla... | true |
bc2e8e1789e075ed5e10edc9939b0ef84c4e5c45 | sankalp7654/HackerRank | /Python/Power - Mod Power/Solution.py | UTF-8 | 181 | 3.390625 | 3 | [
"MIT"
] | permissive | #author SANKALP SAXENA
# Enter your code here. Read input from STDIN. Print output to STDOUT
a = int(input());
b = int(input());
n = int(input());
print(a**b, pow(a,b, n), sep = '\n'); | true |
d02dcaae6f3307facae57d91171f87ad42ee39f4 | dambergn-codefellows/py401_data-structures-and-algorithms | /challenges/reverse_array/reverse_array.py | UTF-8 | 530 | 3.890625 | 4 | [
"MIT"
] | permissive | input_list = [1, 2, 3, 4]
# def reverse_array(input_list):
# for i in range(0, (len(input_list) // 2)):
# input_list[i], input_list[i-1] = input_list[i-1], input_list[i]
# return input_list
def reverse_array(arr):
if type(arr) is not list:
raise TypeError('There was an error')
mid = len(arr) // 2
... | true |
a20bd10cc949fcedacfb3e5f2a02b7ff44bbdd83 | jamestonkin/knoxpy-serverless | /flask/service.py | UTF-8 | 2,127 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
from flask import Flask, request
import json
import random
from uuid import uuid4
app = Flask(__name__)
app.url_map.strict_slashes = False
def return_string(retval):
'''Prepares retval data structure to be returned to client.
If the User-Agent string indicates a browser, we will prepa... | true |
4326a0111d21cd3946dc7dd53546274383ca5f93 | VolkUralskiy/Continers | /Zadacha_13.py | UTF-8 | 489 | 3.484375 | 3 | [] | no_license | n = int(input())
if n >= 1 and n <= 4:
print('несколько')
elif n >= 5 and n <= 9:
print(' немного')
elif n >= 10 and n <= 19:
print(' отряд')
elif n >= 20 and n <= 49:
print(' толпа')
elif n >= 50 and n <= 99:
print(' орда')
elif n >= 100 and n <= 249:
print('множество')
elif n >= 250 and n <= ... | true |
be24816aa80f928dba9a40f0419c0ff96b762436 | xufeixxff/DIY_Function | /majiong/majiang.py | UTF-8 | 7,647 | 3.25 | 3 | [] | no_license | # coding=utf-8
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from os import listdir
import random
from collections import Counter
from os.path import isfile, join, getsize
'''this function is created to achieve a majiong game'''
def card_store_create():
card_store = []
'''card announc... | true |
d93495abc63b4ad8f74efa4e7ce123d6e7a4c22a | LucasFerreira06/Exercicio1---Prova-2BIM | /questao14.py | UTF-8 | 412 | 3.921875 | 4 | [] | no_license | Numero = int(input("Digite um número:"))
Quantidade = 0
Pares = 0
Impares = 0
while(Quantidade <= 9):
if (Numero % 2 == 0):
Pares = Pares + 1
else:
Impares = Impares + 1
if (Quantidade < 9):
Numero = int(input("Digite um número:"))
Quantidade = Quantidade + 1
print("A quantidade... | true |
bfc3579d745a711fcb366cf1546c5036b1eff3ab | tuestudy/ipsc | /2012/A/haru.py | UTF-8 | 551 | 3.234375 | 3 | [
"MIT"
] | permissive | import re
H_CANDY = re.compile('>o<')
V_CANDY = re.compile('vo\^')
def count_candy(p, box):
return sum(len(p.findall(x)) for x in box)
def main():
t = input()
for _ in range(t):
raw_input()
r, c = raw_input().strip().split()
rows = []
cols = [''] * int(c)
for _ i... | true |
9008f5685cffa887d8d6c329f87ba17310c898ed | vishwatejn/CPprograms | /Monk Takes a Walk.py | UTF-8 | 173 | 3.046875 | 3 | [] | no_license | l=["a","e","i","o","u","A","E","I","O","U"]
for _ in range(int(input())):
ans=0
s=input()
for i in s:
if i in l:
ans+=1
print(ans) | true |
c8f9829d7e19cb71afacdfca04805e997a4cefdf | mark-ni/competitive-programming | /codeforces/20.03.23.B.py | UTF-8 | 767 | 2.828125 | 3 | [] | no_license | from sys import stdin
input=stdin.readline
def getAns(n,p):
visited=[False]*(n+1)
index=-1
for i in range(n):
j=1
while j < p[i][0] + 1 and visited[p[i][j]]:
j+=1
if j == p[i][0] + 1:
index=i
else:
if p[i][0] > 0:
visited[p[... | true |
f72dac44e537441ceb2a941a4dd9d761062b6a7c | feitianyiren/TaskCoach | /.svn/pristine/f7/f72dac44e537441ceb2a941a4dd9d761062b6a7c.svn-base | UTF-8 | 16,721 | 2.859375 | 3 | [] | no_license | import test, patterns
class EventTest(test.TestCase):
def testEqualWhenAllValuesAreEqual(self):
self.assertEqual(patterns.Event(self, 'eventtype', 'some value'),
patterns.Event(self, 'eventtype', 'some value'))
def testUnequalWhenValuesAreDifferent(self):
self.assertN... | true |
0a677a5a19bff5673303103f9b83f25d1707feb8 | moneymashi/SVN_fr.class | /pythonexp/a08_numpy2/a06_pickle.py | UTF-8 | 1,581 | 3.625 | 4 | [] | no_license | '''
Created on 2017. 7. 27.
@author: kitcoop
객체를 파일로 저장할 때, 장점..
1) 파일에 특정데이터를 로딩하지 않고도, 객체단위로 바로 활용
파이선에에 객체를 파일로 저장 할때, 사용되는 모듈
1) 피클링 모듈, DBM 관련 모듈
2) [피클링 모듈]은 임의의 파이썬 객체를 저장하는 가장 일반화된 모듈
피클링(pickle)를 통한 저장처리..
1) pickle.dump(출력할 객체, 파일객체)
피클링을 통해 읽어오기..
1) pickle.load(파일객체) : 객체를 1개씩 읽기.
2) p... | true |
fd52cf23fece7c5546e85c79d2921df0efaa5fdd | anuj8june/dataquest_projects | /Guided Project- Working With Data Downloads/read.py | UTF-8 | 172 | 2.53125 | 3 | [] | no_license | import pandas as pd
contents = pd.read_csv("CRDC2013_14content.csv")
print(contents.head())
print("########################################")
print(contents.columns.values) | true |
cbc2b6b0ed8e203657880e6cd142d8d23432bf02 | jacatral/School-Bus-Route-Scheduler | /source/bus_route_data_processor.py | UTF-8 | 4,485 | 3.25 | 3 | [] | no_license | import csv
import math
import numpy as np
import random
from pathlib import Path
def constrained_sum_sample_pos(n, total):
"""Return a randomly chosen list of n positive integers summing to total.
Each such list is equally likely to occur."""
dividers = sorted(random.sample(range(1, total), n - 1))
re... | true |
112cfb44233144bb85cc86deb7c738cc299d5d13 | goldenhairs/bonds_reminder | /get_all_data.py | UTF-8 | 609 | 2.828125 | 3 | [] | no_license |
"""获取数据"""
import json
import requests
def get_data(url):
try:
header = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
}
response = requests.get(url, headers=header)
status_co... | true |
562e9c6166e0e92d8876de8a66c4c987d2603a65 | KedarnathSahu/Smart-Mirror | /Smart Mirror/AI-Smart-Mirror/AI-Smart-Mirror-master/hhsmartmirror/bin/gtts-cli.py | UTF-8 | 1,780 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/home/pi/Downloads/AI-Smart-Mirror/AI-Smart-Mirror-master/hhsmartmirror/bin/python
from __future__ import print_function
from gtts import gTTS
from gtts import __version__
import sys
import argparse
import os
import codecs
def languages():
"""Sorted pretty printed string of supported languages"""
return ", ... | true |
332bc19714fc1c0b4676ebf86c68dfa05da8d3c4 | liujianpc/pythonScript | /test_try.py | UTF-8 | 129 | 3.03125 | 3 | [] | no_license | while 1:
try:
n = int(raw_input("input an integer:"))
print n
except:
print "error!try again!"
| true |
b9019e59bfe291e4f6d05d060b2209ace8e1c8b6 | YasumaTakahiro/python_rensyuu | /26 集合型を使ってみよう.py | UTF-8 | 2,782 | 4.34375 | 4 | [] | no_license | # さて、次はセットについて見ていきましょう。
# リストやタプルは順序付きのデータを扱うものでしたが、セットは順番がなくて、そして重複を許さないデータ構造になります。
# 例を見ていきましょう。
# では今回、単純に a というセットを作ってみます。
# セットを作るには a = set([]) としてあげて [] の中に要素を入れていくか、もしくはもっとシンプルに a = {} で要素を並べていけば OK です。
# ここで、セットでは重複が許されないので、最後の 5 は無視されるはずです。
# あとで確認するとして、とりあえず print(a) としておきましょう。
# それから、リストと違って順番を持たないので、何番目の要素... | true |
ecc649d076a47647a7cb964d86fbcb06d0afa84b | sharf/hello_python | /pipes/steps/date.py | UTF-8 | 625 | 3.296875 | 3 | [] | no_license | import logging
import datetime
class Step(object):
#Appends date to input string
#Input:string
#Output:string:MM-DD-YYYY
def run(self, input):
try:
today = datetime.datetime.now()
#Operations performed inside the if block are only valid for input as a dict of str values
if type(input) i... | true |
856b3e8c4829b644bfcfb77bb29374bed2994886 | ArchiveTeam/WebArchiver | /webarchiver/database.py | UTF-8 | 4,566 | 3.03125 | 3 | [] | no_license | """Databases used in webarchiver."""
import logging
import os
import sqlite3
logger = logging.getLogger(__name__)
class BaseDatabase:
"""The base class for the database."""
def __init__(self, path, synchronous, journal_mode):
"""Inits the database.
The database is created at the path with `... | true |
3c95e29a101f7be8fcd78661a84d48d186dc9ac3 | coder-RT/AlgoExpert | /sumUpToTwoPointer.py | UTF-8 | 522 | 3.71875 | 4 | [] | no_license | #! /usr/bin/python
#-*- coding: utf-8 -*-
#Time O(N) | Space O(N)
def twoNumberSum(array, targetSum):
# Write your code here.
array.sort()
left = 0
right = len(array) - 1
while left < right:
sum = array[left] + array[right]
if sum > targetSum:
right -= 1
if sum < targetSum:
left += 1
if sum == ... | true |
46fb0e93905b9716135c3bcae43ace1460f5cffa | TLeben/compilerContruction | /unstructorFlow.py | UTF-8 | 2,045 | 2.515625 | 3 | [] | no_license | from selector3 import *
from x86AST import *
import string
import random
class FlowStripper:
_labelCount = 0
def getLabel(self, lbl):
return '{}{}'.format(lbl, self._labelCount)
def getRandLabel(self, length=6):
return ''.join(random.choice(
string.ascii_lowercase +
... | true |
6026b9dd2403bfd4d8ef0cc1996e637074d5ef42 | oweson/python-river-master | /第一天/常见的数据类型的转换.py | UTF-8 | 79 | 2.84375 | 3 | [] | no_license | a = 100
b = int(100.10)
print(b,hex(16))
'''int把数据转换为int类型'''
| true |
7ccd475d50398647b0cf148ba5aadbcc81ec1223 | albert-zhao/py_code | /test-cla-use/inheritance-use.py | UTF-8 | 579 | 3.140625 | 3 | [] | no_license | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
class Filter:
def init(self):
self.blocked = []
def filter(self, seq):
return [x for x in seq if x not in self.blocked]
class SpamFilter(Filter):
def init(self):
self.blocked = ['SPAM']
f = SpamFilter()
f.init()
print(f.filter(['SPAM... | true |
dc79293c7746195a902c1369af17a51a919bba44 | Rameshganesan/Mypython | /palindrom.py | UTF-8 | 272 | 3.671875 | 4 | [] | no_license | import sys
def palind(ptext):
pal=''
for i in range(len(ptext)-1,-1,-1):
pal=pal+ptext[i]
return pal
if __name__ == "__main__":
k = palind('SAS')
if ( k == 'SAS'):
print('Its a palindrome')
else:
print('Its not a palindrome')
| true |
5cf50fc9c82fa34215b2df4d638d559dc893e7e8 | lyashevska/DataProcessOto | /processing.py | UTF-8 | 884 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
import re
import os
from glob import glob
import csv
# change dir
dirname = os.path.dirname(__file__)
datadir = os.path.join(dirname,'data')
os.chdir(datadir)
filenames = glob('*.txt')
results = []
for i in range(len(filenames)):
f = open(filenames[i], 'r')
lines = f.readlines()
#... | true |
2b598878daad62779310818bbaf1e20d104ed1c0 | COVID2019-app/server | /data/updates/toJson.py | UTF-8 | 332 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | import csv , json
pathToCsv = 'data.csv'
pathToJson = 'data.json'
data = {}
with open(pathToCsv) as csvFile:
csvReader = csv.DictReader(csvFile)
for rows in csvReader:
id = rows['id']
data[id] = rows
with open(pathToJson,'w') as jsonFile:
jsonFile.write(json.dumps(data,ind... | true |
38a100ce18aa805724fe6e3319060d8cffb1bf0c | Romnako/BD_PyQT_Python_GeekBrains | /Lesson_5_Sarmanov_EF/client/client_gui.py | UTF-8 | 3,718 | 2.671875 | 3 | [] | no_license | """ описание классов окон клиента """
import sys
import logging
from PyQt5.QtWidgets import QWidget, QApplication, qApp, QMainWindow, QDialog
from PyQt5 import uic
logger = logging.getLogger('client')
# функция перенесена
#class UI_MainClientWindow(QMainWindow):
# def __init__(self):
# super().__init__()
# ... | true |
fcf75ded84239fae8d9af31dff3498b1c56c2c88 | liyingxiong/cbfe | /cbfe/cbfe/matseval_nonlinear_hardening.py | UTF-8 | 3,793 | 2.515625 | 3 | [] | no_license | '''
Created on 12.01.2016
@author: Yingxiong
'''
from traits.api import implements, Int, Array, HasTraits, Instance, \
Property, cached_property, Constant, Float, List
import numpy as np
from scipy.misc import derivative
class MATSEvalNH(HasTraits):
E_m = Float(28484, tooltip='Stiffness of th... | true |
943de61da3a6a6dd6cf9fdfff3bbca22283b8d1e | windorchidwarm/py_test_project | /hugh/onon/guiyang/test_plot.py | UTF-8 | 2,309 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -- coding: utf-8 --#
# @Time : 2020/3/9 16:09
# @Author : Aries
# @Site :
# @File : test_plot.py
# @Software: PyCharm
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm #字体管理器
import os
COMPONENT_PATH = os.path.join(os.path.dirname(os.path.realpath... | true |
6aed292c0889942755dde874d2099efda3396451 | carolyn-brodie/Summer2021 | /controlledEnviroment/GUIpackage/Classes/patientSimulatorClass.py | UTF-8 | 6,661 | 2.765625 | 3 | [] | no_license | from GUIpackage.Classes.LetterToCharactersClass import LetterToCharacters
import random
import datetime
from GUIpackage.sysVar import application_path
class PatientSimulatorClass():
def __init__(self):
self.LTCC = LetterToCharacters()
self.listAlph = list(self.LTCC.alphabet.keys())
self.list... | true |
f50b98ea7c8785a44a382457cd5b396c9d0d3f59 | MSSERG/fpn | /ASCII.py | UTF-8 | 281 | 3.859375 | 4 | [] | no_license | print( '\n Перевод символов в ASCII код.\n' )
while True:
try:
text = input( ' Введите любое значение:' )
for l in text:
print( ' ', l, '=', ord( l ), '\a' )
except IOError as qwerty:
text = '0' | true |
6879e46b9ad77123f91c07f9a752df1330b7032e | wan-catherine/Leetcode | /problems/N130_Surrounded_Regions.py | UTF-8 | 3,403 | 3.1875 | 3 | [] | no_license | class Solution(object):
def solve_before(self, board):
"""
:type board: List[List[str]]
:rtype: None Do not return anything, modify board in-place instead.
"""
self.board = board
if not self.board or not len(self.board) or not len(self.board[0]):
return
... | true |
5fdfeb87e5abbc38d0d428b69c58a31a4638e66c | nachereshata/HedUtils | /src/hed_utils/support/persistence/file_sys.py | UTF-8 | 1,923 | 2.625 | 3 | [
"MIT"
] | permissive | from datetime import datetime
from pathlib import Path
from shutil import copyfile, copytree
from tempfile import gettempdir
from typing import Union
from hed_utils.support import log
@log.call
def get_utc_timestamp() -> str:
return datetime.utcnow().strftime('%Y-%m-%d_%H_%M_%S_%f')
@log.call
def get_tmp_locat... | true |
661c79ebb70b3cc0030f0aa718e400eef0bdfa1d | gauravshrma/DS-and-Algo-in-Python | /Sorting Algos/shell_sort.py | UTF-8 | 422 | 3.484375 | 3 | [] | no_license | def shellsort(arr):
gap = len(arr)//2
while gap>0:
for i in range(gap,len(arr)):
j = i - gap
temp = arr[i]
while j>=0 and arr[j]>temp:
arr[j+gap] = arr[j]
j -= gap
arr[j+gap] = temp
gap = gap//2
print(arr)
if __... | true |
7a6621e0940c430e8b6efa4d907dbded75d070ae | shjoshi/vispy | /examples/basics/visuals/reactive_polygon.py | UTF-8 | 1,478 | 2.890625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-public-domain"
] | permissive | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Simple demonstration of PolygonVisual.
"""
import numpy as np
import vispy.app
from vispy import gloo
from vispy.scene import visuals
# vertex positions of data to draw... | true |
e001d05304138502afe636a9244edb4d8d853711 | chaoos/numerik | /least_squares_non_linear_test.py | UTF-8 | 6,403 | 2.890625 | 3 | [
"BSD-3-Clause"
] | permissive | from numpy import *
from scipy.constants import c
import scipy.stats as stats
from numpy.linalg import lstsq, norm
from matplotlib.pyplot import *
from matplotlib.mlab import find
from least_squares_linear import *
from least_squares_non_linear import *
#Assignment 09,2 as a test (GPS)
def gn(x, F, J, tol=1e-6, maxi... | true |
7242c2711d1fffa4c0f3300a7d176f465bf07f43 | bcornw2/InfoSec_IQ_api_scripts | /conversion.py | UTF-8 | 2,939 | 2.5625 | 3 | [] | no_license | import csv
import os
from pathlib import Path
home = str(Path.home())
path = os.path.join(home, "temp")
print("Working Directory: " + path)
suffix_array = ["jr", "sr", "ii", "iii", "iv", "v", "vi", "vii", "iix" "ix", "x", "esq", "esq."]
with open(os.path.join(path, "InfoSecEmployeesReport.csv"), newline='', en... | true |
26bbaa913a8a39cfc1a2919912782102c42033d7 | cristianornelas/Semasimi | /src/pmi.py | UTF-8 | 1,990 | 3.0625 | 3 | [] | no_license | import codecs
import sys
import math
import numpy as np
from sklearn import preprocessing
def calc_pmi(pFreq, pOutput):
WORDSCOUNTED = pFreq
DESTFOLDER = pOutput
#Websize is the number of words in the wikipedia corpus,
#run wc -w < wikipedia to get the number of words, extract tags
WEBSIZE = 294000000.0
#Ope... | true |
8054f6e1cbaa8d464820edc1c2781a24706f344c | approvals/ApprovalTests.cpp | /build/tests/test_multiline_string_utilities.py | UTF-8 | 2,160 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import unittest
import textwrap
import inspect
from approvaltests.approvals import verify
from scripts.multiline_string_utilities import remove_indentation, remove_indentation_from
from tests.helpers import diff_merge_reporter
class TestMultilineStringUtilities(unittest.TestCase):
def test_remove_indentation_fr... | true |
f32b576879903a189af48a91f3ed46830b788e74 | charles-wangkai/exercism | /python/ocr-numbers/ocr_numbers.py | UTF-8 | 1,023 | 2.890625 | 3 | [] | no_license | IMAGES = [
[' _ ',
'| |',
'|_|',
' '],
[' ',
' |',
' |',
' '],
[' _ ',
' _|',
'|_ ',
' '],
[' _ ',
' _|',
' _|',
' '],
[' ',
'|_|',
' |',
' '],
[' _ ',
'|_ ',
' _|',
' '],
[' _ ',
... | true |
346820fc3a5d65c8f6828d19bacb9ca61225929f | AnastasiaYiChen/Python | /mongo/age_grumpy.py | UTF-8 | 1,499 | 2.71875 | 3 | [] | no_license | __author__ = 'Anastasia'
from pymongo import MongoClient
# cli = MongoClient('172.16.176.30')
# cli = MongoClient()
cli = MongoClient('mongodb://student:mongoose@172.16.176.24/movieDB')
# cli=MongoClient('mongodb://student:mongoose@172.16.176.30/movieDB')
# cli=MongoClient('mongodb://student:mongoose@172.16.176.24/mo... | true |
9bf11caf8502aa1fce688a36dfb7ed67031ab777 | amironov73/PythonIrbis | /irbis/terms.py | UTF-8 | 3,235 | 2.9375 | 3 | [
"MIT"
] | permissive | # coding: utf-8
"""
Работа с терминами словаря.
"""
from typing import TYPE_CHECKING
from irbis._common import safe_str
if TYPE_CHECKING:
from typing import Iterable, List, Optional
class PostingParameters:
"""
Параметры для команды ReadPostings.
"""
__slots__ = 'database', 'first', 'fmt', 'num... | true |
60ca0765d859f4b5a5f899aaad1a7ba60e8d6b37 | Azanul/Sorting-Visualized | /selection_sort.py | UTF-8 | 482 | 2.671875 | 3 | [
"MIT"
] | permissive | from OFA import *
def sort(list=blocks):
for i in range(0, len(list)):
min=i
for j in range(i+1, len(list)):
if list[min].h > list[j].h:
min=j
swap(i, min, list)
time.sleep(0.05)
if __name__ == "__main__":
tk.title("Selection Sort")
generate()
btn1 = Button(tk, text = 'Shuffle', bd = ... | true |
ece2bf3b3e5faf4878b30e2f9c0a9f26da31fcaf | daniel-reich/ubiquitous-fiesta | /w5eFnzhADpLZSuCM3_2.py | UTF-8 | 126 | 2.859375 | 3 | [] | no_license |
def multiplicity(lst):
a = []
for i in lst:
if i not in a:
a.append(i)
return [[i,lst.count(i)] for i in a]
| true |
bf2ddc59c2db74f0dbc32f6a8515d920da6e31f7 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_1_neat/16_0_1_graige_osinfo.py | UTF-8 | 595 | 2.703125 | 3 | [] | no_license |
fp = open("A-large.in","r")
fpa = open("A-small-attempt5.out","w")
t=int(fp.readline())
a=[]
c=1
p=0
while t:
p+=1
t-=1
d=int(fp.readline())
c=1
if d==0:
#print "INSOMNIA"
fpa.write("Case #"+str(p)+": INSOMNIA\n")
else:
a=[0 for i in range(10)]
while True:
w=c*d
while w>0:
a[w%10]+=1;
w/=... | true |
47dcdb0942495e9580ff3a4778b213760a7215ac | Kyonchev/PongGame | /cursor.py | UTF-8 | 433 | 3.296875 | 3 | [] | no_license | import pygame
class Cursor:
def __init__(self, text, size, font, x_offset):
self.__surface = pygame.font.Font(font, size).render(text, True, (255, 255, 255))
self.__rect = pygame.Rect(-20, -20, size, size)
self.__x_offset = x_offset
def get_surface(self):
return self.__surface... | true |
f51b143ad503cdd7aa77cb38b904869f7dc0c26b | riya1794/python-practice | /dict.py | UTF-8 | 225 | 3.5625 | 4 | [] | no_license | class Song(object):
def __init__(myself,lyrics):
myself.lyrics = lyrics
def sing_to_me(myself):
for line in myself.lyrics:
print line
str = ["happy bday", "is it so", "u r lucky"]
hbd = Song(str)
hbd.sing_to_me()
| true |
b5f240993fb76431e8411f37cf6b4056e273df16 | Bhargav-Rao/12CS406SMSLAB | /SMS (2)/newspaper.py | UTF-8 | 952 | 3.109375 | 3 | [] | no_license | #newspaper
gfp = [(0,0.35,"good"),(0.35,0.80,"fair"),(0.8,1,"poor")]
num = {0:[(0,0.03,40),(0.03,0.08,50),(0.08,0.23,60),(0.23,0.43,70),(0.43,0.78,80),(0.78,0.93,90),(0.93,1,100)],
1:[(0,0.1,40),(0.1,0.28,50),(0.28,0.68,60),(0.68,0.88,70),(0.88,0.96,80),(0.96,1,90),(1,1,100)],
2:[(0,0.44,40),(0.44,0.66,50),(0.66,0.... | true |
51b81d7768b5c63807fb02e1dd5e1ef1b2448ebd | tanaes/script_bin | /make_otu_map_from_uparse.py | UTF-8 | 3,670 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
"""
Prints a QIIME-compatible OTU map based on the information in a uparse OTU map
uclust file. Note that the order of sequences in the OTU list is determined by
the order of hits in the Uclust file, so may not be sensible/important.
"""
def clusters_from_uparse_file(uc_lines):
""" Given an ... | true |
c2d1fad68319e96d9200a4ba6ae231e2df8ac2db | h12161612/okjike | /api_requests/werobot_demo.py | UTF-8 | 5,434 | 2.515625 | 3 | [] | no_license | import os
import re
import werobot, requests, time
from urllib3 import encode_multipart_formdata
from werobot.client import Client
import requests_work, pic_dowload
class WerobotWork:
def __init__(self):
robot = werobot.WeRoBot(token='martin001') # 微信公众平台配置设置的Token
robot.config["APP_ID"] = "wxea... | true |
0e2620dc3b111ee28b0eeffb74ba74e4262d4a29 | JON2K4/Game | /character.py | UTF-8 | 2,216 | 2.9375 | 3 | [] | no_license | from screen_objects import *
import time
class Character():
ALIVE = "ALIVE"
DEAD = "DEAD"
def __init__(self, world, pos, body: list, speed:int =5, dmg:int =1, hp:int =100, state=ALIVE):
self.world = world
self.pos = list(pos)
self.body = body
self.spd = speed
self.... | true |
56b1ae50c43edcfe302863c8337481aa9c4e61d0 | leoyeh2019/curtain_shooting_game | /practice/hangman.py | UTF-8 | 2,793 | 3.59375 | 4 | [] | no_license | import random
class color:
BOLDRED = "\033[1;91m"
BOLDBLUE = "\033[1;34m"
NORMAL = "\033[0m"
HANGMAN_PICS = ['''
+---+
|
|
|
===''', """
+---+
O |
|
|
===""", '''
+---+
O |
| |
|
===''', """
+---+
O |
/| |
|
... | true |
30266c7f64b50fe6d8e73a5d20aa8e663eece446 | kyukhin/c-fib-service | /test/fib-service.py | UTF-8 | 841 | 2.859375 | 3 | [] | no_license | import unittest
import urllib2
import json
class fib_service (unittest.TestCase):
def get (self, param):
url = "http://localhost:1983/%s" % (param)
return json.loads (urllib2.urlopen (url).read ())
def test_0 (self):
self.assertEqual (self.get ("fib/0"), [])
def test_1 (self):
self.assertEqual... | true |
df17e05bd36e88f45a528a6d431e0c5f4803991a | 1026237416/Python | /Django_project/zqxt_django/zqxt/initdb.py | UTF-8 | 1,508 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/8/6 17:17
# @Author : liping
# @File : initdb.py
# @Software: PyCharm
from __future__ import unicode_literals
import random
from blog.models import Author, Article, Tag
author_name_list = ["Lucy", "Lisa", "Jack", "Tom", "Json"]
article_title_list ... | true |
b1672fb352a39a6cea4a50087f29d08dafbd1fa2 | john-dowling/VesperLynd | /tests/test_wsgi_app.py | UTF-8 | 519 | 2.640625 | 3 | [] | no_license | import unittest
from app.wsgi_app import WsgiApp
class TestWsgiAppInstantiation(unittest.TestCase):
def setUp(self):
self.app = WsgiApp()
def test_wsgi_instantiate_without_routing_adds_default_engine(self):
from routing.routing_engine import RoutingEngine
self.assertEquals(type(self.... | true |
1a4d708d9b372f3a8ee35bd9570f0d3db6ab9891 | ancestor-mithril/Custom-Un-Packer | /functions.py | UTF-8 | 5,363 | 3.3125 | 3 | [
"MIT"
] | permissive | """Run the script as follows:
python a_seven.py --help
=> prints help
python a_seven.py -create_archive target_archive target_objects
* where `target_objects` must be at least 1 directory or file in SSV format (space separated values)
=> fails if `target_archive` already exists or an... | true |
9f44d226bb5cb9e4db171b76d32ebbe45c41c27a | olivierh59500/snorkel | /snorkel/parser/parser.py | UTF-8 | 2,214 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | import requests
import sys
class Parser(object):
def __init__(self,name):
self.name = name
def connect(self):
'''
Return connection object for this parser type
:return:
'''
raise NotImplementedError()
def close(self):
'''
Kill this parser
... | true |
bde1013146c02c5eae6f953cd2fa6b2998007a54 | saipavans/pythonrepo | /lab1/1Task2.py | UTF-8 | 250 | 3.09375 | 3 | [] | no_license | width = 17
height = 12.0
delimiter = "."
exp1 = width/2
exp2 = width/2.0
exp3 = height/3
exp4 = 1 + 2 * 5
exp5 = delimiter * 5
print(exp1, type(exp1))
print(exp2, type(exp2))
print(exp3, type(exp3))
print(exp4, type(exp4))
print(exp5, type(exp5))
| true |
0c230360e97472a9944bfcfc54d48d800b6e8854 | Ian100/Curso_em_Video-exercicios- | /desafio_76.py | UTF-8 | 700 | 3.9375 | 4 | [] | no_license | # Crie um programa que tenha uma tupla única com nomes de produtos e seus
# respectivos preços, na sequência. No final, mostre uma listagem de preços,
# organizando os dado de forma tabular.
produtos = ('Lápis', 1.75,
'Borracha', 2,
'Caderno', 15.90,
'Estojo', 25,
... | true |
a08535e8d2a16accff68f35d77d0f5b05b054b3d | Daiver/jff | /obsolete/py/vk_face/ChebyshevDesc.py | UTF-8 | 1,742 | 2.90625 | 3 | [] | no_license | import numpy as np
class ChebyshevPolynom:
def __init__(self, p, N):
self.p = p
self.N = float(N)
if self.p <= 1:
self.const1 = 1 - N
else:
self.const1 = float(2*p - 1)
self.const2 = (p - 1) * (1 - ((p - 1)**2)/(N**2))
def __call__(se... | true |
0a31a04c9c06c5166cfbd279d99b5836a16bd6a4 | wildsrincon/holbertonschool-higher_level_programming | /0x0B-python-input_output/2-read_lines.py | UTF-8 | 533 | 3.890625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/python3
""" 2-read_lines.py: Write a function that reads n lines
of a text file (UTF8) and prints it to stdout
"""
def read_lines(filename="", nb_lines=0):
""" Function numbers of lines file """
counter = 0
with open(filename, mode='r', encoding="UTF8") as file:
if nb_lines <= 0:
... | true |
7db0e76b047becd836f5900f37b6ce6e81198af7 | jarmovanlenthe/aoc2020 | /17_2.py | UTF-8 | 2,876 | 3.34375 | 3 | [] | no_license | from collections import defaultdict
from itertools import combinations_with_replacement
with open("input17.txt") as f:
lines = [x.strip() for x in f.readlines()]
state = defaultdict(lambda: defaultdict(lambda: defaultdict(lambda: defaultdict(bool))))
for y, l in enumerate(lines):
for x, c in enumerate(l):
... | true |
a4532cbd22819da9b1fd1a58725cfc1a0ad68cee | tjeromin/Distributed-Systems | /Lab3/MeierhoferJeromin/PlotsAndMore/EvaluationSpecificCode/plotter.py | UTF-8 | 1,745 | 2.84375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
def calc_avg(list):
avg = 0
for i in list:
avg += i
return avg / len(list)
round = np.array([1, 2, 3, 4, 5])
latency40 = np.array([4.0, 18.4, 12.8, 11.8, 9.2])
latency30 = np.array([10.2, 11.2, 4.3, 10.1, 11.0])
latency20 = np.array([3.4, 3.... | true |
f5ac9339844e27c543743f9ad25c5ed547b9167e | wangyongfei0306/Requests | /test.py | UTF-8 | 407 | 2.84375 | 3 | [] | no_license | import urllib.request, urllib3
URI_IP = 'http://127.0.0.1:5000'
def use_simple_urllib2():
response = urllib.request.urlopen(URI_IP)
print('>>>Response Headers:')
print(response.info())
print('>>>Response Body:')
# print(''.join([line for line in response.readlines()]))
print(response.status)
... | true |
cd567ede43873be7c9756f34aab582ef0087be83 | xfq/w3c-memo | /i18n/char-disp/generate.py | UTF-8 | 2,359 | 2.75 | 3 | [] | no_license | #! /usr/bin/env python3
import sys
LINE_LEN = 32
def genCharArray(fname):
try:
fp = open(fname, 'r', encoding='UTF-8')
except IOError as e:
raise Exception("File '{}' open error {}".format(fname, e))
flines = fp.read().splitlines()
fdat = []
for fline in flines:
fdat += li... | true |
a06e06e09a2711de4dbc7d97ef6c8c9efe4030e6 | Kennydao/web-scraping-challenge | /Missions_to_Mars/scrape_mars.py | UTF-8 | 4,688 | 3.140625 | 3 | [] | no_license | # import dependencies
from splinter import Browser
from bs4 import BeautifulSoup as bs
import pandas as pd
import os
import time
# News title & paragraph scraping
def mars_news():
executable_path = {"executable_path": "C:\\Users\\home\\Downloads\\tmp\\chromedriver.exe"}
browser = Browser("chrome", **executabl... | true |
53bd12e2b26bd9ecfe1f7163906c7e7499164bef | glangsto/analyze | /iplatlon.py | UTF-8 | 1,777 | 3.21875 | 3 | [] | no_license | # python script to get the location of the IP server and
# print out the latitude and longitude in a clearer format
# HISTORY
# 20Nov03 GIL Clean up dependances.
import re
import json
import os
from urllib.request import urlopen
try:
data = str(urlopen('http://checkip.dyndns.com/',timeout=10).read())
IP = re... | true |
46a6b8afc5bf2f86414147bb65889a7df149d166 | leonardoru/ccpythoncourse | /Assignment4-LeoRueda.py | UTF-8 | 953 | 3.859375 | 4 | [] | no_license | # Class: CIS 112 #37791 ADVANCED PROGRAMMING USING PYT-Online
# Pasadena City College
# Instructor: Mr. Jason Y. Huh
# Assignment 4: Write a Python program that identifies prime numbers
# Student: Leonardo Rueda
repeat = True
while repeat:
num = input('What is the number you would like to check?')
num = int... | true |
b00c8aa0a7d46dd26c6d293c5f9030b06975e0e7 | Kalgrand/BSI_LAB10 | /WebSocket_Client_Server/aes.py | UTF-8 | 1,062 | 3.46875 | 3 | [] | no_license | """
Szyfrowanie tekstu przy pomocy algorytmu AES.
Autor: Maciej Milewski
Źródło algorytmu szyfrującego: https://pypi.org/project/pycrypto/
"""
from Crypto.Cipher import AES
import base64
from utils import pad, unpad, fill_to_block
def aes_encode(message, key):
""" Encrypting message using AES in CBC Mode """
... | true |
a78164725ef47f546a70c75115107fcb8611eae0 | Mberepkel/PythonTests | /TestExamples/ConditionalComands.py | UTF-8 | 851 | 2.59375 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
driver= webdriver.Chrome(executable_path= "C:\Users\VICOMA\Python27\Scripts\chromedriver.exe")
driver.get("http://newtours.demoaut.com/")
ele= driver.find_element_by_name("userName")
print (ele.is_displayed())
print (ele.is_ena... | true |
97c1c9e2a565fa3f19c07170d8744f90b646e1af | yotamsali/Projecton | /cnn training/createChoosing.py | UTF-8 | 3,366 | 2.703125 | 3 | [] | no_license | import numpy
from keras.layers import Dense
from keras.models import Sequential
from keras.models import save_model
SIZE = [30,30]
def ReturnXY():
X = []
Y = []
j=0
'''
for dir in range(1, 13):
T = '/home/yovelrom/Downloads/cutImages/clip' + str(dir) + '/0.jpg'
F = '/home/yovelrom/... | true |
f1398979d49d5a21c425dd901a5ff6a94073f69e | priyankavanaja/iterstor | /iter.py | UTF-8 | 2,502 | 3.953125 | 4 | [] | no_license | # Create a list of strings: flash
flash = ['jay garrick', 'barry allen', 'wally west', 'bart allen']
# Print each list item in flash using a for loop
for person in flash:
print(person)
# Create an iterator for flash: superhero
superhero=iter(flash)
# Print each item from the iterator
print(next(superhero))
prin... | true |
cd95f70575eb25dd59b10f6fda47163ea381af4d | TianyunZ/Cornell-Deep-Learning | /hw3/prb5.py | UTF-8 | 6,731 | 2.78125 | 3 | [] | no_license |
from torch.nn.modules.activation import LeakyReLU
import torchvision
from torchvision import transforms, datasets
import torch
import torch.nn as nn
from torch.autograd.variable import Variable
import torch.optim as optim
from torchvision.utils import make_grid
transform = transforms.Compose([
# transforms.Resize... | true |
5cd6501dc0a06aef4558509518116c29434c393e | liaozhongqiang/pythonlearncode | /fun/mapReduceTest.py | UTF-8 | 1,148 | 3.5625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
from functools import reduce
def f(x):
return x * x
print(list(map(f, [1, 2, 3, 4, 5])))
print(list(map(str, [1, 2, 3, 4, 5])))
def add(x, y):
return x + y
print(reduce(add, [1, 2, 3, 4]))
# 字符串转数字
print(list(x for x in '12345'))
def str2int(s):
def... | true |
83fbadd72e038adad5bad8df605e71ebda5b3319 | restrepo/Mecanica | /figures/forzado.py | UTF-8 | 446 | 2.5625 | 3 | [] | no_license | from pylab import *
w=np.arange(40,49.9,0.05)
plt.plot(w,1./(50.**2-w**2),'b-')
w=np.arange(50.1,60,0.05)
plt.plot(w,1./(50.**2-w**2),'b-')
plt.vlines(50,-0.06,0.06,color='k', linestyles='dashed')
plt.hlines(0,40,60,color='k',lw=0.5)
plt.xticks([])
plt.yticks([])
plt.xlim(40,60)
plt.ylim(-0.06,0.06)
plt.xlabel(r'$\omeg... | true |
ebbb7a99aa23f5b0cda340a2fd436c05ab39f200 | leesy1992/Page_Object | /Page_object/incall.py | UTF-8 | 3,859 | 2.53125 | 3 | [] | no_license | # # # coding=utf-8
'''
Created on 2018-11-1
@author: Lee
Project:案件类表页面的元素操作
'''
from selenium.webdriver.common.by import By
from Page_object.base_object import BasePage
from Logs.logs import Logger
import Obejct_config.config as cfg
#log
log = Logger(cfg.Logger.path,cfg.Logger.filename)
# 继承BasePage类
class in_Call(... | true |
d5502e16be12541480a624d7970a83d21234dbd6 | sinjorjob/screenshot-to-code-keras-django | /pix2code/app1/model/classes/Vocabulary.py | UTF-8 | 2,558 | 3.015625 | 3 | [
"MIT"
] | permissive | __author__ = 'Tony Beltramelli - www.tonybeltramelli.com'
import sys
import numpy as np
START_TOKEN = "<START>"
END_TOKEN = "<END>"
PLACEHOLDER = " "
SEPARATOR = '->'
class Vocabulary:
def __init__(self):
self.binary_vocabulary = {}
self.vocabulary = {}
self.token_lookup = {}
sel... | true |
a8268d35068abd0633474f246dff83287db0344a | Andyll96/portfolio-client | /AddAlbum.py | UTF-8 | 3,403 | 2.734375 | 3 | [] | no_license | from Album import Album
from Photo import Photo
import tkinter as tk
import tkinter.filedialog as fd
from exif import Image
from pymongo import MongoClient
MONGOURL = 'mongodb+srv://allactah:Al%23416587@portfolio-cluster.okbvf.mongodb.net/portfolio-database?retryWrites=true&w=majority'
def openFiles(root, title):
... | true |
b14f16a6f398c03161eaaf2fa6fc2111b7dc8a6d | dam-grassman/woulda | /sokoban_wrappers.py | UTF-8 | 8,268 | 2.875 | 3 | [] | no_license | #############################################
############# SOKOBAN WRAPPER ###############
#############################################
import gym
import gym_sokoban
import numpy as np
from gym import spaces
from gym import ObservationWrapper
class ActionWrapper(gym.ActionWrapper):
""" Limit the number of acti... | true |
ab6f26cf5300c42aa68bde2176ff427d76db3efd | hacanthi1234/hoangha-fundamentals-c4e15 | /session5/homework/test.py | UTF-8 | 237 | 3.8125 | 4 | [] | no_license | n = int(input("please insert a number: "))
x = 1
count = 0
while x < n:
x +=1
if n % x == 0:
count += 1
if count > 2:
print ("{0} is not a prime number".format(n))
else:
print ("{0} is a prime number".format(n))
| true |
3648206d5faffcc7cd4f312e4a36d50ed7831cec | AshBrandywine/PotAnalyzer | /analyzertools/masktools.py | UTF-8 | 3,183 | 3.1875 | 3 | [] | no_license |
alpha_lower_mask = "?l"
alpha_lower_pool = "abcdefghijklmnopqrstuvwxyz"
alpha_upper_mask = "?u"
alpha_upper_pool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
digit_mask = "?d"
digit_pool = "0123456789"
special_mask = "?s"
special_pool = "!\"#$%&'()*+,-./:;<=>?@[]^_`{|}~"
year_length = 4
recent_centuries = ("19", "20")
famous_p... | true |
2e47094ab91d83010d672f6704bcbfe73b2d1987 | ozonuweg/BYUI | /CSE 130 - Algorithm Design/lab02.py | UTF-8 | 1,790 | 4.25 | 4 | [] | no_license | """
File: lab02.py
Lab : 02
Topic: Authentication
Author: Glory Ozonuwe
Purpose: Write a program to read the contents of the file into a list. The program will then prompt the
user for a username and password. Finally, we will tell the user whether the user is authenticated.
What was the hardest part?: The hardest p... | true |
42dd71fc70de246e4c2e6b7adc858bafd51ae3d4 | TharunKumar26/TankWars_Multiplater_Python_arcade_game | /main.py | UTF-8 | 23,769 | 2.953125 | 3 | [] | no_license |
import arcade
import os
import math
import _pickle as pickle
import socket
import json
HOST = "192.168.55.103"
PORT = 5555
from network import Network
import threading
file_path = os.path.dirname(os.path.abspath(__file__))
os.chdir(file_path)
SPRITE_SCALING = 0.35
WALL_SCALING = 0.2
SPRITE_SCALING_BULLET = 0.5
... | true |
a2b83e40a677abef36ddc588b46c3b214d47a5e2 | pchandraprakash/selenium_python3.x | /Understanding_Variables_Data_Types/StringMethods.py | UTF-8 | 2,142 | 4.4375 | 4 | [] | no_license | # accessing characters in a string
city = "draper"
print(city[5]) # index will always start from 0
print("draper"[4])
"""
len()
upper()
lower()
str()
"""
FN = "MISSISSIPPI"
print(len(city))
print(city.upper())
print(FN.lower())
print("char at position 6: " + FN[5]) # Concatenation
print(FN + str... | true |
d01af6063c47c4b7c14de263960528da36503b38 | zicro/arcpy | /SampleArcPyMappingScriptTools/Scripts/ShiftElements.py | UTF-8 | 616 | 2.640625 | 3 | [] | no_license | import arcpy, os
import arcpy.mapping as MAP
#Read parameters from dialog
mxdPath = arcpy.GetParameterAsText(0)
xShift = arcpy.GetParameterAsText(1)
yShift = arcpy.GetParameterAsText(2)
outPath = arcpy.GetParameterAsText(3)
#Reference the map document
MXD = MAP.MapDocument(mxdPath)
#Loop through each page layout ele... | true |
fefd8d3a9414a3da339585cbe605fc412a364c18 | AustinCai/RedditComment_MulticlassClassification | /neural_net_model/word_embeddings.py | UTF-8 | 973 | 3.21875 | 3 | [] | no_license | '''
Creates a word embedding dictionary that, given a word, returns a vector representation
of the word. Dictionary created from word vectors pretrained by GloVe. See bottom of file
for a usage example.
'''
import collections
import pickle
import helper
def getWordEmbeddingDict(vocabSize = 10000):
wor... | true |
fa0f788895795663f9f465ad828b155bf61a5c89 | kefirski/hlm | /model/modules/utils/squeeze.py | UTF-8 | 233 | 2.6875 | 3 | [] | no_license | import torch.nn as nn
class Squeeze(nn.Module):
def __init__(self, position):
super(Squeeze, self).__init__()
self.position = position
def forward(self, input):
return input.squeeze(self.position)
| true |