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 |
|---|---|---|---|---|---|---|---|---|---|---|
06d9e7186975fa2716dc51c843bb98330803b1da | Amrutha-M/Online-Coding | /Day 9(28-05-2020)/Program 2.py | UTF-8 | 365 | 3.703125 | 4 | [] | no_license | #Python program to find digital root of a #number
n = int(input("Enter the digit\n"))
def digital_root(n):
m = len(str(n))
s=0
for i in range(m):
s = s+ n%10
n = n//10
print(s)
if(len(str(s))>1):
return(digital_root(s))
print(digital_root(n))
Output:
Enter the... | true |
87105ad5b8c0e01ec77dd96895fe676710a8e90b | alipwong/VAMPIRES-MCFOST-GA | /make-measurements/physics.py | UTF-8 | 2,068 | 3.40625 | 3 | [] | no_license | import numpy as np
from scipy.fftpack import fft2
#--------------
# Image Manipulation
#--------------
def power_spectrum(image):
''' Returns the power spectrum function of an image'''
image = image.astype(float)
ps_img = abs(pow(fft2(image), 2))
return ps_img
def normalise(image):
return image/np.amax(image)
... | true |
008482fb47a4553ea1f723b52dab84a24014d2da | gugasantos/JOGO_DA_FORCA | /Jogo_da_forca.py | UTF-8 | 2,597 | 3.265625 | 3 | [] | no_license | import os
from unicodedata import normalize
def remover_acentos(txt):
return normalize('NFKD', txt).encode('ASCII', 'ignore').decode('ASCII')
secreto = input("Escreva a palavra secreta: ").upper().strip()
secreto = remover_acentos(secreto)
os.system("cls")
vetor = []
a = 1
while True:
print("Você tem {} ten... | true |
04bc7cda99c65024df0d01b97d0b746da2f70d64 | sutt/ppd | /scratch/ScratchHist.py | UTF-8 | 12,772 | 2.546875 | 3 | [] | no_license | import os,sys, random, copy
import cv2
import numpy as np
from ImgUtils import px3clr_3px1clr as three_color
from ImgUtils import px_to_list
#import os
#os.chdir('c:/users/wsutt/desktop/files/ppd/ppd/')
#import ScratchHist
def read_img(p = "data/write/july/imgs17/img1.jpg"):
img = cv2.imread(p)
return img
... | true |
fcf41fe268c70387c3e12c1d36709fb0ac145a9a | affinity96/2020PS-python | /BaekJoon/9461_재귀.py | UTF-8 | 260 | 2.953125 | 3 | [] | no_license | T= int(input())
#for t in range(T): test_case.append(int(input()))
test_cases = [int(input()) for _ in range(T)]
padoban = [0,1,1,1,2,2]
def P(n) :
if n<6 : return padoban[n]
else :
return P(n-1)+P(n-5)
for N in test_cases:
print(P(N))
| true |
760a01a284a96c6bae5035741cf37349e44e59b5 | oleksiimodlo/tasks | /exercises/05_basic_scripts/task_5_2.py | UTF-8 | 1,362 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
Задание 5.2
Запросить у пользователя ввод IP-сети в формате: 10.1.1.0/24
Затем вывести информацию о сети и маске в таком формате:
Network:
10 1 1 0
00001010 00000001 00000001 00000000
Mask:
/24
255 255 255 0
11111111 11111111 11111111 000000... | true |
882c9e7b7c862d493cce186ce86bbe5d3307c656 | borg-project/cargo | /src/python/cargo/sql/test/test_alchemy.py | UTF-8 | 4,604 | 2.796875 | 3 | [
"MIT"
] | permissive | """
@author: Bryan Silverthorn <bcs@cargo-cult.org>
"""
from nose.tools import (
assert_equal,
assert_raises,
)
def with_sqlite_temporary(callable):
"""
Provide a safely-disposed, disk-backed SQLite engine to a nose test.
"""
from os.path import join
from nose.tools ... | true |
741660815540679b063d6cf1917313cd0a4d2a9c | banders/chimp | /data-prep/app/data_access/format_conversions.py | UTF-8 | 2,866 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | """
Dependencies:
- laz_to_csv depends on:
- command-line access to pdal. It may be necessary to first activate a pdal environment
with a command such as:
conda activate <pdal-venv>
- csv_to_gpkg depends on:
- command-line access to pdal. It may be necessary to first activate a pdal environ... | true |
611b3844fd4cea14e12647325f26a4679f8ada0b | rmcgibbo/opt-k | /paper/first_submission/postprocess_markdown.py | UTF-8 | 2,298 | 2.5625 | 3 | [] | no_license | import sys
import string
import re
import urllib
import itertools
msg = "This file was automatically generated from latex using pandoc\n\n"
sys.stdout.write(msg)
base_url = 'http://latex.codecogs.com/gif.latex'
github_url = "https://raw.github.com/rmcgibbo/opt-k/master/paper/"
# match inline math or displayed math
... | true |
339d2e6684dbe1e21d940d6d8959a1007fbd9b5a | CunningDJ/CalculatorGUI | /calculatorGUI.pyw | UTF-8 | 13,893 | 2.875 | 3 | [] | no_license | try:
import tkinter as tk
from tkinter.constants import TOP, BOTTOM, LEFT, RIGHT, X, Y, BOTH
except ImportError:
import Tkinter as tk
from Tkinter import TOP, BOTTOM, LEFT, RIGHT, X, Y, BOTH
import random
def run():
calcGUI = CalculatorGUI()
'''
('','','',''),
(... | true |
e4029430fa1531a3c1a05e44ad7dab3734aba5d8 | Ved-vampir/disk_perf_test_tool | /ssh_copy_directory.py | UTF-8 | 2,969 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | import os.path
def normalize_dirpath(dirpath):
while dirpath.endswith("/"):
dirpath = dirpath[:-1]
return dirpath
def ssh_mkdir(sftp, remotepath, mode=0777, intermediate=False):
remotepath = normalize_dirpath(remotepath)
if intermediate:
try:
sftp.mkdir(remotepath, mode=m... | true |
f17023c8341eb5dbb7b395421dcef667f65af51b | Kyrios0/SGX-Protect | /server/server.py | UTF-8 | 2,517 | 2.515625 | 3 | [] | no_license | import socket
import rsa
import os
MAX_RECV = 2048 # 2048
KEY_LEN = 16 # 96 To-Do: exchange KEY_LEN
CLIENT_HELLO = 'Hello, server.'
SERVER_HELLO = 'Hello, client.'
CLIENT_DONE = 'Done, server.'
SERVER_DONE = 'Done, client.'
SGX_key = '*'
def rc4(data, key):
"""RC4 encryption and decryption method."""
S, j, ou... | true |
5da2200a96df90589d97fbf8146ccbdc03d34582 | tomifor/raspberryPlateRecognition | /venv/src/Main.py | UTF-8 | 4,777 | 2.546875 | 3 | [] | no_license | import os
import time
import cv2
import PossiblePlate
from DetectPlates import detect_plates_in_scene
# variables ##########################################################################
SCALAR_BLACK = (0.0, 0.0, 0.0)
SCALAR_WHITE = (255.0, 255.0, 255.0)
SCALAR_YELLOW = (0.0, 255.0, 255.0)
SCALAR_GREEN = (0.0, 255... | true |
45e662052df117787cb1becbaf69c43a2d450be3 | 314062304/Programming-Python | /02_第2部分-系统编程/第3章-脚本运行上下文/Example_3_3_setenv.py | UTF-8 | 606 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# 修改shell变量
# 简单地修改shell变量USER,然后派生另一个脚本进程读取该变量值
import os
print('setenv...', end=' ')
print(os.environ['USER']) # 输出当前shell的变量值
os.environ['USER'] = 'Brian' # 在后台运行 os.putenv
os.system('python Example_3_4_echoenv.py')
os.environ['USER'] = 'Arthur' ... | true |
6fb8eefcb42cc933cae4fff217ff810463ce9b0b | fferrara/pysmartenv | /pysmartenv/control.py | UTF-8 | 5,844 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | """
Main class
"""
import os
import threading
import time
import Queue
import panel
import config
import commandserver
import GUI
import arduino
class Control(object):
def __init__(self, panelFile=None):
# instantiate serial
self.arduino = None
try:
self.arduino = arduino.Ardu... | true |
6e30908316ec531663ebb9a8a6f443e3b36f214d | rishitha-rani/exception | /exception.py | UTF-8 | 303 | 3.9375 | 4 | [] | no_license | #Exception Handling
a=int(input("Enter a value"));
b=int(input("Enter a value"));
try:
print(a/b);
k=int(input("Enter a number :"));
print(k)
except ZeroDivisionError as e:
print("We cannot divide a number by zero:",e);
except Exception:
print("Hey,Something went wrong");
finally:
print("End");
| true |
36885875140d9f9ac7564d4fcb25ae49f6c41c4e | BigDataBoutique/bogi | /bogi/callbacks.py | UTF-8 | 859 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | from bogi import bcolors
class CallbackBase:
def __init__(self):
self.successes = []
self.failures = []
def failure(self, f):
self.failures.append(f)
def success(self, s):
self.successes.append(s)
class LoggerCallback(CallbackBase):
def __init__(self, logger):
... | true |
f40d99454113cee9dac79ef646149e48fa2764dd | hejack0207/astpath | /astpath/search.py | UTF-8 | 6,932 | 2.84375 | 3 | [] | no_license | """Functions for searching the XML from file, file contents, or directory."""
import os
import ast
from astpath.asts import convert_to_xml
try:
from lxml import etree
use_lxml=True
except ImportError:
import xml.etree.ElementTree as etree
PYTHON_EXTENSION = '{}py'.format(os.path.extsep)
def _query_fa... | true |
e10e5d719605ebf847cd325c4f1f8cc89e2fc5e5 | strellic/PulseLang | /src/ast.py | UTF-8 | 4,068 | 3.046875 | 3 | [
"MIT"
] | permissive | # Pulse AST (Abstract Snytax Tree)
# CORE AST
class AST(object):
_nodes = { }
@classmethod
def __init_subclass__(cls):
AST._nodes[cls.__name__] = cls
if not hasattr(cls, '__annotations__'):
return
fields = list(cls.__annotations__.items())
def __init__(self, ... | true |
f1b3fcb19221039e8bb84f42390bacf5d7da934c | mlpotter/Factorized_Personalized_Markov_Chains | /FPMC_Optimization.py | UTF-8 | 4,925 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 23 08:39:11 2021
@author: lpott
"""
import argparse
from torch.utils.data import DataLoader
import torch
from preprocessing import *
from dataset import *
from metrics import *
from models import *
parser = argparse.ArgumentParser()
parser.add_argument... | true |
95d717a2561f21e2417bd414f65a4ba542944189 | yu-hanyang/my-newcoder-ans-by-python | /“九韶杯”河科院程序设计协会第一届程序设计竞赛+/E.py | UTF-8 | 137 | 2.796875 | 3 | [] | no_license | md=1000000007
cnt=0
cnt_1=0
temp=0
for i in range(1,20210411+1):
cnt+=((1+i)*i)//2
temp+=i//2
cnt_1+=temp
print((cnt+cnt_1))
| true |
ed1eafd7873757e95db985d419496271e7663343 | bondac-ion/Instructiunea_WHILE | /While1.py | UTF-8 | 307 | 3.546875 | 4 | [] | no_license | """Se introduc succesiv numere nenule până la introducerea numărului 0. Să se afişeze suma tuturor numerelor introduse. Exemplu: Date de intrare 3 5 4 2 0 Date de ieşire 14."""
suma=0
n=1
while n!=0:
suma+=n
n=eval(input("dati un numar:"))
print("suma numerelor este=",suma-1) | true |
32d5e4beceb241b8092c69e69c35e448a035ec8c | lbowenwest/creme | /creme/datasets/electricity.py | UTF-8 | 1,058 | 2.90625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from . import base
def fetch_electricity(data_home=None):
"""Returns a stream containing a day of electricity prices in New South Wales.
Parameters:
data_home (str): The directory where you wish to store the data.
Yields:
tuple: A pair (``x``, ``y``) where ``x`` is a dict of features and... | true |
3487d5fbf98bba673fc7346c92f77b5f579a9af6 | achintyagopal/PaintingToArtists | /BagOfWords.py | UTF-8 | 3,327 | 2.515625 | 3 | [] | no_license | from project_types import FeatureConverter, Instance
import cv2
from images import *
import numpy as np
import pickle
class BagOfWords(FeatureConverter):
def __init__(self, center_num = 800):
self.training_instances = None
self.testing_instances = None
self.center_num = center_num
def... | true |
e0276c02b842563bfcc2c3c59122fcb6e5fec698 | clever-trevor/maas | /www/scripts/maas_utils.py | UTF-8 | 671 | 3.5 | 4 | [] | no_license | #!/usr/bin/python3
# Module to contain any useful / generic functions
# This checks a value against and operator threshold and returns
# a BOOL if the condition is met
# e.g. 1 < 2 = True
def evaluate_metric(value,operator,threshold):
status = False
if operator == ">" :
if value > float(threshold) :
sta... | true |
593e29f05b77d80cce02c49e9c852ef0e9136df9 | MiroK/cutFEM-beam | /kent-report/py/plate_beam.py | UTF-8 | 4,968 | 3.125 | 3 | [] | no_license | from __future__ import division
from sympy import lambdify, symbols, sqrt, Number
from sympy.mpmath import quad
from itertools import product
import numpy as np
'''
Given a mapping \chi, \chi : [-1, 1] -> [-1, 1]^d we all (generalized) beam
a set of points x in [-1, 1]^d, (generalized) plate, that are such that
x = \... | true |
38f4ca55237ade51266ad7ab6ae08e1dab0a8612 | benoitkoenig/blobWar-image | /faster_rcnn/show_prediction.py | UTF-8 | 2,654 | 2.59375 | 3 | [] | no_license |
import json
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import sys
tf.compat.v1.enable_eager_execution() # Remove when switching to tf2
from boxes import get_boxes, get_final_box
from constants import feature_size, real_image_height, real_image_widt... | true |
4289d7215c62724853294d698f9092fd0dc55e9f | rmanak/python_misc | /problem_solving_python/recursion.py | UTF-8 | 3,097 | 3.6875 | 4 | [
"MIT"
] | permissive |
# This is a global variable used for base lookup characters
BASES = [''.join([str(y) for y in list(x)]) for x in [range(n) for n in range(1, 11)]]
print(BASES)
def convert_to_string(num_int, base=10):
"""
converts an integer number to its string repr in base=base
"""
base_chars = BASES[base-1]
if ... | true |
ccc72cdf6bc46d8af9dbd1a86d8261f22370039d | JetBrains/intellij-community | /python/testData/inspections/PyUnboundLocalVariableInspection/AfterDeletionBySlice.py | UTF-8 | 95 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | values = [100, 200, 300, 400, 500, 600]
del values[0:1]
print(values) # should not be a warning | true |
d443b993e4c40c067bcf4a4c277ef4bf47e7dcd1 | mcgnly/immo-scraper | /scraper.py | UTF-8 | 2,538 | 2.734375 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import json
import os
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
BASE_URL = os.getenv("BASE_URL")
def get_subscribers():
list_of_house_data = []
html = requests.get(BASE_URL).content
soup = BeautifulSoup(html, features="html.parser")
... | true |
5ad11284c643dbc911e3ba457de33acfaab47205 | scottyshi/FPGA_char_reg | /log_reg/newmain.py | UTF-8 | 2,696 | 3.203125 | 3 | [] | no_license |
import numpy
import random
class LogisticRegression(object):
# initialize
def __init__(self, X, Y, number, alpha=0.0005, lam=0.1, printIter=True):
x = numpy.array(X)
m, n = x.shape
# normalize data
# self.xMean = numpy.mean(x, axis=0)
# self.xStd = numpy.std(x, axis=0... | true |
f51e6995ee6f7fbc91c607c1883f202797c8cfe5 | gombru/pycaffeCNNTemplate | /do_solve.py | UTF-8 | 3,118 | 2.6875 | 3 | [] | no_license | def do_solve(niter, solvers, disp_interval, test_interval, test_iters):
"""Run solvers for niter iterations,
returning the loss and accuracy recorded each iteration.
`solvers` is a list of (name, solver) tuples."""
import tempfile
import numpy as np
import os
from pylab import zeros, ... | true |
6de58c731da084ac12bc13c7dd3a0c88e2c1252e | yzx814/pre-learn | /pre-learn/def class.py | UTF-8 | 277 | 3.078125 | 3 | [] | no_license | class Person:
def say(self, content):
print(content)
yzh = Person()
yzh.say("ithe dictonary is the only place where success comes before work")
cxq = Person()
cxq.say("At 18 our conviction are the hills form which we look ;at 45 they are caves in which we hide")
| true |
82dd38d336516002686816ee427d7c98c355ee95 | AndySH720/checkio | /max_of_two.py | UTF-8 | 351 | 3.359375 | 3 | [] | no_license | __author__ = "AndySH720"
def my_max(a, b):
return max(a, b)
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
assert my_max(3, 3) == 3, "First"
assert my_max(0, 1) == 1, "Second"
assert my_max(3, 2) == 3, "Third"
print("All set? Click \"Check\" to review... | true |
f6c57d88cb3c65e1b5a31240e6acb6bc247398a1 | YuuuXie/Stanene_FLARE | /flare/modules/hyp_opt.py | UTF-8 | 9,052 | 2.546875 | 3 | [
"MIT"
] | permissive | import math
from math import exp
import sys
import numpy as np
from scipy.linalg import solve_triangular
import time
sys.path.append('otf/otf_engine')
import env, gp, struc
def two_body_grad(env1, env2, d1, d2, hyps):
return two_body_grad_from_env(env1.bond_array,
env1.bond_types... | true |
9ad327f596ccba50f4f8e5a610e379de773e996e | Fransebas/python3DGraph | /Texture.py | UTF-8 | 1,000 | 2.703125 | 3 | [] | no_license | from PIL import Image
from OpenGL.GL import *
import numpy as np
class Texture():
def __init__(self, name):
self.image = Image.open(name)
#self.image.convert('RGB')
self.imageData = np.asarray(self.image, np.uint8)
self.initMemory()
def initMemory(self):
self.texture... | true |
165d9ac6abd8454b7814785bcc104345bb00ad06 | Dob3r/python_training_mantis | /fixture/project.py | UTF-8 | 2,903 | 2.625 | 3 | [] | no_license | from model.project import Project
class ProjectHelper:
def __init__(self, app):
self.app = app
self.project_list_cache = None
def create(self, project):
wd = self.app.wd
self.ensure_is_in_projects_page()
# click Create New Project button
wd.find_element_by_xpa... | true |
bcedd55d84b90ae286c3209d46dfecb2b533a550 | pymc-devs/pymc | /scripts/check_all_tests_are_covered.py | UTF-8 | 4,380 | 2.59375 | 3 | [
"Apache-2.0",
"AFL-2.1",
"MIT"
] | permissive | """
In .github/workflows/pytest.yml, tests are split between multiple jobs.
Here, we check that the jobs ignored by the first job actually end up getting
run by the other jobs.
This is intended to be used as a pre-commit hook, see `.pre-commit-config.yaml`.
You can run it manually with `pre-commit run check-no-tests-a... | true |
2e26ce7002309da331f8dca9c8068bed62ec4901 | IanHF/OKzoomers_bhuiyanS-chanM-friedH-olinJ | /utl/cards.py | UTF-8 | 2,202 | 2.90625 | 3 | [] | no_license | # Team OKzoomers -- Saad Bhuiyan, Matthew Chan, Hannah Fried, Jacob Olin
# SoftDev1 pd2
# P01 -- ArRESTed Development
# 2019-11-19
#=========================================================
# DATABASE FUNCTIONS FOR INTERACTION WITH *cards* TABLE
#=========================================================
# importing t... | true |
b04c084c5518fe623f2ab0e89ef1dd7fdbb1c1b0 | helloworld575/pythonchallenge | /3.py | UTF-8 | 439 | 3.3125 | 3 | [] | no_license | import re
import urllib2
request = urllib2.Request('http://www.pythonchallenge.com/pc/def/equality.html')
response = urllib2.urlopen(request)
pattern1 = re.compile('<!--(.*?)-->',re.S)
pattern2 = re.compile('[^A-Z][A-Z]{3}[a-z][A-Z]{3}[^A-Z]',re.S)
strings = re.search(pattern1,response.read()).group(1)
letters... | true |
432841b0e58cacf9c5136beb8786cd6fb682ccbf | alexis2009/hashmap | /gentest.py | UTF-8 | 896 | 3.125 | 3 | [] | no_license | import random, string
file_in = open('in', 'w')
file_out = open('out', 'w')
d = {}
for i in xrange(100000):
key = ''.join(random.choice(string.ascii_uppercase + string.digits) \
for _ in range(random.randint(1, 9)))
value = ''.join(random.choice(string.ascii_uppercase + string.digits) \
for... | true |
ee240cb410c4d428d1ce2d25bd92191e712f7cc7 | brookingcharlie/python-notes | /functions.py | UTF-8 | 1,390 | 3.90625 | 4 | [] | no_license | def sq(n):
return n * n
sq_v2 = lambda n: n * n
assert sq(2) == 4, 'calling def-defined function'
assert sq_v2(2) == 4, 'calling lambda-defined function'
# higher-order functions
def apply(f, n): return f(n)
assert apply(sq, 2), 'passing a function argument by identifier'
assert apply(lambda n: n * n, 2), 'passi... | true |
276b8019cc77b6c4cca1967c5d0be6752d2a91f6 | oonisim/python-programs | /nlp/src/common/test_010_functions_softmax_log_loss.py | UTF-8 | 4,691 | 2.859375 | 3 | [] | no_license | import logging
from functools import partial
import numpy as np
from common.constant import (
TYPE_FLOAT,
TYPE_LABEL,
TYPE_INT
)
from common.function import (
standardize,
logarithm,
sigmoid,
softmax,
cross_entropy_log_loss,
softmax_cross_entropy_log_loss,
sigmoid_cross_entropy_l... | true |
162e41b59a839b324160285e2249947e3211916b | ndenham/EpisodeRenamer | /episoderenamer.py | UTF-8 | 683 | 2.859375 | 3 | [] | no_license | import os
import glob
import csv
import sys
titles = []
path = sys.argv[1]
season = sys.argv[2]
episodes = sys.argv[3]
globpath = path+"\\Season "+season+"\\*.mp4"
files = glob.glob(globpath)
with open(episodes) as csvfile:
reader = csv.DictReader(csvfile, delimiter = ',')
for row in reader:
seasonnum = row['Season... | true |
8dfe8f66e4be71930382fe0976bbbbe2b32cd453 | JinXu2/ServiceModelDeployment | /Initialization.py | UTF-8 | 5,743 | 2.8125 | 3 | [] | no_license | import openpyxl
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from sklearn.cluster import KMeans
from KM import KMediod
import functools
'''
根据任务优先级排序后的结果
以及各自所需的成本
进行成本初次分配 解决 需要冗余部署的模块能部署几个的问题
'''
# 事先设定的值
budget = 2000
n = 3
def allocation(df):
"""
:param df: 数据集 包括任务编号,聚类个数,优先... | true |
2d6067e2a66a70f0ce4ea2f4153cd1f913c41ac6 | chemouna/AlgorithmsPy | /src/com/mounacheikhna/algorithms/sorting/CountingSort.py | UTF-8 | 207 | 3.34375 | 3 | [] | no_license |
def countingsort(list, k):
counter = [0] * (k + 1)
for i in list:
counter[i] += 1
index = 0
for i in range(len(counter)):
while counter[i] > 0:
list[index] = i
| true |
c62db56a7e6256325e8b32074f5e761c32a2a8c3 | CXY-YSL/MGZDTS | /Python/PythonCode/Chapter11/索引分片重载.py | UTF-8 | 453 | 4.28125 | 4 | [
"MIT"
] | permissive | # 定义类
class Demo:
# 定义构造方法
def __init__(self, obj):
self.data = obj[:]
# 定义索引、分片运算符重载方法
def __getitem__(self, index):
return self.data[index]
# 创建实例对象,用列表初始化
x = Demo([1, 2, 3, 4])
print(x[1]) # 索引返回单个值
print(x[:]) # 分片返回全部的值
print(x[:2]) # 分片返回部分值
for num in x: # for循环迭代
p... | true |
dbc2fe455b98b16f9378fedb6b5e175207df2153 | simranchn99/pythonbtoe | /else and elif.py | UTF-8 | 244 | 3.78125 | 4 | [] | no_license | #program for driving age
print("age of a person")
age = int(input())
for age in range(0,100):
age = int(input())
if age>18:
print("can drive")
elif age==18:
print("cannot decide")
else :
print("cannot")
| true |
648e83e445804e488a702413324d6ed9b5cf995d | Combal/ml-examples | /src/linear_regression/data_generator.py | UTF-8 | 2,642 | 3.25 | 3 | [] | no_license | import numpy as np
import random
# don't remove
from mpl_toolkits import mplot3d
import matplotlib.pyplot as plt
import os
class DataGenerator:
_np_data = []
_x_deviation = 1 # x2-ის გადახრა x1-ისგან
def __init__(self, theta, x_range=(-100, 100)):
self._theta = np.array(theta)
self._x_... | true |
3cb2e2d6158a6f219b25f8e97e7b6e59f95c8b22 | morganwallace/NLP_IE_football | /get_reports.py | UTF-8 | 1,207 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python
from lxml import html
from urllib import urlopen
import pickle
#global variables
seed_url="http://espnfc.com/scores/_/league/eng.1/barclays-premier-league?cc=5901"
report_links=[]
num_of_reports=200
def get_reports(url):
'''Using espnfc.com, scrape league scores page for reports'''
global report_... | true |
57edcc5da56cbde26629d98f61744fcd7ea09b2c | nadasaiyed/NLP-TextAnalytics | /Sentiment Analysis - Amazon Reviews/Part 4 - ANN_model_predict.py | UTF-8 | 1,750 | 2.6875 | 3 | [] | no_license | import os
import sys
import json
import numpy as np
import keras
from keras.models import Model
from keras.layers import Input, LSTM, Embedding, Dense
from keras.layers.experimental.preprocessing import TextVectorization
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import ... | true |
e996f0292cd81365c97f19159aa7441444a7e333 | hyungwonchoi/siamese-triplet | /trainer.py | UTF-8 | 10,100 | 2.53125 | 3 | [] | no_license | import torch
import numpy as np
from tensorboardX import SummaryWriter
import os
import shutil
import torch.nn.functional as F
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.a... | true |
6993ace7ac1c140ebe65daae2f521333aacf31e5 | ayanamizuta/cpro | /atcoder/arc/arc143/b.py | UTF-8 | 65 | 2.671875 | 3 | [] | no_license | n=int(input())
mod=998244353
cnt=0
for i in range(1,n**2+1):
| true |
68ee7471bf1c2f879d59025f6874a8126272e7e5 | sconemad/antigravity | /comtest.py | UTF-8 | 478 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python3
import time
from MD25 import MD25
from Lidar import Lidar
from Bot import Bot
bot = Bot()
lidar = Lidar(bot)
md25 = MD25(0x59)
l = 0
c = 0
r = 0
x = 127
while True:
x = x + 2
v = md25.readBatteryVoltage()
l = lidar.getDistance(lidar.DIST_LEFT)
c = lidar.getDistance(lidar.DIST_CENT... | true |
71ab581824e6e9815b6341bdebb1b747b995ec79 | CEA-COSMIC/pysap-mri | /mri/operators/gradient/base.py | UTF-8 | 3,174 | 2.921875 | 3 | [
"LicenseRef-scancode-cecill-b-en"
] | permissive | # #############################################################################
# pySAP - Copyright (C) CEA, 2017 - 2018 #
# Distributed under the terms of the CeCILL-B license, #
# as published by the CEA-CNRS-INRIA. Refer to the LICENSE file or to #
... | true |
cf7aef9e80e93a052922b7eae2576083dfd95c35 | mrocamora/carat | /examples/compute_accentuation_feature.py | UTF-8 | 2,501 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=C0103
'''
_ _ __ _ _|_
(_ (_| | (_| |_ computer-aided rhythm analysis toolbox
Compute accentuation feature example
'''
import sys
import argparse
import matplotlib.pyplot as plt
from carat import audio, features, annotations, display
def compute_... | true |
2dd021814317728c04f522a96836ee0f0cf0e226 | StBowie/foobar | /gun_to_guard_fight.py | UTF-8 | 4,325 | 3.96875 | 4 | [] | no_license |
'''Bringing a Gun to a Guard Fight
===============================
Uh-oh - you've been cornered by one of Commander Lambdas elite guards! Fortunately, you grabbed a
beam weapon from an abandoned guardpost while you were running through the station, so you have a
chance to fight your way out. But the beam weapon is pot... | true |
3d301bc993c33d55e4148a69a64be8f852af3ddc | weicheng113/deep-reinforcement-learning | /p1_navigation/prioritized_replay_buffer.py | UTF-8 | 3,249 | 3.125 | 3 | [
"MIT"
] | permissive | import numpy as np
from collections import namedtuple
import random
from sum_tree import SumTree
class PrioritizedReplayBuffer:
"""Fixed-size buffer to store experience tuples."""
def __init__(self, buffer_size, seed):
"""Initialize a ReplayBuffer object.
Params
======
se... | true |
063a23eb49142975443c533f6baec2f23732333b | DiffSharp/DiffSharp | /tools/generate_slice_code.py | UTF-8 | 1,641 | 2.640625 | 3 | [
"BSD-2-Clause"
] | permissive | def generate(num_dims, fixed_dims):
str = '[<System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage>]'
str += '\nmember t.GetSlice('
prefix = ''
for i in range(num_dims):
if fixed_dims[i]:
str += '{}i{}:int'.format(prefix, i)
else:
str += '{}i{}min:int option, i{... | true |
892869696fd0ad6ee0aa3886bc35e56a6b924156 | mgennart/pythonexercices | /conversitionangle.py | UTF-8 | 200 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#exercice 1 convertir angle radian
deg,minute,sec,pi=18,22,45,3.141592653589793
angledegre=deg+(minute/60)+(sec/3600)
rad=pi*angledegre/180
print rad
| true |
798edf57580ed49975d5f0054fcb08b2e5359a04 | poojamalviya/ds-algo | /test_heap.py | UTF-8 | 1,875 | 3.71875 | 4 | [] | no_license | class Heap():
def __init__(self):
self.arr = []
self.size = 0
def insert(self, ele):
self.arr.append(ele)
self.size = self.size +1
self.prolocate_up(self.size-1)
def left_child(self, i):
return i*2 +1
def right_child(self, i):
return i*2+2
... | true |
4ac6951e81d47e2d663fe5eb51b30290249692f2 | lomholdt/bads-2015 | /5/code/alfa.py | UTF-8 | 102 | 2.625 | 3 | [] | no_license | import string
import random
for alfa in range(1000000):
print random.choice(string.ascii_uppercase), | true |
29ec02a2f05bd956d6e914983c6fc11885c87919 | timcubb/docker-registry | /test/test_tags.py | UTF-8 | 1,185 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive |
import json
import base
class TestImages(base.TestCase):
def test_simple(self):
image_id = self.gen_random_string()
layer_data = self.gen_random_string(1024)
self.upload_image(image_id, parent_id=None, layer=layer_data)
# test the ancestry
resp = self.http_client.put('/v1... | true |
8f8ee098d3defc84410c13a5dcb47db743c4154a | svakulenk0/pyyacp | /pyyacp/yacp.py | UTF-8 | 5,100 | 2.890625 | 3 | [
"MIT"
] | permissive | '''
Created on Jan 29, 2016
@author: jumbrich
'''
from pyyacp import simple_type_detection
# python 3 compatible
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import unicodecsv as csv
import anycsv
import unicodecsv
class YACParserException(Exception):
pass
class YA... | true |
f54014169170858fc3a87d65a7c1fa2af56f20ac | Pena86/GameBundle | /games/colorFlood.py | UTF-8 | 7,461 | 2.890625 | 3 | [] | no_license | #! /usr/bin/env python3
# encoding: utf-8
import random
import pygame
from pygame.locals import *
import time
import sys, os
sys.path.append(os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ))
from data.textToScreen import textToScreen
from data.gameMenu import MenuContainer, MenuItem
from data.highScor... | true |
4e178160b70da724fa924e65514f4f083ec2ac1a | thomasduffy328/intro-python | /Final/sum_digits.py | UTF-8 | 431 | 3.8125 | 4 | [] | no_license | def sum_digits(s):
"""
assumes s a string
Returns an int that is the sum of all of the digits in s.
If there are no digits in s it raises a ValueError exception.
"""
sList = list(s)
numList =[]
for i in range(0, len(sList)):
try:
numList.append(int(sList[i]))
... | true |
8514a4654b8c5f66be94ea61225dabec700f1bda | xiaolongjia/techTrees | /Python/98_授课/10_Programming/CCC/2016/j4.py | UTF-8 | 1,239 | 3.453125 | 3 | [] | no_license | #!C:\Python\Python
time = input()
(hour, minutes) = map(int, time.split(":"))
allMinutes = hour*60 + minutes
freeMinutes, busyMinutes, leftMinutes = 0,0,0
cost = 0
if hour < 7:
freeMinutes = 7*60 - allMinutes
if freeMinutes >= 2*60:
cost = 2*60
else:
busyMinutes = 2*60 - freeMinutes
... | true |
aba4f2b6e31cc7be9398172594c4d1557411fcfd | Dzhevizov/SoftUni-Python-Advanced-course | /Lists as Stacks and Queues - Exercise/08. Crossroads.py | UTF-8 | 1,188 | 3.421875 | 3 | [] | no_license | from collections import deque
initial_green_light = int(input())
initial_free_window = int(input())
queue = deque()
in_crossroad = None
total_cars = 0
crashed = False
command = input()
while not command == "END":
if command == "green":
green_light = initial_green_light
free_window = initial_free... | true |
ddb4cbfe66d9b3a6f7089fa0a5640a777e5ecee3 | terasakisatoshi/pythonCodes | /isingModel/ising_aot.py | UTF-8 | 1,221 | 2.8125 | 3 | [
"MIT"
] | permissive | # Reference: http://nbviewer.jupyter.org/gist/genkuroki/4fa46c68c56ee0f3b1a6fc8ec628b9d7
# Author MathSorcerer
from math import log, sqrt, exp
from random import choice, random
from copy import deepcopy
import time
from array import array
from matplotlib import pyplot as plt
from numba import jit
import numpy as np
... | true |
b3dcd7b96c7724b2394635c3d9972a4a7e3f0e4e | shaunnnorton/docker-example-first | /recipe_app/auth/tests.py | UTF-8 | 2,742 | 2.53125 | 3 | [] | no_license | import os
import unittest
from recipe_app import app, db, bcrypt
from recipe_app.models import User, Recipe, Ingredient, recipe_ingredient_association
from flask_login import current_user
def login(client, username, password):
data = {
'username':username,
'password':password
}
return cli... | true |
23267f5e0b6d9e77363c971fcf43ae5872ba01d8 | alakaz4m/GitHubRepoAssignment | /DojoAssignments/Python/python_stack/flask_fundamentals/GreatNumberGame/server.py | UTF-8 | 1,194 | 2.6875 | 3 | [] | no_license | import random
from flask import Flask, render_template, redirect, request, session
app = Flask(__name__)
app.secret_key = 'mySecret'
@app.route('/', methods=['GET', 'POST'])
def index():
winner = 'inline'
playornot = 'Submit'
color_box = '#FFFFFF'
outcome = ''
outcomeshow = 'none'
if 'value' not in session:
... | true |
e30b585f66c17042dafc9d331468676212c9dc86 | jessrieger25/HonorsThesis | /text_parsing/creating_graph.py | UTF-8 | 2,215 | 3 | 3 | [] | no_license | import os
from text_parsing.keyword_manager import KeywordManager
class CreateGraph:
def __init__(self):
self.keyword_manager = KeywordManager()
def within_range_graph(self, relational_dict, keyword, range):
with open(os.path.abspath("../g_star_graphs/within_range_" + keyword + '_' + str(ran... | true |
ab906109310e551dbf7128f958f3ecfce34335d9 | altanai/cirq_quantum_programming | /insertStrategy.py | UTF-8 | 1,330 | 3.859375 | 4 | [] | no_license | # circuit to add gates based on position of qubits
# 4 such strategies:
# - InsertStrategy.EARLIEST,
# - InsertStrategy.NEW,
# - InsertStrategy.INLINE and
# - InsertStrategy.NEW_THEN_INLINE
import cirq
# define the length of the grid.
length = 3
# define qubits on the grid.
qubits = [cirq.GridQubit(i, j) for i in ran... | true |
753b1c1d4935205e0fa03588d02fff441d182cbd | yuynwa/Coursera | /TF-in-practice-Coursera/1-Introduction/Programming/fashion_mnist/fashion_mnist.7.py | UTF-8 | 1,143 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tensorflow as tf
import keras
class MyCallback(keras.callbacks.Callback):
def on_epoch_end(self, epoch, logs={}):
if logs.get('acc') > 0.85:
print("\nReaches 85% accuracy so cancelling training!\n")
self.model.stop_training = ... | true |
00e1343a7ca83fe30e91913aab7c360811672483 | alejwang/si699-si-hunt | /flask_app/models/location.py | UTF-8 | 1,308 | 2.765625 | 3 | [
"MIT"
] | permissive | from extensions import db
class LocationModel(db.Model):
__tablename__ = "locations"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
capacity = db.Column(db.Integer)
is_armap_available = db.Column(db.Boolean)
def __init__(self, name, capacity=0, is_armap_available... | true |
71d2abf0927c0588c83d61f09799cb3022031e69 | drewserles/Project-Euler | /60_PrimePairSets.py | UTF-8 | 2,959 | 4 | 4 | [] | no_license | """
PROBLEM 60
The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes
and concatenating them in any order the result will always be prime. For
example, taking 7 and 109, both 7109 and 1097 are prime. The sum of these four
primes, 792, represents the lowest sum for a set of four primes with t... | true |
173c881e866a0c60e39c7694697c3737db3e8ffd | luisfredgs/pytorch-RbF | /train.py | UTF-8 | 4,766 | 2.515625 | 3 | [] | no_license | import argparse
from datetime import datetime
import torch.nn.functional as F
import torch.utils
import torchvision
from torch import nn
from tqdm import tqdm
from RbF import RbFIterator
class Classifier:
def __init__(self, model: nn.Module, opt):
self.cal_acc = True
self.meters = None
s... | true |
152a408360b3f22499cdcea7ad5c999d7c81a7a8 | jgjimmy/ssmg | /figure3.py | UTF-8 | 6,902 | 2.609375 | 3 | [] | no_license | """
Traces figure 2. "figure3_data_fit.py" must be run before this code, so that
the necessary data is computed and saved.
---
This code fits a State-space Model of Time-varying multi-graph Ising model. It
is based on previous work on State-space Model of Time-varying Neural
Interactions previously developed (Shimaz... | true |
c7fa5e7b3b7f301e778da44cf71dd1dce0868b3c | obutkalyuk/Python_15 | /test/Contacts/Test_Contact_Verify.py | UTF-8 | 1,733 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | from model.contact import Contact
from random import randrange
def test_verify_random_contacts(app):
if app.contact.count() == 0:
app.contact.create(Contact(firstName="Sophie", lastName="Marceau", address="Paris", homePhone="1-2-3",
mobilePhone="4 5 6", workPhone="(7) 89"... | true |
713f396a55ee54a5aaa2fb0dca2eb2efbfd47cc0 | Lumexralph/python-algorithm-datastructures | /stack/double_stack.py | UTF-8 | 4,765 | 4.1875 | 4 | [
"MIT"
] | permissive | """Using Adapter pattern - it is a design pattern that
involves modifying the method of an existing class or interface
to look like that of the methods of a similar class or interface
"""
# create an appropriate class to raise an appropriate message
# for an empty stack as against the index error raised by List
class ... | true |
c575e0ac6408da805d89862ac95620b450ba65c2 | jeremiahmarks/dangerzone | /scripts/python/oneTimeScripts/nonunique.py | UTF-8 | 114 | 3.3125 | 3 | [
"MIT"
] | permissive | def nonunique(alist):
for item in alist:
if (alist.count(item)==1):
alist.remove(item)
return alist
| true |
f6fc522d3987f831e4bad799d66ec73ce8badab9 | sairam2000/telegram-bot---to-search-for-coding-challenges | /main.py | UTF-8 | 2,111 | 2.765625 | 3 | [] | no_license | import requests
import telebot
import config
from datetime import datetime
URL = "https://cplistapi.herokuapp.com/"
r = requests.get(url=URL)
t1 = datetime.now()
data = r.json()
bot = telebot.TeleBot(config.API_KEY)
def fetchData():
global t1
t2 = datetime.now()
duration = t2 - t1
duration_in_s = d... | true |
9683f78997b7af97f3834caac61202b6b4c949b7 | MilleR98/vidiscovery-recognition | /indexing/faiss_test.py | UTF-8 | 2,684 | 2.625 | 3 | [] | no_license | import operator
from datetime import datetime
import numpy as np
import faiss
from cfg.globals import DATA_DIR
from preprocessing.model_provider import ModelProvider, IMG_SHAPE
from processing.video_features_db import VideoFeaturesDb
from processing.video_processing import VideoProcessing
def init_tree():
index... | true |
f4fc9bbf91a4e50cd23ff8511c12e620b44d8a7a | NagiKhushdeep/AirPassengers-Satisfaction | /main.py | UTF-8 | 3,864 | 2.65625 | 3 | [] | no_license | import pickle
import streamlit as st
import numpy as np
from sklearn.preprocessing import StandardScaler
import category_encoders as ce
model = pickle.load(open("airmodel.pkl","rb"))
scaler = pickle.load(open("scaler.pkl","rb"))
page_bg_img = '''
<style>
body {
background-image: url("http://4.bp.blog... | true |
d66cf5a9448453250e3f26fedcc24c7c28e0203f | Jsky16/Python | /Pickling&Un-Pickling/Unpickling.py | UTF-8 | 246 | 3.0625 | 3 | [] | no_license | import pickle,Employee
with open('emp.dat','rb') as f:
while True:
try:
obj=pickle.load(f)
obj.Display()
except EOFError:
print('Unpickling of object is completed')
break | true |
caa37237b9f75dcb2bd704e535ce71cccb6411b1 | RobertDGordon/Hash-Tables | /hashtable/hashtable.py | UTF-8 | 4,959 | 3.734375 | 4 | [] | no_license | class HashTableEntry:
"""
Hash Table entry, as a linked list node.
"""
def __init__(self, key, value):
self.key = key
self.value = value
self.next = None
class HashTable:
"""
A hash table that with `capacity` buckets
that accepts string keys
Implement this.
... | true |
b4194995a93bc6589b340f7f6422b04aa6189aef | mariachacko93/luminarDjano | /luminarproject/functional programming/listcomreheemployee.py | UTF-8 | 1,385 | 3.6875 | 4 | [] | no_license | class Employee:
def __init__(self,id,name,salary,exp,des):
self.id=id
self.name=name
self.salary=salary
self.exp=exp
self.des=des
def printDetails(self):
print("id=",self.id)
print("name=",self.name)
print("salary=",self.salary)
print("exp... | true |
e723b336f1adc0d941353b1dfcb677b667998c2c | DarioCozzuto/python-dates | /python dates.py | UTF-8 | 489 | 4 | 4 | [] | no_license | #Import the datetime module and display the current date:
import datetime
x = datetime.datetime.now()
print(x)
#Return the year and name of weekday:
import datetime
x = datetime.datetime.now()
print(x.year)
print(x.strftime("%A"))
#Create a date object:
import datetime
x = datet... | true |
66e797e67f11709ae430fb9379fefd170b5c1b59 | saidino84/_pythonScript_full_qrcode_numpy_cv | /aula_08_redirecionamento_login/aula08_redirecionamento_vs_erros.py | UTF-8 | 2,706 | 3.015625 | 3 | [] | no_license | # Aula 08 -redirecionamento e erros
from configparser import ConfigParser
from flask import Flask,request , abort , redirect, url_for #
# (abort =parar abortar(), redirect(url_for)
import json
app =Flask(__name__,static_folder='static')
# app.send_static_file("static")
path_configurer="configs.ini"
config=ConfigParser... | true |
11ff53f5aadc3b0a2018fb0e1a099e589edbb72d | bampowbam/question_edit_teacher | /server/app.py | UTF-8 | 7,368 | 2.546875 | 3 | [] | no_license | from flask import Flask, render_template, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from marshmallow import Schema, fields
from flask_marshmallow import Marshmallow
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
import os
app = Flask(__name__)
ENV = 'prod'
if ENV... | true |
5afdef39a36498c41426a56a48c45ed3fd2cf06f | milind1992/CheckIO-python | /Brackets.py | UTF-8 | 1,614 | 3.828125 | 4 | [] | no_license | # migrated from python 2.7
def checkio(expression):
# Stack used to store all the brackets that are encountered in the program
stack=[]
# Maps the right closing bracket to the right opening bracket
bracket_dictionary={')':'(',']':'[','}':'{'}
for element in expression:
# If the ele... | true |
94bca185a335a6a2f61d77715b4c4b3ea5aafb25 | sarzz2/codewars-kata | /Divide and conquer.py | UTF-8 | 568 | 4.34375 | 4 | [] | no_license | #Given a mixed array of number and string representations of integers, add up the string integers
#and subtract this from the total of the non-string integers.
def sum_mix(arr):
ans = 0
res = 0
for i in arr:
if isinstance(i, int):
ans = ans + i
elif isinstance(i, str):
... | true |
7e1fe921995a0629e6c7922cc707d5127508a086 | Lia-k/py_course | /lesson6/scopes_python.py | UTF-8 | 322 | 3.828125 | 4 | [] | no_license | name = "John" # Global scope
names = ["John", "Marta"]
def update_name():
name = "James" # local scope
# names[1] = 1 # global variable modification since names mutable
def internal():
name = "Some"
print(name) # closing scope
internal()
update_name()
print(name)
# print(names... | true |
6b8198e7a9eec561753db270e0291e0a81cc5b2f | ComNewman/pyItchatTest | /getHires.py | UTF-8 | 2,914 | 2.53125 | 3 | [] | no_license | from urllib.request import urlopen
from bs4 import BeautifulSoup
import time
import csv
def create_csv(path):
with open(path, 'w', newline="", encoding='utf-8-sig') as f:
csv_write = csv.writer(f)
csv_write.writerow(['id', 'projectName', 'lianxi', 'phone', 'address', 'teamType', 'memo', 'time'])
... | true |
6d93c1c7c5ec14c70aee345b38ae0ddf935f4435 | FunsomMars/Timg | /mkdir.py | UTF-8 | 298 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019-07-23 22:47
# @Author : Simon Meng
# @Site :
# @File : mkdir.py
# @Software: PyCharm
import os
# Make a folder under the current path
def mkdir(path):
folder = os.path.exists(path)
if not folder:
os.makedirs(path)
| true |
b1df66cccadcc0bbb8965434466b5b23309ebe5b | ak229/ganpati | /modules/hadoop.py | UTF-8 | 2,005 | 2.546875 | 3 | [] | no_license | from customutils import *
def analyze( connection, submodule = "" ):
# get all the info required
host = {}
host['submodule'] = submodule
host = info( connection , host )
host = runTests( host )
return host
def info( connection , host ):
host['home_variable'] = home_variable ( connection )
host... | true |
b67fb8c23a3119debc607b66619218aeeaad230e | opticaliqlusion/enterprise-document-organizer | /edo/edo.py | UTF-8 | 4,372 | 2.75 | 3 | [
"MIT"
] | permissive | # Builtin
import os
import sys
import glob
import pdfminer
import hashlib
import json
import shutil
from io import StringIO
class EDOCache():
def __init__(self):
# if the cache file does not exist, create it
self.lock = None
self.lock_location = os.path.realpath(os.path.expanduser('~/.edo... | true |
e2b5edbb88787eceabafaf7ef61b4ee5b3b26e11 | cga-wm/cga-wm.github.io | /course/adv-gis/scripts/shp_zipper.py | UTF-8 | 4,311 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
#
# shp_zipper.py
#
# VERSION 0.1
#
# AUTHOR: Tyler W. Davis, CGA, W&M
#
# LAST UPDATED: 2020-03-18
#
# Use this script to create zipped shapefiles (e.g., to upload to AGOL).
#
###############################################################################
# REQUIRED MODULES
#####################... | true |
c97fa573809618833fd7747858906e6fd868d1b9 | beizhao215/ticket_app | /addr_multiprocess.py | UTF-8 | 2,073 | 2.859375 | 3 | [] | no_license | from multiprocessing import Pool
import multiprocessing
from geopy.geocoders import Nominatim
import csv
import time
from itertools import islice
filename = "data/Parking_Tags_Data_2015_1.csv" ## The original csv file
out_filename = "data/out_Parking_Tags_Data_2015_4.csv" ## the file you want to save with zipcod... | true |
1e882bc35537dc22a415af9bd87881a8d657e3f6 | NiteshBabu/bird_motel-mongoDB | /src/services/data_services.py | UTF-8 | 1,636 | 3.078125 | 3 | [] | no_license | import datetime
from data.owner import Owner
from data.birds import Bird
from data.cage import Cage
from data.booking import Booking
def create_account(name:str, email:str) -> Owner:
owner = Owner()
owner.name = name
owner.email = email
owner.save()
return owner
def find_account_by_email(email):
owne... | true |