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 |
|---|---|---|---|---|---|---|---|---|---|---|
5e2479da6253f890760dbac200a807ce184c62ab | samarjit98/Cat-Breeds | /Breed-Relationship/clustering.py | UTF-8 | 1,292 | 2.75 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy import ndimage
from matplotlib import pyplot as plt
from sklearn.cluster import AgglomerativeClustering
import scipy.cluster.hierarchy as shc
def plot_clustering(X, labels, title=None):
x_min, x_max = np.min(X, axis=0), np.max(X, axis=0)
X = (X - x_min) / (x_max - x_min)
p... | true |
9d9c416345d413629877da183e1e50c6811a0ef2 | WarlonZeng/CS1114-Python | /win.py | UTF-8 | 372 | 3.265625 | 3 | [] | no_license | def didHeWin(sameLength, userName):
if sameLength == 1:
heWon = 1
elif userName == '''Python''':
heWon = 1
else:
heWon = 0
if heWon == 1:
print('''YAG!''')
print('''You won a marble!''')
else:
print('''YAG!''')
print('''You were off by ''' + str(le... | true |
12c6df51e11ba9dfbd3df8ea4801e50c65e23471 | scpiantadosi/NAPE_imaging_analysis | /napeca/main_parallel.py | UTF-8 | 6,274 | 2.984375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
"""
Finds any .tif, .tiff, .h5 files in the requested directory and performs SIMA-based motion correction and fft-based bidirection
offset correction, signal extraction, and neuropil correction. This code parallelizes the computation at the session level
by passing the multiple ... | true |
d5a0a5ef1ef355bb9124dca1ccd342f534afb430 | mateuszwwwrobel/Problem-Solving-With-Algorithms-And-Data-Structures-Using-Python-by-B.-Miller-and-D.-Ranum | /Chapter6/parse_tree.py | UTF-8 | 3,889 | 3.546875 | 4 | [] | no_license | import operator
class BinaryTree:
def __init__(self, rootObj):
self.key = rootObj
self.leftChild = None
self.rightChild = None
def insertLeft(self, NewNode):
if self.leftChild == None:
self.leftChild = BinaryTree(NewNode)
else:
t = BinaryTree(New... | true |
b1e42ee1cb073a4ae66944a43de8e3fb450cadd0 | PacktPublishing/Deep-Reinforcement-Learning-Hands-On-Second-Edition | /Chapter02/01_agent_anatomy.py | UTF-8 | 960 | 3.734375 | 4 | [
"MIT"
] | permissive | import random
from typing import List
class Environment:
def __init__(self):
self.steps_left = 10
def get_observation(self) -> List[float]:
return [0.0, 0.0, 0.0]
def get_actions(self) -> List[int]:
return [0, 1]
def is_done(self) -> bool:
return self.steps_left == 0... | true |
aee321f52226122b846574cbc615f93312fc72d2 | amvtek/SqlMake | /sqlmake/__main__.py | UTF-8 | 2,768 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
sqlmake.__main__
~~~~~~~~~~~~~~~~
command line tool that builds a complete SQL database schema
from a set of files contained in a folder.
the tool outputs SQL instructions :
* after sorting out declared dependencies
* after renaming... | true |
478bf17a3a64b42c9b149902c466b2fa9119111a | michael84/learn-python-the-notes | /jlpy/basic03-set.py | UTF-8 | 937 | 3.9375 | 4 | [] | no_license | #!/usr/bin/env python
# coding:utf-8
# Author: Wei Tong
from jlpy_utils import title, sub_title
title("set")
# set就是去重的,无序的。 直接把一个list或者tuple给set。
s_a = set([1, 2, 2, 3, 4, 5, 6])
s_b = set([4, 5, 6, 7, 8, 9])
print(s_a)
print(s_b)
# 判断元素是否存在
print(5 in s_a)
print(0 in s_b)
# 并集
print(s_a | s_b) # 或操作, 并集
print(s_... | true |
3d5000c123cb956fa371a23b24dee6d807a979b9 | sprestrelski/Spero-Image-Classifier-2020-2021 | /CompiledAlgorithms/DeD_enumeration.py | UTF-8 | 3,864 | 3.140625 | 3 | [] | no_license | import numpy as np
from tqdm import tqdm
import sys
import math
from scipy.spatial.distance import mahalanobis
#from sklearn.datasets.samples_generator import make_blobs
class DeD_Enumerator():
def __init__(self, data):
self.randomize = True
# data is a numpy array
self.data = np.copy(data... | true |
faddc43dabca34f1b810b0a24747d631a3edf28d | AdamZhouSE/pythonHomework | /Code/CodeRecords/2502/60706/281273.py | UTF-8 | 132 | 2.765625 | 3 | [] | no_license | n=int(input())
a=[]
for i in range(n):
a.append(int(input()))
ans=0
for i in range(1,n):
ans=ans+max(a[i],a[i-1])
print(ans) | true |
e983681aca0c340e7049aab72d66fd7552090f9d | Aasthaengg/IBMdataset | /Python_codes/p03761/s953854142.py | UTF-8 | 473 | 3.375 | 3 | [] | no_license | n = int(input())
for i in range(n):
s = input()
dic = {chr(c): 0 for c in range(ord('a'), ord('z') + 1)}
for c in s:
dic[c] += 1
# 最初の1周
if i == 0:
ans = {chr(c): 0 for c in range(ord('a'), ord('z') + 1)}
for k, v in dic.items():
ans[k] = v
# 以外
else:
... | true |
2b3962038666deb311714de6d4ccb5a47c620dc5 | webargus/LabProg | /GraphSearch.py | UTF-8 | 5,358 | 3.71875 | 4 | [] | no_license | """
recursive_dfs(g, u):
rotule u como visitado
para toda aresta de u até v, faça:
se o vértice v não estiver rotulado como visitado, então:
recursive_dfs(g, v)
interactive_dfs(g, origin):
be S a stack
s.pile(origin)
while s is not empty:
v = s.pop()
if v is not... | true |
3127184cd890ca469821db26112bf5170b3365d6 | mazinma/algorithms_python | /p31_shell_sort.py | UTF-8 | 1,816 | 4.375 | 4 | [] | no_license | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# __author__ = Allen
"""
原理:插入排序的改进版,先按一定间隔分组,每组插入排序,然后缩小间隔继续,直至间隔大小为1;
"""
def shell_sort(array):
gap = len(array) // 2
while gap > 0:
for i in range(gap, len(array)):
for j in range(i, 0, -gap):
if array[j] < array[j - gap... | true |
d75632c32720e98924bc1bbe6201e078b20caf23 | jsphon/colony | /examples/node/persistent_node_async_example.py | UTF-8 | 978 | 2.6875 | 3 | [] | no_license | from multiprocessing import Process
from colony.node import AsyncWorker
from colony.node import PersistentNode
from colony.utils.random_name import random_name
def get_data():
return 'data'
if __name__ == '__main__':
name = random_name()
persistent_node = PersistentNode(target_func=get_data,
... | true |
14f2ac827f9e1bbab5401d999c542bffd79b58ce | emerson-escolar/mapper_tutorial | /mapperutils/mapperutils/visualization.py | UTF-8 | 1,879 | 2.671875 | 3 | [] | no_license | import matplotlib.colors
import matplotlib.pyplot as plt
import matplotlib.cm as cmx
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
"""
Helpful(?) scripts to do plotting
"""
def scatter3d(X, lens, colorsMap='jet_r', show=True, colorbar=True, fig=None):
# Derived from https://stackoverflow.com/a/2717... | true |
12a7da2b3332e10ffd87ff76ba3a2125060083ef | wanggao1990/PythonProjects | /= Fishc bbs/43 魔法方法 算术运算2.py | UTF-8 | 2,213 | 4.03125 | 4 | [] | no_license |
# int()、float()、str()、len()、tuple()、list() 等函数调用时,就创建一个相应的实例
####### 算术运算符
##
## __add__(self, other) 定义加法的行为:+
## __sub__(self, other) 定义减法的行为:-
## __mul__(self, other) 定义乘法的行为:*
## __truediv__(self, other) 定义真除法的行为:/
## __floordiv__(self, other) 定义整数除法的行为://
## __mod__(self, other) 定... | true |
8d13a7aa11c253bf143d07ca8a8d9369d3956b96 | leoneong/fyp | /random_forest/backtesting.py | UTF-8 | 7,018 | 2.9375 | 3 | [] | no_license | import numpy as np
import investpy
import talib
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn import svm
def get_stock_data(a):
df = investpy.get_stock_historical_data(stock= a,
coun... | true |
80abb8a2a8088973a5c0784562abba6a5d072165 | iamashu/Data-Camp-exercise-PythonTrack | /part9-Manipulating-DataFrames-with-pandas/No35-Applying-drop_duplicates.py | UTF-8 | 1,431 | 3.953125 | 4 | [] | no_license | #Applying .drop_duplicates()
'''
What could be the difference between the 'Event_gender' and 'Gender' columns? You should be able to evaluate your guess by looking at the unique values of the pairs (Event_gender, Gender) in the data. In particular, you should not see something like (Event_gender='M', Gender='Women'). H... | true |
d4d5c30e12b1569dd42cdf400cab8da2658c085e | alex-precosky/IoT_HomeSensor_Dashboard | /populate_test_db.py | UTF-8 | 953 | 2.734375 | 3 | [] | no_license | import MySQLdb as mdb
from datetime import datetime,timedelta
import math
mysql_host = "localhost"
mysql_user = "precosky_fridge"
mysql_passwd = "fridge"
mysql_db = "fridge_db"
def perdelta(start, end, delta):
curr = start
while curr < end:
yield curr
curr += delta
if __n... | true |
9b956363e4ec27ac84bce2fdddaadbafd72c7f77 | ashishsubedi/algorithm_labs | /Lab5/algorithm.py | UTF-8 | 1,099 | 2.8125 | 3 | [] | no_license | import numpy as np
import networkx as nx
def num_nodes(G):
return len(nx.nodes(G))
def num_edges(G):
return len(nx.edges(G))
def density(G):
e = num_edges(G)
v = num_nodes(G)
d = (2*e)/(v*(v-1))
return d
def degree(G,v):
return len(G.adj[v])
def avg_degree(G):
count = 0
for v in... | true |
10206a9641ed2d0d636de15ee4e21588d1f022bd | BenGfoyle/Stats-DataAnalysisEP404 | /leastsq.py | UTF-8 | 2,961 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
leastsq: linear least squares fitting (based on 'fit' from Press et al.)
set 'mwt' to zero if uncertainties in y values not available
set 'mwt' to one if errors in y are available (can be unequal)
Created on Fri Jan 11 14:45:46 2019
@author: mfc
"""
import numpy as n... | true |
18517f0afed68988859f02ca8b0f344355140c04 | prusswan/kml_viewer | /Scripts/kml_repair.py | UTF-8 | 7,066 | 2.609375 | 3 | [] | no_license | from fastkml.kml import KML
from shapely.geometry import LineString, MultiLineString, mapping, shape
try:
from arcpy import AddMessage
except:
pass
# system modules, no need to install
import os
import sys
import shutil
import httplib
import urllib
import csv
import json
from math import... | true |
1c1912538c142c82e268b829cb772af6c8b88915 | HarishK501/100-days-of-coding | /longest-subarray-given-sum.py | UTF-8 | 1,241 | 3.890625 | 4 | [] | no_license | # naive approach - O(n^2)
def maxLengthSubarrayNaive(A, k):
length = end = 0
for i in range(len(A)):
sum = 0
for j in range(i, len(A)):
sum += A[j]
if sum == k:
if length < j - i + 1:
length = j - i + 1
end = j
p... | true |
48b149b950015e44ba9d68098b38b2a68b3870cd | daisysj/EC601-Mini-Project-3 | /transform.py | UTF-8 | 574 | 2.59375 | 3 | [] | no_license | from os import listdir, stat
from sys import argv
from scipy.io.wavfile import read
import matplotlib.pyplot as plt
def transform(n):
dirs = listdir('./audio/')
files = []
for file in dirs:
files.append(file)
chosenfile = "./audio/" + files[n]
print(chosenfile)
input_data = read(chosen... | true |
780480f874ca35b57e3bc0c05b9845718275ebac | zhangxingxian/Python-One-Phase | /onephase/运算符与表达式.py | UTF-8 | 486 | 4.09375 | 4 | [] | no_license | # 位运算
print(5 & 7)
print(5 | 7)
print(5 ^ 7)
print(~5)
print(2 << 2)
print(-13 >> 2)
# 逻辑运算
num1 = 10
num2 = 20
if num1 and num2:
print("*")
print(num1, num2)
# 短路原则
# exp1 and exp2 and exp3 and ... and expn
num3 = 0
num4 = 1
if num3 or num4:
print("**")
if not 0:
print("***")
# 成员运算符
#in:如果在指定的序列中没有找到值返回Tru... | true |
c927cc07632bb2a17e9bfc0f0f671c75ff3706c2 | michaelneururer/leetcode_solutions | /prob_7_reverse_integer_easy.py | UTF-8 | 236 | 3.09375 | 3 | [] | no_license | import math
def reverse(x: int) -> int:
sign = 2*int(x>0)-1
x = str(abs(x))
ans = sign*int(''.join([x[i] for i in range(len(x)-1,-1,-1)]))
if ans < -2**31 or ans > 2**31-1:
return 0
else:
return ans
| true |
415cb211f3562557f7c27ecd7c31e850e598d636 | cedricfarinazzo/password | /test/db/config.py | UTF-8 | 1,392 | 2.65625 | 3 | [
"MIT"
] | permissive | import os
import unittest
from password.db.config import *
class TestConfig(unittest.TestCase):
def setUp(self):
self.conf = Config()
def test_init(self):
self.assertIsNotNone(self.conf)
self.assertEqual(len(self.conf), 0)
def test_set(self):
self.conf.clean()
se... | true |
2f0778e81adf6e8f11851e8dd18ddb17472c3518 | EriKWDev/Programmeringsfredag | /Erik/Python/Random/findPi.py | UTF-8 | 339 | 3.4375 | 3 | [] | no_license | pi = 3.14159265358979
def count_correct_digits(n):
c = 0
i = 0
s_pi = str(pi)
for s in str(n):
if s == s_pi[i]:
c += 1
else:
return c
i += 1
return c
for i in range(3, 3000):
for j in range(1, int(i/2.5)):
d = count_correct_digits(i/j)
if d >= 8:
print("Correct decimals: {}, {}/{} = {}".forma... | true |
4b9d6e6d4b3a0cddc7dbd673101f26e1a31fa22c | emu1200tra/python-challenge-practice | /Q14.py | UTF-8 | 2,010 | 2.921875 | 3 | [] | no_license | import sys
from PIL import Image
from time import sleep
image = Image.open('wire.png')
result = Image.new('RGB' , (100 , 100))
(a , b) = image.size
flag = 0
max_counter = 99
counter = 1
first = 1
counter2 = 0
place = [0 , 0]
for i in range(0 , a):
tmp = image.getpixel((i , 0))
if first == 1:
... | true |
7b31141d19d16a84041111164467089bf0674f53 | 1azy/practice | /给一句英语,把首字母变大写/demo.py | UTF-8 | 918 | 4.1875 | 4 | [] | no_license | '''
给出一个句子,把首字母变成大写
'''
import string
def translate(s):
ss = list(s)
i = 0
while i < len(ss):
if i == 0:
ss[i] = str.upper(ss[i])
else:
if ss[i-1] == ' ' or (ss[i-1].isalpha() == False and ss[i-1] != '\' '):
ss[i] = str.upper(ss[i])
i = i + 1... | true |
c74f346a0167dbabf3f9a5b75bcef9ae0cce591a | swagner648/rainbownum | /rainbownum/RainbowSim.py | UTF-8 | 5,669 | 3.0625 | 3 | [
"MIT"
] | permissive | from .LinkedLists import SetLinkedList
from .LinkedLists import ColoringLinkedList
import time
class RainbowSim:
def __init__(self, n, a, b, mod):
if type(n) is not int or n < 1:
raise TypeError("Scalar n must be an integer greater than or equal to 1")
self.n = n
for i in a:
... | true |
9d1762fae2d3f2ceacb6a5257513d9d4e587fe59 | lizeyan/snippets | /tests/modules/test_mlp.py | UTF-8 | 401 | 2.5625 | 3 | [
"MIT"
] | permissive | import unittest
import torch
import torch.distributions as dist
import torch.nn as nn
from snippets.modules import MLP
class TestMLP(unittest.TestCase):
def test_mlp_shape(self):
features = (37, 31, 23, 11, 5, 2)
x = torch.randn(11, 5, 37)
mlp = MLP(features, activation_class=nn.LeakyReL... | true |
dbcba238d2496a33c46187dcd09ff972a0a3ddc1 | DualVission/dv_yaml_logic_converter | /class_creator/class_ms.py | UTF-8 | 4,767 | 2.609375 | 3 | [] | no_license | import yaml
from collections import OrderedDict
from scripts import andOr
class YamlOrderedDictLoader(yaml.SafeLoader):
pass
YamlOrderedDictLoader.add_constructor(
yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
lambda loader, node: OrderedDict(loader.construct_pairs(node))
)
class groupObj:
def __init__(sel... | true |
cf510c262ff519304159352e407bc240056b6cdf | mptich/prokaryote_genome | /hier_classify_genome.py | UTF-8 | 4,030 | 2.609375 | 3 | [] | no_license | # CURRENTLY UNUSED
# Place a genome (identified by its directory name) into a Taxonomy
# Classification tree, based on the hierarchical algorithm: average
# COG distances for domain, phylum, etc.
import sys
from taxonomy import *
from collections import defaultdict as DefDict
import common_cogs_method as ccm
from shar... | true |
1987fbc643155c1a94cab437b221e2653c72c16f | vikashtank/uav-design-system | /uav_design_system/aerodynamics/xfoil/xfoil.py | UTF-8 | 6,304 | 2.796875 | 3 | [] | no_license | """
Xfoil API
"""
import sys
import os
from ...common import Process, Runner
import time
import tempfile
import shutil
from .results import XfoilResults
from pathlib import Path
class XfoilRunner():
"""
class for running xfoil through python
"""
def __init__(self, xfoil_file_path):
"""
... | true |
65698bfc7c38d49af893b0afb867aa45dbe286e3 | sarvesh4you/Python-Disk-Space-Utilitiy_DU_Command | /src/main/disk_space_utility.py | UTF-8 | 10,427 | 3.25 | 3 | [] | no_license | '''
Created on 27-Sep-2018
@author: sarveshshrivastava
'''
import sys, os, math
from datetime import datetime
from functools import lru_cache
class DiskSpaceUtility(object):
'''
**To run this utility just pass an absolute path of a directory or filesystem through command-line argument
or ... | true |
4e226e4548b3332fbe3a712cab33df2f16a9b30e | Crisescode/leetcode | /Python/String/796. rotate_string.py | UTF-8 | 674 | 4.0625 | 4 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# https://leetcode-cn.com/problems/rotate-string/
# Given two strings s and goal, return true if and only if s can become
# goal after some number of shifts on s.
#
"""
Example 1:
Input: s = "abcde", goal = "cdeab"
Output: true
Example 2:
Input: s = "abcde"... | true |
36d1284d9370ebc75443d48e90f4d16374be5082 | DeepSpider/Content-filtering | /Content-filtering-flask/hddUsage.py | UTF-8 | 475 | 2.84375 | 3 | [
"MIT"
] | permissive | import ctypes
import os
import platform
def get_free_space_mb(dirname):
"""Return folder/drive free space (in megabytes)."""
if platform.system() == 'Windows':
free_bytes = ctypes.c_ulonglong(0)
ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(dirname), None, None, ctypes.pointer(fr... | true |
6de116514c23bd01896a7e5d01d2d41463f45a30 | concalahan/parallel-computing-ai | /parse/parser_raw.py | UTF-8 | 1,571 | 2.6875 | 3 | [] | no_license | # encoding=utf8
from html.parser import HTMLParser
from bs4 import BeautifulSoup
from urllib.request import urlopen
from urllib.error import URLError, HTTPError
from urllib import parse
import sys
import os, os.path
import urllib
sys.path.append(os.path.realpath('..'))
# save to this directory
READ_DIR = '../data/ur... | true |
7c42fb28d7fd5c247aa870cc0a983948638d3bb4 | theodoresi/leetcode_solutions | /python_version/645_set_mismatch/set_mismatch.py | UTF-8 | 1,381 | 3.53125 | 4 | [] | no_license | from typing import List
import pytest
class Solution:
def findErrorNums(self, nums: List[int]) -> List[int]:
# O(N), O(N)
max_number = len(nums)
num_occurance = {num: 0 for num in range(1, max_number+1)}
for num in nums:
num_occurance[num] += 1
result = {}
... | true |
d3fb352fe0630924e1c101183becf0df566edcbf | Vishwa07dev/multiprocessing | /MultiProcessingMerge.py | UTF-8 | 1,200 | 3.484375 | 3 | [] | no_license | import multiprocessing
import random
import time
def merge(arr,l,m,r):
size1 = m-l+1
size2 = r-m
L = arr[l:m+1]
R = arr[m:r]
i = 0
j = 0
k = l
while i < size1 and j < size2:
if L[i] <= R[j]:
arr[k] = L[i]
i += 1
else:
arr[k] = R[j]
... | true |
5a49677580305fc247c7887f6897b0232dd00cbe | DanielDworakowski/flot | /workspace/agents/NNHeuristicCollisionAvoidanceAgent.py | UTF-8 | 5,594 | 2.53125 | 3 | [] | no_license | import os
import torch
import numpy as np
from debug import *
import AgentBase as base
from Actions import Action
import Observations as obv
from torchvision import transforms
from torch.autograd import Variable
#
# Neural network agent class.
class Agent(base.AgentBase):
#
# Constructor.
def __init__(self,... | true |
dbf4c1d1061d8534c1a29cb9c80aee3d40423464 | MarkHofstetter/python-2020-10-27 | /023-qt/qt-demo.py | UTF-8 | 1,269 | 3.03125 | 3 | [] | no_license | import sys
from PySide2.QtWidgets import *
# import (QApplication, QLabel, QPushButton, QVBoxLayout, QWidget)
from PySide2.QtCore import Slot, Qt
class DemoWidget(QWidget):
def __init__(self):
QWidget.__init__(self)
self.textlabel = QLabel("Start Text")
self.text2change = QLabel(""... | true |
033296d268b3e12db74af8b62f48b162aafddc12 | tereninsv/Python | /lesson1.py | UTF-8 | 2,419 | 4.03125 | 4 | [] | no_license | print('Задание-1\n')
# Взять любую последовательность символов Юникода
# Написать функцию, которая принимает строку
# которая состоит только из английских букв и цифр
# и возвращает закодированное этой последовательностью
# что-то
def pool(start, end):
start = int(start, 16)
end = int(end, 16)
pool = []
... | true |
6f6308f5e7cc8ad712f40e6c4a42a6e5a706d93d | rishabhdutta/nonplanar_gorkha | /additional_scripts/geompars/Gorkhamakemesh.py | UTF-8 | 14,170 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import numpy as np
import math
from scipy.integrate import quad
from scipy.optimize import leastsq
def findpoint(p1,p2,somep):
x1 = p1[0]
y1 = p1[1]
x2 = p2[0]
y2 = p2[1]
distsq = (x2-x1)**2+(y2-y1)**2
scale = 2/np.sqrt(distsq)
divpt = (y2-y1)/(x2-x1)
angr... | true |
ec77153cda5686943b2f83d8c08684a92af65a8d | vlad0-0/lab3 | /task4.py | UTF-8 | 61 | 3.640625 | 4 | [] | no_license | x = float(input("Введите x: "))
print(3*x**6+6*x*x-7)
| true |
4cfcb8370c511cc625a0adabe2e0c8a30c7ed235 | shariarriday/Sudoku-Solver-Thesis | /brute_force.py | UTF-8 | 4,708 | 3.21875 | 3 | [
"MIT"
] | permissive | import math
from datetime import datetime
class Brute_Force(object):
def __init__(self):
self.n = 0
self.b = 0
self.puzzle = []
self.num_guesses = 0
self.known_indices = []
def load_puzzle(self, puzzle_string):
self.puzzle = []
self.known_indices = []
... | true |
7a2c2f8975e73dca6966e0a98ffa573aacdd1fa4 | DonyTawil/LPTHW | /gothonweb/tests/map2_tests.py | UTF-8 | 3,820 | 3.234375 | 3 | [] | no_license | from nose.tools import*
from gothonweb.map02 import*
def test_Player():
assert_equal(Player.inventory,{})
assert_equal((Player.health),(100))
Player.reduce_health(100)
assert_equal(Player.health,0)
assert_equal(Player.room.name,'death room')
def test_Enemy():
dony=Enemy('don',100,100)
asse... | true |
6fa31f8fa6e1ab87857b9ee0c9da76f4cba007b9 | darknoemie/python | /poo/Figure.py | UTF-8 | 703 | 3.6875 | 4 | [] | no_license | import sys
class Figure(object):
# Variable de classe
compteur = 0
# Methode de classe , le premier argument doit etre cls
@classmethod
def cm_getCompteur(cls):
return cls.compteur
# Deuxieme methode de classe
@staticmethod
def sm_getCompteur():
return Figure.compte... | true |
82074ba0c6e96d48fd040bfbc53887480e245ba2 | Gaazedo/Portfolio | /Codes/python/py1/ex4.py | UTF-8 | 217 | 2.953125 | 3 | [
"MIT"
] | permissive | from utility import*
def iguais(vetor1, vetor2):
m1 = len(vetor)
iguais = ''
for i in range(m1):
if (vetor1[i] not in vetor2):
iguais = iguais + str(vetor[i]) + " "
return iguais
| true |
86dc1b3a770d1809dfdb2cf3eeebd914c684b18b | prince-gupta/python-practice | /core/dictonary.py | UTF-8 | 272 | 3.53125 | 4 | [] | no_license | dictonary = {(1, 2, 3, 4, 5): 'Tuple', (1, 2, 3, 4, 5): 'tuple2'}
print dictonary
dictonary2 = {'Name': 'Jhon', 'Age': 7}
print cmp(dictonary,dictonary2)
list = ['Name', 'Age', 'Address']
dict = dict.fromkeys(list, 'Not Assigned')
print dict
print dictonary2.items()
| true |
b7bfd80c5139f6261bcf51f4be1788f6b9213c11 | Yunazaki/GhostlyPythonTBG | /game.py | UTF-8 | 1,467 | 3.765625 | 4 | [] | no_license | import random
room = 1
def monster():
rand = random.randrange(1, 100)
if rand <= 30:
print("A vampire is here to suck your blood!")
elif rand <= 50:
print("A mummy crawls out of his coffin to attack you!")
else:
print()
while True:
if room == 1... | true |
1ef3cf7e991164a599479d505021fa815604e042 | katamarija/planet_express | /test/unit/test_crew_member.py | UTF-8 | 1,436 | 3.078125 | 3 | [] | no_license | import pytest
import sqlite3
from crew.crew_member import CrewMember
def test_init_crew_member():
crew_member = CrewMember(name="Fry")
assert crew_member.name == "Fry"
def test_save_new_crew_member(cursor):
crew_member = CrewMember(name="Fry")
crew_member.save(cursor)
assert type(crew_member.... | true |
bc86b364fe402a4e7ebd33c4fee789620521a3ef | boneyag/dl4nlp_asn2 | /src/neural_net.py | UTF-8 | 4,686 | 3.03125 | 3 | [] | no_license | import numpy as np
from numpy import random
import pickle
import matplotlib
from numpy.core.fromnumeric import shape
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
def sigmoid(z):
"""
Sigmoid function.
"""
return 1.0/(1.0 + np.exp(-z))
def sigmoid_prime(z):
"""
Derivative of the sigm... | true |
43a42cbc43b18802cd8eac1ca0867e9ed57d241c | christina57/lc-python | /lc-python/src/lock/163. Missing Ranges.py | UTF-8 | 903 | 3.828125 | 4 | [] | no_license | """
163. Missing Ranges
Given a sorted integer array where the range of elements are in the inclusive range [lower, upper], return its missing ranges.
For example, given [0, 1, 3, 50, 75], lower = 0 and upper = 99, return ["2", "4->49", "51->74", "76->99"].
"""
class Solution(object):
def findMissingRanges(self... | true |
270b715ea53beb9470b800e3cd11e215a6da854a | DidiMilikina/DataCamp | /Machine Learning Scientist with Python/19. Image Processing with Keras in Python/04. Understanding and Improving Deep Convolutional Networks/04. Add batch normalization to your network.py | UTF-8 | 1,238 | 3.953125 | 4 | [] | no_license | '''
Add batch normalization to your network
Batch normalization is another form of regularization that rescales the outputs of a layer to make sure that they have mean 0 and standard deviation 1. In this exercise, we will add batch normalization to the convolutional neural network that we have used in previous exercise... | true |
7ffbd246fcb03950f5b1a5679dd7689fad65e933 | karthikeyansa/python-placements-old | /python-day-2/prob3.py | UTF-8 | 237 | 3.9375 | 4 | [] | no_license | #Write a Python program to get the 4th element and 4th element from last of a tuple.
n=tuple(map(int,input("Enter the set of numbers separated by space: ").split()))
print("4 th element from index: ",n[3],"4 th element from last",n[-4])
| true |
0a38622e8cdef308b1f07ba59e07da0102c7cb95 | redadmiral/ezra_scraper | /scraper.py | UTF-8 | 3,720 | 2.6875 | 3 | [] | no_license | # This is a template for a Python scraper on morph.io (https://morph.io)
# including some code snippets below that you should find helpful
import requests_html
import re
import json
import locale
import datetime
import os
os.environ["SCRAPERWIKI_DATABASE_NAME"] = "sqlite:///data.sqlite"
import scraperwiki
# Read in... | true |
1fa1fa223cb0b4bf4381c0ff8b9c87c890f22218 | StaZarycki/Taiko-Bot | /main.py | UTF-8 | 1,682 | 2.984375 | 3 | [] | no_license | from PIL import ImageGrab, ImageOps
from pynput.keyboard import Key, Controller
import time
from numpy import *
import keyboard as kb
keyboard = Controller()
class Coordinates():
hitZone = (530, 390,
640, 500)
class Vars():
donNum = 0
katsuNum = 0
awaitInput = True
canPlay = False
timeToWait = 0.05
def hitD... | true |
82aaaba19ec13c6939354a7a26f7e65a15e0d31f | ramyasutraye/python-3 | /Player/appends.py | UTF-8 | 46 | 2.765625 | 3 | [] | no_license | m=input("enter the number")
print("\n",m+".")
| true |
d9b524a4a2958aad0650076e00df2ccb4a116de9 | stfate/EventernoteCrawler | /eventernote_crawler/eventernote_crawler/spiders/eventernote.py | UTF-8 | 21,488 | 2.890625 | 3 | [] | no_license | """
Spiders for crawling Eventernote
"""
import json
import os
import re
import time
import scrapy
ROOT_URL = "https://www.eventernote.com"
class EventernoteActorEventsSpider(scrapy.Spider):
"""
@class EventernoteActorEventsSpider
@brief a class for searching events of a specified actor
input:
... | true |
9c8a9b1101850fbbd7e3b933e4f0538d6bf1bc7c | HBPNeurorobotics/Experiments | /cdp1_mouse_holodeck/resources/SpinalNeuralNetwork.py | UTF-8 | 15,226 | 2.75 | 3 | [] | no_license | import pyNN.nest as sim
from CellsParameters import CellsParameters
from AfferentFibersPopulation import AfferentFibersPopulation
from AfferentFibersPopulationSimple import AfferentFibersPopulationSimple
import time
import numpy as np
import os
pathToCode = os.path.dirname(__file__)
class SpinalNeuralNetwork():
""" ... | true |
9210e5f559730c35cabe19dbc037c926d67fa443 | textile/python-textile | /tests/test_subclassing.py | UTF-8 | 493 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | import textile
def test_change_glyphs():
class TextilePL(textile.Textile):
glyph_definitions = dict(textile.Textile.glyph_definitions,
quote_double_open = '„'
)
test = 'Test "quotes".'
expect = '\t<p>Test „quotes”.</p>'
result = TextilePL().parse(test)
... | true |
a3262fa569cdaa53f7e1da1089cdc1b218135f8b | fengcorn/leetcode-python | /014.Longest_Common_Prefix.py | UTF-8 | 687 | 3.515625 | 4 | [] | no_license | class Solution:
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
result = ""
if len(strs) > 0:
for i,n in enumerate(strs[0]):
for j in range(1,len(strs)):
if i <= (len(strs[j])-1) ... | true |
fb830519207a0dea88bbf2adf74dad4d3c602336 | avinash-rao/Python | /InheritancePractice/inh2.py | UTF-8 | 579 | 4.1875 | 4 | [] | no_license | class Base():
def __init__(self):
self.x = 10
def test(self):
print("Baratheon")
class Derived(Base):
def __init__(self):
self.x = 20
def test(self):
print("Stark")
d = Derived()
# This will print out the variables and functions inside Derived class and not Base cl... | true |
08d79b8b1c9fb8d10ddc2ca668d5ce2af725e736 | Rodrigofsiqueira/Estudo | /CursoEmVideo/Python/Mundo1/ex032 - ano bissexto.py | UTF-8 | 224 | 3.75 | 4 | [
"MIT"
] | permissive | a = int(input("Digite algum ano, para saber se ele é bissexto ou não: "))
if a % 400 == 0 or a % 4 == 0 and a % 100 != 0:
print("O ano {} é bissexto".format(a))
else:
print("O ano {} não é bissexto".format(a))
| true |
50b0e443404f5a26398c89e31c4506f050183322 | LeoCenturion/tda | /stringMatching/minhash.py | UTF-8 | 1,244 | 3.34375 | 3 | [] | no_license | import random
class JaccardMinhash():
randomIndexesPattern=[]
randomIndexesText=[]
def __init__(self,setsLenght,samples):
indexes=range(setsLenght)
random.shuffle(indexes)
self.randomIndexesPattern=indexes[0:samples]
random.shuffle(indexes)
self.randomIndexesText =... | true |
d329e9a7974cbadbf41bef353a442fe5e4bd5943 | honyacho/leetcode_excercise | /0054.py | UTF-8 | 1,061 | 3.03125 | 3 | [] | no_license | class Solution:
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
res = []
if not matrix: return res
M,N=len(matrix),len(matrix[0])
cnt, i, j = 0, 0, 0
min_i, max_i, min_j, max_j = 0, M-1, 0, N-1
size = M*N
dir_x = 1 if len(matrix[0]) > 1 else 0
... | true |
b9c9ed5f8dc32a563561f61d5b53d9c0c82180e5 | langtodu/learn | /study/list-notice.py | UTF-8 | 453 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
# [0]*N 与 [[0]*N]*M 的用法
test1 = [0]*5
print test1
### result: [0, 0, 0, 0, 0]
test2 = [[0]*2]*3
print test2
### result: [[0, 0], [0, 0], [0, 0]]
test2[1][0] = 1
print test2
### result: [[1, 0], [1, 0], [1, 0]] 此处矩阵每一行都以 *3 的关系进行改变
test3 = [[0]*2]*3
test3_1 = np.array(tes... | true |
fb9de172bb2106e6a9b29eb954e5334a5c760b9c | job-franck-pernet/power-up | /anki/anki_class.py | UTF-8 | 2,933 | 3.046875 | 3 | [] | no_license | # -*- coding: iso-8859-15 -*-
__author__ = "Franck Pernet"
__license__ = ""
__version__ = "2021-01-18"
__email__ = "job.franck.pernet@gmail.com"
import os.path
class anki():
def __init__(self, file):
self._session_filename = file
self._boxes_start = {'red':[],'orange':[],'green':[]}
self._boxes_result... | true |
738d4917b460c32cb8c58a7ad751ce8f0d656483 | Aditi-Bhole/summer_project | /bot.py | UTF-8 | 7,360 | 2.671875 | 3 | [] | no_license | import pandas as pd
from sklearn import preprocessing
from sklearn.tree import DecisionTreeClassifier,_tree
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn import model_selection
from sklearn.tree import export_graphviz
from matplotlib import pyplot as plt
import warnings
w... | true |
0936db8727360f9707edad2d67e5ee8c49eb1891 | AleksandraTsygantsova/CatalogueParser | /AuchanParser.py | UTF-8 | 5,471 | 2.6875 | 3 | [] | no_license | import os
import time
import datetime
import requests
import bs4
from urllib.parse import urljoin
import pymysql
from pymysql import Error
import dotenv
pymysql.install_as_MySQLdb()
dotenv.load_dotenv('.env')
def connect():
""" Connect to MySQL database """
try:
conn = pymysql.connect('localhost', o... | true |
fdbf1d5b96c2e6cfec47471c0c035f7f2bc1b379 | interifter/runner | /scripts/run.py | UTF-8 | 1,538 | 2.578125 | 3 | [
"MIT"
] | permissive | import pkg_resources
import click
from colors import COLORS, WRITERS, MIXERS, ColorException
discovered_plugins = {
entry_point.name: entry_point.load()
for entry_point
in pkg_resources.iter_entry_points('runner.colors.plugins')
}
@click.group("run")
def main():
return 0
def find_plugin_info(name... | true |
db47ba2b246ae65abc7afbeef4da21b826315b9f | apollo-chiu/guess | /guess-1.py | UTF-8 | 609 | 4.53125 | 5 | [] | no_license | # 產生一個隨機整數1~100(不要印出來)
# 讓使用者重複輸入數字去猜
# 猜對的話 印出 "終於猜對了!"
# 猜錯的話 要告訴他 比答案大小
import random
start = input('請輸入隨機數字範圍起始值: ')
start = int(start)
end = input('請輸入隨機數字範圍結束值: ')
end = int(end)
key = random.randint(start, end)
count = 0
while 1:
count += 1
num = input('請猜數字: ')
num = int(num)
print('這是你猜的第', count, '次')
i... | true |
effeb3a96938e75b0c929f40fbb8add8e25e5f10 | cmsystems/PycharmProjects | /Programmierkurs/Übungen_Programmierkurs/u_parameter.py | UTF-8 | 304 | 3.765625 | 4 | [] | no_license | __author__ = 'Thomas'
print("Bitte geben Sie ihr gehalt ein: ")
a = input()
gehalt = int(a)
def steuer(gehalt):
if gehalt > 2500:
steuersatz = 0.22
return steuersatz
else:
steuersatz = 0.18
return steuersatz
print("Der Steuerbetrag ist: ", gehalt*steuer(gehalt))
| true |
7abeeb66c2b3b012690559a2d2d10038e0f2f62e | doctaphred/wortmaschine | /analysis.py | UTF-8 | 3,300 | 3.8125 | 4 | [] | no_license | from collections import defaultdict, Counter, namedtuple
from itertools import chain, islice, tee
import random
import re
Token = namedtuple('Token', ['type', 'value'])
word_patterns = re.compile('|'.join([
r'(?P<VOWEL>[aeiouAEIOU]+)',
r'(?P<CONSONANT>[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]+)',
r"(?... | true |
4e4519b2aa53036d330234635466769761af5f65 | jensfinnas/smhi_scraper | /tests/test_vantetider_datatable.py | UTF-8 | 2,424 | 2.59375 | 3 | [] | no_license | # encoding: utf-8
from vantetider.dataset import Datatable
import os
DATA_DIR = "tests/data/vantetider/datatable"
TABLE_WITH_TABS = os.path.join(DATA_DIR, "BUP.html")
TABLE_WITH_H_SCROLL = os.path.join(DATA_DIR, "BUP.html")
TABLE_WITHOUT_SCROLL = os.path.join(DATA_DIR, "PrimarvardBesok.html")
TABLE_WITH_V_SCROLL = o... | true |
486674a3bc6f53003e3e44455009d6b62faf8582 | mertturkmenoglu/python-examples | /examples/other/E006_Time/main.py | UTF-8 | 1,708 | 4.125 | 4 | [] | no_license | # Example 046: Time
import datetime
# Get current date and time
current = datetime.datetime.now()
print(current)
print('\n' * 3)
# Get current date
today_date = datetime.date.today()
print(today_date)
print('\n' * 3)
# List possible usages
print(dir(datetime))
print('\n' * 3)
# Create a date object
date_obj = d... | true |
7f85216ab99db2bfdf4acde0c29ab61f7ea72a16 | Bepersch/Study | /lesson2HW/fun.py | UTF-8 | 228 | 3.515625 | 4 | [] | no_license | try:
a = int(input("Begin: "))
b = int(input("End: "))
c = int(input("Step: "))
except ValueError:
print("NotLikeThis")
else:
while a <= b:
print("x: ", a, "| y: ", -1.24 * a ** 2 + a)
a += c
| true |
412bec1ec6e175f92c93809c195b8481c434f695 | r3ap3rpy/ECTestRepo | /Chapter05/test_pytestdemo.py | UTF-8 | 212 | 2.796875 | 3 | [] | no_license | from functions import *
def test_sum():
assert sum(1,4) == 5, "Should be 5"
def test_diff():
assert diff(9,7) == 2, "Should be 2"
def test_multiply():
assert multiply(11,11) == 121, "Should be 121" | true |
f5a7745a75714af98b83f6057e52267d7a52383e | ra5xc/CSEE5590 | /Hackathon/main.py | UTF-8 | 3,534 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 15 06:19:59 2018
@author: rohitabhishek
"""
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import xlrd
import pygeoip
rawdata = pygeoip.GeoIP('GeoLiteCity.dat')
import socket
def ipquery(ip):
addr=ip
try:
socket.inet_a... | true |
4910669c7d2f147313767a6beea299220c089822 | rirze/pmcpy | /pmcpy/common_utils.py | UTF-8 | 273 | 3 | 3 | [] | no_license | from datetime import datetime
def parse_date_to_string(obj, utc=False):
if isinstance(obj, datetime):
if not utc:
return datetime.isoformat(obj)
else:
return obj.strftime('%Y-%m-%dT%H:%M:%SZ')
else:
return str(obj)
| true |
5ed1e6cce1a0103b9d902f802f39fa2f09a8ebc4 | leohsmedeiros/DataScienceStudy | /udemy/04 - redes neurais e deep learning/03_deep_learning_parte_02.py | UTF-8 | 3,050 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.utils import np_utils
import numpy as np
from sklearn.metrics import confusion_matrix
from keras.datasets import mnist
(X_treinamento, y_treinamento), ... | true |
b9d1eb2586aa8c9e640cb06f85d535a526b0a4a4 | tbaffonso/Paper_codes | /CR,SBA,TSB.py | UTF-8 | 4,672 | 2.578125 | 3 | [] | no_license | #Nome: Tássia Bolotari Affonso
#Croston, SBA e TSB
from sba import *
from random import *
import statistics
import random as ty
import numpy
import statistics
import xlrd
import xlwt
import pandas as pd
import sys
if __name__ == "__main__":
for i in range (12723):
#print(i)
pr... | true |
9de235f180acff20614a33fb36351fd6150f8212 | Rango94/leetcode | /最长递增子序列.py | UTF-8 | 260 | 3.015625 | 3 | [] | no_license |
def findLongest(A,n):
c=[]
for i in range(n):
tmp=[1]
for j in range(i-1,-1,-1):
if A[j]<A[i]:
tmp.append(c[j]+1)
c.append(max(tmp))
return max(c)
A=[157,232,6]
print(findLongest(A,len(A))) | true |
d4b79ca33cf93c865fdcd52f7f10abd49c934252 | dannl/hunter-sim-classic | /buff/trinket/warrior.py | UTF-8 | 250 | 2.53125 | 3 | [
"MIT"
] | permissive | from buff import Buff
class Warrior(Buff):
def __init__(self):
super().__init__('warrior', 0)
def equip(self,engine, char_state):
char_state.ap += 150
def dequip(self,engine, char_state):
char_state.ap -= 150
| true |
5202adc75db448ad1597f5147e224102c3ab29a0 | Vladyslav-Samokryk/QS_Quadratic_sieve_algorithm | /src/Factor.py | UTF-8 | 1,073 | 2.859375 | 3 | [] | no_license | from time import time
def Factor(n, B):
# color text!!!
from valcolor import valcolor
# some functions to support functionality (LOL)
from lib import GCD,Q
q = Q(n)
# class generating Factor base
from Prime import Prime
primes = Prime(n,B,q)
# func to suive until we have critica... | true |
221696a51539d5b325e3ddd732067f346d54e53f | damn-glitch/StudyC | /Game Physics-Geometry Simulation/Wireframe.py | UTF-8 | 7,853 | 3.421875 | 3 | [] | no_license | import Vectors
import copy
import math
import random
# Gets the rough distance between a wireframe and a position
def wireDist(item, position):
assert isinstance(item, Wireframe), 'Must be Wireframe type'
centre = item.findCentre()
return math.sqrt((centre.x - position.x) ** 2 +
... | true |
bb16d8de8d40c5a7e0b563fcfda436f2a2bf82e3 | nikita1610/100PythonProblems | /Problem80/Day80.py | UTF-8 | 274 | 3.53125 | 4 | [] | no_license | def max_length_subarray(a,b):
count=0
ans=0
for item in a:
if item in a and item in b:
count+=1
else:
ans=max(count,ans)
count=0
return ans
a=[3,6,1,0]
b=[3,6,5,4]
ans=max_length_subarray(a,b)
print(ans)
| true |
f103241692704e4696cab3ea22488df88f48eb9c | GuoZhengJian/GoodStyel | /UnittestDemo/Unit.py | UTF-8 | 1,001 | 4.0625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
class Demo:
"""
类或方法的第一行字符串为文档字符串。可以使用doctest模块来收集文档字符串, 在其中
查找交互式会话,并以一系列测试的形式执行它们。
要测试该单元, 通常会创建一个独立模块用于测试。如 TestUnit.py
文档字符串通常会包含简短的交互例子:
>>> Demo('Hello Word').back_str()
'Hello Word'
>>> Demo(5).back_nums()
5
>>> Demo(5).back_lis... | true |
6f1ada680dacae4816335add6432ae5915972a46 | rocket3989/hackerEarth2019 | /april easy/water.py | UTF-8 | 803 | 2.546875 | 3 | [] | no_license | import sys, resource
sys.setrecursionlimit(1000000)
resource.setrlimit(resource.RLIMIT_STACK, (2**29, -1))
N = int(input())
adj = [[] for i in range(N + 1)]
for i in range(N - 1):
u, v = [int(x) for x in input().split()]
adj[u].append(v)
adj[v].append(u)
visited = [False] * (N + 1)
block... | true |
c0355ece172a90876e55a6d67b8ab025aed75d1c | shamgang/def-orbit | /animation.py | UTF-8 | 28,783 | 2.609375 | 3 | [] | no_license | # Animation writer script
import bpy
import re
from math import pi
import random
### Assume the following objects exist and are set up correctly:
# Cameras:
# Camera (child of and z-rotation tracking to object: spin)
# Lights:
# Hemi
# Point
# Point.001
# Spot
# Sun (with energy initialized to 0)
# redhemi
# ... | true |
25dac655c92c6d92fbd6dd791fdd9a7a42a1ed2e | cryptoadvance/specter-diy | /src/gui/specter.py | UTF-8 | 2,381 | 2.5625 | 3 | [
"MIT"
] | permissive | from .async_gui import AsyncGUI
from .screens import (
Screen,
Progress,
MnemonicScreen,
NewMnemonicScreen,
RecoverMnemonicScreen,
DevSettings,
)
import rng
import asyncio
class SpecterGUI(AsyncGUI):
"""Specter-related GUI"""
async def show_mnemonic(self, mnemonic: str):
"""
... | true |
13057528d7acfd58d2b3c1ce88368a51675b1e63 | FirmAI-Research/tlearning | /tlearning/utils/character_simulator/citizen.py | UTF-8 | 980 | 3.5625 | 4 | [] | no_license | import numpy as np
import torch
class Citizen():
def __init__(self, nclasses, strategy):
"""The citizen is quite naive: if the image is easy to classify they
will most likely get the right answer, o.w they will choose a category
from which confusion is possible.
The creator gives t... | true |
865d291feb292e849b69cc6a87d2d541e158905b | daniel-reich/ubiquitous-fiesta | /4AtqpqKdXAFofa566_10.py | UTF-8 | 261 | 2.953125 | 3 | [] | no_license |
def remove_leading_trailing(x):
if "." not in x:
return str(int(x))
else:
x = x.lstrip('0').rstrip('0')
if x.endswith('.'):
x = x.replace('.', '')
if not x:
return '0'
if x.startswith('.'):
x = '0' + x
return (x)
| true |
9b59cb5365283c9919295e772c5bf48e5bfaf62e | oversteerZZ/Challenge | /3-3.py | UTF-8 | 243 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:茁
# date:2019/4/16
a = int(input('请输入:'))
if a <= 10:
print('a小于等于10')
elif a > 10 and a <= 25:
print('a大于10且小于等于25')
else:
print('a大于25') | true |
f913af86aa28af933f6a92bf950589ffc0c35479 | moisesStevend/cursoIOT_salaveryr | /codigosPython/pub1.py | UTF-8 | 702 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
print("Empezamos a conectarnos con calidad "+str(rc))
client.subscribe("xpotron2017")
def on_message(client, userdata, msg):
print msg.payload
if (msg.payload == "finish"):
print("acabo!")
client.discon... | true |
75a84ba12315934794b711379ca1cff78388c097 | Sixmillion/pycharm | /pds/pds.py | UTF-8 | 730 | 3.390625 | 3 | [] | no_license | import pandas as pd
import numpy as np
#Series:带索引的一维数组
a=['as','a','good','boy','aha']
b={'name':'jack','age':18,'sex':'boy'}
pd0=pd.Series(a,index=list("abcde"))
# print(pd0.index,pd0.values)
# print(pd0[['a','c','d']])
#Dtaframe:二维数组
df1=pd.read_csv('./dogNames2.csv')
# print(type(pd1))
df2=pd.DataFrame(np.arange(1... | true |
0c0e02ff5cb55cf2659f45768dc97f3762f4e524 | Kevinsss/redis_monitor | /test/redis_test.py | UTF-8 | 609 | 2.515625 | 3 | [] | no_license | import json
import redis
import config
class MockRedis(object):
def __init__(self):
self.host = '127.0.0.1'
self.port = 6379
# self.password = 'pwd'
self.client = redis.StrictRedis(host=self.host, port=self.port, db=0)
def mock_setnx(self):
for i in range(0,20000):
... | true |
2e602d46a9859386a998fc14bb6f4b62dea496ad | fl82hope/HLA-Face-Code | /train_code/data/image.py | UTF-8 | 1,155 | 2.578125 | 3 | [] | no_license | #-*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
from PIL import Image, ImageDraw
import torch.utils.data as data
import numpy as np
import random
from utils.augmentations import transform_to_dsfd
import glob
class ImageL... | true |
d42b98de5547a98a827873b037bb9e65e316a941 | Yash-YC/Source-Code-Plagiarism-Detection | /gcj/gcj/188266/BlackHorse/168107/0/extracted/1.py | UTF-8 | 1,358 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
def getNumberBase(number,base):
""" return the number in particular base """
newnumber = number;
total = 0
while(newnumber):
#print base
rem = newnumber % base
newnumber /= base
total += rem * rem
return(total)
def isHappy(number,base):
retVal = number
oldr... | true |