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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
94b6d5b403f7b4aa01782d541dd77d6f0656997e | Python | bryanlim95/simple-security-gui | /encryption.py | UTF-8 | 833 | 3.53125 | 4 | [] | no_license | import random
def des_encrypt(realText, step):
outText = []
uppercase = ["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"]
digits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
for eachChar in realText:
if eac... | true |
6c238bf4a22d8282a3800dbc819f1cbae92a4361 | Python | phatboyle/programs | /pig_latin/pig_latin.py | UTF-8 | 2,418 | 3.46875 | 3 | [] | no_license |
def vowelWord(word):
convertedWord = word + "-yay"
return convertedWord
def consonantWord(word):
vowels = ['a','e','i','o','u']
convertedWord=''
wordlist = list(word)
letter = wordlist.pop(0)
while letter not in vowels:
if len(wordlist) == 0:
break
convertedWord... | true |
4f1dc4a70ab037da5928d6f073fc4e286f43cee2 | Python | rehmannjETHZ/PythonMachZehnder | /fringes.py | UTF-8 | 4,648 | 2.5625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import os #used for data path
from tqdm import tqdm
def mean(x):
return sum(x)/np.size(x)
def weightedmean(x, w):
return sum(x*w)/sum(w)
def var(x):
return np.sqrt(mean(x*x) - mean(x)**2)
Time = []
Ramp = []
Digita... | true |
4629bd4e72b5669ea737a00b32d7ddd956ab6f31 | Python | zju-sclab/turtlebot_develop | /laser/MultiLaserPublish.py | UTF-8 | 2,734 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
import serial
import MultiLaser
import rospy
import roslib
import sys
from std_msgs.msg import String, Float32MultiArray
class MultiLaserPub:
def __init__(self):
self.ser=[]
self.cmd_alwaysMeature = [0x80, 0x06, 0x03, 0x77]
self.port = ['/dev/ttyUSB0', '/dev/ttyUSB1', '/de... | true |
dd75996e0f1cc5dfd7671fe9ae48a5dd2f043eac | Python | Timothy-Kornish/MachineLearningPython | /machineLearning/visualization_practice/Seaborn_Excercises/matrixPlots.py | UTF-8 | 2,795 | 3.546875 | 4 | [] | no_license | import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
#-------------------------------------------------------------------------------
# Matrix Plots
# must show each plot independently or they will overlap on same plot,
# this feature can be useful for combining certain plo... | true |
9c338d0a88a3b65cd764a30169f676b81e0d2447 | Python | code-lighthouse/tests | /circle_area.py | UTF-8 | 117 | 3.25 | 3 | [] | no_license | #! /usr/bin/python
from math import pi
def circle_area(radius):
return pi * radius ** 2
print circle_area(5)
| true |
15ee375d9e9df19f33b81a9957eb5c6315eebfca | Python | Terospay/Admission_Board_bot_Review | /main.py | UTF-8 | 9,040 | 2.703125 | 3 | [] | no_license | import telebot as tb
import sqlite3
import datetime as dt
bot = tb.TeleBot('673810626:AAFwq4l_fWxkRlg38tswsft9Egy_IrplQ-M')
FIO = ''
FN = ''
LN = ''
PN = ''
birth = ''
DM = ''
time = ''
@bot.message_handler(commands=['help', 'start'])
def send_welcome(message):
msg = bot.send_message(message.chat.id, '"Этот бот ... | true |
459b3b7af2cafe59747026354353b59e01d1157d | Python | nickgcamp/Python-Image-Processing | /edgeDetection.py | UTF-8 | 1,442 | 3 | 3 | [] | no_license | # Edge processing and histogram
from skimage import io, exposure
import matplotlib.pyplot as plt
plt.close('all')
DIR = '/users/nick/GoogleDrive/School/Fall 2018/Biophysics/'
# read image and show
# aCity = io.imread('/users/nick/GoogleDrive/School/Fall 2018/Biophysics/city.tif')
aCity = io.imread(DIR + 'city.tif')... | true |
b43f7a462813015a92e7bcdf8d888abafb025127 | Python | vijendra06/Machine_Learning_ | /Decisiontress.py | UTF-8 | 787 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 16 13:46:48 2018
@author: vijendrasharma
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
dataset= pd.read_csv('Position_Salaries.csv')
x= dataset.iloc[ :, 1:2].values
y= dataset.iloc[:, 2:3].values
'''from sklearn.prepr... | true |
2fd591789221c602234bea7dc84eeba9018d8054 | Python | PacktPublishing/Practical-Computer-Vision | /Chapter05/05_print_inceptionv3.py | UTF-8 | 276 | 2.6875 | 3 | [
"MIT"
] | permissive | from keras.applications.inception_v3 import InceptionV3
def print_model():
"""
Loads Inceptionv3 and prints model structure
"""
# create model
model = InceptionV3(weights='imagenet')
# prints our model created
model.summary()
print_model() | true |
419418319b835e7ddfadea391c6d936320987b5b | Python | prasha230/Friday | /speech_rec.py | UTF-8 | 3,015 | 3.046875 | 3 | [] | no_license | import speech_recognition as sr
import webbrowser
from gtts import gTTS
import os
import playsound as pl
r1=sr.Recognizer()
f=open(os.path.join(sys.path[0], "convo.txt"), "a")
def talk(mytext):
myobj = gTTS(text=mytext, lang='en', slow=False)
myobj.save('r.mp3')
pl.playsound('r.mp3')
os.remo... | true |
d2bf524a50b66b075e5922fef0513e58ed2e47cb | Python | maluginbuhl/geo_percolation | /Tools/my_pyplot.py | UTF-8 | 3,617 | 2.5625 | 3 | [] | no_license | import matplotlib as plt
import matplotlib.pyplot as plt
myRed=(229/255.0,25/255.0,50/255.0)
myBlue=(25/255.0,178/255.0,255/255.0)
myGreen=(50/255.0,255/255.0,0/255.0)
myOrange=(255/255.0,127/255.0,0/255.0)
myViolet=(101/255.0,76/255.0,255/255.0)
plt.rc('text', usetex=True)
mpl.rcParams['text.latex.preamble'] = [
... | true |
2d350fb14014dab30e85c67bd7d2814e2f4c56cb | Python | rerapony/software-design-2021 | /cli/src/factory/abstract_factory.py | UTF-8 | 480 | 2.75 | 3 | [] | no_license | from abc import ABC, abstractmethod
class AbstractFactory(ABC):
"""Abstract CLI parser interface.
Declares set of commands:
- cat
- echo
- pwd
- wc
- exit
"""
@abstractmethod
def cat_cmd(self):
pass
@abstractmethod
def echo_cmd(self):
pass
@abstr... | true |
2b543f085d283830fa371888911d3e7667f5cd73 | Python | lqktz/python_practice | /ex7.py | UTF-8 | 398 | 3.375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
print "My name is %s ." % 'qli3'
print "Mary had a little lamd."
print "And everyone that mary went."
end1 = "C"
end2 = "h"
end3 = "e"
end4 = "e"
end5 = "s"
end5 = "B"
# 末尾的逗号会使只空格,而不是换行
print end1 + end2 + end3 + end4 + end5 + end5,
print end1 + end2 + end3 + end4 + end5 + end5
print "This ... | true |
4244d2c9c98f4bc3f6290f73d41e725f3e835efe | Python | pathakamaresh86/python_class_prgms | /multiply.py | UTF-8 | 294 | 3.625 | 4 | [] | no_license | #!/usr/bin/python
#Write a single function to multiply 2,3,4,5 numbers.
def multiply(a,b,c=1,d=1,e=1):
return (a*b*c*d*e)
print multiply(1,2)
print multiply(1,2,3)
print multiply(1,2,3,4)
print multiply(1,2,3,4,5)
'''
D:\F DATA\python_class>python multiply.py
2
6
24
120
''' | true |
7c0ddc175436625e02a76e6ebcf0ca48db6d0d9e | Python | jiminnpark/Empath | /home/Classifier.py | UTF-8 | 4,313 | 2.765625 | 3 | [] | no_license | #---------------------------------------------------------------------------------------------------
# Script by:- VEDANT VINAYAK KULKARNI
#---------------------------------------------------------------------------------------------------
import math
import pandas as pd
from collections import Counter
def Knn(que... | true |
0a42068e879bd13bd9bea0778c7b23380f69d922 | Python | saketh1506/CODES | /Greater.py | UTF-8 | 89 | 3.171875 | 3 | [] | no_license | def is_greater(a,b):
if a>b:
return True
elif a<=b:
return False
| true |
6ffab33ad43558fd2d49c9f81dd3adbcae27db46 | Python | SBU-BMI/quip_classification | /u24_lymphocyte/third_party/treeano/nodes/composite.py | UTF-8 | 3,469 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | """
nodes which are combinations of multiple other nodes
"""
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import numpy as np
import theano
import theano.tensor as T
from .. import core
from . import simple
from . import containers
from . import combine
from... | true |
a1aa7eede892b18572daeb5e3599bcc25eecf349 | Python | jungwonkkim/swexpert | /linked_list.py | UTF-8 | 1,306 | 3.640625 | 4 | [] | no_license | class Node:
def __init__(self, d=0, n = None):
self.data = d
self.next = n
def __del__(self):
print(self.data, '삭제')
class LinkedList:
def __init__(self):
self.head = None
self.num_of_data = 0
self.current = None
self.before = None
self.tail... | true |
66c742208f3bebe37cf8ced00fd5f91f9f9f7bd0 | Python | snowthesprite/assignment-problems | /Assigns/Assignment_2/count_characters.py | UTF-8 | 590 | 3.921875 | 4 | [] | no_license | def count_characters(string) :
lowercase_string = string.casefold()
count_dict = {}
for char in lowercase_string :
amount = 0
for character in lowercase_string :
if char == character :
amount += 1
count_dict[char] = amount
return count_dict
test_str =... | true |
e99d9d3e492fe8dd10e335f5b8c03a66ee804e56 | Python | daniel-reich/ubiquitous-fiesta | /dZhxErwMfyWymXbPN_14.py | UTF-8 | 124 | 2.78125 | 3 | [] | no_license |
def hangman(phrase, lst):
return ''.join(x if x.lower() in ''.join(lst)+' ,.!' or x.isdigit() else '-' for x in phrase)
| true |
2c25c74e4b7dec93403b707a096c5af937a7ffe8 | Python | diem-ai/datascience-projects | /twitter_bot/nlp_helper.py | UTF-8 | 3,176 | 2.796875 | 3 | [
"MIT"
] | permissive | import emoji
import re
import string
import spacy
from nltk.corpus import stopwords
def clean_emoji(text):
if (emoji.emoji_count(text) > 0):
return re.sub(emoji.get_emoji_regexp(), r"", text)
else:
return text
def clean_punctuation(text):
"""
@text: is a text with/without the punctuati... | true |
a34ef7e711f540bd7cc065c5d3f9349b343888a9 | Python | ckguo/logicAI | /functions.py | UTF-8 | 2,503 | 3.3125 | 3 | [] | no_license | import sys
RED = "\033[1;31m"
BLUE = "\033[1;34m"
RESET = "\033[0;0m"
def viewEnumerationNum(enum):
# enum is a 4x6 array of integers (0-23)
print('\tCard 1\tCard 2\tCard 3\tCard 4\tCard 5\tCard 6')
for i in range(4):
sys.stdout.write(RESET)
sys.stdout.write('Plyr {}:\t'.format(i))
for j in range(6):
... | true |
bb1b2c048e17efbdef21be96625e326330bbf98b | Python | booleon/adventofcode2020 | /tests/test_tobogan_trajectory.py | UTF-8 | 3,835 | 3.046875 | 3 | [] | no_license | import pytest
from adventofcode.tobogan_trajectory import MapLayer, Map, Tobogan
class TestMapLayer:
class TestIsTreeOnPosition:
def test_given_no_tree(self):
"""
Given:
When:
Then:
"""
# arrange
layer = "..##......."
... | true |
90863ef22dc5af53a6d9952ea9ff74b9f047c806 | Python | Aadars/Python-Project-Repo | /02-Code/class1intro.py | UTF-8 | 120 | 3.3125 | 3 | [] | no_license | class Dog():
def __init__(self,breed):
self.mybreed = breed
my_dog = Dog(breed='lab')
print(my_dog.mybreed)
| true |
68e828aa85d8e8713d108893d28713cefefaded5 | Python | SonneR09/flask_tutor_noDB | /support/support_scripts.py | UTF-8 | 931 | 3.125 | 3 | [] | no_license | """Небольшие вспомогательные скрипты"""
import random
from flask import abort
def booking_link_checker(path, teachers):
"""Проверяет корректность URL в роуте booking"""
to_check_list = path.split('/')[-4:]
id = int(to_check_list[0])
weekDay = to_check_list[1]
time = to_check_list[2]
teache... | true |
076eaba8656593be1663103048155dadd04a3fca | Python | 2021-INT2-GROUP21/ImageClassifier | /models/TwoStep.py | UTF-8 | 2,592 | 2.65625 | 3 | [] | no_license | import torch
from torch import nn
import numpy as np
import matplotlib.pyplot as plt
class TwoStep(nn.Module):
def __init__(self):
super().__init__()
m = 32
#######################################################################################
self.conv_layer0 = nn.... | true |
ccc0a6f9976d493349b1af85568c58667b742635 | Python | Carifio24/ProjectEuler | /problem_31.py | UTF-8 | 1,811 | 4.46875 | 4 | [] | no_license | ####################################################
# In the United Kingdom the currency is made up of pound (£) and pence (p). There are eight coins in general circulation:
# 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p), and £2 (200p).
# It is possible to make £2 in the following way:
# 1×£1 + 1×50p + 2×20p + 1×5p + 1×2p +... | true |
0f0f67d90fb2c809fef8b7db0922501dd369182b | Python | dedaluz/django-tumblelog | /tumblelog/managers.py | UTF-8 | 1,372 | 2.625 | 3 | [
"MIT"
] | permissive | from datetime import datetime
from django.db import models
from django.db.models import Q
class PostManager(models.Manager):
"""
Custom model manager for Post and BasePostType. Adds filtering methods for
only returning queued, past, draft, published, private, and public
(published + past) objects.
... | true |
ba7ffd943a20994b3305997e87c80d2e7d3ae2ee | Python | aoweiding/TorchProteinLibrary | /docs/Examples/FullAtomModel/ExamplePDB2CoordsUnordered.py | UTF-8 | 1,788 | 2.671875 | 3 | [
"MIT"
] | permissive | import torch
from TorchProteinLibrary import FullAtomModel
import numpy as np
import matplotlib
import matplotlib.pylab as plt
import mpl_toolkits.mplot3d.axes3d as p3
from scipy.spatial import ConvexHull
cmap = matplotlib.cm.get_cmap('Spectral')
if __name__=='__main__':
#Reading pdb file
p2c = FullAtomM... | true |
06eb83aac678516728119719d81451a7df1c1e96 | Python | biocomp-eafit/simple-assembly | /src/euler.py | UTF-8 | 2,786 | 3.015625 | 3 | [] | no_license | import networkx as nx
import operator
import matplotlib.pyplot as plt
from functools import reduce
def has_euler_circuit(graph):
if not nx.is_strongly_connected(graph):
return False
for node in graph.nodes():
if graph.in_degree(node) != graph.out_degree(node):
return False
retur... | true |
e1d1839cc85fb02b388ae493295d44a2935b0559 | Python | zixing131/Fruit-Recognition | /code/Fruit-recognition-remote/main.py | UTF-8 | 1,608 | 2.625 | 3 | [] | no_license | import wx
import wx.xrc
from skimage import io, transform
import tensorflow as tf
import numpy as np
import cv2
class Module:
def __init__(self):
self.fruit_dict = {0: '苹果', 1: '香蕉', 2: '橙子'}
self.w = 100
self.h = 100
self.c = 3
# 读取图片
def read_image(self, path):
im... | true |
e2143d61be2341f4e1aa2f888d444904e6a3b53f | Python | wekesa/python_practise | /sorting/selection_sort.py | UTF-8 | 848 | 4.46875 | 4 | [] | no_license | """
- This algorithm segments the list into two parts. sorted and unsorted.
We continuously remove the smallest element of the unsorted segment of the list and append
to the sorted segment.
"""
def selection_sort(nums):
for i in range(nums):
# We assume that the first item of the unsorted segment is the sm... | true |
aae24f3c20629ac99617994c44ba97bb8336bb7c | Python | jmabf/uri-python | /1066.py | UTF-8 | 437 | 3.578125 | 4 | [] | no_license | n1= float(input())
n2= float(input())
n3= float(input())
n4= float(input())
n5= float(input())
lista = [n1,n2,n3,n4,n5,]
par=0
impar=0
pos=0
neg=0
for x in lista:
if x%2==0:
par+=1
elif x%2==1:
impar+=1
if x>0:
pos+=1
elif x<0:
neg+=1
print('{} valor(es... | true |
7d29f01e47de7edbd7787286e58431bc79ce8ad6 | Python | plelewski/50_python_Q_and_A | /10_wartosci_slownika.py | UTF-8 | 1,162 | 4.46875 | 4 | [] | no_license | # Pytanie 10 - korzystając ze słownika stworzonego w poprzednim zadaniu
# sprawdź czy któraś z liter wystąpiła w stringu dokładnie 4 razy.
# Jeśli tak - wypisz True, jeśli nie - False.
litery = {'m': 1, 'y': 3, 's': 1, 'z': 3, 'd': 2, 'o': 2, \
'k': 2, 'a': 2, 'u': 2, 'j': 2, 'ą': 2, 'g': 1, \
't':... | true |
08f4ab4fbfb4fe3dc526b1c8a49c3c818ac49b48 | Python | daniel-reich/ubiquitous-fiesta | /ch3ZsbzJt56krcvhy_12.py | UTF-8 | 147 | 3.140625 | 3 | [] | no_license |
def square_root(n):
est = int(n**0.5)
while True:
est = int((est + n//est)//2)
if est * est == n:
return est
| true |
2cc952787162429aee8437ae6d5f390d0f51f75b | Python | paudano/kanapy | /util/kmer.py | UTF-8 | 6,080 | 3.71875 | 4 | [] | no_license | """
Basic k-mer manipulation utilities.
"""
class KmerUtil:
"""
Manages basic k-mer functions, such as converting formats, appending bases, and reverse-complementing.
Contains a set of constants specific to the k-mer size and minimizer (if defined).
"""
def __init__(self, k_size, k_min_size=0, k_... | true |
ffd59946f0bb685789cb1f14beed8fc716a92905 | Python | ReneNyffenegger/ToyLang | /lite/lite_transformer.py | UTF-8 | 5,379 | 2.59375 | 3 | [
"MIT"
] | permissive | from lark import Lark, Transformer, v_args
from lite_ast import *
from lite_errors import *
from importer import Importer
from lark import exceptions
import os.path
import sys
@v_args(inline=True)
class LiteTransformer(Transformer):
def __init__(self):
self.importer = Importer()
def number(self, valu... | true |
87ace5142de00e53d8b8bdef95825ea95a8a6514 | Python | Kevin-Arcos/Trabajos-hechos-en-curso | /Ejemplo de importacion.py | UTF-8 | 497 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 30 11:46:34 2019
@author: CEC
"""
import datetime
oTime=datetime.datetime.now()
print(oTime.isoformat())
from platform import platform
print(platform())
print(platform(1))
print(platform(0,1))
import numpy as np
from platform import machine
print(... | true |
daec5fa3472284c526ed7f123eab9f16d86ea06a | Python | eziong/algorithm | /level1/11720.py | UTF-8 | 83 | 2.90625 | 3 | [] | no_license | #sum
n = input()
nn = input()
nn = list(nn)
nn = list(map(int,nn))
print(sum(nn)) | true |
eee762fecd6d9c366403ce2491e80eaac48b0ba3 | Python | stanislav-shulha/Python-Automate-the-Boring-Stuff | /Chapter 8/shelveExample.py | UTF-8 | 651 | 3.953125 | 4 | [] | no_license | #! python3
# shelveExample - Program to demonstrate the shelve module
# Use plaintext to store human readable informaion, shelve for non-human readable information
import shelve
shelfFile = shelve.open('mydata')
cats = ['Zophie', 'Pooka', 'Simon']
shelfFile['cats'] = cats
shelfFile.close()
print('-------------------... | true |
51ea2d143df6938c2a8ec21c84ad327699ff5682 | Python | micheles/papers | /pypers/europython05/Quixote-2.0/form/compatibility.py | UTF-8 | 3,484 | 2.53125 | 3 | [] | no_license | '''$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/quixote/form/compatibility.py $
$Id: compatibility.py 26061 2005-02-11 02:48:16Z dbinger $
A Form subclass that provides close to the same API as the old form
class (useful for transitioning existing forms).
'''
from quixote import get_request, get_path, redirect
f... | true |
06a4f9ad82230eda6a12ef9c7fb8a2b9f3b0f4c4 | Python | andelgado53/interviewProblems | /sum_two_link_list_in_normal_order.py | UTF-8 | 1,812 | 4.0625 | 4 | [] | no_license | # Cracking the Coding Interview Chapter
# Sum the values of two linked lists
# list1 = 3 -> 2 -> 5
# list2 = 5 -> 2 -> 1
# Result = 8 -> 4 -> 6
class ListNode:
def __init__(self, x):
self.value = x
self.next = None
_3 = ListNode(3)
_2 = ListNode(2)
_5 = ListNode(5)
_3.next = _2
_2.next = _5
list... | true |
a2f5fc04d4d7b92e9c33ad2f545c92dad68c5e5f | Python | techi/trabajo_grado | /graficos.py | UTF-8 | 1,136 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
from connect import *
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
def main():
# VIDRIERIA
df = getTableVidrieria()
IDs = [38, 2, 497, 16, 23]
frames = pd.DataFrame()
for id in IDs:
filtrado = df[(df['idproducto'] == id)]
filtrado['fecha'... | true |
0134215a27862b58de14e6c0f9f4670304143889 | Python | munna94/Flask | /rest.py | UTF-8 | 664 | 2.8125 | 3 | [] | no_license | from flask import Flask, request
from pymongo import MongoClient
client=MongoClient('localhost',27017)
db=client.flaskTest
app = Flask(__name__)
#---hit using http://127.0.0.1:2020/rest/api/?name=mk&salary=1000k--------
@app.route('/rest/api/', methods=['GET'])
def foo():
bar = request.args.to_dict()
keys... | true |
1b77ff5984de6e7712e72f6a6004fbbb508e58fa | Python | LSC333/pythonAlgorithm | /PAT/PAT1/1054.py | UTF-8 | 501 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/6/10 18:46
# @Author : ValarMorghulis
# @File : 1054.py
def solve():
m, n = map(int, input().split())
ans, cnt = -1, 0
for i in range(n):
t = list(map(int, input().split()))
for j in range(m):
if ans != t[j]:
if cnt == 0:
... | true |
bfe7736352e247fd59dc23d05e9ce882d0ba58a7 | Python | googleads/googleads-bidmanager-examples | /python/v1.1/get_latest_report.py | UTF-8 | 5,225 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 b... | true |
aaf862981ca125640ef123d408a4172060047ff6 | Python | jackrvan/mealcost | /mealcost/recipe/parse_recipes.py | UTF-8 | 3,008 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python
import requests
import re
from bs4 import BeautifulSoup
fractions = {
0x2189: '0.0', # ; ; 0 # No VULGAR FRACTION ZERO THIRDS
0x2152: '0.1', # ; ; 1/10 # No VULGAR FRACTION ONE TENTH
0x2151: '0.11111111', # ; ; 1/9 # No VULGAR FRACTION ONE NINTH
0x215B: '0.12... | true |
d59e35f4581a1f36a1cd650d82f2c99537c720dc | Python | junho100/algorithm_in_military | /Lv1/Lv1_폰켓몬.py | UTF-8 | 201 | 2.828125 | 3 | [] | no_license | def solution(nums):
answer = 0
select = len(nums)//2
nums_set = set(nums)
if select >= len(nums_set):
return len(nums_set)
else:
return select
return answer | true |
5207165f7222261df62c92eae7e109cf7bb517c5 | Python | Rein-PY/timezone | /test_version_bot.py.save | UTF-8 | 5,866 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import discord
import config
from discord.ext import commands
import numexpr as ne
import logging
bot = commands.Bot(command_prefix='!')
@bot.command(pass_context=True) # разрешаем передавать агрументы
async def calc(self, nam1): # Ввод переменных
whu = '{0.author... | true |
504c6d99ad904e57c3579e8e7648537f62780085 | Python | moontree/leetcode | /version1/368_Largetst_Devided_Subset.py | UTF-8 | 1,410 | 3.84375 | 4 | [] | no_license | """
Given a set of distinct positive integers,
find the largest subset such that every pair (Si, Sj)
of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0.
If there are multiple solutions, return any subset is fine.
Example 1:
nums: [1,2,3]
Result: [1,2] (of course, [1,3] will also be ok)
Example 2:
num... | true |
2040c6a875cd5a054d64eccccd0a9114e6e1f1bb | Python | zhouhanghust/algorithms | /13.期货杯/code/代码整理/clean_data_cu/merge_data_cu/using_logistic.py | UTF-8 | 2,040 | 2.75 | 3 | [] | no_license | #!usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:hang
@file: using_logistic.py
@time: 2018/02/{DAY}
"""
# -*- coding: UTF-8 -*-
"""
@author:
contact:
@file: using_svm.py
@time: 2018/2/4 19:21
@Software: PyCharm Community Edition
"""
import numpy as np
import pandas as pd
from sklearn.model_selection imp... | true |
38bc5ea1c1ba6593a44624c6e19c54174d16fc8a | Python | Scori/przelicznik | /units/temperature.py | UTF-8 | 1,073 | 3.578125 | 4 | [] | no_license | # coding: utf8
"""
Module containing ValueType and Unit subclasses associated with temperature.
"""
from fractions import Fraction
import typing
from .core import ValueType, Unit
class Temperature(ValueType):
display_name = 'Temperature'
class Kelvin(Unit):
value_type = Temperature
display_name = 'Kelvi... | true |
b40558e7572575af7650a421dbb3e2a89d053137 | Python | ruanramos/studies | /Hackerrank/py-collections-namedtuple.py | UTF-8 | 668 | 3.359375 | 3 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
from collections import namedtuple
student = namedtuple('student', 'marks classe name idt')
numAlunos = int(input())
order = input().split()
dic = {}
dic['idt'] = order.index('ID')
dic['marks'] = order.index('MARKS')
dic['classe'] = order.index(... | true |
f4ce76f426a4a2876cde5d085358fbff0bf19ae1 | Python | atharvap27/Forest-Cover-Project | /Predicting_DataTransformation/Prediction_DataTransformation.py | UTF-8 | 970 | 2.71875 | 3 | [] | no_license | import pandas as pd
from app_logger.App_Logger import App_logger
from os import listdir
class dataTransformPredict:
def __init__(self):
self.logger=App_logger()
self.goodData_path='Prediction_Rawfiles_after_validation/GoodData/'
def addQuotestoSringValuesInColumn(self):
log_f... | true |
26b79412a5c67ef94dddd2be43d0dc7a746b69de | Python | sjcoope/deepracer-reward-tests | /5_CornerSlowlyFastStraights/reward.py | UTF-8 | 1,558 | 3.1875 | 3 | [] | no_license | # Weightings
# -------------
WEIGHTING_CORNER_SLOW_FAST_STRAIGHTS = 1.25
# Reward Levels
# -------------
REWARD_LARGE = 1.25
REWARD_MED = 1.0
REWARD_SMALL = 0.75
REWARD_MIN = 1e-3
# Config
# -------
MAX_SPEED = 3
MIN_SPEED = 1
MIN_STEER = 0
def reward_function(params):
# Input parameters
speed = params['spee... | true |
0f3107b900b0dfbf04bd82f3cc1eb952920f2277 | Python | b-mohebali/AdaptiveStressTesting | /ActiveLearning/Sampling.py | UTF-8 | 17,574 | 2.96875 | 3 | [] | no_license | from yamlParseObjects.yamlObjects import VariableConfig
from typing import List
from samply.hypercube import cvt, lhs, halton
from enum import Enum
from .benchmarks import Benchmark
from sklearn import svm
from sklearn.metrics import accuracy_score,precision_score, recall_score,f1_score
import numpy as np
class Insuf... | true |
bc0368c0593a858669131e72ffc5e91bae60569d | Python | sigmayh/tryleetcode | /532 k-diff paris in an array.py | UTF-8 | 204 | 2.78125 | 3 | [] | no_license | def findpairs(num,k):
ans=0
nums=list(set(num))
for i in range (len(nums)):
for j in range (i,len(nums)):
if abs(nums[i]-nums[j])==k:
ans+=1
return ans
| true |
24aaa90fe2c60e6f53a6712370264430290d8ce4 | Python | ateoto/timetracker | /timetracker/__init__.py | UTF-8 | 1,486 | 2.6875 | 3 | [] | no_license | import argparse
from .timetracker import TimeTracker
def process_commands():
parser = argparse.ArgumentParser(description='Keep track of tasks and time.')
parser.add_argument('action', help='Start/stop tracking, sync database to server.')
parser.add_argument('taskname', nargs='?', help='Define a taskname ... | true |
aad38f28bb21d60ab7d22f0e7188f2d0577594e3 | Python | log2timeline/dftimewolf | /docs/generate_recipe_doc.py | UTF-8 | 5,068 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | """
Helper script to autogenerate documentation for recipes.
"""
import os
import sys
import json
import graphviz
from dftimewolf.lib import resources
# These are the first strings that will be generated in the file.
HEADER = """
# Recipe list
This is an auto-generated list of dfTimewolf recipes.
To regenerate thi... | true |
a7c5436de493807a8fcdae7d674a86a455790ca9 | Python | eunjoo-ny/Jenny_Eunjoo_2020 | /Python file/try_except_else_finally.py | UTF-8 | 385 | 3.625 | 4 | [] | no_license | try:
A=int(input("Insert the integer:"))
print("the radius of circle:",A)
print("the circumstance of circle:",2*3.14*A)
print("the area of circle:",3.14*A*A)
except:
print("You don't insert the integer. Check it please!")
else:
print("the program operates well")
finall... | true |
6cab7d641bf83c709d929e12018c99a84a2e2960 | Python | demisto/content | /Packs/DataminrPulse/Scripts/DataminrPulseTransformExtractedIndicatorsToList/DataminrPulseTransformExtractedIndicatorsToList.py | UTF-8 | 2,356 | 2.71875 | 3 | [
"MIT"
] | permissive | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
"""DataminrPulseTransformExtractedIndicatorsToList Script for Cortex XSOAR (aka Demisto)."""
''' STANDALONE FUNCTION '''
def flat_indicators(extracted_indicators: Dict) -> List:
"""Returns a python list of indicators with... | true |
1e1e23a17a51456dc3c7fd2064b034c81341e0cc | Python | PythonUnited/djinn_forms | /djinn_forms/fields/share.py | UTF-8 | 2,852 | 2.515625 | 3 | [] | no_license | from django.forms.fields import Field
from djinn_forms.widgets.share import ShareWidget
from djinn_core.utils import object_to_urn
class ShareField(Field):
""" Field for shares, inspired by RelateField """
widget = ShareWidget
def __init__(self, mode, content_types, *args, **kwargs):
self.mode... | true |
799eb46fc8d4157a5ac146e44afe56103ffb69bb | Python | reg1reg1/Exploits | /exploit-exercises/exploit education challenges/protostar/stack7.py | UTF-8 | 2,143 | 3 | 3 | [] | no_license | #!/usr/bin/python
#Tested on Ubuntu 16.04
'''
Return to text
pop pop ret
80485f7: 5b pop %ebx
80485f8: 5d pop %ebp
80485f9: c3 ret
0804:8492 pop ebx<-- beginnning of pop pop Return
Exploit because the return address cannot begin with 0xb. This means... | true |
31a66f7a36456abcc2dbe98b5653585cb6b8ac62 | Python | lovejing0306/TensorFlow | /project/object_detection/yolo_v3/utils/get_loss.py | UTF-8 | 4,463 | 2.78125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
from utils import IOU as get_IOU
def objectness_loss(input, switch, l_switch, alpha=0.5):
'''
Calculate the objectness loss
:param input: input IOU
:param switch: If target in this box is 1, else 1e-8
:param l_switch: Target in this box is 1, else 0
... | true |
c76fb0c6feabf9674abcd1eabbacb76b3fbe6879 | Python | comonadd/stemplates | /stemplates/template_renderer.py | UTF-8 | 471 | 2.75 | 3 | [
"MIT"
] | permissive | from renderer import render
def render_template(text: str, **params):
return render(text, **params)
def render_file(filename: str, **params):
with open(filename, "r") as f:
text = f.read()
return render_template(text)
def render_file_to(filename: str, out_file: str, **params):
with ope... | true |
cffdd8134f3c0510512e7db70d9515e694f0f000 | Python | krejiba/image-denoising-tensorflow | /autoencoder.py | UTF-8 | 1,845 | 2.546875 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras.layers import Input, Conv2D, MaxPool2D, UpSampling2D
# Sets the seed of the random number generator
tf.random.set_seed(10)
class AutoEncoder(tf.keras.Model):
def __init__(self, input_shape):
super(AutoEncoder, self).__init__(name='Autoencoder')
self... | true |
42bb1e927c21de78175de4cbd0e7fc57a51dfee9 | Python | sukharev/ucd | /pyradi/ryplanck.py | UTF-8 | 35,897 | 2.5625 | 3 | [] | no_license | # $Id: ryplanck.py 106 2012-11-02 10:32:27Z neliswillers@gmail.com $
# $HeadURL: http://pyradi.googlecode.com/svn/trunk/ryplanck.py $
################################################################
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use t... | true |
c3d5e905492962a237d66b637eced1f83f1f90e1 | Python | gubnota/convert_bkrs | /py/u/__init__.py | UTF-8 | 667 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""converting utf strings to unicode and vice-versa"""
__all__ = ('u', 'utf')
def u(s):
"convert anything to unicode"
if isinstance(s, unicode):
return s
try:
s = unicode(s)
except UnicodeDecodeError:
s = str(s)
s = s.decode("utf-8")
return ... | true |
f46eb39b15e3be1946a952f4b780848ac5ad798e | Python | sssunda/solve_algorithms | /programmers/collatz_conjecture.py | UTF-8 | 373 | 3.15625 | 3 | [
"MIT"
] | permissive | def solution(num):
cnt = 0
while num != 1 :
if cnt > 500 :
cnt = -1
break
# 짝수일 경우,
if num % 2 == 0 :
num = num // 2
# 홀수일 경우,
else :
num = (num * 3) + 1
cnt += 1
return cnt
if __name__ == '__main__':
... | true |
8c45780f2134c851b995d7903ffa4bb79b98795f | Python | Young-in/Stock-Trading-Bot | /src/crawler.py | UTF-8 | 4,494 | 2.640625 | 3 | [] | no_license | # Libraries for crawling
import requests
from bs4 import BeautifulSoup
import datetime
import util
# Libraries for data processing
import pandas as pd
import numpy as np
def checkStockCode(stock_code):
""" Check whether the stock code exists
Parameters
----------
stock_code : str
the st... | true |
49398653a943ae653390d00acd326fd313564d4f | Python | drray30/Machine_Learning | /HousingPricePredict/randomforestMelbHousing.py | UTF-8 | 2,114 | 3.5625 | 4 | [] | no_license | ### Reading and getting data
import pandas as pd
melbourne_file_path = '../input/melbourne-housing-snapshot/melb_data.csv'
melbourne_data = pd.read_csv(melbourne_file_path)
### Building model
# setting the predictor and the target variable
y = melbourne_data.Price # usually, we will make use of y as ... | true |
a33639e00c7a7b885e44454a466f8d559c0f6596 | Python | ekosman/CarNet | /Udacity_added_velocity/utils.py | UTF-8 | 5,042 | 2.875 | 3 | [] | no_license | import cv2
import matplotlib.image as mpimg
import numpy as np
import os
IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_CHANNELS = 66, 200, 3
INPUT_SHAPE = (IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_CHANNELS)
augment_prob = 0.7
brightness_low = 0.8
brightness_high = 1.2
translate_multiplier = 0.002
translate_range_x = 100
translate_range_... | true |
266b2721efbc36273dd6364192611cd6a9adc0e3 | Python | JulietaCaro/Programacion-I | /Trabajo Practico 4/Ejercicio 9.py | UTF-8 | 455 | 4.40625 | 4 | [] | no_license | # 9.Desarrollar una función que devuelva una subcadena con los últimos N caracteres de una cadena dada.
# La cadena y el valor de N se pasan como parámetros.
def ultimosNCaracteres(cadena, num):
return cadena[len(cadena)-num:]
def main():
cad = input("Ingrese una cadena: ")
num = int(input("Ingres... | true |
ac413a6df547ca5e47817fb61d16b074807b4c06 | Python | jiaohuixing/pythonStudy | /old/anjuke.py | UTF-8 | 2,505 | 2.515625 | 3 | [] | no_license | import requests
import lxml
import html5lib
from bs4 import BeautifulSoup
import random
from selenium import webdriver
url ='https://xa.anjuke.com/sale/changanb/?from=SearchBar'
def get_agent():
'''
模拟header的user-agent字段,
返回一个随机的user-agent字典类型的键值对
'''
agents = ['Mozilla/5.0 (compatible; MSIE 9.... | true |
12cec358e7a6bbf928edaf823c4f0033f3c17d01 | Python | Gayathrichennaioutlook/September-LeetCoding-Challenge | /Week-1/Day-2 Contains Duplicate III.py | UTF-8 | 1,415 | 3.875 | 4 | [
"MIT"
] | permissive | Day-2 Contains Duplicate III.py
/*
Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and nums[j] is at most t and the absolute difference between i and j is at most k.
Example 1:
Input: nums = [1,2,3,1], ... | true |
156014cbaf0ef891509914187e8e8106efe4f8d2 | Python | abhishekjani123/CodeChef_SolvedQuestions | /FCTRL2.py | UTF-8 | 178 | 3.3125 | 3 | [] | no_license | import math
def fact(t):
for x in range(t):
n = int(input())
print(math.factorial(n))
if __name__ == '__main__':
ans = int(input())
fact(ans)
| true |
58a55484f14f84b66b74d4f9853cc48cdff77525 | Python | winnychenn/line-bot-python | /supermg.py | UTF-8 | 558 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
# coding=utf8
import configparser
config = configparser.ConfigParser()
# 讀取 INI 設定檔
config.read('config.ini')
def write_doc(string,string2,string3):
config[string2][string] = string3
with open('config.ini', 'w') as configfile:
config.write(configfile)
def read_doc(string,string2):
tx... | true |
9998b95556b6792c7faba101a7ecbb8dbed60cb1 | Python | praveencali2017/file_uploader_fr | /uploader_back_end/utils/db_helper.py | UTF-8 | 1,587 | 2.8125 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy import Column, String, Integer
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from config.default import DB_HOST, DB_THREAD
engine = create_engine(DB_HOST+DB_THREAD, echo = False)
Base = declarative_base()
Session= ses... | true |
44410fddc6e0574d730259c5fa74435abd83c5d6 | Python | Besla-Team/jellyfish | /jellyfish/abundanceMatching.py | UTF-8 | 7,260 | 2.96875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
###################################################
# Katie Chamberlain - February 2019 #
# Abundance matching code relating stellar mass #
# to halo mass for a galaxy/DMH #
# ... #
# Follo... | true |
e64be605f7880a049937c704b6c9156c2eb93dea | Python | rodrigolll/python | /triangle.py | UTF-8 | 840 | 3.28125 | 3 | [] | no_license | from tkinter import *
import random
w = 400
h = 400
tk = Tk()
canvas = Canvas(tk... | true |
3ae25df34da3bba1535c152a4c215f4937abe059 | Python | VolkerH/jupyter-desktop-connection-tool | /connection_tool/ssh_connect_gui.py | UTF-8 | 2,985 | 2.515625 | 3 | [] | no_license | from PySimpleGUI.PySimpleGUI import I, InputText
from ssh_connect import *
from ssh_connect import _save_settings_json, _read_settings_json
from pathlib import Path
import inspect
import PySimpleGUI as sg
import webbrowser
CONNECT = "Connect to Server"
START = "Start Jupyter Desktop"
KILL = "Kill Jupyter Desktop"
DISC... | true |
60e2b8d5712aaada3a3aea3e68f0c241af853b59 | Python | hadaytullah/sa_port | /simulation.py | UTF-8 | 3,311 | 3.234375 | 3 | [] | no_license | """Main functionality for creating and executing simulations.
"""
import random
from base_system.berth import Berth
def create_berths(n_terminals, add_neighbors=True, **kwargs):
"""Convenience function to create a number of berths with given kwargs.
"""
agents = []
for i in range(n_terminals):
... | true |
f688390ce4afd6207dad78e37fc4e977623dccbe | Python | RobinDePauw/HashCode19 | /src/InputParser.py | UTF-8 | 839 | 3.234375 | 3 | [] | no_license | from Photo import Photo
class InputParser:
class Photo:
def __init__(self,id,orientation,n_tags,tags):
self.id = id
self.orientation = orientation
self.n_tags = n_tags
self.tags = tags
def parse(self,filename):
inputfile = open(filename, 'r')
... | true |
c98ace15496ea2143a86e0f2646c611369b13158 | Python | volnt/pyriot | /pyriot/game/game.py | UTF-8 | 931 | 2.515625 | 3 | [] | no_license | from pyriot.entity import Entity
class Player(Entity):
def __init__(self, **kwargs):
Entity.__init__(self, **kwargs)
def __repr__(self):
return "%s(%r)" % (self.__class__, self.__dict__)
class RawStats(Entity):
def __init__(self, **kwargs):
Entity.__init__(self, **kwargs)
def... | true |
a1466aadc201867035e4ed8b75b9a240a392621c | Python | thedod/redwind | /redwind/plugins/hentry_template.py | UTF-8 | 1,141 | 3.015625 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive |
def fill(author_url=None, author_name=None, author_image=None, pub_date=None,
title=None, content=None, permalink=None):
html = """<html><body><div class="h-entry">\n"""
if author_name or author_image or author_url:
html += """<div class="p-author h-card">\n"""
if author_url:
... | true |
f8b11915b1ff14ffa31c202c308e21c774e97e3d | Python | jaymin1570/PythonTutorial | /chapter17/builtin_error.py | UTF-8 | 447 | 3.59375 | 4 | [] | no_license | # built in error
# exception ,how to handle them
# raise your own error, debugging etc.
# syntax error
# def func:
# pass
# indentation error
# def func():
# print('hello')
# print('world')
# name error
# print(name)
#type error
# print('jaymin' +5)
# index error
# l=[1,2,3]
# print(l[4])
#value error... | true |
ebb783b68b53c8258dfda41e7568a360dd9e9797 | Python | michael-michelotti/blackjack | /events/turns.py | UTF-8 | 2,588 | 3.546875 | 4 | [
"MIT"
] | permissive | from cards.card import render_card_back
def handle_player_turns(table):
dealer = table.dealer
dealer_card = dealer.hand[0]
print(f'Dealer\'s hand:')
print(dealer_card.render())
print(render_card_back())
for player in table.players:
print(f'{player.name}\'s turn:')
print(f'{pl... | true |
0d069ccf49ed10bc9666b7151c4d4be091fa03cf | Python | Ryan-Kong/Python-learning | /list.py | UTF-8 | 352 | 3.8125 | 4 | [] | no_license | L = ['a','b','c','d','e','f'] # 列表可变
print(L[0:3]) # 取列表L的前3个元素
print(L[:3]) # 还是取前三个元素
print(L[-6:-3]) # 还是前三个元素
T = ('a','b','c','d','e','f') # 元祖不可变
print(T[0:3]) # 元祖也可以切片操作
a = 'abcdefghijklmnopqrstuvwxyz' # 字符串也可以操作切片
print(a[:3]) | true |
b1d9fef7be4419e2730333f1ad340ffc4e466ead | Python | rohankhatwani/Playing-With-Turtle | /test3.py | UTF-8 | 164 | 3.796875 | 4 | [] | no_license | import turtle
import math
bob = turtle.Turtle()
bob.color("red","yellow")
bob.speed(10)
for i in range(2000):
bob.forward(math.sqrt(i))
bob.left(i%180) | true |
17e62de93a3a56d9128829f49b98b6f89f6c797b | Python | L-IG/PythonProject | /code_oldboy/面向对象/面向对象初级/接口类与抽象类.py | UTF-8 | 3,807 | 3.625 | 4 | [] | no_license | '''
作者:lg
日期:2019/11/22
文件描述:
缺陷:
'''
# 概念来源:
# java : 面向对象编程
# 设计模式 —— 接口
# 接口类 : python原生不支持
# 抽象类 : python原生支持的
# 在python里这两个很类似,在其他语言里则有区别
from abc import abstractmethod, ABCMeta # 元类 默认的元类 type
class Pay_Ment(metaclass=ABCMeta):
@abstractmethod
def pay(self, money):
pass
# raise NotIm... | true |
6a4ce71edec89ed305324185096263e37e81f610 | Python | CodeHemP/CAREER-TRACK-Data-Scientist-with-Python | /25_Supervised Learning with scikit-learn/03_Fine-tuning-your-model/03-plotting-an-roc-curve.py | UTF-8 | 1,725 | 3.9375 | 4 | [
"MIT"
] | permissive | '''
03 - Plotting an ROC curve
Great job in the previous exercise - you now have a new addition to your toolbox of
classifiers!
Classification reports and confusion matrices are great methods to quantitatively evaluate
model performance, while ROC curves provide a way to visually evaluate models. As Hugo
demonstra... | true |
22293305ea035b2911ab9e0bea7603138d9c5651 | Python | renukamani/topgear_python | /even_odd19.py | UTF-8 | 320 | 3.203125 | 3 | [] | no_license | for i in range(100) :
i = i+1
if i == 50 :
break
elif i in [10,20,30,40,50] :
continue
elif i % 2== 0 :
print(i)
i = 1
while i <= 100 :
if i == 90 :
break
elif i in [60,70,80,90] :
i += 1
continue
elif i % 2 == 0 :
print(i)
i += 1
| true |
f612bc40aabf0286335068417f62474cecfc89b3 | Python | inabakaiso/MLTraining-Project | /categorical_feature_encoding/src/train.py | UTF-8 | 1,447 | 2.65625 | 3 | [] | no_license |
import joblib
import config
import os
import pandas as pd
from sklearn import metrics
import model_dispatcher
import argparse
def run(fold, model):
# import pdb
# pdb.set_trace()
df = pd.read_csv(config.FOLDS_PATH)
df_train = df[df.kfold != fold].reset_index(drop=True)
df_valid = df[df.kfold ... | true |
d9f0163e58943312accaf0fe9e64ea6d6e794230 | Python | WeiHsinChen/Political-Analysis | /Visualization.py | UTF-8 | 10,170 | 2.734375 | 3 | [] | no_license | from __future__ import print_function
import numpy as np
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from mpl_toolkits.basemap import Basemap as Basemap
from matplotlib.colors import rgb2hex
from matplotlib.patches import Polygon
class Visu... | true |
a0584d0f666017693d32b6bbe381ad10a95473c8 | Python | jreeder/JRNN | /Experiments/JRNN_Experiments/src/ReadDebugFile.py | UTF-8 | 425 | 2.84375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri May 10 21:24:28 2013
@author: John
"""
import re
from collections import defaultdict
variables = re.compile('(\S+?: \S+)\b')
name = re.compile("^(.+) ValSums")
def readIn(fileh):
data = defaultdict(list)
for line in fileh:
vName = name.search(line).groups()... | true |
9101ac220fa91d7adae270dffc955d85f3f233d4 | Python | punitjha/CHEM_548_Project_2 | /correlation_plots.py | UTF-8 | 425 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 11 14:06:56 2017
@author: punit
"""
import matplotlib.pyplot as plt
import numpy as np
corr=np.loadtxt('correlation.txt')
time=np.loadtxt('time.txt')
plt.plot([],'r--', label="Correlation Function")
#for col in range(0,10):
# if(col%2==0):
... | true |
d2fe794842d1961b4d79abd00930a86fa48a9057 | Python | MansiShah1999/Artificial_Intelligence | /tictactoe/tictactoe.py | UTF-8 | 3,204 | 3.84375 | 4 | [] | no_license | """
Tic Tac Toe Player
"""
import math
import copy
X = "X"
O = "O"
EMPTY = None
def initial_state():
"""
Returns starting state of the board.
"""
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]]
def player(board):
"""
Returns player who h... | true |
55c822a97bfa33f0579f8d1c8b0fe74b1e26d7f4 | Python | Deba1998/coding | /python/2substrings.py | UTF-8 | 645 | 2.984375 | 3 | [] | no_license | s=input()
n=len(s)
l=[]
k=[]
for i in range(n-1):
if s[i]=="A" and s[i+1]=="B":
l.append([i+1,i])
if s[i]=="B" and s[i+1]=="A":
k.append([i,i+1])
if len(l)==0 or len(k)==0:
print("NO")
else:
if abs(len(l)-len(k))>0 and (len(l)>2 or len(k)>2):
flag=1
else:
flag=0
... | true |
3b32adacce39464762f7460d90c4e33ae28c8fe8 | Python | Jyotsna1292/POC | /module20, ensemble models/assign1.py | UTF-8 | 2,293 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 13 22:46:12 2020
@author: USER
"""
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import Bag... | true |