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 |
|---|---|---|---|---|---|---|---|---|---|---|
8c604633651c070b1a170375f91f25f92e2f0e98 | joeltaguinota/fcpc_projects_python | /splice_taguinota.py | UTF-8 | 279 | 3.5625 | 4 | [] | no_license | numList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(numList[3:9])
numlist2 = [0.1, 2.3, 3.5, 4.7, 2.4, 3.7, 5.3, 7.1, 2.9, 1.7,]
print(numlist2[4:8])
carsList = ["Toyota", "Mitsubushi", "Ford", "Nissan", "Subaru", "Kia", "Suzuki", "Isuzu", "Hyundai", "Honda"]
print(carsList[2:6])
| true |
db19405819cc18136f7c566bd5a1a81cd9e677fe | hliuliu/my-projects | /math_project/pymath_tester.py | UTF-8 | 16,645 | 3.5625 | 4 | [] | no_license |
import pymath as pm
## Testing creation of integers
# zeroes in diffrent ways
zeroes_strings=[
'0',
'00000000',
' 000 000 00',
' \t 0 \n 0 \n\t 0',
'+0',
'+ 0000 00',
' + \t 0000000',
'- 00000 00',
'-0',
' - 0000 00 '
]
for z in zeroes_strings:
assert str(pm.integer(z))=='0'
# nonzero integers
... | true |
d6d472e9fff4ebffc03750295804b2804ac17f09 | sfeeling/StarbucksAnalysis | /暂未整合的统计图代码/timezone.py | UTF-8 | 823 | 2.8125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib
#from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import geonamescache
#统计时区的店铺数量,显示柱状图
plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签
plt.rcParams['axes.unicode_minus']=False #用来正常显示负号
df=pd.read_csv('directory.csv')
timezone... | true |
83cc01af31148f1a479c8886c204360c852db762 | prasadmano/Mouse_pointer | /viewing.py | UTF-8 | 1,465 | 2.640625 | 3 | [] | no_license | import cv2
import mediapipe as mp
import time
class display_annotation:
"""display_annotation class is for displaying fps and other annotations from
displaying on screen"""
prev_frame_time = 0
new_frame_time = 0
font = cv2.FONT_HERSHEY_SIMPLEX
mp_drawing = mp.solutions.drawing_utils
mp_draw... | true |
b671db37fe04fe593959e0f30d62dda166f750c6 | thedrkpenguin/CPT1110 | /Week 10/regExpressions5.py | UTF-8 | 2,322 | 3.546875 | 4 | [] | no_license | #Special Characters for Regular Expressions
# '.' - dot matches any character excpet a newline
# '^' - caret matches start of string or beinning of line
# '$' - dollar sign matches the end of a string just before the newline
# '*' - asterisk matches 0 or more repetitions of preceding expression (ab* would match a, ... | true |
0c782ced7cdd6215c2977a5b54905daf933f42c7 | Geeky-star/SortingAlgorithms | /SortingAlgos/TimSort.py | UTF-8 | 1,360 | 3.59375 | 4 | [
"MIT"
] | permissive | def merge(array, left, mid, right):
leftLength, rightLength = mid - left + 1, right - mid
Left, Right = [], []
for i in range(0, leftLength):
Left.append(array[left + i])
for i in range(0, rightLength):
Right.append(array[mid + 1 + i])
i, j, k = 0, 0, left
while i < l... | true |
25e659c57246a64fb2aff472a28bf7d2acc5eba7 | JingkaiTang/nlp-homework | /homework2/20newsgroups.py | UTF-8 | 1,606 | 2.90625 | 3 | [] | no_license | #! /usr/bin/env python
import os
import sys
import functools
import chardet
from nltk.corpus import stopwords
from sklearn.metrics import classification_report
from sklearn.cross_validation import train_test_split
from naivebayes import NaiveBayesTextClassifier
data_dir = sys.argv[1]
def prepare_file(folder, filena... | true |
d27d454a337d717d85e01fffebe3d9b7dec62b89 | wlach/libroutez | /python/libroutez/osm.py | UTF-8 | 6,001 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# The code in this module was gratuitously stolen from
# graphserver (http://graphserver.sourceforge.net/)
# Copyright (c) 2007, Brandon Martin-Anderson
import xml.sax
import copy
import sys
from math import *
class Node:
def __init__(self, id, lon, lat):
self.id = id
self.lon ... | true |
55b849a199a0b5a413f8a35ae9fc7aaef00ce66e | lizenghui1121/DS_algorithms | /数据结构/二分查找二分搜索/08.转变数组后最接近目标值的数组和.py | UTF-8 | 737 | 3.4375 | 3 | [] | no_license | """
@Author: Li Zenghui
@Date: 2020-08-01 15:25
"""
class Solution:
def findBestValue(self, arr: List[int], target: int) -> int:
left = 0
right = 0
for num in arr:
right = max(num, right)
while left < right:
mid = left + (right - left) // 2
pri... | true |
0ef93267442147e3ae2ec2123d7db37a2a70a0a8 | luisdavi5/tipos-sanguineos- | /sangue.py | UTF-8 | 1,891 | 4.25 | 4 | [] | no_license | print("lista de tipos sanguíneos:")
print(" ")
print("[ A+ ]")
print("[ A- ]")
print("[ B+ ]")
print("[ B- ]")
print("[ AB+ ]")
print("[ AB- ]")
print("[ O+ ]")
print("[ O- ]")
print(" ")
sangue = str(input("qual seu tipo sanguíneo? "))
if sangue == "a+":
print(" ")
print("o t... | true |
0b07d4d1814f0ccb8fa027efd8d99af288be3d3a | c1au6i0/pokerpy | /pokerpy/deck.py | UTF-8 | 3,486 | 3.828125 | 4 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
class Deck:
"""" Deck of cards a Pandas dataframe
A dataframe called cards containing 3 columns, with each row representing a card:
cardNumber : numeric, J, Q, K, Ace are 11, 12, 13, 14
suit : 1, 2, 3, 4, equivalent to clubs, diamonds, hearts, spades.
... | true |
7adae63a1aca0eec154c0283ac721639408a0fb6 | mounatjar/Ejercicios | /Ejercicio_4.py | UTF-8 | 1,648 | 3.703125 | 4 | [] | no_license | class Fraccion():
def __init__(self, numerador, denominador):
self.numerador = numerador
self.denominador = denominador
def get_numerador():
return numerador
def get_denominador():
return denominador
def get_sumar(self,fraccion):
numerador1 = se... | true |
9abc2156561847d29ffad752038f3ac640d058b8 | AndresdPM/Voronoi-tessellation | /voronoi_3d_binning.py | UTF-8 | 18,245 | 3.03125 | 3 | [
"BSD-2-Clause"
] | permissive | """
#####################################################################
Copyright (C) 2001-2016, Michele Cappellari
E-mail: michele.cappellari_at_physics.ox.ac.uk
Updated versions of the software are available from my web page
http://purl.org/cappellari/software
If you have found this software useful for your
rese... | true |
ced08289fe1249c781c4b1ff510d4c509a34495b | franleplant/python-for-javascript-developers | /loops.py | UTF-8 | 1,048 | 4.1875 | 4 | [] | no_license |
# in python you usually use these types of loops
for element in ["first element", "second element", "etc"]:
print(element)
for index, element in enumerate(["first element", "second element", "etc"]):
print(index,element)
elements = ["first element", "second element", "etc"]
for index in range(len(elements)):... | true |
6b3954025fd7adaa8547d721e6e22d5923694ac9 | ginop/name-that-color | /scripts/learn_ntc.py | UTF-8 | 2,614 | 2.953125 | 3 | [] | no_license | import math
import pandas as pd
from tqdm import trange
import os
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout
from name_that_color.name_that_color import ntc
def get_colors(force_reprocess: bool = False):
ntc_object = ntc()
df_filepath = '../colors_categ... | true |
57d7b72ae0c7edaec25203acaa7e72e0141ac970 | ncomly/CS236G_Final_Project | /preprocessing.py | UTF-8 | 4,909 | 2.5625 | 3 | [] | no_license | import face_alignment
from skimage import io, draw
import os
import numpy as np
import matplotlib.pyplot as plt
import time
import tqdm
celebA_dir = 'C:/Users/nacom/Documents/Datasets/CelebA/img_align_celeba/'
dogFace_dir = 'C:/Users/nacom/Documents/Datasets/DogFaceNet/after_4_bis/'
color_map = dict({
('jaw', (0,... | true |
f563d985f59a9007d5ec3c9962d9bff5101387b5 | skynimrod/dt_python | /0.Dev Training/1.Junior/1. Base Demo/3.高级索引(画对角线)/x.py | GB18030 | 536 | 3.078125 | 3 | [] | no_license | # coding=gbk
import scipy.misc
import matplotlib.pyplot
# ͨѶԽϵֵ 0, ʾ˸÷
# Lena
lena = scipy.misc.lena()
xmax = lena.shape[0]
ymax = lena.shape[1]
#
# ѶԽλõֵ0
# x 0-xmax
# y 0-ymax
lena[ range(xmax), range(ymax) ] = 0
# һԽλϵֵ0
# x xmax - 0
# y 0-ymax
lena[ range( xmax-1, -1, -1 ), range( ymax ) ] = 0
# ƶԽ 0 ͼ Len... | true |
27a98574b579e5727459b7744429a535d23c0c6c | hexavi42/Arduino | /serialMulti/arduinoServer.py | UTF-8 | 4,801 | 2.9375 | 3 | [] | no_license | # Flask server code - can set to print posted text or read from news/outlet
import serial
import signal
import json
import os
from flask import Flask, request
# modified http://stackoverflow.com/questions/2281850/
# timeout-function-if-it-takes-too-long-to-finish
# will only work in unix systems
class timeout:
d... | true |
2e45634a90a14bf6710a4790ccbc551aad2faf73 | Accoustium/PyBites | /bite_13/dict_convert.py | UTF-8 | 891 | 2.90625 | 3 | [] | no_license | from collections import namedtuple
from datetime import datetime
import json
blog = dict(name='PyBites',
founders=('Julian', 'Bob'),
started=datetime(year=2016, month=12, day=19),
tags=['Python', 'Code Challenges', 'Learn by Doing'],
location='Spain/Australia',
... | true |
d7d1b378aef94fd6f8352cfd9644b24b34319c57 | suoyuxi/yoloV4 | /yolo_layer.py | UTF-8 | 3,921 | 2.546875 | 3 | [] | no_license | import torch.nn as nn
import torch
'''
decode函数和YOLOLAYER类都是对某个尺度的输出进行解码,比如out1或out2或out3
训练过程中会不经过解码直接把out输出与target进行loss计算,所以参与loss计算的数据没有经过sigmoid的0~1规整
'''
#将输出解码,形式上output[batch_size,A*n_channels,h,w]→[batch_size,A,h,w,n_channels]
def decode(output,num_classes,anchors,num_anchors,scale_xy):
#判断数据位于显存还... | true |
55b1b50d8339f0c77577de4d5bd23552f4daac0f | Kori3a/M-PT1-38-21 | /Lessons/Lesson 05-27/eq.py | UTF-8 | 172 | 3.484375 | 3 | [] | no_license | eq = input("Input your expression:\n")
x_val = int(input("Input the x value:\n"))
parts = eq.replace(' ', '')[2:].split('x')
print(int(parts[0])*x_val + int(parts[1]))
| true |
c55339e9356590cd02d78503d3416bbbe6cd43ed | itachi176/image_compressor- | /test_lzw.py | UTF-8 | 1,827 | 3.296875 | 3 | [
"MIT"
] | permissive | import io
def compress(uncompressed):
"""Compress a string to a list of output symbols."""
# Build the dictionary.
dict_size = 256
dictionary = dict((chr(i), i) for i in range(dict_size))
w = ""
result = []
for c in uncompressed:
wc = w + c
if wc in dictionary:
... | true |
4ee7b85c2cb9f4e945ff3ea153c8c06c85ae7a13 | serenayan/roboticspath | /obstacle_environment.py | UTF-8 | 2,996 | 2.859375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from numpy.linalg import norm
from matplotlib import collections as mc
# Constants I will use testing
RED = np.array([1, 0, 0, 1])
BLUE = np.array([0, 0, 1, 1])
GREEN = np.array([0, 1, 0, 1])
BLACK = np.array([0, 0, 0, 1])
START = (5, 5, 50, 0)
END = (90, 90, 0, 0)
#... | true |
04ae3a379164f4949a52580d8cd0ac7cdb8f1d09 | helpmoeny/pythoncode | /Python_projects/project11/proj11.py | UTF-8 | 6,396 | 3.375 | 3 | [
"Unlicense"
] | permissive | import random
import turtle
import time
from random import choice
from random import randrange
class Fishing(object):
'''Creating fish type object'''
def Fish():
#creating multiple types of object fish types and returning one of them
Fish = ['Whale Shark','Jack','Blacktip Shark','Tarpon','Roost... | true |
03ec4d33eed95f22fc0b9531dea68c13de470851 | apgoetz/HungryGames | /source/darwinAgent.py | UTF-8 | 2,584 | 3.203125 | 3 | [] | no_license | ##Sample code from site.
# blah blah
#
import importlib
import sys
# represents a chromosome object.
class Chromosome:
def __init__(self, p1 = None, p2 = None):
self.alleles = []
def add_allele(self, a):
self.alleles.append(a)
def get_fitness(self, round_number, current... | true |
c2939b436c2190c7d48a1e2649812a5fbf690d53 | gasbarroni8/news_plus | /web/backend/news/utils/mark_list.py | UTF-8 | 433 | 2.78125 | 3 | [
"MIT"
] | permissive | import re
def read_mark():
code_li = []
with open('mark.dat') as file:
text_content = file.read()
res = re.findall(r"\[MARK\]([\s\S]*)\[TIP\]", text_content)[0]
lines = res.split('\n')
lines = lines[1:-1]
for line in lines:
pair = line.split('=')
... | true |
3f9e0e801df8042fab182572ab2caa13e74a9072 | alexras/cse-arcade | /Scripts/PlotUsage.py | UTF-8 | 3,055 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
import os,sys,sqlite3
from boomslang import Line, Plot, Bar, PlotLayout, Utils
from optparse import OptionParser
import datetime
def executeQuery(query, dbFile):
rowIterator = db.execute(query)
return rowIterator
def hourNumToString(hourNum):
if hourNum == 0:
return "12 A... | true |
8fdebc8231c465aa06d1fcb826f485a552e39e3d | sindhupaluri/Python | /2_dim_array.py | UTF-8 | 261 | 3.90625 | 4 | [] | no_license | # Write a program to construct two dimensional array and print the same
lst1 = []
for j in range(1, 4):
lst2 = []
for i in range(1, 6):
lst2.append(i)
lst1.append(lst2)
for k in lst1:
for l in k:
print(l, end=' ')
print()
| true |
b0c98f2a82403e0b06163d0b0b294f5c11be68f0 | rafaelscnunes/hackerrank | /06_PlusMinus/plusminus.py | UTF-8 | 771 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the plusMinus function below.
def plusMinus(arr, precision='{:.6f}'):
negative, positive, zero = 0, 0, 0
for item in arr:
if item < 0:
negative += 1
elif item > 0:
positive += 1
e... | true |
b892f04cd1f2034ce6a35619dde5be9f3a03cc72 | Sergey80/python-samples | /src/fucnctions.py | UTF-8 | 189 | 3.15625 | 3 | [] | no_license | def fun1():
print("hello")
def fun2():
print("hello2")
def fun3(arg1, arg2="123"):
print(str(arg1) + " " + str(arg2))
fun1()
fun2()
fun3("value1")
fun3("value1", "value2")
| true |
a4c5ef9bbe7b11521f5d942fcc533a3ee471475a | anskipper/jupyter-notebooks | /flowmeterAnalysis/rainEvents.py | UTF-8 | 8,903 | 3.0625 | 3 | [
"MIT"
] | permissive | #imports
import math
import datetime as dt
import numpy as np
import pandas as pd
from flowmeterAnalysis import basicMath
from flowmeterAnalysis import readFiles
'''
INPUTS :
* dfDaily: pandas dataframe with daily rain totals over the analysis period
* dfHourly: pandas dataframe with hourly rain totals ove... | true |
693f3437f5df18466f3183dd45d5eb2ed3f213fa | Alexerson/adventofcode | /y2018/day3.py | UTF-8 | 1,490 | 3.65625 | 4 | [] | no_license | import collections
from utils import data_import
# We need to convert the input in something we can work with
def convert_data(data):
out = []
for item in data:
pk, _, position, size = item.split(" ")
pk = pk[1:]
x, y = position[:-1].split(',')
w, h = size.split('x')
o... | true |
84d981b9d59f92031157a490d9eb91de5ea14711 | clk1006/Informatik-kryptographie | /monoalph.py | UTF-8 | 523 | 3.359375 | 3 | [] | no_license | import lib
import sys
alph=input("Bitte das verschlüsselte Alphabet in Kleinbuchstaben angeben: ")
text=input("Bitte Klartext angeben: ")
isEncrypting=bool(int(input("0 => Entschlüsseln; 1=> Verschlüsseln: ")))
alph=lib.purify(lib.uniquify(alph))
if len(alph)!=26:
print("Nicht alle Buchstaben sind im Alphabet entha... | true |
d21c54fa598dddc866c4b980f47dc6737435e61b | LiamMehle/playground | /py/old/base_convert.py | UTF-8 | 1,111 | 3.265625 | 3 | [] | no_license | print('base converter')
num = input('number\n:')
inbase = input('input base\n:')
outbase = input('output base\n:')
print('\n' *5)
import math
b10num = 0
# convert to array
num = num.lower()
temp = []
for k in num:
if k == 'a':
temp.append(10)
continue
if k == 'b':
temp.append(11)
continue
if k == 'c':
te... | true |
b6a593d46fd8286385f1972eb3e4ac040ec04292 | robspringles/learning-sequences | /lstm/lstm-keras/large-lstm.py | UTF-8 | 3,098 | 3.0625 | 3 | [] | no_license |
# Load Larger LSTM network and generate text
from __future__ import print_function
import sys
import numpy
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import LSTM
from keras.callbacks import ModelCheckpoint
from keras.utils import np_utils
# lo... | true |
0ee881b9819771eaad0ce503ea73159eb147732c | sun-ruiheng/snake | /snake.py | UTF-8 | 2,538 | 3.578125 | 4 | [] | no_license | from enum import Enum
class Direction(Enum):
UP = 0
DOWN = 1
LEFT = 2
RIGHT = 3
class Snake():
length = None
direction = None
body = None
block_size = None
color = (230, 230, 255)
bounds = None
def __init__(self, block_size, bounds):
self.block_size = block_size
... | true |
2f8143f40d875a211a05318fd6305b50a1197440 | zhanglianxin/pystudy | /oop_@property.py | UTF-8 | 1,438 | 4.15625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @property 装饰器就是负责把一个方法变成属性调用的
class Student(object):
"""docstring for Student"""
@property
def score(self):
return self._score
@score.setter
def score(self, value):
if not isinstance(value, int):
raise ValueError('score mu... | true |
61dc6577168c15d72949b36f3d44ba5c04c9e82d | Tusharcoder18/Time-Series-Visualizer | /time_series_visualizer.py | UTF-8 | 2,610 | 3.359375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
# Import data (Make sure to parse dates. Consider setting index column to 'date'.)
df = pd.read_csv('fcc-forum-pageviews.csv', parse_dates=True, index_co... | true |
b6f9dad8a231a3f921a61851cd15c3ad4a311b9c | JiaoAlvin/Neuroevolution | /lib/fixed_top_nn.py | UTF-8 | 1,209 | 3.296875 | 3 | [
"MIT"
] | permissive | import numpy as np
class FixedTopologyNeuralNetwork:
class Neuron:
def __init__(self, wages, bias):
self.wages = wages
self.bias = bias
#*
#* layers = list of pairs (number of neurons in layer, activator functions)
#* wages = list/array of floats, concatenat... | true |
baadd8fd7f8c4ce80a15354e5c12b1d495d62a1f | jinghul/viral | /predictor.py | UTF-8 | 7,294 | 2.6875 | 3 | [] | no_license | # encoding=utf-8
import os
import sys
import time
import numpy as np
# For saving trained models
from joblib import dump, load
# sklearn tools
from sklearn.model_selection import KFold
from sklearn.decomposition import PCA
from sklearn.metrics import mean_squared_error
from sklearn.feature_selection import SelectPer... | true |
515390a9c9acc69c1a366a86f009383831490d59 | morteano/IT3708 | /Assignment5/mtsp.py | UTF-8 | 10,526 | 3.140625 | 3 | [] | no_license | import openpyxl as px
import numpy as np
from random import randint, random
import math
import matplotlib.pyplot as plt
import operator
# Global variables
N=60
GENERATIONS=30
CROSSOVER_RATE = 0.6
MUTATION_RATE=0.1
TOURNAMENT_SIZE=50
EPSILON=0.9
# a class containing the cost and distance matrices
class Data:
def ... | true |
b2d01556c90d53dcd034baf81942b7a2fb70b344 | peteyb37/SWEN344REST | /src/db/bechdel_db.py | UTF-8 | 6,977 | 2.765625 | 3 | [] | no_license | import os
import json
from psycopg2.extras import execute_values
import hashlib
import secrets
from .swen344_db_utils import *
def rebuild_tables():
"""Rebuilds tables"""
exec_sql_file('src/db/schema.sql')
def build_movie_table():
"""Builds the movie table and all other tables as well"""
exec_sql_file... | true |
5a2c040425b719acf2c76916e191c2b976fb9292 | chenxu0602/LeetCode | /1837.sum-of-digits-in-base-k.py | UTF-8 | 1,055 | 3.53125 | 4 | [] | no_license | #
# @lc app=leetcode id=1837 lang=python3
#
# [1837] Sum of Digits in Base K
#
# https://leetcode.com/problems/sum-of-digits-in-base-k/description/
#
# algorithms
# Easy (75.24%)
# Likes: 52
# Dislikes: 8
# Total Accepted: 9.5K
# Total Submissions: 12.6K
# Testcase Example: '34\n6'
#
# Given an integer n (in bas... | true |
41af9c04ed83997cf5989a0582ea5b2cedb485f0 | shannon-jia/pg_api | /pg_api/utils/create_log_table.py | UTF-8 | 1,806 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import asyncio
import asyncpg
# import datetime
async def main(dsn='postgresql://postgres:passwd+123@localhost/test'):
# Establish a connection to an existing database named "test"
# as a "postgres" user.
conn = await asyncpg.connect(dsn)
await conn.execute('''
DROP TAB... | true |
5749c542568d585a3cc287c37f51462439461a09 | fotavio16/PycharmProjects | /PythonExercicio/ex046.py | UTF-8 | 123 | 3.046875 | 3 | [
"MIT"
] | permissive | import time
print("ATENÇÃO!! Vai explodir.")
for i in range(10, 0, -1):
print(i)
time.sleep(1)
print("0 BUUUM!") | true |
b098618551650c1f06186910574c7fe324b4fd7b | assisken/avito-hw-3-tests | /tests/test_issue04.py | UTF-8 | 967 | 2.75 | 3 | [] | no_license | import pytest
from lib.one_hot_encoder import fit_transform
@pytest.mark.parametrize(
'given, expect',
[
(
['red', 'red', 'green'],
[
('red', [0, 1]),
('red', [0, 1]),
('green', [1, 0]),
]
),
(
... | true |
4409c3b2ffa0183a19535922f873a2f2ffaace9f | JimmyLamothe/trad | /OLD/trad_srt.py | UTF-8 | 3,072 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Convertit un XML FCP7 en .srt.
Prend deux arguments: input/NOMDUXML - TC
"""
from lxml import etree
import sys
import tc_calc
print('Ne pas oublier de vérifier que le TC est bon avant de travailler sur le document Word.\n')
input_file = sys.argv[1]
tc = "0"
try:
tc = int(sys.argv[2... | true |
112bcc913e87506b347b97453e204b8f3676ee30 | Aniketthani/Python-Tkinter-Tutorial-With-Begginer-Level-Projects | /20plots.py | UTF-8 | 334 | 3.203125 | 3 | [] | no_license | from tkinter import *
import numpy as np
import random
import matplotlib.pyplot as plt
root=Tk()
root.title("Plots")
root.geometry("400x400")
def graph():
house_prices=np.random.normal(200000,25000,5000)
plt.hist(house_prices)
plt.show()
button=Button(root,text="Plot Graph",command=graph)
button.pack()
r... | true |
ecedc2669f6fc413729904a0229423579e12f900 | usvyatsky/azure-functions-durable-python | /samples/fan_out_fan_in_tensorflow/GetImageUrls/__init__.py | UTF-8 | 1,862 | 2.84375 | 3 | [
"MIT"
] | permissive | import json
import os
from azure.cognitiveservices.search.imagesearch import ImageSearchClient
from msrest.authentication import CognitiveServicesCredentials
def _get_cognitive_services_client() -> ImageSearchClient:
"""Get the cognitive service client to run the searches against.
Ensure there is a COGNITIVE... | true |
27280d251df4fcec0b572674553721b023ee039b | hidde/iam-profile-faker | /iam_profile_faker/factory.py | UTF-8 | 8,662 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import json
import random
from faker import Faker
def wrap_metadata_signature(obj, value):
"""Wrap profile value with metadata/signature"""
# Value key varies based on the type of the value
if isinstance(value, dict) or isinstance(value, list):
value_key = 'values'
else:
value_key = ... | true |
0cbd7f77eb2c01e9125f6022db72ff9c26f3305e | bitfree/pp | /arduino-ldr/ldr.py | UTF-8 | 2,319 | 3.3125 | 3 | [
"MIT"
] | permissive | """
ldr.py
Display analog data from Arduino using Python (matplotlib)
Author: Mahesh Venkitachalam
Website: electronut.in
"""
import serial, argparse
from collections import deque
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# plot class
class AnalogPlot:
# constr
def __init__... | true |
174dd90f43abad304fba37c751ac2bae5ff43416 | ayman-elkassas/network-programing-python | /Network Programming/Practical/Compressed/Compressed.py | UTF-8 | 383 | 3.078125 | 3 | [] | no_license | import zlib
import sys
text=open("file.txt","rb").read()
print("Raw size of file is {}".format(sys.getsizeof(text)))
compressed=zlib.compress(text,9)
print("size of compressed data is {}".format(sys.getsizeof(compressed)))
# save=open("compress.txt","ab")
open("compress.txt","wb").write(compressed)
# original=zlib.d... | true |
39e53236f499c25c2db54a2113ec895de3386e4a | Yashinde145/pdf-to-csv | /assignment.py | UTF-8 | 281 | 2.625 | 3 | [] | no_license |
import tabula
dfs = tabula.read_pdf("Enter the filename or path of pdf file", pages='all')
#print(dfs)
tabula.convert_into("Enter the filename or path of pdf file", "Enter the filename or path of csv file", output_format="csv", pages='all/no of specific pages you want')
| true |
da2412d777e04e54e3fae435c1e32376e689d356 | RatserX/minecraft-handicraft | /src/helpers/inspect_helper.py | UTF-8 | 226 | 2.703125 | 3 | [] | no_license | import inspect
class InspectHelper:
def get_function_name(context = 1) -> None:
stack: list[inspect.FrameInfo] = inspect.stack(context)
caller: inspect.FrameInfo = stack[1]
return caller.function
| true |
bc96ac340cda422662789a0002d2083faff96c60 | kanhua/pyCONTIN | /dev/pyCONTIN_demo.py | UTF-8 | 551 | 2.6875 | 3 | [
"MIT"
] | permissive | # ## This example file demonstrates how to use pyCONTIN wrapper
# Load the required packages
import numpy as np
import matplotlib.pyplot as plt
from CONTINWrapper import runCONTINfit
# #### Load example transient file
trans_data = np.loadtxt("demo_input.csv")
# #### Assign template file
template_file = "paramTempl... | true |
c76908374609749508a40434de2c723d10856be1 | dingyiran/mysql_backup_client | /dao/mysql_conn.py | UTF-8 | 1,603 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
class MysqlConn(object):
"""MySQL 数据源的类
Attribute:
engine: sqlalchemy 的引擎
DBSession: sqlalchemy 的session
"""
def __init__(s... | true |
c7d095d170b25b2e272fab794a7e9ffbe059bdc3 | pytutor/python-tutor | /Johannes/alt/Funktionen/2_4 Erstellen und plotten eigener Funktionen/ex_2_4.py | UTF-8 | 420 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 2 10:28:05 2012
@author: johannes
"""
import numpy as np
import matplotlib.pyplot as plt
def sgauss(x,x_0,s):
return 1/(s*np.sqrt(2*np.pi))*np.exp(-(x-x_0)**2/(2*s**2))
def secansh(x,x_0,s):
return 1/(np.pi*s*np.cosh(-(x-x_0)/s))
x_a=0
x_e=30
x_n=3... | true |
a4236220cef2e4415873473372180b7a0b7234ae | clinicalml/finding-decision-heterogeneity-regions | /data_processing/semisynth_dataloader.py | UTF-8 | 14,019 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
DATA_DIR = # PATH TO RECIDIVISM DATA
DEFAULT_CACHE_PATH = # PATH TO CACHE
import pandas as pd
import numpy as np
from scipy.special import logit, expit
import pickle as pkl
from sklearn.linear_model import LogisticRegression
from sklearn import preprocessing
from sklearn import... | true |
9573d27075fc52e152940b252289ad29aa184725 | P79N6A/SiteScan | /lib/info/save2file.py | UTF-8 | 954 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python
# __author__ = 'jasonsheh'
# -*- coding:utf-8 -*-
from setting import user_path
class SaveToFile:
def __init__(self, target, domains, title, fingerprint, dirs):
self.target = target
self.domains = domains
self.title = title
self.fingerprint = fingerprint
... | true |
81f5a36b1d347d7311f2d299e5eb0198007b3c2a | PrashanthCV455/Au893_Spring21_Team3 | /src/assignment3_Team3/src/launch/square.py | UTF-8 | 2,043 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python3
import rospy
from geometry_msgs.msg import Twist
PI= 3.1415926535897
def move():
# Starts a new node
rospy.init_node('square', anonymous=True)
velocity_publisher = rospy.Publisher('/cmd_vel', Twist, queue_size=10)
vel_msg = Twist()
#Receiveing the user's input
print("Let... | true |
6630734e360af45cb9d77a39bf873a85bc0a1955 | PMEAL/OpenPNM | /openpnm/io/_networkx.py | UTF-8 | 6,658 | 3.40625 | 3 | [
"MIT"
] | permissive | import logging
import numpy as np
logger = logging.getLogger(__name__)
def network_from_networkx(G):
r"""
Creates an OpenPNM Network from a undirected NetworkX graph object
Parameters
----------
G : networkx.classes.graph.Graph Object
The NetworkX graph. G should be undirected. The number... | true |
5136c9cabb90cf64f0cee0b0e6500c603c817006 | Itm-dsc-tsw-2020-1/tsw-practica-7-pentesting-de-servicios-http-MaricarmenGGR | /p7_1python.py | UTF-8 | 733 | 3.375 | 3 | [] | no_license | """Desarrollo: Parte 1 - conexión HTTP"""
import requests
import os
import mysql.connector as mysql
# Inicio del código
print ("Python conectándose a MySQL")
# Conectándose a MySQL
conexion = mysql.connect( host='localhost', user= 'root', passwd='', db='compuservi' )
operacion = conexion.cursor()
operacion... | true |
6f4f6e8815fe014c4f7da94d80730744dfb09e9b | JanFalk/Pyg-Latin-0.9 | /PygLatinCode.py | UTF-8 | 659 | 3.71875 | 4 | [] | no_license | def pyg_word(word):
# Convert single word, manage punctuation marks
Satzzeichen = ""
if not word[len(word)-1].isalpha():
Satzzeichen=word[len(word)-1]
word= word[0:len(word)-2]
word = word.lower()
first = word[0]
new_word = word + first + "ay"
new_word = new_word [1:len(new_w... | true |
6877ec6ffca3ea508fc53f120a5d81ac44c579b0 | basti-schr/ColorCrossfader | /ColorCrossfader.py | UTF-8 | 3,827 | 3.109375 | 3 | [] | no_license | import os
import time
import commands
import math
__author__ = 'Basti-Schr'
# Source: https://www.arduino.cc/en/Tutorial/ColorCrossfader
# transformed to Python language for the Raspberry Pi
# Output pins
redPin = 22
grnPin = 17
bluPin = 24
# static values
wait = 0.001 # 10 ms delay
hold = 0 # optional ho... | true |
dfe81889e9a3582ea73b12805988c44d43a9e49c | MouA/lightnovel-crawler | /lncrawl/sources/1ksy.py | UTF-8 | 2,113 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import logging
import re
from bs4 import BeautifulSoup
from lncrawl.core.crawler import Crawler
logger = logging.getLogger(__name__)
ajaxchapter_url = 'https://www.1ksy.com/home/index/ajaxchapter'
class OneKsyCrawler(Crawler):
base_url = [
'https://m.1ksy.com/',
'https://... | true |
469411de75158124d576edd50ad44d5e3b6481d2 | daverblair/CrypticPhenotypeAnalysisScripts | /AuxillaryFunctions/AuxFuncs.py | UTF-8 | 1,936 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy.stats.mstats import mquantiles
from scipy.stats import rankdata,norm,chi2
import pandas as pd
def assign_quantiles(data_frame,property,num_quantiles):
quantile_thresh=mquantiles(data_frame[property],prob=np.linspace(0.0,1.0,num_quantiles+1))
atypical_labels=['1st','2nd','3rd']
... | true |
7b0e48bc63c3eef9744065ff7a7e0eb090947288 | wholmen/Master | /NuclearMatter/PythonScripts/ThermodynamicLimit.py | UTF-8 | 567 | 2.875 | 3 | [] | no_license | from pylab import *
infile = open("../Results/ThermodynamicLimit_Nh14_n0.2.txt",'r')
infile.readline(); infile.readline(); infile.readline(); # Skipping three first lines filled with text
E = []; Ns = [];
for line in infile:
splitline = line.split();
Ns.append( float(splitline[1]))
E.append(float(splitline[-2]))... | true |
d675737bd49b7e72e2408587fc8481b581fdf85a | Pricolno/Crosses_and_Niles | /Crosses_and_Niles.py | UTF-8 | 4,523 | 3.890625 | 4 | [] | no_license | class Crosses_and_Niles:
field = [[' ', ' ', ' '],
[' ', ' ', ' '],
[' ', ' ', ' ']]
player = [-1, -1]
now_move = 0
symbols = ['x', 'o']
winner = 'Игра ещё не закончилась'
def print_field(self):
for line in self.field:
for cell in line:
... | true |
7d1458afdc83fcc79de1ce6b37806778c9f1414a | SaudiWebDev2020/Omaima_Abuzaid | /Assignments/Python/Assignments/user_2.py | UTF-8 | 1,214 | 3.578125 | 4 | [] | no_license | class User :
def __init__ (self, name, email, account_balance):
self.name= name
self.email= email
self.account_balance= account_balance
def make_deposit(self, amount):
self.account_balance += amount
return self
def make_withdrawal (self, amount):
self.accoun... | true |
b55113a69417bbd602806f5334b07ac5d0e6cd87 | eirtscience/marksix | /modules/e_object.py | UTF-8 | 2,271 | 2.84375 | 3 | [] | no_license | from modules.e_datetime import Timer
from time import sleep
import sys
import os
import uuid
class e_object(Timer):
def __init__(self):
super(Timer, self)
self.exec_time = Timer()
self.exec_time.start_time()
def run_time(self):
print("\nExecution time ({} seconds)".format(
... | true |
90c4fd9cbd7a6468de410cf1bf2e358b92966d89 | pkgcore/pkgcore | /src/pkgcore/config/central.py | UTF-8 | 22,115 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | """Collapse multiple config-sources and instantiate from them.
A lot of extra documentation on this is in dev-notes/config.rst.
"""
__all__ = (
"CollapsedConfig",
"ConfigManager",
)
import typing
import warnings
import weakref
from collections import defaultdict, deque, namedtuple
from snakeoil import klass... | true |
49bdf82472f3b8e5fa1329c620ce012207f9a87a | rescenic/Softuni-Python-v2 | /python-fundamentals/02 Data Types and Variables - Exercises/10. Gladiator Expenses.py | UTF-8 | 569 | 3.8125 | 4 | [] | no_license | lost_fights_count = int(input())
helmet_price = float(input())
sword_price = float(input())
shield_price = float(input())
armour_price = float(input())
expenses = 0
shields_count = 0
for fight in range(1, lost_fights_count+1):
if fight % 2 == 0:
expenses += helmet_price
if fight % 3 == 0:
exp... | true |
0852ca76b063608c2d4d4a6f78dc3116fb5f7e72 | PKlimo/CryptoChallenge | /set6/ch41/sollution.py | UTF-8 | 2,943 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3
from __future__ import print_function
debug = True
def invmod(a, b):
from Crypto.Util import number
return number.inverse(a, b)
class RSA:
def generate_keys(self, e):
len = 1024
if debug:
len = 16 # DEBUG
from Crypto.Util import number
... | true |
a6bf8388a39a1fa4809ee9fbac442abd4eb851d0 | alphagov/govuk-taxonomy-supervised-learning | /python/pipeline_functions.py | UTF-8 | 5,806 | 2.859375 | 3 | [] | no_license | '''
Helper functions used in the clean_content.py and clean_taxons.py scripts.
'''
import os.path
import functools
import pandas as pd
import numpy as np
from lxml import etree
import json
from collections import OrderedDict
from pandas.io.json import json_normalize
from lxml import html
def write_csv(dataframe, nam... | true |
0f78ab8c3681dea4c9c16c1034f2473f374601ae | neuromaancer/politeness-detection | /detection/preprocessing.py | UTF-8 | 2,038 | 2.734375 | 3 | [
"MIT"
] | permissive | from typing import List
from convokit import Corpus, download
import pandas as pd
from rich import print
import nltk
from nltk import tokenize
nltk.download("punkt")
def random_pick(
df,
columns=["text", "meta.Normalized Score", "meta.Binary", "meta.parsed"],
num=1250,
):
return df[columns].sample(n=... | true |
e1a882c89e68140116bc5e19a65d64227568fbd1 | digital-carver/tweet-digger | /tweet_digger.py | UTF-8 | 982 | 2.90625 | 3 | [] | no_license | #! /usr/bin/env python
# script to import tweet history via twitter's timeline pagination
import urllib
import simplejson
user = raw_input("User's screen name please: ")
count = 100 # best result
pages = range(3200/count); #Twitter allows retrieving only the last 3200 tweets
f = open(user + '.txt', 'w')
min_id = No... | true |
b001223cc9ed5d4d55c7df48d8d5654c3cb0fbbb | dorian-bucaille/CrewHelp | /detection/main.py | UTF-8 | 6,733 | 2.625 | 3 | [
"MIT"
] | permissive | import cv2 as cv
from visionhsv import Vision
from gamecapture import GameCapture
from time import time
import cons.cst
import gui.qtmap
import gui.qtgui
import threading
# Debugging parameters
detectionscreen = False # Display detection screen
processedscreen = None # Display processed image
hsv_sliders = False # ... | true |
182ee58e6a336de10812dbd82cfff8b15f1c9cf4 | Mrakrok/pithon | /PRG/Graf ze souboru/graf.py | UTF-8 | 1,540 | 3.5 | 4 | [] | no_license |
from tkinter import *
from tkinter import filedialog as fld
from tkinter import messagebox as msb
import pylab
#výběr souboru
def VyberSoubor():
global cesta
cesta=fld.askopenfilename(title="Vyberte soubor")
if cesta!="":
SouborCesta.set(cesta)
#čteni ze souboru a vykreslení grafu
def FceSoubor(... | true |
eac6a9250c07c5045ba400ffc66e639000647eb6 | khaledbnmohamed/LeetCode-BabySteps | /148. Sort List.py | UTF-8 | 1,287 | 3.4375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def sortList(self, head: ListNode) -> ListNode:
if not head: return head
if head.next == None: return head
newHead= ... | true |
f2e2a833f3eaa6f762d0f8ef89038e5e406d79a7 | nickmvincent/reddit_discourse_interference | /score_responses.py | UTF-8 | 2,477 | 3.046875 | 3 | [
"MIT"
] | permissive | """
This script samples some posts for a user test.
"""
import os
import pandas as pd
from sklearn.metrics import classification_report, f1_score, fbeta_score, precision_score, recall_score
from collections import defaultdict
import numpy as np
def main():
"""run"""
# order matters here
subredd... | true |
e9942bf16d7919b2f32efd3d29be963345a97274 | YasaswiPoolla/portal | /trip_project/trip_project/trip_app/management/commands/portaltest.py | UTF-8 | 1,584 | 2.609375 | 3 | [] | no_license | from django.core.management.base import BaseCommand
from trip_project.trip_app.models import User, Trips, Locations
import math
from django.db.models import Count, Sum
class Command(BaseCommand):
help = "Test scripts"
def handle(self, *args, **options):
trips = Trips.objects.filter(trip_distance__isnu... | true |
9177c72c1279908a93bcc059bdd7ebfaee464223 | samkohn/dyb-event-selection | /dyb_analysis/plot_generators/plot_diagnostics.py | UTF-8 | 26,640 | 2.578125 | 3 | [] | no_license | import argparse
from datetime import datetime
import sqlite3
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import gridspec
from scipy.ndimage.filters import uniform_filter1d
import numpy as np
from plot_results import _plot_point_hist
if __name__ == '__main__':
parser = argparse.Argum... | true |
d3a647c8e2db34c0f4398fabfdd546a5fe504cd1 | SCiO-systems/india-rice-production-igc | /project/tests/test_rice_prod.py | UTF-8 | 552 | 2.640625 | 3 | [
"MIT"
] | permissive | '''Test rice goetiffs'''
import gdal
def main():
'''Main'''
rice_tifs = [
'./data/RiceGeotiffs/31360_spam2000v3r7_global_p_ta_rice_a.tif',
'./data/RiceGeotiffs/31360_spam2005v3r2_global_p_ta_rice_a.tif',
'./data/RiceGeotiffs/31360_spam2010v1r0_global_p_ta_rice_a.tif',
]
for ti... | true |
df9a75be91c78f07cef96af809f5a232a173009d | anshulg03/DataScience-with-Python | /My Experiments with NLP/SpaCy/sentiment.py | UTF-8 | 2,218 | 2.859375 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
from sklearn.feature_extraction.stop_words import ENGLISH_STOP_WORDS as stopwords
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics import accuracy_score
from sklearn.base import TransformerMixin
from sklearn.pipeline import Pipeline
from sklearn.svm import Linea... | true |
473c97fbb77675f03877c87a9a8242df8ec71f5d | sundongjian/myself | /socket_io/test1.py | UTF-8 | 3,574 | 3.03125 | 3 | [] | no_license | # tcp_charfinder.py
import sys
import asyncio
# 用于构建索引,提供查询方法
from charfinder import UnicodeNameIndex
CRLF = b'\r\n'
PROMPT = b'?> '
# 实例化UnicodeNameIndex 类,它会使用charfinder_index.pickle 文件
index = UnicodeNameIndex()
async def handle_queries(reader, writer):
# 这个协程要传给asyncio.start_server 函数,接收的两个参数是... | true |
cb7fa6039ead309089af6982a0b68205bda4d47a | jdalton92/trading-bot | /server/assets/tasks.py | UTF-8 | 3,929 | 2.640625 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | import logging
from alpaca_trade_api.entity import Asset as AlpacaAsset
from config import celery_app
from core.alpaca import TradeApiRest
from django.db.utils import IntegrityError
from .models import Asset, AssetClass, Exchange
from .serializers import AssetSerializer, BarSerializer
logger = logging.getLogger(__na... | true |
cae3eff03e664056c689264fc197cd105e0d20b7 | coderlzy/python- | /算法图解/二分查找.py | UTF-8 | 887 | 4.1875 | 4 | [] | no_license | #第一章
#二分查找:从中间开始找,运行时间O(log n),适用于有序的元素列表
#二分查找
import time #我算下时间
def binary_search(list,item):
low=0
high=len(list)-1
while low<=high:
# mid=(low+high)/2 #这样写会报错,因为如果是基数就要取整
# 应该这样
mid = (low + high) // 2 # 自动向下取整
guess = list[mid] # 把中间位置转换成列表
if guess==item:... | true |
36d40bd198dfc59bd40a3c23a3155ab9d1ade963 | iYunghui/MLGame-Pingpong | /pingpong/game/gamecore.py | UTF-8 | 2,822 | 3.015625 | 3 | [] | no_license | import pygame
from essential.game_base import StringEnum
from .gameobject import (
Ball, Platform, PlatformMoveAction
)
display_area_size = (200, 500) # (width, height)
color_1P = (84, 149, 255) # Blue
color_2P = (219, 70, 92) # Red
class GameStatus(StringEnum):
GAME_1P_WIN = "GAME_1P_WIN"
GAME_2P_WIN = "GAME_2P_... | true |
16343ddda0819686efecd15cf31669e7cf8beeb5 | Aasthaengg/IBMdataset | /Python_codes/p02730/s228871183.py | UTF-8 | 141 | 3.515625 | 4 | [] | no_license | s = input()
s1 = s[:len(s) // 2]
s2 = s[:len(s) // 2:-1]
s3 = s[len(s) // 2 + 1:]
if s1 == s2 == s3:
print('Yes')
else:
print('No')
| true |
e4fdfa8524595fa727653b07961d906cebe5f8ce | palaciodaniel/channard_psychosis_inventory | /packages/channard_class.py | UTF-8 | 807 | 3.671875 | 4 | [] | no_license | def channard_gravity(num: int) -> str:
"""
Determines diagnosis' gravity based on the
results from Channard's Psychosis Inventory.
:param num: Sum of Inventory's chosen items.
:return: Diagnosis' gravity.
>>> channard_gravity(21)
"- Moderate psychosis."
>>> depr_beck_gravedad(44)
... | true |
011ad926dc8d1731773380e2828f45af4d97bdc4 | KnightChan/LeetCode-Python | /Palindrome Number.py | UTF-8 | 1,002 | 3.96875 | 4 | [] | no_license | class Solution:
# @return a boolean
def isPalindrome(self, x):
'''
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting the integer to string, note the ... | true |
a1b736536700a99e4dfaebb9944d704f6230bf6c | ChrisTimperley/dockerblade | /src/dockerblade/daemon.py | UTF-8 | 5,309 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
__all__ = ('DockerDaemon',)
from types import TracebackType
from typing import Any, Mapping, Optional, Type
from loguru import logger
import attr
import docker
from .container import Container
@attr.s(frozen=True)
class DockerDaemon:
"""Maintains a connection to a Docker daemon."""
... | true |
67875f088207f839f9fb1191aed13023d74bf1a8 | chunlin11/DetectorDesignSensitivities | /Functions/utils.py | UTF-8 | 8,221 | 3.046875 | 3 | [
"MIT"
] | permissive | import astropy.units as u
import numpy as np
#########Empirical Distributions########
# class used to define a 1D empirical distribution
# based on posterior from another MCMC
class EmpiricalDistribution1D(object):
def __init__(self, param_name, samples, bins):
"""
:param samples: samples for... | true |
b1017cb5cfc142293d3baa570e8420fd50b73f22 | 25Vaishnavibarge17/ticket-booking-system | /initDb.py | UTF-8 | 993 | 2.515625 | 3 | [] | no_license | import pymongo
from config import mongoUri
# Run to generate TTL indexes for your Database
# use only if you are using your own mongodb instance
if __name__=='__main__':
client = pymongo.MongoClient(mongoUri, connectTimeoutMS=50000)
database = client.zomentum
ticketsCollection = database.tickets
moviesColle... | true |
b1df94d09c44187b7adb2680b5557d7a4ed330ea | vardigroup/DPMC | /tensor/src/tensor_network/tensor.py | UTF-8 | 4,820 | 3.171875 | 3 | [
"MIT"
] | permissive | class Tensor:
def __init__(self, base, variables):
self.base = base
self.variables = variables
def duplicate_variable(self, tensor_library, var_index):
"""
Duplicate the provided variable in the tensor.
Note that the duplicated variable is inserted as the first index,
... | true |
7a51376d71b2e4b3053a43efe1f9ae6e7ab366ee | Mitchell-Faas/UU-ProgrammerenInDeWiskunde | /- Game/renderFunctions.py | UTF-8 | 6,822 | 3.109375 | 3 | [] | no_license | import tcod
from enum import Enum
from game_states import GameStates
from menus import inventory_menu
class RenderOrder(Enum):
"""Static data on render order"""
corpse = 1
item = 2
actor = 3
def get_names_under_mouse(mouse, entities, fov_map):
"""Finds the name of whichever entity is located below... | true |
1fe01dbca8bc8ea6f136914b63380cad05cb5013 | VladPronko/Patterns | /structural_patterns/flyweight.py | UTF-8 | 3,800 | 3.5625 | 4 | [] | no_license | from typing import Dict, List
import hashlib
class Flyweight:
'''
Легковес хранит общую часть состояния (также называемую внутренним
состоянием), которая принадлежит нескольким реальным бизнес-объектам.
Легковес принимает оставшуюся часть состояния (внешнее состояние, уникальное
для каждого объект... | true |
7b5aa137ab79b1f766291b61657690b2a1525c08 | RM1708/Oreilly-Learning-TensorFlow | /03__tensorflow_basics/08.Placeholders.py | UTF-8 | 806 | 2.84375 | 3 | [
"MIT"
] | permissive | # coding: utf-8
import tensorflow as tf
import numpy as np
# ### Placeholders
# In[22]:
x_data = np.random.randn(4,3)
w_data = np.random.randn(3,1)
with tf.Graph().as_default():
x = tf.placeholder(tf.float32,shape=(4,3))
w = tf.placeholder(tf.float32,shape=(3,1))
b = tf.fill((4,1),-1.)
xw = tf... | true |
9122f444729cea00cc3221cb742c4af95fffd91f | Hironobu-Kawaguchi/atcoder | /atcoder/abc103_b.py | UTF-8 | 190 | 3.09375 | 3 | [] | no_license | # https://atcoder.jp/contests/abc103/tasks/abc103_b
S = input()
T = input()
n = len(S)
ans = 'No'
for i in range(n):
if S[-i:] + S[:-i] == T:
ans = 'Yes'
print(ans)
| true |
7c80da934f3da0cb2e017977f26adaf8a4ea6bd3 | extend1994/Tools | /hexo/convert-filename.py | UTF-8 | 782 | 3.03125 | 3 | [] | no_license | import os, sys, re
def getTitle(firstLine):
strs = ':'.join(firstLine.split(':')[1:])
strs = strs.replace("'", '')
strs = strs.strip()
title = '-'.join(strs.split(' '))
return title
"""
Get and use "title" field in the .md files to be replace garbled filename
"""
if __name__ == "__main__":
dirName = sys.a... | true |