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 |
|---|---|---|---|---|---|---|---|---|---|---|
82ce39e7d9a768bbe249ef52921028d7b380eb78 | yuthreestone/LanQiao-Learning | /第九届蓝桥杯大赛决赛/阅兵方阵.py | UTF-8 | 464 | 3.3125 | 3 | [
"MIT"
] | permissive | # 先确定 人数平方的阈值
import math
num=1000
count=0
while count!=12:
count=0
limit=int(math.sqrt(num))
t=0
for i in range(limit,limit//2,-1):
iSquare=i**2
# if 余数 的开方刚好是整的,那么就是可以的
rest=num-iSquare
if int(math.sqrt(rest))**2==rest and t!=rest:
## print(iSquare,rest)
... | true |
c8e4fd35c4ae7e6587cb4befa0bf4a982650e103 | minasel/gmt-python | /gmt/tests/test_gmttempfile.py | UTF-8 | 1,823 | 3.15625 | 3 | [
"BSD-3-Clause",
"Python-2.0"
] | permissive | """
Tests for GMTTempFile class
"""
import os
from ..utils import GMTTempFile
def test_gmttempfile():
"Check that file is really created and deleted."
with GMTTempFile() as tmpfile:
assert os.path.exists(tmpfile.name)
# File should be deleted when leaving the with block
assert not os.path.exi... | true |
f363d113302db978eaef33c84f9eea4f8111012f | SherbazHashmi/HackathonServer | /arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/_impl/common/_utils.py | UTF-8 | 7,380 | 2.75 | 3 | [
"Python-2.0"
] | permissive | """set of common utilities"""
import os
import sys
import time
import uuid
import zipfile
import datetime
from datetime import date
import tempfile
from contextlib import contextmanager
import six
import logging
import decimal
import functools
#-------------------------------------------------------------... | true |
5fa7ecf35df20796719a14279ea60bc8fffe465d | mfcookie/Lab8 | /hashPart2.py | UTF-8 | 2,829 | 3.5625 | 4 | [] | no_license | #MIDN Megan Fields & MIDN Luke Loehr, SY402 - Section 3321
#Lab 8: Understanding the Host's integrity
# Part 1 - create a script that will recursively walk through all the files on a file system.
# Configure the program to define certain files/directories as unhashable so they'll be
# ignored. /dev, /proc, /run, /sys... | true |
581eb5bcece4995ce48a1ad166816e3dd03c1310 | rfrm99/Assignments | /Semester 1/Mr. Jude/File Assignments/1. findHapax.py | UTF-8 | 345 | 3.21875 | 3 | [] | no_license | def findHapax(file):
hapax_list = []
text = ''
with open(file, 'r') as f:
for line in f:
text = (line + ' ').lower()
for word in text.split():
x = text.split().count(word)
if x == 1:
hapax_list.append(word)
print(hapax_list)
findHapax('... | true |
a0f3824c8fe7dffcabd837ae7c4406dc5ed70366 | EGINF-BK/py-training | /Knowledge_Sharing/decoration_fun1.py | UTF-8 | 952 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#*************************************************************************
# > File Name: generator_list_test.py
# > Author: Tim Wang
# > Mail: spookw@foxmail.com
# > Created Time: Tue 22 May 2018 11:20:57 PM CST
# ************************************************... | true |
71c17170177f570c18b6f7942b681cf340ddfb40 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_54/38.py | UTF-8 | 539 | 3.03125 | 3 | [] | no_license | import sys
def gcd(a,b):
if(a > b):
return gcd(b,a)
if(a==0):
return b
else:
return gcd(b%a,a)
count = 0
data = sys.stdin.readline()
T = int(data)
for omg in range(0,T):
svals = sys.stdin.readline()
val = svals.split()
N = int(val[0])
ts = [0]*N
for i in range(1,N+1):
ts[i-1] = int(val[i])
ts.sort(... | true |
c41f9a2478768ecc58b89409e5ebdb544e200fd6 | ezopezo/deepdive | /3_hash/timmings_and_optimizations.py | UTF-8 | 3,001 | 3.8125 | 4 | [] | no_license | from timeit import timeit
from collections import OrderedDict
'''
def create_dict(n=100):
d = dict()
for i in range(n):
d[i] = i
return d
def create_ordered_dict(n=100):
d = OrderedDict()
for i in range(n):
d[i] = i
return d
def popitem(d, last=True):
if last:
retu... | true |
2035d234187289e7ffb8ca029308fc835a31f43c | Mercadillo/Zalando_product_analysis | /model_alpha.py | UTF-8 | 4,186 | 2.65625 | 3 | [] | no_license | import torch
import torch.nn as nn
import torchvision.datasets as dsets
#from skimage import transform
import torchvision.transforms as transforms
from torch.autograd import Variable
import pandas as pd;
import numpy as np;
from torch.utils.data import Dataset, DataLoader
#from vis_utils import *
import rand... | true |
3b66de53fc18c3e00a9b9fa475d19a0536b87fc1 | dyhmzall/geekbrains_python | /lesson3/task6.py | UTF-8 | 1,409 | 4.90625 | 5 | [] | no_license | # 6. Реализовать функцию int_func(), принимающую слово из маленьких латинских букв и возвращающую его же,
# но с прописной первой буквой. Например, print(int_func(‘text’)) -> Text.
# Продолжить работу над заданием.
# В программу должна попадать строка из слов, разделенных пробелом.
# Каждое слово состоит из латинских б... | true |
ba54896e967344e0b386ba40f8feebf74d2e7586 | ari-hacks/kata-practice | /katas/python/kyu8/get_average.py | UTF-8 | 133 | 3.28125 | 3 | [] | no_license | import math
"""
Get the average of a list and round to low
"""
def get_average(marks):
return math.floor(sum(marks)/len(marks))
| true |
e477aefa6b5701f29f91710cdde7d2bf0d1c1169 | Aasthaengg/IBMdataset | /Python_codes/p03697/s917872783.py | UTF-8 | 86 | 2.703125 | 3 | [] | no_license | a, b = map(int, input().split())
ans = a+b
print(ans) if ans <= 9 else print("error") | true |
9502bf47e03bcd619091a767f7aea40f69dbbeda | izharul-haq/mailbox-back | /src/services/Elgamal/utils.py | UTF-8 | 294 | 3.265625 | 3 | [] | no_license | from typing import Union
def generate_key(p: int, g: int, x: int) -> (int, int, int, int):
'''Generate Elgamal public/private key using given prime number p
and random number g and x.
It's assumed that g < p and 1 <= x <= p - 2.'''
y = pow(g, x, p)
return (y, g, x, p)
| true |
cb757a202fa894a1f6ef6dcc4426c17a0461ba70 | flyingdutchnick/ceo-turnover | /data/dev/1_update_panel.py | UTF-8 | 1,082 | 2.90625 | 3 | [] | no_license | import pandas as pd
import numpy as np
def make_panel(file_path):
data_no_panel = pd.read_csv(file_path)
lst_of_panels = []
for i in range(data_no_panel.shape[0]):
start = data_no_panel.at[i, 'date_start_role']
end = data_no_panel.at[i, 'date_end_role']
if end == '-1':
... | true |
c087382c5ba99ac3dfef13f7e7920ae5337a6d2a | FleischmannLucas/Trabalho2_IA | /Atividade_02_WINE_Fuzzy_C_meansVariandoMe excluindofeatures.py | UTF-8 | 3,640 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 27 18:13:54 2021
@author: Lucas Gava
"""
from __future__ import division, print_function
import skfuzzy as fuzz
from sklearn.datasets import load_iris
from sklearn.datasets import load_wine
import numpy as np
import collections
from sklearn.metrics import cl... | true |
fb15545db965406a1479f8bbdb6417c4e59b7efc | gene63/BaekJoonStep | /step15/8.py | UTF-8 | 517 | 2.640625 | 3 | [] | no_license | from itertools import combinations
n = int(input())
scores = [list(map(int, input().split())) for _ in range(n)]
people = set([i for i in range(n)])
permute = set((combinations(people, n//2)))
mmin = 1000000000
for arr in permute:
a = set(arr)
b = people - a
ascore = 0
bscore = 0
for i in list(a):
... | true |
97e6c685a8cd41535515d17cb10c0dc5858e0bd2 | Heyyounghan/AIstudy | /molamola/200217_DNN.py | UTF-8 | 2,416 | 3 | 3 | [] | no_license | import pandabear as pd
import applepie as np
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split #훈련, 테스트 데이터 분리, 그리드 서치 등의 기능 제공
from keras.layers import Dense #은닉층
from keras.models import Sequential # 신경망으로 묶기.
from keras.utils import to_categorical # 다중분류시에... | true |
20d341b7e0c689faed5217c11fcc667955f77106 | lemoshu/Cooperative_Training_and_Latent_Space_Data_Augmentation | /medseg/models/model_util.py | UTF-8 | 25,575 | 2.546875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from torch.optim import lr_scheduler
import numpy as np
import contextlib
import math
from medseg.models.segmentation_models.... | true |
b2ab9a04cbe64fdd7f7229c03a1037a3a3801ecb | sapsey19/oop-ssapsey | /assignment3/python/couch.py | UTF-8 | 404 | 3.421875 | 3 | [] | no_license | from furniture import Furniture
class Couch(Furniture):
DEFAULT_MATERIAL : str = 'leather'
DEFAULT_NUM_CUSHIONS : int = 4
def __init__(self, material : str = DEFAULT_MATERIAL, numCushions : int = DEFAULT_NUM_CUSHIONS):
super(Couch, self).__init__(material)
self._numCushions = numCushions
... | true |
445ff9efa93cb39ed4ca5aa02e262236ccf51c6d | Jazz0006/battle_ship | /game_server.py | UTF-8 | 4,768 | 3.40625 | 3 | [] | no_license | import game_class
import socket
import threading
class ClientThread(threading.Thread):
""" A thread for each client connection
Attribute:
conn: the socket connection
addr: client IP address and port
my_game: a instance of GamePlay class
"""
def __init__(self, clientAddress, c... | true |
7c030782e22acd1261e2a6f870bf2c321dcaafcf | yongzx/automated-RevSlider-input | /src/ExcelData.py | UTF-8 | 2,162 | 3.484375 | 3 | [
"MIT"
] | permissive | import openpyxl
import copy
import re
class ExcelData:
"""
ExcelData contains all the data in a Excel sheet
Arguments:
None
Container: list
To access individual Topic data, ExcelData_instance[row_number_from_excel-2][column_number][category]
Functions:
read(TopicData object, Excel) : ... | true |
73d9d0f5f1c2e4422a8f19cf0d563e11121ac1b3 | Vins1805/SPEZ-PROG-GRUPPE01 | /backend/src/customer.py | UTF-8 | 1,765 | 3.09375 | 3 | [] | no_license | import uuid
import json
from booking import Bookings
class Customer():
def __init__(self,_id, surname, name, driver_license, payment_methods, renting):
self._id = _id
self.surname = surname
self.name = name
self.driver_license = driver_license
self.payment_methods = paymen... | true |
0a3b68185eee0eaa3ad01e8bbfab094493411c6c | plishing/Agena2 | /DHT.py | UTF-8 | 692 | 3.3125 | 3 | [
"Beerware"
] | permissive | #ubprocess module
import subprocess
## call date command ##
p = subprocess.Popen("./DHT.sh", stdout=subprocess.PIPE, shell=True)
## Talk with date command i.e. read data from stdout and stderr. Store this info in tuple ##
#Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-fi... | true |
cb23885a5bcce322ed6610796bf52b06c22af687 | siva9598/DS-Algo-Python | /Graphs/DFS.py | UTF-8 | 579 | 3.671875 | 4 | [
"MIT"
] | permissive | from collections import defaultdict
class Graph:
def __init__(self):
self.graph = defaultdict(list)
def addEdge(self,u,v):
self.graph[u].append(v)
def DFSUtil(self,v,visited):
visited.add(v)
print(v, end=" ")
for neighbour in self.graph[v]:
if neighbour ... | true |
be702f6543b73d011ba686f9572ea69849a77975 | muhamed-emadeldin/Data-Structure-Algorithms | /basic_algorithm/find_first_last_index.py | UTF-8 | 2,043 | 3.921875 | 4 | [] | no_license | #!/usr/bin/env python
def binary_search(arr, target, l, r):
if r >= l:
midd = (l+r) // 2
if arr[midd] == target:
return midd
elif arr[midd] < target:
return binary_search(arr, target, midd+1, r)
else:
return binary_search(arr, target, l, r=midd - 1)
else:
return -1
def first_... | true |
bd63a277654205b8c29699090a130c975df82eb7 | conditg/live-topic-analysis | /spark_streaming.py | UTF-8 | 3,464 | 2.625 | 3 | [] | no_license | from pyspark import SparkConf,SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row,SQLContext, SparkSession
import sys
import requests
import json
from datetime import datetime
TCP_REMOTE_HOST = "data_server" #docker container name of tweet generator
TCP_PORT_INPUT = 9009 ... | true |
5362bec6353b977bbfff4cf69a53a4371e94e3e9 | novelview9/doodle | /20171108/corutine.py | UTF-8 | 195 | 2.5625 | 3 | [] | no_license | def check_and_split(yun, e):
yun_list = [("+", "-", "*", "/"]
for yun in yun_list:
def calc():
result = None
value = yield result
if '+' in value:
value.split('+')
| true |
7a7b5ff1a22957a70857fb10d55c939a06562c1b | yhyoscar/codingpractice | /python/lc140_wordbreak2.py | UTF-8 | 2,579 | 3.046875 | 3 | [] | no_license | class Solution:
def wordBreak(self, s, wordDict):
print(s)
print(wordDict)
method = 'memory'
if method == 'memory':
start = {i:{} for i in range(len(s)+1)}
for word in wordDict:
for i in range(0, len(s)-len(word)+1):
if s[i:... | true |
5ab2f19826aa5d5a9e985b7859dfbea4a8f6dd96 | Gaodelike/errorCorrect | /explorations/indel-gen.py | UTF-8 | 5,583 | 3.34375 | 3 | [
"MIT"
] | permissive | #!/data/home/nlubock/miniconda2/envs/py35/bin/python
"""
Insert or delete arbitrarily long N-mers at a given position
Nathan Lubock
June, 2016
TODO - Convert to command line utility
"""
import itertools
import csv
import sys
import argparse
from signal import signal, SIGPIPE, SIG_DFL
# catch broken pipe errors to all... | true |
9fa6085ab5c4503a5182702ef4bd8cb641a7e5bf | Nur99/yandex_lyceum | /2nd_year/6/ClassWork/Номера телефонов 1 .py | UTF-8 | 991 | 3.375 | 3 | [] | no_license | def to_std(tel):
_error_msg = "error"
tel = "".join(tel.split()) # убрали все пробелы
if tel.find("+7") != 0 and tel.find("8") != 0:
return _error_msg
if not all(tel.split("-")): # условие на знак -, нет пустых строк, если разделим по ним
return _error_msg
else:
tel = te... | true |
b9807d8148ed6c4d21f192ef4181c5face4f5299 | sameedshoaibb/Python100days | /version_cleaner.py | UTF-8 | 3,040 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
''' Service that will give running Testing machine's '''
import boto3
REGION = 'eu-central-1'
ENV = "stage"
def get_name():
''' Get data '''
empty_list = []
ec2 = boto3.resource('ec2', region_name=REGION)
running_instances = ec2.instances.filter(Filters=[{'Name': 'instance-state... | true |
363f9540d0c8fc6f331ef6b13f852dc353e344a1 | Lucky4/coding-interview | /17.py | UTF-8 | 582 | 3.5625 | 4 | [] | no_license | # -*- coding:utf-8 -*-
import re
class Solution:
# s字符串
def isNumeric(self, s):
return re.match(r"^[\+\-]?[0-9]*(\.[0-9]*)?([eE][\+\-]?[0-9]+)?$", s)
# 这个题,对于我来说就是巩固正则表达式,学会使用正则表达式来解决问题。
# 有几个注意的地方:
#
# 1. 什么是科学计数法?
# 如:19971400000000=1.99714×10^13。计算器或电脑表达10的幂是一般是用E或e,也就是1.99714E13=19971400000000。
... | true |
a4e95436b81fcf3b1090b95a6af65d689f78c1bb | HeYichigo/IR-work | /bbb.py | UTF-8 | 681 | 3.234375 | 3 | [] | no_license | import time
"""
暂时没有用
"""
def get_label_in_a_file(original_path, save_path='label.txt'):
f = open(original_path, 'r')
label_list = []
for line in f:
# spam
if line[0] == 's':
label_list.append("spam")
# ham
elif line[0] == 'h':
label_list.append("ha... | true |
d1261835df4df2415bbc2c9fefec0e0084edb16d | Kyliec89/Python-Projects | /sorts_count.py | UTF-8 | 1,498 | 4.40625 | 4 | [] | no_license | # Author: Kylie Chambers
# Date: 1/29/2020
# Description: A bubble sort and an insertion sort that count the number of
# exchanges and comparisons made while sorting a list and returns them as a
# tuple.
def bubble_count(my_list):
"""
a bubble sort function that counts the number of comparisons and exchanges
... | true |
4872739b9f85358dae73c8492c0b1db850c6d815 | mkmrabby/Hackerrank | /python_challenge/python_challenge.py | UTF-8 | 13,231 | 4.75 | 5 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Say "Hello, World!" With Python
# Here is a sample line of code that can be executed in Python:
#
# print("Hello, World!")
# You can just as easily store a string as a variable and then print it to stdout:
#
# my_string = "Hello, World!"
# print(my_string)
# The above code w... | true |
af8cb8d2a2599b6f1bdd62962552b6e162bff732 | alekspv/dcos | /packages/winpanda/extra/src/winpanda/core/package/id.py | UTF-8 | 1,793 | 3.21875 | 3 | [
"ErlPL-1.1",
"Python-2.0",
"LicenseRef-scancode-oracle-bcl-javase-javafx-2012",
"MPL-2.0",
"ISC",
"BSL-1.0",
"Apache-2.0",
"BSD-2-Clause",
"MIT"
] | permissive | """Panda package management for Windows.
DC/OS package ID type definition.
"""
class PackageId:
"""DC/OS package ID type.
Ref:
[1] https://github.com/dcos/dcos/blob/master/pkgpanda/docs/\
package_concepts.md
"""
_separator = '--'
def __init__(self, pkg_id=None, pkg_name=None, pk... | true |
659373cb21913c99d201a2f33d9934a262172959 | mariaspasojevic/PyRBSP | /wfrpy.py | UTF-8 | 3,262 | 2.96875 | 3 | [] | no_license | """
wfrpy.py
This module contains functionality for handling WFR data from the
RBSP EMFISIS intrument
http://emfisis.physics.uiowa.edu/
"""
import os
import glob
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from spacepy import pycdf
def read_cd... | true |
9c92543a04043b7eb5c0ade08ae5bfed06521bbe | Lucas749/Instagram-Media-Scraper | /Instagram Media Scraper.py | UTF-8 | 6,073 | 2.8125 | 3 | [] | no_license | # Import packages
import os
import requests
import time
import re
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
# Assign instagram url and retrieve account names
URL = "https://instagram.com/"
account_list... | true |
2e75f79f04273fa704e7290cb73a89f1ebeabc6c | jdeepee/metamix | /webapp/manage.py | UTF-8 | 1,559 | 2.5625 | 3 | [] | no_license | from flask_script import Manager
from sqlalchemy.schema import CreateTable
from metamix.application import create_app
from metamix.extensions import db
import os
from flask import *
# Set config Object based on Ennv
if os.environ.get('METAMIX_ENV') == "production":
config = "metamix.config.Production"
elif os.env... | true |
509a4ec3338fc8855ca4b1e8b7201e2ab8ff9bff | Baz07/urlShort | /tinyURLapp/shortLogic.py | UTF-8 | 1,495 | 3.46875 | 3 | [] | no_license | import hashlib
class Shortner:
# url_mapper = {}
# url_id = 1000000
# def shorten_url(self, long_url):
# if long_url in self.url_mapper:
# # print("ALREADY PRESENT")
# id = self.url_mapper[long_url]
# short_url = self.tokenGenerator(id)
# else:
# ... | true |
279d89e054105304eb9a6f5cfd6f7bb1d9cca5c1 | AaronTengDeChuan/leetcode | /leetcode/50.Pow_x^n.py~ | UTF-8 | 625 | 3.546875 | 4 | [] | no_license | #!usr/bin/env python
#-*-coding:utf-8-*-
import sys
class Solution(object):
def myPow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
flag = False
if n < 0:
flag = True
n = -n
result = 1.0
curPow = x
... | true |
efcab312baf71c1da033098bbcdc4787ea7c8b9d | soultoxik/dis | /builder.py | UTF-8 | 229 | 2.859375 | 3 | [] | no_license |
class AirportsBuilder:
def __init__(self):
self.state = {}
def build(self):
return self.state
def add(self, id, lat, lon, capacity):
self.state[id] = {
'lat': lat,
'lon': lon,
'capacity': capacity
}
| true |
9db9222d35c165f1e3b6c99f9b99db565251f659 | adamjakab/GarminConnectFitFetcher | /gcff.py | UTF-8 | 3,992 | 2.578125 | 3 | [] | no_license | from datetime import datetime
import logging
import json
import os
import argparse
from datetime import timedelta
from dateutil import tz
from garminexport.retryer import Retryer, ExponentialBackoffDelayStrategy, \
MaxRetriesStopStrategy
from garminexport.garminclient import GarminClient
import garminexport.backup... | true |
ae58999b61d332371eb04f17b409ff177f9ce439 | JohnUrban/sciara-project-tools | /deprecated/pfm/pfmTools.py | UTF-8 | 5,291 | 3.21875 | 3 | [] | no_license | import random, sys
def addToPfm(seqLen, sequence, posFreqMatDict, currentHeader, seqCount):
if len(sequence) == seqLen:
sequence = sequence.upper() ## make all bases same case
## for each position along sequence
for i in range(seqLen):
## Take the base at position i
... | true |
132d540e8677adf0786d770a2784ee77aa8e4521 | githubvit/study | /2018/pcy1/pyy.py | UTF-8 | 4,867 | 2.828125 | 3 | [] | no_license | #_*_coding:utf-8_*_
# print 'hello word!'
# def sayhai():
# print 'this in sayhai funcoint'
# def test1():
# print 'in the test1'
# def test2():
# print 'in the test2'
#
# sayhai()
# test1()
# test2()
# print (__file__)
# def test1(name,age):
# name=name
# age=age
# r1=('Foo', ('typ', 'obje'), {'mo... | true |
0e699402458beefb5b1f54f99c11a97b4f77809b | AndrejHafner/Data-mining | /Naloga_1-Eurovision/naloga1.py | UTF-8 | 6,520 | 3.421875 | 3 | [] | no_license | import csv
import math
import sys
# Author: Andrej Hafner (63160122)
REMOVED_ATTRIBUTES = ['Region', 'Song language', 'Artist', 'Song', 'English translation', 'Artist gender', 'Group/Solo', 'Place', 'Points', 'Host Country', 'Host region', 'Home/Away Country', 'Home/Away Region', 'Approximate Betting Prices']
def re... | true |
094797fc05c9a8ea5f6edc53dcf5130117ee4c7f | Hopding/arithmetic-evaluator | /src/test_evaluate_postfix.py | UTF-8 | 1,913 | 3.25 | 3 | [] | no_license | import unittest
# pylint: disable=import-error
from expression_tokenizer import tokenize_expression, stringify_tokens, Token
from notation_conversion import infix_to_postfix
from postfix_evaluation import eval_postfix
def parse_and_eval(infix_expression):
return eval_postfix(infix_to_postfix(tokenize_expression(... | true |
532d0f5704343e8050d0f9ac1a41433b35ed3ec8 | drpuig/Leetcode-1 | /construct-binary-tree-from-preorder-and-inorder-traversal/construct-binary-tree-from-preorder-and-inorder-traversal.py | UTF-8 | 638 | 3.1875 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def buildTree(self, preorder: List[int], inorder: List[int]) -> TreeNode:
dic = {num: i for i, num i... | true |
232b5e00e697e19e769939effaa2ab03fcaaa93b | boywell/learn_python | /timeToYearEnd.py | UTF-8 | 796 | 3.375 | 3 | [] | no_license | import time
import math
def changeTime(allTime):
day = 24 * 60 * 60
hour = 60 * 60
min = 60
if (allTime < 60):
return "%d 秒" % math.ceil(allTime)
elif allTime > day:
days = divmod(allTime, day)
return "%d 天,%s" % (int(days[0]), changeTime(days[1]))
elif allTime >= hour:
... | true |
0a1bd7d66d8ec85fa76abf1026b4c12ce447e812 | DamnDanielV/bootcamp-higher_level_programming | /0x07-python-test_driven_development/tests/6-max_integer_test.py | UTF-8 | 2,270 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python3
"""Unittest for max_integer([..])
"""
import unittest
max_integer = __import__('6-max_integer').max_integer
class TestMaxInteger(unittest.TestCase):
"""class max integer"""
def test_max_integer(self):
"""# test max in a list"""
ma = [2, 3, 4, 5]
self.assertEqual(max_... | true |
0ef21d109d80b9d6c4ff224a892c173f8aa0a959 | Nightknight3000/SeqBioinfo1920-Project | /src/algorithm/reverseComplement.py | UTF-8 | 829 | 2.96875 | 3 | [
"MIT"
] | permissive | __author__ = "Nantia Leonidou"
__description__ = " Reverse Complement of fasta files "
from Bio.Seq import Seq
from Bio import SeqIO
input = "assembly.fasta"
def reverse_complement(file):
revCompls =[]
fasta_sequences = SeqIO.parse(open(file), 'fasta')
for fasta in fasta_sequences:
sequ... | true |
880dce512c5c1bfeb19853648f55a002b8b5d99a | saisumanth007/facial-keypoint-detection-tensorflow-implementation | /utilities.py | UTF-8 | 3,413 | 2.734375 | 3 | [] | no_license | import matplotlib.pyplot as plt
from sklearn.utils import shuffle
import pandas as pd
import numpy as np
from sklearn.externals import joblib
from sklearn.learning_curve import learning_curve
import os
filedir = os.getcwd()
ftrain = filedir+'/data/training.csv'
ftest = filedir+'/data/test.csv'
flookup = filedir+'/dat... | true |
33f97b2b2159475a1d55919c4424bf110ab84e21 | neelkantnewra/BotRasa | /actions/actions.py | UTF-8 | 3,260 | 2.53125 | 3 | [] | no_license | # This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/custom-actions
# This is a simple example for a custom action which utters "Hello World!"
from pynput.keyboard import Key, Listener
from logging im... | true |
02cf1ee5fc01c62cfa78fe1b6a8811d34a750d3b | ok2qw66/TIL | /swea/d2/1966.py | UTF-8 | 216 | 3.21875 | 3 | [] | no_license | T = int(input())
for testCase in range(1, T + 1):
num = int(input())
answer = list(map(int, input().split()))
answer.sort()
answer = ' '.join(list(map(str,answer)))
print(f'#{testCase} {answer}') | true |
26b4c39184d726f6b2fef3093dff281211256b9d | tspannhw/machine_learning | /source/09_Computer_Vision_Intro/read_web_cam.py | UTF-8 | 550 | 2.90625 | 3 | [
"MIT"
] | permissive | import cv2
# http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html
cap = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
... | true |
1a292913d2d3bd670192576e07f9071a9c1d050b | afonso12325/get_my_videos | /crawler.py | UTF-8 | 2,213 | 2.671875 | 3 | [
"MIT"
] | permissive | import requests
from bs4 import BeautifulSoup
import os
import glob
class Crawler:
def __init__(self, channels_list, N):
self.ch_list = channels_list
self.N = N
def get_videos_url(self, channel):
ch_url = 'https://www.youtube.com/user/' + channel + '/videos'
data = requests.get(... | true |
3b51c0a0abf43f80050def7dcdd249020cacdecb | rodrigo-brito/BestWordChallenge | /src/main.py | UTF-8 | 1,510 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python
#-*- coding: utf-8 -*-
# Author: Rodrigo Ferreira de Brito (contato@rodrigobrito.net)
from database import Database
from word import Word
# Search for words avaliable for the list construction
# lettersAvaliable [string] list of letters avaliable for the construction
# database [Database] database ob... | true |
e12d1eef36a83d9e8fdf1c7cf65edd0de6d282c2 | souvikchtt/svk_repos | /user_input.py | UTF-8 | 519 | 4.46875 | 4 | [] | no_license | name=input("Enter the name: ")
age=input("Enter your age: ")
print("hello "+name+" your age is "+age)
num1=input("Enter first number: ")
num2=input("Enter second number: ")
## by default python take user input as string, if we take num1 as 3 and num2 as 4 and then use sum=num1+num2,
## we get 34 as sum result. ... | true |
891c5ed1b73f40600295bdb7e57d6dcdd58b9e86 | AmimoAustin/OOP-Basics1 | /Polymorphism.py | UTF-8 | 1,124 | 4.34375 | 4 | [] | no_license | # Polymorphism is an important feature of class definition in Python that is utilized when you have commonly named
# methods across classes or subclasses. This permits functions to use entities of different types at different times.
# So, it provides flexibility and loose coupling so that code can be extended and easil... | true |
bce6ede99ad7c1d156e40c50cf8178e3c1dc42b5 | abiraja2004/automatic-text-classification-summarization | /preprocessing/feature_extraction.py | UTF-8 | 5,842 | 3.46875 | 3 | [] | no_license | """
Created on Fri Dec 1 17:40:29 2017
@author: Aleksa Kocić
Feature extraction module. Contains methods for feature extraction from
third-party libraries.
"""
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.stem import PorterStemmer... | true |
d7b0dbf559a1511aac4ba6d1d524206c98583f57 | dukeow94/graphics | /shading/bsp.py | UTF-8 | 5,333 | 2.53125 | 3 | [] | no_license | # coding: utf-8
import numpy as np
import random
import material
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL import *
V, VT, VN = range(3)
EPS = 1e-4
def lin_interp(t, a, b):
return (1.0 - t) * a + t * b
def sign(x):
if abs(x) < EPS:
return 0
return np.sign(x)
class BspTree:
de... | true |
7de929e4e2c62b2dd3ccfb864e857c774a58c583 | WojciechGierulski/chat_app | /chat_window_widget.py | UTF-8 | 2,957 | 3.0625 | 3 | [] | no_license | import tkinter
class ChatWindowWidget:
def __init__(self, frame, width=400, height=500):
self.font_size = 15
self.offset = 8
self.width = width
self.height = height
self.bits_limit = 40
self.canvas = tkinter.Canvas(frame, bg='#FFFFFF', width=width, height=height,
... | true |
92fc8553b0f069539c1a0831068c6af6c7c1244a | dannyso16/pyxelDigitRecognition | /model.py | UTF-8 | 1,185 | 3.171875 | 3 | [] | no_license | import numpy as np
import pickle
from PIL import Image
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
def train():
"""Train k-nearest neighbors model with Digits dataset
"""
digits = load_digits()
X = dig... | true |
8347e04622327503e69d262e50ce634eb05dae72 | danathughes/pyNeuralNetwork | /demo/predictIsolet_NN.py | UTF-8 | 1,351 | 2.515625 | 3 | [] | no_license | from NeuralNetwork.neuralNetwork import *
import Training.training as training
import random
import matplotlib.pyplot as plt
from datasets.isolet import *
from Logger.graphLogger import *
from Logger.consoleLogger import *
from Logger.compositeLogger import *
from Training.teacher import *
if __name__ == '__main__':
... | true |
f6e06811176598787172f4627c10a4b3244be65f | nurakmaljalil91/python-game-development | /src/scenes/Scene.py | UTF-8 | 505 | 3.09375 | 3 | [] | no_license | import random
import string
def generate_id():
random_number = random.randint(100, 999)
random_string = ''.join(
[random.choice(string.ascii_letters) for n in range(3)])
random_id = random_string + str(random_number)
return random_id
class Scene(object):
def __init__(self, name):
... | true |
543a196c219d7fd48a7db4a73de56674e6f794eb | KWierchomska/GUPB | /gupb/model/arenas.py | UTF-8 | 6,722 | 2.53125 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
from dataclasses import dataclass
import logging
import os.path
import random
from typing import Dict, NamedTuple, Optional
import bresenham
from gupb.logger import core as logger_core
from gupb.model import characters
from gupb.model import coordinates
from gupb.model import effect... | true |
33ef1d376393f27179442867d0f1d4d9cdb583a1 | Jojorabbit21/NBASpread | /data_analysis/runKnnRegression.py | UTF-8 | 2,491 | 2.765625 | 3 | [] | no_license | import mysql.connector
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn import neighbors
from sklearn.model_selection import GridSearchCV
import random
nbadb = mysql.connector.connect(
host="localhost",
user="nbauser",
passwd="",
database="nbadatabase"
)
... | true |
a90de804ce6f75af1914519335d385cba871d55c | diorsx/learnpythonforexample | /socketserver/samplesocketforthreading.py | GB18030 | 936 | 2.9375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
'''
Author: wood
Date: 2017-08-28
Desc: ̰߳汾socketַ
'''
from socket import *
import threading
from time import ctime
HOST = ''
PORT = 12580
ADDR = (HOST, PORT)
def sockHandle(tcpCliSock, addr):
tcpCliSock.settimeout(5000)
while True:
try:
data = tcpCliSock.recv(1024)
... | true |
5ecf0bfd29810a1676c66492c036136b5bc3e5c6 | bandrw/kpfu | /2_course/oib/day02/ex01/main.py | UTF-8 | 4,159 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
import math
import random
import os
import socket
import sys
BLUE_BACK = "\033[44m"
RED_BACK = "\033[41m"
RED = "\033[0;31m"
NULL = "\033[0m"
BOLD = "\033[1m"
MODES_INFO = f"""\
{BLUE_BACK} {NULL} {'Console input: 1':>16s} {BLUE_BACK} {NULL}
{BLUE_BACK} {NULL} {'File input: 2':>16s} {BLUE_BACK... | true |
949649bd5b588007531791beac796d1ed05a56c0 | hamik112/dealerfunnel | /funnel/templates/dev/base/base__/mongo.py | UTF-8 | 1,302 | 2.6875 | 3 | [] | no_license | import datetime
import random
from bson.objectid import ObjectId
def getDate():
day = int(random.randint(1,28))
month = int(random.randint(1,12))
year = int(random.randint(2010,2015))
hour = int(random.randint(1,23))
min = int(random.randint(0,59))
sec = int(30)
return datetime.datet... | true |
e9799e1fe25e6928b9f677b88740ac4d1039a7a4 | azhusubaliev/discrete2project5 | /gui/temAlgorithm.py | UTF-8 | 1,343 | 3.21875 | 3 | [] | no_license |
from heapq import *
def dijkstra(g,n,src,dest,path):
d = [-1] * n
p = [None] * n
d[src] = 0
p[src] = [src,0]
q = [(0, src)]
while (q):
v = heappop(q)[1]
for i in g[v]:
u = i[0]
w = i[1]
if d[u] == -1 or d[u] > d[v] + w:
... | true |
2164945cab117e756e862fea064de2288adf7dbb | YovchoGandjurov/Python-Fundamentals | /02. Lists and Dictionaries/Dictionaries/10.Shellbound.py | UTF-8 | 527 | 3.15625 | 3 | [] | no_license | dct = {}
while True:
inp = input()
if inp == "Aggregate":
break
region = inp.split()[0]
shell = inp.split()[1]
if region not in dct:
dct[region] = [shell]
else:
dct[region].append(shell)
for x in dct.keys():
used = []
lst = [used.append(y) for y in dct[x] if y... | true |
b772e8a6dcf3ce2d46e574c6d411ca6b0ee07233 | ganeshhubale/python_programs | /submenu.py | UTF-8 | 391 | 2.890625 | 3 | [] | no_license | import tkinter
from tkinter import Menu
def hello():
print("hello")
root = tkinter.Tk()
menu = Menu(root)
root.config(menu=menu)
submenu = Menu(menu)
menu.add_cascade(label="file", menu=submenu)
submenu.add_command(label="open", command=hello)
submenu.add_command(label="save", command=hello)
submenu.add_separato... | true |
3d93c4ed65b0ad6e26b2856db48369d11ba81479 | Shadow1356/FiniteAutomata | /CanvasWindow.py | UTF-8 | 1,005 | 2.6875 | 3 | [] | no_license | from tkinter import *
from ResizingCanvas import ResizingCanvas
class CanvasWindow:
def __init__(self):
self.root = None
self.frame = None
self.drawingCanvas = None
def setup(self):
self.root = Tk()
self.frame = Frame(self.root)
self.frame.pack(fill=BOTH, expan... | true |
e4145a3dc2bd062317eb20df05546ecf052a29e2 | rheehot/project-face-recognization | /face_recognition.py | UTF-8 | 1,296 | 2.5625 | 3 | [] | no_license | import cv2
import numpy as np
import os
recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.read('trainer/trainer.yml')
cascadePath = 'haarcascades/haarcascade_frontalface_default.xml'
faceCascade = cv2.CascadeClassifier(cascadePath)
font = cv2.FONT_HERSHEY_SIMPLEX
id = 0
names = ['None','sumin','dongjun',... | true |
fbf353645e39dcba0413c0d3a6fb82edd88935f5 | qsq522439539/Autotest | /Autotest_baicells/BaiTestSulite/webset.py | UTF-8 | 32,346 | 2.609375 | 3 | [] | no_license | #coding=utf-8
import time
import logging
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
fro... | true |
4839a00cc78d722a4fb6453de52b976417316aee | bscheinman/skrim | /skrim/skrimutils.py | UTF-8 | 441 | 3.03125 | 3 | [] | no_license | import numpy as np
from math import exp, sqrt
pad_ones = lambda x: np.append(np.ones([x.shape[0], 1]), x, 1)
sigmoid = lambda x: 1 / (1 + exp(-x))
sigmoid_curry = np.vectorize(sigmoid)
def sigmoid_gradient(x):
x_sig = sigmoid(x)
return x_sig * (1 - x_sig)
sigmoid_gradient_curry = np.vectorize(sigmoid_gradie... | true |
aa42c5b19bc37422dfb5f033803852371371a9d5 | kalekundert/ligrna | /scripts/count_transformants.py | UTF-8 | 8,234 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python3
"""\
Count how many cells were successfully transformed via electroporation.
This is a fairly brittle script meant to help with a calculation I frequently
make. When I do an electro-transformation, I plate up to four dilutions: 10⁻³,
10⁻⁴, 10⁻⁵, 10⁻⁶. This script takes the number of colony-... | true |
e9c1b70f5c18de2871e662a621d5a888851e8f6b | inteligenciamilgrau/assistentemilgrau | /POCs/arduinoPython.py | UTF-8 | 1,309 | 3.171875 | 3 | [
"MIT"
] | permissive | import serial
import threading
import time
conectado = False
porta = 'COM3' # linux ou mac em geral -> '/dev/ttyS0'
velocidadeBaud = 115200
mensagensRecebidas = 1;
desligarArduinoThread = False
try:
SerialArduino = serial.Serial(porta,velocidadeBaud, timeout = 0.2)
except:
print("Verificar porta serial ou re... | true |
926fec7164b4ec37719bc2e258fc3b19d341ef9f | Bilal092/CppNumericalSolvers | /tensorflow/problem.py | UTF-8 | 959 | 2.59375 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
import numpy as np
x = tf.placeholder(tf.float32, shape=[1, 2], name='input')
A = tf.get_variable('A', dtype=tf.float32, initializer=[[2., 1], [3, 4]], trainable=False)
b = tf.get_variable('b', dtype=tf.float32, initializer=[[1., 1]], trainable=False)
c = tf.get_variable('c', dtype=tf.float32,... | true |
60b4976ef362a9b3f6071be759f73165d8947bef | MaximWeb1999/Portfolio_Maksim | /32.The Tkinter Canvas Widget - Метод move. Привязка клавиш клавиатуры/test.py | UTF-8 | 673 | 3.53125 | 4 | [] | no_license | from tkinter import *
c = Canvas(width=300, height=200, bg='white')
# Фокусируем внимание клавиатуры на окно
c.focus_set()
c.pack()
# Шарик
ball = c.create_oval(50, 100, 90, 140, fill='red')
def control(event):
# Проверка ключей клавиш
if event.keysym == 'Left':
c.move(ball, -5, 0)
... | true |
c2fc02f07c46baaac382a8c444792daf942afd71 | merveozdemir/Hangman | /hangman.py | UTF-8 | 4,060 | 4.0625 | 4 | [] | no_license | import random
import string
WORDLIST_FILENAME = "words.txt"
alphabet = "abcdefghijklmnopqrstuvwxyz"
letterList = list(alphabet)
vowelLetters = "aeiou"
def load_words():
print("Loading word list from file...")
# inFile: file
inFile = open(WORDLIST_FILENAME, 'r')
# line: string
line = inFile.readl... | true |
29f12673a8259a44c9c4ab93fb9ecc87782f4186 | eryncameron/tensorflow_plot_test | /please_work.py | UTF-8 | 567 | 2.84375 | 3 | [] | no_license | import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
data = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = data.load_data()
train_images = train_images / 255.0
test_images = test_images / 255.0
"""print(train_l... | true |
51eda8d560d3df12d2c26c2ee91a7d1e83f56fee | lorberlabs/pretvornik | /pretvornik.py | UTF-8 | 477 | 3.859375 | 4 | [] | no_license | print "Hello I'm a program that turns Kilometers in Miles"
newConversion="yes"
while newConversion== "yes":
kilometers = input("Enter value in kilometers")
conversion = 0.621371
# calculate miles
miles = kilometers * conversion
print str(kilometers )+ " kilometers " + " is " + str( miles ) +... | true |
38785b07aedf3bce1a4c74317b5f55aa33d7e3b1 | LDJWJ/kagglebook_jp | /ch02/ch02-05-custom-function.py | UTF-8 | 826 | 3 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
import pandas as pd
# -----------------------------------
# 커스텀 목적 함수의 평가지표 근사에 의한 MAE 최적화
# -----------------------------------
# Fair 함수
def fair(preds, dtrain):
x = preds - dtrain.get_labels() # 잔차 획득
c = 1.0 # Fair함수 파라미터
den = abs(x) + c # 기울기 식의 분모 계산
grad = c * x / den ... | true |
92492ea13e75ab75726931376381c81799dfc368 | Cstolborg/HMMpy | /hmmpy/hmm_online.py | UTF-8 | 7,972 | 2.625 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy import stats
from scipy.special import logsumexp
import matplotlib.pyplot as plt
from hmmpy.sampler import SampleHMM
from hmmpy.base import BaseHiddenMarkov
from hmmpy.mle import MLEHMM
class OnlineHMM(MLEHMM, BaseHiddenMarkov):
def __init__(self, n_states: int = 2, init: str = 'ra... | true |
4c1bd91cafaee0bdf7828ad89c81f705a2955b47 | teerasanqq/miniworldmaker | /source/miniworldmaker/containers/event_console.py | UTF-8 | 580 | 2.8125 | 3 | [
"MIT"
] | permissive | import os
import pygame
from miniworldmaker.containers.container import Container
from miniworldmaker.containers.console import Console
class EventConsole(Console):
event_id = 0
def __init__(self):
super().__init__()
self.register_events.add("all")
def get_event(self, event, data):
... | true |
2a5067ba5671cfc591a859cd2c6737dbdf437038 | AlecJacobsen/roscoff_gwas | /scripts/HetPlot.py | UTF-8 | 1,688 | 2.65625 | 3 | [] | no_license | import argparse
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", dest="input", help="Input File")
parser.add_argument("-s", "--samples", dest="samples", help="Samples File")
parser.add_argument("-o", "--outp... | true |
51729e35797182b5cb23c17a16c983a02444ee34 | bioCKO/RACCROCHE | /raccroche/module2/raccroche/module2/contig_module.py | UTF-8 | 4,536 | 2.75 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 24 02:29:17 2020
@author: qiaojixu
"""
import os
import os.path
import shutil
from raccroche.module2.reset_weight import *
from raccroche.module2.mwm_rewrite import *
from raccroche.module2.save_mwmoutput import *
"""
Module discription:
--... | true |
276af54b70ffe3fcea00f59b6291b38d69084385 | Eloston/misc-programs | /open_path_with_http.py | UTF-8 | 7,162 | 2.703125 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Simple localhost HTTP server with webbrowser launching. It will serve the path of the file or symlink used to invoke this script as the root path; otherwise, it will use current working directory. Only one server will launch per path.
Useful for viewing HTML-based do... | true |
a078a71f74d1c88ca217b95f205d99a948102c11 | CloakMe/MyStuff | /HackerRank/IsFibo/isFibo.py | UTF-8 | 590 | 3.375 | 3 | [] | no_license | import math
def Fib(n):
f_n = ( math.pow( ((1+math.sqrt(5))/2), n) - math.pow( ((1-math.sqrt(5))/2), n) )/math.sqrt(5)
return f_n
def solve(y):
eps = 1e-6
test_n = math.log( math.sqrt(5)*y, (1+math.sqrt(5))/2)
print(test_n)
n = math.ceil(test_n)
f_n = Fib(n-1)
if( abs(f_n - y) < ep... | true |
cd83535e50e388a55d68d81bcb31176b414ed8cc | Wang-Yann/LeetCodeMe | /python/CrackingTheCodingInterview_6/16_20_t9-lcci.py | UTF-8 | 1,852 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : Rock Wayne
# @Created : 2020-07-13 18:20:45
# @Last Modified : 2020-07-13 18:20:45
# @Mail : lostlorder@gmail.com
# @Version : alpha-1.0
"""
# 在老式手机上,用户通过数字键盘输入,手机将提供与这些数字相匹配的单词列表。每个数字映射到0至4个字母。给定一个数字序列,实现一个算法来返回匹配单词的列表。你
# 会得到一张含有有... | true |
58ae7434a5cdfc6a5297a8a5946dbdf87a2b997c | volodya31415/FreeCAD-proto | /proto.py | UTF-8 | 15,089 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#execfile("/home/volodya/Mechanics/FreeCAD-proto/proto.py")
# Change the path above to point to location of this file
# Then you can copy and paste the line into FreeCAD
import Part, FreeCAD, Drawing
from FreeCAD import Base
from Draft import *
import Draft
from math import *
import random
impo... | true |
cccc2b3ebaa7d05f5d3d15a090af21902a11b414 | isundaylee/graphene-django | /graphene_django/filter/utils.py | UTF-8 | 4,077 | 2.578125 | 3 | [
"MIT"
] | permissive | import graphene
from django_filters.utils import get_model_field
from django_filters.filters import Filter, BaseCSVFilter
from .filterset import custom_filterset_factory, setup_filterset
from .filters import InFilter, RangeFilter
def get_filtering_args_from_filterset(filterset_class, type):
""" Inspect a Filter... | true |
22b3294c669fb4e62e3d2c6ac2989c858fe5c1e2 | r-cloutier/savemythesis | /figures/transmittance.py | UTF-8 | 1,576 | 2.71875 | 3 | [] | no_license | from imports import *
from matplotlib.ticker import NullFormatter
def plot_transmittance(wl, trans, pltt=True, label=False):
fig = plt.figure(figsize=(7,4))
ax = fig.add_subplot(111)
ax.plot(wl, trans, 'k-', lw=.5)
# plot bands
bands = ['U','B','V','R','I','Y','J','H','K$_{S}$']
wlcen = [0... | true |
a5a4b8be48f2f876b171f227c396458690312c2c | MarcWiebusch/cowboymoji | /scripts/cowboyfy.py | UTF-8 | 3,690 | 3.21875 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python3
from cowboy_tool import CowboyTool
import argparse
import time
import os
def cli_to_args():
"""
converts the command line interface to a series of args
"""
cli = argparse.ArgumentParser(description="")
cli.add_argument('-input_dir',
type=str, required=T... | true |
97cc6ea495d8f371782993dbf22859d89fa8c55f | Wegii/igitcommit | /gitcommit/__main__.py | UTF-8 | 2,463 | 2.703125 | 3 | [] | no_license | import os
import logging
from jinja2 import Environment, FileSystemLoader, meta, Template
from gitcommit.renderer import (
GitlabRenderer,
HistoryRenderer,
MessageRenderer,
CodeAnalysisRenderer,
)
from gitcommit.config.config import get_config
ROOT_DIR = "./"
RENDERERS = [GitlabRenderer, CodeAnalysisRe... | true |
4475f8eecb76c42e1565c8f8da1634b0cf2b5b4d | anuragchhipa123/ASD1998 | /Day 4/zoo.py | UTF-8 | 716 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri May 10 11:17:44 2019
@author: DELL
"""
import csv
with open("zoo.csv","rt") as f1:
print(f1.readlines())
dict1={}
with open("zoo.csv") as f1:
csv_reader = csv.reader(f1)
next(csv_reader)
for row in csv_reader:
if row[0] in dict1:
... | true |
2afc496dd812130bf8bce54fd69c686e4ccc51c6 | srikanthpragada/PYTHON_31_MAY_2021 | /demo/libdemo/list_tasks.py | UTF-8 | 639 | 3.234375 | 3 | [] | no_license | from datetime import *
f = open("tasks.txt", "rt")
for line in f.readlines():
parts = line.strip().split(",")
if len(parts) < 2: # Not enough data
continue
try:
startdate = datetime.strptime(parts[1], "%d-%m-%Y")
except:
continue # Startdate is invalid
if len(parts) == 2... | true |
8afdcf6551e788109d28812e723702601d460c8f | 15110500442/2017-python- | /day15/飞机大战汇总.py/plane_main.py | UTF-8 | 5,329 | 3.390625 | 3 | [] | no_license | # 使用pygame 我们要先导入这个包
import pygame
from plane_sprites import *
class PlaneGame(object):
'''飞机大战主游戏'''
def __init__(self):
print('游戏初始化')
#创建游戏窗口 pygame.display.set_mode 创建游戏窗口 需要传宽和高
#.size 取宽高 x取x轴的值 y取y轴的值
self.screen = pygame.display.set_mode((SCREEN_RECT.s... | true |