blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
56b09cc74fba45102c2b8374f1fd7f28ad356abf | Python | sedthh/lara-hungarian-nlp | /examples/example_chatbot_1.py | UTF-8 | 1,263 | 2.96875 | 3 | [
"MIT"
] | permissive | # -*- coding: UTF-8 -*-
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from lara import parser, entities
''' Basic Chatbot that just prints out replies '''
if __name__ == "__main__":
user_text = 'Szia! Szeretnék rendelni egy sajtos pizzát szalámival!'
#... | true |
dcb05ac6de0b42f0ea0f52dacb0b3a73b62f2043 | Python | lbinmeng/EEG_poisoning_attack | /methods.py | UTF-8 | 2,418 | 2.984375 | 3 | [] | no_license | import numpy as np
import scipy.signal as signal
def pulse_noise(shape, freq, sample_freq, proportion, phase=.0):
""" generate pulse noise """
length = shape[2]
t = 1 / freq
k = int(length / (t * sample_freq))
pulse = np.zeros(shape=shape)
if k == 0:
pulse[:, :, int(phase * t * sample... | true |
4be6994bd472da2db1a5a636be074e0eb32cdec0 | Python | sebastianbautista/bikeparts | /mine/DarkSky AWS Working.py | UTF-8 | 764 | 2.546875 | 3 | [] | no_license | import psycopg2
import pandas as pd
import os
from pathlib import Path
from dotenv import load_dotenv
env_path = Path('~/git/Bikeshare-DC') / '.env'
load_dotenv(dotenv_path=env_path)
host = "capstone-bikeshare.cs9te7lm3pt2.us-east-1.rds.amazonaws.com"
port = 5432
database = "bikeshare"
user = os.environ.get("AWS_RE... | true |
fc515e580213c285aba336c8ac2785b326490769 | Python | dobigergo/fordito_programok | /elemzo.py | UTF-8 | 2,464 | 2.703125 | 3 | [] | no_license | #vilmos12>=231<>péter(*{izé}**){nem} --- <azonosító><nagyobbegyenlő><szám><nemegyenlő><azonosító><kommentár(**)><kommentár{}>
false=False
true=True
str=input()
atmenet_vektor=["","","{","}","(","*",")",":","=","<",">"," "]
atmenet={
"start" : [2,4,6,19,8,19,19,12,19,14,17,1,19,21,false,true],
"azonosító": [2,2,3,3,3,3... | true |
a8e03b233d7eb96eebbbb69ff445dc3a4ce478d0 | Python | joohyun333/programmers | /백준/자료구조/스택수열.py | UTF-8 | 437 | 3.078125 | 3 | [] | no_license | from sys import stdin
n = int(stdin.readline())
in_ = [int(input()) for i in range(n)]
temp = True
cnt, stack, result = 1, [], []
for i in in_:
print(i, cnt, stack, result)
while cnt <= i:
stack.append(cnt)
result.append('+')
cnt+=1
if stack.pop() != i:
temp=False
bre... | true |
1590ab481fa607dab8b77b2da9b52e366557fe89 | Python | xhalo32/advpy | /rsc/games/game03/main.py | UTF-8 | 2,417 | 2.546875 | 3 | [] | no_license | import pygame as p
import time
from random import *
from math import *
from message import *
from handler import *
from utils import *
p.init( )
p.font.init( )
class Main:
def __init__( self ):
self.size = ( 800, 600 )
self.scr = p.display.set_mode( self.size, p.FULLSCREEN )
self.active = 1
self.FP... | true |
842bd4ce48af6f496dd9b5eede3821505efc0ae3 | Python | suntyneu/test | /test/面向对象/__new__.py | UTF-8 | 678 | 4.09375 | 4 | [] | no_license | # __new__
"""
触发时机:初始化对象时出发(不是实例化对象,但是和实例化在一个操作中)
"""
class Person(object):
def __init__(self, name):
print("---------->init")
self.name = name
def __new__(cls, *args, **kwargs):
print("------------>new")
p = Person("jack")
class newStyleClass(object):
# In Python2, we need to... | true |
31d46626364c4b16708893b0dc8040337397227e | Python | aliharakeh/M2-Project | /Project_Final_Scripts/hotspots/extra/filter_tweets.py | UTF-8 | 1,376 | 3 | 3 | [] | no_license | from Language.lang_detection.lang_words import is_arabic, is_english
import re
import json
WORDS = ['corona', 'كورونا', '_', 'covid', 'http']
def within_removed_words(word):
for w in WORDS:
if w in word:
return True
return False
if __name__ == '__main__':
total_count = 0
tweets_... | true |
8c4b40d951b26cfd05b000c4f815f8ee8193deeb | Python | Dartspacephysiker/hatch_python_utils | /math/vectors.py | UTF-8 | 686 | 3.53125 | 4 | [] | no_license | import numpy as np
def dotprod(a,b):
"""
dp = dotprod(a,b)
Assuming a and b are arrays of N three-dimensional vectors
(i.e., they have shape (N, 3)), return an array of N values.
Each value corresponding to the dot products of a pair of vectors in a and b.
SMH
Birkeland Centre for Space ... | true |
a594abbfb952c12b5b3a57637b66faafdc31d295 | Python | tartakynov/sandbox | /hackerrank/algorithms/dynamic-programming/coin-change.py | UTF-8 | 653 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
"""
https://www.hackerrank.com/challenges/coin-change/problem
"""
def coin_change(memo, n, m, coin_types):
if n == 0:
return 1
if n < 0:
return 0
if m <= 0:
return 0
if memo[n][m] == -1:
memo[n][m] = coin_change(memo, n, m - 1, coin_types) + coin_... | true |
cd3e4e6e605a348d7d774e0c4738f6d825068619 | Python | anshu3012/ENPM-661-Project-3 | /A_star_implemented_resized.py | UTF-8 | 28,761 | 3.015625 | 3 | [] | no_license | import numpy as np
import cv2
import math
# To check if the new point lies in the circle obstacle
def check_obstacle_circle(point, dimension, clearance):
increase = dimension + clearance
center = [225, 50]
point_x = point[0]
point_y = point[1]
dist = np.sqrt((point_x - center[0]) ** 2 + (point_y -... | true |
c6a814c69b271b6b0793034c6fb853889305b346 | Python | BickfordA/Presidential | /TwitterSearch/search.py | UTF-8 | 3,359 | 2.703125 | 3 | [] | no_license | import twitter
import json
import argparse
import sys
reload(sys)
sys.setdefaultencoding("ISO-8859-1")
from urllib import unquote
# XXX: Go to http://dev.twitter.com/apps/new to create an app and get values
# for these credentials, which you'll need to provide in place of these
# empty string values that are define... | true |
e5047cd88e17cb201a24af6465b342d4d96f8a80 | Python | esterjara/experiment-notebook | /enb/experiment.py | UTF-8 | 11,959 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""Tools to run compression experiments
"""
__author__ = "Miguel Hernández-Cabronero"
__since__ = "2019/09/19"
import os
import collections
import itertools
import inspect
import enb.atable
import enb.sets
from enb import atable
from enb import sets
from enb.config import options
class Experi... | true |
c068e36257341a4454619243a350699216c275fb | Python | exo7math/cours-exo7 | /fpv/python/fonctions_extremlie_1.py | UTF-8 | 1,886 | 3 | 3 | [] | no_license |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
n = 50
VX = np.linspace(-1.5, 1.5, n)
VY = np.linspace(-1.5, 1.5, n)
X,Y = np.meshgrid(VX, VY)
def f(x,y):
return x**2 + 2*y**2
Z = f(X,Y)
# Droite y = 2x-1
LX = np.linspace(-0.25, 1.25, n)
LY = 2*LX - 1
LZ = f(LX,LY)... | true |
05642963d0e18c865eb43210cf8ed33dac89159c | Python | ObinnaObeleagu/evalml | /evalml/data_checks/data_check_message.py | UTF-8 | 2,159 | 3.1875 | 3 | [
"BSD-3-Clause"
] | permissive | from .data_check_message_type import DataCheckMessageType
class DataCheckMessage:
"""Base class for a message returned by a DataCheck, tagged by name.
Arguments:
message (str): Message string
data_check_name (str): Name of data check
message_code (DataCheckMessageCode): Message code a... | true |
38c4d9c14cbca9fff76dec2b7999d6a645e5f283 | Python | aviaowl/pandas_assignments | /assignment2.py | UTF-8 | 4,714 | 3.5 | 4 | [] | no_license | import pandas as pd
import sys
pd.set_option('display.max_rows', None)
df = pd.read_csv('source/olympics.csv', index_col=0, skiprows=1)
census_df = pd.read_csv('source/census.csv')
"""
The following code loads the olympics dataset (olympics.csv), which was derrived from the Wikipedia entry on
All Time Olympic Games ... | true |
583baac569449e42a61ca87f8998c6013ce7ce7f | Python | JesusMartinezCamps/GildedRose | /agedBrieTest.py | UTF-8 | 296 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#Caso test del aged brie
from clases import *
if __name__ == '__main__':
item = agedBrieTest("Aged Brie", 2, 0)
# chequeo herencia __repr__
print(item)
# test update_quality
for dia in range(1, 10):
item.update_quality()
print(item)
| true |
79394a612138bce55ebe5899b413fca30175db53 | Python | rkhous/Clemont | /clemont.py | UTF-8 | 4,760 | 2.546875 | 3 | [
"MIT"
] | permissive | import discord
from discord.ext import commands
from bot import *
from config import *
from requirements import *
from geopy.distance import great_circle
bot = commands.Bot(command_prefix='//')
@bot.event
async def on_ready():
print('-' * 15)
print('Clemont is now online')
print('-' * 15)
@bot.event
asyn... | true |
48ea525cfbe4c2ad09aba30955c4ae7aa3c2d288 | Python | danielzoch/pocketDSTR | /scripts/dstr.py | UTF-8 | 1,981 | 2.734375 | 3 | [] | no_license | # This file was made by Daniel Zoch and Daniyal Ansari for the Mobile Integrated Solutions Laboratory
# at Texas A&M University. Special thanks to TStar and Matthew Leonard for the rights to the DSTR kit.
# This code was used to run a DSTR (Digital Systems Teaching & Research) robot using the Pocketbeagle.
import soc... | true |
283f50cceb213b457e40fd522ad1b0040e0c4f6b | Python | winstonhd/my_spider | /core/utils.py | UTF-8 | 3,844 | 2.734375 | 3 | [] | no_license | import re
import tld
import math
from core.config import badTypes
try:
from urllib.parse import urlparse
except:
from urlparse import urlparse
def extract_headers(headers):
"""从交互式输入中提取有效的 headers"""
sorted_headers = {} # 先定义一个空字典
# findall(pattern, string),返回headers中所有与前面的正则表达式相匹配的全部字符串,返回形式为列表,类... | true |
08fcb03faf39cc8023aa02624765381eaf34d068 | Python | pedroriosg/IIC2233 | /pedroriosg-iic2233-2020-2/Tareas/T01/main.py | UTF-8 | 6,169 | 2.75 | 3 | [] | no_license | import menus
import funciones
import funciones_bitacora
import parametros as p
from campeonato import Campeonato
ejecucion_general = True
while ejecucion_general:
# Acá se muestra el Menú de inicio
habilidad_especial = True
opcion_inicio = menus.menu_inicio()
if opcion_inicio == "0":
# Acá se f... | true |
affbb60b7d05d76cfaebe7013f07b40590b8b34d | Python | m-elhussieny/code | /maps/build/EnthoughtBase/enthought/util/Worker.py | UTF-8 | 2,462 | 3.09375 | 3 | [] | no_license | #------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describ... | true |
a164d086f0540e4488276a3ab5465ed357aeac58 | Python | dayanandtekale/Python-Programs- | /Abstraction.py | UTF-8 | 1,309 | 3.390625 | 3 | [] | no_license | # Abstraction
from abc import ABC, abstractmethod, ABCMeta, abstractclassmethod, abstractstaticmethod, abstractproperty
class Shape(metaclass=ABCMeta):
@abstractmethod
def area(self): pass
@abstractmethod
def perimeter(self): pass
@abstractstaticmethod
def static_method(): pass
cl... | true |
4ff98d5a25efb749d2669885777f4948c1900aa1 | Python | KearaBerlin/Crosswords | /src/Intersection.py | UTF-8 | 337 | 3.046875 | 3 | [] | no_license | """
Represents two words and the index within each word where they intersect one another
"""
class Intersection:
def __init__(self, acrossWord, downWord, acrossWordIndex, downWordIndex ):
self.across = acrossWord
self.down = downWord
self.acrossIndex = acrossWordIndex
self.downIndex... | true |
d8efa80a55e0e21e63b8630b93ded62315e8027e | Python | BenjaminBeni/BenjaminBeni.github.io | /Computer Logics/PropozitiiLC/valoareadevar.py | UTF-8 | 1,854 | 2.875 | 3 | [] | no_license | from functiiptimport import *
print("Pentru simbolul IMPLICA folositi '>'")
print("Pentru simbolul ECHIVALENT folositi '='")
print("Pentru simbolul SAU folositi '/'")
print("Pentru simbolul SI folositi '&'")
print("Pentru simbolul NEGATIE folositi '!'")
print("Pentru simbolul TAUTOLOGIE folositi '1'")
print("Pentru sim... | true |
250439d81fb89d5bdf98d14486324f2e6a30c493 | Python | macaty/opsany-paas | /saas/deploy.py | UTF-8 | 8,636 | 2.65625 | 3 | [
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0",
"Apache-2.0"
] | permissive | """
脚本说明:部署SaaS脚本
文件命名要求:必须为 app_code + "-" + paas_domain + "-" + version + ".tar.gz"
执行说明:python deploy.py --domain [paas_domain] --username [paas_admin_user_name] --password [paas_admin_user_password] --file_name [file1] [file2] [file3]
例:python deploy.py --domain 192.168.56.11 --file_name rbac-192.168.56.1... | true |
dd355c6a9d16772dd289cef49453e5afa13c7dd5 | Python | dongkwan-kim/BubblePop | /bubblepopApi/submodules/url_strip.py | UTF-8 | 103 | 2.90625 | 3 | [
"MIT"
] | permissive | def url_strip(url):
idx = url.find('?')
if(idx==-1):
return url
return url[:idx]
| true |
04db83aaea5af736c0bd3a1bb9b3bf26fd077eab | Python | gustavo-mota/programming_fundamentals | /1_Primeira_lista/Algoritmo F/AlgoritmoF.py | UTF-8 | 135 | 3.46875 | 3 | [] | no_license | #ALgoritmo item F
lado = float(input("Digite o valor do lado do quadrado: "))
area = lado*lado
print("A area do quadrado vale: ", area) | true |
d676392872e2cae18c29dfaa667dedbe8dcf16c8 | Python | psideleau/wireless-remote-app | /user.py | UTF-8 | 641 | 2.5625 | 3 | [] | no_license | class User:
def __init__(self,username,password):
self.username = username
self.password = password
class RegUser:
def __init__(self, username, password, email, fname, lname):
self.username = username
self.password = password
self.email = email
self.fname... | true |
3a5069c0c9f1d9438d9b281e2d0553c9798f2ba7 | Python | Burane/CalculatingPi | /Damien/python/calcul suite.py | UTF-8 | 345 | 2.703125 | 3 | [] | no_license | from math import *
from decimal import *
def pi(n):
getcontext().prec = 323
p = 0
r=0
for k in range(0, n):
r=Decimal(((-1)**k)/((2*k+1)*3**k))
p = Decimal(p) + Decimal(((-1)**k)/((2*k+1)*3**k))
p = Decimal(12).sqrt() * Decimal(p)
return Decimal(p) ,"nombre décimal sur :", int(l... | true |
c830cbda2235a676578485d51af71055b03b613c | Python | fabiocostadeoliveira/DiffDBProgressOpenedge | /test_geral.py | UTF-8 | 9,081 | 2.703125 | 3 | [] | no_license | import unittest
from exec import executa_diferenca
class TesteGeral(unittest.TestCase):
def test_tabela_add(self):
df1 = "testes/arq/dfTable1_d1.df"
df2 = "testes/arq/dfTable1_d2.df"
f = open(df1, 'r', encoding="utf-8", errors='ignore')
strcompara = f.read() + '\n'
self.as... | true |
7273d9e82981979b990e34a59c9056b5aec7b745 | Python | dvu4/udacity | /Project 5/Project5-2 Reducer.py | UTF-8 | 768 | 3.59375 | 4 | [] | no_license | import sys
def reducer():
'''
Given the output of the mapper for this assignment, simply print
0 and then the average number of riders per day for the month of 05/2011,
separated by a tab.
There are 31 days in 05/2011.
Example output might look like this:
0 10501050.0
'''
... | true |
a6b89ca878f08ee1ab5c56bbc6425986f9da515f | Python | rguilmain/project-euler | /tests/euler010_test.py | UTF-8 | 350 | 2.890625 | 3 | [] | no_license | import unittest
from solutions import euler010
class ProjectEuler010Tests(unittest.TestCase):
def test_Given(self):
self.assertEquals(euler010.get_sum_of_primes(upper_limit=10), 17)
def test_Answer(self):
self.assertEquals(euler010.get_sum_of_primes(upper_limit=2000000), 142913828922)
if __name__ == ... | true |
d8d286f9e146e6b0d74f6bebfd377fa4698afeb8 | Python | kmrgaurav11235/PythonProBootcamp | /section_04_intermediate/lesson_04_india_states_game/get_mouse_click_coordinates.py | UTF-8 | 328 | 3.265625 | 3 | [] | no_license | import turtle
def get_mouse_click_coordinate(x, y):
print(x, y)
IMAGE_PATH = "blank_states_img.gif"
screen = turtle.Screen()
screen.title("India States Game")
screen.setup(height=1000, width=1000)
screen.addshape(IMAGE_PATH)
turtle.shape(IMAGE_PATH)
turtle.onscreenclick(get_mouse_click_coordinate)
turtle.ma... | true |
ceb95496ebe1dd33c299f2ba70ddd2c4688e5bde | Python | hainamnguyen/data-structure-and-algorithm-coursera-ucsd | /Coding/String/Week_4/suffix_array_matching/suffix_array_matching.py | UTF-8 | 3,762 | 2.71875 | 3 | [] | no_license | # python3
import sys
def PreprocessBWT(bwt):
starts = {'A' : 0, 'C' : 0, 'G' : 0, 'T' : 0, '$': 0}
occ_count_before = {'A' : [0], 'C' : [0], 'G' : [0], 'T' : [0], '$' : [0]}
sortedBwt = sorted(bwt)
for i in starts:
try:
starts[i] = sortedBwt.index(i)
except:
starts[i] = float('inf')
c... | true |
4a61edb71e0a254bf28c4e90209c09441c69abda | Python | fatlotus/lsda-automation | /quota_emailer.py | UTF-8 | 3,589 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#
# A persistent worker daemon to notify me with regular updates of how much quota
# is left for each user.
#
# Author: Jeremy Archer <jarcher@uchicago.edu>
# Date: 12 January 2013
import boto.ses
from kazoo.client import KazooClient
import datetime, time, yaml, logging
def trigger_update(zook... | true |
a643c25c068394452fb250fbe273081aa4764090 | Python | noorulameenkm/DataStructuresAlgorithms | /Graph/bfs.py | UTF-8 | 1,233 | 3.578125 | 4 | [] | no_license | import queue
class Graph:
def __init__(self, nodes, edges):
self.nodes = nodes
self.edges = edges
self.graph = [[0 for i in range(self.nodes)] for j in range(self.nodes)]
def constructGraph(self,edge_list):
for edge in edge_list:
x, y = edge
... | true |
38e10c3decfc110bd6abaeacd18e8eda3c164371 | Python | alexZeLoCO/Subrutinas1 | /Ejercicio7.py | UTF-8 | 706 | 4.15625 | 4 | [] | no_license | from math import sqrt
from math import pow
def leeValor(): #Subrutina leeValor():
"""
Devuelve un valor introducido por teclado
:return: valor - Introducido por el usuario
"""
valor=float(input("Introduzca un valor: ")) #Solicita valor
return valor #Devuelve valor
def di... | true |
69d46ffae5ff5098443002127463067917e9bfae | Python | andreyskv/rosalind-solutions | /CONS.py | UTF-8 | 644 | 3.03125 | 3 | [] | no_license | # Consensus and Profile
# Read FASTA format file
file = open("Data/CONS.txt")
sample = file.read()
# Convert FASTA string into dictonary
entries = dict(map(lambda e:[i.replace('\n','') for i in e.split('\n',1)][::-1], sample.lstrip('>').split('>')))
dna_list = list(entries.keys())
n = len(dna_list[0])
nt = ... | true |
5d7bd65b61c73d3a83b5769dbfa13001fbb56829 | Python | einav19-meet/y2s18-python_review | /exercises/while.py | UTF-8 | 60 | 3.21875 | 3 | [
"MIT"
] | permissive | i=1
sum=0
while sum < 10000:
i = i+1
sum = sum+i
print(i)
| true |
c2fde5d644192b9e648da3d71d65d218ae21fafb | Python | Andos25/CodeforFundFlow | /stephanie/predict_models/GBDT.py | UTF-8 | 2,407 | 2.90625 | 3 | [] | no_license | # coding=UTF-8
import numpy as np
import matplotlib.pyplot as plt
from sklearn import ensemble
from sklearn import datasets
from sklearn.utils import shuffle
from sklearn.metrics import mean_squared_error
#############################################################
def load_data():
boston = datasets.load_boston(... | true |
b7cb71098f9b223146dcfa138d696d5432d03089 | Python | mamadouAmar/3pions | /moteur.py | UTF-8 | 4,394 | 3.265625 | 3 | [] | no_license |
class Plateau:
def __init__(self):
for ligne in range(3):
for colonne in range(3):
self.plateau[ligne][colonne] = "vide"
self.alignement = "null"
def est_vide(self, ligne, colonne):
if self.plateau[ligne][colonne] == "vide":
return True
... | true |
aea8561c4208249e3a1be201b6cefdaec969a4aa | Python | Jithinkg/AQI_Data_Science | /Html_script.py | UTF-8 | 1,537 | 3.296875 | 3 | [] | no_license | import os
import time #time taken to extract all html files
import requests #download that part. webpage in form of html
import sys
def retrieve_html():
for year in range(2013,2019): #to collect data from 2013 to 2018
for month in range(1,13): #for 12 month
if(month<10):
... | true |
d5642577f3f52f9f8dbb4425b3a2dd4ef994e895 | Python | zcmarine/continued_cs | /continued_cs/algorithms/tower_of_hanoi/__init__.py | UTF-8 | 2,881 | 3.640625 | 4 | [] | no_license | import logging
from continued_cs.data_structures.stack import Stack
LOG_FORMAT = '%(levelname)s:%(filename)s:%(funcName)s:%(lineno)s - %(message)s'
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
logger = logging.getLogger(__name__)
START = 0
END = 2
EXTRA = 1
class ItemTooLargeError(Exception):
... | true |
aa5369679a9585adafb46e3beb84215f9250df28 | Python | amreis/dojo-ufrgs | /11-04-18/santa.py | UTF-8 | 492 | 3.375 | 3 | [] | no_license | import random
from copy import copy
class Santa():
def __init__(self,nameslist):
self.people = nameslist.split("\n")
def getPeople(self):
return self.people
def sorteio(self):
sorteado = {}
pegaveis = copy(self.people)
for person in self.people:
if(person in pegaveis):
pegaveis.remove(person)
... | true |
b8a575ed06450e634d5a32eef0bb5700ce3d7ed2 | Python | emmaping/leetcode | /Python/Binary Tree Preorder Traversal.py | UTF-8 | 510 | 3.46875 | 3 | [] | no_license | class Solution:
# @param root, a tree node
# @return a list of integers
def preorderTraversal(self, root):
nodes = []
result = []
if root== None:
return result
nodes.append(root)
while nodes:
node = nodes.pop()
... | true |
6ba3cc19de2b14e31e444d86b0e1d6e7b6f90ef1 | Python | 0kd/kadai | /tucom4.py | UTF-8 | 5,286 | 2.796875 | 3 | [] | no_license | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
チューリングパターンのシミュレーションは通常微分方程式を用いて行われるが、
ここではグラフ理論を用いて、周囲六個の分子と接する10000個の色素分子のシミュレーションをする。
二種類の色素分子について、
1.周り一周の色素分子のうち色が異なるものが4種類以上なら、裏返す
2.周り二周の色素分子と色が同じならば、裏返す
という二つの性質を仮定すると、蛇のような模様ができる。
2015/5/3に放送された「目がテン!大実験…オセロの石で生き... | true |
6b0558d2dace8e8d86ef16a6699cd88b93ff67c6 | Python | DKRZ-AIM/mardata-training | /Hands-On ML Bootstrap envtest/utils/visualize_tree.py | UTF-8 | 2,254 | 3 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import warnings
def visualize_tree(
estimator,
X, y,
boundaries=False,
xlim=None, ylim=None,
ax=None
):
"""
Adapted from:
https://github.com/donnemartin/data-science-ipython-notebooks/blob/master/scikit-lear... | true |
d47b92a5040c37f7d75670bad5b005681cdcf207 | Python | fakegermano/webponto-virtualenv | /src/plantao/models.py | UTF-8 | 6,468 | 2.734375 | 3 | [] | no_license | from django.db import models
from django.conf import settings
from datetime import datetime, date, time
# Create your models here.
# Model para gerenciar os plantoes dos membros
# cadastrando no bd:
# - Quem criou o plantao
# - Quando o plantao foi criado (automatico)
# - O titulo do plantao
# - A ultima data que o pl... | true |
6b4636bfc6db5179dec8bb81832d51d949855d6b | Python | CaylinK/csci-102-wk12 | /Week12-utility.py | UTF-8 | 1,867 | 3.609375 | 4 | [] | no_license | # Caylin Kuenn
# CSCI 102 - Section B
# Week 12 - Part A
# https://github.com/CaylinK/csci-102-wk12
# First commit done here---
# Function # 1
def PrintOutput(output):
print("OUTPUT",output)
# Second Commit done here---
# Function #2
def LoadFile(file):
with open(file,'r') as text:
string = list(tex... | true |
1377e727add9a31e98dbc60812f0f89ead2ddacc | Python | thicma/CursosEstudos | /PacManPygame/pacman.py | UTF-8 | 973 | 2.96875 | 3 | [] | no_license | import pygame
AMARELO = (255,255,0)
PRETO = (0,0,0)
VELOCIDADE = 1
RAIO = 30
pygame.init()
tela = pygame.display.set_mode((640,480), 0)
movimento_eixo_x = 10
movimento_eixo_y = 30
velocidade_x = VELOCIDADE
velocidade_y = VELOCIDADE
while True:
#Calcula as regras
movimento_eixo_x += velocidade_x
moviment... | true |
546b3b55a0234dc8d2bd7c856799c28ac8902f9e | Python | rvkupper/8CC00_1 | /AssignmentPCA.py | UTF-8 | 5,376 | 3.421875 | 3 | [] | no_license | """Principal Component Analysis tools
"""
import CellLineRMAExpression as clre
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
import numpy as np
from math import sqrt
class AssignmentPCA:
"""Class for principal component analysis of the CellLineRMAExpression data.
"""
lis... | true |
1f017d5ddc3f624eba4ec556c3089fb8187967e5 | Python | TrentBrunson/Fed_Gov | /militaryTime.py | UTF-8 | 421 | 3.59375 | 4 | [] | no_license | # Trent Brunson
# Question 3
time = []
time = str(input("Enter a military time (0000 to 2359): "))
hour = int((time[0] + time[1]))
# print(hour, type(hour))
if hour > 12:
regHour = hour - 12
elif 0 <= hour < 1:
regHour = hour + 12
else:
regHour = hour
if hour >= 12:
indicator = "p.m."
else:
indica... | true |
f1be285a40a74cd82cd8702ffdd01134089a5b12 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2698/60608/280035.py | UTF-8 | 349 | 3.171875 | 3 | [] | no_license |
n=input()
if n=="2 2":
print(3,end="")
elif n=="2 3":
print(21,end="")
elif n=="2 4":
print(651,end="")
elif n=="4 3":
print(83505, end="")
elif n=="3 5":
print(58871587162270592645034001, end="")
elif n=="3 6":
print(20404090132275267384423043787767186154385808485089570387455465128399798056100... | true |
e5af9df4f0dcd7b75de331858a677551a7e27c11 | Python | ssmi1975/solovay-kitaev-py | /solovay_kitaev/algorithm.py | UTF-8 | 8,226 | 2.890625 | 3 | [] | no_license | import math
import copy
import collections
import functools
# most of the code are translated from https://github.com/kodack64/SolovayKitaevAlg
EPS = 1e-12
# XXX : any better way to impelement strategy pattern?
class GateSet:
def __init__(self, valid_construction, get_dagger, epsilon_net, simplify):
self... | true |
acafe51327af376096b4504deca5ab7ccea424ba | Python | SergSm/octobotv4 | /plugins/urban.py | UTF-8 | 2,941 | 2.59375 | 3 | [
"MIT"
] | permissive | import html
import requests
import telegram
import octobot
from octobot import catalogs
import textwrap
import re
apiurl = "http://api.urbandictionary.com/v0/define"
DEF_BASELINE = octobot.localizable("Definition for <b>{word}</b> by <i>{author}</i>:\n" + \
"\n{definition}\n" + \
... | true |
1e5bf6c3fdea86104ff155c185afd4caf6c26e13 | Python | gilson27/learning_experiments | /Ex_Files_Deep_Learning_Image_Recog_Upd/Exercise Files/Ch05/05_training_with_extracted_features.py | UTF-8 | 844 | 2.71875 | 3 | [
"MIT"
] | permissive | from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from pathlib import Path
import joblib
# Load data set
x_train = joblib.load("x_train.dat")
y_train = joblib.load("y_train.dat")
# Create a model and add layers
model = Sequential()
model.add(Flatten(input_shape=x_train.shape[1:]))
... | true |
3fd49cf90f87701359109b7109652766f4303a6c | Python | benfetch/Project-Euler-Python | /problem74.py | UTF-8 | 491 | 3.6875 | 4 | [] | no_license | import math
def sum_digit_factorials(n):
sum = 0
for i in str(n):
sum += math.factorial(int(i))
return sum
def chain_of_factorials(n):
count = 1
x = n
list_chain = [x]
while True:
n = sum_digit_factorials(n)
if n in list_chain:
return count
e... | true |
69f93fbdc34f876191e477a0d89962fcbc0beeab | Python | int-fanle/WordlessBook | /middleware/validate.py | UTF-8 | 833 | 2.59375 | 3 | [
"MIT"
] | permissive | # coding: utf-8
from functools import wraps
from flask import request
from jsonschema import ValidationError, validate
from utils.errors import ParameterError
def check_date(schema):
"""
校验非get的所有请求的参数
TODO 添加get 请求的参数校验(规避所有的非法参数)
:param schema: jsonschema 规定的参数格式 必传
:return:
"""
def i... | true |
fffbaadcf124591c701666f237ac646ebf743d6d | Python | michaeljhuang/Artificial-Intelligence-2017-2018 | /Tennis.py | UTF-8 | 1,460 | 3.140625 | 3 | [] | no_license | import pandas as pd
import math
def main():
data = pd.read_csv("play_tennis.csv")
data = data.drop("Day",axis = 1)
tree = decisionTree(data)
for i in range(len(data)):
row = data.iloc[i,:]
print(classify(tree,row))
def entropy(data,var,value):
series = data[data[var] == value]
va... | true |
7e4854db769bab4ffb790bf06099b36a99d23d50 | Python | MagicLab-pipeline/test | /menu.py | UTF-8 | 131 | 2.625 | 3 | [] | no_license | import nuke
import re
# this is a test text
for i, letter in enumerate(['this', 'that', 'alsoThis'])
print(i)
print(letter)
| true |
f8deaea3a9b65b1cc36ff0c4cac520185177b9ca | Python | hpfn/wttd-2017-exerc | /modulo_2/CodingBat/string-1/combo_string.py | UTF-8 | 236 | 3 | 3 | [] | no_license | # coding=utf-8
def combo_string(a, b):
tam_a = len(a)
tam_b = len(b)
str_ = ''
if tam_a == tam_b:
str_ = False
elif tam_a > tam_b:
str_ = b + a + b
else:
str_ = a + b + a
return str_
| true |
46d1a8fc9d76634947d4bfc893ac1bee01d352e9 | Python | jsairdrop/Python-SciKit | /SciKit-ex13.py | UTF-8 | 3,453 | 3.34375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import svm
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
from sklearn.utils.multiclass import unique_labels
#Determinando a matriz de co... | true |
eeb501cc9d374ca0c78563a164ca789d3618799f | Python | Activity00/Python | /Intrtoalgorithms/同时找到最大值和最小值.py | UTF-8 | 745 | 3.4375 | 3 | [] | no_license | def find_max_min(nums):
if len(nums) % 2 == 0:
if nums[0] > nums[1]:
mx = nums[1]
mi = nums[0]
else:
mx = nums[0]
mi = nums[1]
start = 3
else:
mi = mx = nums[0]
start = 2
for i in range(start, len(nums)):
if nu... | true |
8d2feae0d1cc43df11bc41e5ceae67516e0b0f4d | Python | LautaroNavarro/games2 | /Generala/TestCategories.py | UTF-8 | 7,833 | 2.65625 | 3 | [] | no_license | import unittest
from . import *
from .utils import check_throw
class TestCategories(unittest.TestCase):
def test_generala(self):
numOfThrows = 2
mockThrow = [1, 1, 1, 1, 1]
isGenerala = check_throw(mockThrow, GENERALA['name'], numOfThrows)
self.assertTrue(isGenerala)
def test... | true |
ec95c891eb8056ed124024ba839c24723981ec04 | Python | carbonblack/cb-taxii-connector | /src/cbopensource/utilities/common_config.py | UTF-8 | 19,584 | 2.90625 | 3 | [
"MIT"
] | permissive | # coding: utf-8
# Copyright © 2014-2020 VMware, Inc. All Rights Reserved.
################################################################################
import os
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
__all__ = ["CommonConfigException", "CommonConfigOptio... | true |
24bf5e98eafed91dc8d28062b4ed93e9fbb414b1 | Python | bcody/doaj | /portality/models/toc.py | UTF-8 | 7,870 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | from portality.dao import DomainObject
from portality.models import Article
from copy import deepcopy
class JournalVolumeToC(DomainObject):
__type__ = "toc"
@classmethod
def get_id(cls, journal_id, volume):
q = ToCQuery(journal_id=journal_id, volume=volume, idonly=True)
result = cls.query(... | true |
e1f0fe0c7ff8221dcf6ead4c3b1ebc798b622ba2 | Python | rshiva/DSA | /leetcode/string-to-integer-atoi.py | UTF-8 | 1,117 | 3.4375 | 3 | [] | no_license | #https://leetcode.com/problems/string-to-integer-atoi/
class Solution:
def myAtoi(self, s: str) -> int:
result = ''
s = s.strip()
if len(s) == 0:
return 0
if s[0] == '-' or s[0] == '+' or ord(s[0]) in range(48,58):
for i in range(0,len(s)):
if i == 0 ... | true |
56ac6fb807c25f9fd183411664040267bea1aafa | Python | myungwooko/tcp_chat_crud | /without ORM/client_chat.py | UTF-8 | 3,093 | 2.921875 | 3 | [] | no_license | from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
import tkinter
class host_and_port:
def __init__(self, host, port):
self.host = host
self.port = port
class Setting_Tkinter(host_and_port):
def __init__(self, host, port):
super().__init__(host, port)
... | true |
bc5d21e99ca048dcc12d9e96df4afd0cc16a53f2 | Python | speedify/speedify-py | /sample/speedify_login.py | UTF-8 | 1,944 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | import sys
sys.path.append("../")
import speedify
from speedify import State, SpeedifyError, Priority
"""
This sample connects to the closest server and configures some speedify settings
"""
if len(sys.argv) > 2:
user = sys.argv[1]
password = sys.argv[2]
state = speedify.show_state()
print("Speedify's state... | true |
2981f1ba020a9fad09addc930c7f574754505e70 | Python | sarahahartley/IRC_Chat_Server | /Chat_Server.py | UTF-8 | 18,513 | 2.546875 | 3 | [] | no_license | import socket
import select #python Library that runs OS level I/O regardless of the OS
from random import randrange #generate random nunmber
import asyncio
import sys, time
HEADER_LENGTH =1024
__timeout = 60
IP= "10.0.42.17" #Ubuntu IP
PORT= 6667
is_pong_recived=False
server_socket= socket.socket(socket.AF_INET, ... | true |
872cb97b4da6eb5a674bdb05c2fed9684433190d | Python | Hyunjong1461/python | /200324/연습문제3.py | UTF-8 | 662 | 3.484375 | 3 | [] | no_license | n=5
arr=[[0]*n for _ in range(n)]
row_start = col_start = 0
row_end = col_end =n-1
cnt=1
while row_start<=row_end and col_start<=col_end:
for i in range(col_start, col_end + 1):
arr[row_start][i] = cnt
cnt += 1
row_start += 1
for i in range(row_start, row_end + 1):
... | true |
226512353366357f345740a0237c588b0b08eea6 | Python | trodfjell/PythonTeachers2021 | /Introduksjon/Flytkontroll/BoolskeOperatorer.py | UTF-8 | 1,100 | 4.625 | 5 | [
"MIT"
] | permissive | #Alle boolske operatorer evalueres enten til sann (True) eller usann (False).
print(True)
print(False)
# Er lik
print(True == True) # True
print(12 == 12.0) # True
print(12 == 11) # False
# Er ikke lik
print(True != True) # False
print(12 != 12.0) # False
print(12 != 11) # True
# Er større enn
print(12 > 11) # True
... | true |
64caa9800f525a40fc1994b3e551a78bcad3cc38 | Python | domainexpert/kivy-basics | /main.py | UTF-8 | 2,206 | 2.84375 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | # A simple paint app from
# https://kivy.org/doc/stable/tutorials/firstwidget.html
#
# Copyright (c) 2010-2020 Kivy Team and other contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Softwa... | true |
1ba3d7e33d04ff48abc83db34cbc621de63550c6 | Python | LuisCastellanosOviedo/python3 | /my-python-project/day10_functions_with_outputs/calculator.py | UTF-8 | 538 | 3.578125 | 4 | [] | no_license | from art import logo
print(logo)
def add(n1, n2):
return n1 + n2
def subtract(n1, n2):
return n1 - n2
def multiply(n1, n2):
return n1 * n2
def divide(n1, n2):
return n1 / n2
print(type(add))
operators = {
"+": add,
"-": subtract,
"*": multiply,
"/": divide,
}
num1 = float(inp... | true |
d104e1e4f2f561b0d67960db0aca838ef4f0690a | Python | ryfeus/lambda-packs | /Skimage_numpy/source/skimage/morphology/_skeletonize_3d.py | UTF-8 | 2,538 | 3.1875 | 3 | [
"MIT"
] | permissive | from __future__ import division, print_function, absolute_import
import numpy as np
from ..util import img_as_ubyte, crop
from ._skeletonize_3d_cy import _compute_thin_image
def skeletonize_3d(img):
"""Compute the skeleton of a binary image.
Thinning is used to reduce each connected component in a binary im... | true |
582c939f269a08906c0789bf46f4a59395ed80df | Python | licarpen/opencv-playground | /image-processing/mask.py | UTF-8 | 1,205 | 3.234375 | 3 | [] | no_license | # Generate a mask that is smaller than the original image and overlay
import cv2
import matplotlib.pyplot as plt
import numpy as np
img1 = cv2.imread('../assets/arete.jpg')
img1 = cv2.cvtColor(img1, cv2.COLOR_BGR2RGB)
img2 = cv2.imread('../assets/paw.jpg')
img2 = cv2. cvtColor(img2, cv2.COLOR_BGR2RGB)
img2 = cv2.resi... | true |
ab28a092e7d894cd90c2a4cc190303ccbc9e4691 | Python | alex-xia/leetcode-python | /lib/distance_k_in_binary_tree.py | UTF-8 | 3,969 | 3.953125 | 4 | [] | no_license | '''
We are given a binary tree (with root node root), a target node, and an integer value K.
Return a list of the values of all nodes that have a distance K from the target node. The answer can be returned in any order.
Example 1:
Input: root = [3,5,1,6,2,0,8,null,null,7,4], target = 5, K = 2
Output: [7,4,1]
Explan... | true |
453efb151b9548655fefeae33ff615b4837b744c | Python | ivaneduardomv/PythonBMP | /AddNoiseToImage.py | UTF-8 | 1,139 | 2.796875 | 3 | [
"Unlicense"
] | permissive | import random
import time
f = open("originalImage.bmp", "rb")
originalImageHeader = list(f.read(54))
print(f.tell())
originalImageData = list(f.read())
f.close()
print(len(originalImageData))
originalImageHeaderBytes = bytearray(originalImageHeader)
noisyImageData = []
startTime = time.time()
for x in range(640*480... | true |
8a36cb02b450477f549de05d7ea5136c4a3c9377 | Python | sangqt/lighthouse | /challenge8.py | UTF-8 | 710 | 3.453125 | 3 | [] | no_license | df = pd.read_csv('milk.csv', sep=r'\s*,\s*',header=0, encoding='ascii', engine='python')
max_milk = df['Month'][df['Monthly milk production: pounds per cow'].idxmax()]
print(f'The month and year with most milk is {max_milk}')
least_milk = df['Month'][df['Monthly milk production: pounds per cow'].idxmin()]
print(f'The m... | true |
c78876fb8e2a9505fa0d3301a7126ad0ec37d78d | Python | GeassDB/if2rp | /test.py | UTF-8 | 1,245 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
import random
import unittest
import if2rp
class test_infix2rp(unittest.TestCase):
def setUp(self):
self.nums = list(range(1000))
self.syms = "()+-*/^"
def test_exp1(self):
self.assertEqual(if2rp.infix2rp("11+22-33*44"), "11 22 + 33 44 * -")
def test_exp2(sel... | true |
15e5b94ebf033fc3177b56adb440deff7f94bfc8 | Python | ductandev/Tkinter_GUI_tutorial | /1.py | UTF-8 | 329 | 3.203125 | 3 | [] | no_license | from tkinter import *
root = Tk()
root.geometry("250x200")
def clear():
list = root.grid_slaves()
for l in list:
l.destroy()
print("\n",l)
Label(root,text="Hello word").pack()
root.geometry("350x400")
Label(root,text='Hello World!').grid(row=0)
Button(root,text='Clear',command=clear).grid(row=1)
root.ma... | true |
aa9a0c06c66c72492fc43b1c05c536ae23dab341 | Python | electrodragon/C-Quick-Guide | /test.py | UTF-8 | 255 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
import os, sys
myfile = os.sys.argv[1:][0]
cont = []
with open(myfile,'r') as f:
cont = f.readlines()
with open(myfile,'w') as f:
for l in cont:
l = l[:-1]
t = 'document.write(\''+l+'\');\n'
f.write(t)
| true |
be662b6df71040a9aefc9c228f36c77d1905df60 | Python | jangbigom91/python_lecture | /skip_vowel_continue.py | UTF-8 | 222 | 3.84375 | 4 | [] | no_license | st = 'Programming'
# 자음이 나타날때만 출력하는 기능
for ch in st :
if ch in ['a', 'e', 'i', 'o', 'u'] :
continue # 모음일 경우 아래 출력을 건너뛴다
print(ch)
print('The end') | true |
f0948ab19938edb54d3a6b53b41216a11d795c2e | Python | embatbr/labrador | /server/app/controllers.py | UTF-8 | 1,359 | 2.515625 | 3 | [
"WTFPL"
] | permissive | # -*- coding: utf-8 -*-
import falcon
import json
from labrador.labrador import BaseObject
class Controller(BaseObject):
def __init__(self):
BaseObject.__init__(self)
def on_get(self, req, resp):
self._logger.info('Request {} received', str(req))
self._on_get(req, resp)
se... | true |
46a307d4552024277a58456b99b013a11ec90dcb | Python | hongzhangbrown/pnl-system | /untitled.py | UTF-8 | 654 | 2.71875 | 3 | [] | no_license | from collections import namedtuple
import sys
""" Stores information of a fill operation
time: timestamp of the fill message
name: name of the stock
price: price of the stock at the time of the operation
size: fill size of the stock,
mode: side indicator; 'B' or 'S'
"""
Trade = namedtuple('Trade',['time','price... | true |
4cb42622bcdcaadc30c94929c06e3128a248cbbc | Python | vansun11/tensorflow-Deep-learning | /tensorboard_basic.py | UTF-8 | 1,035 | 3.015625 | 3 | [] | no_license | '''
Graph and Loss visualization using Tensorboard.
This example is using the MNIST database of handwritten digits
(http://yann.lecun.com/exdb/mnist/)
'''
from __future__ import print_function
import tensorflow as tf
# import mnist data
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.re... | true |
00649325619ee6c1dd859faa0b2b0691de64c493 | Python | PrithviSathish/School-Projects | /Armstrong Number.py | UTF-8 | 264 | 3.921875 | 4 | [] | no_license | n = int(input("Enter n: "))
order = len(str(n))
Sum = 0
temp = n
while temp > 0:
Digit = temp % 10
Sum += Digit ** order
temp //= 10
if n == Sum:
print("The number is an Armstrong number")
else:
print("The number is not an Armstrong number")
| true |
210931f481f8e5986fadc19ade8e258a8d6e7327 | Python | Scarecrow-ai/RPG_for_Neoscholar | /Codes/Level.py | UTF-8 | 1,634 | 3.125 | 3 | [] | no_license | import pygame
from grid import MapGrid
import Player
import Enemy
import World_module
import Npc
import Task
def level1(window_size_x, window_size_y, surface):
grid = MapGrid(30, 20)
player_group = pygame.sprite.Group()
enemy_group1 = pygame.sprite.Group()
player_group.add(Player.boy((5, 10), grid))... | true |
a508d4aa8ea2d3dfb05e3416ab433b49a4c691c7 | Python | jodonnell/python_game | /sprites/player/ducking_state.py | UTF-8 | 1,166 | 3.125 | 3 | [] | no_license | from game.conf import PLAYER_FACING_RIGHT, PLAYER_FACING_LEFT
class DuckingState():
"The state when the player is standing still."
def __init__(self, player, direction):
self.player = player
if direction == PLAYER_FACING_RIGHT:
self._animation = self.player._DUCK_RIGHT_FRA... | true |
b673d10d41a748bf9e742f773403d3b1d263c142 | Python | hrishikeshtak/Coding_Practises_Solutions | /leetcode/30-day-leetcoding-challenge-Apr-20/01_singleNumber.py | UTF-8 | 641 | 3.671875 | 4 | [] | no_license | #!/usr/bin/python3
"""Single Number"""
from functools import reduce
class Solution(object):
"""
Given a non-empty array of integers, every element appears
twice except for one. Find that single one.
"""
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
... | true |
64658125494c71b6f3cb362542fe40d131356309 | Python | sainihimanshu1999/Interview-Bit | /LEVEL 3/Two Pointers/removingduplicates.py | UTF-8 | 341 | 2.84375 | 3 | [] | no_license | class Solution:
# @param A : list of integers
# @return an integer
def removeDuplicates(self, A):
p1 = 0
p2 = 1
for i in range(1,len(A)):
if A[i]!=A[p1]:
p1 = p2
A[i],A[p2] = A[p2],A[i]
p2+=1
return p2
... | true |
c78136bf257b3ea674994f86763329c5e9767e28 | Python | shambhukbhakta/basic-Python | /Zero/helloWorld.py | UTF-8 | 202 | 3.3125 | 3 | [] | no_license | friends = ['zero','one','two','three','four','five','six']
numbers =[1,2,3,4,5,1,6,4,7,8]
friends.extend(numbers)
print(friends.index(1));
#print(friends[2:3])
#print(friends[-4:-3])
#print(friends[-6]) | true |
3c38910f5cae37836be285a49fadccf87e6f0007 | Python | rgresia-umd/fml-wright | /fmlwright/core/postprocessing/build_floorplan.py | UTF-8 | 8,318 | 2.765625 | 3 | [] | no_license | import geopandas as gpd
import numpy as np
from scipy.spatial import Voronoi
from shapely import ops
from shapely.geometry import Point, LineString, Polygon
from fmlwright.core.utils import create_exterior_points, get_angle_between_points
from fmlwright.core.preprocessing import (
image_to_geodataframe,
resize... | true |
7fecee704f0acd5c6e81b1259cdc1618eab2aa5e | Python | Anmol-Monga/rpmcli | /rpmcli/src/standalones/jobhold.py | UTF-8 | 808 | 2.578125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from argparse import ArgumentParser as ArgParse
import os
import sys
from time import sleep
from RPM import RPM
from standalones import clikey
if __name__ == '__main__':
# Connect using the configured CLI Key.
r = RPM(key = clikey)
# Wait for connection to establis... | true |
011c4635f5ee8670d5a2618ea377d15db3c3054a | Python | makerC-LV/py-cfgparser | /src/grammar.py | UTF-8 | 5,829 | 2.65625 | 3 | [
"MIT"
] | permissive | from src.rules import Alt, Seq, Opt, Star, ParseNode, AltType, Lit, Reg, Eps, Eof
from enum import Enum
class Grammar:
def __init__(self):
self.rules = {}
self.ptree_list = None
self.backtrack_choices = None
def init_parse(self):
self.ptree_list = []
self.backtrack_c... | true |
7799ac5e9c8ae08ee5d0dac533cb159010b4c1de | Python | zholland/CMPUT690Project | /deep_nn_action_value_function.py | UTF-8 | 7,502 | 2.765625 | 3 | [
"MIT"
] | permissive | from action_value_function import AbstractActionValueFunction
import numpy as np
import tensorflow as tf
import random
class Transition:
def __init__(self, state, action, reward, next_state, done):
self.state = state
self.action = action
self.reward = reward
self.next_state = next_... | true |
33f164b47f2844e0bff0b5967c2c1b5d8fb71b56 | Python | ibogorad/CodeWars | /Relatively Prime Numbers.py | UTF-8 | 716 | 3.484375 | 3 | [] | no_license | def relatively_prime (n, l):
# list_of_numbers = []
# for i in l:
# if n%i !=0:
# list_of_numbers.append(i)
# return list_of_numbers
# factors of n
# all_numbers_in_n = range(n)
i = 2
factors = []
while i*i <= n:
if n %i != 0:
i+=1
... | true |
a4cc240cf8509f75150b2d8f19411edd1fccf78c | Python | drivetrainhub/notebooks-gears | /geometry/involute.py | UTF-8 | 1,464 | 3.421875 | 3 | [] | no_license | # Copyright 2019 Drivetrain Hub LLC
# For non-commercial use only. For commercial products and services, visit https://drivetrainhub.com.
"""Notebook module for involute geometry."""
import numpy as np
from math import pi
# region CURVES
def involute_curve(radius_base, roll_angle):
x = radius_base * (np.cos(r... | true |
327b6c1576ed084c7d7391617b1afce93150bf52 | Python | bingli8802/leetcode | /0012_Integer_to_Roman.py | UTF-8 | 1,505 | 3.375 | 3 | [] | no_license | class Solution(object):
def intToRoman(self, n):
# TODO convert int to roman string
string=''
symbol=['M','D','C','L','X','V','I']
value = [1000,500,100,50,10,5,1]
num = 10**(len(str(n))-1)
# quo = n//num
# rem=n%num
quo, rem = divmod(n, num)
... | true |