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 |
|---|---|---|---|---|---|---|---|---|---|---|
25c532503d291c6017f70cbd379959090f248729 | AlexDeimon/MisionTic2020 | /Clases_ciclo1/ejemploFormat.py | UTF-8 | 124 | 2.65625 | 3 | [] | no_license | Dia = 'lunes'
dia = 'martes'
dIA = 'jueves'
DIA = 'miercoles'
print('Dia={} dia={} DIA={} dIA={}'.format(Dia,dia,DIA, dIA)) | true |
ddcedfa1bab6c307fa5668c16fb853bd584a17b2 | lbr10/TIPE | /Vallées 2.py | UTF-8 | 11,835 | 2.828125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
from time import time
plt.style.use('seaborn-whitegrid')
def Node(coords=(0,0),valley=0,roads=[],town=False,id=-1) :
n = [coords,valley,roads,town,id]
return n
def Road(start,end,height=0,is_tunnel=False) :
r = [start,end,heigh... | true |
43f4fef6fcf188279b38359828239b05e537681f | Will-Chenn/Python_Tree_Visualization | /tree_data.py | UTF-8 | 15,381 | 3.796875 | 4 | [] | no_license | """Assignment 2: Trees for Treemap
=== CSC148 Fall 2020 ===
Diane Horton and David Liu
Department of Computer Science,
University of Toronto
=== Module Description ===
This module contains the basic tree interface required by the treemap
visualiser. You will both add to the abstract class, and complete a
co... | true |
50689e58661a4b2d47cc4954cea7e06944d21bc1 | winterash2/algorithm_study_2021_1 | /210225-210228/백)1018 체스판 다시 칠하기/이동재.py | UTF-8 | 509 | 2.71875 | 3 | [] | no_license | N, M = map(int, input().split())
board = [[] for _ in range(N)]
for i in range(N):
board[i] = [0 if c == 'W' else 1 for c in input()]
# [print(board[i]) for i in range(len(board))]
answer = 1e9
for baseY in range(N-8+1):
for baseX in range(M-8+1):
count = 0
for i in range(8):
for j... | true |
d98c309cbcff800d7eacce5451f94861ffcd6297 | blmoistawinde/sjtu-cs420-project-2019 | /VGG++_VGGA/results/plot.py | UTF-8 | 2,617 | 2.546875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def get_info_from_log(filename="VGG++.out"):
mode = 0
mode_str = ["train","val","test"]
losses = {"train":[], "val":[], "test":[]}
accs = {"train":[], "val":[], "test":[]}
with open(filename,"r",encoding="utf-8") as f:
... | true |
07a1f57663643c1664e764a76db9f1be3a381066 | abhisht51/OpenColorIO | /tests/python/DisplayViewTransformTest.py | UTF-8 | 7,886 | 2.5625 | 3 | [
"BSD-3-Clause",
"CC-BY-4.0"
] | permissive | # SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
import unittest
import os
import sys
import PyOpenColorIO as OCIO
from UnitTestUtils import TEST_DATAFILES_DIR, TEST_NAMES, TEST_DESCS
class DisplayViewTransformTest(unittest.TestCase):
TEST_SRC = ['abc', 'raw', '$... | true |
292e5d89b5f1a99f291a66b08249b829b06c3c30 | edoermini/pygma-enigma | /pygma/rotor.py | UTF-8 | 1,132 | 3.875 | 4 | [] | no_license | class Rotor:
def __init__(self, letters, position):
self.rotor = []
self.letters = letters.lower()
self.position = position
self.alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
#check if a letter between the... | true |
fc743b0927f7247f6e3da13f0e4a06e5be328230 | RustyRaptor/CS278 | /Lab8/Lab8.py | UTF-8 | 752 | 3.734375 | 4 | [] | no_license | vals = input("Please enter values of a, b, c, and M in this order (separated "
"by spaces): ")
vals = vals.split(" ")
vals = [int(x) for x in vals]
begin_cycle = False
flag = 0
cycles = 0
start = vals[2]
start2 = vals[2]
for i in range(0, vals[3] - 1):
if begin_cycle:
cycles += 1
if f... | true |
d3f4e20d1d8947681d972799ba96a527fd0e436d | helloshyreckdc/learn_python | /function/hello.py | UTF-8 | 144 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# The first line is used to designate a interpreter, second line is coding
a = abs
print(a(-1))
| true |
e684d054ac7f4ad4239f38e040652f3260d2b28d | othieno/geotagx-tool-validator | /tests/test_helper.py | UTF-8 | 14,066 | 2.765625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#
# This module is part of the GeoTag-X project sanitizer tool.
# It contains unit tests for helper module.
#
# Author: Jeremy Othieno (j.othieno@gmail.com)
#
# Copyright (c) 2016-2017 UNITAR/UNOSAT
#
# The MIT License (MIT)
# Permission is hereby granted, free of charge, to any person obtaining... | true |
5dda30491f1a7195df3b04bd236d13118b4c81bc | serhatbilyaz/ME382 | /main/PythonApplication1/contourplot.py | UTF-8 | 1,122 | 2.59375 | 3 | [] | no_license | # This script plots the temperature contour plots
import numpy as np
import matplotlib
from matplotlib import pyplot
def compareanaly(T_FD_all,T_analy_all,rLoc,zLoc,tsample,delt,Ncellr,Ncellz,t):
print("Creating contourplot ...")
i=t/delt
i=int(np.around(i)) # Time index
if i==tsample.shape[0]:
... | true |
6e491612eeecdd0fb0aff723ec8438731df7a5c3 | haowen-xu/tfsnippet | /tfsnippet/utils/misc.py | UTF-8 | 11,370 | 2.71875 | 3 | [
"MIT"
] | permissive | import contextlib
import os
import re
import threading
import time
from contextlib import contextmanager
import numpy as np
import tensorflow as tf
from .type_utils import is_integer, TensorArgValidator, is_tensor_object
__all__ = [
'humanize_duration', 'camel_to_underscore', 'maybe_close',
'iter_files', 'ET... | true |
b29a5d901157105ea8d6a150113095dc4d226cbc | volkanakcora/Volkan_Scripts | /Temel/Workshops/sayiBulma.py | UTF-8 | 450 | 3.890625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
sayi1 = int(input("lütfen birinci sayiyi giriniz"))
sayi2 = int(input("lütfen ikinci sayiyi giriniz "))
sayi3 = int(input("lütfen üçüncü sayiyi giriniz "))
if (sayi1 >= sayi2) and (sayi1 >=sayi3):
print("birinci sayi en büyük")
if (sayi2 >= sayi1) and (sayi2 >=sayi3):
prin... | true |
c53ad696a69c3ce0076963f6be8ad190cd57f14f | darkelle24/Ordered-Dictionary | /Dictionnaire_Ordonne.py | UTF-8 | 2,391 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python3
class DictionnaireOrdonne:
def __init__(self, base={}, **donne):
self.cles = []
self.valeur = []
if type(base) not in (dict, DictionnaireOrdonne):
raise TypeError("le type attendu est un dictionnaire (usuel ou ordonne)")
for cle in base:
s... | true |
f2f0598931a2b91f3ba11a4f39d6d0e9eee7d36a | alexandriatwo/nmn | /python/csv_to_json.py | UTF-8 | 1,805 | 3.078125 | 3 | [] | no_license | """Converts the nmn survey csv into json format.
Just is just easier to handle.
"""
import csv
import json
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-i", "--infile",
dest="infile",
help="CSV to read", metavar="INFILE")
parser.add_option("-o", "--... | true |
d32b07b8d786c36e7fa5bf9ced5e6f00c1bccf60 | biswajyoti2607/quora-question-pairs-experiments | /Decomposition Attention Model/pair_classifier_infer.py | UTF-8 | 4,230 | 2.671875 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
import os.path
import pandas as pd
import nltk
from tqdm import tqdm
from pair_classifier_model import Model
def add_embedded_sentences(df, word_vec_dict):
"""Here sentences are sanitized, tokenized, and vector representations of question are added to the dataframe."""
... | true |
f8bbaaf114b4dc00fb408415ecff37f8a28e2ec0 | ThomasMLawrence/shuffle | /shuffle.py | UTF-8 | 1,656 | 4.09375 | 4 | [] | no_license | #Michael Lawrence
#CS350
#915247432
#Professor Lund
#Hw 2 program
import random
import time
import string
def shuffle(length, A):
for i in range(0, length):
j = random.randint(0, length - 1)
#gets the index of a random cell
A[i], A[j] = A[j], A[i]
#swaps the i cell with a random c... | true |
fcf001667d2ef2665eb11df2d9b03b8d76f2a0dc | owenparsons/EmergentPredictiveCoding | /train.py | UTF-8 | 2,655 | 2.828125 | 3 | [] | no_license | import torch
import numpy as np
from typing import Callable
from functions import *
from ModelState import ModelState
from Dataset import Dataset
def test_epoch(ms: ModelState,
dataset: Dataset,
loss_fn: Callable[[torch.FloatTensor, torch.FloatTensor], torch.FloatTensor],
s... | true |
9536d445fa188c49eca8bac54c91c42837d7e9be | yanqiangmiffy/personal-credit-evaluation | /main.py | UTF-8 | 7,205 | 2.96875 | 3 | [] | no_license | # !/usr/bin/env python3
# -*- coding:utf-8 _*-
"""
@Author:yanqiang
@File: main.py
@Time: 2018/12/5 11:43
@Software: PyCharm
@Description:
"""
from __future__ import print_function
import pandas as pd
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics imp... | true |
5943f032b17e07afa06f653a81a3f00903bb3af7 | ttttaaaddf/python- | /2.py | UTF-8 | 84 | 3.265625 | 3 | [] | no_license | a = input("number")
b = input("bumber2")
area = 3.14 * int(a) * int(b)
print(area) | true |
95211a65c97d75e2c9258ee561705f3a5b2ec8d5 | Maheerr2707/C-102-HW | /searchWords.py | UTF-8 | 434 | 3.375 | 3 | [] | no_license | import os
import shutil
filename = input("Enter the file name")
f = open(filename)
fileline = f.readlines()
found = False
searchString=input("Enter your word you want to search")
for lines in fileline:
words = lines.split()
for word in words:
if word == searchString:
fo... | true |
f7bc5b3f429ea6e32633cb0c7e1ab5ded69455fa | jennhu/vmf_vae_nlp | /NVLL/data/lm.py | UTF-8 | 4,092 | 2.765625 | 3 | [
"MIT"
] | permissive | import os
import torch
from NVLL.util.util import Dictionary
from NVLL.util.util import GVar
class DataLM(object):
"""Data structure and preprocessing for language model (Yelp with sentiment bit and PTB) """
def __init__(self, path, batch_sz, eval_batch_sz, condition=False):
"""
:param path:... | true |
e3a5543f29d547f5733fd680d312c515adc1a8ff | SeniorGlassMaster/Dual-Attention-for-VAD | /DB_reader.py | UTF-8 | 4,102 | 2.546875 | 3 | [] | no_license | import logging
import os
from glob import glob
import pandas as pd
import config as c
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
pd.set_option('max_colwidth', 100)
# Recursively finds all feature files matching the pattern.
def find_wav_file... | true |
1174e91c13788dcd33056f17f973bc9c9e9d600b | ArTeMkA-B/Kalah | /Kalah.py | UTF-8 | 6,432 | 3.359375 | 3 | [] | no_license | from GameHistory import *
from copy import deepcopy, copy
class Kalah:
def __init__(self):
self.state = [6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 0]
self.cells_number = 14
self.active_player = 0 # players: 0 and 1
self.kalah0_index = 6
self.kalah1_index = 13
self.IsEn... | true |
cd9d2590ec1b46b6f1f549d47346ab934fbce21f | viralparekh/cvitmlss17 | /lab2/Q1/redundant/AddBinaryStrings_bkp.py | UTF-8 | 4,467 | 2.75 | 3 | [] | no_license | # coding: utf-8
# =============================================================================
# Make a simple RNN learn binray addition
# Binary string pairs and the sum is generated for a given #numBits
# ============================================================================
# for ML Summer School 2017 at III... | true |
c598435e65fe6fa2949e4ad9c04c0dfa916749b0 | fukuoka-tomo/image_processing | /median6.py | UTF-8 | 2,951 | 2.5625 | 3 | [] | no_license | import cv2
import os
import numpy as np
def main():
'''
訓練用画像のメディアンフィルタ実行
RGBそれぞれでメディアンフィルターを実施、その結果をカラーとして合成
'''
f_name = "bridge1"
filep = "clack1"
label1 = "Negative"
cg = "gray"
#画像ファイルパス
#path = "/home/fuku/openCV/concrete-crack-images-for-classification/images/Negative"
... | true |
bd015124f4c4a044c33f465489dafac24d8e5f4f | nayomipoligami/repeat | /8.bölüm (NESNEYE YONELIK PROGRAMLAMA)/hatacozum1.py | UTF-8 | 904 | 3.109375 | 3 | [] | no_license | class bilgisayar():
def __init__(self,marka="Bilgi Yok",model="Bilgi Yok",renk="Bilgi Yok",tur="Bilgi Yok",boyut="Bilgi Yok"):
print("init fonksiyonu çağırıldı")
self.markasi = marka
self.modeli = model
self.rengi = renk
self.turu = tur
self.boyutu = boyut
... | true |
6ef73786151126d0f8a48cc9b17fbea6050819fb | kstats/KTProject | /irt_combined.py | UTF-8 | 5,119 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env
import numpy as np
from tqdm import tqdm
from scipy.sparse import lil_matrix
from sklearn.linear_model import LogisticRegression
from util.data_reader_a import KDD
from scipy.stats import norm
TOTAL_EPOCHS = 10
def logistic(x):
return 1.0 / (1.0 + np.exp(-x))
class IRT(object):
def __init__(sel... | true |
769df7074d34c4d0f80c5f982f171aff0362d8e0 | chakravarthi-giduthuri/DSA | /Algorithms/Search/ExponentialSearch.py | UTF-8 | 741 | 4.0625 | 4 | [] | no_license | def binarySearch(arr, l, r, x):
if r >= l:
mid = int(l + (r-l)//2)
if arr[mid] == x:
return mid
if arr[mid] > x:
return binarySearch(arr, l, mid-1, x)
if arr[mid] < x:
return binarySearch(arr, mid+1, r, x)
return -1
def exponentialSearch(a... | true |
9dbe689b2c652a5fac28a9aa9058ec2cc5ce54f9 | SeltzerIsTheNewCoke/Gokay-s-Homeworks | /Week3HW_to_guess_it_or_not_to_guess_it.py | UTF-8 | 891 | 4.375 | 4 | [] | no_license | import random
gimme_a_number = random.randint(1, 102)
guesses = 0
while True:
number = int(input("Enter a number between 1 and 102, yes 102. (Enter 0 to let the universe know you give up):"))
guesses += 1
if(number == 0):
print("See you in another incarnation, maybe you'll co... | true |
8bb95085eae1e8978be5db640bbe44894aa45196 | richardambridge/bongopi | /bongopi.py | UTF-8 | 1,759 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python
from control import control
import signal
import sys
import logging
import logging.handlers
LOG_FILENAME = "/tmp/bongopi.log"
LOG_LEVEL = logging.INFO # Could be e.g. "DEBUG" or "WARNING"
# configure logging to log to a file,
# making a new file at midnight and keeping the last 3 day's data
# Give t... | true |
3f26f227968b082bf54cda05d47298136892780f | ggmpteam/ggmp-client-py | /lib/messages.py | UTF-8 | 4,127 | 2.578125 | 3 | [] | no_license | __author__ = 'bretmattingly'
class Action:
def __init__(self, ACK, cl, mid, ar, an, ac1, ac2):
self.ack = ACK
self.cl = cl
self.mid = mid
self.ar = ar
self.an = an
self.ac1 = ac1
self.ac2 = ac2
self.stream = bytearray([0x00]) if ACK else bytearray([... | true |
aa723735e88700649fbf7e6aada7a4952318fd81 | kunjabijukchhe/Pharmacy-Management-System | /stock.py | UTF-8 | 3,439 | 3.40625 | 3 | [] | no_license | import sys
import os
import pymysql
py = sys.executable
def back():
os.system('%s %s' % (py, 'main.py'))
def addMedicine():
try:
conn = pymysql.connect(host="localhost", user="root", password="root", database="stock")
myCursor = conn.cursor()
name = input("Enter the Medicine Name:"... | true |
c1f64a7ac7cfef3f0877d23a97f69dcbde705201 | priver/ansible-playbooks | /playbooks/filter_plugins/postgresql_filters.py | UTF-8 | 1,729 | 2.734375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""Jinja2 filters for Postgresql config files."""
MULTIPLES = (
('GB', 1024 ** 3),
('MB', 1024 ** 2),
('kB', 1024 ** 1),
('', 1024 ** 0)
)
def pg_size(size):
"""Return string representation of memory size."""
for suffix, factor in MULTIPLES:
if size >= factor * ... | true |
62e27861a697f83dfdbf9615bff3b0823ea537be | sprax/1337 | /python3/test_l0220_contain_duplicate_3.py | UTF-8 | 501 | 3.046875 | 3 | [] | no_license | import unittest
from l0220_contains_duplicate_3 import Solution
class Test(unittest.TestCase):
def test_solution(self):
self.assertEqual(True, Solution().containsNearbyAlmostDuplicate([1, 2, 3, 1], 3, 0))
self.assertEqual(True, Solution().containsNearbyAlmostDuplicate([1, 0, 1, 1], 1, 2))
... | true |
2e8ea45e2af374c6ef6d900886c34836e1115ab3 | miguelfajardoc/holbertonschool-higher_level_programming | /0x02-python-import_modules/2-args.py | UTF-8 | 351 | 3.515625 | 4 | [] | no_license | #!/usr/bin/python3
if __name__ == "__main__":
from sys import argv
n = len(argv) - 1
if n == 1:
arg = "argument"
else:
arg = "arguments"
if n == 0:
print("{:d} {}.".format(n, arg))
else:
print("{:d} {}:".format(n, arg))
for i in range(1, n + 1):
print(... | true |
eeeca333da7db4c52f14db8462a4d4453d716820 | serpeilop/proyecto_GPI | /Recursos.py | UTF-8 | 3,944 | 2.9375 | 3 | [] | no_license | from Tkinter import *
from Recurso import *
from Tabla import *
from Histograma import *
from ttk import *
class Recursos:
recursos = []
def getRecursos(self):
return self.recursos
def crearRecurso(self, nombre, capacidad, frameCrear, frameAsignar, var_recurso):
recurso = Recurso(str(nomb... | true |
32e6f8f80373b491f36fc20b134c2c5f86bf792e | alercunha/adventofcode | /2021/day12.py | UTF-8 | 2,614 | 3.3125 | 3 | [] | no_license | from collections import Counter
class Node:
def __init__(self, name):
self.connections = list()
self.name = name
self.small = name[0].islower()
def find_all_paths(self, dest, valid_path_func):
paths = list()
self.__find_all_paths(dest, list(), paths, valid_path_func)
... | true |
53d306831b584590504b46e4afd0c545aebd9e2e | epfl-dlab/when_sheep_shop | /code/python/server/parse_ratings_for_users_beers.py | UTF-8 | 1,743 | 3.15625 | 3 | [
"MIT"
] | permissive | import json
import pandas as pd
import gzip
def parse(filename):
"""
Parse a txt.gz file and return a generator for it
Copyright © 2017 Gael Lederrey <gael.lederrey@epfl.ch>
:param filename: name of the file
:return: Generator to go through the file
"""
file = gzip.open(filename, 'rb')
... | true |
522ac088fb0421f7f1725ca6da708e2ec38f27d7 | aaaaaaason/tx-study-tool | /src/txtool/database.py | UTF-8 | 3,410 | 2.59375 | 3 | [
"MIT"
] | permissive | """Provide database utility."""
import logging
from typing import (
Any,
Callable,
Dict,
)
import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.exc import (
IntegrityError,
ResourceClosedError,
)
from txtool import (
config,
step,
)
def get_default_session_id() -> int:
"... | true |
83b9e6ec9dd956819782907eab4e26a13ca3ae85 | JeffreyBenjaminBrown/play | /_not_music/machineLearn/pyBrain/setup.py | UTF-8 | 1,089 | 2.65625 | 3 | [] | no_license | # exec(open("./reading.py").read())
# http://pybrain.org/docs/tutorial/netmodcon.html
from pybrain.structure import FeedForwardNetwork
from pybrain.structure import LinearLayer, SigmoidLayer
from pybrain.structure import FullConnection
if 1: # create network
n = FeedForwardNetwork()
inLayer = LinearLayer(2,name ... | true |
5ee4cf85afec686663e08420bc72f6a3e94c9f69 | sungcalvin/python | /2015 Data Funconference - Fullerton CA - Python Intro/intro/x_modules/mod_logger.py | UTF-8 | 189 | 2.578125 | 3 | [
"MIT"
] | permissive | import datetime
def log_warning(msg):
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
print "%s, '%s'" % (now, msg)
if __name__ == '__main__':
log_warning("test now") | true |
f060d8dc4a6a71fb0404a3e96aee664d7547becc | MaxPoon/Leetcode | /python/681.NextClosestTime.py | UTF-8 | 952 | 3.15625 | 3 | [] | no_license | class Solution(object):
def nextClosestTime(self, time):
"""
:type time: str
:rtype: str
"""
numbers = set()
for index in (0,1,3,4):
numbers.add(int(time[index]))
timeInMin = int(time[:2])*60 + int(time[3:])
oneDayInMin = 24*60
minG... | true |
edc5ef00957d9ef93bb8f8ced0fdf49c20cc1270 | jssellars/aniket_filed | /Core/utils.py | UTF-8 | 1,348 | 3.3125 | 3 | [] | no_license | import humps
def snake_to_camelcase(data):
if isinstance(data, list):
camelcase = [{humps.camelize(key): value for key, value in entry.items()} for entry in data]
else:
camelcase = {humps.camelize(key): value for key, value in data.items()}
return camelcase
DOT = "."
PLACEHOLDER = "__DO... | true |
8711198b027d3684193f43833a29fd06f684e1fe | Chetongsheng/flask-limiter | /flask_limiter/wrappers.py | UTF-8 | 1,773 | 2.75 | 3 | [
"MIT"
] | permissive | from flask import request
from limits import parse_many
class Limit(object):
"""
simple wrapper to encapsulate limits and their context
"""
def __init__(
self, limit, key_func, scope, per_method, methods, error_message,
exempt_when
):
self.limit = limit
self.key_fu... | true |
bcbf1cf7025088bf44c93c218f5a9647b17cc347 | bantmen/adversarial-examples | /model.py | UTF-8 | 4,200 | 2.71875 | 3 | [] | no_license | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
def construct_convnet(num_classes=10, input_shape=(28, 28, 1)):
"""
Simple convnet that should have ~1.5 error rate on... | true |
b3f315b518c31f531ab1b4b28f202a3dcf177bcd | Miranjunaidi/CSE-304-Lab | /Ex2/datawriter.py | UTF-8 | 649 | 2.890625 | 3 | [] | no_license | import numpy as np
import random
import string
No_of_records = 1000000
Branches = ["CSE","ECE","MEC", "ELC"]
def roll_no(roll_list):
rand_index = np.random.randint(0,len(roll_list)-1)
a = roll_list.pop(rand_index)
return a
r_no = []
for i in range(No_of_records):
r_no.append(i)
file = open("All_Unifo... | true |
be96737a1d402ab265b23a27470a5c0bf16dc45b | annagrace-phillips/Pandas | /pandas_series.py | UTF-8 | 837 | 4.125 | 4 | [] | no_license | import pandas as pd
grades = pd.Series([87,100,94])
print(grades)
same_grade = pd.series(98.6, range(3))
print(same_grade)
#0 98.6
#1 98.6
#2 98.6
#dtype: float64
print(grades[0])
grades.count()
grades.mean()
grades.min()
grades.max()
grades.std()
print(grades.describe())
#you can specify custome indices with ... | true |
59fef746204f623de5ed2b43a6ad480e3b5e9c78 | yroosel/Graduaat-DEVASC | /DNA Center 1 Northbound API Hello Network Simple.py | UTF-8 | 2,883 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[13]:
#### DNA Center => Manage Enterprise Networks and Devices
#### Adapted by Y. Rooseleer, BIASC
#STEP 1 => DEFINE HARD CODED VARIABLES TO BE USED IN THE SCRIPT
import requests
import datetime
import json
requests.packages.urllib3.disable_warnings()
print ("Current date a... | true |
a6de7a6419e42b58a05c4b51e293814a2eb1a66d | i2mint/py2misc | /py2store/kv.py | UTF-8 | 17,426 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | from collections.abc import MutableMapping, Mapping
from py2store.util import lazyprop
from py2store.errors import KeyValidationError
from py2store.paths import PrefixRelativizationMixin
from dol.paths import PrefixRelativization
# TODO: Define store type so the type is defined by it's methods, not by subclassing.
cl... | true |
aabe8185b4ae539c6fbbc90db6702d5a4a198afb | binhdoitsme/python_ss1 | /practice/practice4.py | UTF-8 | 311 | 3.640625 | 4 | [] | no_license | #
def sumFourOfFive(arr: list):
intArr = list()
for num in arr:
intArr.append(int(num))
intArr.sort()
print(sum(intArr[0:len(intArr) - 1]), sum(intArr[1:len(intArr)]), sep=' ')
return
arr = list()
for k in input().split(" "):
arr.append(int(k))
sumFourOfFive(arr)
| true |
1f82d100b0e388ecd6845c33b704a5c0beaa56ac | TiganyZ/O2_N2 | /o2_analytic_diag.py | UTF-8 | 17,118 | 2.765625 | 3 | [] | no_license | # /usr/env/bin/python3.6
## This is a file which has the analytic solution to the tight binding Hamiltonian of O2 ##
import numpy as np
import matplotlib.pyplot as plt
import opt_general as g
import bayes_opt_g_process as gpr
"""
This is the Hamiltonian for diatomic Oxygen
H = np.array( [ [ s, ss, 0, 0, ... | true |
e7e0ff9a0d29c1335c5a741f76b2880930bad776 | JanBergsma/Project-Euler | /tests/test_problem2.py | UTF-8 | 863 | 2.703125 | 3 | [] | no_license | from src.problem2 import a014445, a014445_iter
A014445 = [
0, 2, 8, 34, 144, 610, 2584, 10946, 46368, 196418, 832040, 3524578,
14930352, 63245986, 267914296, 1134903170, 4807526976, 20365011074,
86267571272, 365435296162, 1548008755920, 6557470319842, 27777890035288,
117669030460994
]
def test_a01444... | true |
00d99b604e0ebc553eac8bec073f3d9de66f496f | gregorymcintyre/DroneCollaboration | /imageConversion/imageConversion.py | UTF-8 | 660 | 2.875 | 3 | [] | no_license | from PIL import Image
import PIL.ImageOps
import numpy as np
image = Image.open('crop.png')
print("Processing image...")
inverted_image = PIL.ImageOps.invert(image)
print("Image inverted")
gray_file= inverted_image.convert('LA') # convert grey
print("Image converted to greyscale")
resize_image = gray_file.resize((... | true |
0984fb5b89f5c6d2dce14ca90a820dddc5735380 | mohitsaroha03/The-Py-Algorithms | /src/7.2Sets/relative sort array.py | UTF-8 | 675 | 3.984375 | 4 | [
"MIT"
] | permissive | def relativeSortArray(arr1, arr2):
# result, the sorted array.
result = []
# sort arr1, so any elements not in arr2 can be appended to results in ascending order.
arr1 = sorted(arr1)
# set to check any elements in arr1 left out of arr2.
arr2set = set(arr2)
# go through all elements in arr2, ... | true |
61b62623bd22db7b80fb5917c46d959575cd81ec | adityaranjan/KattisSolutions | /encodedmessage.py | UTF-8 | 421 | 2.890625 | 3 | [] | no_license | #Encoded Message
NumTestCases = int(input())
for i in range(NumTestCases):
EncodedWord = list(input())
j = 0
NewWord = ""
for j in range(int(len(EncodedWord) ** 0.5)):
k = int((len(EncodedWord) ** 0.5) - (j + 1))
a = 0
for a in range(int(len(EncodedWord) ** 0.5)):
... | true |
c60fcf509eeb871ca5a823d1d6b039b4f157366c | samarthgupta1/assignments | /file_handling.py | UTF-8 | 1,143 | 3.296875 | 3 | [] | no_license |
print "QUESTION 1"
#QUESTION 1
fr=open("new.txt","r")
l=fr.readlines()
print l
print len(l)
n=input("enter the no from which ypu want lines")
for i in range(len(l)-n,len(l)):
print l[i]
print "QUESTION 2"
#QUESTION 2
s=fr.read()
d=s.split()
n=raw_input("enter the word to be counted")
if n in s:
print s.coun... | true |
3341503c933a84df16ba84f51de6b0082360fcef | SwatiTParshuramkar/Function_InPython | /Question4.py | UTF-8 | 336 | 3.109375 | 3 | [] | no_license | # def addnumbers(num1,num2):
# print(num1+num2)
# addnumbers(23,50)
# def addnumbers(num1,num2):
# print(num1+num2)
# num1 = 56
# num2 = 12
# addnumbers(num1,num2)
#
# Second_Part
def sum(list1,list2):
i=0
while i<len(list1):
print(list1[i]+list2[i])
i+=1
sum([10,25,5... | true |
9cb4598c389bb0ecc7e8565d1b0bdec2fb949559 | fhasanzade/microbial_evolution | /Animations_Interaction.py | UTF-8 | 3,253 | 2.5625 | 3 | [] | no_license |
import numpy, gzip, pickle, dill, sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pylab import *
import matplotlib.animation as animation
from mpl_toolkits.axes_grid1 import make_axes_locatable
def main():
fname = sys.argv[1]
fh = gzip.open(fname, ... | true |
6b0b3835ffc0c4c09e95f6c4043da828b199bbb3 | xlyang0211/learngit | /spiral_matrix.py | UTF-8 | 1,530 | 3.609375 | 4 | [] | no_license | __author__ = 'seany'
class Solution:
# @param {integer[][]} matrix
# @return {integer[]}
def spiralOrder(self, matrix):
direction = 0
ret = []
row = len(matrix)
if row == 0:
return ret
col = len(matrix[0])
if col == 0:
return ret
... | true |
ab61091aa9d894161436dea2b94a43438155df98 | prasantadh/project_euler | /euler7-2.py | UTF-8 | 297 | 3.28125 | 3 | [] | no_license | import time
start_time = time.time()
prime_counter = 6
n = 13
while prime_counter!= 10001:
n = n + 1
prime = True
for i in range(2,int(n**0.5+1)):
if n % i == 0:
prime = False
break
if prime == True:
prime_counter+=1
print(prime_counter, n)
print (n)
print(time.time()-start_time) | true |
893bbe5aad9e7847cad30177b502bc2125424bde | gnosis-xian/identify_express_via_waybillno | /import_dataset.py | UTF-8 | 1,826 | 2.5625 | 3 | [] | no_license | import logging as log
from collections import defaultdict
from gensim import corpora, models, similarities
import constants
import file_funcs
import utils
log.basicConfig(format=constants.log_format, level=constants.log_level)
documents = []
def participles(file_content_map):
# 分词
texts = []
for key i... | true |
2f26d206c5e63481b1470dc57f8064216f0ac159 | Aasthaengg/IBMdataset | /Python_codes/p04013/s552751590.py | UTF-8 | 201 | 2.84375 | 3 | [] | no_license | N, A = map(int, input().split())
X = list(map(lambda x: int(x) - A, input().split()))
d = {0: 1}
for cur in X:
for k, v in list(d.items()):
d[cur + k] = d.get(cur + k, 0) + v
print(d[0]-1) | true |
4d41799630f851afcb4d40a058f23528fc8ba82c | medical-projects/Unet_Medical_Segmentation | /predict.py | UTF-8 | 5,380 | 2.640625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# @Time : 2021/2/8 0:00
# @Author : Zeqi@@
# @FileName: predict.py
# @Software: PyCharm
from models.Unet import Unet
class Unet_inference(object):
_defaults = {
"model_path": 'logs/ep496-loss0.294-f0.915-IOU0.845.h5',
"model_image_size": (512, 512, 3),
"num_cla... | true |
fc8a3df10342090b3747445961b454ac3896efdd | erick1984linares/t10_linares_rojas | /rojas/app5.py | UTF-8 | 930 | 3.328125 | 3 | [] | no_license | from Rojas import libreria
def agregar_votante():
nombre=libreria.pedir_nombre("ingrese nombre del votante: ")
dni=libreria.pedir_dni("ingrese el dni: ")
content=nombre+"-"+dni+"\n"
libreria.guardar_datos("votantes.txt",content,"a")
print("votante agregado")
def mostrar_votantes():
ler=libreri... | true |
3b9c49fa81f90b1e9100b4d3f5178f4c1f5e34a7 | dvilela/wait_response | /wait_response/wait_response.py | UTF-8 | 1,983 | 3.25 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
from argparse import ArgumentParser
from time import sleep
from requests import get as http_get
URL, ATTEMPTS, SLEEP_SECS, STATUS_UP = 'http://localhost:8080/health', 20, 1, 'UP'
def health_match_status(url, status):
r = http_get(url)
if r.status_code is not 200:
... | true |
0657ba6b1339408b65fe35f416d40bd3da236735 | guidorony/Calculadora-en-Python | /V1.2 Standar/calculadora V1.2 standar.py | UTF-8 | 5,403 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 27 18:34:25 2020
@author: Rony choquemaqui
"""
from tkinter import *
from math import *
ventana = Tk()
ventana.iconbitmap("../image/UNA.ico")
ventana.title("Calculadora basica")
ventana.geometry("400x600")
ventana.resizable(False,False)
ventana.configure(background="gr... | true |
146077313407a01bfa1616f371f25286772ff4b5 | nickromano/django-daily-digest | /leather/axis.py | UTF-8 | 6,037 | 2.984375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import xml.etree.ElementTree as ET
import six
from leather import svg
from leather import theme
class Axis(object):
"""
A horizontal or vertical chart axis.
:param ticks:
Instead of inferring tick values from the data, use exactly this
sequence of ticks values. Th... | true |
e999c4487f27f1b3a6c3cbabb849b60eb3af90b3 | choco9966/Algorithm-Master | /programmers/코딩테스트 대비반/2주차/나머지 한 점.py | UTF-8 | 270 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | from collections import Counter
def solution(v):
x, y = [], []
for i in v:
x.append(i[0])
y.append(i[1])
x = sorted(Counter(x).items(), key=lambda x: x[1])[0][0]
y = sorted(Counter(y).items(), key=lambda x: x[1])[0][0]
return [x, y]
| true |
f03fceb11d53eca7a22aafa94f54ee369720662d | thomasvandoren/pychapel | /docs/source/examples/chapel.inline.hello.py | UTF-8 | 565 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | from pych.extern import Chapel
@Chapel()
def add_fff(x=float, y=float):
"""
writeln("Hello");
return x + y;
"""
return float
@Chapel()
def div_fff(x=float, y=float):
"""
return x / y;
"""
return float
@Chapel()
def mul_fff(x=float, y=float):
"""
return x * y;
"""
r... | true |
06da3af7abbad1ebf388f908f6bd931d6cf895ad | DavidMueller1/BachelorThesisProject | /manual_control.py | UTF-8 | 1,398 | 2.921875 | 3 | [] | no_license | from visualization_engine_3d.engine import Engine3D
from init_terrain import generate_random_terrain
from data_util.experiment_data_classes import Terrain
from data_util.data_loader import load_terrain
from data_util.data_saver import save_terrain
from logger import Logger
# RENDERER
# scale = 20
scale = 14
distance ... | true |
07d149f1b527c185f92d14d128aa719c40248869 | guohaoyuan/algorithms-for-work | /offer/树/55-2. 平衡二叉树/isBalanced.py | UTF-8 | 797 | 3.515625 | 4 | [] | no_license | # -*- coding : utf-8 -*-
class Solution:
def isBalanced(self, root):
"""
:param root:
:return: boolean
"""
def helper(root):
# 1. 递归结束条件:
if not root:
return 0
# 2. 递归操作
left = helper(root.left)
ri... | true |
2cb33e9795ee3f451be55c1ce1083100d7117d4c | DommyVanAigner/open-data | /spilt_shots_json.py | UTF-8 | 264 | 2.53125 | 3 | [] | no_license | import json
# this file was just to split the massive file into smaller shots files.
shots = json.load(open("shots.json", 'r'))
for ii, shot in enumerate(shots):
with open('shots/shot{}.json'.format(ii), 'w+') as out:
json.dump(shot, out, indent=2)
| true |
078b6b6ea85ab4c8240cf95445bdf7203bbefe08 | Kaljurand/touchless-timer | /fsg-to-fsgjs.py | UTF-8 | 944 | 2.609375 | 3 | [] | no_license | #! /usr/bin/env python
# Converts OpenFst format from STDIN
# into pocketsphinx.js FSA representation to STDOUT.
#
# Author: Kaarel Kaljurand
# Version: 2013-09-16
#
import sys
import re
count = 0
name = "grammarFsa"
print "var " + name + " = {"
for line in sys.stdin:
if re.match("^NUM_STATES ", line):
(tag, num)... | true |
b157377590f3f88ffeadf64ab379448d859fa4bc | atheys/Portfolio | /AE3212FD/Asymmetrical.py | UTF-8 | 2,322 | 2.65625 | 3 | [] | no_license | # Asymmetrical Flight Simulation Module.
# @author: Group 21/03/2017_F3.
# @version: 2.0
# Imported Module.
# Control Package Import.
import control as c
# Numpy Library Module Import.
import numpy as np
# Pyplot Library Module Import.
import matplotlib.pyplot as plt
# StateSpace Module Import.
from StateSpace import ... | true |
fc44cd17395bd30e99bc3dd9c6800640b5f38b0f | GTagent/nn-models | /models/vgg.py | UTF-8 | 2,516 | 2.78125 | 3 | [] | no_license | # VGG model implemented by pytorch
# "VERY DEEP CONVOLUTIONAL NETWORKS FOR LARGE SCALE IMAGE RECOGNITION"
# reference implementation https://github.com/pytorch/vision/blob/master/torchvision/models/vgg.py
import torch
import torch.nn as nn
# cfgs & _make_layers from https://github.com/pytorch/vision/blob/master/torch... | true |
22656afc91e1231c69c01e3fe2173c190a2e97df | terrapower/armi | /armi/nuclearDataIO/cccc/pmatrx.py | UTF-8 | 14,386 | 2.5625 | 3 | [
"Apache-2.0",
"GPL-1.0-or-later",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | # Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | true |
a9264930790be04f6a3d695842590b52d4ea74cc | emilybisaga1/emilybisaga2.github.io | /lab10!.py | UTF-8 | 1,010 | 3.15625 | 3 | [] | no_license |
with open('test3','x') as f:
f.write('hello world!\n')
try:
with open('test3','w') as f:
f.write('hello world!\nthid is itt')
this_variable_does_not_exist
except FileExistsError:
print('file already exists')
except NameError:
print('I had a typo in the code.')
import requests
requests.get... | true |
347400be1a113d597d3c87db88be2c395b45b7fc | nelsonSetyawan09/simple-rest-api-with-flask | /code/app.py | UTF-8 | 3,214 | 2.734375 | 3 | [] | no_license | from flask import Flask, request
from flask_restful import Resource, Api, reqparse
from flask_jwt import JWT, jwt_required
from security import authenticate, identity
app = Flask(__name__)
app.secret_key='citra_amba'
api = Api(app) # make ease to Resource, get-post, get-delete, get-post-delete
# http://127.0.0.1:5... | true |
04e60a49a2ee854c66c0e814c71c1e2879d03a67 | RustPython/RustPython | /Lib/ctypes/test/test_struct_fields.py | UTF-8 | 3,151 | 3.0625 | 3 | [
"Python-2.0",
"CC-BY-4.0",
"MIT"
] | permissive | import unittest
from ctypes import *
class StructFieldsTestCase(unittest.TestCase):
# Structure/Union classes must get 'finalized' sooner or
# later, when one of these things happen:
#
# 1. _fields_ is set.
# 2. An instance is created.
# 3. The type is used as field of another Structure/Union.
... | true |
b9c7f156d3be3e95c5fac5767c76ccd9895a9ea9 | bknopps/Public_SE_DevNet | /init_challenge.py | UTF-8 | 1,343 | 2.953125 | 3 | [] | no_license | #! Python3
import csv
import requests
# TOKEN GOES HERE.
# LAST FOR 12 hours.
# reference this url: https://developer.webex.com/docs/api/v1/memberships/list-memberships
# This page will give you access to how to use the membership api and how to get your token.
USER_TOKEN = "Bearer XXXXXXXXXXXXXXX" # your token goes... | true |
42e00293ef5e04460edf7e4304559617103ffd8c | anderscui/Programming | /py/data_structures/lists.py | UTF-8 | 499 | 4 | 4 | [] | no_license |
shop_list = ['apple', 'mango', 'carrot', 'banana']
print('I have {0} items to purchase.'.format(len(shop_list)))
print('These items are: ')
for item in shop_list:
print('\t' + item)
print('I also have to buy rice.')
shop_list.append('rice')
print('sort it now: ')
shop_list.sort()
print('Sorted list: {0}'.format(s... | true |
fc12969519c83a1366ad0d2a985b4b1806cae44a | ZoeMilbauer/AI-Ex2---ID3-KNN-naive-base | /Naive_Base.py | UTF-8 | 3,139 | 3.296875 | 3 | [] | no_license | import utils
# Naive Base algorithm
class Naive_Base:
# initialize data
def __init__(self, data):
self.data = data.data
self.attributes = data.attributes
self.values_for_attribute = data.values_for_attribute
# run naive base algorithm on the given train and test
de... | true |
18cdf3d700aefff6f57fc1603c401baeb6a60753 | mdurrer/cgd | /zion/main.py | UTF-8 | 863 | 2.6875 | 3 | [] | no_license | import os,sys,socket, ircbot,string
if __name__ == "__main__":
bot = ircbot.IRCBot()
print ( bot.botName,"has been started successfully.")
if bot.connect() == True:
print ("Succesfully connected to", bot.network)
while True:
data = bot.irc.recv(4096)
print(data)
... | true |
8d53a04f7623bbc2785c66f5cc9a0bf1dd3f61a0 | sudheemujum/Python-3 | /test_module.py | UTF-8 | 53 | 2.53125 | 3 | [] | no_license | t1=(10,20,30)
t2=()
print(type(t1))
print(type(t2))
| true |
14aad59eda5e08577f568fa6441036d6a8c0f0f2 | ndhansen/programming-challenges | /84_Towers_of_Hanoi/towers_of_hanoi.py | UTF-8 | 571 | 3.625 | 4 | [] | no_license | amount = int(input("How many pieces should be used? "))
stacks = {"s1": [x for x in range(amount, 0, -1)],
"s2": [],
"s3": []}
def movetower(stacks, pieces, sourcestack, deststack, altstack):
if pieces == 1:
stacks[deststack].append(stacks[sourcestack].pop())
else:
movetower... | true |
eadb70b32216ef25347ca55b5de48088e7f8e5b8 | egeyelken/ComputerVisionDL | /eyelken17_61742_assignment1/comp451/classifiers/softmax.py | UTF-8 | 4,084 | 3.3125 | 3 | [] | no_license | from builtins import range
import numpy as np
from random import shuffle
import builtins
from past.builtins import xrange
def softmax_loss_naive(W, X, y, reg_l2, reg_l1 = 0):
"""
Softmax loss function, naive implementation (with loops)
Inputs have dimension D, there are C classes, and we operate on miniba... | true |
27b6f65194d7b992371df43e3d3b6a5a0d5747ca | aparnabreddy/pythonpracticeprograms | /students.py | UTF-8 | 539 | 2.625 | 3 | [] | no_license | # lis(dictionaries(dictionaries))
data=[{"Name":"aparna","Roll_no":101,"admin_num":301,"clg":"Gsksjti","marks":{"eng":94,"kan":98,"bio":97}},{"Name":"pruthvi","Roll_no":102,"admin_num":302,"clg":"JES","marks":{"eng":94,"kan":98,"bio":97}},
{"Name":"Rajesh","Roll_no":103,"admin_num":303,"clg":"knsit","marks":{"eng":94,"... | true |
eb923cec598e38fdc62627d1328b926ec719f7b5 | dimitriy2000/Smiles_Makar | /Smiles_grandfather_Makar.py | UTF-8 | 200 | 3.734375 | 4 | [] | no_license | user_input = input("Введите любой текст:\n").capitalize()
string = ""
for i in user_input:
if i == "б" or i == "Б":
string+= "9"
else:
string+= i
print(string[::-1])
| true |
b92ec82624b56013e5df4faff0865335acbb7a9d | sol-austin/advent-of-code-2020 | /Day 18/main.py | UTF-8 | 1,597 | 2.859375 | 3 | [] | no_license | f = open('text.txt', 'r')
arr = f.read().split('\n')
def solve_section(section):
ops_idx_arr = [idx for idx, char in enumerate(section) if char=='*' or char=='+']
prev_num = section[:ops_idx_arr[0]]
for op_idx in range(len(ops_idx_arr)):
op_start_idx = ops_idx_arr[op_idx]
try:
... | true |
00683ccce514d65be6dff38476b3caeb4cbe1c74 | ivan4oto/Python101 | /week07/day01/context_managers.py | UTF-8 | 1,881 | 3.015625 | 3 | [] | no_license | from contextlib import contextmanager
from decimal import getcontext, MAX_PREC, Decimal
from time import time, sleep
class SilenceException:
def __init__(self, exc_type, msg=None):
self.exc_type = exc_type
self.msg = msg
def __enter__(self):
return self
def __exit__(self, exc_type... | true |
7ec63006151a5ccf78b1c9d62e0eb2e24b7e6432 | dav1t/face-recognition | /recognize-module/process-images.py | UTF-8 | 755 | 2.78125 | 3 | [] | no_license | import os
import face_recognition
from PIL import Image
PRE_PROCESSED_IMAGES_DIR = "../Data/pre-processed-images"
PROCESSED_IMAGES_DIR = "../Data/processed-images/"
def processImages():
for img_path in os.listdir(PRE_PROCESSED_IMAGES_DIR):
full_path = os.path.join(PRE_PROCESSED_IMAGES_DIR, img_path)
... | true |
78390184e19db49af271e0fcac5292dc349a301b | daniel-reich/ubiquitous-fiesta | /t2WH2HdrQhCcJrezL_18.py | UTF-8 | 325 | 3.3125 | 3 | [] | no_license |
def eda_bit(start, end):
newtxt = []
for i in range(start, end+1):
if i % 3 == 0 and i % 5 == 0:
newtxt.append("EdaBit")
elif i % 3 == 0:
newtxt.append("Eda")
elif i % 5 == 0:
newtxt.append("Bit")
else:
newtxt += [i]
return new... | true |
a5017f24eca3801897113e0468f1142ad0b3657d | bretttolbert/mapgraph | /devtools/jsonminify.py | UTF-8 | 308 | 2.8125 | 3 | [] | no_license | import sys
import simplejson as json
import codecs
if len(sys.argv) != 2:
print 'Usage: jsonminify.py infile > outfile'
else:
fname = sys.argv[1]
with codecs.open(fname, 'r', encoding='utf-8') as f:
data = json.loads(f.read())
print json.dumps(data, separators=(',',':')) | true |
9067f3da1e58e7ebd4b075f5150102a75cfea70d | Tadaboody/Ir | /tests/test_analyzer.py | UTF-8 | 1,757 | 3.203125 | 3 | [] | no_license | import string
import pytest
from product_team import EnglishAnalyzer
from product_team.analyzer import stopwords
@pytest.fixture
def analyzer():
return EnglishAnalyzer()
def test_posessive(analyzer: EnglishAnalyzer):
strings_with_posessive = ["mike's", "U.S.A's Constitution'S"]
filtered_strings = [ana... | true |
97df91e0f1204dd2649f76e7ecf266c8cf1f8346 | EmoryWalsh/softdevFinal | /app/utl/databasing.py | UTF-8 | 11,826 | 2.875 | 3 | [] | no_license | # Flying Saucers
# Softdev2 pd9
# P05 -- The Bookshelf / Databasing Methods
# 2020-06-05
import sqlite3
import atexit
import os
DIR = os.path.dirname(__file__) or '.'
DIR += '/'
DB_FILENAME=DIR+'../dat/saucer.db'
def init_tables():
tables = {
'books' : [
['book_id','INTEGER PRIMARY KEY'],
... | true |
fdb47d39f653c063ed24ed717699b639fac1b9a4 | 5l1v3r1/UAB-Projects | /Labyrinth/Brain_3.py | UTF-8 | 3,072 | 2.890625 | 3 | [] | no_license | # -*- coding: latin-1 -*- # Comentari per permetre que s'utilitzin accents i caràcters especials als comentaris i les cadenes de text.
"""
Daniel Martos Tornay - 1369988
Hector De Armas Padron - 1369599
"""
from pyrobot.brain import Brain
import QueueList
reload(QueueList) # 'reload' serveix per forçar que Python ca... | true |
276073d1c6ee447c461b51da13ba14b32e7ef495 | odrads/scrapy-merchants | /stores/spiders/snowboard_libtech.py | UTF-8 | 1,826 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import csv
import json
import scrapy
from scrapy.selector import Selector
from stores.items import StoresItem
class SnowboardLibTechSpider(scrapy.Spider):
name = "libtech"
allowed_domains = ['locally.com']
def start_requests(self):
urls = []
with open('./USPostalCo... | true |
d2cd309c721717ac1abbf523ec1e9e809d16777b | kellanfan/python | /jiaocheng/03-系统编程/07-给target传递参数.py | UTF-8 | 393 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #/usr/bin/env python
#coding=utf8
"""
# Author: kellanfan
# Created Time : Fri 09 Feb 2018 04:05:00 PM CST
# File Name: 07-给target传递参数.py
# Description:
"""
from multiprocessing import Process
import os
def test(num):
print("pid=%d,ppid=%d,,,,num=%d"%(os.getpid(), os.getppid(), num))
p = Process(target=test, ... | true |
1624a3f3f9e4b7bcd02fef8792f03adf18d61889 | IgorTerriaga/MiniCursoPython2019Begin | /string02.py | UTF-8 | 302 | 3.8125 | 4 | [] | no_license | primeira = input("Informe a primeira string: ")
segunda = input("Informe a segunda string: ")
terceira = ""
for letra in primeira:
if letra in segunda and letra not in terceira:
terceira = terceira + letra
if terceira == "":
print("Caracteres comuns não encontrados.")
print(terceira) | true |