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 |
|---|---|---|---|---|---|---|---|---|---|---|
a86ae01541204f87f13fe9747484bbed7ab093c4 | Jwilson1172/DS-Unit-3-Sprint-2-SQL-and-Databases | /app/chinook_queries.py | UTF-8 | 404 | 2.890625 | 3 | [
"MIT"
] | permissive | import sqlite3
import os
DB_FILENAME= os.path.join(os.path.dirname(__file__),"..","data","chinook.db")
connection=sqlite3.connect(DB_FILENAME)
connection.row_factory = sqlite3.Row # lest reat our objects like dict nor tuples
curs=connection.cursor()
query="SELECT * FROM customers LIMIT 5;"
result=curs.execute(query).f... | true |
7264ca48d6b1d4a8dc4139ec57b976e0bee793a2 | UPstartDeveloper/CS-2.1-Trees-Sorting | /Code/sorting_integer.py | UTF-8 | 7,071 | 3.71875 | 4 | [] | no_license | #!python
import sys
from linkedlist import LinkedList, Node
from sorting_recursive import merge_sort, quick_sort
from sorting_iterative import sort_one_element, insertion_sort
from timing import compare_two_sorting_times
from pprint import pprint
import math
def find_max(numbers):
'''Linear search for the maximum... | true |
4b9f5eb050b36efe0b29d92e777ac811a14dfe59 | EthanJWright/IoT-Home | /RPI-Controller-API/Flask-API/HueApi.py | UTF-8 | 2,045 | 2.71875 | 3 | [] | no_license | import HueController
from colour import Color
import simplejson
import datetime
import time
import ConfigParser
class HueApi():
def __init__(self):
self.config = ConfigParser.ConfigParser()
self.config.read('iot.properties')
self.hueIP = self.config.get('Hue', 'ip')
self.hue = HueCo... | true |
459e33097fc0032f54e9c9735c8316616e5392a8 | ck-unifr/hackerrank-30-days-code | /day-1-data-types.py | UTF-8 | 581 | 4.25 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/30-data-types/problem
import sys
# Declare second integer, double, and String variables.
i = 4
d = 4.0
s = 'HackerRank'
# Read and save an integer, double, and String to your variables.
var1 = int(input())
var2 = float(input())
var3 = input().strip()
# Print the sum of both in... | true |
d663354bc95274fc6e8c34ff7d6d2506bfdbc004 | justinm0rgan/python_work | /chp2/simple_message.py | UTF-8 | 51 | 3 | 3 | [] | no_license | message = "How are you doing today?"
print(message) | true |
b6b027611cadb6df33a15638fa19c8e5c768807b | ArtezGDA/text-IO | /Niels/Alfabet/b.py | UTF-8 | 2,714 | 2.703125 | 3 | [
"MIT"
] | permissive | import curses
import random
import time
for myChar in range(10):
randomNum = random.randint(33, 126)
myChar = chr(randomNum)
screen = curses.initscr()
screen.addstr( 21, 75, str(randomNum))
screen.addstr( 22, 75, str(randomNum))
screen.addstr( 23, 75, str(randomNum))
screen.addstr( 24, 75, str(randomNum))
scr... | true |
a36811903f39a0a01ccec62db9293bf7e76a8499 | rohanmandrekar/search-algorithms | /run.py | UTF-8 | 10,065 | 2.59375 | 3 | [] | no_license | import timeit
import random
from tkinter import *
# from flask import Flask,request,render_template,redirect,url_for,make_response
# app = Flask(__name__)
def linearsearch(inputs,querry):
# start=timeit.default_timer()
flag=0
pos=0
for number in inputs:
if (querry==number):
print('querry found at index ... | true |
7374d3210b085152586aa7eade8c603193800f62 | 97hknl/Thesis | /code/frequency_analysis/flair/test1.py | UTF-8 | 1,218 | 2.9375 | 3 | [] | no_license | # The sentence objects holds a sentence that we may want to embed or tag
from flair.data import Sentence
from flair.models import SequenceTagger
from flair.embeddings import WordEmbeddings
from flair.embeddings import CharacterEmbeddings
from flair.embeddings import BertEmbeddings
import nltk
filename = "/home/harsh/D... | true |
378339778cb9be692c7d20a9cf84c4d7ad33ae98 | mariabrb/python | /aldo de papa.py | UTF-8 | 329 | 3.46875 | 3 | [] | no_license | def damemitad(num):
return num/2
def media(a,b):
return (a+b)/2
def cubo(num):
return num**3
def raiz(num):
return num**(1/2)
def main():
nota1=input('dime primera nota: ')
nota2=input('dime segunda nota: ')
print ('la media es: '),media(nota1,nota2)
main()
... | true |
800700454e8e8237af7825d1405750e5a63c2d2d | APettit98/Senior-IS | /WebApplication/MeetingPlaceFinder/mpf/algorithms.py | UTF-8 | 12,106 | 3.140625 | 3 | [] | no_license | import osmnx as ox
import networkx as nx
import math
import geopy
from geopy import exc
from collections import Counter
import sys
import time
import logging
logging.basicConfig(format="%(asctime)s - %(message)s",
datefmt='%d-%b-%y %H:%M:%S')
logger = logging.getLogger("mpfLogger")
mapbox_access_to... | true |
619c7e39924cda6c74bf8a35a3d7df88d96d4212 | csm-forklift/pepper_vr_teleop | /src/torso_control.py | UTF-8 | 16,374 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
""" Controls Pepper's base velocities using the torso pose.
Reads the torso (base_link) and shoulder transforms from the skeleton tracker.
Treats the Z axis of the torso like a joystick and sends X/Y velocity commands
based on the axis tilt. Also reads the shoulder positions and determines an
ang... | true |
c308fc49ba870938f509d87f0aeec4e1aa8270bd | js-refresh/python-101 | /word_counter.py | UTF-8 | 338 | 4.15625 | 4 | [] | no_license | print("Word counter!")
user_input = input("Pick a word, I'll tell you how many of each word: ")
def word_count(str):
counts = dict()
words = str.split()
for word in words:
if word in counts:
counts[word] +=1
else:
counts[word] = 1
return counts
print(word_... | true |
49c4629b38eaa688e67d770ae0ffa1fceb7cd1b1 | ares5221/JulyEdu-Projects | /01NLP/01NLPBasic/lesson01/nltk_work2.py | UTF-8 | 2,012 | 3.9375 | 4 | [] | no_license | #!/usr/bin/env python
# _*_ coding:utf-8 _*_
import nltk
from nltk import FreqDist
# 统计词频,讲文本转换为向量
# 做个词库先
corpus = 'this is my sentence ' \
'this is my life ' \
'this is the day'
# 随便tokenize一下
# 显然, 正如上文提到,
# 这里可以根据需要做任何的preprocessing:
# stopwords, lemma, stemming, etc.
tokens = nltk.word_token... | true |
6667af8c493af6db56ea0983309ff56664fcd182 | abdukhashimov/telegram-bot2 | /test_main.py | UTF-8 | 3,147 | 2.609375 | 3 | [
"MIT"
] | permissive | from bot import User, KeyboardLanguage, Button, Keyboard
from unittest import TestCase, main
from telegram import InlineKeyboardButton
from emoji import emojize
class TestUser(TestCase):
def setUp(self):
self.user = User('max', 'Madiyor', 'Abdukhashimov')
def test_username(self):
self.asser... | true |
5a5b3f6cc40f56a8e470481249dad698ce99b2c6 | aarti-b/web-scraping | /data_fetch.py | UTF-8 | 3,176 | 2.546875 | 3 | [] | no_license | import urllib.request
from bs4 import BeautifulSoup
import pandas as pd
data = []
dfs = []
webpage_urls = ["https://data.gov.au/dataset?q=&groups=business&sort=extras_harvest_portal+asc%2C+score+desc%2C+metadata_modified+desc&_organization_limit=0&organization=reservebankofaustralia&_groups_limit=0",
... | true |
4d5fb5a4ede517ce93936b3aa3c949225150e1c5 | marcemq/BreakingTheRecord | /printRecords.py | UTF-8 | 1,469 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
def checkConstraints(n, scores):
""" Checks based constraints for given input """
if n != len(scores):
return False
if n not in range(1, 1001):
return False
for score in scores:
if score not in range(1, 100000001):
return Fal... | true |
e73fca7a05f9d51d27cee0c731909f61da1eb66b | krischer/seismo_live | /notebooks/Computational Seismology/The Pseudospectral Method/ps_fourier_derivative_solution.py | UTF-8 | 6,413 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.2.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# <div style='ba... | true |
bad7fdbe7e687ba938bcc1362eb1ff105fc825b1 | hgxur88/study | /programming and date/3.리스트 정렬.py | UTF-8 | 355 | 4.21875 | 4 | [] | no_license | #정렬
numbers = [2, 3, 20, 7, 1, 43, 17, 19]
list = sorted(numbers)
print(list)
#반대로 정렬
numbers = [2, 3, 20, 7, 1, 43, 17, 19]
list = sorted(numbers, reverse = True)
print(list)
# sorted 기존 리스트는 건드리지 않고, 정렬된 새로운 리스트를 리턴
# sort 아무것도 리턴하지 않고, 기존 리스트를 정렬
| true |
e7b961abfff927001db7914322df5e9d760bb731 | draagc-iw/DraBrIW | /App/Storage/DrinkService.py | UTF-8 | 1,087 | 2.796875 | 3 | [] | no_license | from App.Utils import SingletonMeta
from App.Storage import DBConnectionManager
from App.Utils.Mappers import DrinkMapper
class DrinkService(metaclass=SingletonMeta):
def __init__(self):
self._db = DBConnectionManager()
def add(self, drink_name):
add_query = f"""INSERT INTO drinks (name)
... | true |
df5cb853a53f6583c6fdaee7ab4147c9f7c69843 | LucaLabio/ExerciciosPython | /dia7/exercicio10.py | UTF-8 | 308 | 4.375 | 4 | [] | no_license | """ Faça um algoritmo em Python para ler dois números inteiros (num1 e num2)
e informar se num1 é divisível por num2."""
n1 = float(input("Digite um numero "))
n2 = float(input("Digite outro numero "))
if n1 % n2 == 0:
print(n1," e divisivel por ",n2)
else:
print(n1, " nao e divisivel por ", n2) | true |
d3d44b8f7990dba98ccb9e75be4733f4f6ca76aa | lRomul/argus-freesound | /src/predictor.py | UTF-8 | 1,348 | 2.578125 | 3 | [
"MIT"
] | permissive | import torch
from torch.utils.data import DataLoader
from argus import load_model
from src.tiles import ImageSlicer
@torch.no_grad()
def tile_prediction(model, image, transforms,
tile_size, tile_step, batch_size):
tiler = ImageSlicer(image.shape,
tile_size=tile_size,
... | true |
8ec5a41360fa643dc9d422183ba17aebcd183ce5 | green-fox-academy/bertokpeter | /week-02/day-03/matchmaking.py | UTF-8 | 592 | 4.15625 | 4 | [] | no_license | # Join the two lists by matching one girl with one boy in the order list
# Exepected output: ["Eve", "Joe", "Ashley", "Fred"...]
girls = ["Eve", "Ashley", "Bozsi", "Kat", "Jane"]
boys = ["Joe", "Fred", "Bela", "Todd", "Neef", "Jeff"]
import random
order = []
while len(girls) > 0 or len(boys) > 0:
if len(girls) > 0... | true |
56ebc102fbf9c57fb6948731fb460049a1f8c01a | huangqingyi-code/ai | /代码/PythonStudy/赋值运算符.py | UTF-8 | 39 | 2.859375 | 3 | [] | no_license | a = 4
a += 3
print(a)
a **= 2
print(a)
| true |
b2b932e32c8ce610c0941272ec631fd05d68df5c | flintx/PythonExecrise | /0000.py | UTF-8 | 678 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
# coding: utf-8
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
ImagePath = "/home/zzf/"
FontPath = "/usr/share/fonts/truetype/ubuntu-font-family/"
PortraitFile = "portrait.jpg"
OutputFile = "output.jpg"
def DrawFont(image, Font):
FontSize = min(image.size) / 4
... | true |
4350beb5c05d792074567af67d4377c704b713a7 | anilkale99/pythoncode | /src/basic/SeleniumFirstScriptWithPytest1.py | UTF-8 | 226 | 3.234375 | 3 | [] | no_license | '''
Created on Jul 19, 2018
@author: Anil.Kale
'''
def capital_case(x):
return x.capitalize()
def test_capital_case3():
assert capital_case('anil') == 'Anil'
def test_capital_case4():
assert (True) == True | true |
bedd02480c0259877ff60377b876c3a157d92921 | turgun3/python_classwork | /lesson4_1.py | UTF-8 | 59 | 2.59375 | 3 | [] | no_license | import lesson4_1
for x in lesson4_1.countdown(5):
print(x) | true |
a67d6338066ae3c039ff5a208b3680b2bc2dd6fd | thekma/DS2000 | /hw4_starter/kmeans_viz.py | UTF-8 | 1,412 | 3.640625 | 4 | [] | no_license | # DO NOT CHANGE ANYTHING IN THIS FILE
# USED TO VISUALIZE K-MEANS MAIN PROGRAM
import turtle
# Sets a few Turtle parameters
def setup(minx, miny, maxx, maxy, turtlespeed):
turtle.setworldcoordinates(minx, miny, maxx, maxy)
turtle.speed(turtlespeed)
turtle.hideturtle()
# Waits for the user to close a wind... | true |
6be7372e0d9317d0f1cf18b19d1287628a340eb7 | morobar1202/algorithims | /quick.py | UTF-8 | 1,269 | 3.984375 | 4 | [] | no_license | # quick sort experiment
# by Liam Morrison
# V 1.00
import random, time
TIMES = 1000
SIZE = 10
def quicksort(sort_list):
""" does the quick sort """
if len(sort_list) <= 1:
return sort_list
else:
x = len(sort_list) // 2
middle_item = sort_list[x]
left = []
middle =... | true |
29a10c487f423ca098f1cd4eb8f94f18667228b2 | royan2024/Algorithm_Practice | /Graph/Dijkstra.py | UTF-8 | 1,095 | 3.25 | 3 | [] | no_license | from Graph import Graph
import sys
def dijkstra(graph: Graph, start):
vertices = graph.get_verts()
result = {}
for v in vertices:
if v == start:
result[v] = 0
else:
result[v] = sys.maxsize
while len(vertices) > 0:
min_length = sys.maxsize
pivot... | true |
7483e0b2324e6ed0857cf6df5af74f9e6801804f | Toyin96/bookish-engine | /textbook/testing.py | UTF-8 | 891 | 3.78125 | 4 | [] | no_license | print("Welcome to toyin's master calculator \n")
while True:
input1 = input("Enter first number or enter 'q' to end: ")
if input1.lower().strip() == 'q':
break
input2 = input("Enter first number or enter 'q' to end: ")
if input2.lower().strip() == 'q':
break
try:
result = in... | true |
5b208567c672c208a1f6f33524378bda71716074 | chazkiker2/Data-Structures | /floodfill.py | UTF-8 | 1,177 | 3.75 | 4 | [] | no_license | from time import sleep
# floodfill
image_str = [
"#########################"
"# ### #"
"# # # #"
"# # #### #"
"# # # #"
"# # # #"
"# ######## #### #"
"# # # #"
"# ... | true |
072663eda4e70c6ab31568892bd3bc77fa12aa26 | LukeM44/Fish_Imputation_Project | /LUM44_technicalwork_2021/real_world_data_test_2.py | UTF-8 | 2,827 | 2.515625 | 3 | [] | no_license | #runs imputation code on real world data set 1
#By Luke Mullis
#Done
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import statistics
import math
import random
from sklearn.experimental import enable_iterative_imputer
from sklearn.impute import It... | true |
2955ba698ef6fdc31b9ff16571d225eca7176b44 | namuhevil/Accesory | /Folder_generator/Folder_generator.py | UTF-8 | 2,915 | 3 | 3 | [] | no_license | import os
import numpy as np
import hashlib
import time
from tkinter import *
from tkinter import messagebox
from tkinter.filedialog import askdirectory
class Frame():
def __init__(self,init_window_name):
self.init_window_name = init_window_name
#Set Windows
def set_init_window(self):
se... | true |
da3a6b928e671aea092980cdefef5af9cc02e417 | guyandtheworld/Top-Secret-Private-Project | /CTCI/TreesAndGraphs/ctci_7.py | UTF-8 | 2,229 | 3.71875 | 4 | [] | no_license | """
Build Order: You are given a list of projects and a list of dependencies (which is a list of pairs of projects,
where the second project is dependent on the first project). All of a project's dependencies must be built
before the project is. Find a build order that will allow the projects to be built. If there is n... | true |
977b783b351ec9b635e2eaf3c186adb2b2202bca | azbyn/fundamentele | /src/integrals.py | UTF-8 | 819 | 3.90625 | 4 | [] | no_license | def exp(x, iterations=20):
factorial = 1
pow = 1
res = 1.0
for i in range(1, iterations):
factorial *= i
pow *= x
res += pow/factorial
return res
def cos(x, iterations=20):
factorial = 1
pow = 1
res = 1.0
for i in range(1, iterations, 2):
factorial *=... | true |
83e3af54f73abd781ccfeb50e4d1941247e06717 | nathankong/eeg_rsa_opt | /compute_optimal_correlation_flex.py | UTF-8 | 12,206 | 2.703125 | 3 | [] | no_license | import os
import time
import pickle
import numpy as np
from scipy.stats import spearmanr
from sklearn.model_selection import KFold
np.random.seed(0)
KFOLD_RAND_SEED = 0
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from models import LinearModel, ElementWiseScalin... | true |
718f20bf9349f426aaf2cc581c917b587c92050a | Prd1899/The-Blind-s-Eye | /brain.py | UTF-8 | 1,647 | 2.671875 | 3 | [] | no_license | import tell_time, general_conversations, sleep,define_subject
import os
def brain1(speech_text):
def check_message(check):
"""
This function checks if the items in the list (specified in argument) are present in the user's input speech.
"""
words_of_message = speech_text.split... | true |
12acd36282cc321839b6322855837a8c9e3c6651 | marcinszymura/python_kurs | /day2/homework/homework_1.py | UTF-8 | 730 | 3.71875 | 4 | [] | no_license | x = int(input('podaj pozycje dla x: '))
y = int(input('podaj pozycje dla y: '))
result = ''
if (x > 100) or (x < 0) or (y > 100) or (y < 0):
result = 'poza planszą'
elif x <= 10:
if y <= 10:
result = 'w lewym dolnym rogu'
elif y >= 90:
result = 'w lewym górnym rogu'
else:
result... | true |
9f518dc99206dcfa3c726553269c994e5df0deda | azhonghao/python_learn | /index.py | UTF-8 | 94 | 2.53125 | 3 | [] | no_license | import myclass
# import sys
# print(sys.path)
n=myclass.myclass()
print(type(n))
print(dir(n)) | true |
67a4201f88f76693ce8fb05782c1d5d873bdeca2 | farooquesayed/crittercism | /src/ui/elements/common_table.py | UTF-8 | 2,303 | 2.578125 | 3 | [] | no_license | import abc
from selenium.common.exceptions import NoSuchElementException
from yopenstackqe_tests.common.utils.ui.elements.launch_dialog import \
LaunchDialog
from yopenstackqe_tests.common.utils.ui.wait_utils import Waiter
class CommonTable(object):
@abc.abstractproperty
def root_id(self):
pass
... | true |
9561662442feee8158f752bff24b89f7de9a4a13 | NiekAukes/Informati.ca | /scheldwoordenverwijderaar.py | UTF-8 | 920 | 3.21875 | 3 | [] | no_license | lijstjenummero2 = input("Voer een lijstje in").split()
scheldwoorden = ["kut", "godverdomme", "fuck"]
scheldwoord = ""
##def geenScheldwoorden(lijstje):
## for i in lijstje:
## if lijstje[i] == scheldwoord:
## lijstje[i] = len(lijstje[i]) * "*"
##
##print(geenScheldwoorden(lijstjenummero2))... | true |
253c1196a62b033ee5547a5b815e71226a1ca161 | eoh-uiuc/volunteer-api | /scripts/parse_timeslots.py | UTF-8 | 2,596 | 2.796875 | 3 | [
"MIT"
] | permissive | import json
import os
import pandas as pd
import requests
import sys
URL = 'http://127.0.0.1:5000/{}/'
YEAR = 2019
DATE_FORMAT = '{:02d}/{:02d}/{} {:02d}:{}' # MM/DD/YYYY HH:A
ID_FORMAT = '{}_{}_{}' # POS_DATE_24HOUR
def admin_login():
payload = {'uid': os.getenv('ADMIN'),
'pwd': os.getenv('ADMIN_P... | true |
66670de1bb8c48d8d8ddd9f679ec6d2ace12fed6 | BrianQcq/LeetCode | /src/009_palindrome_number.py | UTF-8 | 540 | 4.34375 | 4 | [] | no_license | """
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Input: 121
Output: true
Input: -121
Output: false
"""
class Solution(object):
#Converting to string, extra space required.
def isPalindrome(self, x):
temp = str(x)
return temp == temp[::-1]
... | true |
789af9bb6e826abbd268646944969de324afee51 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_95/1071.py | UTF-8 | 790 | 3.046875 | 3 | [] | no_license | text_file = open("input.txt", "r")
input_text = text_file.readlines()
run_amount = int(input_text[0])
end_result = ""
charmapping = {'a': 'y', 'c': 'e', 'b': 'h', 'e': 'o', 'd': 's', 'g': 'v', 'f': 'c', 'i': 'd', 'h': 'x', 'k': 'i', 'j': 'u', 'm': 'l', 'l': 'g', 'o': 'k', 'n': 'b', 'p': 'r', 's': 'n', 'r': 't', 'u'... | true |
2e2bacc8b197175a884ba25195404374fc2f0bbf | vaibhavkrishna-bhosle/Covid-chatbot-RASA | /chatgui.py | UTF-8 | 1,539 | 2.828125 | 3 | [] | no_license | #Creating GUI with tkinter
import tkinter
from utils import *
from tkinter import *
def send():
msg = EntryBox.get("1.0",'end-1c').strip()
EntryBox.delete("0.0",END)
if msg != '':
ChatLog.config(state=NORMAL)
ChatLog.insert(END, "You: " + msg + '\n\n')
ChatLog.config(foreground="bl... | true |
725d0a50b65492674eeacaf6ea9ab05b42c579ea | vinidixit/hackerearth | /Searching/conditional_bin_search.py | UTF-8 | 1,128 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 16 19:30:03 2020
@author: vdixit
"""
'''
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to ou... | true |
3074dc157b2705932a0e5833a0680c4561678dc2 | Valupiruiz/AutomationPHP | /ejemplo_pytest_sin_bdd/src/actions/base/base_action.py | UTF-8 | 1,163 | 2.59375 | 3 | [] | no_license | from abc import ABC
from src.page_objects.base.base_page import BasePage
from src.utils.asserts import Assert
from src.utils.db_utils import Db
from src.utils.requests import Request
class BaseAction(ABC):
def __init__(self, context):
self.page = context.page
self.db: Db = context.db
sel... | true |
ac75ce760fbe028648138a8fb891b45640931381 | lujh410/pandas | /src/chapter02/demo12.py | UTF-8 | 661 | 3.28125 | 3 | [] | no_license | # 读写Pickle格式的Series和DataFrame文件
import pandas as pd
scientists = pd.read_csv('../scientists.csv')
names = scientists['Name']
print(names)
import os
if not os.path.exists('./output/scientists_names_series.pickle'):
names.to_pickle('./output/scientists_names_series.pickle')
if not os.path.exists('./output/scientis... | true |
826b20ea837bbee9b12a7b29e6fe6ca55d0ed3d3 | hakanbayraktar/my_blog_codes | /pandas_satir_sutun2.py | UTF-8 | 840 | 2.734375 | 3 | [
"MIT"
] | permissive |
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
for dirname, _, filenames in os.walk('/kaggle/input'):
for filename in filenames:
print(os.path.join(dirname, filename))
#kaggleblalyasar
df = pd.read_csv("/kaggle/inpu... | true |
2e6d2c6c310c4cad324531c6b1490ff9e70a13d1 | tanoManzo/birth | /webpage.py | UTF-8 | 2,976 | 3.203125 | 3 | [] | no_license |
import streamlit as st
import datetime
from PIL import Image
from streamlit import beta_util
flag_age=0
flag_date=0
flag_yes=0
st.title("Welcome to my Birthday Quiz")
st.write("""
## Let's start with the first question
""")
age=st.slider("How old will I turn this year ?",28,35)
if age==30:
st.markdown("<h1... | true |
d75d8cd2a60f9cda22c4ea572d2b9d319680c846 | cook1804/flask_web | /dbmake.py | UTF-8 | 2,031 | 3.1875 | 3 | [] | no_license | import pymysql
# db 접속 하기위에 connect 메소드 사용.
db = pymysql.connect(
host ='localhost',
port = 3306,
user = 'root',
passwd = '1234',
db = 'busan'
)
sql = '''
CREATE TABLE `topic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL,
`body` text NOT NULL,
`author... | true |
8d677e998f86af55c8fdbec0f36fee2b408a0f6d | takuya0412/AOJ | /ALDS1/1_3_B_Queue.py | UTF-8 | 441 | 2.890625 | 3 | [] | no_license | N, q = map(lambda x:int(x),input().strip().split(' '))
in_data = []
for i in range(N):
a, b = input().strip().split(' ')
in_data.append([a, int(b)])
res_data = []
cnt = 0
while len(in_data):
tgt = in_data.pop(0)
if tgt[1] <= q:
total = cnt + tgt[1]
res_data.append([tgt[0], total])
... | true |
44f17621c39113cd34ff72a6fece6daacd5db805 | sheng3690/DataScience | /Project/classification/Iris/iris.py | UTF-8 | 3,777 | 2.875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import model_selection,linear_model
# read data
iris_data=pd.read_csv('iris.csv',header=None,names=['sepal length','sepal width','petal length','petal width','classes']) #.data文件可以直接用pandas中的read_csv读取,返回DataFrame
# different class at... | true |
ed83140510dfd4558c0b53266f24f8cb9620fdc8 | cdcunnin/PHYS202-S13 | /Midterm/Electrostatics.py | UTF-8 | 818 | 3.5625 | 4 | [] | no_license | import numpy as np
def dipolePotential(x,y,q1,q2,d):
"""This takes the charges and distance between two particles"""
#and gives you the potential at an x-y point.
k = 8.99*(10**9)
P = ((k*q1)/((x**2) + (y - d)**2)**1/2) - ((k*q2)/((x**2) + (y + d)**2)**1/2)
return P
def pointPotential(x,y,q,posx,p... | true |
d811d11ba2718df404f4b659923c11558866c8f0 | Ynjxsjmh/PracticeMakesPerfect | /LeetCode/p0200/I/number-of-islands.py | UTF-8 | 3,049 | 3.5625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# ********************************************************************************
# Copyright © 2022 Ynjxsjmh
# File Name: number-of-islands.py
# Author: Ynjxsjmh
# Email: ynjxsjmh@gmail.com
# Created: 2022-07-02 13:07:33
# Last Updated:
# By: Ynjxsjmh
# Description: Given an `m x n`... | true |
1e77af45d3d733aa980848d9005d4cb444ce5127 | VigoWong/UNSW_summary | /9021/9021final/2019T1PRE/exercise_3.py | UTF-8 | 1,313 | 3.234375 | 3 | [] | no_license | from math import sqrt
import operator
from itertools import compress
from collections import defaultdict
def p(n):
sie = bytearray([True]) * (n//2)
for i in range(3, int(n**0.5)+1, 2):
if sie[i//2]:
sie[i*i//2::i] = bytearray((n-i*i-1)//(2*i)+1)
return [2, *compress(range(3, n, 2), sie... | true |
c4c347bb00dce85ea30357b4ec81e729d73af5e4 | catSirup/coding_test | /Ace_Project_CodingTest/test.py | UTF-8 | 976 | 3.8125 | 4 | [] | no_license | # 정수로 이루어진 배열이 있습니다.
# 배열을 좌우 두 부분으로 갈랐을 때, 각 배열의 원소의 합 간 차이를 최소로 하려고 합니다.
# 이렇게 차이를 최소화하도록 갈랐을 때, 왼쪽 배열의 원소의 개수를 반환하는 함수를 작성해 주세요.
# 만약 차이를 최소화하는 방법이 여러 가지가 있다면 왼쪽 배열의 원소의 개수를 최소화하는 답을 반환하세요.
# 한쪽 배열을 비워 두는 것도 가능하며, 빈 배열의 원소의 합은 0으로 정의합니다.
def solution(n, v):
answer = 0
_min = 0
for i in range(0, n +... | true |
7c65cfcefe6d0773903720bf31e2214bfdae2623 | kwaters/hacks | /ff-13-2-clock/clock.py | UTF-8 | 1,389 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
"""Clock puzzle sover for FF XIII-2."""
import argparse
import pprint
import exactcover
def create_grid(clock):
"""Turn the clock into an exact cover problem."""
size = len(clock)
m = []
# Each of the two moves from each number
for i, v in enumerate(clock):
m.appen... | true |
b6573bd698f38390218b389e97cdeee5509f53f5 | Aasthaengg/IBMdataset | /Python_codes/p02399/s626871249.py | UTF-8 | 119 | 2.515625 | 3 | [] | no_license | line = map(float, raw_input().split(" "))
print "%d %d %f" % (line[0] / line[1], line[0] % line[1], line[0] / line[1]) | true |
fa337538d817287b1c5cffe2cca824defe065d7c | JQIamo/Wavemeter-Dashboard | /wavemeter_dashboard/config.py | UTF-8 | 795 | 3.046875 | 3 | [] | no_license | import json
class Config:
def __init__(self, path=''):
self.path = ''
self.config_dict = {}
if path:
self.load_config(path)
def load_config(self, path):
self.path = path
with open(self.path) as f:
self.config_dict = json.load(f)
def has(s... | true |
a6354f533b6937edb91cd24d4e5379b5226eb001 | beni55/AuleFree | /FreeRoom.py | UTF-8 | 3,898 | 2.796875 | 3 | [] | no_license | __author__ = 'darka'
from datetime import datetime
from datetime import timedelta
from UniCalendarMulti import getcalendar
from model import Event
import json
import os.path
from optparse import OptionParser
CACHE_FILE_NAME = 'eventList.json'
def freeroom(t, eventlist, place=''):
result = []
for e in eventli... | true |
4228b71de29ab969a39a870cd556ac277455c919 | kopok2/CodeforcesSolutionsPython | /src/940B/test_cdf_940B.py | UTF-8 | 1,313 | 2.53125 | 3 | [
"MIT"
] | permissive | import unittest
from unittest.mock import patch
from cdf_940B import CodeforcesTask940BSolution
class TestCDF940B(unittest.TestCase):
def test_940B_acceptance_1(self):
mock_input = ['9', '2', '3', '1']
expected = '6'
with patch('builtins.input', side_effect=mock_input):
Soluti... | true |
dccb19137f34da60f33440db5077a36ff46002ff | zxynus/scrapy-finance | /text/spiders/bloomberg.py | UTF-8 | 3,106 | 2.765625 | 3 | [
"MIT"
] | permissive | import os
import scrapy
from scrapy.spiders import CrawlSpider
from w3lib.html import remove_tags, remove_tags_with_content
class BloombergSpider(CrawlSpider):
name = 'bloomberg'
handle_httpstatus_list = [200, 404]
allowed_domains = ['bloomberg.com']
start_urls = ['https://www.bloomberg.com/markets']... | true |
e29d393ef26172f35c9dfd8a979fb80f81b16962 | TenninYan/cirq-qulacs | /benchmark/qulacs_bench_20191119/benchmark_plot_fix.py | UTF-8 | 1,931 | 2.59375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import csv
cmap = plt.get_cmap("tab10")
def plot(path, name,linestyle,color):
fin = open(path)
dat = {}
reader = csv.reader(fin, delimiter=",")
next(reader)
for row in reader:
n, _, t = row
n = int(n)
t = floa... | true |
2e616f9b910f132a07e52c7a7c026094959968d5 | Borys-karton/LabPython | /Spotkanie7/Zad3_Odwroc_el_tablicy.py | UTF-8 | 183 | 3.375 | 3 | [] | no_license | array = [1,3,5,3,7,1,9,3]
print(array)
array.reverse()
print(array)
import array
my_array = array.array('i', [1,3,5,3,7,1,9,3])
my_array.reverse()
for i in my_array:
print(i) | true |
792913b769a5f6c98b9f5bb800dc4b44ef95371b | buaabyl/wasm | /wasm/decode.py | UTF-8 | 2,078 | 2.65625 | 3 | [
"MIT"
] | permissive | """Provides functions for decoding WASM modules and bytecode."""
from __future__ import print_function, absolute_import, division, unicode_literals
from collections import namedtuple
from .modtypes import ModuleHeader, Section, SEC_UNK, SEC_NAME, NameSubSection
from .opcodes import OPCODE_MAP
from .compat import byte2... | true |
a74a3f015b857c0a663df762a146cb44d4b98873 | hespozel/Trab2_DataScience | /SVD 3.py | UTF-8 | 2,530 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 11 12:01:34 2017
@author: hespo
"""
#%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from numpy import linalg as LA
import time
from PIL import Image
import os
os.chdir("C:/Users/hespo/OneDrive/Documentos/GitHub/Trab2_DataScience/gs")
cwd = os.getc... | true |
8cc7ca1a284ec6f62253365b9a16b41878634ae3 | lukewaller00/AlexaSpellingTest | /lambda/utils.py | UTF-8 | 4,650 | 2.875 | 3 | [] | no_license | import logging
import os
import boto3
from botocore.exceptions import ClientError
from ask_sdk_core.handler_input import HandlerInput
from ask_sdk_dynamodb.adapter import DynamoDbAdapter
ddb_region = os.environ.get('DYNAMODB_PERSISTENCE_REGION')
ddb_table_name = os.environ.get('DYNAMODB_PERSISTENCE_TABLE_NAME')
ddb_... | true |
2f4dd4f02594e253ce6b4fe7e1db686e5aed3c45 | intel-ctrlsys/actsys | /datastore/datastore/utilities.py | UTF-8 | 5,952 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Intel Corp.
#
"""
Common utilities that DataStore users or implementers need.
"""
import json
from os import linesep
from ClusterShell.NodeSet import expand, fold, grouplist, NodeSetParseError
class DeviceUtilities(object):
"""
Utilities for handling device names... | true |
53285deab1e6b7cd7a0d8ee336eef70dda3508fb | drlongle/leetcode | /algorithms/problem_1197/leetcode2.py | UTF-8 | 1,864 | 3.640625 | 4 | [] | no_license | class Solution:
def minKnightMoves(self, x: int, y: int) -> int:
# the offsets in the eight directions
offsets = [(1, 2), (2, 1), (2, -1), (1, -2),
(-1, -2), (-2, -1), (-2, 1), (-1, 2)]
# data structures needed to move from the origin point
origin_queue = deque([(... | true |
4d5825eb5cc6100f45d6fb532547b6d26bc9173f | ATarsky23/Year9DesignPythonAT | /Takinginputs.py | UTF-8 | 586 | 3.90625 | 4 | [] | no_license | #Comments are made with a #
#It is essentail you comment
#code
#This program will take to intergers
#Input
#The input function returns the string the user end
#All inputs start as Strings
#Casting is the proscess of changing type
#To change the type of variuble you "cast" i
name=input("Please input your name: ")
a=i... | true |
2a63c3dd219b7596da4ec94bcb8daa5cc03b8871 | MicroTransactionsMatterToo/Wet_Ferret_Engine | /V1/RPG Game.py | UTF-8 | 2,150 | 3.15625 | 3 | [] | no_license | #Copyright Wet Ferret Studios 2015
#Initialize Player Stats
playerstats = {
"health": 100,
"name": 'Gerald Lagley',
'inventory': [],
'damagemult': 0,
}
#Initialize Rooms
roomnumberint = 000000
roomnumber = str(roomnumberint)
room = {
'0':{
'name': 'Start Room',
'i... | true |
89923847c50dbb79084e80c8e930c2fbbb09a1e8 | valtron/symbench-athens-client | /symbench_athens_client/athens_client.py | UTF-8 | 3,527 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import logging
import time
import api4jenkins
from api4jenkins.exceptions import ItemNotFoundError
from symbench_athens_client.exceptions import JobFailedError
from symbench_athens_client.utils import get_logger
__all__ = ["SymbenchAthensClient"]
class SymbenchAthensClient:
"""The client to the symbench athens... | true |
5f0234d31b106e39bb1ed05e5d1a8087a6d18bd3 | sathayas/AnalyticsClassSpring2019 | /netStatsExamples/DegreeDistFacebook.py | UTF-8 | 532 | 2.9375 | 3 | [] | no_license | import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
# loading network data
G_facebook = nx.read_edgelist('facebook_combined.edgelist') # facebook
# degree distribution, against ranks, log-log
k_facebook = [d for n, d in G_facebook.degree()]
sk_facebook = sorted(k_facebook, reverse=True)
rank_fa... | true |
2ec88f5f0bde3e738191fad379baa50aee59d1bc | mindcrusher11/Mytest | /processWords/page.py | UTF-8 | 1,256 | 2.640625 | 3 | [] | no_license | import time
import tweepy
# == OAuth Authentication ==
#
# This mode of authentication is the new preferred way
# of authenticating with Twitter.
# The consumer keys can be found on your application's Details
# page located at https://dev.twitter.com/apps (under "OAuth settings")
#consumer_key="hhYq78kZ6VkAp4Q4pXzuKC... | true |
b6d32a4a993910ebc12ec8f4d9845a3d8ca49631 | OverflowException/inidividual_project | /multiple_tracker/python/extmovdata.py | UTF-8 | 1,585 | 3.375 | 3 | [] | no_license | import sys
import re
def extract(filename):
"""pass data filename, return tracks of x coordinates and y coordinates and number of objects"""
try:
fd = open(sys.argv[1], 'r')
except IOError:
print("Cannot open " + filename)
#regular expressions
header_pattern = re.compile("... | true |
10f379c2f7e25d59486293bff8934cbfccbe40f5 | aksharanigam1112/MachineLearningIITK | /packageML01/Practical27.py | UTF-8 | 818 | 3.734375 | 4 | [
"MIT"
] | permissive |
d = { 'A' : 'Java' , 'C' : 'Android' , 'D' : 'Python' , 'E':'Hadoop' , 'Key' : 'Value' , 'B' : 'J2ee'}
print(d)
del d['E']
print("\nAfter deletion of 'E' = ",d)
print("d['B'] = ",d['B'])
# print("d[2] = " , d[2]) Dictionary does not support positional indexing
print("len(D) = " , len(d))
print("'A' in d" , 'A' in... | true |
5199323fac4e839892a0eda812af172df114dcfb | berkturetken/UU-Game | /CommunicationPlatform/Tests/test_tournament.py | UTF-8 | 1,413 | 3.4375 | 3 | [] | no_license | import tournament as t
import random
def main():
players = 4
player_list = []
player_name = ["Pettersson", "Undran", "Ola", "Mr.X", "Bumbi-Bu", "Pelle", "Gerald", "Ronald", "Nisse", "Megamen", "Baby-Jesus", "Tyke", "Kim", "Q"]
for i in range(players):
temp = random.choice(player_name)
p... | true |
ffdc1ac4422f43995f2279073d948ff5668575a1 | gandlurisuma/python | /lab7-time_reversal.py | UTF-8 | 622 | 3.21875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import math
j=np.complex(0,1)
a=input("enter length of input")
f=0
x1=np.zeros(a)
x2=np.zeros(a)
for b in range(0,a):
c=input("enter value")
x1[b]=c
for d in range(0,a):
x2[d]=x1[a-d-1]
print(x1)
print(x2)
def DFT(x):
N=100
w=np.linspace(-np.pi,np.pi,N)
y=[]
fo... | true |
1bfa05551542aa33897929e4d56f1826a1dc815f | zozers/Karuta-google-sheet | /sheets.py | UTF-8 | 1,230 | 2.609375 | 3 | [] | no_license | import os, json
from dotenv import load_dotenv
import pygsheets
load_dotenv()
#authorization
gc = pygsheets.authorize(service_account_env_var = 'GOOGLE_JSON')
wks = gc.open('Karuta storage example for my bot')[0]
def getRowbyId(cardId, sheet):
for i in range(1, sheet.rows):
if(sheet.cell((i,3)).value == cardId):
... | true |
3be84e0256d4fc8492a3acaca9bc46eaf38be9f7 | AyushChatto/Advent-of-Code-solutions | /Day 10: Challenge 1.py | UTF-8 | 981 | 3.140625 | 3 | [] | no_license | n = input("Number list length (256 for the official question) ")
listOfNumbers = range(0,n)
currentPosition = 0
lengths = map(int, raw_input().split(','))
skipSize = 0
for currentLength in lengths:
if currentLength+currentPosition < n:
temp = listOfNumbers[currentPosition: currentLength+currentPosition]... | true |
7af346c11d4c749f92fb8fbcb3aab391c736e4c1 | skywallkee/Cinema-Python | /service/Service.py | UTF-8 | 14,222 | 2.75 | 3 | [] | no_license | import datetime
class Service:
def __init__(self, repo):
self.repository = repo
def filterFilme(self, filterOption):
"""
Returneaza lista de filme ce contine cuvantul cheie filterOption in id, titlu, an, pret sau program
Date intrare: filterOption - string
Date iesi... | true |
fdbd97e5d69444535dc5a17f6da8ea4dfe86391c | nathanlatino/traitement-image | /2ModelisationImage/exercice2.py | UTF-8 | 628 | 3.0625 | 3 | [] | no_license | import cv2
import numpy as np
from matplotlib import pyplot as plt
def gray_image(img):
return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
def hist_gray(img):
plt.hist(gray_image(img).ravel(), 256, [0, 256])
plt.title('Histogram for gray scale image')
plt.show()
def hist_color(img):
color = ('b','g','r')
for i,col ... | true |
378ed3d1c744fa57bbe76a90831d268067a98d81 | SuHyeonJung/iot_python2019 | /03_Bigdata/02_Standardization_Analysis/3. DB/00db_mysql_load_from_csv_with_pk.py | UTF-8 | 1,227 | 3.015625 | 3 | [] | no_license | import csv
import MySQLdb
import sys
from datetime import datetime, date
#Path to and name of a CSV input file
input_file = sys.argv[1] # Basic_Student_Info.csv
#db: Database명 create database my_suppliers <= 이렇게 생선한 db명과 매칭
# con = MySQLdb.connect(host='localhost', port= 3306, db='my_student', user = 'root', passwd =... | true |
c8c226ef8b43db513ca39cf70d3721c34441e808 | SiWonSeong/RL_practice | /utils.py | UTF-8 | 1,765 | 3.03125 | 3 | [] | no_license | import torch
import numpy as np
import matplotlib.pyplot as plt
def cosine_fun(x):
noise = np.random.rand(x.shape[0]) * 0.4 - 0.2 # ε ~ U(0, 1) → ε ~ U(-0.2, 0.2)
return np.cos(1.5 * np.pi * x) * x + noise # f(x) = cos(1.5 π * x) + x + ε
def plot_results(model):
x = np.linspace(0, 5, 100)
input_x = to... | true |
0c156280494a2afa7725903ced8ff3a5abdb7ecf | yotamlevit/Shell | /temp.py | UTF-8 | 647 | 3.328125 | 3 | [] | no_license | import os
import binascii
FILE_PATH = "C:/Users/cyber/Documents/GitHub/shell/bin.txt"
def is_file(path):
return os.path.isfile(path)
def converter(text):
hex_text = binascii.hexlify(text)
count = 0
hex_ret = ""
for char in hex_text:
count += 1
if count == 2:
hex_ret +=... | true |
082ef1029c0b15bcf2fc66e0228680c605c2f77a | SCRK16/ProjectEuler | /src/1-100/15.py | UTF-8 | 172 | 2.78125 | 3 | [] | no_license | import sys
sys.path.append("..")
from euler import factorial
def nCk(n, k):
return factorial(n) // (factorial(k) * factorial(n-k))
result = nCk(40, 20)
print(result)
| true |
b99d0998f8074e08efaa5e66e72b20a58b7e3e3f | Aasthaengg/IBMdataset | /Python_codes/p03486/s584948672.py | UTF-8 | 264 | 3.328125 | 3 | [] | no_license | s = sorted(list(input()))
t = sorted(list(input()))[::-1]
for S, T in zip(s, t):
if S < T:
print('Yes')
exit()
elif S > T:
print('No')
exit()
else:
continue
print('Yes' if len(s) < len(t) else 'No') | true |
bbad353bbc6b1fbac2ae16038e5b9ce636f59084 | VeroMorera/python_basico_2_2019 | /semana06/subfolder/archivo3.py | UTF-8 | 161 | 2.96875 | 3 | [] | no_license | #ejemplo de modulo en subfolder
a=1
b=2
class Pato:
def __init__(self):
print('soy un pato')
def camina(self):
print('el pato camina') | true |
2fe36a0d31cc0b4311aca5677452dad4807c1171 | RoeeLupo/IreneBot | /module/Youtube.py | UTF-8 | 4,642 | 2.515625 | 3 | [] | no_license | from discord.ext import commands, tasks
import aiohttp
from bs4 import BeautifulSoup as soup
from datetime import *
import asyncio
from module import logger as log
from Utility import fetch_all, fetch_one, DBconn, c
class Youtube(commands.Cog):
def __init__(self, client):
self.client = client
pass... | true |
b2453ccb867c6e7e3ccc0d7b6cf1bb758233591b | soeaxy/Cal_PI | /Cal_PI.py | UTF-8 | 1,194 | 3.765625 | 4 | [] | no_license | # coding:utf-8
# Calculate the value of PI using the Monte Carlo method
import math
import random
import matplotlib.pyplot as plt
import numpy as np
# Calculate the root mean square of two numbers or radius
def cal_r(x,y):
return math.sqrt(x*x+y*y)
# Draw a circle
def draw_round(x):
return math.sqrt(1-x*x)... | true |
382ce2bdcd5349c026963ee1297d4400d0c8161b | pedroromn/pywork | /pycode/binary_to_decimal.py | UTF-8 | 506 | 3.90625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Date: 28/08/2015
author: peyoromn
"""
"""
Converts a string of bits to decimal integer
"""
def binary_to_decimal(bstring):
decimal = 0
exponent = len(bstring) - 1
for digit in bstring:
decimal = decimal + int(digit) * 2 ** exponent
exponent -= 1
return decimal
... | true |
905da93b4e5b8a49dfdf9860ff6b43c7427bb3e9 | GabeQ/ReconstructingPhylogeneticTrees | /infeasibilitySearch.py | UTF-8 | 896 | 2.734375 | 3 | [] | no_license | # Searches outfiles from NNIHeuristic to look for cases where infeasible trees were found.
# Chen Pekker, June 2016
import shutil
import os
for folderName, subfolders, filenames in os.walk('/Users/cssummer16/Documents/100e6-1x/'): #need to change this for every directory
for filename in filenames:
string... | true |
c640898a965d38395a5cb43e9a01f1df8310d14e | VinayHaryan/Object-Oriented-Programing | /IheritanceObjIssubclassSuper.py | UTF-8 | 5,570 | 4.84375 | 5 | [] | no_license | '''
OOP in Python | Set 3 (Inheritance, examples of object, issubclass and super)
In this article, Inheritance is introduced.
One of the major advantages of Object Oriented Programming is re-use.
Inheritance is one of the mechanisms to achieve the same.
In inheritance, a class (usually called superclass) is ... | true |
bfab9a105dc0ba581b217e9498cfc30b2a63a81f | lukemartinlogan/bossa-test-algorithm | /Algorithms.py | UTF-8 | 2,282 | 2.9375 | 3 | [] | no_license |
import lmfit, math, numpy as np
from collections import Counter
def loc_model1(params, x, y, prox):
x0 = params['x0']
y0 = params['y0']
t = (x - x0)**2 + (y - y0)**2 - prox
t = t**2/prox**2
return np.sqrt(t)
def loc_model2(params, x, y, prox):
x0 = params['x0']
y0 = p... | true |
f968efca6c03054f0877dd6c59a62173994d1c3b | max-zia/aks-primality-test | /aks2.py | UTF-8 | 3,636 | 3.625 | 4 | [] | no_license | """
Successful implementation of aks primality test.
"""
from math import log, sqrt, floor
def aks_test(n):
"""
Implement the AKS primality test.
"""
# Check if n is a perfect power. If so, return composite.
if is_perfect_power(n):
return "composite"
# Find the smallest r such th... | true |
5f2388b3018f312f9441f18c04ab73411a390ad8 | LinhVu1027/Reversi-ServerNodeJS-ClientPython-AI-Solved | /examples/python-client.py | UTF-8 | 7,534 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python2
from copy import deepcopy
from socketIO_client import SocketIO
my_board = []
socketIO = None
def updateBoard(data):
""" Server inform me that board has been updated
"""
global my_board
my_board = data['board']
print "**************************************"
print '\n'.j... | true |
b919274455d86624dc3544cb1900f54911395376 | ksomemo/Competitive-programming | /atcoder/abc/109/B.py | UTF-8 | 629 | 3.890625 | 4 | [] | no_license | def main():
"""
はじめ、好きな単語を発言する
以降、次の条件を満たす単語を発言することを繰り返す
その単語はまだ発言していない単語である
その単語の先頭の文字は直前に発言した単語の末尾の文字と一致する
"""
N = int(input())
W = [input() for _ in range(N)]
ans = AC(N, W)
print(ans)
def AC(N, W):
for i, w in enumerate(W[1:]):
if W.count(w) >= 2:
... | true |
f8719960b063affbb366e3522d3ae9fd8d5eb2a1 | XIAOQUANHE/pythontest | /requests/Requests/test_api_05_certificate.py | UTF-8 | 453 | 2.828125 | 3 | [] | no_license | # 举例说明,携程网
import requests as rs
url = 'https://www.ctrip.com'
# 解决方案1
# 发送请求时候忽略证书,证书的参数verify-用的比较多
r = rs.get(url=url,verify=False) # verify参数默认为True,值为FALSE 表示忽略证书
print(r.text)
# 解决方案2,verify里面添加证书的路径
r = rs.get(url=url,verify='路径') # verify参数默认为True,值为FALSE 表示忽略证书
print(r.text) | true |
6822668bfe652d162217459d41421ce0feb53bae | yxx94/2020- | /jianzhioffer/笔试题辅助代码.py | UTF-8 | 1,982 | 3.671875 | 4 | [] | no_license | # coding=utf-8
# 0~9999 中有多少个数字 5
count = 0
for i in range(9999):
count += str(i).count('5')
print(count)
'''
# a, b 互换值
a^=b # ^ 或运算
b^=a
a^=b
'''
# 十进制转Y进制
def NumToABC(intN):
if intN in [0,1,2,3,4,5,6,7,8,9]:
return intN
if intN ==10 :
return 'A'
if intN ==11 :
return '... | true |