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 |
|---|---|---|---|---|---|---|---|---|---|---|
d18df7ab8ba2be8e94cd5aa3e0d757ee95e68628 | EASONGUAN/TheTowerGame | /Dungeon/main_multi.py | UTF-8 | 8,996 | 2.765625 | 3 | [] | no_license | import pygame
import sys
import traceback
import hero
import world
import soldier
import socket
import time
import pickle
import Trees
from pygame.locals import *
from random import *
bg_size = width, height = 480, 480
screen = pygame.display.set_mode(bg_size)
pygame.display.set_caption('Dungeon')
... | true |
2351abe16f909ef0457f55915f94352d8d434e47 | openwfm/JPSSdata | /read_goes.py | UTF-8 | 5,621 | 2.59375 | 3 | [] | no_license | '''
Developed in Python 2.7.15 :: Anaconda 4.5.10, on Windows
Lauren Hearn (lauren@robotlauren.com) 2018-10
'''
from netCDF4 import Dataset
from datetime import datetime, timedelta
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from pyproj import Proj
import sys
file=sys.ar... | true |
8355b809572fffd8dcdfe609163121c7c6fa31f9 | DragonKiller952/IPASS-Othello | /Othello.py | UTF-8 | 7,554 | 3.28125 | 3 | [] | no_license | import random
from tkinter import *
canvas = Canvas(width=800, height=800, bg='green', highlightthickness=0)
canvas.pack()
def isValidMove(board, tile, ystart, xstart):
if (xstart > 7 or xstart < 0) or (ystart > 7 or ystart < 0):
return False, []
elif board[ystart][xstart] != '.':
return False,... | true |
162da1ebf748ada9978522e240dd9767364159e0 | pythononwheels/pow_comments | /handlers/comment.py | UTF-8 | 2,286 | 2.65625 | 3 | [
"MIT"
] | permissive | from pow_comments.handlers.base import BaseHandler
from pow_comments.models.comment import Comment
from pow_comments.config import myapp, database
from pow_comments.application import app
import tornado.web
@app.add_rest_routes("comment")
class commentHandler(BaseHandler):
#
# every pow handler automatically... | true |
acd5024505799c1ae880b0b7f633c0ad4a9920c9 | sachinmorabada/Handover-Demo | /RaClient.py | UTF-8 | 2,464 | 2.828125 | 3 | [] | no_license | import socket
import sys
class RaClient:
AR1 = 'radvd-an1'
AR2 = 'radvd-an2'
def __init__(self, host, port):
self._host = host
self._port = port
self._sock = False
self._connected = False
self._ar1_running = False
self._ar2_running = False
self._sta... | true |
8f19c1d09b00520cc9439a49548a1638c9d7e964 | kalyons11/kevin | /kevin/leet/reduce_array_size_half.py | UTF-8 | 1,037 | 3.046875 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | """
https://leetcode.com/explore/featured/card/july-leetcoding-challenge-2021/608/week-1-july-1st-july-7th/3804/
"""
from typing import List, Dict
class Solution:
def min_set_size(self, arr: List[int]) -> int:
# max frequency greedy approach should work here
# thank you hints
freq_map = s... | true |
751f27fa4d17c17b17619a3bb9b02b89e59c916d | dagster-io/dagster | /python_modules/automation/automation/printer.py | UTF-8 | 1,494 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import os
import sys
from io import StringIO
from typing import Any, Callable, List, Type
from dagster._utils.indenting_printer import IndentingPrinter
class IndentingBufferPrinter(IndentingPrinter):
"""Subclass of IndentingPrinter wrapping a StringIO."""
buffer: StringIO
def __init__(self, indent_leve... | true |
26810ad810290e550fc21bff1c6228fbfa51e046 | dolphonie/sign-translator | /model/language_model.py | UTF-8 | 6,448 | 3.078125 | 3 | [] | no_license | """
LanguageModel wrapper class for pre-trained huggingface GPT2 transformer. Provides interface methods
for batch tokenization, forward passes, and access to token and position embedding layers.
Usage example:
m = LanguageModel("gpt2-medium")
hidden, past, attention = m.forward(*m.tokenize(["hello, my name", "what c... | true |
164d30f84a711f4a5378eba4261d23fddfc5b3b2 | ngonzo95/stravaPictureBackend | /app/tests/helpers/util/random_utils.py | UTF-8 | 648 | 3.34375 | 3 | [] | no_license | import random
import string
from decimal import Decimal
def randomString(n):
return ''.join(random.choices(string.ascii_uppercase + string.digits, k=n))
def randomDecimal(start, end, resolution):
"""Returns a random decimal number between two integers resolution
dictates the number of decimal places"""
... | true |
d1e38000a1755d2f16483b323a4231a41c2a5acd | skshabeera/dictionary | /weight.py | UTF-8 | 171 | 2.90625 | 3 | [] | no_license |
d={'Cierra Vega': (6.2, 70), 'Alden Cantrell': (5.9, 65), 'Kierra Gentry': (6.0, 68), 'Pierre Cox': (5.8, 66)}
for k,v in d.items():
if v[0]>6.0 and v[1]>=70:
print({k:v})
| true |
ba925036cd692feb041c9305eba8a89b438a528e | pedronet28/curso-pyton-udemy | /06-list.py | UTF-8 | 1,451 | 4.25 | 4 | [] | no_license | #En python los arreglos son llamados list
#definiendo y cargando un ana list en python
#Ejemplo1
lenguajes = ['Python','Kotlin','Java','JavaScrip']
numeros = [3,5,7,2]
print(lenguajes)
#Ejemplo2 Aplicando método de ordenamiento
#acendente y alfabetico en list de python
lenguajes.sort()
print(lenguajes)
numeros.so... | true |
89d423851421b07fcb3700e5c430e2fc99d87815 | ByronDxO/OLC1-VJ2021-201806840 | /Compilador/interpreterSample/Instrucciones/Switch.py | UTF-8 | 5,726 | 2.78125 | 3 | [] | no_license | from Expresiones.Identificador import Identificador
from Instrucciones.Case import Case
from Instrucciones.Decremento_incremento import Decremento_incremento
from Instrucciones.Declaracion import Declaracion
from Instrucciones.Asignacion import Asignacion
from Abstract.Instruccion import Instruccion
from TS.Excepcion i... | true |
2debda5026e6d715ee5d68f6abc3fa7ebbb90a8b | hehaijuan/wxpythondemo | /layoutmanagement/tool8.py | UTF-8 | 1,301 | 2.90625 | 3 | [] | no_license | # coding=utf-8
import wx
# 自定义窗口类MyFrame
class MyFrame(wx.Frame):
def __init__(self):
super().__init__(parent=None,title="Grid布局",size=(300,180))
self.Center()
panel = wx.Panel(parent=self)
btn1 = wx.Button(panel,label='1')
btn2 = wx.Button(panel, label='2')
btn3 =... | true |
14293c35914f4dcdc965e61ee0aacd251479e6a0 | JPstCode/SGN41007 | /GTSRB_prep.py | UTF-8 | 589 | 2.546875 | 3 | [] | no_license | import numpy as np
from sklearn.preprocessing import normalize
from sklearn.model_selection import train_test_split
c1 = np.load('GTSRB/class1.npy')
c2 = np.load('GTSRB/class2.npy')
c1 = c1.reshape([len(c1),64,-1])
c2 = c2.reshape([len(c2),64,-1])
data = []
labels = []
for img in c1:
data.append... | true |
c82725dce9020b3dbf586d632f7b6c77ae73360e | jennynanap/U-Time | /utime/train/trainer.py | UTF-8 | 10,941 | 2.609375 | 3 | [
"MIT"
] | permissive | """
The Trainer class prepares and launches training of a model.
Most importantly, it compiles the tf.keras Model object with according to the
specified optimizer, loss and metrics and implements the .fit method for
training the model given a set of parameters and (non-initialized) callbacks.
"""
import tensorflow as ... | true |
0ae901863b36ef59c6fc900683206191bb4402d7 | liu-kevin1/News-Checker | /mydata2.py | UTF-8 | 6,000 | 2.84375 | 3 | [] | no_license | # import collections
# import pathlib
# import re
# import string
import time
import tensorflow as tf
import tensorflowjs as tfjs
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import json
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.pr... | true |
a0b643760dec42fa0f5cb9b6f1a9005999380f93 | gabriellaec/desoft-analise-exercicios | /backup/user_380/ch30_2019_03_22_13_10_49_832925.py | UTF-8 | 205 | 3.375 | 3 | [] | no_license | import math
v = float(input())
a = float(input())
t = a*math.pi/180
g = 9.8
d = v**2*math.sin(2*t)/g
if d < 98:
print('Muito perto')
elif d > 102:
print('Muito longe')
else:
print('Acertou!')
| true |
f9bd207a30720eaf744693e96042279915fbd37c | biothings/mychem.info | /src/hub/dataload/sources/ndc/ndc_parser.py | UTF-8 | 3,366 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import csv, os, re
from biothings.utils.dataload import dict_sweep, unlist
def parse_pharm_classes(pharm_classes_str):
# Split on commas that are followed by a closing bracket for cases like: Anti-Inflammatory Agents, Non-Steroidal [CS]
classes_list = [cls.strip() for cls in re.split(r"(?<=\]),\s*", pharm_clas... | true |
b805d7ca4163d1c4c70f5b639cc352ab7d4bf3f6 | Ujkwon/py-mpc | /pympc/archives/policy_with_bounds.py | UTF-8 | 15,633 | 2.9375 | 3 | [] | no_license | def backwards_reachability_analysis(self, switching_sequence):
"""
Returns the feasible set (Polytope) for the given switching sequence.
It consists in N orthogonal projections:
X_N := { x | G x <= g }
x_N = A_{N-1} x_{N-1} + B_{N-1} u_{N-1} + c_{N-1}
X_{N-1} = { x | exists u: G A_{N-1} x <= g -... | true |
714caf3dd7229be3b4896cb925af1002dcae0a22 | cohoe/london | /london/resource/__init__.py | UTF-8 | 2,004 | 2.75 | 3 | [] | no_license | import london.util
import requests
from barbados.services.logging import LogService
import json
class Resource:
@staticmethod
def get(endpoint, args):
LogService.debug("Getting %s" % args.slug)
if args.slug == 'all':
result = requests.get(endpoint)
else:
result ... | true |
8daa67b14cd97799be41c0043011f138b3acca06 | mudit-adityaja/Project-Headlight | /RPi_Master.py | UTF-8 | 10,842 | 2.5625 | 3 | [] | no_license | import serial
import time
#Arduino Serial Commands
# 1 - read lightTop
# 2 - read lightFront
# 3 - read dipper switch
# 4 - capera
# 5 - lightsOff
# 6 - lowbeam
# 7 - highbeam
# 8 - buzz
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=1)
ser.flush()
valueTop = 800
valueFront = 800
def case1(buttonstate... | true |
3b72e7abe0d70c96bf91e8bb623c8dda1d4c4d0a | jp-security/advent-of-code | /2022/Day 1/part_1.py | UTF-8 | 547 | 3.25 | 3 | [] | no_license | import pandas as pd
file = open("./input.txt", 'r')
df_setup = []
elf_count = 0
count = 0
previous_sum = 0
while True:
count += 1
line = file.readline()
if not line:
break
if line == '\n':
df_setup.append({'Elf Name': f'elf-{elf_count}', 'Calories': previous_sum})
elf_... | true |
376aa293df9b5f4bceaa998d5e4cb3a597e740b3 | Laxmanpathare/PythonTest | /bin/search_file.py | UTF-8 | 801 | 3.046875 | 3 | [] | no_license | import os
for root_dir, sub_dir, files in os.walk(r'C:\Users\Admin\Desktop\Laxman'):
# Read all files in direcoty and sub dir
# print('-'*40)
# print('Root Dir=',root_dir,'\n')
# print('Sub directories:',sub_dir,'\n')
# print('files:',files,'\n')
# read only files ends with .py
#... | true |
6ccab4f13c71e78a21f59dfbafe77d0be5c1d178 | corutopi/AtCorder_python | /AtCoderBeginnerContest/1XX/179/D.py | UTF-8 | 2,056 | 2.921875 | 3 | [] | no_license | # 解説などを参考に作成
"""
N = 10, LR = [2, 4] を例とする.
fi:=マスiまで移動する方法の個数とおく.
便宜上0マスから始めると、
N: 0 1 2 3 4 5 6 7 8 9 10
fi: 0 1 0 1 1 2 2 4 5 8 11
となる.(1マス目には最初からいるのでf1 = 1とする.)
ここで、N=5,6の時で考えると、LR=[2,4]から
f5 = f1 + f2 + f3 (∵2~4マス前からしか遷移がないので)
f6 = f2 + f3 + f4
よってf5とf6の差はf1とf4によって求めることができる.
f6 = f5 - f1... | true |
45a316e9a61beca6c0bb8ebb1b2e938552d850b1 | 1040979575/baseDataStructureAndAlgorithm | /leecode/addTwoNumbers.py | UTF-8 | 954 | 3.359375 | 3 | [] | no_license | class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def addTwoNumbers(self, l1, l2):
sum = ListNode(0)
temp = sum
while l1 or l2:
if l1 == None:
sum.val = l2.val + sum.val
elif l2 == None:
... | true |
0c945ce8cf37e93fe46d4808ac65d74cd5b602c5 | jpenna/course-v3 | /notes/scripts/cleanup/handlers.py | UTF-8 | 1,992 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | import os
import json
import glob
import re
import itertools
import random
def handleGetImages(handler, path, query = []):
pathParam = query.get('path').pop()
if pathParam is None:
raise Exception('Missing path param')
types = ('*.png', '*.jpg')
files_grabbed = [glob.glob(f'{pathParam}/{ext}'... | true |
7a7c0289ea0ebc64bf179f39d1eb0c22dcd809c8 | nthieu173/astraios | /astraios/astfield_gen/draw_ast.py | UTF-8 | 3,292 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | from tkinter import *
from math import *
import random
import time
master = Tk()
w = Canvas(master, width=1200, height=700)
w.pack()
#random a tuple list from 0-x_bound and 0-y_bound. deprecated
def ran_plist(num_points,x_bound,y_bound):
count = 0
point_list = []
while count < num_points:
point_list.append((rand... | true |
e7d5510fab178f99c2f07e8c7c0a4f402e70a644 | MillenniumEarl/RevengeUnfold | /RevengeUnfold/classes/phone.py | UTF-8 | 1,843 | 3.65625 | 4 | [
"MIT"
] | permissive | import phonenumbers
from phonenumbers import geocoder, carrier, timezone
class phone:
'''
Classe rappresentante un numero di telefono. Tramite costruttore può ottenere i dati di un numero telefonico.
Proprietà:
@number: Numero di telefono (Stringa)
@carrier: Nome operatore telefonico originale de... | true |
29d7255ce8cdcdb4d1e703fcd616cd19c06aed12 | DeveloperArthur/Python | /modularizacao-python/media.py | UTF-8 | 624 | 2.96875 | 3 | [] | no_license | from statistics import *
def media(lista):
media = sum(lista)/float(len(lista))
return media
def mediana(lista):
lista_ordenada = sorted(lista)
t = len(lista_ordenada)
if t % 2 == 0:
mediana = (lista_ordenada[int(t/2)]+lista_ordenada[int((t/2)-1)])/2
elif t % 2 == 1:
mediana = lista_ordenada... | true |
2f972152d410ee02603b1f412e80b1a85e1a67d2 | SouravJohar/genetic-algorithm-driver | /evolution.py | UTF-8 | 3,889 | 3.03125 | 3 | [] | no_license | from random import *
import math
from numpy import interp
class Evolution:
def __init__(species, mutation_rate=0.01, pop_size=100, elitism=0.1):
self.mutation_rate = mutation_rate
self.pop_size = pop_size
self.elitism = elitism
self.species = species
def create():
init... | true |
cd1df3dcf508516e73795b38fb54d3497d41cfad | zhangtianxiang/genome_assembler | /GetCompRev.py | UTF-8 | 1,181 | 2.9375 | 3 | [] | no_license | '''
对某个fasta文件求反向互补串,行行对应,可以用于对答案去重,但是最终并没有使用
'''
import argparse
import os
import Levenshtein as leve
from tqdm import tqdm
from collections import Counter
import json
import sys
def prepare_fasta_data(filename):
content = []
print('Load data', filename)
with open(filename, 'r') as f:
lines = f.r... | true |
b4569dea0807b8d459fd3a5a8b8f989809918a91 | trojan1771/Python-Images_template_matching | /template_matching.py | UTF-8 | 729 | 2.53125 | 3 | [] | no_license | import numpy as np
import cv2
img=cv2.imread('assets/soccer_practice.jpg',0)
template=cv2.imread('assets/ball.png',0)
h,w =template.shape
methods=[cv2.TM_CCOEFF, cv2.TM_CCOEFF_NORMED, cv2.TM_CCORR,cv2.TM_CCORR_NORMED,cv2.TM_SQDIFF,cv2.TM_SQDIFF_NORMED]
for method in methods:
img2=img.copy()
result=cv2.mat... | true |
695f0154a2ca7654ead1e7f6792ccb489e2969b7 | gauravc6/CollegeStuff | /py/dataAnalysisProject.py | UTF-8 | 1,807 | 3.234375 | 3 | [] | no_license | # Imports
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Data analysis
df = pd.read_csv('insurance.csv')
df.head()
# region column is useless so deleted
del df['region']
df['smoker'] = df['smoker'].apply(lambda x: 1 if x=="yes" else 0)
df['sex'] = df['sex'].apply(lambda... | true |
634f74243e239b05920e62ba983be9977eb6d8d4 | thomasdesr/graph-network-paths | /graph.py | UTF-8 | 5,432 | 2.5625 | 3 | [] | no_license | import sqlite3
import graphviz
import pyasn
from tqdm import tqdm
asndb = pyasn.pyasn("./ipasn_20210227.dat")
def lookup_nodes_ptr(nodes):
import asyncio
import aiodns
async def lookup_nodes(ips):
ips = set(ips)
resolver = aiodns.DNSResolver() # ["8.8.8.8"]
async def query(ip... | true |
148913b29d2a08caa15a56fc3bfa80799527fa6c | szsb26/Alphazero-CS | /cur_source/modifications/alphazero_compressedsensing_nonoise_hierarchical_v2/compressed_sensing/CSGame.py | UTF-8 | 7,290 | 3.125 | 3 | [] | no_license | from Game_Args import Game_args
from CSState import State
import numpy as np
import copy
class CSGame():
def getInitBoard(self, args, Game_args, identifier = None): #Game_args is an object
#Get the initial state at beginning of CS Game and compute its features and terminal reward
Initial_State = Stat... | true |
426b1aafe5a86d559de0aa748f0af2f3294db43d | CarlosNunezMX/Watermelon-Bot | /src/utils/fetch.py | UTF-8 | 359 | 2.609375 | 3 | [
"MIT"
] | permissive | import requests
def get(url):
r = requests.get(url)
if r.status_code == 200:
return [r.status_code, r.json()]
else:
return [r.status_code]
def getWithHeaders(url, headers):
r = requests.get(url, headers=headers)
if r.status_code == 200:
return [r.status_code, r.json()]
... | true |
2ef69e3d65e103b539be3f3a83a191bcd382502f | pthom/Cling_Repl_Demo | /scripts/tooling/Simulate_KeyPresses.py | UTF-8 | 1,511 | 2.515625 | 3 | [] | no_license | import sys
import time
import subprocess
def send_letter(letter):
# V1 : simple print
sys.stdout.write(letter)
sys.stdout.flush()
# V2: Test with expect (apt-get install expect)
# cmd = """echo 'send "{}"' | expect""".format(c)
# subprocess.run(cmd, shell=True)
def write_line(line):
delay_letter = 0.03... | true |
2939ce72b632bf13f19ff193f05615f21751e954 | tianzhuzhu/mystock | /data/akshare/test/northFLow.py | UTF-8 | 2,275 | 2.890625 | 3 | [] | no_license | import akshare as ak
# 沪股通 深股通 北上
# stock_em_hsgt_north_net_flow_in_df = ak.stock_em_hsgt_north_net_flow_in(indicator="沪股通")
# print(stock_em_hsgt_north_net_flow_in_df)
# # stock_em_hsgt_north_net_flow_in_df = ak.stock_em_hsgt_north_net_flow_in(indicator="深股通")
# # print(stock_em_hsgt_north_net_flow_in_df)
#
#
# # impo... | true |
bf0cfb1588ffbe4bd06256d430a501ca44b95bad | probhakarroy/Algorithms-Data-Structures | /Algorithmic Toolbox/week3/max_loot.py | UTF-8 | 702 | 3.375 | 3 | [] | no_license | # python3
def fractional_knapsack(n, W, v, w):
V = 0
for _ in range(n):
if W == 0:
return V
index = 0
for j in range(n):
if (index is None) or (w[j] > 0 and v[j]/w[j] > v[index]/w[index]):
index = j
a = min(w[index], W)
V += a*(... | true |
686ae3fe90e504a54db9bb669f5894683602e188 | Tarek-Ramadan/Dashing | /util/pcaOrig.py | UTF-8 | 1,643 | 2.71875 | 3 | [
"MIT"
] | permissive | import scipy
import numpy as np
import math as mp
import warnings
def pcaOrig(X, no_dims):
# Ported from MATLAB to Python by Albert Furlong, 5/07/2019
# INPUT:
# X: A higher dimension array data field.
# no_dims: An integer representation of the
# number of dimensions i... | true |
91a705df043fe4b7e7ddb85cfa0c233c0bb854d9 | Aasthaengg/IBMdataset | /Python_codes/p03687/s872626121.py | UTF-8 | 1,406 | 2.734375 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().sp... | true |
5db2bdab70a73565434957fc43928e27627be9ef | bok/mopidy | /mopidy/frontends/base.py | UTF-8 | 898 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | class BaseFrontend(object):
"""
Base class for frontends.
:param core_queue: queue for messaging the core
:type core_queue: :class:`multiprocessing.Queue`
:param backend: the backend
:type backend: :class:`mopidy.backends.base.Backend`
"""
def __init__(self, core_queue, backend):
... | true |
faed16865b5356d10b70a50e7a42d8de926da768 | josemariasilva/___ | /tools/tests_ea_tag.py | UTF-8 | 803 | 2.5625 | 3 | [] | no_license | import os
def make_dir_a_tag(tag):
root = os.path.abspath('.')
motor = list(filter(lambda x: x=='motores_registrados', os.listdir(root)))[0]
motor_path = os.path.join(root, motor)
location_tag = os.path.join(motor_path, tag)
try:
if not os.path.exists(tag):
os.makedirs... | true |
ff6f7ddb8ad53397057b30a18685e6100529cb87 | fifo2019/algo_and_structures_python | /Lesson_8/1.py | UTF-8 | 1,794 | 3.90625 | 4 | [] | no_license | """
1. Закодируйте любую строку из трех слов по алгоритму Хаффмана.
"""
import collections
input_str = 'beep boop beer!'
str_count = collections.Counter()
list_str = list(input_str)
for i in list_str:
str_count[i] += 1
list_letter = list(map(list, sorted(list(str_count.items()), key=lambda count: count[1])))
lis... | true |
dd3da4a3cbc54f542213a21efae88c9fd51be7d4 | alexandraback/datacollection | /solutions_2463486_1/Python/cavoo/p.py | UTF-8 | 1,285 | 2.90625 | 3 | [] | no_license | import sys, pickle
def f(i):
return ''.join(reversed(list(str(i)))) == str(i) and ''.join(reversed(list(str(i*i)))) == str(i*i)
def calculate():
X = [1, 4, 9]
a = [11, 22]
while a:
n = a.pop(0)
s = str(n)
l = len(s)
if n*n > 1e110: continue
#p... | true |
d57d82379f857dbaa407a55d30439d200eda3a68 | kbhadury/Shamir | /data_ops.py | UTF-8 | 1,427 | 3.265625 | 3 | [] | no_license | import base64
import random
import re
# ***** Strings ***** #
def str_to_num(string):
number = 0
for char in string:
ascii_val = ord(char)
number = (number << 8) | ascii_val
return number
def num_to_str(num):
string = ""
while num != 0:
ascii_val = num & 0xFF
... | true |
859aa8b70bf9e50998d2640b4e7383015dcf1fdc | ctseng98/inst326_group_project | /test_music.py | UTF-8 | 2,404 | 2.71875 | 3 | [] | no_license | from music import Music
def test_play():
# Playlist 1
url = "http://www.youtube.com/feeds/videos.xml?playlist_id=PLsH19NHPTD44m-5CCyx5jKLKAGir3iL2L"
m1 = Music(url=url, tarot=0)
m2 = Music(url=url, tarot=10)
m3 = Music(url=url, tarot=12)
m4 = Music(url=url, tarot=20)
m5 = Music(url=url, ta... | true |
6d7df26f4f6e30ad190754df2ea79bd436cb4891 | wdc63/xorencryption_python | /webapp_workinprogress/encrypt_webapp.py | UTF-8 | 2,024 | 2.640625 | 3 | [] | no_license | #encoding=utf-8
import encrypt_api
from flexx import ui,app,event
class encrypt_decrypt(ui.Widget):
def init(self):
with ui.TabLayout():
self.encrypt = ui.Widget(title='加密')
with self.encrypt:
with ui.FormLayout():
self.l1 = ui.Label(text='请输入需加密的... | true |
1fd8a1ae1d64e7d7f536dae50b0b8387ca4a2bff | Mirdev/DSS_Code | /Prog_Proj/p2/mini_painter_fill.py | UTF-8 | 1,808 | 3.828125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
board = [[1, 1, 2, 2, 2, 2],
[1, 1, 1, 3, 3, 2],
[1, 1, 3, 3, 3, 2],
[4, 5, 5, 3, 3, 2],
[4, 1, 1, 3, 2, 2],
[4, 4, 1, 3, 3, 2]]
# mini_board : 2차원 리스트(리스트의 리스트)로 그림판을 나타냄
# x, y : 각각 그림판에서 선택한 픽셀의 행과 열을 나타냄
# color : 새로 칠하게 될 색 값을 나타냄
# 모든 인접한 주변의 ... | true |
f14656030a76b4449822c327c8735ee3f92a5004 | aluminium-computing/hhbasic | /programclass.py | UTF-8 | 3,078 | 3.140625 | 3 | [] | no_license | # Copyright (c) 2014 Aluminium Computing, Inc., under APL
# the program class
import string
lictimes = 0
def find(num_list, num, start, end):
# Report the index in num_list that contains num or -1 if not found.
# ASSUMPTION: num_list is sorted
if start == end:
if num_list[start] == num:
return start... | true |
629f74e0b0f392deda10ded2886c20ac3c23cae6 | 181221/IN4120-SOEK | /obligatorisk/assignment-e/suffixarray.py | UTF-8 | 7,302 | 3.4375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import itertools
from collections import Counter
from utilities import Sieve, apply
from corpus import Corpus
from normalization import Normalizer
from tokenization import Tokenizer
from typing import Callable, Any, Iterable, Tuple
class SuffixArray:
"""
A simple suf... | true |
2c33660290163de918c00473d7efb4f86a834212 | siberian122/kyoupuro | /HHKB/HHKB-C.py | UTF-8 | 337 | 2.65625 | 3 | [] | no_license | def main():
n=int(input())
p=list(map(int,input().split()))
l=[0 for _ in range(max(p)+2)]
cnt=0
for i in p:
l[i]=1
if l[cnt]==0:
print(cnt)
else:
while True:
cnt+=1
if l[cnt]==0:
break
pr... | true |
f31c84310972e576503e4b3cd2f3524daba22ca2 | sushantkumar-1996/Python_GeeksForGeeks | /Python_SimpleIntrest.py | UTF-8 | 615 | 4 | 4 | [] | no_license | """Simple Intrest Formula is given by
Simple Intrest= (P*T*R)/100
P-Principle Amount, T-Time, R-Rate
"""
P = int(input("Enter Principal Amount"))
T = float(input("Enter Time"))
R = float(input("Enter Rate Of Intrest"))
SI = (P*T*R) / 100
print(SI)
"""Compound ... | true |
bae48fbf7e89cddfd3dd9eb94e78d13403f354b4 | jspfister-sep/advent-of-code | /2019/day22/part2.py | UTF-8 | 4,500 | 3.125 | 3 | [] | no_license | import sys
from functools import partial
FINAL_INDEX = 2020
DECK_SIZE = 119315717514047
NUM_SHUFFLES = 101741582076661
EXAMPLES = [
([
'deal with increment 7',
'deal into new stack',
'deal into new stack',
],
[0, 3, 6, 9, 2, 5, 8, 1, 4, 7]),
([
... | true |
81c333f29c220227449171cc3cc4f6951d1e9f55 | flo7210/WegfLaby_AP | /src/maze.py | UTF-8 | 5,386 | 3.734375 | 4 | [] | no_license | class Maze:
"""An abstract representation of a maze as a rectangular, simple graph."""
def __init__(self, width, height):
"""Initialize a new instance of the Maze class with given width and height."""
self.width = width
self.height = height
self._reachable = dict()
# I... | true |
04749b7bc27946967cbd50e7262a6202c8bfb81d | kbutler52/python_scripts | /break.py | UTF-8 | 150 | 3.734375 | 4 | [] | no_license | # to use break/Contine in a program
a =['foo', 'bar', 'baz', 'qux']
for i in a:
if 'b' in i:
#break
continue# shipped over bar and baz
print(i)
| true |
d6fe340cda8a6e6419c6dace4da056b450d4c241 | shihyu/MyTool | /Tools/inpy | UTF-8 | 2,205 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python -i
# Enhance introspection at the python interactive prompt.
# This is a very simple alternative to ipython
# whose default settings I don't like.
# Notes:
# You can run it directly, or call it like:
# PYTHONSTARTUP=~/path/to/inpy python
# Changes:
# V0.1 09 Sep 2008 Initial releas... | true |
837ac5c8f57b92e2e54ed5057d7ce8477ef6c309 | angelm1974/analiza_danych | /D1/funkcje.py | UTF-8 | 809 | 3.953125 | 4 | [] | no_license | def drukuje():
return 1
a = drukuje()
print(a)
# def imie():
# return input('Podaj swoje imię')
# b = imie()
# print('Witaj, ', b)
def suma(liczba1, liczba2):
return liczba1 + liczba2
print(suma(12, 44))
def suma_opcjonalna(liczba1, liczba2=5):
return liczba1 + liczba2
print(suma_opcjonaln... | true |
3add12ee30a465344674e582a0ba623b4f8f7f20 | littleboss1/practice_project | /analysis_nginx/clear_file_log.py | UTF-8 | 1,093 | 2.515625 | 3 | [] | no_license |
#!/usr/bin/env python
#!coding=utf-8
#author=little boss
import os
import time
import shutil
import logging
import datetime
Src_Dir = "/data/freeswitch/recordings/archive"
Drc_Dir = "/data/back/"
def Confirm_Dir():
Current_Dir = os.getcwd()
if Current_Dir == Src_Dir:
pass
else:
os.chdir(S... | true |
b27eff3bfc55951efcb4ad2b6936394f41a964a9 | gr8jam/IncisorSegmentation | /Preprocess.py | UTF-8 | 3,310 | 2.5625 | 3 | [] | no_license | import numpy as np
import cv2
import matplotlib
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
import os
import sys
import warnings
from numpy.distutils.system_info import x11_info
import myLib
def preprocess_radiograph(img):
img = cv2.medianBlur(img, 5)
img = cv2.bilateralFilter(img, ... | true |
80ecfc3bf04e9d307592b58dcb4e13840a6dd764 | tommyfms2/2017-10-28_skill-up | /chainer_skillupsemi.py | UTF-8 | 7,031 | 2.78125 | 3 | [] | no_license |
from __future__ import print_function
import argparse
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import training
from chainer.training import extensions
from chainer.datasets import tuple_dataset
import numpy as np
def create_data(min_num, max_num, n_samples):
# np.ran... | true |
6f1a90bf8504dc513eac7cf2fada6c8ff8b1be20 | hesambeigy/cscircles | /Spy Decoder.py | UTF-8 | 391 | 2.609375 | 3 | [] | no_license | n = input()
s = int(input())
def spyDecoder(n,s):
a = []
for i in range (0,len(n)):
if n[i] == ' ':
a.append(n[i])
elif (ord(n[i])-s)<= 65 or ord(n[i]) <= 65:
code = n.replace(n[i],chr(ord(n[i])-s+26))
a.append(code[i])
else:
code = n.replace(n[i],chr(... | true |
a69f72e338740973b662c52f0b6fe57114a78901 | ytcer/ssh-cracker | /cracker.py | UTF-8 | 1,151 | 2.609375 | 3 | [] | no_license | import pexpect
A='Are you sure you want to continue connecting (yes/no)?'
B='Permission denied, please try again.'
C=' password:'
D='Connection timed out'
host='192.168.81.82'
usr='root'
password=[]
def connect_test(host,usr,password):
try:
send_mess='ssh '+usr+'@'+host
p=pexpect.spawn(send_mess,timeout=3)
... | true |
f71bddb83a24992e2b79953694bc68199ad4364b | listenzcc/RemoteController | /weChatController/weChatController/operator.py | UTF-8 | 1,417 | 3.34375 | 3 | [
"MIT"
] | permissive | '''
FileName: operator.py
Author: Chuncheng
Version: V0.0
Purpose: WeChat Operator
'''
import time
import clipboard
import keyboard
def send_message(message):
'''
Method: send_message
Send [message] to WeChat and Send the Message
Args:
- @message
Outputs:
- Succes... | true |
c392da6e18ae9f2a08678eb14246c1674e625048 | djaenicke3/stock_models | /trade_bot.py | UTF-8 | 5,758 | 2.6875 | 3 | [] | no_license | import numpy as np
##import yfinance as yf
import json
import alpaca_trade_api as tradeapi
import ta
import random
import pandas as pd
ALPACA_API_KEY = "PKIA6EW2U4VEBXLOGBXJ"
ALPACA_SECRET_KEY = "wbJCjYt7yhVgcZIjdsTXWGIJBKbv91RbzRQ7q6QG"
base_url = 'https://paper-api.alpaca.markets'
import logging
import argparse
# Yo... | true |
d7afdc1f52a2c0c7d5b01250351aa99209f55abc | joakimtosteberg/aoc19 | /13/day13.py | UTF-8 | 699 | 2.96875 | 3 | [] | no_license | import sys
sys.path.append('../intcode')
import intcode
with open("day13.input") as file:
program = [int(val) for val in file.read().split(',')]
EMPTY = 0
WALL = 1
BLOCK = 2
PADDLE = 3
BALL = 4
arcade = intcode.IntCode()
arcade.load_program(program)
out_queue = arcade.get_output_queue()
board = {}
while not ar... | true |
5ab5218c5ce37f9423baa2b181c02ea90c005e9d | Chabana/ClassificationIA | /openFile.py | UTF-8 | 1,682 | 2.8125 | 3 | [] | no_license | import codecs
acceptType = ("VER", "NOM", "ADV", "ADJ")
def traiteFichierTagged(path, dict):
"""
Ouvre le fichier tagués
:param path: path du fichier
:param dict: dicionnaire résultat
:return:
"""
with codecs.open(path, "r", "utf-8") as file:
for line in file:
split = l... | true |
22a54fc4e6ceb230be0ece9e27d2cfcac0af88d1 | asa/gtsfm | /gtsfm/common/sfm_result.py | UTF-8 | 3,656 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | """Data structure to hold results of bundle adjustment.
Authors: Xiaolong Wu, Ayush Baid
"""
from typing import List, NamedTuple, Tuple
import numpy as np
from gtsam import Pose3, SfmData, SfmTrack
class SfmResult(NamedTuple):
"""Class to hold optimized camera params, 3d landmarks (w/ tracks), and total reproje... | true |
63e113d0cdf18cf456b6212f77528f746af7e3f5 | sarathreddynaidu/SeleniumPython | /UnitTestFramework/assertionTest2.py | UTF-8 | 636 | 3.53125 | 4 | [] | no_license | # assertTrue - If result/value is True the test passes, if False the test fails
# assertFalse - If result/value is False the test passes, if True the test fails
import unittest
from selenium import webdriver
class Test(unittest.TestCase):
def test1(self):
driver = webdriver.Chrome(executable_path="C:\ch... | true |
98b6f6fc63979c0bdfdb4bb882da0d654e384611 | weizhixiaoyi/leetcode | /dp/338.counting-bits.py | UTF-8 | 839 | 3.453125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from typing import List
import pprint
"""
在pow(2, i)的二进制数中1的个数为1个
进而可以统计pow(2, i)到pow(2, i+1)个数内元素的数目
"""
class Solution:
def countBits(self, num: int) -> List[int]:
dp = [0 for i in range(num + 1)]
for i in range(0, 100):
cur_value = pow(2, i)
if c... | true |
2196758d59c5818ac514170e5d4e78e2c290cf88 | thrawn01/compiler | /ollie/__init__.py | UTF-8 | 5,443 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python
import re
from llvm import *
from llvm.core import *
from llvm.ee import ExecutionEngine, TargetData
class SyntaxNode():
def __init__(self, input, range, type):
self.input = input
self.range = range
self.type = type
def value(self):
return self.input[self.range[0]:self.range[1]... | true |
cad9a944a9fc030939c569acadd91c1d85d246bd | CarlosTheG/DeepRLgroup | /lunarlander/NNQALearn.py | UTF-8 | 5,381 | 2.875 | 3 | [] | no_license | ''' EXPERIENCE REPLAY WOW '''
import gym
import numpy as np
import random
import tensorflow as tf
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import time
import utils
from memory_bank import *
import tf_utils
import os
# matplotlib inline
# OPTIONS
save_name = './tmp/save'
# if not o... | true |
fc0a72571fcb01bde3842165c7e03522da5033a3 | rod1n/nn-from-scratch | /nn/optimizers.py | UTF-8 | 4,336 | 3.09375 | 3 | [] | no_license | import numpy as np
class SGD(object):
def __init__(self, learning_rate=0.1, momentum=0.0, decay=0.0, nesterov=False):
self.learning_rate = learning_rate
self.momentum = momentum
self.nesterov = nesterov
self.decay = decay
self.iteration = 0
def update(self, layer, wei... | true |
60068e35de9248124039a76e51f4e8cb2a2f35b1 | mdinacci/rtw | /contrib/src/mdlib/gui/gtk/__init__.py | UTF-8 | 2,700 | 2.9375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8-*-
"""
Author: Marco Dinacci <marco.dinacci@gmail.com>
License: BSD
This module contains some utilities related to GUI development,
especially with PyGTK and Glade
"""
import gtk
class DoubleBufferedDrawingArea(gtk.DrawingArea):
pass
class GladeView(object):
"""
Make easier dealing ... | true |
4d846f28cb062154ca734d115dffc5e2e3131cc5 | dankaygit/aoc20 | /python/day5.py | UTF-8 | 1,844 | 3.453125 | 3 | [] | no_license | def readInput(fileName):
with open(fileName) as file:
lines = file.readlines()
return (lines)
def findRow(line):
code = line[:7]
row = [0, 127] # total no. of rows separated in max min to iteratively reduce
max_idx = len(code) - 1
for i in range(max_idx + 1):
if (code[i] == '... | true |
53a721af904e88b89e789697fb7d16dc1b1aa24c | gregbugaj/unet-reference-impl | /perf.py | UTF-8 | 1,182 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import mxnet as mx
from mxnet import profiler
# Configurations
warmup = 25
runs = 100
run_backward = True
# Operator to benchmark
F = mx.nd.add
# Prepare data for the operator
lhs = mx.nd.ones(shape=(1024, 1024))
rhs = mx.nd.ones(shape=(1024, 1024))
lhs.attach_grad()
rhs.attach_grad()
mx.nd.waitall()
# Warmup
pr... | true |
1c098af8055f056694c498027ed5e05d5d1e642a | guancgsuccess/python_spider | /unit47 - scrapy/myspiders/myspiders/spiders/rbSpider.py | UTF-8 | 736 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import scrapy
from myspiders.items import RunnoobItem
class RbspiderSpider(scrapy.Spider):
name = 'rbSpider'
allowed_domains = ['runoob.com']
start_urls = ['http://www.runoob.com/']
def parse(self, response):
# print(response.body)
# pass
# 解析找到导航
... | true |
dddb11dc1e151c9a9faaabae2e05cb0f8e27f154 | kalenforn/Real_time_face_recognition_with_insightface | /deploy/model.py | UTF-8 | 4,546 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*-coding: utf-8
"""
FileName: face_recognition.py
Author: kalentee
E-mail: 1564920382@qq.com
Data: 2019-5-23 11:41
Work Speace: Visual Studio Code, Ubuntu18.04TLS, Anaconda5.1, Tensorflow1.13.1
The last modify time:2019-5-23 11:41
"""
import face_model_test
import face_image, face_preproce... | true |
6bf3e94579e3c9e8a2498fb2c4662cb2154e5d86 | spy86/docker-h2t | /app/src/output.py | UTF-8 | 5,345 | 3.1875 | 3 | [
"MIT"
] | permissive | import json
from colorama import Fore, Style
def help():
print('''Output explanation:
{b}{g}[+]{reset} Good headers. Already used in your website. Good job!
{b}{y}[+]{reset} Good headers. We recommend applying it
{b}{r}[-]{reset} Bad headers. We recommend remove it\n'''.format(b=Style.BRIGHT, g=Fore.GR... | true |
cf55ff5f5c3457ad21cfb24f341871b7378a4197 | pypa/pip | /src/pip/_internal/models/wheel.py | UTF-8 | 3,600 | 2.96875 | 3 | [
"MIT"
] | permissive | """Represents a wheel file and provides access to the various parts of the
name that have meaning.
"""
import re
from typing import Dict, Iterable, List
from pip._vendor.packaging.tags import Tag
from pip._internal.exceptions import InvalidWheelFilename
class Wheel:
"""A wheel file"""
wheel_file_re = re.co... | true |
0f70fc5ddd6f9e4a2ac1a14350c5485622f6b319 | alexandraback/datacollection | /solutions_5753053697277952_0/Python/Fedux/senate.py | UTF-8 | 1,178 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import division
from fileparser import FileParser
def index2party(index):
return chr(ord("A") + index)
def check(senators):
tot = sum(senators)
for i, x in enumerate(senators):
if x*2 > tot and tot > 0:
#print "Party {} h... | true |
ed006da13e93ae89cdca08272bf53e9045e497f2 | priyathamkat/unpaired-image-denoising | /src/glow/invertible_layers/affine.py | UTF-8 | 2,019 | 2.625 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
from .invertible import InvertibleModule
cuda_device = torch.device("cuda:0")
class Affine(InvertibleModule):
def __init__(self, num_channels, net_channels=128):
super().__init__()
assert num_channels % 2 == 0
self.split_size = num_channels // 2
... | true |
604a4fb6d44db1ce5b689295cb3c9e00e44ddf4c | obs145628/py-utils | /src/dataset_boston.py | UTF-8 | 998 | 2.765625 | 3 | [
"MIT"
] | permissive | import sklearn.datasets
import numpy as np
import pickle
TRAIN_TEST_FILE = './boston.bin'
def sep_train_test(data, target, train_len, test_len):
total_len = train_len + test_len
arr = list(zip(data, target))
np.random.shuffle(arr)
arr = arr[:total_len]
train = arr[:train_len]
t... | true |
6e7f5cbac0a884876e6c49950445695e410c015b | hugoren/flinks-python | /flinks/client.py | UTF-8 | 3,641 | 2.796875 | 3 | [
"MIT"
] | permissive | """
Flinks client
=============
This module defines the ``Client`` class allowing to interact with the Flinks API endpoints and
methods.
Documentation: https://sandbox.flinks.io/documentation/
"""
from urllib.parse import urljoin
import requests
from requests.adapters import HTTPAdapter
from req... | true |
dabda85d8ff77ccfe35f9699fa2e85766bf850f0 | Benehiko/php-python-clientserver | /python/test.py | UTF-8 | 580 | 2.90625 | 3 | [] | no_license | from core import Pyhandler
test = Pyhandler()
#test.login("alanopi.314@gmail.com","password1234")
while True:
selection = raw_input("1.Login\n2.Logout\n3.Check Login\n4.Register\n5.GetData")
if selection == "1":
test.login("alanopi.314@gmail.com","password1234")
elif selection == "2":
te... | true |
473b7ddf4547d1575b6c55aebcf7490baeb3d87e | startFromBottom/Hackerrank_problems | /Graphs/BFS: Shortest Reach in a Graph.py | UTF-8 | 1,494 | 3.703125 | 4 | [] | no_license | """
problem link : https://www.hackerrank.com/challenges/ctci-bfs-shortest-reach/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=graphs
"""
from collections import deque, defaultdict
class Graph:
def __init__(self, n):
self.size = n
self.graph = defaul... | true |
d7288ee894a4eb2095f78551ea3bb44ce84e0f6f | yangjianj/unittest_base | /unittest_result_message_base.py | UTF-8 | 928 | 2.671875 | 3 | [] | no_license | import os
import unittest
#测试结果信息收集:
if __name__ == '__main__':
case_path = os.path.join(os.getcwd(), 'test_case')
discover = unittest.defaultTestLoader.discover(case_path, pattern="test*.py", top_level_dir=None)
test_result = unittest.TextTestRunner(verbosity=2).run(discover)
print('All case number')
... | true |
4e2c27bea93f8f495afb0ad43afe0f3d9ef84604 | kelr/practice-stuff | /leetcode/1441-buildarraywithstackops.py | UTF-8 | 629 | 3.734375 | 4 | [] | no_license | # Loop through the range of 1-n and compare each with the current target val.
# If it matches, the op should be push then go to the next target
# If it does not match, the op is push pop and stay on the target
# O(N) where N is n.
# O(N) output array is at most 2N-1 elements (target is a single element == n)
def ... | true |
181c9f4008032f2c160b1040f1b22822e27e945b | laurila2/tie-02101-ohjelmointi-1 | /kierros04/4.5.6 Geometriset kuviot.py | UTF-8 | 1,889 | 4.25 | 4 | [] | no_license | # Introduction to Programming spring 2020
# Geometriset kuviot -tehtävä
# Santeri Laurila
import math
PI = math.pi
def syotteen_tarkastus(fraasi):
# Tarkistaa, että käyttäjä on syöttänyt positiivisen arvon
sivu = float(input(fraasi))
while sivu < 0.01:
sivu = float(input(fraasi))
return sivu
... | true |
d2a7dc9657d3c03124364566d5357cfb366e9728 | Schachte/Learn_Python_The_Hard_Way | /Excercise_39/Excercise_39.py | UTF-8 | 1,285 | 4.46875 | 4 | [] | no_license | ################################
######### Excercise 39##########
# Learning Python The Hard Way#
####### Ryan Schachte ##########
################################
#Description:
#Working with dictionaries in Python
#Mapping multiple items to elements in a list. Each element is a key.
#Example
dict_info = {
'Sta... | true |
0f4f2e9213df7926ddbc9f7c061b48487bd8acf0 | dael-victoria-reyes/data-act-broker-backend | /dataactbroker/helpers/generic_helper.py | UTF-8 | 5,755 | 2.546875 | 3 | [
"CC0-1.0"
] | permissive | import re
import calendar
from dateutil.parser import parse
import datetime as dt
from suds.client import Client
from sqlalchemy.dialects.postgresql.base import PGDialect
from sqlalchemy.sql.sqltypes import String, DateTime, NullType, Date
from dataactcore.config import CONFIG_BROKER
from dataactcore.utils.responseE... | true |
0ca865dd48206c7b599a61dfdc5f0c4696fb5c7a | KyloMUN/cs2005_group_project | /notes/jacks-assign5/auth_frontend_example/persistence.py | UTF-8 | 736 | 2.765625 | 3 | [] | no_license | """Persistence
Manage the storage of structures for the applications different modules.
'Structures' are classes defined within structures.py
"""
import os
from structures import *
class Persistence:
__shelf_instance = {}
def __init__(self):
"""Create a persistence interface."""
self._shelf ... | true |
179e2a64fe881627561a2636ada438691c8e1c18 | damianradowiecki/notes | /docker/example/looking_for_five.py | UTF-8 | 3,938 | 2.90625 | 3 | [] | no_license | from sklearn.datasets import fetch_mldata
import numpy as np
from sklearn.linear_model import SGDClassifier
from sklearn.model_selection import cross_val_score
from sklearn.base import BaseEstimator
from sklearn.model_selection import cross_val_predict
from sklearn.metrics import confusion_matrix
from sklearn.metrics i... | true |
83953e65a568c45e7b3ba5edc2ab410d8b17408e | rpucella/Ragnarok | /tests/test_engine.py | UTF-8 | 2,921 | 2.890625 | 3 | [] | no_license | import pytest
from src import engine
from src import lisp
_CONTEXT = {'env': lisp.Environment() }
def _make_sexp (struct):
if type(struct) == type([]):
result = lisp.SEmpty()
for r in reversed(struct):
result = lisp.SCons(_make_sexp(r), result)
return result
else:
r... | true |
3c49a7e7ebd3ef584e15b9a0f189354a443b96f0 | Sceptre/sceptre | /sceptre/resolvers/placeholders.py | UTF-8 | 3,622 | 3 | 3 | [
"Apache-2.0"
] | permissive | from contextlib import contextmanager
from enum import Enum
from threading import Lock
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from sceptre import resolvers
# This is a toggle used for globally enabling placeholder values out of resolvers when they error
# while resolving. This is important when p... | true |
bbec4b6d4484395029f0e890b1192fc38ea2d173 | younseunghyun/YBSOC | /pre_processing/random_word.py | UTF-8 | 4,638 | 3.109375 | 3 | [] | no_license | __author__ = "Lynn"
__email__ = "lynnn.hong@gmail.com"
"""
This is script for handling exceptional terms which must not be removed from the original text.
'random_generator' function is used to create mapping words randomly.
The simple usage guide is in the main function.
"""
import string
import random
import re
#f... | true |
8d9ff0c06e8b5e2bb5b7837722fdc26f72232f64 | shen-huang/selfteaching-python-camp | /exercises/1901090010/d07/mymodule/stats_word.py | UTF-8 | 2,305 | 3.96875 | 4 | [] | no_license | import re
#(1)定义一个名为 stats_text_en 的函数
def stats_text_en(text):
#(2)函数接受一个字符串 text 作为参数。如果不是字符串,则提示
if not isinstance(text,str):
return '请输入字符串'
#(3)统计参数中每个英文单词出现的次数
# 1.替换掉所有的符号
word_str = text.replace(','," ").replace('.'," ").replace('!'," ").replace('*'," ").replace('--'," ")
# 2.按照... | true |
572cdc18895cbc0cc500b595a68d233ac44bfaa8 | kzorluoglu/python_alltag | /DataSortingWithLambda.py | UTF-8 | 338 | 3.78125 | 4 | [] | no_license | students = [
("Max", 1),
("Necmettin", 5),
("Temel", 4),
("Erik", 1)
]
def students_key(student):
return student[1]
# standart way
students.sort(key=students_key, reverse=True)
print(students)
# with lambda
students.sort(key=lambda student: student[1])
print(students)
f = lambda student: studen... | true |
8ad2ad25b7ab6ca16abcfb6e6242511609bff860 | xinmiaoo/leetcode_Aug_3 | /0015. 3Sum.py | UTF-8 | 862 | 2.828125 | 3 | [] | no_license | class Solution(object):
def threeSum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
ans=[]
n=len(nums)
nums.sort()
for i in range(n-2):
if i>0 and nums[i]==nums[i-1]:
continue
l,r=i+1,n-1
... | true |
e5dd30cd0fa792b7dcb49ee2649be5f2f51e5fb5 | anuragseven/coding-problems | /online_practice_problems/puzzles/3 Divisors.py | UTF-8 | 1,623 | 3.5 | 4 | [] | no_license | # You have given a list of q queries and for every query, you are given an integer N.
# The task is to find how many numbers less than or equal to N have numbers of divisors exactly equal to 3.
class Solution:
def threeDivisors(self, queries):
primes = self.sieveOfE(round(max(queries) ** 0.5))
pri... | true |