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
142e5d369684d8d4d9393c5998876bb56c10e3f4
galatedgi/Final_p
/CLs.py
UTF-8
1,850
2.671875
3
[]
no_license
import os from time import time import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import KFold, RandomizedSearchCV from tqdm import tqdm from CL import svm_score,get_data_by_rank,write def CL_s(data,score_func=svm_score): """ This functio...
true
766bea9d3af2a2b3b4b1039eb75ea6d31a8d6562
Fastcampus-WPS-9th/Thanksgiving-Homework
/JungMongKyo/game.py
UTF-8
4,162
3.25
3
[]
no_license
from functions import * updated_records = [] def turn_on(): print('---Play Game---') while True: main_menu = input('[1] 게 임 시 작\n[2] 기 록 보 기\n[0] 게 임 종 료: \n') if main_menu == '1': player = input('캐릭터 이름을 입력하세요 : ') type_of = input('캐릭터 속성을 입력하세요(fire / ice) : ') ...
true
7e992d08e7eacee3dc9ec8bd912c23454b545771
data-gov-ie/cso2rdf
/csv/Converters/convert-religion.py
UTF-8
1,514
2.71875
3
[]
no_license
#!/usr/bin/env python #-*- coding:utf-8 -*- import os from Converter import Converter # Definition of the paths DSD = os.path.join("..", "..", "DSDs", "persons-by-religion.ttl") ED_FILE = os.path.join("..", "Datasources", "ed", "religion.csv") EA_FILE = os.path.join("..", "Datasources", "ea", "religion.csv") class ...
true
3e620b84aaaa397aae160d0d7a8780caf1d3f1ee
PabloFernandez008/attenuate
/Atenuación_OII_z.py
UTF-8
6,309
2.71875
3
[]
no_license
# Este código toma datos de un archivo del Millenium para OII # y dibuja, para un redshift z dado, la función de luminosidad sin atenuar, # la atenuada con y sin el factor de Saito. Se crean 3 gráficas según el tipo # de atenuación: Cardelli, Calzetti y Millenium # Pablo Fernández, 14/05/2021 import read_jc_obs as jc ...
true
16580ff26b375ca00063cdd614f3fde6bc6ec72c
cfjedimaster/adventofcode
/2021/5/part2.py
UTF-8
2,417
3.359375
3
[]
no_license
import pprint pp = pprint.PrettyPrinter(indent=4) testInput = """ 0,9 -> 5,9 8,0 -> 0,8 9,4 -> 3,4 2,2 -> 2,1 7,0 -> 7,4 6,4 -> 2,0 0,9 -> 2,9 3,4 -> 1,4 0,0 -> 8,8 5,5 -> 8,2 """ #input = testInput file = open(r"input.txt","r") input = file.read() file.close() input = input.strip().split("\n") # Define our field ...
true
4f473b53dd22690d4aa608f746ca586078b11732
liangliannie/LeetCode
/956. Tallest Billboard.py
UTF-8
1,041
2.984375
3
[]
no_license
class Solution(object): def tallestBillboard(self, rods): """ :type rods: List[int] :rtype: int """ def make(A): states = {(0, 0)} for x in A: states |= ({(a+x, b) for a, b in states} | {(a, b+x) for a, b in s...
true
0a49ffbb3b019455feb16d6a0e219f3b050d885a
aklap/python-crash-course
/ch-10/ch-10.py
UTF-8
2,788
4.0625
4
[]
no_license
"""Chaper 10.""" # 10-1 with open('notes.txt') as file_object: print('\nRead in the entire file first:\n') contents = file_object.read() print(contents) with open('notes.txt') as file_object: print("\nRead a file in line by line:\n") for line in file_object: print(line) with open('no...
true
bb6a51f9e34707132e414898c9e792f04ac87eb2
coderLong/leetcode
/leetcod/array.py
UTF-8
2,272
3.78125
4
[]
no_license
# coding:utf-8 # 数组相关的算法 # 旋转打印矩阵 import numpy as np def transferMatrix(matrix): m = len(matrix) n = len(matrix[0]) ans = [] for i in range((m-1)//2 + 1): # 条件限定错误, 需要 a1,c1, a2,c2 for j in range(i,n-i): # 向右 ans.append(matrix[i][j]) for j in range(i+1, m-i): # 向下, 固定...
true
5ebbb846372f6efec2390ab9d412767bb1dcd9b2
hendrycks/BIG-bench
/bigbench/benchmark_tasks/word_problems_on_sets_and_graphs/task.py
UTF-8
2,646
2.546875
3
[ "Apache-2.0" ]
permissive
# Copyright 2021 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, so...
true
297e92bc2e18c9d098207d7def0910368ec7682c
angelhof/project_euler
/problem014-longest_collatz_seq/problem14.py
UTF-8
275
3.5625
4
[]
no_license
def length_of_seq(x): result = 0 while x > 1: if x % 2 == 0: x = x / 2 else: x = 3 * x + 1 result += 1 return result max = 0 maxx = 0 for i in range(2, 1000001): if length_of_seq(i) > max: max = length_of_seq(i) maxx = i print max, maxx
true
456873bf5ad7c9f89139b73cc3891f368da7cf54
orangespaceman/tanmt
/tanmt/pictures/tests/views/test_picture_view.py
UTF-8
2,294
2.640625
3
[]
no_license
from django.test import TestCase from django.urls import reverse from django.utils import timezone from ..factories import PictureFactory, TagFactory class TestPictureView(TestCase): def create_published_picture(self, published_id=1, tag_count=0): past_date = timezone.now() - timezone.timedelta(days=1) ...
true
c114db5fecd785f91b927f8300ae8015da0eefc4
pengfeiyan/fluent_python
/two/2.2.py
UTF-8
772
4.09375
4
[]
no_license
# -*- coding: utf-8 -*- # @Author : yanpengfei # @time : 2018/11/16 上午11:38 # @File : 2.2.py # 列表推导和生成器表达式 # 列表推导式的易读性和高效性 symbols = '$¢£¥€¤' codes = [] for symbol in symbols: codes.append(ord(symbol)) print(codes) codes = [ ord(symbol) for symbol in symbols ] print(codes) # 列表推导式不会出现变量的泄漏 , 有列表推导,集合推导,字典推...
true
88cb3fc6d79f76bf4f6ec49cc5113096876b1afb
Ishita-Tiwari/competitive-programming
/Codechef/CHEFZOT.py
UTF-8
201
2.96875
3
[]
no_license
n = int(input()) a = [int(x) for x in input().split()] c, ans = 0, 0 for i in range(n): if a[i] != 0: c += 1 else: ans = max(ans, c) c = 0 ans = max(ans, c) print(ans)
true
6cba90ebdc96dc102d0435a6ab5738fdd503801b
alenars/Blank-Signature
/geo_surreal/RRegression.py
UTF-8
4,430
3.15625
3
[]
no_license
##################################################################################### # Script to sublaunch R from Python and create a linear regression model from # a file with x and y values in it. # To run the script, create a "CSV" file with an "X" and a "Y" column with values # to be used for the linear regres...
true
cc5abfd02a0b171a782765ce319ea045c99465fb
alina29131997/test_python
/test.py
UTF-8
2,354
4.09375
4
[]
no_license
# this function removes spaces and new lines for column from right and left def strip(string): return string.strip() # this function reads database from contacts.txt file def read_database(): file = open("C:/Projects/python-algajatele/11_test_of_input_output_arrays_conditionals/contacts.txt", encoding="u...
true
86f026b8ed048a465b814c179e169e7092ce995f
Null78/KAU-CPIT-Labs
/Lab 5/5-1.py
UTF-8
325
4.0625
4
[]
no_license
import math # Get the length from the center to a vertex r = eval(input("Enter the length from the center to a vertex: ")) # Calculate the length of the side s = (2 * r) * math.sin(math.pi / 5) # Calculate the area area = (3 * math.sqrt(3) / 2) * pow(s, 2) # Display the result print("The area of the pentagon is", a...
true
c27746f7c06aaa09b81e4553a7dc90146a84b522
givEuptreatmEnt/Electronics
/s2/q8/plot.py
UTF-8
424
2.78125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np F = np.logspace(6, 11, 100) print(F) gmro = 100 z1 = 1.25e-11 z2 = 2.5e-11 z3 = 1e-8 Fi = F * 1j * 2 * np.pi Z = np.log10(np.abs(gmro * (1 + Fi*z1) / (1+Fi*z2) / (1+Fi*z3))) * 20 plt.semilogx() plt.plot(F, Z) Fz = [1.2e6, 15.9e6, 1.59e9, 6.37e9, 12.7e9, 95e9] plt.plo...
true
392cfe97401298ed307d59d736f578e7eeb8afb7
Zelenskiy/informatics_10_prof
/Урок 31, 32. Рекурсивні функції/Факторіал.py
UTF-8
178
3.921875
4
[]
no_license
def fact(n): print("!") if n == 0: return 1 else: return fact(n-1) * n n = int(input("n = ")) f = fact(n) print (n, "! = ", f, sep="")
true
e99b7253e20ebe1f26e1216e1a01dc7f73cdb652
LEEtot/pythonPractice
/example/test.py
UTF-8
202
3.34375
3
[]
no_license
print("Hello, world!") print("""""""abc""""""") print("안녕 Python") print('''''abc''''') print("안녕 "+"파이썬") print("안녕"+" "+"파이썬") print("10"+"20") print(10+20) print("10 " * 10)
true
af0da7ff23cae6ecb532853e7273fda258f3cdac
yunusbahtiar22/shor10r
/app/models.py
UTF-8
814
2.859375
3
[]
no_license
import string from app.ext import db from datetime import datetime from random import choices class Link(db.Model): id = db.Column(db.Integer, primary_key=True) original_url = db.Column(db.String(512)) short_url = db.Column(db.String(5), unique=True) visits = db.Column(db.Integer, default=0) date_...
true
21597dac25996a034634c800a24233abf8a0c126
hartl3y94/Gitmails
/core/models/repository.py
UTF-8
726
3.265625
3
[ "MIT" ]
permissive
class Repository: def __init__(self, identifier, name, url, authors): self.identifier = identifier self.name = name self.url = url self.authors = authors def set_authors(self, authors): self.authors = authors def __str__(self): final = "\t{} (ID: {}): {}".f...
true
a442d3e9d98212684b85eb030b4e726fab20d9ac
xmliszt/capstone-topic-modelling
/src/reader.py
UTF-8
373
3.015625
3
[ "MIT" ]
permissive
import json import os def get_article(path): article = [] if os.path.basename(path).split('.')[1].lower() != "json": raise TypeError("File must be in JSON format!") with open(path, 'r', encoding='utf-8') as fp: data = json.load(fp) body = data['body'] for _, v in body.items...
true
9c0782074f923b7a37902e28fc0d0e3879b8b2dd
john-hawkins/DataRobot_Clustering
/drpredexplanations.py
UTF-8
3,939
2.859375
3
[]
no_license
# ############################################################################# # Methods for retriveing and manipulating the DataRobot prediction explanations # for a new dataset # ############################################################################# from functools import reduce import datarobot as dr import ...
true
72fee34828b75dce4d726a8d3865f89e5292fee4
bigobject-inc/bosh-pyfunc
/imgstr2file
UTF-8
294
2.828125
3
[]
no_license
#!/usr/bin/python import base64 import sys def base642image(datastr , save_file): fh = open(save_file, "wb") fh.write(datastr.decode('base64')) fh.close() if __name__ == "__main__": save_file = sys.argv[1] data_str = sys.stdin.read() #print save_file base642image(data_str,save_file)
true
f6349554132822c3962bbe21a0e9283930217c65
lyceejoliotcurierennes/JupyterNotebooks
/bissextile/corexos/bissextile.py
UTF-8
622
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- from nbautoeval.exercise_function import ExerciseFunction from nbautoeval.args import Args def estBissextile(annee): try: #teste si annee est bien un entier en essayant de le convertir annee=int(annee) except: print("vous n'avez pas entré un entier") if annee%4!=0: return False elif a...
true
7debb9e780991ccd6f7ff3d294ca65c51f78f521
daniel-reich/ubiquitous-fiesta
/czjjch48tZYjTDmtH_3.py
UTF-8
211
2.8125
3
[]
no_license
def is_shifted(lst1, lst2): return lst1[0]-lst2[0] == lst1[1]-lst2[1] == lst1[2]-lst2[2] ​ def is_multiplied(lst1, lst2): return lst1[0]*lst2[1] == lst1[1]*lst2[0] and lst1[1]*lst2[2] == lst1[2]*lst2[1]
true
0644c2ba508f3b13a30075bf576f3c79c9fb1375
AbhirupGhosh92/Breeze
/Ryven/packages/auto_generated/ast/nodes.py
UTF-8
12,285
2.8125
3
[ "MIT" ]
permissive
from NENV import * import ast class NodeBase(Node): pass class _Dims_Getter_Node(NodeBase): """ Deprecated. Use elts instead.""" title = '_dims_getter' type_ = 'ast' init_inputs = [ ] init_outputs = [ NodeOutputBP(type_='data'), ] color = '#32DA22' ...
true
7a6d19d66a2e41b597c28c2a2d6286bc343f89e9
databill86/poli-sci-kit
/tests/plot/test_dispr_bar.py
UTF-8
913
2.515625
3
[ "BSD-3-Clause" ]
permissive
""" Disproportionality Bar Plot Tests --------------------------------- """ import matplotlib.pyplot as plt from poli_sci_kit import plot def test_dispr_bar(monkeypatch, short_votes_list, allocations): monkeypatch.setattr(plt, "show", lambda: None) plot.dispr_bar( shares=short_votes_list, allocations...
true
6b63ed0e330b2b8c6763f970e725669ecb952ac3
BlaneTorregrossa/Steering
/target.py
UTF-8
1,979
2.859375
3
[]
no_license
import random import pygame import gametemplate import vectorlib from centertarget import CenterTarget from constants import * from gametemplate import GameTemplate from vectorlib import Vector2 class Target(object): def __init__ (self, position, velocity): self.position = position self.velocity...
true
2ab39f60acd7eb2ef3722b5f073a428cb849c61f
ex-hibition/timecard
/calc_overtime.py
UTF-8
508
3.484375
3
[]
no_license
import pandas as pd import datetime as dt class CalcOvertime(): def __init__(self, csvfile): self.df = pd.read_csv(csvfile) def calc_overtime(self): overtime = 0; for index, row in self.df.iterrows(): work = pd.to_datetime(row['work_time'], format="%H:%M") base = dt.datetime.strptime('7...
true
bdfb134336fa7c160b3f815281800ea847ea3b54
pascalmcme/pands-problem-sheet
/squareroot.py
UTF-8
1,882
4.625
5
[]
no_license
# users input is assigned to the number variable Number = int(input('Please enter a postive number: ')) # we need an ititial guess of the square root of number to apply newton's method. # the initial guess should not be zero, or zero will be in the denominator in the function. guess = 1 # how many times we want ...
true
30857e8003df74b11f2bddc28b0f01a949221466
bognari/alexa-scribe
/src/scribe.py
UTF-8
3,646
3.171875
3
[]
no_license
""" this module is meant to handle the automation part of communicating with Alexa. Future: use https requests to call main module. In post payload, include a scribe type Make web request to run alexa -- if valid scribe type then - generate text - create mp3 from text (gTTS) - convert mp3 to wav - tell program t...
true
5a0ce9aa972155d353c876a91f2ada1af85f8c28
ciresdem/Chris_initial
/uncert/samp_den.py
UTF-8
547
2.78125
3
[]
no_license
import sys import numpy as np import gdal #from gdalconst import * #open raster raster = sys.argv[1] #loop thru bands of raster and append each band of data to 'layers' #note that 'ReadAsArray()' returns a numpy array ds = gdal.Open(raster) ds_array = ds.ReadAsArray() constrained = np.sum(ds_array) print...
true
bab6e4c6e50b05173bb6f435b87ab9b628679a19
JuanAntonaccio/Python_Loops_List_excercise
/exercises/14.2-letter_counter/app.py
UTF-8
442
3
3
[]
no_license
par = "Lorem ipsum dolor sit amet consectetur adipiscing elit Curabitur eget bibendum turpis Curabitur scelerisque eros ultricies venenatis mi at tempor nisl Integer tincidunt accumsan cursus" letters="abcdefghijklmnopqrstuvxyz" counts = {} #your code go here: for i in par: a=i.lower() if a in letters: ...
true
011bc9b1bef23847a02afab616610f627eafe53f
seungjaeryanlee/ml-boilerplate
/networks/mnist_networks.py
UTF-8
743
2.578125
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F class SimpleConvNet(nn.Module): def __init__(self): super().__init__() self.conv_layers = nn.Sequential( nn.Conv2d(1, 32, 3, 1), nn.ReLU(), nn.Conv2d(32, 64, 3, 1), nn.ReLU(), ...
true
4942aacdcd978f0836372efab610f902d72559a5
UofU-Cryosphere/isnoda
/snobal_1d/station_pipeline.py
UTF-8
7,861
2.75
3
[ "MIT" ]
permissive
import MesoPy import json import pandas as pd import numpy as np import math import plotly.express as px from plotly.subplots import make_subplots import plotly.graph_objects as go import chart_studio.plotly as py # only needed if intending to pull station data again. from MesoPy import Meso m = Meso(token='YOUR TOKEN...
true
8fddcdb5a7ad66a29caa97a0c956321492bdc7f3
texttest/capturemock-selftest
/custom_client/target.py
UTF-8
1,034
2.515625
3
[]
no_license
#!/usr/bin/env python # We pretend we aren't working in Python, so we don't import capturemock import os, socket def sendText(text, serverAddress): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(serverAddress) sock.sendall(text.encode()) return sock def sendRecord(code, *args)...
true
50686964ce5aa0e7078bada9bb032388dac59dfe
WindAsMe/Algorithm
/venv/include/Python_Daily_5/findMin.py
UTF-8
694
3.03125
3
[]
no_license
# !/usr/bin/python3 # -- coding: UTF-8 -- # Author :WindAsMe # Date :18-6-2 下午6:03 # File :findMin.py # Location:/Home/PycharmProjects/.. # LeeCode No.153 class Solution: @staticmethod def findMin(nums): """ :type nums: List[int] :rtype: int """ if len(nums)...
true
b42bb995e52c8489839d70c37631a456fd83d4b0
Firkraag/algorithm
/hash.py
UTF-8
584
3.421875
3
[]
no_license
#!/usr/bin/env python def hash_insert(T, k, h): i = 0 while i < len(T): j = h(k, i) if T[j] is None: T[j] = k return j else: i = i + 1 def linear_probe(k, i): return (aux(k) + i) % len(T) def quad_probe(k, i): return (aux(k) + i + 3 * i *...
true
379bc3d0719ff9a5cd2868bcb3fa580192ed7803
xwk1993/LearningPython
/functions/params.py
UTF-8
739
4.21875
4
[]
no_license
# 参数 默认参数必须指向不变对象! def add_end(l=[]): l.append('END') return l print(add_end()) # ['END'] # Python函数在定义的时候,默认参数L的值就被计算出来了,即[],因为默认参数L也是一个变量,它指向对象[], # 每次调用该函数,如果改变了L的内容,则下次调用时,默认参数的内容就变了,不再是函数定义时的[]了。 print(add_end()) # ['END', 'END'] print(add_end([1, 2])) # [1, 2, 'END'] print(add_end([1, 3])) # [1, 3,...
true
ae02c5d70026ee22c2444fe3b3c46a638079d3d0
ziqizhang/msm4phi
/code/python/src/util/hashtag_processor.py
UTF-8
6,388
3.109375
3
[]
no_license
import csv def clean_sort_hashtags(infile, outfile): with open(infile) as f: content = f.readlines() content = [x.strip() for x in content] unique_hashtags=[] for tag in content: if tag.startswith("#") and tag not in unique_hashtags: unique_hashtags.append(tag) unique_...
true
a95e8930b4c2ed022874b1652dd5145c007f1ad6
thehighestmath/ANN-2021
/8383/Averina/lb/2/main.py
UTF-8
1,619
2.6875
3
[]
no_license
import pandas import matplotlib.pyplot as plt from tensorflow.keras.layers import Dense from tensorflow.keras.models import Sequential from sklearn.preprocessing import LabelEncoder dataframe = pandas.read_csv("sonar.csv", header=None) dataset = dataframe.values X = dataset[:, 0:30].astype(float) Y = dataset[:, 60] ...
true
8a25b73726a9d9506fbe2ba37d5ef4c3d39d0ab4
eduNEXT/campusromero-openedx-extensions
/campusromero_openedx_extensions/certificates/course_mode.py
UTF-8
779
2.640625
3
[]
no_license
""" Change the course enrollment mode. """ import logging from .edxapp_dependencies import ( CourseMode, CourseEnrollment, CertificateWhitelist, ) LOG = logging.getLogger(__name__) def change_course_mode(course, student): """ Change the course enrollment mode to 'verified', if the given stud...
true
c516e637ada380dee6df05c169425eebcbb847ee
LiuFang816/SALSTM_py_data
/python/bashtage_arch/arch-master/arch/univariate/recursions_python.py
UTF-8
7,885
2.96875
3
[]
no_license
""" Pure Python implementations of the core recursions in the models. Only used for testing and if it isn't possible to install the Cython version using python setup.py install --no-binary """ from __future__ import division, absolute_import from ..compat.python import range from ..compat.numba import jit from numpy i...
true
3db1b7a42fd32688552304c86c9a2c92ef283943
hk1486/Python_master
/07_05_default_args.py
UTF-8
957
4.3125
4
[]
no_license
# 디폴트 매개변수 (Default Arguments) # 함수정의시 매개변수에 디폴트 값을 지정해 주면, 호출시 생략가능하다 # 생략된 상태에서 호출되면 디폴트 값으로 작동된다 # 디폴트 매개변수 작성 구문 # def 함수명(매개변수명=디폴트값) def say_myself(name, age, gender='남성'): print('이름은 %s 입니다' %name) print('나이는 %d 입니다' %age) print('성별은 %s 입니다' %gender) say_myself('고길동', 43, '남성') say_myself('고...
true
758ed4ac9ec976322431ef08be5f80419bc45405
ArtemusCoder/CatalogLibrary_Yandex
/main.py
UTF-8
3,741
2.515625
3
[]
no_license
import csv import sqlite3 import sys from PyQt5 import uic from PyQt5.QtCore import Qt from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QApplication, QPushButton, QMessageBox, QDialog, QLabel from PyQt5.QtWidgets import QMainWindow, QTableWidgetItem class MyWidget(QMainWindow): def __init_...
true
db2fea6358e56a31e28c3f242370c6d31cbae75f
anubhamandal/Projects
/Named_Entity_Recognition_Classification/extract_and_classify_nouns.py
UTF-8
9,037
3.125
3
[]
no_license
''' File: extract_and_classify_nouns.py Usage: Provide a hardcoded filename with text that needs classification in the variable "filename". Also, the filename can be provided as an argument by the user. Or this can be taken via a UI interface. python extract_and_classify_nouns.py <entire file path> This file takes a...
true
03c76f1233cad3ebcedbd804ae56bfffc4002919
NycoleRibeiro/Exercicios-URI
/Exercícios/1002 - Área do Círculo.py
UTF-8
85
3.3125
3
[ "MIT" ]
permissive
raio = float(input()) n = 3.14159 area = n*(raio**2) print("A={:.4f}".format(area))
true
8c28264c613744866a06310f2fa2a7f004483fa8
stadham/mudpy
/character_back_up.py
UTF-8
3,718
3.125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Character(object): """ Creates the generic attributes for our characters. Stores all of the variables such as name, current room, and authentication status. Also, contains all of the necessary methods that the character will need. """ def __init__(self): # Creates generic attribut...
true
65325309a3c7ba4dd6461e7979f06eb2545dad24
yolotester/learngit
/HmVideoCode/hm_python_basic/13_文件/hm_07_os模块文件目录的常用管理操作.py
UTF-8
590
3.3125
3
[]
no_license
import os # 1、文件操作 # 重命名文件 os.rename("README", "readme") # 删除文件 try: os.remove(r"D:\Git\learngit\hm_python_basic\13_文件\README[复件]") except FileNotFoundError as e: print(e) # 2、目录操作 # 创建目录 os.mkdir("test") # 删除目录 #os.rmdir("test") # 查看目录列表 dir = os.listdir() print(dir) # 判断是否是目录 是目录返回真,否则返回假 var = os.path...
true
a63e75c9e007312315a2a83666720aa3caac4aca
ryanmiddle/CSCI102
/Lab1B-Fibonacci.py
UTF-8
465
4.125
4
[]
no_license
#Ryan Middle #CSCI 101 - A #Python Lab 1B - Fibonacci a=1 #initializing n var in fibonacci sequence b=0 #initializing n-1 var in fibonacci sequence c=1 n=int(input("please enter how many numbers in the Fibonacci sequence you would like to see")) #initializing step var for i in range (1, n, 1): print(c) c=a+b #fibona...
true
e9b8eed7eeebcc9d1a0d82737dd678ef5db365a9
z2bns/MyOwnLearningJourney
/PythonCrashCourse/alien_invasion/ship.py
UTF-8
2,085
3.21875
3
[]
no_license
''' # -*- coding: utf-8 -*- @Time : 4/21/2020 7:29 PM @Author : 思侬 @Email : robeenwang@163.com @File : ship.py @Software: PyCharm ''' import pygame from pygame.sprite import Sprite class Ship(Sprite): '''管理飞船的大部分行为''' def __init__(self,screen,settings): '''飞船初始化''' super(Ship,s...
true
43c98e593372acee9e61a7aed44737a8c4c072f4
lou1306/jaeger
/ui/text_interface.py
UTF-8
9,273
2.546875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from collections import deque from functools import partial from time import sleep from typing import Tuple from asciimatics.screen import Screen, NextScene from asciimatics.widgets import Button, PopUpDialog, ListBox, Frame, Layout, Widget, Label from asciimatics.event import KeyboardEvent, Mo...
true
6270264a72f2a7df74aa4b7916d565d6d1662e5a
smallblackMIN/myProject
/main.py
UTF-8
3,755
4.21875
4
[]
no_license
# This is a sample Python script. # Press ⇧F10 to execute it or replace it with your code. # Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. def print_hi(name): # Use a breakpoint in the code line below to debug your script. print(f'Hi, {name}') # Press ⌘F8 to to...
true
88d090193b62af2b1164d2f49596971af8aabeec
heeyoung1002/LIKELION
/odd_even.py
UTF-8
344
4.65625
5
[]
no_license
#함수 선언 - 짝수일때 def is_even (number): if number % 2 == 0: return True else: return False number_fromuser = int(input("What is the number: ")) result = is_even(number_fromuser) if result == True: print(f"{number_fromuser}는 짝수입니다") else: print(f"{number_fromuser}는 홀수입니다")
true
28b0813666ed57ed089fc932ecf2bc0b35ff430f
qbig/bio-course
/course0/find_pattern.py
UTF-8
273
3.21875
3
[]
no_license
import sys # you must import "sys" to read from STDIN lines = sys.stdin.read().splitlines() # read in the input from STDIN line = lines[0] pattern = lines[1] len_pat = len(pattern) for i in range(len(line) - len(pattern)+1): if pattern == line[i:i+len_pat]: print i ,
true
0e2ad9cecdd3bb29451b17ed6fd38214b002a503
hosjiu1702/ML-Self-Study-Training-Course
/Coursera-Machine-Learning/Python-Code/ex2/plotDecisionBoundary.py
UTF-8
1,600
3.390625
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np from plotData import plotData from mapFeature import mapFeature def plotDecisionBoundary(theta, X, y): # Plos the data points X and y into a new figure with # the decision boundary defined by theta # ------------------------------ # This function plots...
true
d0e51202e75bac49f535ab9a418ba137829ed033
sassoo/goldman
/goldman/middleware/deserializer/__init__.py
UTF-8
1,856
2.671875
3
[ "MIT" ]
permissive
""" middleware.deserializer ~~~~~~~~~~~~~~~~~~~~~~~ Dynamically select & initialize the deserializer on the request object. The deserializer is chosen based on the Content-Type header provided. The deserializer is responsible for all of the deserialization logic, rules, & RFC compliance. "...
true
d395e12f1354e12756d1742aaa3b3f59b9410468
iskandr/parakeet-retired
/unit/test_cond.py
UTF-8
999
3.328125
3
[]
no_license
#!/usr/bin/python from numpy import * import parakeet, sys from parakeet import PAR @PAR def simple_if(x): a = 0 if x: a = 1 else: a = 0 return a def test_if(): print "Testing If" sys.stdout.flush() x = simple_if(1) print "Expected 1, got", x assert 1 == x y = simple_if(0) print "Expecte...
true
b89b21c3257587f4054594d599bda7ef1008901d
envs-net/bbj
/dbupdate.py
UTF-8
449
2.59375
3
[ "MIT" ]
permissive
import sqlite3 with sqlite3.connect("data.sqlite") as _con: _con.execute('ALTER TABLE threads ADD COLUMN last_author text DEFAULT ""') _con.commit() for tid in _con.execute("SELECT thread_id FROM threads"): author = _con.execute("SELECT author FROM messages WHERE thread_id = ? ORDER BY post_id", ti...
true
9dcb35c94beb9cfdd6d11b56eee5e9f785e465fc
isaonaranjo/Laboratorios-Data-Mining
/Laboratorio2DataMining/Laboratorio2.py
UTF-8
1,272
3.171875
3
[]
no_license
# Maria Isabel Ortiz Naranjo # Carné 18176 # Laboratorio 2 from copy import deepcopy import numpy as np import pandas as pd from matplotlib import pyplot as plt flor = pd.read_csv("iris.csv") flor.head() print(flor.info) # Sepalo fig = flor[flor.flower == 'flor-setosa'].plot(kind='scatter', x='sepal...
true
1c3403f6b84489b2e9421576b7465e3d0b197165
nie000/mylinuxlearn
/AssetManage/QtLib/FileOpen.py
UTF-8
1,797
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- # @Author : niejiali # @Time : 2018/10/15 13:49 # @File : FileOpen.py # @Software : PyCharm from Qt import QtWidgets class FileDialog(QtWidgets.QDialog): def __init__(self): super(FileDialog, self).__init__() def directory(self, start_path='C:/'): directory ...
true
34776869cefcca2ba629f6f6ea33581f076409ad
queryor/algorithms
/hiho/1736.py
UTF-8
1,251
3.609375
4
[]
no_license
#!/usr/bin/env python # coding=utf-8 """ @author:queryor @file: 1736.py @time: 2018/05/26 """ # 描述 # 如果一个1~N的排列P=[P1, P2, ... PN]中的任意元素Pi都满足|Pi-i| ≤ K,我们就称P是K-偏差排列。 # 给定N和K,请你求出字典序最大的K-偏差排列。 # 注:字典序最大指首先P1应尽量大,其次P2尽量大,再次P3尽量大 …… 以此类推。 # 输入 # 包含两个整数N和K。 # 对于50%的数据,1 ≤ N ≤ 10 # 对于100%的数据,1 ≤ N ≤ 100, 1 ≤ K ≤ 10...
true
d2bd01f41b13292ecce5a80f37ee1ef9102e3b6f
zeynepCankara/Stock-Price-Predictor-BIST100
/Stock Market Predictor/bistPredictor.py
UTF-8
3,538
3.4375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Sun Apr 22 2018 @author: Zeynep CANKARA """ "import useful libraries" "inspired by Udemy Course DeepLearning A-Z" # data analysis import pandas as pd import numpy as np import random as rnd # visualization import seaborn as sns import matplotlib.pyplot as plt ...
true
61cdb6e7729e8e0acf90b1b2c94100766c9e2dd4
arteev/stepik-course-python
/week-3/week-3-2-step7.py
UTF-8
150
3.21875
3
[]
no_license
d = dict() for x in [int(input()) for x in range(int(input()))]: if x in d: print(d[x]) else: d[x] = f(x) print(d[x])
true
d73e89eb409bdcb0147af4bbe4dcbc933d6c7933
jnash67/eulerpython
/hellopython.py
UTF-8
1,192
3.3125
3
[]
no_license
import random import sys import os import math import functools import euler10 import itertools def divisorGeneratorDumb(n): for i in range(1,n//2+1): if n%i == 0: yield i yield n def triangular_number(n): return n * (n + 1) // 2 # def divisorGenSmart(num): # factors = list(factorGenerator(n...
true
4e675274d7fea10a7737fd5e84c9ec85fe791dcf
wmm98/homework1
/视频+刷题/考试习题/计算两个整数的和.py
UTF-8
441
4.03125
4
[]
no_license
'''【问题描述】计算两个整数的和 【输入形式】两个整数 【输出形式】上述两个整数的和 【样例输入】1 2 【样例输出】3 【样例说明】输入的1和2是两个整数,程序将自动计算1和2的和,也就是3,并且将3输出。 【评分标准】根据不同的输入,输出正确的数,即可得分''' num1, num2 = input().split() num1 = int(num1) num2 = int(num2) print(num1 + num2)
true
d8c92ce1a3b4df0dc80af76c7f0e2fc3364f0c66
time-consume/Python-Crash-Course
/Chapter 10/10-11.py
UTF-8
151
3.078125
3
[]
no_license
import json a=input("enter a letter: ") store='s.json' with open(a,'w') as f_obj: json.dump(a,f_obj) print("We'll remember you when you come back!")
true
909958cb05c3db9b5576eeb94d168562f5c9f863
Barney666/Coding_Interview
/src/MoocCode/Array/thirty-seven.py
UTF-8
1,414
3.765625
4
[]
no_license
''' 题目描述 每年夏天,维蒂娅都来乡下看望他的祖母。由于村网不通,维蒂亚已经连续观察了 n 天的月亮,每天他都写下月亮可见部分的大小。请帮助他根据以下月球的数据,预测明天月亮大小是升还是降,或者数据不足以预测。 根据历史数据,月球周期持续30天。月亮可见部分的大小(以维特雅的单位表示)为0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,然后循环重复,因此在第二个 1 之后再次变为 0。 输入描述 第一行为她观测的天数 n (1 ≤ n ≤ 92) 第二行为她这 n 天观测的月亮数据 (0 ≤ ai ≤ 15),我们保证这 n 天的...
true
529c5056e327551df8ea11cf0d22761953656da8
alexandraback/datacollection
/solutions_5686313294495744_0/Python/joegunrok/c.py
UTF-8
677
2.828125
3
[]
no_license
from sys import stdin as IN for _ in range(int(IN.readline())): print "Case #%s:" % (_+1), firsts = [] seconds = [] for _ in range(int(IN.readline())): f, s = IN.readline().split() firsts.append(f) seconds.append(s) answer = 0 q = [[0, 0, firsts, seconds]] while q: ...
true
c2feaec2b22395d7fe2d77baabe10cc01cf4401b
musketyr/zaciname_programovat_v_jazyce_python
/m07__basic_architecture.py
UTF-8
1,884
2.953125
3
[]
no_license
#Příliš žluťoučký kůň úpěl ďábelské ó - PŘÍLIŠ ŽLUŤOUČKÝ KŮŇ ÚPĚL ĎÁBELSKÉ Ó #Q:/65_PGM/65_PYT/chapters/m07__basic_architecture.py """ Příkazy a záznamy odpovědí zadávané ve výpisech kapitoly: 7 Návrh základní architektury """ #Výpis 7.1: Definice modulu world #######################################################...
true
b26761064398ba2dcdbc3f3f807d033cf855ea0e
BGSU-RNA/fr3d-python
/tests/cif/reader/high_level_tests.py
UTF-8
10,114
2.5625
3
[]
no_license
import pytest import numpy as np from tests.cif import ReaderTest class StructureTest(ReaderTest): name = '1GID' def test_assigns_pdb_id(self): val = self.structure.pdb ans = '1GID' self.assertEqual(ans, val) def test_loads_all_components(self): val = len(list(self.struc...
true
925dbf4f79299226ea15478521f805cfe5de4bcc
kumudunee/Linear-Regression-with-Single-Variable
/linearRegression.py
UTF-8
808
3.046875
3
[]
no_license
import pandas as pd import numpy as np from matplotlib import pyplot as plt from sklearn import linear_model df = pd.read_csv("canada_per_capita_income.csv") print(df.head()) plt.xlabel("year(x)") plt.ylabel("per capital income(USD)") plt.scatter(df.year,df.percapitalincome) plt. show() reg = linear_model.LinearRegr...
true
325d56f574df10175c31806ad7dfae56c8f0a880
ECHO967/yoga_assistant
/datapreparation/remap_name.py
UTF-8
2,103
2.71875
3
[]
no_license
import os import base64 FILE_DIR = "../../yoga_data/label_data/dataset" #label好的数据目录 ORIGIN_DIR = "../../yoga_data/datasets/kaggle_data" renameFile = "remap_2.txt" name_map_file = open(renameFile,"w") all_data_map = {} # key value 形式存储base64,会不会内存爆炸...? support_classes = [] # 支持的class all_classes = os.listdir(FI...
true
46ddaa16662bdab86e87ddba056ebdd239337cbd
taewankim1/uncertainty_deeplearning
/trainer.py
UTF-8
3,296
2.71875
3
[]
no_license
import torch import time from utils import log_gaussian_loss class RegressionTrainer(object) : def __init__(self,name) : self.name = name def train_model(self,model,criterion,optimizer,scheduler,num_epochs,dataloaders,is_cuda=False, verbose=True) : since = time.time() best_model_wts = ...
true
e736208b73370a04e4056946053dca1afa4da7e2
ItsRohan0165/kc
/matematica.py
UTF-8
355
3.046875
3
[]
no_license
import random def fatorial(n): f = 1 for C in range(1, n+1): f *= C return f def multiplicar(n): mt = n/2 p = mt*2 resultado = p*3 return resultado def triplo(n): return n*3 def quaduplo(n): return n * 4 def quinplo(n): return n * 5 def taxa(n): tx = n/5 txh = tx*2 return txh def potencia(b,...
true
ef3d19eb5c9bcdb96dc0f05818924146514f5bd2
StickmanNinja/Find-Breaking-News
/TaskThreaderModule.py
UTF-8
808
2.75
3
[]
no_license
from threading import * import os import time import linecache # The 'data' argument needs to be a list with functions. def runTasks(data): if type(data) is list and len(data) > 0: loop(data) return True else: return False # Loops through data list, runs functions, then starts "finishe...
true
bd744a685723a37b7a72d63bc4b0b325191036b3
HumgTop/DataStructure-Algorithm
/LeetcodeForPython/leetcode/editor/cn/[104]二叉树的最大深度.py
UTF-8
1,691
3.671875
4
[]
no_license
from typing import * # 给定一个二叉树,找出其最大深度。 # # 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 # # 说明: 叶子节点是指没有子节点的节点。 # # 示例: # 给定二叉树 [3,9,20,null,null,15,7], # # 3 # / \ # 9 20 # / \ # 15 7 # # 返回它的最大深度 3 。 # Related Topics 树 深度优先搜索 # 👍 714 👎 0 class TreeNode: def __init__(self, x): ...
true
36ce55ab175c284f8b26b42ace3dfb31d5b32efe
KevinKnott/Coding-Review
/Month 02/Week 01/Day 07/b.py
UTF-8
2,461
4.0625
4
[ "MIT" ]
permissive
# Kth Smallest Element in a Sorted Matrix: https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/ # Given an n x n matrix where each of the rows and columns are sorted in ascending order, return the kth smallest element in the matrix. # Note that it is the kth smallest element in the sorted order, not ...
true
1fa2c873531e7eb8d4fe378463d5e109705b08ad
atxnatalia/python-challenge
/PyBank/main.py
UTF-8
1,381
3.3125
3
[]
no_license
import os import csv import math csvpath = os.path.join ("..","PyBank", "Resources", "budget_data.csv") with open (csvpath) as csvfile: csvreader = csv.reader (csvfile, delimiter= ',') header = next(csvreader) month_total = [] month_total_dict={} net_profit = [] avg_change_dict = {} f...
true
73d1c25b797e81186de9c0624f56e78bac638e25
sharonsabu/pythondjango2021
/regular_expression/variable_validation.py
UTF-8
371
3.53125
4
[]
no_license
#rules--> first character must be alphabet between a-k # --> second character must be a digit divisible by 3 # --> followed by any number of characters from re import * rule='[a-kA-K][369][a-zA-Z0-9]*' variable_name=input("enter variable name") matcher=fullmatch(rule,variable_name) if matcher!=None: prin...
true
c1c535dcaa3f43bfd157c2380867f4a309582a29
LingxiaoShawn/leetcode
/tree/94.binary-tree-inorder-traversal.py
UTF-8
2,076
3.984375
4
[]
no_license
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None """ Goal: traverse a binary tree inorderly. Use iterative method. Note: Notice that the result of inorder traversal is exactly matc...
true
f666b42b5f4898837db6513f0aa96bd04d8b89d5
stuti-v4/DS_ALGO_DAILY
/TCS/106-HCF.py
UTF-8
413
3.875
4
[]
no_license
# def gcd(a,b): # if(a == 0): # return b # if(b == 0): # return a # if(a == b): # return a # # a is greater # if(a > b): # return gcd(a-b , b) # return gcd(a, b-a) # a = 20 # b = 30 # hcf = gcd(a,b) # print(hcf) # SOLUTION 2 def gcd(a,b): if ...
true
9d7377e03fe05885bcceff42aac05e5b7590da9f
ZachEichen/text-extensions-for-pandas
/tutorials/market/market_intelligence.py
UTF-8
14,081
2.53125
3
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
permissive
# market_intelligence.py # Python code related to the market intelligence use case blog series. from typing import * import pandas as pd import text_extensions_for_pandas as tp import ibm_watson import ibm_watson.natural_language_understanding_v1 as nlu import ibm_cloud_sdk_core import spacy import time import urlli...
true
b098d0dcce660dd05ff6a981994f5a93b003b249
Tori1810/python_lab
/keys_controller.py
UTF-8
2,575
2.921875
3
[]
no_license
import argparse from modules import Database from view import View class KeysController: book = Database("base") parser = argparse.ArgumentParser(description='Keys controller ' 'for Database.') parser.add_argument("-show", help="show all database", ...
true
57ce3989d1616be6f269f29ff4a04e441d95ef28
muzammil360/pole-guide
/main.py
UTF-8
7,118
2.59375
3
[]
no_license
import sys import argparse import os import time import cv2 from src.logger import get_logger from src.sensors.camera import Camera from src.sensors.imagefolder import ImageFolder from src.structures.rectangle import SimpleRectangle from src.detectors.yolov3 import Yolov3 from src.feedback.zoomfeedback im...
true
d504a6963745d638fc53dc6f74fe58909909c1a6
tttthomasssss/GamePlayExample
/game/gametree.py
UTF-8
1,603
3.578125
4
[]
no_license
''' Created on Jan 2, 2014 @author: thomas ''' class GameTree(object): def __init__(self, root): self._root = root self._size = 1 @property def root(self): return self._root @property def size(self): return self._size def is_root(self, node): ...
true
acf74d27e97658bcb1f9f3db73f54a7208e0f24f
jithintomcek/PythonSampleWorks
/logfile-reader.py
UTF-8
147
2.84375
3
[]
no_license
# # Sample script to read log file line-by-line # LogFile = '/path/to/logfile' with open(LogFile) as fh: for logline in fh: print(logline)
true
207e31f66cc2baf5057a8ae9429616b702ca1c01
jasyen/The-Teacher-A-Roguelike
/map_objects/game_map.py
UTF-8
5,426
3.15625
3
[]
no_license
import libtcodpy as libtcod from random import randint from render_function import RenderOrder from components.ai import BasicMonster from components.fighter import Fighter from entity import Entity from map_objects.rectangle import Rect from map_objects.tile import Tile class GameMap: def __init__(self, width,...
true
44cef4aee17ee4b00cfa9a132c2dbc58975b41df
faythashiedu/wikipedia-scraper
/wikipediascraper.py
UTF-8
740
2.875
3
[]
no_license
import requests, bs4 covid_data = requests.get("https://en.wikipedia.org/wiki/COVID-19_pandemic_by_country_and_territory") # print(covid_data.content) soup = bs4.BeautifulSoup(markup= covid_data.content, features="html.parser" ) covid_table = soup.find_all(["table",{"class":"wikitable plainrowheaders sortable jquery-t...
true
74aecde777a82a1ac784681b1c1e01412f5316ca
chicochico/exercism
/python/scale-generator/scale_generator.py
UTF-8
1,579
2.734375
3
[]
no_license
from itertools import cycle from itertools import islice CHROMATIC = 'C C# D D# E F F# G G# A A# B'.split() CHROMATIC_FLATS = 'C Db D Eb E F Gb G Ab A Bb B'.split() USE_SHARPS = 'G D A E B F# e b f# c# g# d#'.split() USE_FLATS = 'F Bb Eb Ab Db Gb d g c f bb eb'.split() VALID = ['MMmMMMm', 'MMmMMMm', ...
true
a6b784f1d5b9a1bb1a10494e107dd1c17c137f51
fawaz-strawberry/ValoGun
/PythonScripts/conv_net.py
UTF-8
950
2.625
3
[]
no_license
import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F #((W-F+2*P )/S)+1 class FeetCNN(torch.nn.Module): def __init__(self): super(FeetCNN, self).__init__() self.conv1 = torch.nn.Conv2d(1, 6, kernel_size=5)#Output = ((64-3+2*1)/1) + 1 = 64 se...
true
bbc8a59ee0cd5890ee0fa6dcf62bc2edf1dd8bb5
fdanovice/tfm
/src/old/Route_old.py
UTF-8
20,977
2.59375
3
[]
no_license
from src.old.sucio import waste_collection from itertools import chain import random as random import time import numpy as np import copy import multiprocessing as mp class Route(waste_collection): def __init__(self, file_filling_rates, file_times): super().__init__(file_filling_rates, file_times) def...
true
f8fc5e50c4705b472d12b83d63ed91876ec0c4b2
lun3322/goose3
/tests/test_parsers.py
UTF-8
18,337
2.703125
3
[ "Apache-2.0" ]
permissive
""" This is a python port of "Goose" orignialy licensed to Gravity.com under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Python port was written by Xavier Grangier for Recrutae Gravity.com licenses this file to y...
true
c01ec5d529acd7bbe1ee5b344d911b8a52a8cb06
keepexploring/bits_and_bobs2
/message_server/send_sms.py
UTF-8
468
2.546875
3
[]
no_license
# /usr/bin/env python # Download the twilio-python library from http://twilio.com/docs/libraries from twilio.rest import Client # Find these values at https://twilio.com/user/account account_sid = "" auth_token = "" client = Client(account_sid, auth_token) from_ = "" def send_sms(message,to): message = client.a...
true
0a6eab330fc6a1bb1d3e009a05e196e09ed68255
messteno/shad_example
/utils/preprocessor.py
UTF-8
1,499
2.765625
3
[]
no_license
import re import os import sys def merge_files(files): merged_data = "" for file in files: with open(file, 'r') as fp: merged_data += fp.read() return merged_data def remove_includes(data): sys_inc_re = re.compile(r'#include\s+<(.*)>') sys_inc = set(sys_inc_re.findall(data)) ...
true
c74f36981ab7a9b22902475974b4bd33f727258e
jmelis/qontract-reconcile
/utils/openshift_resource.py
UTF-8
3,650
2.625
3
[ "Apache-2.0" ]
permissive
import copy import hashlib import json class OpenshiftResource(object): def __init__(self, body, integration, integration_version): self.body = body self.integration = integration self.integration_version = integration_version @property def name(self): return self.body['me...
true
9d6153d0d15f1d5bee8079f4161312c7636dff71
gabrielhsu1997/TF-test
/Q2.py
UTF-8
458
3.28125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Aug 24 10:27:20 2021 @author: Gabriel """ # I've tried this function but it doesn't work. # NameError springs up at function call itself and I don't really know to allow for parameters that are undefined variables. def exists(*args): for arg in args: try: ...
true
911629f0716df484297d8f31cfe2a8cbd7180c94
Han-Burger/Leetcode
/10-Regular-Expression-Matching/solution.py
UTF-8
729
2.953125
3
[]
no_license
class Solution(object): def isMatch(self, s, p): """ :type s: str :type p: str :rtype: bool """ m = [[False for j in xrange(len(p) + 1)] for i in xrange(len(s) + 1)] m[0][0] = True for j in xrange(len(p)): m[0][j + 1] = j > 0 and p...
true
951ee63e26783aa616020c46c366ef392e7c3c19
jplasmeier/cull
/cull.py
UTF-8
1,328
2.90625
3
[]
no_license
# cull - split a csv file by applying a regex to its columns import os import pandas as pd import shutil ASSET_PATH = '/home/jgp/geocivics/rone/assets' DATA_PATH = '/home/jgp/geocivics/srproj/data' asset_files = os.listdir(ASSET_PATH) asset_paths = [os.path.join(ASSET_PATH, x) for x in asset_files if x[-3:] == 'csv...
true