blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
9ef74f70e4c745e37b3f4f71db31e27d2cb4df84 | Python | nogicoder/sorting-algorithm | /Algorithms/bubble_sort.py | UTF-8 | 380 | 3.609375 | 4 | [] | no_license | n = [23, 9, -8, 7, 3]
n1 = [1, 2, 3, 6, 90]
def bubble_sort(lst):
for t in range(len(lst)):
for i in range(len(lst) - 1):
count = 0
if lst[i + 1] < lst[i]:
lst[i], lst[i + 1] = lst[i + 1], lst[i]
count += 1
if count >= 1:
... | true |
6db58fdc04f3570c16077f0a9e49614e7ac76ba1 | Python | SonjaGrusche/LPTHW | /EX03/ex3.py | UTF-8 | 2,098 | 4.53125 | 5 | [] | no_license | # + "plus" does addition
# - "minus" does subtraction
# / "slash" does division
# * "asterisk" does multiplication
# % "percent" does modulus calculation (divides and displays the remainder)
# < "less-than" says if the number before the character < is smaller than the number behind it by giving the statement "True" or ... | true |
4fa166a889d750377fb3bcb9d0c73a7974d9f50f | Python | jshcrm/wallet | /wallet/accounts/tests.py | UTF-8 | 726 | 2.703125 | 3 | [] | no_license | from django.test import TestCase
from accounts.models import User, Wallet
class WalletTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.user = User.objects.create(username='test')
cls.wallet = Wallet.objects.create(user=cls.user, savings=100.00)
def test_str(self):
assert... | true |
d4e608a9f381e9923091958862a896619d034a28 | Python | wing603/python3 | /02_分支/01_判断年龄.py | UTF-8 | 215 | 3.296875 | 3 | [] | no_license | # 1.定义一个整数变量记录年龄
age = 15
if age >= 18 :
# 3.如果满了18岁可以进网吧
print("可以进网吧")
print("欢迎欢迎")
print("看看执行什么")
# 2.判断是否满了18岁
| true |
fda5d8fb385381fd9915cf11e9eea57164b9e37e | Python | RajaAyyanar/Computational_Intelligence_Optimization | /ArtificialBeeColony.py | UTF-8 | 3,518 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 31 12:46:23 2017
@author: Raja Ayyanar
"""
def Sphere(Colony):
S=Colony*Colony;
ObjVal=sum(S);
return ObjVal
def calculateFitness(fObjV):
import numpy as np
fFitness=np.zeros(np.max(np.shape(fObjV)));
ind=np.nonzero(fObjV>=0);
... | true |
7c4060db4bfa377d4995a4ea6362b57762a45aaa | Python | jonovik/cgptoolbox | /cgp/virtexp/elphys/examples.py | UTF-8 | 16,295 | 2.828125 | 3 | [] | no_license | """
Virtual experiments for cellular electrophysiology.
These protocols assume that the :wiki:`transmembrane potential` is a variable
named *V* in the model. (If the transmembrane potential is named differently,
use the *rename* argument to the
:meth:`~cgp.physmod.cellmlmodel.Cellmlmodel` constructor.)
Man... | true |
2a02fa94187c064e90be7eafd4b4130b4735ccc7 | Python | geniscuadrado/Crafting-Test-Driven-Software-with-Python | /Chapter07/tests/unit/test_persistence.py | UTF-8 | 735 | 2.75 | 3 | [
"MIT"
] | permissive | import os
import json
from contacts import Application
class TestLoading:
def test_load(self):
app = Application()
with open("./contacts.json", "w+") as f:
json.dump({"_contacts": [("NAME SURNAME", "3333")]}, f)
app.load()
assert app._contacts == [
... | true |
51d181d13b1b47fa72e570d24369ef32227994ab | Python | alexandraback/datacollection | /solutions_5708921029263360_0/Python/Aurel/code.py | UTF-8 | 1,171 | 2.6875 | 3 | [] | no_license | import sys
import itertools
import math
import collections
import functools
sys.setrecursionlimit(10000)
def inputInts():
return map(int, raw_input().split())
T = int(raw_input())
for testId in range(T):
J, P, S, K = inputInts()
res = []
pairsJP = {}
pairsJS = {}
pairsPS = {}
for j in x... | true |
a18625a5b2a27998030ba927915d01b98c086ee3 | Python | sharkbound/Python-Projects | /code_wars/Solutions/walk_up_the_stairs.py | UTF-8 | 790 | 3.59375 | 4 | [] | no_license | from unittest import TestCase
def stairs(n):
spaces, segments = ' ' * (n-1), []
for x in range(1, n+1):
left = ' '.join(str(y + 1)[-1] for y in range(x))
segments.append(spaces + left + ' ' + left[::-1])
spaces = spaces[0:-4]
return '\n'.join(segments)
class unittest(TestCase)... | true |
477b321e18ec8e4bab56502fba64c59ca3f9a2f2 | Python | mccdaq/daqhats | /examples/python/mcc134/web_server/web_server.py | UTF-8 | 25,760 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This example demonstrates a simple web server providing visualization of data
from a MCC 134 DAQ HAT device for a single client. It makes use of the Dash
Python framework for web-based interfaces and a plotly graph. To install the
dependencies for this example, run:
... | true |
742a937de2b1dda61387a01636852e81a29c9dbd | Python | chetanchandc/multimodal_dataset_creation | /src/lib/Windows/recording_Window.py | UTF-8 | 10,142 | 2.59375 | 3 | [
"MIT"
] | permissive | import PyQt5
from PyQt5 import QtCore, QtGui, QtWidgets
## class Ui_Recording_Window
# This class contains the recording window design
class Ui_Recording_Window(object):
def setupUi(self, Recording_Window):
Recording_Window.setObjectName("Recording_Window")
Recording_Window.resize(892, 600)
... | true |
530dfb8efc7f39f7f108f134beff733d24fbee82 | Python | pitcons/amarak | /amarak/models/concept.py | UTF-8 | 1,445 | 2.609375 | 3 | [] | no_license | # encoding: utf8
from .labels_manager import LabelsManager
from .manager import Manager
from .link import Link
from .note import Note
from .notes_manager import NotesManager
from amarak.utils import smart_encode, smart_decode
class LinkManager(Manager):
def __init__(self):
super(LinkManager, self).__init... | true |
02036516b14d48db11e3d3bc9feebaa6f632199d | Python | shawnmjones/VisHash | /calc_query_matches.py | UTF-8 | 3,382 | 2.546875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | # ©2020. Triad National Security, LLC. All rights reserved.
# This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S. Department of Energy/National Nuclear Security Administration. All rights in ... | true |
45ba85dc6ca0fe3c8be648bb0cabf4490b19c47a | Python | tyfeeney/truss-structures-numpy | /client.py | UTF-8 | 368 | 2.734375 | 3 | [] | no_license | from project import Truss, Brace, Node
n1 = Node("a",0,1)
n2 = Node("b",1,1)
n3 = Node("c",0,0)
n4 = Node("d",2,0)
b1 = Brace("beam 1",n1,n2)
b2 = Brace("beam 2",n3,n2)
b3 = Brace("beam 3",n3,n4)
b4 = Brace("beam 4",n2,n4)
t = Truss([n1,n2,n3,n4])
answer = t.calculate(upward_force = 1000)
for entry in answer... | true |
1575354ecf771b24836c581581161d85cee7be51 | Python | JoeA42/calculador-de-notas | /Calculo y Registro de Examenes.py | UTF-8 | 1,617 | 3.765625 | 4 | [] | no_license | # se importa la libreria os
import os
# se asgina la variable restart1 para el primer loop
restart1=True
# se abre el primer loop
while restart1!="n":
# se toma el dato de la prueba y se crea un documento de texto con su nombre
prueba = input("Prueba: ")
documento = prueba+'.txt'
datos = os.ope... | true |
085e8d56f86c54f8ce175f657732863abc107c07 | Python | alfonsusenrico/proyekTOS | /server.py | UTF-8 | 3,542 | 2.578125 | 3 | [] | no_license | import eventlet
import socketio
socket = socketio.Server()
app = socketio.WSGIApp(socket)
#list object
users = []
allDevice = []
class Device:
user_id = ''
token = ''
def __init__(self, id, token):
self.user_id = id
self.token = token
class User:
user_id = ''
deviceCount = 0
... | true |
9b10977c371518b365ae8f65bfe2731596e235a1 | Python | 981377660LMT/algorithm-study | /7_graph/bfs求无权图的最短路径/双向BFS两面包夹芝士/1210. 穿过迷宫的最少移动次数.py | UTF-8 | 2,885 | 3.3125 | 3 | [] | no_license | from typing import List
import collections
# 2 <= n <= 100
# 注意状态是(x1,y1,x2,y2)
# 移动时需要分🐍水平还是竖直讨论
class Solution:
def minimumMoves(self, grid: List[List[int]]) -> int:
n = len(grid)
start = (0, 0, 0, 1)
end = (n - 1, n - 2, n - 1, n - 1)
if grid[0][0] == 1 or grid[... | true |
8d49c444bd42cd3901cf8bd33874c49124d7d096 | Python | goru47/INF1L-PRJ-2 | /INF1L-PRJ-2/blit cards.py | UTF-8 | 1,181 | 2.8125 | 3 | [
"MIT"
] | permissive | import pygame
pygame.init()
#window aanmaken
window = pygame.display.set_mode((1000,600))
#window naam instellen
pygame.display.set_caption("blit card")
# icoon toevoegen
gameIcon = pygame.image.load('images/BPicon.png')
pygame.display.set_icon(gameIcon)
# eigenschappen kaart
cardposX = ... | true |
6755c99b1f8198299bc560f8f37218862a2e054f | Python | woutdenolf/spectrocrunch | /spectrocrunch/visualization/colormap.py | UTF-8 | 1,739 | 3.09375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.colors as pltcolors
from ..utils import instance
def NormalizedToRGB(x):
"""
Args:
x(num|array): data values between 0 and 1
Retruns:
r(array):
g(array):
b(array):
"""
x, f = instance.asarrayf(x)
x =... | true |
b24b486a32aef9353879ea6058d21750507a807c | Python | eddie221/TrainingCode_Detection | /function.py | UTF-8 | 2,589 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 11 13:51:59 2021
@author: mmplab603
"""
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
import torch
import math
def draw_bbox(img, bboxes):
plt.figure()
plt.imshow(img)
for bbox in bboxes:
... | true |
33a75acf95f2deda7c3859e201d294e0cc555636 | Python | darthlukan/pysys | /courses/edX/MITx/600x/sqroot_recipe.py | UTF-8 | 1,260 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def test_find_over_zero(find):
if find > 0:
return True
else:
print "We can't find sqroots for integers zero or less."
return False
def get_find(find):
find = input("Which number do we want the sqroot for?: ")
return find
def start_guessing(find, gue... | true |
806cfbcd20cb7536c4c2ac4337421d126ae5a3a0 | Python | vasjuta/HS_HA | /utilities.py | UTF-8 | 600 | 2.671875 | 3 | [] | no_license | import numpy as np
def hamming_score(y_true, y_pred, normalize=True, sample_weight=None):
"""
Compute the Hamming score (aka label-based accuracy) for multi-label case
"""
acc_list = []
for i in range(y_true.shape[0]):
set_true = set(np.where(y_true[i])[0])
set_pred = set(np.where(... | true |
934f685a515269d27eda1f3ca98a71767410d4cd | Python | ankycheng/damages-calculator | /utils.py | UTF-8 | 6,054 | 2.9375 | 3 | [
"MIT"
] | permissive | import pandas as pd
import os, sys, requests
def downloadFile(url, fileName, targetPath):
with open(targetPath+fileName, 'wb') as f:
print("Downloading {}".format(fileName))
response = requests.get(url, stream=True)
total_length = response.headers.get('content-length')
if total_len... | true |
9d961719336f99c91b9d26be253a6a5d2d375f0b | Python | CSBG-LSU/GEXF- | /Absolute_gene_expression/gexf_file_absolute_gene_exp.py | UTF-8 | 1,484 | 2.734375 | 3 | [] | no_license | import pandas as pd
import networkx as nx
import numpy as np
import argparse
import time
def adding_geneexp_absolute_value(inputgexf, geneexp, output):
Graph = nx.read_gexf(inputgexf)
protein_labels = nx.get_node_attributes(Graph, 'ENSP-ID')
node_labels = nx.get_node_attributes(Graph, 'label')
protein_... | true |
428d38ede136ea97941a5b39dc73c18ff762d7a7 | Python | dbarbella/analogy | /nn/keras/bert.py | UTF-8 | 6,327 | 3.015625 | 3 | [] | no_license | import torch
from pytorch_pretrained_bert import BertTokenizer, BertModel, BertForMaskedLM
# OPTIONAL: if you want to have more information on what's happening, activate the logger as follows
import logging
#logging.basicConfig(level=logging.INFO)
import matplotlib.pyplot as plt
def demo_example():
############... | true |
61a49ba8b9889e171a3da90732f138a81616ba87 | Python | Aasthaengg/IBMdataset | /Python_codes/p02267/s839149158.py | UTF-8 | 151 | 3.078125 | 3 | [] | no_license | n = int(input())
s = input().split()
n = int(input())
t = input().split()
count = 0
for a in t:
if a in s:
count += 1
print(count) | true |
04a2a8fcfa5f182704403f84210cd1aa5f06b8fb | Python | xxiaocheng/ZhengFangCaptcha | /run.py | UTF-8 | 907 | 2.765625 | 3 | [] | no_license | import pickle
from network import TwoLayerNet
from data_process import processImg
import numpy as np
def predict(img_path):
'''
img_path: 图片文件路径
----------------
s: 以字符串形式返回验证码
'''
(im1,im2,im3,im4),(a,b,c,d)=processImg(img_path)
with open('params.pickle', 'rb') as f:
params = pi... | true |
5c1bca3e272f8efaec4ff2891038c32a5f942cee | Python | v1ktos/Python_RTU_08_20 | /u2_g1.py | UTF-8 | 814 | 3.59375 | 4 | [
"MIT"
] | permissive | # def replace_dict_value(d, bad_val, good_val):
# for key, value in d.items() :
# if value == bad_val:
# d[key] = good_val
# return d
# my_dict = {'h': 1, 'u': 2, 'b': 5, 'a': 2}
# print(replace_dict_value(my_dict, 2, 7))
# print(my_dict)
# def clean_dict_valuesOR(d: dict, v_list: list) ->... | true |
0b2a5b668d4800c91df201a67253b20de74e3f2e | Python | Fotoon1992/Programming-for-Digital-Media | /inClass/madlibs.py | UTF-8 | 270 | 3.625 | 4 | [] | no_license | import random
#%%
verbs = ["A", "B", "C"]
print(verbs)
#%%
verbs = ["مرحبا"]
print(verbs)
#%%
verbs = ["Hello"]
print(verbs)
#%%
verbs = ["2019"]
print(5+5)
#%%
verbs = ["runs", "jumps", "plays"]
print("The boy " + random.choice(verbs) + " all day long")
#%%
| true |
2a7352a6709249112ca6b29f7e5f758830839700 | Python | shubham14/Deep-Learning-Pytorch | /Reinforcement Learning/actor_critic.py | UTF-8 | 4,766 | 3.0625 | 3 | [] | no_license | import argparse
import gym
import numpy as np
from itertools import count
from collections import namedtuple
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Categorical
parser = argparse.ArgumentParser(descr... | true |
a8cd6d73d06015a91fbc1773600aaa55be1ec881 | Python | jess-monter/Backend-Test-Monter | /backend_test/orders/tests/test_models.py | UTF-8 | 1,166 | 2.75 | 3 | [] | no_license | from django.test import TestCase
from django.contrib.auth.models import User
from backend_test.users.models import Employee
from backend_test.meals.models import Meal
from backend_test.orders.models import Order
class ModelTestCase(TestCase):
"""Test Orders models."""
@classmethod
def setUpTestData(cls):... | true |
c6e63dd46e2990cd1f97bc8bef2bd9d259dbc135 | Python | sonialfajardo/algos | /binary_tree_zigzag.py | UTF-8 | 1,383 | 3.875 | 4 | [] | no_license | class TreeNode(object):
def __init__(self, val):
self.val = val
self.left = None
self.right = None
class TreePrinter:
def zig_zag(self, root):
# Reverse every other result list
if root is None:
return []
stack = []
stack.append(root)
stack.append(None)
results = []
... | true |
6f957b47ef596e21559d711599bd82b879f28d55 | Python | WojciechKoz/MyFirstNeuralNetwork | /ML_introduction/perceptron/test_single_perceptron.py | UTF-8 | 1,166 | 2.90625 | 3 | [] | no_license | from perceptron import Perceptron
from initialization_objects import create_data, prepare_data, create_obj
import numpy as np
import random as rand
import matplotlib.pyplot as plt
def main():
model = Perceptron(0.1, 5)
groups = create_data([(10, 0), (0, 5)], 1)
X_set, Y_set = prepare_data(groups)
... | true |
969609ade1a0cffdce59f718fcba3ee4106f69db | Python | wangmingjun666/OpenCV-CameraCalibration-Example | /01-02_undistort.py | UTF-8 | 2,052 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import cv2 as cv
import numpy as np
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--device", type=int, default=0)
parser.add_argument("--file", type=str, default=None)
parser.add_argument("--width", type=int, def... | true |
95ffeecf39bdf09a7a374272a5a0c34246690147 | Python | fjf3997/python_plane_war | /f_3_创建游戏窗口.py | UTF-8 | 1,096 | 2.8125 | 3 | [] | no_license | import pygame
from plane_sprite import *
pygame.init()
screen = pygame.display.set_mode((480, 700))
# 加载图片
bg = pygame.image.load("./images/background.png")
screen.blit(bg, (0, 0))
hero = pygame.image.load("./images/me1.png")
screen.blit(hero, (180, 500))
# 图片绘制完成之后统一update,显示最终屏幕的结果
pygame.display.update()
clock = p... | true |
55e3d6c5c8dd8790e057273147d31972db4d6edf | Python | ayakamal/S_Python_2 | /Change_Date_Format.py | UTF-8 | 555 | 3.296875 | 3 | [] | no_license | import datetime
import dateutil.parser
# str=dateutil.parser.parse("15/12/2016")
# str = datetime.datetime.strptime('15/12/2016', '%d/%m/%Y').strftime('%Y%m%d')
# str = parse("11-15-2012")
# print(str)
# print(parse(str).strftime('%Y%m%d'))
from dateutil.parser import parse
def change_date_format(*args):
list_dates... | true |
d4088cfe3c579dd3f1627b06c511ca7962a1c9a8 | Python | ahmad27/socialMining | /getTweets.py | UTF-8 | 1,503 | 2.84375 | 3 | [] | no_license | import selenium
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
import time
import json
import sys
# first param is what to search and the second is how many page to scroll
search = sys.argv[1]
numberofpage = sys.argv[2]
# Open twitter with requested search
browser = webdriver.... | true |
4a5d0baef3af639e7a77d45e84d95822a0188eb4 | Python | szonglong/diode-analysis | /dytest_semilog.py | UTF-8 | 3,099 | 2.8125 | 3 | [] | no_license | import pandas as pd
import os
import numpy as np
import matplotlib.pyplot as plt
import Tkinter
import tkFileDialog
############ Settings ##############
jcol=2 #Column to take current. First column is 0
vcol=1 #column to take voltage. Usually @ column
plotxrange=[-8,8]
plotyrange=[10**-5,10**4]
m = 1 ... | true |
89fa09f297ba42121d95af442c23c685380efbef | Python | cbohara/python_exercises | /test_add.py | UTF-8 | 703 | 3.328125 | 3 | [] | no_license | import pytest
from add import add
def test_add_two_matrix_size_two():
matrix1 = [[1, -2], [-3, 4]]
matrix2 = [[2, -1], [0, -1]]
assert add(matrix1, matrix2) == [[3, -3], [-3, 3]]
def test_add_two_matrix_size_three():
matrix1 = [[1, -2, 3], [-4, 5, -6], [7, -8, 9]]
matrix2 = [[1, 1, 0], [1, -2, 3], [-2, 2, -2]]... | true |
cac483380bb7762c473dc58bf94a45235163a0ab | Python | EugeneMondkar/web-crawler | /writer.py | UTF-8 | 905 | 2.796875 | 3 | [] | no_license | # Author: Emily Villalba
# Group 10
# Tracking of Modifications, Refactoring, and Corrections to code:
# DONE (Eugene Mondkar): Removed httplib2 import
# DONE (Eugene Mondkar): Added language parameter to append to csv filename
# DONE (Eugene Mondkar): Removed other unnecessary libraries
# DONE (Eugene Mondkar): Had t... | true |
1848297f66832aacba1c5d6488f1bb83b1c37705 | Python | lbingbing/leetcode | /Algorithms/p115_Distinct_Subsequences/p115_Distinct_Subsequences_testcase_gen.py | UTF-8 | 372 | 2.875 | 3 | [] | no_license | import random
k = 500
n = 20
set1 = [chr(ord('a')+i) for i in range(26)]
for k1 in range(k):
n1 = random.randint(0,n)
l = [random.choice(set1) for i in range(n1)]
t = ''.join(l)
n2 = random.randint(0,n*4)
for i in range(n2):
l.insert(random.randint(0,len(l)),random.choice(set1))
s = '... | true |
b9ec3d3ff7ecbc4b0404f5d78d277c54570e0b32 | Python | irohit7/python | /function and docstring.py | UTF-8 | 828 | 4.28125 | 4 | [] | no_license | """def function():
print("This is function ")
print(function()) """
"""
def sum(a,b):
c = a+b
print(c)
return c
a = int(input())
b = int(input())
sum(a,b) """
"""
def average(a,b):
#doc astring
c = (a+b)/2
print(c)
print(average.__doc__)
average(5,7) """
#calculat... | true |
87c055b87523a7ab55c05458983027bb4b21eadf | Python | victorlorena/DESlib | /deslib/des/des_clustering.py | UTF-8 | 15,255 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | # coding=utf-8
# Author: Rafael Menelau Oliveira e Cruz <rafaelmenelau@gmail.com>
#
# License: BSD 3 clause
import numpy as np
from sklearn.base import ClusterMixin
from sklearn.cluster import KMeans
from deslib.base import BaseDS
from deslib.util.aggregation import majority_voting_rule
from deslib.util.diversity im... | true |
82d8bbadb3ce098f9fd96aabd2063dc6373d593c | Python | DarkJoney/python_examples | /hillel8/1.py | UTF-8 | 959 | 4.34375 | 4 | [] | no_license | """1. Написать функцию `arithmetic`, принимающую 3 аргумента: первые 2 - числа, третий - операция, которая должна быть
произведена над ними. Если третий аргумент +, сложить их; если —, то вычесть; * — умножить; / — разделить (первое на
второе). В остальных случаях вернуть строку `"Неизвестная операция"`.
"""
def arit... | true |
78d6746a6624ff885c80c92f39a432f2a380de88 | Python | jcgwt/manim | /triple-clebsch-graph/triple-clebsch-graph.py | UTF-8 | 5,122 | 3.109375 | 3 | [] | no_license | from manim import *
import numpy as np
# this produces an attractive 3-colouring of 3 copies of the Clebsch graph, producing a 3-coloring of the complete graph on 16 vertices
# in particular, coupled with the standard argument that R(3,3,3) ≤ 17, this shows R(3,3,3) = 17
class TripleClebschGraph(Scene):
def const... | true |
ddddb763ed101f15ba9b809b772e90ca460d93a9 | Python | Yoctol/uttut | /uttut/pipeline/ops/tests/test_add_sos_eos.py | UTF-8 | 1,456 | 2.515625 | 3 | [
"MIT"
] | permissive | import pytest
from ..add_sos_eos import AddSosEos
from ..tokens import START_TOKEN, END_TOKEN
from .common_tests import OperatorTestTemplate, ParamTuple
class TestAddSosEos(OperatorTestTemplate):
params = [
ParamTuple(
['alvin', '喜歡', '吃', '榴槤'],
[1, 2, 3, 4],
['<sos>... | true |
641b6609d493e84ee55f73b908be94ea5d1dd325 | Python | potatoes-never-lie/Algorithm | /2875.py | UTF-8 | 145 | 2.703125 | 3 | [] | no_license | n,m,k=map(int, input().split())
maxVal=0
for i in range(0,k+1):
team=min((n-i)//2, (m-(k-i))//1)
maxVal=max(maxVal, team)
print(maxVal) | true |
a380332a0d51a83b7192513c9db2065d452885fa | Python | blha303/plus7-tools | /get-last-section.py | UTF-8 | 315 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python2.7
import sys
if len(sys.argv) > 1:
split = sys.argv[1].split("/")
if len(split) >= 1 and split[-1]:
print split[-1]
elif len(split) >= 2 and split[-2]:
print split[-2]
else:
sys.stderr.write("Can't split that on slashes")
else:
sys.stderr.write("Can't split nothing")
| true |
e76ae8212da97a2aa7892e206b6ee7f9ea99b195 | Python | 13555785106/PythonPPT-01 | /twisted-intro-master/basic-twisted/log.py | UTF-8 | 708 | 2.796875 | 3 | [
"MIT"
] | permissive | import sys
from twisted.python import log
from twisted.internet import defer
"""This example illustrates some Twisted logging basics."""
log.msg('This will not be logged, we have not installed a logger.')
log.startLogging(sys.stdout)
log.msg('This will be logged.')
log.err('This will be logged as an error.')
def ... | true |
7937050364a8d66531a713307b133f2055f77d5c | Python | kiayria/epam-python-hw | /homework01/task02/tests/test_fibonacci.py | UTF-8 | 751 | 3.078125 | 3 | [] | no_license | from typing import Sequence
import pytest
from fibonacci.fib import check_fibonacci
@pytest.mark.parametrize(
["data", "expected_result"],
[
([], False),
([0], True),
([5], False),
([10], False),
([0, 0], False),
([0, 1], True),
([89, 144], False),
... | true |
ee9a3fa312edc1e415f571f4c36ba58e32ed9097 | Python | LucasArthur94/tccapp | /rooms/tests/test_models.py | UTF-8 | 325 | 2.78125 | 3 | [] | no_license | from django.test import TestCase
from rooms.models import Room
# models test
class RoomTestCase(TestCase):
def test_full_identifier(self):
room = Room.objects.create(block='A', floor='T', identifier='ST')
self.assertTrue(isinstance(room, Room))
self.assertTrue(room.full_identifier() == 'AT-... | true |
46f1b736e05b98a351503c21718c872d97c09af0 | Python | oxhead/CodingYourWay | /src/lt_226.py | UTF-8 | 1,739 | 3.96875 | 4 | [] | no_license | """
https://leetcode.com/problems/invert-binary-tree
Related:
"""
"""
Invert a binary tree.
4
/ \
2 7
/ \ / \
1 3 6 9
to
4
/ \
7 2
/ \ / \
9 6 3 1
Trivia:
This problem was inspired by this original tweet by Max Howell:
Google: 90% of our engineers use the softwar... | true |
d57ae9aa7351efd3bd8387dba3a41c87af46aee6 | Python | allenwind/python-concurrency-demo | /celery_task.py | UTF-8 | 512 | 2.640625 | 3 | [] | no_license | #分布式任务队列Celery
#架构组成
#消息中间人 Broker 任务调度队列
#是一个生产者消费者模式,即主程序将任务放入队列中,而后台职程则会从队列中取出任务并执行
#Redis、RabbitMQ
#任务执行单元 Worker
#执行结果存储 Backend
from celery import Celery
app = Celery('tasks',
broker='amqp://guest@localhost//', #Broker 任务调度队列
backend='redis://localhost:6379/0')
@app.task
def add(... | true |
0a35514167c32445072a9048ecb5be24b08ff3d4 | Python | Kar5799/PyAss3 | /PyAss3Q12.py | UTF-8 | 160 | 3.234375 | 3 | [] | no_license | def myfilter(func, lis):
new_list = []
for element in lis:
if func(element):
new_list.append(element)
return iter(new_list) | true |
ea4f1c1a8ae7baafc22da8e2ed7d62e0ac7e4a82 | Python | hidole/google_python_codes | /reports.py | UTF-8 | 864 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
from reportlab.platypus import SimpleDocTemplate
from reportlab.platypus import Paragraph, Spacer, Table, Image
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib import colors
import os
def get_filedata(detail): #returing a path and list
path = os.getcwd()
path = ... | true |
841c2a379a5a1d83b9d4a3d69681acad8cf6d67f | Python | JaredKorthuis/SeniorDesign | /test_script_algorithm.py | UTF-8 | 787 | 2.59375 | 3 | [] | no_license | from jared_algorithm import TableData
if(TableData(20,6,23,90,60,0,0,0,0,0,0,0,0,0,0,0,97330,0)=='very good'):
print "TEST VERY GOOD PASSED"
else:
print "TEST VERY GOOD FAILED!"
if(TableData(30,5,25,110,70,0,0,0,0,0,0,0,0,0,0,0,97231,0)=='good'):
print "TEST GOOD PASSED"
else:
print ... | true |
9ae1ade199f056b84fadc169bbc8d600e6b2c59a | Python | amirtha4501/Guvi | /Companies/company8.py | UTF-8 | 186 | 2.90625 | 3 | [] | no_license | n = int(input())
arr = list(map(int, input().split()))
if n<=1000000:
mini = min(arr)
maxi = max(arr)
i1 = arr.index(mini)
i2 = arr.index(maxi)
d = abs(i1-i2)
print(d) | true |
e2ddb52dc4222f7a16d97427efdcce7031a3d994 | Python | pabha9/FuzzBizzFibbonacciGame | /swift_nav.py | UTF-8 | 1,406 | 3.84375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 17 13:23:28 2017
@author: A
"""
def fib(n): #generate fibbonacci numbers through recursion
if n < 2:
return n
else:
return fib(n-1) + fib(n-2)
def primeChecker(n): #checking for prime numbers
if n < 2:
return ... | true |
f3661c73b8eee42a8c65d5be335f77df9551dafc | Python | llwsykll/leetCode | /Excel Sheet Column Title/ESCT.py | UTF-8 | 683 | 3.578125 | 4 | [] | no_license | class Solution:
def convertToTitle(self, n: int) -> str:
arr=["A","B","C","D","E","F","G","H","I","J","K","L","M",
"N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
res = ""
while(n>26):
res += arr[n%26-1]
n = int(n/26) if n%26!=0 else int(n/26)-1
... | true |
a30f0134c0b61a8a4d17d8a3330b2985570c21ed | Python | Jartreg/prometheus-https-demo | /scripts/arpspoof/arpspoof_main.py | UTF-8 | 1,982 | 2.59375 | 3 | [] | no_license | import subprocess
import os
command = None
ipAddress = None
ipAddressTwo = None
ipAdressConfirmed = False
ipAdressTwoConfirmed = False
wrongParameterVar = False
def banner():
print(" ___ ____________ _____ __ ")
print(" / _ \ | ___ \ ___ \ / ___| / _|")
pri... | true |
3dde1d8ad8049ca09a4e8c31afe7cfe796812e51 | Python | parnurzeal/boolean_retrieval_search | /src/main/py/boolean_retrieval.py | UTF-8 | 14,570 | 2.578125 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: teerapol.watanavekin
#
# Created: 20/07/2012
# Copyright: (c) teerapol.watanavekin 2012
# Licence: <your licence>
#------------------------------------------------------... | true |
db7a61d356eec3906537c0c35b5f8e14ba945af1 | Python | danheeks/PySim | /SimControls.py | UTF-8 | 4,064 | 2.515625 | 3 | [] | no_license | import wx
import math
class SimControls(wx.Window):
def __init__(self, parent):
wx.Window.__init__(self, parent )
self.toolpath = None
sizer = wx.BoxSizer()
self.play_button = wx.BitmapButton(self, bitmap = wx.Bitmap('bitmaps/play.png'))
self.pause_button = wx.BitmapButton(... | true |
9acd6702f5b358411d5ab902c1f5740b27db647d | Python | alifar76/MAWQ | /src/mawq_miseq_localhost.py | UTF-8 | 19,242 | 2.671875 | 3 | [
"MIT"
] | permissive | """ Added --prefilter_percent_id to pick_open_reference_otus.py on August 28, 2014"""
import os
import commands
import sys
import re
import subprocess
import logging
from datetime import datetime
def input_file_help():
print """
Help me please!!
The input file should be tab-delimited file with .txt extension. T... | true |
0aa388e91a8574d72e57f7fbeda8493834f093e9 | Python | rickharris-dev/hacker-rank | /algorithms/warmup/a_very_big_sum.py | UTF-8 | 153 | 3.25 | 3 | [] | no_license | #!/usr/bin/python
n = int(raw_input().strip())
arr = map(int,raw_input().strip().split(' '))
total = 0
for item in arr:
total += item
print total
| true |
e86a409cfbc250e31b3a5755ee7b40d07e2702c6 | Python | LynRodWS/reckoner | /reckoner/helm/provider.py | UTF-8 | 2,334 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2019 FairwindsOps Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | true |
19f8cf261d0d9243ff9778d9b1203650997f9e53 | Python | hedlesschkn/easy_filter | /scripts/lidarfilter.py | UTF-8 | 958 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
#hello world
#Well done
import numpy as np
class LidarFilter():
def __init__(self, slices):
assert slices > 0
assert slices <= 36
self.slices = slices
self.deg_per_slice = 360 / slices
def data(self, data_array, min, max):
assert(len(data_array)==... | true |
b88bc3c9c8046ca5cbdd896f0ea75869c96621d6 | Python | stoimeniliev/LearnPythonTheHardWay | /game.py | UTF-8 | 1,182 | 3.265625 | 3 | [] | no_license | from random import randint
hero = {'lvl' : 1,
'exp' : 0,
'nextlvl' : 50}
'stats' : {'dmg' : [5, 12]),
'hp' : 100,
}
}
enemy = {'lvl' : 1,
'exp' : 0,
'nextlvl' : 50}
'dmg' : [2, 6]),
'hp' : 30,
}
def lvlup(hero):
while hero['exp'] >= hero['nextlvl']:
hero['lvl'] += 1
he... | true |
840e66eff371450efc370dfe469a6e756a2afc3a | Python | USF-IMARS/imars-etl | /imars_etl/find.py | UTF-8 | 2,500 | 2.609375 | 3 | [] | no_license | import os
import copy
import logging
import sys
from imars_etl.Load.validate_args import validate_args
from imars_etl.util.config_logger import config_logger
def find(
directory,
verbose=0,
**kwargs
):
"""
Lists all files that match from a directory
returns:
-------
filepath_list : s... | true |
0d81ccdcc75006207701db830c3342fba2146085 | Python | mongesan/Atcoder-m0_ngesan-py | /Beginner-Contest/ABC173/ABC173_C.py | UTF-8 | 357 | 2.75 | 3 | [] | no_license | def check(S):
n=0
for ch in S:
if ch=='#':
n+=1
return n
h,w,k=map(int, input().split())
c=[str(input()) for _ in range(h)]
hl=[]
wl=[]
cnt=0
for s in c:
tmp=check(s)
hl.append(tmp)
cnt+=tmp
for i in range(w):
s=str()
for j in range(h):
s+=c[j][i]
wl.appen... | true |
cb4e7b2ae2c5ab0eaac985a14e44b7ddb5783857 | Python | AndreaMartinez0726/Tarea-3 | /Fourier2D.py | UTF-8 | 1,476 | 3.15625 | 3 | [] | no_license | import numpy as np
import matplotlib.pylab as plt
from scipy import ndimage
from scipy import fftpack
#________Punto 1__________
imagen=ndimage.imread("arbol.png")
#________Punto 2__________
Fourier=fftpack.fft2(imagen)
fm= Fourier.real**2+Fourier.imag**2
fm= (fm)**(1./2.)
fm=np.log(fm)
plt.figure()
plt.imshow(fm... | true |
953cef5ee5ebde4b77b0a0520d75073d868a76fd | Python | araghava92/comp-805 | /labs/week3/lab3-py-practive.py | UTF-8 | 4,012 | 4.3125 | 4 | [] | no_license | """
lab3 Python Practice
RAGHAVA ADUSUMILLI
2/13/2018
"""
from functools import reduce
def switch_case(str_list):
"""
Maps strings in the str_list to a new string of same characters, but
the first letter contains the opposite case
str_list: list of strings
Returns: list of original strings with op... | true |
763b9764f674acc077a8858147f787ef8cd29988 | Python | OlivierGaillard/prestige-djangeurope | /inventory/management/commands/update_inventory.py | UTF-8 | 794 | 2.515625 | 3 | [] | no_license | from django.core.management.base import BaseCommand
from django.conf import settings
from inventory.models import Article
class Command(BaseCommand):
"""
The script copy the field 'prix_total' into field 'purchasing_price'
"""
help = 'update english fields of inventory Article'
def handle(self,... | true |
6cfdba8ce1302ecf69127eb8fb5bc4d8269235fc | Python | ArtemZaZ/OldAllPython-projects | /Projects/BadProjects/Johny/Jonny_JoyV01.py | UTF-8 | 1,963 | 2.6875 | 3 | [] | no_license | import RTCjoystic
import time
import threading
class Jonny_Joystic(threading.Thread):
def __init__(self, M):
threading.Thread.__init__(self)
self.Joy=RTCjoystic.Joystick_master()
self.Joy.start()
self.EXIT=False
self.L=0
self.R=0
self.M=M
time.sleep... | true |
40b6a42649a3255d4683840a1b86b118c103cc88 | Python | WMRGL/IdentityCheck | /compare_vcfs.py | UTF-8 | 8,199 | 2.75 | 3 | [] | no_license | """
Script to compare MassArray and WGS intersected VCF results.
Sarah Burns & Chipo Mashayamombe-Wolfgarten 29 Jan 2019
"""
from ruffus import *
import vcf
import pandas as pd
import re
import glob
import os
from datetime import datetime
import argparse
arg_parser = argparse.ArgumentParser(description='Scripts to... | true |
b139806e7cdb5ec9d19dfa7b0a5b10f2238716d4 | Python | jackdewinter/pymarkdown | /test/nested_three/test_markdown_nested_three_block_block_ordered_max.py | UTF-8 | 144,684 | 2.828125 | 3 | [
"MIT"
] | permissive | """
Extra tests.
"""
from test.utils import act_and_assert
import pytest
# pylint: disable=too-many-lines
@pytest.mark.gfm
def test_nested_three_block_max_block_max_ordered_max():
"""
Verify that a nesting of block quote, block quote, ordered list, with
the maximum number of spaces allowed works properly... | true |
afc36460be0a5cea8306f4fea83b333cbc4407b6 | Python | conormccauley1999/CompetitiveProgramming | /Kattis/phonelist.py | UTF-8 | 264 | 3.203125 | 3 | [] | no_license | def c(ps):
ps.sort()
for i in range(1, len(ps)):
if ps[i].startswith(ps[i - 1]): return False
return True
t = int(raw_input())
for x in range(0, t):
n = int(raw_input())
ps = [str(raw_input()) for y in range(0, n)]
print "YES" if c(ps) else "NO" | true |
afdb5fba12ab27ce8bd48f6e08c29d287b5a8be9 | Python | lucidworks/fusion-seed-app | /pipelines.py | UTF-8 | 151 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import sys
#what is the command
command = sys.argv[1];
source = sys.argv[2];
print "Command: ", command;
print "Source: ", source; | true |
75ef322b6a60aad7b304b4436415ca7d6dd4b846 | Python | merantix-momentum/squirrel-core | /test/test_fsspec/test_custom_fs.py | UTF-8 | 1,038 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import fsspec
import pytest
from squirrel.constants import FILESYSTEM, URL, SQUIRREL_BUCKET
from squirrel.fsspec.custom_gcsfs import CustomGCSFileSystem
from squirrel.fsspec.fs import get_fs_from_url
@pytest.fixture
def fs(test_gcs_url: URL) -> FILESYSTEM:
"""Return an instance of custom gcsfs."""
return get... | true |
fcea35f50e5f6c50c476a3c2b59b7ec104ca5cd0 | Python | hongyong3/TIL | /Algorithm/Swea/D3_3282.py | UTF-8 | 796 | 2.96875 | 3 | [] | no_license | import sys
sys.stdin = open("D3_3282_input.txt", "r")
def knapsack(n, k, data):
ans = [[0 for x in range(K + 1)] for x in range(n + 1)]
for i in range(n + 1):
for w in range(K + 1):
if i == 0 or w == 0:
ans[i][w] = 0
elif data[i - 1][0] <= w:
ans[... | true |
eaabf59020384ff56ba32ebb1e28392a4c000114 | Python | caimengyuan/MachineLearning | /HMM/hmm.py | UTF-8 | 3,629 | 3.265625 | 3 | [] | no_license | import numpy as np
from hmmlearn import hmm
states = ["box 1", "box 2", "box 3"] #状态
n_states = len(states)
observations = ["red", "white"] #观测值
n_observation = len(observations)
start_probability = np.array([0.2, 0.4, 0.4]) #初始状态概率向量
transition_probability = np.array([ #状态转移概率矩阵A
[0.5,... | true |
903ed11161736abdc67265a8faa5f9e3c5119e3d | Python | shadrqen/Load-Prediction-Model | /models/model.py | UTF-8 | 4,255 | 3.53125 | 4 | [] | no_license | from models.imports import *
from models.data import data
#filling the empty or NaN fields in all rows
data['Gender'].fillna(data['Gender'].mode()[0], inplace=True)
data['Married'].fillna(data['Married'].mode()[0], inplace=True)
data['Dependents'].fillna(data['Dependents'].mode()[0], inplace=True)
data['Loan_Amount_Te... | true |
a2dc4c7fbc7ab1901d72fc551ae02e6283060dde | Python | Acinate/python | /leetcode/21_merge_two_sorted_arrays.py | UTF-8 | 1,045 | 3.625 | 4 | [] | no_license | import unittest
from datastructures.linked_list import ListNodeUtil
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
if not l1 or not l2:
... | true |
06d90b3df91e31d2022f38ea2099890f5f727a77 | Python | Ashishkapil/python-runs | /kth-smallest-bst/smallest.py | UTF-8 | 1,820 | 3.90625 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.val = data
self.left = None
self.right = None
self.count = 0
class BST:
def __init__(self):
self.root = None
self.stack = []
self.stacktip = None
pass
def insert(self, val):
node = Node(val)
self._find_and_insert(node, self.root)
def _find_and_inser... | true |
24ceb59dd0854bc9ec1db66bfd4db6b7cccf3203 | Python | DanteLore/jira-utils | /tests/mock_slack.py | UTF-8 | 900 | 2.609375 | 3 | [] | no_license | class MockSlack:
def __init__(self, incoming_messages=None, name_lookup=None):
self.incoming_messages = incoming_messages or []
self.outgoing_messages = []
self.uploaded_files = []
self.name_lookup = name_lookup or {}
def read_next_messages_for_channel(self, channel_id):
... | true |
0d23cca7ba20a5e6e9be87543c25c161e80f388c | Python | xujun10110/fulltext_engine | /searcher.py | UTF-8 | 5,472 | 2.953125 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import sys
from search import Search
from content import Content
from collections import Counter
from tokenizer import Tokenizer
import termcolor
NGRAM = 2
DAMPING_SCORE = 10
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) #term color
class Searcher:
def __init__(self):
... | true |
4c34eb71c64c9e3d7863c05f3b697f50b330b23f | Python | kr80865n/Machine-Learning-Projects-Public | /Depth Estimation from 2D Images/Depth Map Prediction from a Single Image using a Multi-Scale Deep Network/train.py | UTF-8 | 2,833 | 2.578125 | 3 | [] | no_license | # For reproducability
import numpy as np
np.random.seed(3)
import keras
from keras.optimizers import SGD, Adam
from nets import get_models
from loss_functions import SIMSE
import matplotlib.pyplot as plt
import os
from PIL import Image
# based on NYUDepth dataset, modified
input_shape = (304,228,3)
output_shape = (63... | true |
e3a1a848846c5932447593a653d32835d60c7879 | Python | MuhamadAinurRofiq/TUGAS-UAS | /Uas/main.py.py | UTF-8 | 1,297 | 3.34375 | 3 | [] | no_license | from Perhitungan.Gaji import gaji
from Perhitungan.Nilai import nilai
from Perhitungan.Pembayaran import pembayaran
from Perhitungan.Kalkulator import kalkulator
import getpass
def login():
print('=+= Login =+=')
user=input('Username : ')
password=getpass.getpass('Password : ')
if user == 'ai... | true |
9b5c71f082060b0639d949b54e73b0a1aaa81bcb | Python | Scalabull/get-tested-covid19 | /src/data_pipeline/csv_preprocessors/cmd_preprocess_csv.py | UTF-8 | 1,897 | 2.546875 | 3 | [
"MIT"
] | permissive | import csv
import importlib
import click
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import reference_constants
import csv_helpers
import maine_preprocessor
import idaho_preprocessor
TARGET_PREPROCESSED_CSV_HEADER = reference_constants.TARGET_PREPROCESSED_CSV_HEADER
OU... | true |
db07db20e570c35d374239abccfb0276fa8e8611 | Python | nmichiels/cifDataset | /cifStreamer/cifDataset.py | UTF-8 | 6,347 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive | """
A specialized dataset loader class for *.cif files.
Support boths a python FlowSightParser and a faster FlowSightParserC implemented in C++.
"""
import builtins
from .dataset import Dataset
import numpy as np
# from .FlowSightParser import FlowSightParser
from .FlowSightParserC import FlowSightParser
from .dataPre... | true |
00656fb457499fde7c9e7bfc708843795df844cd | Python | metabismuth/esalg-week2-tarefa1 | /stack.py | UTF-8 | 485 | 3.59375 | 4 | [] | no_license | class Stack:
def __init__(self):
self.stack = []
def __str__(self):
return str(self.stack)
def receive(self, item):
return self.stack.append(item)
def receive_many(self, items):
for i in items:
self.receive(i)
def give(self, item):
return self.stack.pop(item)
def peek(self):
... | true |
7175b7268b3b81436be791d18502625dd5c4683f | Python | sanand0/orderedattrdict | /tests/test_orderedattrdict.py | UTF-8 | 10,120 | 3.09375 | 3 | [
"MIT"
] | permissive | import os
import json
import yaml
import random
import unittest
from collections import OrderedDict
from orderedattrdict import AttrDict, DefaultAttrDict, CounterAttrDict, Tree
from orderedattrdict.yamlutils import AttrDictYAMLLoader, from_yaml
# In Python 3, chr is unichr
try:
unichr
except NameError:
unichr... | true |
00ac488a687e2d6cbe2b921398ab5afaee0254f2 | Python | SonicXP/alfred-douban-suggest | /douban_movie.py | UTF-8 | 1,128 | 2.65625 | 3 | [] | no_license | import httplib
import urllib
import json
from xml.dom.minidom import Document
params = urllib.urlencode({"q": "{query}"})
conn = httplib.HTTPConnection("movie.douban.com", 80)
conn.request("GET", "/j/subject_suggest?"+params)
response = conn.getresponse()
data = response.read()
conn.close()
dataobj = json.loads(data)... | true |
3b409f9eb862ad6ee36b68cd4ae4ce787faeccf8 | Python | amaljyothicollegeaes/S1-A-JILSE-JACOB-43 | /PYTHON PROGRAMING LAB/17-2-2021/17-02-2021/CO3/Graphics/FindPerimeter.py | UTF-8 | 513 | 3.359375 | 3 | [] | no_license | import circle
from rectangle import *
from Graphics._3D_graphics import cuboid,sphere
a=float(input('Enter length of the rectangle: '))
b=float(input('Enter breadth of the rectangle: '))
perimeter(a,b)
r=float(input('Enter the radius of the circle: '))
circle.circumference(r)
l=float(input('Enter length of the cuboid: ... | true |
13ac50394bab2f4ba249615ee12c9f31c6114253 | Python | cyLeo2018/spider_python | /v27.py | UTF-8 | 114 | 3.21875 | 3 | [] | no_license | import re
hello = u"你好,世界"
pattern = re.compile(r'[\u4e00-\u9fa5]+')
m = pattern.match(hello)
print(m) | true |
8e65f4a167f06129db2bf82b8a40dcd5a6c8fb1f | Python | MaudBoucherit/horse_colic | /src/data_import.py | UTF-8 | 2,215 | 2.953125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# data_import.py
# Maud Boucherit, Jan 2018
#
# This script import the data for the horse colic project
# and deal with the missing data before saving it in data/
#
# Dependencies: argparse, pandas
#
# Usage: python src/data_import.py
# import libraries
import argparse
import pandas as pd
# re... | true |
802f5da634071de172c6263e3fc22902b33bb4ce | Python | shan18/Depth-Estimation-Segmentation | /tensornet/data/processing.py | UTF-8 | 6,720 | 3 | 3 | [
"MIT"
] | permissive | import numpy as np
import torch
import albumentations as A
from albumentations.pytorch import ToTensor
class Transformations:
"""Wrapper class to pass on albumentaions transforms into PyTorch."""
def __init__(
self, resize=(0, 0), padding=(0, 0), crop=(0, 0), horizontal_flip_prob=0.0,
vertica... | true |
c004b0fe1f7ba82c4fea9de23e63c84103fc5455 | Python | nightqiuhua/selenium_webdriver | /轻松自动化---selenium-webdriver(python) (四)/selenium_exercise_8.py | UTF-8 | 353 | 2.921875 | 3 | [] | no_license | from selenium import webdriver
import time
import os
browser = webdriver.Firefox()
path = 'file://'+os.path.abspath('checkbox.html')
browser.get(path)
inputs = browser.find_elements_by_tag_name('input')
for in_put in inputs:
if in_put.get_attribute('type') == 'checkbox':
print('in_put=',in_put)
in_put.click... | true |
de7b5c40651009a6104c8d44292da2cce0354588 | Python | zhangweichina111/RPi-snake | /snake.py | UTF-8 | 7,277 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
import sys
import select
from time import sleep
import termios
import tty
import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306
import Image
import ImageDraw
import ImageFont
import random
import RPi.GPIO as GPIO
import linkList
class apple:
def __ini... | true |
497361e170cfac70ab5a07d105936f26ce4f4f48 | Python | shahineb/aerosols-vertical-profiles | /src/preprocessing/preprocess_modis.py | UTF-8 | 6,036 | 2.6875 | 3 | [] | no_license | import sys
import glob
import numpy as np
import pickle
import matplotlib.pyplot as plt
import xarray as xr
import dask
import netCDF4 as nc
from pprint import pprint
import pandas as pd
from functools import partial
import multiprocessing as mp
def standardise_coords_and_dims_modis(ds):
ds = ds.rename({'Cell_Al... | true |
a967c5b2032e42dc9dc6a1eba651a7d40d9a7741 | Python | BeyondMark/ida-parse-trace-file-helper | /ida_parse_trace_line_helper/trace_line_parser.py | UTF-8 | 1,773 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from ida_parse_trace_line_helper.operand import Operand
from ida_parse_trace_line_helper.trace_line_info import TraceData
class TraceLine:
def __init__(self, trace_line: str):
self.__raw_trace_line = trace_line
self.__data = self.__parse_trace_line_to_list()
def get_c... | true |